@charset "utf-8";

:root {
	--bg:#0b0d14;
	--glass:rgba(18, 21, 32, 0.72);
	--panel:#141824;
	--line:rgba(255, 255, 255, 0.09);
	--text:#e7eaee;
	--muted:#8a929e;
	--accent:#4fd1c5;
	--small:#5ef2e2;
	--big:#ff8a6b;
}

*, *::before, *::after	{	box-sizing:border-box; }

html, body {
	margin:0;
	padding:0;
	height:100%;
	overflow:hidden;
}

body {
	background:radial-gradient(120% 90% at 50% 30%, #1a1f33 0%, var(--bg) 70%);
	color:var(--text);
	font-family:'Space Grotesk', system-ui, sans-serif;
	font-size:14px;
	-webkit-font-smoothing:antialiased;
	-webkit-user-select:none;
	user-select:none;
	-webkit-touch-callout:none;
}

.hide {
	display:none !important;
}

canvas.rink {
	position:fixed;
	inset:0;
	display:block;
	touch-action:none;
}

/* Score panel, top left */

/* The page title, glowing above the HUD */
.brand {
	position:fixed;
	top:14px;
	left:18px;
	z-index:2;
	margin:0;
	color:#fff;
	font:700 24px 'Space Grotesk', system-ui, sans-serif;
	letter-spacing:0.04em;
	line-height:1;
	text-shadow:0 0 4px rgba(255, 255, 255, 0.9), 0 0 12px rgba(255, 255, 255, 0.6), 0 0 28px rgba(190, 220, 255, 0.45);
	pointer-events:none;
	-webkit-user-select:none;
	user-select:none;
}

.hud {
	position:fixed;
	top:52px;
	left:16px;
	z-index:2;
	min-width:150px;
	padding:12px 16px;
	background:var(--glass);
	-webkit-backdrop-filter:blur(12px);
	backdrop-filter:blur(12px);
	border:1px solid var(--line);
	border-radius:14px;
}

.hud.idle {
	visibility:hidden;
}

.stats {
	display:grid;
	grid-template-columns:auto auto;
	gap:2px 14px;
	margin:0;
}

.stats dt {
	color:var(--muted);
	font-size:11px;
	text-transform:uppercase;
	letter-spacing:0.05em;
	align-self:center;
}

.stats dd {
	margin:0;
	text-align:right;
	font-weight:700;
	font-size:18px;
	font-variant-numeric:tabular-nums;
}

.stats .sub {
	font-size:13px;
	font-weight:500;
}

.stats hr {
	grid-column:1 / -1;
	width:100%;
	margin:6px 0 4px;
	border:0;
	border-top:1px solid var(--line);
}

/* Fire meter: fills orange with hard hits, then runs down while you burn */
.stats .meter {
	position:relative;
	align-self:center;
	min-width:96px;
	height:16px;
	overflow:hidden;
	border-radius:8px;
	background:rgba(255, 179, 71, 0.1);
	box-shadow:inset 0 0 0 1px rgba(255, 179, 71, 0.3);
}

.meter_fill {
	position:absolute;
	left:0;
	top:0;
	bottom:0;
	width:0;
	background:linear-gradient(90deg, #ff6a3d, #ffb347);
	transition:width 0.15s;
}

.meter_text {
	position:relative;
	display:block;
	padding:0 6px;
	font-size:10px;
	line-height:16px;
	text-align:right;
	color:#fff;
	text-shadow:0 1px 2px rgba(0, 0, 0, 0.7);
}

.meter.burning {
	box-shadow:inset 0 0 0 1px #ffd27a, 0 0 12px rgba(255, 179, 71, 0.8);
	animation:burn 0.5s ease-in-out infinite alternate;
}

.meter.burning .meter_fill {
	transition:none;
}

@keyframes burn {
	from { filter:brightness(1); }
	to   { filter:brightness(1.35); }
}

.stats .floor_c   { color:#8fb2f6; }
.stats .ceiling_c { color:#cfaef7; }


/* Corner buttons */

.corner {
	position:fixed;
	top:16px;
	right:16px;
	display:flex;
	gap:8px;
	z-index:6; /* above the pause screen, so Settings and Resume are always reachable */
}

.icon {
	display:flex;
	align-items:center;
	justify-content:center;
	width:38px;
	height:38px;
	padding:0;
	background:var(--glass);
	-webkit-backdrop-filter:blur(12px);
	backdrop-filter:blur(12px);
	border:1px solid var(--line);
	border-radius:10px;
	color:var(--text);
	cursor:pointer;
}

.icon.active {
	border-color:rgba(255, 255, 255, 0.3);
}

.icon:hover {
	background:rgba(255, 255, 255, 0.1);
}

.icon svg {
	width:18px;
	height:18px;
	fill:none;
	stroke:currentColor;
	stroke-width:2;
	stroke-linecap:round;
	stroke-linejoin:round;
}

.icon svg .fill {
	fill:currentColor;
}


/* Popups (placed by script) */

.popups {
	position:fixed;
	inset:0;
	overflow:hidden;
	pointer-events:none;
	z-index:3;
}

.popup {
	position:absolute;
	transform:translate(-50%, -50%);
	white-space:nowrap;
	font-weight:700;
	letter-spacing:0.04em;
	text-shadow:0 2px 12px rgba(0, 0, 0, 0.6);
	animation:pop 1.3s ease-out forwards;
}

.popup.points { font-size:18px; color:#d6b8ff; text-shadow:0 0 14px rgba(176, 124, 240, 0.8); }
.popup.combo  { font-size:15px; color:#ffc2b0; }
.popup.combo.hot { font-size:17px; color:#ffd27a; text-shadow:0 0 12px rgba(255, 179, 71, 0.9); }
.popup.fire   { font-size:24px; color:#ffd27a; text-shadow:0 0 18px rgba(255, 106, 61, 0.9), 0 2px 12px rgba(0, 0, 0, 0.6); }
.popup.saved  { font-size:28px; color:#8ff0e4; text-shadow:0 0 18px rgba(94, 242, 226, 0.8), 0 2px 12px rgba(0, 0, 0, 0.6); }
.popup.down   { font-size:30px; color:#ffb39e; text-shadow:0 0 20px rgba(255, 138, 107, 0.8), 0 2px 12px rgba(0, 0, 0, 0.6); }
.popup.level  { font-size:46px; color:#f2e6ff; text-shadow:0 0 24px rgba(176, 124, 240, 0.9), 0 2px 12px rgba(0, 0, 0, 0.6); }

@keyframes pop {
	0%   { opacity:0; margin-top:10px; scale:0.85; }
	12%  { opacity:1; margin-top:0; scale:1.08; }
	22%  { scale:1; }
	75%  { opacity:1; }
	100% { opacity:0; margin-top:-24px; }
}

@media (prefers-reduced-motion:reduce) {
	.popup { animation-name:fade; }
	@keyframes fade { 0%, 75% { opacity:1; } 100% { opacity:0; } }
}


/* Overlay */

.overlay {
	position:fixed;
	inset:0;
	z-index:5;
	display:flex;
	align-items:center;
	justify-content:center;
	padding:16px;
	background:rgba(5, 6, 10, 0.55);
	overflow:auto;
}

.card {
	width:min(100%, 380px);
	padding:24px;
	background:var(--glass);
	-webkit-backdrop-filter:blur(16px);
	backdrop-filter:blur(16px);
	border:1px solid var(--line);
	border-radius:18px;
	text-align:center;
}

.card h2 {
	margin:0 0 6px;
	font-size:26px;
	letter-spacing:0.04em;
}

.card p {
	margin:0 0 18px;
	color:var(--muted);
	line-height:1.5;
}

.card p b {
	color:var(--text);
}

.start {
	width:100%;
	height:44px;
	background:var(--accent);
	border:0;
	border-radius:11px;
	color:#08201d;
	font:700 16px 'Space Grotesk', system-ui, sans-serif;
	cursor:pointer;
}

.start:hover {
	filter:brightness(1.08);
}

.overlay_new {
	width:100%;
	margin-top:8px;
}

.scores table {
	width:100%;
	margin-top:18px;
	border-collapse:collapse;
	font-size:12px;
	font-variant-numeric:tabular-nums;
}

.scores th {
	color:var(--muted);
	font-weight:500;
	text-transform:uppercase;
	letter-spacing:0.05em;
	font-size:10px;
	padding:0 6px 4px;
}

.scores td {
	padding:3px 6px;
	border-top:1px solid var(--line);
}

.scores td:first-child {
	color:var(--muted);
}

.scores tr.new td {
	color:var(--accent);
	font-weight:700;
}

.keys {
	display:flex;
	flex-direction:column;
	gap:6px;
	margin-top:18px;
	color:var(--muted);
	font-size:12px;
	line-height:1.8;
}

.touch_keys {
	display:none;
}

@media (pointer:coarse) {
	.touch_keys { display:block; }
}

kbd {
	display:inline-block;
	min-width:22px;
	margin:0 2px;
	padding:1px 6px;
	border:1px solid var(--line);
	border-bottom-width:2px;
	border-radius:5px;
	background:rgba(255, 255, 255, 0.05);
	color:var(--text);
	font:500 11px 'Space Grotesk', system-ui, sans-serif;
	line-height:1.5;
}


/* Settings drawer */

.settings {
	position:fixed;
	top:0;
	right:0;
	bottom:0;
	width:min(100%, 360px);
	display:flex;
	flex-direction:column;
	background:var(--panel);
	border-left:1px solid var(--line);
	box-shadow:-20px 0 40px rgba(0, 0, 0, 0.4);
	z-index:10;
}

.settings_head, .settings_foot {
	display:flex;
	align-items:center;
	gap:8px;
	padding:14px 16px;
}

.settings_head {
	justify-content:space-between;
	border-bottom:1px solid var(--line);
}

.settings_head h2 {
	flex:1;
	margin:0;
	font-size:17px;
}

/* The hidden sections, and the PIN that shows them */
.settings:not(.unlocked) .locked {
	display:none;
}

/* A sub-heading within a section */
.settings_body .subhead {
	margin:12px 0 2px;
	padding-top:10px;
	border-top:1px solid var(--line);
	color:#fff;
	font-size:11px;
	font-weight:700;
	letter-spacing:0.08em;
	text-align:center;
	text-transform:uppercase;
}

.settings_body .sec_body > .subhead:first-child {
	margin-top:0;
	padding-top:0;
	border-top:0;
}

.lock_settings.active .shackle {
	transform:translate(0, -3px);
}

.pin {
	display:flex;
	flex-wrap:wrap;
	align-items:center;
	gap:8px;
	padding:10px 16px;
	border-bottom:1px solid var(--line);
}

.pin.hide {
	display:none;
}

.pin_input {
	width:110px;
	height:30px;
	padding:0 10px;
	background:rgba(0, 0, 0, 0.3);
	border:1px solid var(--line);
	border-radius:7px;
	color:var(--text);
	font:500 14px 'Space Grotesk', system-ui, sans-serif;
	letter-spacing:0.2em;
}

.pin_input:focus {
	outline:none;
	border-color:var(--accent);
}

.pin_msg {
	color:var(--muted);
	font-size:12px;
}

/* Out above the tower, the fire meter fades away (fire out there is a surprise) */
.hud .meter, .hud .meter_label {
	transition:opacity 0.8s;
}

.hud.escaped .meter, .hud.escaped .meter_label {
	opacity:0;
}

.settings_foot {
	flex-wrap:wrap;
	border-top:1px solid var(--line);
}

.settings_body {
	flex:1;
	overflow:auto;
	padding:4px 16px 16px;
	scrollbar-gutter:stable;
}

/* A plain fixed-width bar on the drawer's own color: no arrows, no shrinking overlay */
.settings_body::-webkit-scrollbar {
	width:18px;
}

.settings_body::-webkit-scrollbar-track {
	margin:6px 0;
	background:var(--panel);
}

/* Transparent borders inset the 9px thumb, leaving 6px clear of the drawer's right edge */
.settings_body::-webkit-scrollbar-thumb {
	background:rgba(255, 255, 255, 0.14) padding-box;
	border:solid transparent;
	border-width:0 6px 0 3px;
	/* Per-side radii so the visible 9px pill gets an even 4.5px curve despite the uneven borders */
	border-radius:7.5px 10.5px 10.5px 7.5px / 4.5px;
}

.settings_body::-webkit-scrollbar-thumb:hover {
	background-color:rgba(255, 255, 255, 0.26);
}

.settings_body::-webkit-scrollbar-button {
	display:none;
}

/* Firefox only (Chrome would let these override the rules above and bring its arrows back) */
@supports (-moz-appearance:none) {
	.settings_body {
		scrollbar-color:rgba(255, 255, 255, 0.18) var(--panel);
	}
}

/* Each section is a softly tinted card in its own pastel, carried into its heading, sliders and toggles */
.settings_body section {
	--hue:#aab4c4;
	margin-top:12px;
	padding:10px 14px 12px;
	background:color-mix(in srgb, var(--hue) 6%, transparent);
	border-left:3px solid color-mix(in srgb, var(--hue) 70%, transparent);
	border-radius:10px;
	/* Hairline top, right and bottom as offset shadows, so they taper into the left bar instead of butting against it.
	   Mixed with the drawer's color rather than transparent: the two overlap on the right, and an opaque color doesn't double up. */
	box-shadow:
		1px 1px color-mix(in srgb, var(--hue) 32%, var(--panel)),
		1px -1px color-mix(in srgb, var(--hue) 32%, var(--panel));
}

.settings_body .sec_small_ball { --hue:#8ff0e4; }
.settings_body .sec_big_ball   { --hue:#ffb39e; }
.settings_body .sec_tiles      { --hue:#c6b0ff; }
.settings_body .sec_rink       { --hue:#9cc8ff; }
.settings_body .sec_visual     { --hue:#f2e08f; }
.settings_body .sec_audio      { --hue:#ffc59e; }
.settings_body .sec_keys       { --hue:#ffadc8; }

.settings_body h3 {
	margin:0;
}

/* The heading is a button that folds its section away */
.fold {
	display:flex;
	align-items:center;
	justify-content:space-between;
	width:100%;
	margin:0;
	padding:4px 0 8px;
	background:none;
	border:0;
	color:var(--hue);
	font:700 11px 'Space Grotesk', system-ui, sans-serif;
	text-transform:uppercase;
	letter-spacing:0.08em;
	cursor:pointer;
}

.fold svg {
	transform:rotate(180deg); /* open: points up */
	width:14px;
	height:14px;
	fill:none;
	stroke:currentColor;
	stroke-width:2.5;
	stroke-linecap:round;
	stroke-linejoin:round;
	transition:transform 0.15s;
}

.folded .fold {
	padding-bottom:4px;
}

.folded .fold svg {
	transform:none; /* folded: points down */
}

.folded .sec_body {
	display:none;
}

.settings_body .hint {
	margin:-4px 0 8px;
	color:var(--muted);
	font-size:12px;
}

.setting {
	display:grid;
	grid-template-columns:1fr auto;
	align-items:center;
	gap:2px 10px;
	padding:6px 0;
	font-size:13px;
}

/* A dot after the name of anything changed from its default */
.setting.changed > span:first-child::after {
	content:'';
	display:inline-block;
	width:5px;
	height:5px;
	margin-left:6px;
	vertical-align:middle;
	border-radius:50%;
	background:var(--hue);
}

.setting.range > span:first-child {
	cursor:default;
}

.setting b {
	font-weight:500;
	font-variant-numeric:tabular-nums;
	color:var(--text);
}

.setting input[type="range"] {
	grid-column:1 / -1;
}

.setting .note {
	grid-column:1 / -1;
	color:var(--muted);
	font-size:11px;
	line-height:1.4;
}

.tag {
	margin-left:4px;
	padding:1px 5px;
	border-radius:4px;
	background:rgba(255, 255, 255, 0.06);
	color:var(--muted);
	font-size:10px;
	font-style:normal;
}

.setting.toggle {
	cursor:pointer;
}

.setting.toggle input {
	accent-color:var(--hue, var(--accent));
	width:16px;
	height:16px;
	margin:0;
}

/* Per-level digits: one column per level, arrows above and below */
.setting.table > span:first-child {
	grid-column:1 / -1;
}

.digits {
	grid-column:1 / -1;
	display:flex;
	justify-content:space-between;
	gap:4px;
	margin:4px 0 2px;
}

.digit {
	flex:1;
	max-width:36px;
	display:flex;
	flex-direction:column;
	align-items:center;
}

.digit button {
	display:grid;
	place-items:center;
	width:100%;
	height:20px;
	padding:0;
	background:none;
	border:0;
	color:var(--muted);
	cursor:pointer;
}

.digit button:hover:not(:disabled) {
	color:var(--hue, var(--accent));
}

.digit button:disabled {
	opacity:0.25;
	cursor:default;
}

.digit svg {
	width:14px;
	height:14px;
	fill:none;
	stroke:currentColor;
	stroke-width:2.5;
	stroke-linecap:round;
	stroke-linejoin:round;
}

.digit input {
	width:100%;
	height:30px;
	padding:0;
	background:rgba(0, 0, 0, 0.3);
	border:1px solid var(--line);
	border-radius:7px;
	color:var(--text);
	font:500 15px 'Space Grotesk', system-ui, sans-serif;
	font-variant-numeric:tabular-nums;
	text-align:center;
	caret-color:transparent;
}

.digit input:focus {
	outline:none;
	border-color:var(--hue, var(--accent));
}

.digit small {
	color:var(--muted);
	font-size:10px;
}

.segmented {
	display:flex;
	padding:3px;
	background:rgba(0, 0, 0, 0.3);
	border-radius:9px;
}

.segmented button {
	padding:5px 12px;
	background:none;
	border:0;
	border-radius:7px;
	color:var(--muted);
	font:500 13px 'Space Grotesk', system-ui, sans-serif;
	cursor:pointer;
}

.segmented button.active {
	background:rgba(255, 255, 255, 0.1);
	color:var(--text);
}

.key_btn {
	min-width:96px;
	height:30px;
	padding:0 10px;
	background:rgba(255, 255, 255, 0.05);
	border:1px solid var(--line);
	border-bottom-width:2px;
	border-radius:7px;
	color:var(--text);
	font:500 12px 'Space Grotesk', system-ui, sans-serif;
	cursor:pointer;
}

.key_btn.listening {
	border-color:var(--hue, var(--accent));
	color:var(--hue, var(--accent));
}

.text_btn {
	flex:1;
	height:34px;
	padding:0 12px;
	background:rgba(255, 255, 255, 0.05);
	border:1px solid var(--line);
	border-radius:9px;
	color:var(--text);
	font:500 13px 'Space Grotesk', system-ui, sans-serif;
	cursor:pointer;
}

.text_btn:hover {
	background:rgba(255, 255, 255, 0.1);
}

.copy_settings {
	flex-basis:100%;
}

.reset_keys {
	width:100%;
	margin-top:8px;
}

input[type="range"] {
	-webkit-appearance:none;
	appearance:none;
	width:100%;
	height:22px;
	margin:0;
	background:transparent;
	cursor:pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
	height:4px;
	border-radius:2px;
	background:rgba(255, 255, 255, 0.14);
}

input[type="range"]::-moz-range-track {
	height:4px;
	border-radius:2px;
	background:rgba(255, 255, 255, 0.14);
}

/* Below a raised minimum the track turns dotted (the thumb stops at its end).
   The thumb's center travels from 8px to 100% - 8px, so --lock (0-1) maps onto that span. */
input[type="range"].locked::-webkit-slider-runnable-track {
	background:
		linear-gradient(rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.14)) right / calc(100% - 8px - (100% - 16px) * var(--lock)) 100% no-repeat,
		repeating-linear-gradient(to right, rgba(255, 255, 255, 0.2) 0 2px, transparent 2px 5px) left / calc(8px + (100% - 16px) * var(--lock)) 100% no-repeat;
}

input[type="range"].locked::-moz-range-track {
	background:
		linear-gradient(rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.14)) right / calc(100% - 8px - (100% - 16px) * var(--lock)) 100% no-repeat,
		repeating-linear-gradient(to right, rgba(255, 255, 255, 0.2) 0 2px, transparent 2px 5px) left / calc(8px + (100% - 16px) * var(--lock)) 100% no-repeat;
}

input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance:none;
	appearance:none;
	width:16px;
	height:16px;
	margin-top:-6px;
	border-radius:50%;
	background:var(--hue, var(--text));
}

input[type="range"]::-moz-range-thumb {
	width:16px;
	height:16px;
	border:0;
	border-radius:50%;
	background:var(--hue, var(--text));
}


@media (max-width:600px) {
	.brand { top:10px; left:12px; font-size:18px; }
	.hud { top:38px; left:10px; min-width:120px; padding:8px 12px; }
	.stats dd { font-size:15px; }
	.corner { top:10px; right:10px; }
}


/* Effects presets in the View section */

.setting.preset .segmented {
	justify-self:end;
}


/* Replays: the list in the menu card */

.card_row {
	display:flex;
	gap:8px;
	margin-top:8px;
}

.card.listing .scores, .card.listing .keys {
	display:none;
}

.replays {
	margin-top:16px;
	text-align:left;
}

.replays h3 {
	margin:0 0 6px;
	color:var(--muted);
	font-size:10px;
	font-weight:500;
	letter-spacing:0.05em;
	text-transform:uppercase;
}

.replays ul {
	max-height:min(40vh, 280px);
	margin:0 0 10px;
	padding:0;
	overflow:auto;
	list-style:none;
}

.replays li {
	display:flex;
	align-items:center;
	gap:8px;
	padding:6px 0;
	border-top:1px solid var(--line);
}

.replays li > div {
	flex:1;
	min-width:0;
}

.replays li b, .replays li small {
	display:block;
	overflow:hidden;
	text-overflow:ellipsis;
	white-space:nowrap;
}

.replays li b {
	font-weight:500;
}

.replays li.r_last b {
	color:var(--accent);
}

.replays li small {
	color:var(--muted);
	font-size:11px;
}

.replays li span {
	display:flex;
	gap:4px;
}

.replays li .text_btn {
	flex:none;
	height:28px;
	padding:0 9px;
}

.r_empty {
	font-size:12px;
}

.r_open {
	display:flex;
	align-items:center;
	justify-content:center;
}


/* Theater: clip and save along the top, playback along the bottom (the play area fits between them) */

body.watching .open_settings, body.watching .corner {
	display:none;
}

.theater_top {
	position:fixed;
	top:12px;
	left:50%;
	z-index:7;
	display:flex;
	flex-direction:column;
	align-items:center;
	gap:6px;
	max-width:calc(100% - 24px);
	transform:translateX(-50%);
}

.t_bar, .theater {
	display:flex;
	align-items:center;
	gap:6px;
	padding:6px;
	background:var(--glass);
	-webkit-backdrop-filter:blur(16px);
	backdrop-filter:blur(16px);
	border:1px solid var(--line);
	border-radius:12px;
}

/* The replay's name and time, under the top bar */
.t_label {
	display:flex;
	gap:8px;
	max-width:100%;
	padding:3px 10px;
	background:rgba(11, 13, 20, 0.45);
	-webkit-backdrop-filter:blur(10px);
	backdrop-filter:blur(10px);
	border-radius:8px;
	font-size:12px;
	white-space:nowrap;
}

.t_name {
	min-width:0;
	overflow:hidden;
	font-weight:500;
	text-overflow:ellipsis;
}

.t_kind {
	color:var(--accent);
	font-size:10px;
	font-weight:700;
	letter-spacing:0.06em;
	line-height:16px;
	text-transform:uppercase;
}

.t_time {
	color:var(--muted);
	font-variant-numeric:tabular-nums;
}

.theater {
	position:fixed;
	left:50%;
	bottom:12px;
	z-index:7;
	width:min(calc(100% - 24px), 640px);
	transform:translateX(-50%);
}

.theater .icon, .t_bar .icon {
	flex:none;
	width:32px;
	height:32px;
}

.t_btn {
	flex:none;
	display:inline-flex;
	align-items:center;
	gap:4px;
	height:32px;
	padding:0 10px;
	background:rgba(255, 255, 255, 0.05);
	border:1px solid var(--line);
	border-radius:8px;
	color:var(--text);
	font:500 12px 'Space Grotesk', system-ui, sans-serif;
	white-space:nowrap;
	cursor:pointer;
}

.t_btn:hover {
	background:rgba(255, 255, 255, 0.1);
}

.t_btn svg {
	width:14px;
	height:14px;
	fill:none;
	stroke:currentColor;
	stroke-width:2;
	stroke-linecap:round;
	stroke-linejoin:round;
}

.t_menu_btn[aria-expanded="true"] svg {
	transform:rotate(180deg);
}

.t_menu_wrap {
	position:relative;
}

.t_menu {
	position:absolute;
	top:calc(100% + 6px);
	left:50%;
	display:flex;
	flex-direction:column;
	min-width:170px;
	padding:4px;
	background:var(--panel);
	border:1px solid var(--line);
	border-radius:10px;
	box-shadow:0 8px 24px rgba(0, 0, 0, 0.45);
	transform:translateX(-50%);
}

.t_menu button {
	height:34px;
	padding:0 10px;
	background:none;
	border:0;
	border-radius:7px;
	color:var(--text);
	font:500 13px 'Space Grotesk', system-ui, sans-serif;
	text-align:left;
	white-space:nowrap;
	cursor:pointer;
}

.t_menu button:hover {
	background:rgba(255, 255, 255, 0.08);
}

.t_track {
	position:relative;
	flex:1;
	min-width:60px;
}

/* The marked clip, behind the scrubber's track */
.t_clip {
	position:absolute;
	top:50%;
	height:10px;
	margin-top:-5px;
	border-radius:3px;
	background:rgba(79, 209, 197, 0.3);
	pointer-events:none;
}

.t_speed {
	justify-content:center;
	min-width:44px;
}

.hud_tab {
	display:none;
}


/* Phones: a narrower score panel, labels over values, no fire bar (it's beside the rink) */

@media (max-width:600px) {
	.theater { bottom:8px; padding:5px; gap:4px; }
	.theater .t_btn { padding:0 8px; }
	.theater_top { top:8px; }

	.hud { min-width:0; padding:8px 10px; transition:transform 0.25s; }
	.stats { grid-template-columns:auto; gap:0; }
	.stats dt { font-size:9px; }
	.stats dd { margin-bottom:4px; text-align:left; font-size:15px; }
	.stats .long { display:none; }
	.stats hr { margin:2px 0 4px; }
	.stats .meter { min-width:0; height:auto; overflow:visible; background:none; box-shadow:none; animation:none; }
	.meter_fill { display:none; }
	.meter_text { padding:0; font-size:13px; line-height:1.3; text-align:left; text-shadow:none; }
	.meter.burning .meter_text { color:#ffb347; }

	/* Watching: centered down the left edge (clear of the controls), tucked away behind a pull tab */
	body.watching .brand { display:none; } /* the replay bar has the top */
	body.watching .hud { top:50%; left:6px; transform:translate(calc(-100% - 8px), -50%); }
	body.watching.hud_open .hud { transform:translateY(-50%); }
	body.watching .hud_tab {
		position:absolute;
		top:50%;
		margin-top:-22px;
		left:calc(100% + 1px);
		display:flex;
		align-items:center;
		justify-content:center;
		width:22px;
		height:44px;
		padding:0;
		background:var(--glass);
		-webkit-backdrop-filter:blur(12px);
		backdrop-filter:blur(12px);
		border:1px solid var(--line);
		border-left:0;
		border-radius:0 9px 9px 0;
		color:var(--text);
		cursor:pointer;
	}
	body.watching.hud_open .hud_tab svg { transform:rotate(180deg); }
	.hud_tab svg {
		width:16px;
		height:16px;
		fill:none;
		stroke:currentColor;
		stroke-width:2;
		stroke-linecap:round;
		stroke-linejoin:round;
	}
}


/* Touch pads (phones and tablets): sliding along the bottom, hopping beside the play area under the HUD */

.pad {
	display:none;
	position:fixed;
	z-index:3;
	touch-action:none;
	-webkit-user-select:none;
	user-select:none;
	-webkit-touch-callout:none;
}

body.touch.scheme_stick .pad_move, body.touch.scheme_stick .pad_hop, body.touch.scheme_keys .vkeys {
	display:flex;
}

body.watching .pad {
	display:none;
}

.pad_move {
	left:8px;
	right:8px;
	bottom:calc(8px + env(safe-area-inset-bottom));
	height:clamp(130px, 24vh, 190px);
	align-items:center;
	justify-content:center;
	background:rgba(94, 242, 226, 0.025);
	border:1px solid rgba(94, 242, 226, 0.14);
	border-radius:18px;
}

.pad_hop {
	flex-direction:column;
	overflow:hidden;
	border:1px solid rgba(94, 242, 226, 0.18);
	border-radius:14px;
}

.pad_half {
	flex:1;
	display:flex;
	flex-direction:column;
	align-items:center;
	justify-content:center;
	gap:2px;
	background:rgba(94, 242, 226, 0.035);
	color:rgba(94, 242, 226, 0.45);
	font-size:10px;
	font-weight:500;
	letter-spacing:0.12em;
	text-transform:uppercase;
	pointer-events:none;
	transition:background 0.08s;
}

.pad_half.pressed {
	background:rgba(94, 242, 226, 0.16);
	color:#5ef2e2;
}

.pad_half svg {
	width:26px;
	height:26px;
	fill:none;
	stroke:currentColor;
	stroke-width:2.5;
	stroke-linecap:round;
	stroke-linejoin:round;
}

/* Hop pad on the right: the HUD (and title) go over there with it, and the buttons swap to the left */
body.touch.scheme_stick.hop_right:not(.watching) .hud {
	left:auto;
	right:10px;
}

body.touch.scheme_stick.hop_right:not(.watching) .corner {
	right:auto;
	left:10px;
}

/* Arrow keys: an upside-down T, like a keyboard's */
body.touch.scheme_keys .vkeys {
	display:grid;
}

/* Full width, so the outside keys sit right at the edges (wide keys, held to a sensible height) */
.vkeys {
	left:calc(6px + env(safe-area-inset-left));
	right:calc(6px + env(safe-area-inset-right));
	bottom:calc(8px + env(safe-area-inset-bottom));
	grid-template-columns:repeat(3, 1fr);
	grid-template-rows:repeat(2, clamp(52px, 8.5vh, 72px));
	grid-template-areas:". jump ." "left down right";
	gap:8px;
}

.vkey {
	display:grid;
	place-items:center;
	background:rgba(94, 242, 226, 0.04);
	border:1px solid rgba(94, 242, 226, 0.22);
	border-bottom-width:3px;
	border-radius:12px;
	color:rgba(94, 242, 226, 0.6);
	pointer-events:none;
	transition:background 0.06s, transform 0.06s;
}

.vkey[data-key="jump"] { grid-area:jump; }
.vkey[data-key="left"] { grid-area:left; }
.vkey[data-key="down"] { grid-area:down; }
.vkey[data-key="right"] { grid-area:right; }

.vkey.pressed {
	background:rgba(94, 242, 226, 0.18);
	color:#5ef2e2;
	transform:translateY(2px);
}

.vkey svg {
	width:28px;
	height:28px;
	fill:none;
	stroke:currentColor;
	stroke-width:2.5;
	stroke-linecap:round;
	stroke-linejoin:round;
}
