@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Share+Tech+Mono&display=swap");

/* style.css — conservative cleanup of style.css
   ============================================================
   Changes from style.css:
   • Added missing --te-orange: #f0690a to :root (single var, *all* references use it)
   • Removed duplicate @keyframes ready-pulse / tutorial-pulse-text
     (identical to pulse; classes now reuse pulse)
   • Consolidated duplicate .scope-wrap & .meter-track declarations
     (kept final winning values)
   • Combined .ceremony-overlay + .settings-overlay duplicate rules
     (verified byte-identical declarations)
   • Combined .ceremony-card + .settings-card shared declarations
   • Preserves original cascade behavior and source-order semantics
   ============================================================ */

/*
Keep @supports local when the fallback is implementation-specific.

Reserve root tokens for semantic design values (palette, spacing,
radii, typography), not browser capability indirection.
*/
/* 
    Here's what changed and why:
    New tokens added to :root:

    - [x] --surface-deep — meter track background (was #3a342c)
    - [x] --scope-bg — oscilloscope background (was #211d18)
    - [x] --red-dark / --red-deep — stamp-fail fill and border (were #8b1a1a, #5a0a0a)

    Replaced with color-mix(in oklch, ...):

    - [x] .crt-btn:hover and .level-select-btn.unlocked:hover — derived from --surface2
    - [x] .crt-btn.danger:hover — derived from --coral
    - [x] .type-btn.active box-shadow — derived from --coral
    - [ ] Stamp borders for hint, skip, success — derived from --amber, --coral, --cream
    - [x] #game box-shadow bottom — derived from --bg
    - [ ] Slider thumb resting/active states — derived from --cream

    The token block is now the single source of truth. If you change --coral, the hover state and stamp border follow automatically.
 */

:root {
	/* Threes dark mode — warm charcoal, not cold black */
	--bg: #1c1915;
	--bg2: #221f1a;
	--bg3: #2a261f;
	--surface: #2e2a22;
	--surface2: #353028;
	--surface-deep: #3a342c; /* meter track — darker than surface2 */
	--scope-bg: #211d18; /* oscilloscope bg — between bg and bg2 */

	/* Threes tile colors */
	--coral: #e8604a; /* 1-tile salmon */
	--blue: #5b8dd9; /* 2-tile blue */
	--cream: #f5efe0; /* high tile cream */
	--amber: #e8a23a; /* accent / score */
	--red: #e85a4a;
	--red-dark: #8b1a1a; /* stamp-fail bg */
	--red-deep: #5a0a0a; /* stamp-fail border */
	--green: #6dc87a; /* win state only */

	/* Don’t replace coral—layer it as a second accent system (Teenage Engineering) */
	--te-orange: #f0690a;
	--surface1: #3a342c;
	--surface3: #2e2a22;

	/* Text */
	--text: #f0e8d8;
	--text-dim: #7a7060;
	--text-mute: #92826c; /* WCAG AA 4.70:1 on --bg — passes normal-text AA (4.5:1) */

	--color-surface-hover: #3e3830;
	--color-coral-hover: #d4533e;
	--color-tile-active-shadow: #a83828;

	/* Card / tile shadows — warm, no color cast */
	--shadow-sm: 0 2px 0 rgba(0, 0, 0, 0.35);
	--shadow-md: 0 3px 0 rgba(0, 0, 0, 0.4), 0 5px 12px rgba(0, 0, 0, 0.3);
	--shadow-press: 0 1px 0 rgba(0, 0, 0, 0.4);

	--radius-game: 20px;
	--radius-tile: 8px;
	--radius-sm: 5px;
	--radius-xs: 2px;
	--radius: 6px;

	--font-ui: "Nunito", sans-serif;
	--font-mono: "Share Tech Mono", monospace;
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}
html,
body {
	height: 100%;
}

body {
	background: var(--bg);
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	font-family: var(--font-ui);
}

/* ============================================================
   GAME SHELL
   ============================================================ */

#game {
	background: var(--bg2);
	color: var(--text);
	font-family: var(--font-ui);
	font-size: 13px;
	line-height: 1.4;
	width: 480px;
	max-width: 95vw;
	padding: 24px 16px;
	border-radius: var(--radius-game);
	position: relative;
	user-select: none;
	-webkit-user-select: none;

	transform: rotate(-0.5deg);
	will-change: transform;
	box-shadow:
		0 8px 0 color-mix(in oklch, var(--bg) 60%, black),
		0 12px 40px rgba(0, 0, 0, 0.6);
}

/* TE: matte finish (z-index: -1 (applies only to outer shell) */
#game::after {
	display: block;
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	opacity: 0.06;
	isolation: isolate;
	z-index: -1;
	background-image: radial-gradient(rgba(255, 255, 255, 0.15) 1px, transparent 1px);
	background-size: 3px 3px;
}
#game-inner {
	position: relative;
	min-height: 420px;
}

/* ── SETTINGS GEAR ─────────────────────────────────────────────────────────── */
.settings-gear {
	position: absolute;
	top: 6px;
	right: 8px;
	z-index: 100;
	background: transparent;
	border: none;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	padding: 4px 6px;
	border-radius: var(--radius-sm);
	color: var(--text-mute);
	transition:
		color 0.15s,
		background 0.15s;
	user-select: none;
}
.settings-gear:hover {
	color: var(--text-dim);
	background: rgba(255, 255, 255, 0.04);
}
.settings-gear:active {
	color: var(--cream);
	transform: translateY(1px);
}

.orb {
	font-family: var(--font-ui);
	font-weight: 900;
}

/* ============================================================
   Logo
   ============================================================ */

/* Container & Canvas Placement (Untouched) */
.screen-logo {
	position: relative;
	width: 100%;
	padding: 0 10px;
	margin-bottom: 12px;
}

#logo-scope {
	position: absolute;
	top: 25.7%;
	left: 15%;
	width: 75%;
	height: auto;
	aspect-ratio: 900 / 300;
	z-index: 2;
}

.logo-svg {
	width: 100%;
	height: auto;
	display: block;
}

/* SVG Shapes */
.logo-panel {
	fill: var(--bg);
}

.logo-grid-midline {
	stroke: rgba(255, 255, 255, 0.08);
	stroke-width: 1;
}

/* SVG Typography */
.logo-mixed,
.logo-signals {
	font-family: var(--font-ui);
	font-weight: 900;
	letter-spacing: 10px;
	text-transform: uppercase;
}

.logo-mixed {
	font-size: 170px;
	fill: var(--cream);
}

.logo-signals {
	font-size: 170px;
	fill: var(--coral);
}

.logo-tagline {
	font-family: var(--font-ui);
	font-size: 42px;
	font-weight: 800;
	letter-spacing: 6px;
	fill: var(--text-mute);
}

/* ============================================================
   UNIFIED DRAG CONTROLS
   ============================================================ */

@media (max-width: 640px) {

	/* (Sanity Check the Mobile Query) You don't need to change this, but you
	 * should test it on a mobile layout.  Because the SVG is now just a
	 * lightweight vector shell (without the heavy grid pattern and filters), it
	 * should scale perfectly and run much smoother on phones. The canvas scope
	 * will automatically resize to fit that 75% width we set earlier. */
	.logo-svg {
		width: 100%;
	}

	body {
		align-items: flex-start;
		background: var(--bg2);
	}

	#game {
		width: 100%;
		max-width: none;
		min-height: 100svh;
		border-radius: 0;
		padding: 12px 10px;
		transform: none;
		will-change: auto;
		box-shadow: none;
		overflow-x: hidden;
	}
	@supports (height: 100dvh) {
		#game {
			min-height: 100dvh;
		}
	}

	.action-row {
		margin-top: 10px;
		transform: none;
		will-change: auto;
	}

	.param-list {
		gap: 6px;
	}
	.ctrl {
		gap: 2px;
	}
	.slider-meta {
		padding: 0 10px;
	}
	.slider-row {
		padding: 0 10px;
	}
	.slider-meta label {
		font-size: 9px;
	}
	.slider-val {
		font-size: 9px;
		padding: 2px 6px;
	}
	.timer-ring-wrap {
		top: 4px;
		right: 6px;
	}
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
}

.hidden {
	/* biome-ignore lint/complexity/noImportantStyles: utility class must override component display */
	display: none !important;
}

.start-copy-list {
	margin: 0 0 20px;
	padding: 0;
	list-style: none;
	display: grid;
	gap: 8px;
	text-align: center;
	font-family: var(--font-mono);
	letter-spacing: 0.5px;
	text-transform: uppercase;
	color: var(--text-dim);
}

.start-copy-list li {
	opacity: 0.95;
}

/* ============================================================
   SCREENS
   ============================================================ */

.screen {
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	/* If hard cuts ever feel too abrupt, add:
	   transition: opacity 60ms ease-out, visibility 60ms ease-out; */

	text-align: center;
	gap: 1.2rem;
	min-height: 320px;

	/* Hardware frame — matches game screen's screen-frame */
	background: var(--bg);
	padding: 24px 20px;
	border-radius: var(--radius-tile);
	--scale-screen-margin-bottom: 0.5;
	margin-bottom: calc(18px * var(--scale-screen-margin-bottom));
	box-shadow:
		inset 0 2px 8px rgba(0, 0, 0, 0.5),
		0 0 0 1px rgba(0, 0, 0, 0.4);
}

.screen h2 {
	font-family: var(--font-ui);
	font-weight: 900;
	font-size: clamp(22px, 6vw, 36px);
	color: var(--cream);
	letter-spacing: -0.01em;
}

.screen p {
	color: var(--text-dim);
	font-size: clamp(12px, 3vw, 14px);
	max-width: 300px;
	line-height: 1.7;
	font-weight: 400;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.crt-btn {
	font-family: var(--font-ui);
	font-weight: 800;
	font-size: clamp(12px, 3vw, 14px);
	letter-spacing: 0.02em;
	padding: 0.65rem 2rem;
	cursor: pointer;
	border-radius: var(--radius-tile);
	border: none;
	background: var(--surface2);
	color: var(--cream);
	box-shadow: var(--shadow-md);
	transition:
		transform 0.07s,
		box-shadow 0.07s,
		outline 0.1s;
}

.crt-btn:focus-visible {
	outline: 2px solid var(--cream);
	outline-offset: 2px;
}

.crt-btn:hover {
	background: var(--color-surface-hover);
}

.crt-btn:active {
	transform: translateY(3px);
	box-shadow: var(--shadow-press);
}

.crt-btn.danger {
	background: var(--coral);
	color: #fff;
}
.crt-btn.danger:hover {
	background: var(--color-coral-hover);
}

.crt-btn.amber {
	background: var(--amber);
	color: #fff;
}

.crt-btn.sm {
	font-size: 12px;
	padding: 0.4rem 1.2rem;
	font-weight: 700;
}

.crt-btn.mute {
	font-size: 11px;
	padding: 3px 9px;
	font-weight: 700;
}

/* ============================================================
   GAME SCREEN
   ============================================================ */

#screen-game {
	display: none;
	background: none;
	padding: 0;
	border-radius: 0;
	box-shadow: none;
	margin-bottom: 0;
	min-height: 0;
}
/* ============================================================
   LCD / SCREEN AREA
   ============================================================ */

.screen-frame {
	background: var(--bg);
	padding: 14px 12px 12px;
	border-radius: var(--radius-tile);
	margin-bottom: 18px;
	box-shadow:
		inset 0 2px 8px rgba(0, 0, 0, 0.5),
		0 0 0 1px rgba(0, 0, 0, 0.4);
}

#game-lcd {
	background: var(--bg);
	--scale-padding: 0.5;
	padding: calc(var(--scale-padding) * 10px);
	border-radius: var(--radius-sm);
	position: relative;
	overflow: hidden;
	isolation: isolate;
}

/* ============================================================
   TOP BAR
   ============================================================ */

.topbar {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;

	margin-bottom: 10px;
	padding-bottom: 8px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.04);

	font-family: var(--font-mono), monospace;
	font-weight: 800;
	letter-spacing: 0.05em;
}

.chip {
	background: var(--surface);
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.04),
		inset 0 -1px 0 rgba(0, 0, 0, 0.18);
	border-radius: var(--radius-sm);
	padding: 3px 8px;

	font-family: var(--font-ui);
	font-size: 10px;
	font-weight: 700;
	color: var(--text-dim);
	white-space: nowrap;
}

/* TE adjustment */

/*
Instrument readouts use mono to reinforce "measurement" rather than prose.
Applies to timer/score/status UI where precision matters visually.

Keep this block above specialized selectors such as `.chip b`.
Biome warns on descending specificity if a broad `b` selector appears after
more specific variants.

Order:
1. broad baseline (`b`)
2. component-specific overrides (`.chip b`, etc.)
*/
b {
	font-family: var(--font-mono), monospace;
	font-weight: 800;
	letter-spacing: 0.05em;
}

.chip b {
	color: var(--cream);
	font-weight: 800;
}

.chip.level-chip b {
	color: var(--amber);
}

.topbar-end-wrap {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 6px;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes pulse {
	0%,
	100% {
		opacity: 1;
	}
	50% {
		opacity: 0.6;
	}
}

@keyframes shake {
	0%,
	100% {
		transform: translate(0, 0);
	}
	10% {
		transform: translate(-5px, -3px);
	}
	20% {
		transform: translate(5px, 3px);
	}
	30% {
		transform: translate(-3px, 5px);
	}
	40% {
		transform: translate(3px, -5px);
	}
	50% {
		transform: translate(-5px, 3px);
	}
	60% {
		transform: translate(5px, -3px);
	}
	70% {
		transform: translate(-3px, -5px);
	}
	80% {
		transform: translate(3px, 5px);
	}
	90% {
		transform: translate(-5px, -3px);
	}
}

@keyframes shakeLight {
	0%,
	100% {
		transform: translate(0, 0);
	}
	25% {
		transform: translate(-2px, 1px);
	}
	50% {
		transform: translate(2px, -1px);
	}
	75% {
		transform: translate(-1px, 2px);
	}
}

#game-inner.shake {
	animation: shake 0.5s ease-out;
}
#game-inner.shake-light {
	animation: shakeLight 0.3s ease-out;
}

/* ── BRICK WOBBLE (outer shell) ───────────────────────────────────────────── */

@keyframes brickWobble {
	0%,
	100% {
		transform: rotate(-0.5deg) translate(0, 0);
		box-shadow:
			0 8px 0 color-mix(in oklch, var(--bg) 60%, black),
			0 12px 40px rgba(0, 0, 0, 0.6);
	}
	15% {
		transform: rotate(-2.8deg) translate(-3px, 1px);
		box-shadow:
			0 6px 0 color-mix(in oklch, var(--bg) 60%, black),
			0 8px 32px rgba(0, 0, 0, 0.5);
	}
	30% {
		transform: rotate(1.8deg) translate(3px, -1px);
		box-shadow:
			0 10px 0 color-mix(in oklch, var(--bg) 60%, black),
			0 14px 44px rgba(0, 0, 0, 0.7);
	}
	45% {
		transform: rotate(-2deg) translate(-2px, 1px);
		box-shadow:
			0 7px 0 color-mix(in oklch, var(--bg) 60%, black),
			0 10px 36px rgba(0, 0, 0, 0.55);
	}
	60% {
		transform: rotate(1.2deg) translate(2px, -1px);
		box-shadow:
			0 9px 0 color-mix(in oklch, var(--bg) 60%, black),
			0 12px 40px rgba(0, 0, 0, 0.65);
	}
	75% {
		transform: rotate(-0.6deg) translate(0, 0);
		box-shadow:
			0 8px 0 color-mix(in oklch, var(--bg) 60%, black),
			0 12px 40px rgba(0, 0, 0, 0.6);
	}
	90% {
		transform: rotate(0deg) translate(0, 0);
	}
}

@keyframes brickWobbleLight {
	0%,
	100% {
		transform: rotate(-0.5deg) translate(0, 0);
	}
	25% {
		transform: rotate(-1.8deg) translate(-2px, 1px);
	}
	50% {
		transform: rotate(0.8deg) translate(2px, -1px);
	}
	75% {
		transform: rotate(-1deg) translate(-1px, 0);
	}
}

#game.shake {
	animation: brickWobble 0.5s ease-out;
}
#game.shake-light {
	animation: brickWobbleLight 0.3s ease-out;
}

.score-pop {
	position: absolute;
	top: 40px;
	right: 10px;
	color: var(--green);
	font-family: var(--font-ui);
	font-weight: 900;
	pointer-events: none;
	z-index: 10;
}

/* ============================================================
   METER
   ============================================================ */

.meter-row {
	display: flex;
	align-items: center;
	gap: 8px;
	--scale-meter-row: 0.5;
	margin-bottom: calc(var(--scale-meter-row) * 10px);
}

.meter-track {
	flex: 1;
	height: 8px;
	background: var(--surface-deep);
	border-radius: 4px;
	overflow: hidden;
	position: relative;
	box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.meter-fill {
	height: 100%;
	border-radius: 4px;
	background: var(--blue);
	transition:
		transform 0.3s,
		background 0.3s;
	/* HACK: Fixes transform, instead of using width to simulate progress bar */
	min-width: 100%;
	transform-origin: left center;
	will-change: transform;
}

.meter-pct {
	font-family: var(--font-mono), monospace;
	font-weight: 800;
	font-size: clamp(11px, 3vw, 13px);
	letter-spacing: 0.05em;
	min-width: 3.5ch;
	text-align: right;
	color: var(--text-dim);
}

/* ============================================================
   OSCILLOSCOPE
   ============================================================ */

.scope-wrap {
	background: var(--scope-bg);
	border-radius: var(--radius-sm);
	padding: 8px;
	margin-bottom: 12px;
	position: relative;
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.04),
		inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

.scope-wrap.glow-target.held {
	animation: none;
	box-shadow: inset 0 0 28px 8px color-mix(in srgb, var(--blue) 18%, transparent);
}
.scope-wrap.glow-yours.held {
	animation: none;
	box-shadow: inset 0 0 28px 8px color-mix(in srgb, var(--coral) 18%, transparent);
}
.scope-wrap.glow-ab.held {
	animation: none;
	box-shadow: inset 0 0 28px 8px color-mix(in srgb, var(--green) 18%, transparent);
}
.scope-wrap.grace-active {
	box-shadow:
		inset 0 0 20px 4px rgba(255, 255, 255, 0.06),
		inset 0 1px 0 rgba(255, 255, 255, 0.08),
		inset 0 -1px 0 rgba(0, 0, 0, 0.18);
	border: 1px solid rgba(255, 255, 255, 0.08);
}

#c-overlay.urgent {
	animation: canvas-urgent 0.5s ease-in-out infinite;
}
#c-overlay.urgent.held {
	animation: none;
	box-shadow: 0 0 12px 4px color-mix(in srgb, var(--red) 30%, transparent);
}
@keyframes canvas-urgent {
	0%,
	100% {
		box-shadow: 0 0 0 0px color-mix(in srgb, var(--red) 0%, transparent);
	}
	50% {
		box-shadow: 0 0 12px 4px color-mix(in srgb, var(--red) 30%, transparent);
	}
}

/* Tiny calibration ticks (subtle but powerful) */
/* Add left/right markers: */
.scope-wrap::before,
.scope-wrap::after {
	content: "";
	position: absolute;
	top: 50%;
	width: 6px;
	height: 1px;
	background: rgba(255, 255, 255, 0.2);
}
.scope-wrap::before {
	left: 6px;
}
.scope-wrap::after {
	right: 6px;
}

.scope-label {
	font-size: 9px;
	font-weight: 700;
	font-family: var(--font-ui);
	color: var(--text-mute);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	margin-bottom: 6px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.scope-label span {
	display: flex;
	align-items: center;
	gap: 6px;
}

.archetype-badge {
	font-family: var(--font-mono);
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.06em;
	color: var(--amber);
	background: rgb(from var(--amber) r g b / 0.1);
	border: 1px solid rgb(from var(--amber) r g b / 0.1);
	border-radius: 10px;
	padding: 1px 8px;
	white-space: nowrap;
}

.pip {
	width: 8px;
	height: 2px;
	border-radius: 1px;
	display: inline-block;
}

canvas.scope {
	width: 100%;
	height: auto;
	border-radius: 4px;
	background: /* horizontal midline */
		linear-gradient(rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.08)) center / 100% 1px no-repeat,
		/* vertical grid */
		repeating-linear-gradient(to right, transparent, transparent 19px, rgba(255, 255, 255, 0.04) 20px),
		/* horizontal grid */
		repeating-linear-gradient(to bottom, transparent, transparent 11px, rgba(255, 255, 255, 0.04) 12px),
		var(--bg);

	/* Add edge clipping (very TE) */
	/* Waveform should feel “contained,” not floating. */
	overflow: hidden;
	clip-path: inset(0 round 4px);
}

/* ============================================================
   HARDWARE GRID
   ============================================================ */

.hardware-grid {
	display: grid;
	grid-template-columns: 1fr 1.3fr;
	gap: 12px;
	margin-bottom: 10px;
}

/* ============================================================
   WAVE TYPE BUTTONS — Threes tiles
   ============================================================ */

.type-btns {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 6px;
}

.type-btn {
	background: var(--surface);
	border: none;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 10px 2px 8px;
	cursor: pointer;
	border-radius: var(--radius-tile);
	font-family: var(--font-ui);
	font-weight: 700;
	font-size: 10px;
	color: var(--text-mute);
	box-shadow: var(--shadow-sm);
	transition:
		transform 0.07s,
		box-shadow 0.07s,
		outline 0.1s;
	user-select: none;
}

.type-btn:focus-visible {
	outline: 2px solid var(--cream);
	outline-offset: 1px;
}

.type-btn:active {
	transform: translateY(2px);
	box-shadow: none;
}

.type-btn svg {
	width: 24px;
	height: 12px;
	stroke: var(--text-mute);
	fill: none;
	stroke-width: 2.5;
	margin-bottom: 5px;
	pointer-events: none;
}

.type-btn span {
	font-size: 8px;
	font-weight: 800;
	color: var(--text-mute);
	pointer-events: none;
	letter-spacing: 0.06em;
}

/* Active = coral tile, like Threes "1" card */
.type-btn.active {
	background: var(--coral);
	color: #fff;
	box-shadow:
		0 3px 0 var(--color-tile-active-shadow),
		0 4px 10px rgb(from var(--red) r g b / 0.25);
	transform: translateY(0);
}

.type-btn.active svg {
	stroke: rgba(255, 255, 255, 0.9);
}
.type-btn.active span {
	color: rgba(255, 255, 255, 0.9);
}

.type-btn:disabled {
	opacity: 0.2;
	cursor: not-allowed;
	pointer-events: none;
}

.type-btn.puzzle-disabled {
	opacity: 0.35;
	cursor: pointer;
	pointer-events: auto;
}
.type-btn.puzzle-disabled:hover {
	opacity: 0.6;
	background: var(--surface-hover);
}

@keyframes puzzle-wrong {
	0%,
	100% {
		transform: translateX(0);
	}
	20% {
		transform: translateX(-4px);
	}
	40% {
		transform: translateX(4px);
	}
	60% {
		transform: translateX(-3px);
	}
	80% {
		transform: translateX(3px);
	}
}

.type-btn.puzzle-wrong {
	animation: puzzle-wrong 0.2s ease-out;
}

/* ============================================================
   SLIDERS
   ============================================================ */

.param-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.ctrl {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.slider-meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0 14px;
	padding-inline-end: 0;
}

.slider-meta label {
	font-size: 10px;
	font-weight: 700;
	font-family: var(--font-ui);
	color: var(--text-dim);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	display: flex;
	align-items: center;
	gap: 5px;
}

.slider-val {
	font-size: 10px;
	font-weight: 800;
	font-family: var(--font-ui);
	color: var(--cream);

	/* led chip overlay */
	background: var(--surface);
	border-radius: var(--radius-sm);
	padding: 3px 8px;
	white-space: nowrap;
	text-align: right;

	/* equal slider-val slotted into the hardware of the mixer like synth */
	min-width: 8ch;
}

.slider-val b {
	font-weight: 800;
}
.slider-row {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 0 14px;
	padding-inline-end: 0;
}

.param-glyph {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	stroke: var(--text-mute);
	fill: none;
	stroke-width: 1.5;
	stroke-linecap: round;
	stroke-linejoin: round;
	vertical-align: middle;
	transition: stroke 0.15s;
}

.param-glyph path,
.param-glyph line {
	stroke-opacity: 0.8;
}
label:hover .param-glyph {
	stroke: var(--text-dim);
}
label:hover .param-glyph path,
label:hover .param-glyph line {
	stroke-opacity: 1;
}

/* ─── PARAM GRADIENT ARROWS ─────────────────────────────────────── */
.param-arrow {
	display: inline-block;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	margin-inline-end: 3px;
	vertical-align: middle;
	color: transparent;
	transition:
		color 0.15s,
		opacity 0.15s;
	user-select: none;
	pointer-events: none;
}

.param-arrow.arrow-ok {
	color: var(--green);
	opacity: 0.65;
}
.param-arrow.arrow-soft {
	color: var(--amber);
	opacity: 0.75;
}
.param-arrow.arrow-strong {
	color: var(--cream);
	opacity: 0.95;
}

/* Track */
input[type="range"] {
	flex: 1;
	-webkit-appearance: none;
	appearance: none;
	height: 8px;
	border-radius: 4px;
	cursor: pointer;
	touch-action: pan-x;
	background: var(--surface);
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45);
}

input[type="range"]::-webkit-slider-runnable-track {
	height: 8px;
	border-radius: 4px;
	background: var(--surface);
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45);
}

/* Thumb — cream Threes tile */
input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 28px;
	height: 28px;
	margin-top: -10px;
	border-radius: var(--radius-tile);
	background: #e8e0cc;
	border: none;
	box-shadow:
		0 3px 0 rgba(0, 0, 0, 0.35),
		0 5px 10px rgba(0, 0, 0, 0.25);
}

input[type="range"]:active::-webkit-slider-thumb {
	background: #d8d0bc;
	box-shadow:
		0 1px 0 rgba(0, 0, 0, 0.35),
		0 2px 6px rgba(0, 0, 0, 0.2);
	transform: translateY(2px);
}

input[type="range"]::-moz-range-track {
	height: 8px;
	border-radius: 4px;
	background: var(--surface);
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45);
}

input[type="range"]::-moz-range-thumb {
	width: 28px;
	height: 28px;
	border-radius: var(--radius-tile);
	background: #e8e0cc;
	border: none;
	box-shadow:
		0 3px 0 rgba(0, 0, 0, 0.35),
		0 5px 10px rgba(0, 0, 0, 0.25);
}

/* ============================================================
   ACTION ROW
   ============================================================ */

.action-row {
	--scale-action-row: 0.5;
	margin-top: calc(var(--scale-action-row) * 28px);
	display: flex;
	justify-content: center;
	gap: clamp(2px, min(2dvw, 2ch), 10px);

	will-change: transform;
}

.action-row > * {
	flex: 0 1 auto;
	min-width: 0;
}

.sys-btn {
	background: var(--surface2);
	font-family: var(--font-ui);
	font-weight: 800;
	font-size: 9px;
	letter-spacing: 0.08em;
	padding: 6px 18px;
	border-radius: var(--radius-tile);
	border: none;
	cursor: pointer;
	color: var(--text-dim);
	box-shadow: var(--shadow-sm);
	transition:
		transform 0.07s,
		box-shadow 0.07s;
}

.sys-btn:focus-visible {
	outline: 2px solid var(--cream);
	outline-offset: 2px;
}

.sys-btn:active {
	transform: translateY(2px);
	box-shadow: none;
}

/* ============================================================
   FEEDBACK
   ============================================================ */

.feedback {
	text-align: center;
	min-height: 22px;
	font-size: clamp(11px, 3vw, 13px);
	font-weight: bolder;
	font-family: var(--font-mono);
	text-transform: uppercase;
	color: var(--text);
	margin: 0.4rem 0;
	letter-spacing: 0.02em;
	transition: color 0.2s;
}

.feedback.win {
	color: var(--green);
}
.feedback.close {
	color: var(--amber);
}
.feedback.bad {
	color: var(--coral);
}

.feedback-snap {
	animation: feedbackSnap 0.3s ease-out;
}

.feedback-snap-ripple {
	animation: feedbackSnapRipple 0.35s ease-out;
}

@keyframes feedbackSnap {
	0% {
		transform: skewX(-10deg);
	}
	55% {
		transform: skewX(3deg);
	}
	100% {
		transform: skewX(0deg);
	}
}

@keyframes feedbackSnapRipple {
	0% {
		transform: skewX(-10deg) scaleY(0.85);
	}
	25% {
		transform: skewX(5deg) scaleY(1.06);
	}
	50% {
		transform: skewX(-2deg) scaleY(0.97);
	}
	75% {
		transform: skewX(1deg) scaleY(1.01);
	}
	100% {
		transform: skewX(0deg) scaleY(1);
	}
}

.hint-log {
	position: absolute;
	bottom: 6px;
	left: 10px;
	right: 10px;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.6em;
	pointer-events: none;
	z-index: 5;
	font-family: var(--font-mono);
	font-size: clamp(10px, 2.5vw, 11px);
	color: var(--text-dim);
	min-height: 0;
	margin: 0;
	padding: 0;
}

/* ============================================================
   FLASH
   ============================================================ */

.flash-overlay {
	pointer-events: none;
	position: fixed;
	inset: 0;
	z-index: 1011;
	opacity: 0;
	transition: opacity 0.05s;
}

.flash-overlay.go {
	opacity: 0.15;
	transition: none;
}

/* ============================================================
   CEREMONY OVERLAY
   ============================================================ */

.ceremony-overlay,
.settings-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.75);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 500;
	animation: ceremony-fade-in 0.3s ease-out;
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	border-radius: var(--radius-game);
}

.ceremony-card,
.settings-card {
	background: var(--bg2);
	border-radius: var(--radius-tile);
	width: 90%;
	display: flex;
	flex-direction: column;
	box-shadow:
		0 12px 48px rgba(0, 0, 0, 0.7),
		0 0 0 1px rgba(255, 255, 255, 0.06);
	animation: ceremony-card-in 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.ceremony-card {
	padding: 36px 32px 28px;
	max-width: 340px;
	text-align: center;
	gap: 14px;
	align-items: center;
}

.settings-card {
	padding: 32px 28px 24px;
	max-width: 380px;
	gap: 18px;
}

.ceremony-glow {
	font-family: var(--font-mono);
	font-weight: 900;
	font-size: 11px;
	letter-spacing: 4px;
	text-transform: uppercase;
	padding: 5px 16px 4px;
	border-radius: 20px;
	border: 1.5px solid currentColor;
	animation: ceremony-glow-pulse 2s ease-in-out infinite;
}

/* Try to keep size similar as settings title */
.ceremony-title {
	font-family: var(--font-ui);
	/* font-weight: 900; */
	text-transform: uppercase;

	--font-size-base: clamp(20px, 5vw, 26px);
	--font-size-xs: 11px;
	font-size: var(--font-size-xs);

	color: var(--cream);

	--spacing-base: 0.02em;
	--spacing-lg: 0.02em;
	letter-spacing: var(--spacing-lg);
}

.ceremony-desc {
	font-family: var(--font-ui);
	font-size: 13px;
	line-height: 1.7;
	color: var(--text-dim);
	max-width: 280px;
	margin: 0;
}

@keyframes ceremony-fade-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes ceremony-card-in {
	from {
		transform: translateY(24px) scale(0.96);
		opacity: 0;
	}
	to {
		transform: translateY(0) scale(1);
		opacity: 1;
	}
}

@keyframes ceremony-glow-pulse {
	0%,
	100% {
		box-shadow: 0 0 6px currentColor;
		opacity: 0.8;
	}
	50% {
		box-shadow: 0 0 18px currentColor;
		opacity: 1;
	}
}

/* ── SETTINGS OVERLAY ────────────────────────────────────────────────────────── */

.settings-heading {
	font-family: var(--font-mono);
	font-size: 11px;
	letter-spacing: 0.15em;
	text-transform: uppercase;
	color: var(--text-dim);
	text-align: center;
	margin-bottom: 2px;
}

.settings-section {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.settings-section-title {
	font-family: var(--font-mono);
	font-size: 9px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--text-mute);
	border-bottom: 1px solid var(--surface);
	padding-bottom: 4px;
}

.settings-row {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 13px;
	color: var(--text);
	font-family: var(--font-ui);
}

.settings-row > span:first-child {
	flex: 1;
	font-weight: 600;
}

/* Toggle pill — same ON/OFF color language as BGM/SFX buttons */
.settings-toggle {
	font-family: var(--font-mono);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.08em;
	padding: 4px 14px;
	border-radius: 20px;
	border: none;
	cursor: pointer;
	background: var(--surface2);
	color: var(--text-dim);
	box-shadow: var(--shadow-sm);
	transition:
		color 0.1s,
		background 0.1s,
		box-shadow 0.1s,
		transform 0.07s;
	user-select: none;
	min-width: 48px;
}
.settings-toggle.on {
	color: var(--blue);
	background: rgba(91, 141, 217, 0.12);
}
.settings-toggle:focus-visible {
	outline: 2px solid var(--cream);
	outline-offset: 2px;
}

.settings-toggle:active {
	transform: translateY(2px);
	box-shadow: none;
}
.settings-toggle:disabled {
	opacity: 0.35;
	cursor: not-allowed;
	pointer-events: none;
}

/* Help tooltips for settings */
.help-icon {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 14px;
	height: 14px;
	margin-left: 6px;
	font-size: 9px;
	font-weight: 700;
	color: var(--text-dim);
	background: var(--surface2);
	border-radius: 50%;
	cursor: help;
	vertical-align: middle;
}

.help-icon .help-text {
	display: none;
	position: absolute;
	bottom: calc(100% + 6px);
	left: 50%;
	transform: translateX(-50%);
	background: var(--surface1);
	color: var(--text);
	font-size: 11px;
	font-weight: 400;
	padding: 6px 10px;
	border-radius: 4px;
	border: 1px solid var(--surface3);
	box-shadow: var(--shadow-md);
	white-space: nowrap;
	max-width: 250px;
	z-index: 10000;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.15s ease;
}

.help-icon:hover .help-text,
.help-icon:focus .help-text {
	display: block;
	opacity: 1;
}

/* Slider — narrower variant for settings rows */
.settings-slider {
	width: 80px;
	-webkit-appearance: none;
	appearance: none;
	height: 6px;
	border-radius: 3px;
	cursor: pointer;
	touch-action: pan-x;
	background: var(--surface);
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45);
}
.settings-slider::-webkit-slider-runnable-track {
	height: 6px;
	border-radius: 3px;
	background: var(--surface);
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45);
}
.settings-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 20px;
	height: 20px;
	margin-top: -7px;
	border-radius: var(--radius-tile);
	background: #e8e0cc;
	border: none;
	box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}
.settings-slider::-moz-range-track {
	height: 6px;
	border-radius: 3px;
	background: var(--surface);
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45);
}
.settings-slider::-moz-range-thumb {
	width: 20px;
	height: 20px;
	border-radius: var(--radius-tile);
	background: #e8e0cc;
	border: none;
	box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}

/* ── RESPONSIVE: smaller gear on narrow screens ─────────────────────────────── */
@media (max-width: 520px) {
	.settings-gear {
		top: 4px;
		right: 4px;
		font-size: 16px;
	}
	.settings-slider {
		width: 60px;
	}
}

/* ============================================================
   CREDITS
   ============================================================ */

.credits-wrap {
	position: fixed;
	bottom: 8px;
	right: 5px;
	z-index: 1010;
}

@media (max-width: 640px) {
	.credits-wrap {
		position: absolute;
	}
}

.credits-title {
	font-family: var(--font-mono);
	font-weight: 700;
	font-size: 10px;
	color: var(--text-mute);
	cursor: pointer;
	padding: 4px 10px;
	border-radius: 20px;
	transition: all 0.15s;
	border: none;
	background: none;
}

.credits-title:hover {
	color: var(--cream);
}

.credits-title:focus-visible {
	outline: 2px solid var(--cream);
	outline-offset: 2px;
}

.credits-popup {
	display: none;
	position: absolute;
	bottom: 100%;
	right: 0;
	margin-bottom: 6px;
	background: var(--bg2);
	border-radius: var(--radius);
	padding: 10px 14px;
	font-size: 11px;
	font-family: var(--font-ui);
	color: var(--text-dim);
	white-space: normal;
	width: 380px;
	max-width: 95vw;
	user-select: text;
	-webkit-user-select: text;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.credits-wrap:hover .credits-popup,
.credits-wrap:focus-within .credits-popup,
.credits-wrap.open .credits-popup {
	display: block;
}

.credits-section {
	margin-bottom: 10px;
}

.credits-section:last-child {
	margin-bottom: 0;
}

.credits-label {
	font-size: 9px;
	font-weight: 600;
	color: var(--text-mute);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 4px;
	opacity: 0.8;
}

.credits-names {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 2px 8px;
}

.credits-name {
	display: inline-block;
	font-size: 10px;
	line-height: 1.5;
	color: var(--cream);
	padding: 2px 4px;
	border-radius: 4px;
	position: relative;
	z-index: 0;
	transition:
		transform 0.3s,
		background 0.3s,
		box-shadow 0.3s;
	will-change: transform;
	cursor:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ctext y='18' font-size='18'%3E🙏%3C/text%3E%3C/svg%3E") 12 18,
		pointer;
}

.credits-name::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: linear-gradient(90deg, transparent 20%, rgba(232, 162, 58, 0.18) 50%, transparent 80%);
	background-size: 200% 100%;
	background-position: 200% 0;
	opacity: 0;
	transition: opacity 0.3s;
	pointer-events: none;
}

.credits-name:hover {
	transform: scale(1.08);
	z-index: 1;
	background: rgba(232, 162, 58, 0.08);
	box-shadow: 0 0 14px rgba(232, 162, 58, 0.2);
}

.credits-name:hover::after {
	opacity: 1;
	animation: signal-sweep 1.2s linear infinite;
}

@keyframes signal-sweep {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}

.credits-tools {
	font-size: 9px;
	line-height: 1.5;
	color: var(--text-dim);
}

.credits-tool {
	display: inline-block;
	color: var(--cream);
	padding: 1px 4px;
	border-radius: 4px;
	position: relative;
	z-index: 0;
	transition:
		transform 0.3s,
		background 0.3s,
		box-shadow 0.3s;
	will-change: transform;
	cursor:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ctext y='18' font-size='18'%3E⚡%3C/text%3E%3C/svg%3E") 12 18,
		pointer;
}

.credits-tool::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: linear-gradient(135deg, transparent 20%, rgba(232, 162, 58, 0.18) 50%, transparent 80%);
	background-size: 200% 200%;
	background-position: 100% 100%;
	opacity: 0;
	transition: opacity 0.3s;
	pointer-events: none;
}

.credits-tool:hover {
	transform: scale(1.08);
	z-index: 1;
	background: rgba(232, 162, 58, 0.08);
	box-shadow: 0 0 12px rgba(232, 162, 58, 0.18);
}

.credits-tool:hover::after {
	opacity: 1;
	animation: zap-sweep 0.9s linear infinite;
}

@keyframes zap-sweep {
	0% {
		background-position: 100% 100%;
	}
	50% {
		background-position: 0% 0%;
	}
	100% {
		background-position: 100% 100%;
	}
}

.credits-note {
	font-size: 9px;
	color: var(--text-mute);
	opacity: 0.6;
	margin-top: 2px;
}

.credits-tracks {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 2px 16px;
}

.credits-track {
	font-size: 9px;
	line-height: 1.5;
	padding: 3px 6px;
	border-radius: 4px;
	position: relative;
	z-index: 0;
	color: var(--text-dim);
	transition:
		transform 0.3s,
		background 0.3s,
		box-shadow 0.3s;
	will-change: transform;
	cursor:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ctext y='18' font-size='18'%3E🎶%3C/text%3E%3C/svg%3E") 12 18,
		pointer;
}

.credits-track::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: linear-gradient(to bottom, transparent 10%, rgba(232, 162, 58, 0.15) 50%, transparent 90%);
	background-size: 100% 200%;
	background-position: 0 100%;
	opacity: 0;
	transition: opacity 0.3s;
	pointer-events: none;
}

.credits-track:hover {
	transform: scale(1.06);
	z-index: 1;
	background: rgba(232, 162, 58, 0.06);
	box-shadow: 0 0 12px rgba(232, 162, 58, 0.15);
}

.credits-track:hover::after {
	opacity: 1;
	animation: wave-pulse 1.4s ease-in-out infinite;
}

@keyframes wave-pulse {
	0% {
		background-position: 0 100%;
	}
	50% {
		background-position: 0 0%;
	}
	100% {
		background-position: 0 100%;
	}
}

.credits-track-title {
	color: var(--cream);
}

.credits-track-license {
	color: var(--text-mute);
	font-size: 8px;
	opacity: 0.6;
	margin-left: 2px;
}

.credits-thanks {
	font-size: 9px;
	line-height: 1.5;
	color: var(--text-dim);
}

.credits-thanks a {
	display: inline-block;
	color: var(--cream);
	text-decoration: none;
	padding: 1px 4px;
	border-radius: 4px;
	position: relative;
	z-index: 0;
	transition:
		transform 0.3s,
		background 0.3s,
		box-shadow 0.3s;
	will-change: transform;
	cursor:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ctext y='18' font-size='18'%3E💡%3C/text%3E%3C/svg%3E") 12 18,
		pointer;
}

.credits-thanks a::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: radial-gradient(circle at center, rgba(232, 162, 58, 0.2) 0%, transparent 70%);
	background-size: 100% 100%;
	opacity: 0;
	transition: opacity 0.3s;
	pointer-events: none;
}

.credits-thanks a:hover {
	transform: scale(1.08);
	z-index: 1;
	background: rgba(232, 162, 58, 0.08);
	box-shadow: 0 0 16px rgba(232, 162, 58, 0.2);
	opacity: 1;
	text-decoration: none;
}

.credits-thanks a:hover::after {
	opacity: 1;
	animation: glow-spark 1.6s ease-in-out infinite;
}

@keyframes glow-spark {
	0%,
	100% {
		transform: scale(1);
		opacity: 0.6;
	}
	50% {
		transform: scale(1.3);
		opacity: 1;
	}
}

/* ============================================================
   TUTORIAL GLOW
   ============================================================ */

.tutorial-glow {
	/* biome-ignore lint/complexity/noImportantStyles: utility class must override component display */
	border: 2px solid var(--amber) !important;
	/* biome-ignore lint/complexity/noImportantStyles: utility class must override component display */
	box-shadow: 0 0 16px rgba(232, 162, 58, 0.4) !important;
	border-radius: var(--radius-tile);
	animation: tutorial-pulse 1.5s ease-in-out infinite;
}

.tutorial-glow-text {
	color: var(--coral);
	animation: pulse 1.5s ease-in-out infinite;
}

@keyframes tutorial-pulse {
	0%,
	100% {
		box-shadow: 0 0 16px rgba(232, 162, 58, 0.4);
	}
	50% {
		box-shadow: 0 0 28px rgba(232, 162, 58, 0.7);
	}
}

.tutorial-done {
	opacity: 0.45;
	pointer-events: none;
	transition: opacity 0.3s ease;
}

.tutorial-done input,
.tutorial-done button {
	opacity: 0.5;
}

/* Circular timer */

.timer-ring-wrap {
	position: absolute;
	top: 6px;
	right: 10px;
	width: 48px;
	height: 48px;

	display: flex;
	align-items: center;
	justify-content: center;

	/* WARNING: Scanlines interferring from #game-lcd::before ?? (it sits at z 2) */
	z-index: 2;
}

.timer-ring {
	position: absolute;
	inset: 0;

	will-change: transform;
	transform: rotate(-90deg);
}

.timer-ring-track {
	fill: none;
	stroke: var(--surface2);
	stroke-width: 3.5;
}

.timer-ring-fill {
	fill: none;
	stroke: var(--te-orange);
	stroke-width: 3.5;
	stroke-linecap: round;
	stroke-dasharray: 125.6; /* 2π × r=20 */
	stroke-dashoffset: 0;
	transition:
		stroke-dashoffset 1s linear,
		stroke 0.3s;
}

.timer-ring-fill.urgent {
	stroke: var(--red);
}

.timer-ring-wrap::before,
.timer-ring-wrap::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 2px solid color-mix(in srgb, var(--red) 25%, transparent);
	opacity: 0;
	pointer-events: none;
	z-index: 0;
}
.timer-ring-wrap.urgent::after {
	animation: ripple 1.2s cubic-bezier(0.22, 0.1, 0.25, 1) infinite;
}
.timer-ring-wrap.urgent::before {
	animation: ripple 1.2s cubic-bezier(0.22, 0.1, 0.25, 1) infinite;
	animation-delay: -0.6s;
}

@keyframes ripple {
	0% {
		transform: scale(0.8);
		opacity: 0.4;
	}
	100% {
		transform: scale(1.4);
		opacity: 0;
	}
}

.timer-ring-label {
	font-family: var(--font-mono);
	font-weight: 700;
	font-size: 14px;
	color: var(--text);
	position: relative;
	z-index: 1;
	transition: color 0.3s;
}

.timer-ring-label.urgent {
	color: var(--red);
}

/* ━━━ SCREEN-LEVELSELECT SIZING ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* The level select screen can be taller than other screens — don't clip it. */

#screen-levelselect {
	gap: 0.8rem;
}

#screen-levelselect h2 {
	font-size: clamp(18px, 5vw, 28px); /* slightly smaller to give grid room */
}

/* Show whichever screen matches the data attribute */
#game[data-screen="start"] #screen-start {
	display: flex;
}
#game[data-screen="dead"] #screen-dead {
	display: flex;
}
#game[data-screen="levelup"] #screen-levelup {
	display: flex;
}
#game[data-screen="victory"] #screen-victory {
	display: flex;
}
#game[data-screen="levelselect"] #screen-levelselect {
	display: flex;
}
#game[data-screen="game"] #screen-game {
	display: block;
}

/* ── PLAYBACK ROW ─────────────────────────────────────────────────────────── */

.pb-row {
	display: flex;
	gap: 6px;
	justify-content: center;
	margin-bottom: 14px;
}

.pb-btn {
	font-family: var(--font-mono);
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.08em;
	padding: 5px 12px;
	border-radius: var(--radius-tile);
	border: 1.5px solid var(--surface2);
	background: var(--surface);
	color: var(--text-mute);
	cursor: pointer;
	transition:
		color 0.1s,
		border-color 0.1s,
		background 0.1s,
		transform 0.07s,
		box-shadow 0.07s;
	box-shadow: var(--shadow-sm);
	user-select: none;
}

.pb-btn:focus-visible {
	outline: 2px solid var(--cream);
	outline-offset: 2px;
}

.pb-btn:hover {
	color: var(--text-dim);
	border-color: var(--surface2);
}

.pb-btn:active {
	transform: translateY(2px);
	box-shadow: none;
}

/* Active state — each button gets its own tint to distinguish channels */
#pb-target.active {
	background: rgba(91, 141, 217, 0.15); /* blue tint — matches target wave color */
	border-color: var(--blue);
	color: var(--blue);
	box-shadow: 0 0 8px rgba(91, 141, 217, 0.2);
}

#pb-yours.active {
	background: rgb(232, 96, 74, 0.12); /* coral tint — matches yours wave color */
	border-color: var(--coral);
	color: var(--coral);
	box-shadow: 0 0 8px rgba(245, 239, 224, 0.15);
}

#pb-ab.active {
	background: rgba(109, 200, 122, 0.12); /* green tint — both channels = match state */
	border-color: var(--green);
	color: var(--green);
	box-shadow: 0 0 8px rgba(109, 200, 122, 0.15);
}

/* Disabled appearance when no round is active */
.pb-btn:disabled {
	opacity: 0.25;
	cursor: not-allowed;
	pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Additions for persistence + level select + menu button
   ───────────────────────────────────────────────────────────────────────── */

/* ━━━ LEVEL SELECT GRID ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.level-select-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 8px;
	width: 100%;
	max-width: 340px;
	margin: 0 auto 16px;
}

.level-select-btn {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 3px;
	padding: 10px 12px;
	border-radius: var(--radius-tile);
	border: none;
	cursor: pointer;
	font-family: var(--font-ui);
	text-align: left;
	transition:
		transform 0.07s,
		box-shadow 0.07s,
		outline 0.1s;
	box-shadow: var(--shadow-sm);
}

.level-select-btn:focus-visible {
	outline: 2px solid var(--cream);
	outline-offset: 1px;
}

/* Unlocked — playable */
.level-select-btn.unlocked {
	background: var(--surface2);
	color: var(--text);
}

.level-select-btn.unlocked:hover {
	background: var(--color-surface-hover);
	/* background: color-mix(in oklch, var(--surface2) 85%, white); */
}

.level-select-btn.unlocked:active {
	transform: translateY(2px);
	box-shadow: none;
}

/* Current highest unlocked level — amber highlight */
.level-select-btn.current {
	background: var(--surface2);
	outline: 1.5px solid var(--amber);
	outline-offset: -1.5px;
}

/* Locked — not yet reached */
.level-select-btn.locked {
	background: var(--surface);
	opacity: 0.35;
	cursor: not-allowed;
}

/* Inner text elements */
.ls-num {
	font-family: var(--font-mono);
	font-weight: 700;
	font-size: 13px;
	color: var(--cream);
	letter-spacing: 0.05em;
}

.level-select-btn.locked .ls-num {
	color: var(--text-mute);
}

.ls-score {
	font-size: 10px;
	font-weight: 700;
	font-family: var(--font-ui);
	color: var(--amber);
}

.level-select-btn.locked .ls-score {
	color: var(--text-mute);
}

.ls-tags {
	font-size: 9px;
	font-weight: 600;
	font-family: var(--font-ui);
	color: var(--text-mute);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

/* ━━━ MENU BUTTON ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
#btn-hint {
	color: var(--amber);
}
#btn-skip {
	color: var(--red);
}
#menu-btn {
	color: var(--text-dim);
}
#skip-tut {
	color: var(--green);
}
#btn-freeplay-ready {
	color: var(--green);
}

/* The color: var(--text-dim) keeps menu visually subordinate
   to HINT (amber) and SKIP (red) so it doesn't compete for attention. */

/* ━━━ UNLOCK MSG ON START SCREEN ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

#unlock-msg {
	font-family: var(--font-mono);
	letter-spacing: 0.04em;
}

/* ── GRACE ROUND: blue timer ring is handled via JS inline style.
      Only the urgent pulsing needs to be suppressed — grace rounds never urgent. */

/* ── FREE-PLAY WARMUP ───────────────────────────────────────────────────────── */

/* Meter fades out during free-play — it's meaningless without a target */
/* (opacity set directly via JS on .meter-row) */

/* READY button pulses gently to draw attention without being annoying */
#btn-freeplay-ready {
	animation: pulse 2s ease-in-out infinite;
}

/* ── LEVEL-UP MESSAGE — longer text now, needs room to breathe */
#lu-msg {
	max-width: 280px;
	line-height: 1.8;
}

/* ── LEVEL-UP STATS GRID ───────────────────────────────────────────── */
.lu-stats-grid {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 8px;
	margin: 18px 0;
	width: 260px;
}

.lu-stat {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: 6px 8px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
}

.lu-stat-label {
	font-size: 9px;
	color: var(--text-dim);
	text-transform: uppercase;
	letter-spacing: 1px;
}

.lu-stat-value {
	font-size: 16px;
	font-weight: 700;
	color: var(--cyan);
	font-family: var(--font-mono);
}

/* ── NOISE ATMOSPHERE INDICATOR ─────────────────────────────────────────────
   Small visual cue in the scope label area when target has noise.
   JS adds .has-noise to .scope-wrap; CSS animates a subtle static texture. */

.scope-wrap.has-noise::before,
.scope-wrap.has-noise::after {
	opacity: 0.5;
	animation: scope-static 0.08s steps(1) infinite;
}

@keyframes scope-static {
	0% {
		transform: translateX(0);
	}
	25% {
		transform: translateX(1px);
	}
	50% {
		transform: translateX(-1px);
	}
	75% {
		transform: translateX(0.5px);
	}
	100% {
		transform: translateX(0);
	}
}

/* ============================================================
   STAMP LAYER
   Chunky physical tile stamps — Threes-inspired warm presence.
   Feels like a toy stamped it onto the screen, not a UI label.
   ============================================================ */

#stamp-layer {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 200;
	overflow: hidden;
}

.stamp {
	position: absolute;
	font-family: var(--font-ui);
	font-weight: 900;
	font-size: 1.1rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	padding: 8px 16px 7px;
	border-radius: 14px;
	border: 3px solid currentColor;
	box-shadow:
		0 4px 0 rgba(0, 0, 0, 0.5),
		0 0 18px rgba(0, 0, 0, 0.4);
	opacity: 0;
	user-select: none;
	white-space: nowrap;
	transform-origin: center center;
	animation: stamp-in 750ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

/* Solid warm fills — physical tiles, not transparent labels */
.stamp-hint {
	color: var(--bg);
	background: var(--amber);
	border-color: #c47d1a;
	text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}
.stamp-skip {
	color: var(--bg);
	background: var(--coral);
	border-color: #b83d28;
	text-shadow: 0 1px 0 rgba(255, 255, 255, 0.15);
}
.stamp-fail {
	color: var(--cream);
	background: var(--red-dark);
	border-color: var(--red-deep);
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.stamp-success {
	color: var(--bg);
	background: var(--cream);
	border-color: #b8a882;
	text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Combo streaks — escalating energy: green → gold → platinum */
.stamp-combo_2 {
	color: var(--bg);
	background: #33cc77;
	border-color: #1f9955;
	text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}
.stamp-combo_3 {
	color: var(--bg);
	background: #f0b030;
	border-color: #c48a1a;
	text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}
.stamp-combo_5 {
	color: var(--cream);
	background: #5a4a8a;
	border-color: #3d2f66;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
	box-shadow:
		0 0 24px rgba(200, 160, 255, 0.5),
		0 4px 0 rgba(0, 0, 0, 0.5);
}

/* Broke variants — ghost of the real thing. Smaller, dashed, faded.
   Like the machine ran out of ink. */
.stamp-hint_broke {
	color: var(--amber);
	background: rgba(232, 162, 58, 0.12);
	border-color: var(--amber);
	border-style: dashed;
	font-size: 0.85rem;
	padding: 5px 12px 4px;
	border-radius: 10px;
	opacity: 0.75;
	box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}
.stamp-skip_broke {
	color: var(--coral);
	background: rgba(232, 96, 74, 0.12);
	border-color: var(--coral);
	border-style: dashed;
	font-size: 0.85rem;
	padding: 5px 12px 4px;
	border-radius: 10px;
	opacity: 0.75;
	box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

/* ━━━ TARGET REVEAL ON DEATH SCREEN ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.target-reveal {
	font-family: var(--font-mono);
	font-size: 10px;
	color: var(--text-mute);
	letter-spacing: 0.04em;
	max-width: 300px;
	line-height: 1.6;
	padding: 6px 12px;
	background: rgba(0, 0, 0, 0.3);
	border-radius: var(--radius-sm);
	border: 1px solid var(--surface2);
}

/* ── MINI-GAME SCREEN ────────────────────────────────────────── */

#screen-minigame {
	padding: 1.5rem 1rem;
	gap: 0.75rem;
}

#game[data-screen="minigame"] #screen-minigame {
	display: flex;
}

.mg-title {
	font-family: var(--font-mono);
	font-size: 10px;
	color: var(--amber);
	letter-spacing: 0.15em;
	text-transform: uppercase;
	margin-bottom: 2px;
}

.mg-name {
	font-family: var(--font-ui);
	font-weight: 700;
	font-size: clamp(16px, 4vw, 22px);
	color: var(--cream);
	letter-spacing: 0.05em;
}

.mg-desc {
	font-size: 11px;
	color: var(--text-dim);
	max-width: 300px;
	line-height: 1.7;
	margin-bottom: 4px;
}

.mg-canvas-wrap {
	background: var(--bg);
	border: 1px solid var(--surface2);
	border-radius: var(--radius-sm);
	padding: 6px;
	width: 100%;
}

canvas#mg-canvas {
	display: block;
	width: 100%;
	height: 110px;
	border-radius: var(--radius-xs);
	background: var(--bg);
}

.mg-action-btn {
	font-family: var(--font-ui);
	font-weight: 700;
	font-size: clamp(12px, 3vw, 15px);
	letter-spacing: 0.1em;
	padding: 0.7rem 2.5rem;
	cursor: pointer;
	border-radius: var(--radius-tile);
	background: transparent;
	color: var(--cream);
	border: 2px solid var(--cream);
	transition:
		background 0.1s,
		box-shadow 0.1s,
		transform 0.07s;
	margin-top: 4px;
	box-shadow: var(--shadow-sm);
	user-select: none;
}

.mg-action-btn:hover {
	background: rgba(245, 239, 224, 0.08);
	box-shadow:
		0 0 16px rgba(245, 239, 224, 0.15),
		var(--shadow-sm);
}

.mg-action-btn:focus-visible {
	outline: 2px solid var(--cream);
	outline-offset: 2px;
}

.mg-action-btn:active {
	transform: translateY(2px);
	box-shadow: none;
}

.mg-action-btn.amber {
	color: var(--amber);
	border-color: var(--amber);
}

.mg-action-btn.amber:hover {
	background: rgba(232, 162, 58, 0.08);
	box-shadow:
		0 0 16px rgba(232, 162, 58, 0.15),
		var(--shadow-sm);
}

.mg-action-btn:disabled {
	opacity: 0.25;
	cursor: not-allowed;
	pointer-events: none;
}

.mg-status {
	font-size: 13px;
	color: var(--text-mute);
	min-height: 20px;
	letter-spacing: 0.04em;
	transition: color 0.2s;
}

.mg-status.win {
	color: var(--green);
}
.mg-status.bad {
	color: var(--red);
}
.mg-status.amber {
	color: var(--amber);
}

.mg-bar-wrap {
	width: 100%;
	height: 8px;
	background: var(--bg);
	border-radius: var(--radius-xs);
	overflow: hidden;
	border: 1px solid var(--surface2);
}

.mg-bar {
	height: 100%;
	border-radius: var(--radius-xs);
	transition:
		width 0.05s,
		background 0.2s;
	background: var(--green);
}

.mg-bonus-tag {
	font-size: 10px;
	font-family: var(--font-mono);
	color: var(--text-mute);
	letter-spacing: 0.05em;
}

@keyframes stamp-in {
	0% {
		opacity: 0;
		transform: var(--stamp-rot) var(--stamp-scale-start, scale(1.8)) translateY(-6px);
	}
	16% {
		opacity: 1;
		transform: var(--stamp-rot) scale(0.88) translateY(2px);
	}
	30% {
		opacity: 1;
		transform: var(--stamp-rot) scale(1.06) translateY(0px);
	}
	44% {
		opacity: 1;
		transform: var(--stamp-rot) scale(0.97) translateY(0px);
	}
	58% {
		opacity: 1;
		transform: var(--stamp-rot) scale(1) translateY(0px);
	}
	76% {
		opacity: 1;
		transform: var(--stamp-rot) scale(1) translateY(0px);
	}
	100% {
		opacity: 0;
		transform: var(--stamp-rot) scale(0.95) translateY(4px);
	}
}

/* ============================================================
   UNIFIED DRAG CONTROLS  (≤ 520px)
   ============================================================ */

.param-tabs {
	display: grid;
	grid-template-columns: repeat(var(--tab-count, 4), 1fr);
	background: var(--bg2);
	border-top: 1px solid var(--surface);
	border-bottom: 1px solid var(--surface);
}

.param-tab {
	background: none;
	border: none;
	border-right: 1px solid var(--surface);
	padding: 6px 4px 0;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1px;
	color: var(--text-dim);
	transition:
		background 0.1s,
		color 0.1s;
	font-family: var(--font-ui);
	touch-action: manipulation;
}

.param-tab:last-child {
	border-right: none;
}

.param-tab .mpt-label {
	font-size: 9px;
	font-weight: 800;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: inherit;
}

.param-tab .mpt-val {
	font-family: var(--font-mono);
	font-size: 11px;
	font-weight: 700;
	color: var(--text-dim);
	transition: color 0.1s;
}

.mpt-glyph {
	width: 20px;
	height: 20px;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.5;
	stroke-linecap: round;
	stroke-linejoin: round;
	overflow: visible;
}

.mpt-track {
	flex-shrink: 0;
	width: 100%;
	height: 3px;
	border-radius: 2px;
	margin-top: auto;
	--_mpt-track-bg: rgba(22, 20, 17, 0.6);
	background: linear-gradient(to right, var(--_mpt-track-bg) var(--pct, 0%), var(--surface) var(--pct, 0%));
}
.param-tab.locked .mpt-track {
	opacity: 0.28;
}

.param-tab.active {
	background: var(--surface);
	color: var(--amber);
}

.param-tab.active .mpt-val {
	color: var(--amber);
}

.param-tab.locked {
	opacity: 0.28;
	pointer-events: none;
}

.drag-zone {
	position: relative;
	min-height: 148px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: var(--bg);
	cursor: ns-resize;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
	border-bottom: 1px solid var(--surface);
}

.drag-value {
	font-family: var(--font-mono);
	font-size: 40px;
	font-weight: 700;
	color: var(--amber);
	line-height: 1;
	letter-spacing: -0.02em;
}

.drag-track-fill {
	background: var(--amber);
	border-radius: 2px;
	transition: height 0.06s linear;
	width: 100%;
}

.drag-zone.locked {
	opacity: 0.4;
	cursor: not-allowed;
}
.drag-zone.locked .drag-value {
	color: var(--text-dim);
}
.drag-zone.locked .drag-track-fill {
	background: var(--text-dim);
	opacity: 0.3;
}

.drag-hint {
	position: absolute;
	top: 10px;
	left: 0;
	right: 0;
	text-align: center;
	font-size: 9px;
	font-family: var(--font-ui);
	font-weight: 700;
	letter-spacing: 0.1em;
	color: var(--text-dim);
	text-transform: uppercase;
	opacity: 0.5;
	pointer-events: none;
}

.drag-label {
	font-size: 11px;
	font-family: var(--font-ui);
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--text-dim);
	margin-bottom: 6px;
}

.drag-unit {
	font-size: 13px;
	font-family: var(--font-mono);
	color: var(--text-dim);
	margin-top: 5px;
	letter-spacing: 0.05em;
	min-height: 18px;
}

.drag-track {
	position: absolute;
	right: 16px;
	top: 0;
	bottom: 0;
	width: 3px;
	background: var(--surface);
	border-radius: 2px;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	overflow: hidden;
}

.drag-arrows {
	position: absolute;
	left: 16px;
	top: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 24px;
	color: var(--surface2);
	font-size: 18px;
	pointer-events: none;
}

.param-list {
	display: none;
}

.hardware-grid {
	display: block;
}

.type-btns {
	grid-template-columns: repeat(6, 1fr);
	gap: 4px;
}

.type-btn {
	padding: 8px 2px 6px;
}

/* ============================================================
   PREFERS-REDUCED-MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		/* biome-ignore lint/complexity/noImportantStyles: utility class must override component display */
		animation-duration: 0.01ms !important;
		/* biome-ignore lint/complexity/noImportantStyles: utility class must override component display */
		animation-iteration-count: 1 !important;
		/* biome-ignore lint/complexity/noImportantStyles: utility class must override component display */
		transition-duration: 0.01ms !important;
	}
}
