#theme-media {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	pointer-events: none;
}

#theme-media img,
#theme-media video {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

#theme-webcam {
	display: block;
	max-width: none;
	max-height: none;
}

/* Desaturate 75% then tint wash (tint overlay is separate) — same spirit as block recolor. */
body.has-bg-tint:not(.has-bg-cycle) #theme-media img,
body.has-bg-tint:not(.has-bg-cycle) #theme-media video,
body.has-bg-tint:not(.has-bg-cycle) #theme-webcam {
	filter: grayscale(0.75);
}

/* Backdrop-only hue cycle (GPU filter) — never applied to the block atlas.
   Full spectrum over ~60s. Angle property keeps the loop continuous (no
   orange→blue→snap-back from filter resets). */
@property --bg-hue {
	syntax: "<angle>";
	inherits: false;
	initial-value: 0deg;
}

body.has-bg-cycle:not(.has-bg-tint) #theme-media img,
body.has-bg-cycle:not(.has-bg-tint) #theme-media video,
body.has-bg-cycle:not(.has-bg-tint) #theme-webcam {
	--bg-hue: 0deg;
	filter: hue-rotate(var(--bg-hue));
	animation: bg-hue-cycle 60s linear infinite;
}

body.has-bg-cycle.has-bg-tint #theme-media img,
body.has-bg-cycle.has-bg-tint #theme-media video,
body.has-bg-cycle.has-bg-tint #theme-webcam {
	--bg-hue: 0deg;
	filter: hue-rotate(var(--bg-hue)) grayscale(0.75);
	animation: bg-hue-cycle 60s linear infinite;
}

@keyframes bg-hue-cycle {
	from {
		--bg-hue: 0deg;
	}
	to {
		--bg-hue: 360deg;
	}
}


#theme-webcam[hidden] {
	display: none !important;
}

body.has-theme-media #canvas {
	background-color: transparent !important;
}

body.has-webcam-bg #canvas,
body.has-webcam-bg #animation_container,
body.has-webcam-bg.is-playing #canvas,
body.has-webcam-bg.is-playing #animation_container,
body.has-webcam-bg.no-theme-bg #canvas,
body.has-webcam-bg.no-theme-bg #animation_container {
	background-color: transparent !important;
}

#play-chrome {
	position: absolute;
	inset: 0;
	z-index: 12;
	pointer-events: none;
	font: 700 calc(11 * 100cqh / 300) / 1 Orbitron, Arial, Helvetica, sans-serif;
	color: #000;
}

#play-chrome,
#play-menu,
#play-pass,
#play-moves,
#play-time,
#play-stage-name,
#play-pass-lab,
#play-moves-lab,
#play-time-lab,
#play-pass-val,
#play-moves-val,
#play-time-val {
	text-shadow:
		0 0 1px #fff,
		0 0 0.45cqh #fff,
		0 0 1.1cqh #ffc070,
		0 0 2cqh #ff6a18;
}

#play-menu {
	pointer-events: auto;
	box-sizing: border-box;
	position: absolute;
	left: 2.18%;
	top: 2.5%;
	width: auto;
	max-width: 42%;
	height: 7%;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	font: 700 calc(11 * 100cqh / 300) / 1 Orbitron, Arial, Helvetica, sans-serif;
	color: #000;
	text-shadow:
		0 0 1px #fff,
		0 0 0.45cqh #fff,
		0 0 1.1cqh #ffc070,
		0 0 2cqh #ff6a18;
	letter-spacing: 0;
	text-align: left;
	white-space: nowrap;
	cursor: pointer;
}

#play-menu:focus {
	outline: none;
}

#play-pass,
#play-moves {
	position: absolute;
	left: 69.6%;
	width: 27.3%;
	height: 6.67%;
	display: grid;
	grid-template-columns: 57% 43%;
	align-items: center;
	column-gap: 0;
	letter-spacing: 0;
	white-space: nowrap;
}

#play-time {
	position: absolute;
	left: 69.6%;
	width: 27.3%;
	top: 7.2%;
	height: 6.67%;
	display: grid;
	grid-template-columns: 57% 43%;
	align-items: center;
	column-gap: 0;
	box-sizing: border-box;
	letter-spacing: 0;
	white-space: nowrap;
	color: #000;
	pointer-events: none;
}

#play-chrome.has-pass #play-time {
	top: 13.8%;
}

#play-chrome.has-play-time #play-moves {
	/* keep moves row; time sits under it */
}

#animation_container.has-speedrun #play-pass,
#animation_container.has-speedrun #play-moves,
#animation_container.has-speedrun #play-time,
#play-chrome.has-speedrun #play-pass,
#play-chrome.has-speedrun #play-moves,
#play-chrome.has-speedrun #play-time {
	/* Sit closer to the speedrun panel — previous 52% left a wide empty gap. */
	left: 58%;
	width: 28%;
}

#play-pass,
#play-moves { top: 0.17%; }
#play-chrome.has-pass #play-moves { top: 6.83%; }

#play-pass-lab,
#play-moves-lab,
#play-time-lab {
	text-align: right;
	padding-right: 4%;
}

#play-pass-val,
#play-moves-val,
#play-time-val {
	font: 700 calc(11 * 100cqh / 300) / 1 Orbitron, Arial, Helvetica, sans-serif;
	letter-spacing: 0.22em;
	text-align: left;
}

#play-stage-name {
	position: absolute;
	left: 50%;
	top: 2.5%;
	z-index: 12;
	box-sizing: border-box;
	width: max-content;
	max-width: 40%;
	min-height: 7%;
	height: auto;
	margin: 0;
	padding: 0;
	transform: translateX(-50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	overflow: hidden;
	white-space: nowrap;
	letter-spacing: 0.08em;
	font: 700 calc(11 * 100cqh / 300) / 1 Orbitron, Arial, Helvetica, sans-serif;
	color: #000;
}

#play-stage-name[data-sub]::after {
	content: attr(data-sub);
	display: block;
	margin-top: 0.15em;
	font-size: 0.78em;
	font-weight: 600;
	opacity: 0.88;
	letter-spacing: 0.06em;
}

#play-help {
	position: absolute;
	left: 14.6%;
	top: 88.6%;
	width: 71.5%;
	margin: 0;
	z-index: 12;
	pointer-events: none;
	font: 700 calc(11 * 100cqh / 300) / 1.2 Orbitron, Arial, Helvetica, sans-serif;
	color: #fff;
	text-shadow: 0 0 0.3cqh #ff5a18, 0 0 0.6cqh #c43800;
}

#play-help[hidden] {
	display: none !important;
}

#stage-card {
	position: absolute;
	left: 25.2%;
	top: 45.2%;
	width: 40%;
	height: 14%;
	z-index: 14;
	margin: 0;
	pointer-events: none;
	display: flex;
	align-items: center;
	text-align: left;
	font: 700 calc(28 * 100cqh / 300) / 1 Orbitron, Arial, sans-serif;
	letter-spacing: 0.16em;
	color: #fff;
	text-shadow: 0 0 0.4cqh #ff6a18, 0 0 1cqh #c44810, 0 0 1.8cqh #a03008;
}

#howto-page,
#howto-copy {
	position: absolute;
	z-index: 14;
	margin: 0;
	pointer-events: none;
	color: #fff;
	text-shadow: 0 0 0.4cqh #ff4a12, 0 0 0.8cqh #c43000;
	font: 700 calc(11 * 100cqh / 300) / 1.45 Orbitron, Arial, Helvetica, sans-serif;
}

#howto-page {
	left: 2.1%;
	top: 36.8%;
	font-size: calc(11 * 100cqh / 300);
	letter-spacing: 0.02em;
}

#howto-copy {
	left: 1.6%;
	top: 47.2%;
	width: 96.8%;
	height: 34%;
	white-space: pre-wrap;
	overflow: hidden;
}

#pause-stats {
	position: absolute;
	/* Fallback before the first sync; JS retargets left/top to the sliding stats clip. */
	left: 67.5%;
	top: 48%;
	transform: none;
	z-index: 14;
	pointer-events: none;
	font: 700 calc(11 * 100cqh / 300) / 1.75 Orbitron, Arial, Helvetica, sans-serif;
	color: #fff;
	text-shadow: 0 0 0.4cqh #c45a18;
	min-width: 11em;
	text-align: left;
	padding: 0.7em 0.35em 0.35em 0.55em;
	box-sizing: border-box;
}

#pause-time,
#pause-stage,
#pause-tries {
	display: grid;
	grid-template-columns: 6.6em 1fr;
	column-gap: 0.55em;
	align-items: baseline;
}

#pause-stats .lab {
	text-align: left;
	white-space: nowrap;
}

#pause-stats .val {
	letter-spacing: 0.14em;
	font-weight: 700;
	text-align: left;
	justify-self: start;
	font-variant-numeric: tabular-nums;
}

#howto-nav,
#pause-nav {
	position: absolute;
	inset: 0;
	z-index: 15;
	pointer-events: none;
}

#howto-nav {
	inset: auto 0 0 0;
	height: 16%;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto auto auto;
	align-items: center;
	column-gap: 1.4%;
	padding: 0 1.8% 1.4%;
	box-sizing: border-box;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.18) 70%, transparent);
}

#howto-nav button,
#pause-nav button {
	pointer-events: auto;
	position: absolute;
	box-sizing: border-box;
	margin: 0;
	padding: 0.15em 0.2em;
	border: 0;
	background: transparent;
	color: #fff;
	font: 700 calc(11 * 100cqh / 300) / 1.15 Orbitron, Arial, Helvetica, sans-serif;
	text-shadow: 0 0 0.4cqh #ff4a12, 0 0 0.8cqh #c43000;
	white-space: nowrap;
	cursor: pointer;
	text-align: center;
	overflow: hidden;
	text-overflow: ellipsis;
}

#howto-nav button {
	position: relative;
	left: auto;
	top: auto;
	width: auto;
	height: auto;
	max-width: 100%;
	transform: none;
	min-width: 0;
}

#howto-nav button.is-focus,
#pause-nav button.is-focus {
	text-shadow: 0 0 0.5cqh #fff, 0 0 1cqh #ff6a18;
}

#howto-back {
	grid-column: 1;
	justify-self: start;
	text-align: left;
}

#howto-skip {
	grid-column: 2;
	justify-self: end;
}

#howto-prev {
	grid-column: 3;
	justify-self: end;
}

#howto-next,
#howto-start {
	grid-column: 4;
	justify-self: end;
}

#pause-return { left: 10%; top: 47.6%; width: auto; height: auto; text-align: left; }
#pause-sound { left: 10%; top: 54.6%; width: auto; height: auto; text-align: left; }
#pause-quit { left: 10%; top: 61.6%; width: auto; height: auto; text-align: left; }

#play-select {
	position: absolute;
	z-index: 14;
	margin: 0;
	pointer-events: none;
	transform: translate(-50%, -100%);
	font: 700 calc(11 * 100cqh / 300) / 1 Orbitron, Arial, Helvetica, sans-serif;
	color: #fff;
	text-shadow: 0 0 0.4cqh #ff4a12, 0 0 0.8cqh #c43000;
	letter-spacing: 0.12em;
}

#hud-theme-select,
#hud-locale-select,
#hud-theme-upload-btn,
#hud-theme-template-btn,
#hud-theme-manage-btn,
.hud-dd-btn,
.hud-dd-menu,
.hud-dd-opt {
	pointer-events: auto;
}

.hud-dd {
	position: absolute;
	z-index: 30;
}

.hud-dd.is-open {
	z-index: 50;
}

.hud-dd-btn,
#hud-theme-upload-btn,
#hud-theme-template-btn,
#hud-theme-manage-btn {
	box-sizing: border-box;
	height: 20px;
	padding: 0 18px 0 6px;
	font: 700 11px Orbitron, sans-serif;
	color: #ffe6c4;
	background: #1a120c;
	border: 1px solid #c45a18;
	cursor: pointer;
}

.hud-dd-btn {
	width: 100%;
	text-align: left;
	background-image: linear-gradient(45deg, transparent 50%, #ffe6c4 50%),
		linear-gradient(135deg, #ffe6c4 50%, transparent 50%);
	background-position: calc(100% - 10px) 8px, calc(100% - 6px) 8px;
	background-size: 4px 4px, 4px 4px;
	background-repeat: no-repeat;
}

.hud-dd-menu {
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	z-index: 40;
	max-height: 180px;
	margin: 0;
	padding: 2px 0;
	overflow-x: hidden;
	overflow-y: auto;
	background: #1a120c;
	border: 1px solid #c45a18;
}

.hud-dd-opt {
	display: block;
	width: 100%;
	margin: 0;
	padding: 4px 6px;
	border: 0;
	background: transparent;
	color: #ffe6c4;
	font: 700 11px Orbitron, sans-serif;
	text-align: left;
	cursor: pointer;
}

.hud-dd-opt.is-current,
.hud-dd-opt:hover,
.hud-dd-opt:focus {
	background: #c45a18;
	color: #fff;
}

#dom_overlay_container.is-dd-open,
#animation_container.is-dd-open {
	overflow: visible;
}

#hud-theme-select {
	left: 36%;
	top: 48.5%;
	width: 22%;
}

#hud-theme-select .hud-dd-menu {
	top: auto;
	bottom: 100%;
}

#hud-locale-select {
	left: 36%;
	top: 55.5%;
	width: 28%;
}

#hud-theme-upload-btn,
#hud-theme-template-btn,
#hud-theme-manage-btn {
	position: absolute;
	z-index: 30;
	top: 48.5%;
	padding: 0 4px;
	cursor: pointer;
}

#hud-theme-upload-btn {
	left: 59%;
	width: 14%;
}

#hud-theme-template-btn {
	left: 74%;
	top: 48.5%;
	width: 13%;
	font-size: 8px;
	line-height: 1.1;
	white-space: normal;
}

#hud-theme-manage-btn {
	left: 88%;
	width: 10%;
}

#hud-bg-color,
#hud-block-color,
#hud-color-slots input {
	position: absolute;
	z-index: 30;
	left: 28%;
	top: 78.4%;
	width: 4.2%;
	height: 4.4%;
	padding: 0;
	border: 1px solid #c45a18;
	background: transparent;
	cursor: pointer;
	pointer-events: auto;
	-webkit-appearance: none;
	appearance: none;
}

#hud-bg-color::-webkit-color-swatch-wrapper,
#hud-block-color::-webkit-color-swatch-wrapper,
#hud-color-slots input::-webkit-color-swatch-wrapper {
	padding: 0;
}

#hud-bg-color::-webkit-color-swatch,
#hud-block-color::-webkit-color-swatch,
#hud-color-slots input::-webkit-color-swatch {
	border: none;
	border-radius: 0;
}

#hud-color-slots {
	position: absolute;
	inset: 0;
	z-index: 30;
	pointer-events: none;
}

#hud-color-slots input {
	pointer-events: auto;
	left: 36.4%;
	width: 4.2%;
	height: 4.4%;
}

/* Match drawCustomizeColors rowY0=40, rowStep=18 on a 300px canvas. */
body.is-settings-colors #hud-color-slots input[data-slot="bg"] { top: 13.3%; }
body.is-settings-colors #hud-color-slots input[data-slot="block"] { top: 19.3%; }
body.is-settings-colors #hud-color-slots input[data-slot="stone"] { top: 25.3%; }
body.is-settings-colors #hud-color-slots input[data-slot="exit"] { top: 31.3%; }
body.is-settings-colors #hud-color-slots input[data-slot="soft"] { top: 37.3%; }
body.is-settings-colors #hud-color-slots input[data-slot="heavy"] { top: 43.3%; }
body.is-settings-colors #hud-color-slots input[data-slot="fragile"] { top: 49.3%; }
body.is-settings-colors #hud-color-slots input[data-slot="split"] { top: 55.3%; }
body.is-settings-colors #hud-color-slots input[data-slot="bridgeL"] { top: 61.3%; }
body.is-settings-colors #hud-color-slots input[data-slot="bridgeR"] { top: 67.3%; }

body:not(.is-settings-colors) #hud-color-slots {
	display: none;
}

#hud-color-preset-select {
	position: absolute;
	z-index: 32;
	/* Beside "Load preset" (drawCustomizeColors loadY≈218); match-stone is below at y≈238. */
	left: 24%;
	top: 72.5%;
	width: 28%;
	pointer-events: auto;
}

body:not(.is-settings-colors) #hud-color-preset-select {
	display: none;
}

body.is-settings-colors #hud-color-preset-manage {
	left: 48%;
	top: 42%;
	width: 46%;
}

#attract-fade {
	position: fixed;
	inset: 0;
	z-index: 90;
	pointer-events: none;
	background: #000;
	opacity: 0;
	transition: opacity 0.7s ease;
}

#attract-fade.is-on {
	opacity: 1;
}

#attract-title {
	/* Legacy HTML title — attract now uses in-canvas billboard glyphs. Kept hidden. */
	display: none !important;
}

#hud-theme-manage,
#hud-color-preset-manage {
	position: absolute;
	z-index: 40;
	left: 36%;
	top: 48%;
	width: 54%;
	max-height: 36%;
	overflow: auto;
	box-sizing: border-box;
	padding: 6px;
	background: #1a120c;
	border: 1px solid #c45a18;
	pointer-events: auto;
}

.hud-theme-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin: 4px 0;
	color: #ffe6c4;
	font: 700 11px Orbitron, sans-serif;
}

.hud-theme-row button {
	flex: 0 0 auto;
	padding: 2px 8px;
	font: 700 10px Orbitron, sans-serif;
	color: #ffe6c4;
	background: #1a120c;
	border: 1px solid #c45a18;
	cursor: pointer;
}

#hud-theme-manage-empty,
#hud-color-preset-manage-empty {
	margin: 4px 0;
	color: rgba(255, 210, 160, 0.7);
	font: 700 11px Orbitron, sans-serif;
}

#hud-theme-manage-back,
#hud-color-preset-manage-back {
	display: block;
	margin-top: 8px;
	padding: 4px 10px;
	font: 700 11px Orbitron, sans-serif;
	color: #ffe6c4;
	background: #1a120c;
	border: 1px solid #c45a18;
	cursor: pointer;
}

#hud-theme-select[hidden],
#hud-locale-select[hidden],
#hud-theme-upload-btn[hidden],
#hud-theme-template-btn[hidden],
#hud-theme-manage-btn[hidden],
#hud-theme-manage[hidden],
#hud-color-preset-manage[hidden],
#hud-bg-color[hidden],
#hud-block-color[hidden],
#hud-color-slots[hidden],
#play-chrome[hidden],
#play-pass[hidden],
#play-stage-name[hidden],
#play-time[hidden],
#stage-card[hidden],
#howto-copy[hidden],
#howto-page[hidden],
#howto-nav[hidden],
#pause-stats[hidden],
#pause-nav[hidden],
#play-select[hidden],
#theme-media[hidden] {
	display: none !important;
}

body.is-hd #canvas {
	image-rendering: auto;
}

#hud-input {
	position: absolute;
	z-index: 20;
	box-sizing: border-box;
	height: 22px;
	padding: 2px 8px;
	font: 700 12px/1.2 Orbitron, sans-serif;
	letter-spacing: 0.06em;
	color: #ffe6c4;
	background: transparent;
	border: 0;
	outline: none;
	pointer-events: auto;
}

#hud-input::placeholder {
	color: rgba(255, 210, 160, 0.4);
}

#extra-shell,
#extra-ingame {
	display: none !important;
}

body.no-theme-bg #animation_container,
body.no-theme-bg #canvas,
body.title-letterbox #animation_container,
body.title-letterbox #canvas {
	background-color: #000 !important;
}

body.is-playing #animation_container,
body.is-playing #canvas {
	background-color: var(--play-tint, #000);
}

#hud-modal {
	position: absolute;
	inset: 0;
	z-index: 40;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.62);
	pointer-events: auto;
}

#hud-modal.is-open {
	display: flex;
}

#tab-crop-overlay {
	position: absolute;
	inset: 0;
	z-index: 45;
	pointer-events: auto;
	background: rgba(0, 0, 0, 0.28);
}

#tab-crop-overlay[hidden] {
	display: none !important;
}

/* Full-bleed over #theme-media so drag coords match applyTabCrop (not shrunk by the bar). */
#tab-crop-stage {
	position: absolute;
	inset: 0;
	cursor: crosshair;
	touch-action: none;
}

#tab-crop-rect {
	position: absolute;
	box-sizing: border-box;
	border: 2px solid #ffc070;
	box-shadow:
		0 0 0 9999px rgba(0, 0, 0, 0.45),
		inset 0 0 0 1px rgba(0, 0, 0, 0.35);
	pointer-events: none;
}

#tab-crop-bar {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 6px 8px;
	background: rgba(12, 8, 6, 0.92);
	border-top: 1px solid #c45a18;
	pointer-events: auto;
}

#tab-crop-hint {
	margin: 0;
	flex: 1 1 auto;
	font: 700 calc(10 * 100cqh / 300) / 1.2 Orbitron, sans-serif;
	color: #ffe6c4;
}

#tab-crop-actions {
	display: flex;
	gap: 6px;
	flex: 0 0 auto;
}

#tab-crop-actions button {
	pointer-events: auto;
	padding: 4px 8px;
	border: 1px solid #c45a18;
	background: #1a120c;
	color: #ffe6c4;
	font: 700 calc(10 * 100cqh / 300) / 1 Orbitron, sans-serif;
	cursor: pointer;
}

#tab-crop-actions button:hover {
	background: #2a1810;
}

body.is-tab-cropping #canvas {
	pointer-events: none;
	opacity: 0;
}

body.is-tab-cropping #theme-media {
	z-index: 1;
}

body.is-tab-cropping #play-chrome,
body.is-tab-cropping #howto-nav,
body.is-tab-cropping #howto-page,
body.is-tab-cropping #howto-copy,
body.is-tab-cropping #pause-nav,
body.is-tab-cropping #pause-stats,
body.is-tab-cropping #stage-card,
body.is-tab-cropping #play-stage-name,
body.is-tab-cropping #hud-theme-select,
body.is-tab-cropping #hud-locale-select,
body.is-tab-cropping #hud-theme-upload-btn,
body.is-tab-cropping #hud-theme-template-btn,
body.is-tab-cropping #hud-theme-manage-btn,
body.is-tab-cropping #hud-color-slots,
body.is-tab-cropping #hud-color-preset-select,
body.is-tab-cropping #hud-input,
body.is-tab-cropping #build-version {
	visibility: hidden;
}

#hud-busy {
	position: absolute;
	inset: 0;
	z-index: 80;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.72);
	pointer-events: auto;
}

#hud-busy[hidden] {
	display: none !important;
}

.hud-busy-card {
	width: min(320px, 80%);
	padding: 16px 18px 14px;
	background: #140e0a;
	border: 1px solid #c45a18;
	box-shadow: 0 0 24px rgba(255, 120, 30, 0.25);
}

#hud-busy-title {
	margin: 0 0 12px;
	font: 700 13px/1.3 Orbitron, sans-serif;
	color: #ffe6c4;
}

.hud-busy-track {
	height: 8px;
	background: #2a1810;
	border: 1px solid #c45a18;
}

#hud-busy-bar {
	width: 0;
	height: 100%;
	background: #c45a18;
}

body.is-busy #dom_overlay_container > :not(#hud-busy) {
	pointer-events: none !important;
}

.hud-modal-card {
	width: min(360px, 86%);
	padding: 16px 18px 14px;
	background: #140e0a;
	border: 1px solid #c45a18;
	box-shadow: 0 0 24px rgba(255, 120, 30, 0.25);
}

#hud-modal-title {
	margin: 0 0 10px;
	font: 700 14px/1.3 Orbitron, sans-serif;
	color: #ffe6c4;
}

#hud-modal-input {
	box-sizing: border-box;
	width: 100%;
	min-height: 72px;
	height: 72px;
	padding: 8px;
	margin: 0 0 12px;
	font: 700 11px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	color: #ffe6c4;
	background: #1a120c;
	border: 1px solid #c45a18;
	outline: none;
	resize: vertical;
	word-break: break-all;
}

.hud-modal-row {
	display: flex;
	gap: 10px;
}

.hud-modal-row button {
	font: 700 12px/1 Orbitron, sans-serif;
	color: #ffe6c4;
	background: transparent;
	border: 1px solid #c45a18;
	padding: 7px 12px;
	cursor: pointer;
}

.hud-modal-row button:hover {
	color: #fff;
	border-color: #fff;
}

#animation_container {
	display: flex;
	align-items: center;
	justify-content: center;
}

#canvas,
#dom_overlay_container {
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	overflow: hidden;
}

#dom_overlay_container {
	container-type: size;
	container-name: stage;
}

#dom_overlay_container #side_panel,
#dom_overlay_container #table_container {
	overflow: hidden;
	scrollbar-width: none;
}

#touch-pad,
#install-hint,
#landscape-hint {
	box-sizing: border-box;
	-webkit-user-select: none;
	user-select: none;
	touch-action: none;
}

#touch-pad[hidden],
#install-hint[hidden],
#landscape-hint[hidden],
#install-how[hidden] {
	display: none !important;
}

#install-hint,
#landscape-hint {
	position: fixed;
	left: 12px;
	right: 12px;
	z-index: 30;
	padding: 12px 14px;
	background: #140e0a;
	border: 1px solid #c45a18;
	color: #ffe6c4;
	font: 600 13px/1.4 Orbitron, sans-serif;
}

#install-hint {
	bottom: calc(12px + env(safe-area-inset-bottom));
}

#landscape-hint {
	top: 12px;
}

.install-row {
	display: flex;
	gap: 10px;
	margin-top: 10px;
}

#install-hint button,
#landscape-hint button {
	font: 700 12px/1 Orbitron, sans-serif;
	color: #ffe6c4;
	background: transparent;
	border: 1px solid #c45a18;
	padding: 10px 12px;
	min-height: 40px;
}

#touch-pad {
	position: fixed;
	inset: 0;
	z-index: 18;
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
	background: transparent;
	pointer-events: none;
}

.tp-cluster {
	position: relative;
	pointer-events: auto;
}

.tp-dpad {
	width: min(38vw, 168px);
	height: min(38vw, 168px);
}

.tp-btn {
	appearance: none;
	border: 1px solid rgba(196, 90, 24, 0.8);
	background: rgba(16, 11, 8, 0.55);
	color: #ffe6c4;
	font: 700 16px/1 Orbitron, sans-serif;
	border-radius: 12px;
	padding: 0;
	-webkit-tap-highlight-color: transparent;
}

.tp-btn.is-down {
	background: rgba(196, 90, 24, 0.88);
	color: #fff;
}

.tp-dpad .tp-btn {
	position: absolute;
	width: 32%;
	height: 32%;
}

.tp-up { left: 34%; top: 0; }
.tp-down { left: 34%; bottom: 0; }
.tp-left { left: 0; top: 34%; }
.tp-right { right: 0; top: 34%; }

.tp-actions {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	align-items: stretch;
	gap: 8px;
	width: min(14vw, 72px);
}

.tp-swap,
.tp-rotate,
.tp-menu {
	width: 100%;
	min-height: 44px;
	padding: 0 4px;
	font-size: 11px;
	border-radius: 10px;
}

#app-shell {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	width: 100%;
	display: flex;
	flex-direction: column;
}

body.is-pad-on #screen-split {
	flex: 1 1 auto;
	height: 100%;
	min-height: 0;
}

body.is-pad-on #animation_container {
	width: 100%;
	height: 100%;
	max-height: none;
}

body.is-rotated {
	overflow: hidden;
}

body.is-rotated #app-shell {
	position: fixed;
	top: 0;
	left: 100vw;
	left: 100dvw;
	width: 100vh;
	width: 100dvh;
	height: 100vw;
	height: 100dvw;
	transform: rotate(90deg);
	transform-origin: top left;
	z-index: 6;
}

body.is-rotated.is-pad-on #screen-split,
body.is-rotated.is-pad-on #animation_container {
	width: 100%;
	height: 100%;
	max-height: none;
}

body.is-rotated #touch-pad {
	flex-direction: column;
	align-items: flex-start;
	justify-content: space-between;
	padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
}

body.is-rotated #touch-pad .tp-dpad {
	width: min(34vw, 150px);
	height: min(34vw, 150px);
}

body.is-mobile #hud-input {
	height: 36px;
	font-size: 16px;
}

body.is-mobile #hud-modal-input {
	min-height: 88px;
	height: 88px;
	font-size: 16px;
}

body.is-mobile .hud-modal-row button {
	min-height: 44px;
	padding: 10px 16px;
}

#ach-toasts {
	position: absolute;
	right: 2.2%;
	top: 8%;
	z-index: 60;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 8px;
	pointer-events: none;
	width: min(46%, 220px);
}

.ach-toast {
	box-sizing: border-box;
	width: 100%;
	padding: 8px 10px 9px;
	background: rgba(20, 12, 8, 0.92);
	border: 1px solid #c45a18;
	box-shadow: 0 0 16px rgba(255, 120, 30, 0.28);
	color: #ffe6c4;
	font: 700 11px/1.25 Orbitron, sans-serif;
	animation: ach-in 280ms ease-out;
}

.ach-toast b {
	display: block;
	margin: 0 0 4px;
	color: #fff;
	font-size: 10px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.ach-toast.is-out {
	opacity: 0;
	transform: translateY(-8px);
	transition: opacity 280ms ease, transform 280ms ease;
}

@keyframes ach-in {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: translateY(0); }
}

body.is-creator-edit.is-pad-on #touch-pad {
	padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
	align-items: flex-end;
}

body.is-creator-edit.is-pad-on #touch-pad .tp-dpad {
	width: min(30vw, 132px);
	height: min(30vw, 132px);
}

body.is-creator-edit.is-pad-on .tp-actions {
	width: min(18vw, 76px);
}

@media (orientation: landscape) and (max-height: 500px) {
	#install-hint {
		display: none !important;
	}
}
