:root {
	--bg: #0f172a;
	--bg-panel: #1e293b;
	--text: #e2e8f0;
	--accent: #38bdf8;
	--success: #22c55e;
	--tile-w: 48px;
	--tile-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
	height: 100%;
	overflow: hidden;
	background: var(--bg);
	color: var(--text);
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	user-select: none;
	-webkit-user-select: none;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}

.game-container {
	display: flex;
	flex-direction: column;
	height: 100%;
	padding: 8px;
	gap: 8px;
}

/* v0.9.4: header removed (title already in the splash) to maximize the
   board's vertical space on mobile. */

.status-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	background: var(--bg-panel);
	border-radius: 10px;
	padding: 4px 10px;
	flex-shrink: 0;
	font-family: 'Consolas', 'Courier New', monospace;
	position: relative;
	z-index: 10;
}

.status-controls {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-left: auto;
	padding-right: 44px;
}

.icon-btn {
	width: 32px;
	height: 32px;
	border: none;
	border-radius: 8px;
	background: rgba(15, 23, 42, 0.65);
	color: #fff;
	font-size: 1rem;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease, transform 0.1s ease;
	user-select: none;
}
.icon-btn:hover { background: rgba(56, 189, 248, 0.35); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.muted {
	opacity: 0.5;
	filter: grayscale(0.8);
}

.status-item { display: flex; align-items: center; gap: 4px; font-size: 0.85rem; font-weight: 700; }
.status-value { color: var(--accent); min-width: 20px; text-align: center; }
.status-value.pairs { color: var(--success); }

/* COMBO CHAIN (v0.7.0) — animated badge on fast consecutive matches.
   Hidden by default, gets .show from game.js. */
#combo {
	display: none;
	background: linear-gradient(135deg, #f97316, #ef4444);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	font-size: 1rem;
	font-weight: 900;
	animation: combo-pulse 0.8s ease-in-out infinite;
}
#combo.show { display: flex; }

@keyframes combo-pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.15); }
}

/* ----------------------------------------------------------
   STAGING BOX — 4 slots where clicked tiles are held.
   Two matching tiles in the box automatically match.
   4 tiles without a match = game over.
   ---------------------------------------------------------- */
.staging-box {
	display: flex;
	justify-content: center;
	gap: 8px;
	padding: 4px 14px;
	background: var(--bg-panel);
	border-radius: 10px;
	flex-shrink: 0;
	min-height: 52px;
	align-items: center;
}

.staging-slot {
	width: 44px;
	height: 52px;
	border: 2px dashed rgba(148, 163, 184, 0.35);
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 22px;
	opacity: 0.5;
	position: relative;
}

.staging-slot.filled {
	border-style: solid;
	border-color: rgba(56, 189, 248, 0.5);
	background: linear-gradient(180deg, #f7f9fc 0%, #e9edf2 100%);
	box-shadow:
		1px 0 0 0 rgba(71, 85, 105, 0.30),
		0 3px 0 0 rgba(71, 85, 105, 0.25),
		1px 3px 0 0 rgba(71, 85, 105, 0.25),
		3px 5px 8px rgba(15, 23, 42, 0.25);
	opacity: 1;
	overflow: hidden;
	padding: 0;
}

.staging-svg {
	width: calc(100% - 10px);
	height: calc(100% - 10px);
	object-fit: contain;
	pointer-events: none;
}

/* v0.8.0: dark staging slot for classic-dark (black) tiles. */
.staging-slot.svg-black {
	background: linear-gradient(135deg, #475569 0%, #1e293b 55%, #0f172a 100%);
}

.board-wrap {
	flex: 1;
	position: relative;
	overflow: hidden;
	min-height: 0;
	background: radial-gradient(circle at 50% 42%, #1e293b 0%, #0b1220 100%);
	border-radius: 14px;
}

#board {
	position: absolute;
	top: 0;
	left: 0;
	/* Anchor the scale to the top-left corner. Without this the default
	   transform-origin (50% 50%) makes scale() expand the board from its
	   centre, shifting the visible board LEFT and clipping it at the TOP
	   of board-wrap (which has overflow:hidden). With top left, the
	   scaled board sits exactly at the (left, top) computed by
	   fitBoard(), so the centring formula is correct. */
	transform-origin: top left;
	touch-action: none;
	/* The board is fitted with transform: scale() set by fitBoard() in
	   game.js. top/left/width/height are set in JS to centre the scaled
	   board inside board-wrap. fitBoard() applies the scale in two phases
	   (remove transform → next paint → re-apply) so the browser creates a
	   fresh texture at the CURRENT viewport resolution — this is what
	   keeps tiles crisp when the WordPress iframe grows to fullscreen. */
}

/* ----------------------------------------------------------
   TILE — every tile is pixel-identical. Rounded corners,
   soft semi-transparent side faces, subtle gradient face,
   uniform drop shadow (same blur on all sides: cannot
   create the asymmetric edge illusion).
   ---------------------------------------------------------- */
.tile {
	position: absolute;
	top: 0;
	left: 0;
	width: 48px;
	height: 64px;
	box-sizing: border-box;
	border-radius: 4px;
	overflow: hidden;
	background: linear-gradient(180deg, #f7f9fc 0%, #e9edf2 100%);
	color: #1e293b;
	box-shadow:
		-1px 0 0 0 rgba(40, 50, 70, 0.35),                /* LEFT face — in shadow 🡐 */
		0 3px 0 0 rgb(55, 58, 65),                        /* BOTTOM face — soft dark 🡑 */
		-1px 3px 0 0 rgba(45, 55, 70, 0.28),              /* bottom-left corner shadow */
		1px 0 0 0 rgba(71, 85, 105, 0.22),                /* RIGHT face — grazing light */
		0 6px 14px rgba(0, 0, 0, 0.22),                   /* projected shadow — lifts off */
		rgba(10, 37, 64, 0.28) 0px -2px 4px 0px inset;    /* top inner edge highlight */
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	cursor: pointer;
	transition: transform 0.12s ease;
	transform: translate(var(--tx), var(--ty));
}

.tile.z0 { z-index: 1; }
.tile.z1 {
	z-index: 2;
	background: linear-gradient(180deg, #ffffff 0%, #f1f4f8 100%);
}
.tile.z2 { z-index: 3; background: linear-gradient(180deg, #ffffff 0%, #eef2f7 100%); }
.tile.z3 { z-index: 4; background: linear-gradient(180deg, #fbfcff 0%, #e9eef5 100%); }
.tile.z4 { z-index: 5; background: linear-gradient(180deg, #f8fafe 0%, #e4eaf2 100%); }
.tile.z5 { z-index: 6; background: linear-gradient(180deg, #f5f8fd 0%, #e0e7f0 100%); }
.tile.z6 { z-index: 7; }
.tile.z7 { z-index: 8; }
.tile.z8 { z-index: 9; }
.tile.z9 { z-index: 10; }
.status-value.level-value { color: #f472b6; font-weight: 800; }

/* Face-down (covered) tiles — memory mechanic.
   Symbol is HIDDEN: the sym element is invisible and the
   tile shows an authentic rich mahjong back. */
.tile.face-down {
	background: linear-gradient(145deg, #1e3a8a 0%, #1e293b 100%);
	color: #e2e8f0;
	box-shadow:
		-1px 0 0 0 rgba(40, 50, 70, 0.35),
		0 3px 0 0 rgb(30, 41, 59),
		-1px 3px 0 0 rgba(45, 55, 70, 0.28),
		1px 0 0 0 rgba(71, 85, 105, 0.22),
		0 6px 14px rgba(0, 0, 0, 0.35),
		rgba(56, 189, 248, 0.3) 0px 0px 0px 1px inset;
	opacity: 1;
}
.tile.face-down .tile-sym { visibility: hidden; }
.tile.face-down .tile-svg { visibility: hidden; }
.tile.face-down::after {
	content: '?';
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	font-weight: 900;
	color: rgba(226, 232, 240, 0.65);
	pointer-events: none;
}

/* Blocked face-down tiles: cannot be dimmed, so use a red "lock" cue instead. */
.tile.face-down.blocked {
	box-shadow:
		1px 0 0 0 rgba(71, 85, 105, 0.30),
		0 3px 0 0 rgba(71, 85, 105, 0.25),
		1px 3px 0 0 rgba(71, 85, 105, 0.25),
		0 0 0 2px rgba(239, 68, 68, 0.75) inset;
}
.tile.face-down.blocked::after {
	content: '🔒';
	font-size: 13px;
	color: rgba(239, 68, 68, 0.85);
}
.tile.face-down.blocked:hover .tile-overlay { opacity: 0; }
.tile.face-down.blocked:hover { opacity: 1; }

/* v0.9 BLACKOUT — obscured base plane. */
.tile.obscured {
	background: linear-gradient(135deg, #0a0f1c 0%, #05080f 100%);
	color: #94a3b8;
	box-shadow:
		-1px 0 0 0 rgba(40, 50, 70, 0.35),
		0 3px 0 0 rgb(15, 23, 42),
		-1px 3px 0 0 rgba(45, 55, 70, 0.28),
		1px 0 0 0 rgba(71, 85, 105, 0.22),
		0 6px 14px rgba(0, 0, 0, 0.35);
	opacity: 1;
	cursor: default;
}
.tile.obscured .tile-sym { visibility: hidden; }
.tile.obscured .tile-svg { visibility: hidden; }
.tile.obscured::after {
	content: '◼';
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	font-weight: 900;
	color: rgba(148, 163, 184, 0.35);
	pointer-events: none;
}
.tile.obscured:hover { transform: translate(var(--tx), var(--ty)); }
.tile.obscured:hover .tile-overlay { opacity: 0; }

.tile:hover { transform: translate(var(--tx), var(--ty)) scale(1.05); }

.tile-overlay {
	position: absolute;
	inset: 0;
	border-radius: 4px;
	background: #000;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.12s ease;
}
.tile:hover .tile-overlay { opacity: 0.08; }

/* Blocked tiles: NO opacity — dimmed via darker face color
   instead. Fully opaque, never shows tiles beneath. */
.tile.blocked:not(.face-down) {
	opacity: 1;
	cursor: default;
	background: linear-gradient(180deg, #c9cfd7 0%, #aeb6bf 100%);
}
.tile.z1.blocked:not(.face-down) {
	background: linear-gradient(180deg, #e0e3e7 0%, #cdd1d6 100%);
}
.tile.blocked:hover { transform: translate(var(--tx), var(--ty)); }
.tile.blocked:hover .tile-overlay { opacity: 0; }

.tile.removed { visibility: hidden; pointer-events: none; }

/* Tiles inside the staging box disappear from the board */
.tile.in-staging { visibility: hidden; pointer-events: none; }

.tile.selected { outline: 3px solid var(--accent); outline-offset: 2px; z-index: 3; }
.tile.hinted { outline: 3px solid var(--success); outline-offset: 2px; z-index: 3; }

/* Dragging (peek): lift over everything, no transition lag.
   Also 2D translate() here — even during the drag the tile must stay
   in the board layer so it is always rasterized at the final scale
   (no GPU layer upscaling → no blur). */
.tile.dragging {
	z-index: 100;
	transition: none;
	touch-action: none;
	cursor: grabbing;
	transform: translate(var(--tx), var(--ty));
}
.tile.dragging .tile-overlay { opacity: 0; }

.tile-sym {
	font-size: 28px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	user-select: none;
}

/* Classic SVG tiles (riichi-mahjong-tiles). Scaled with a generous 7px margin
   inside the 48x64 tile face so symbols breathe and look like authentic engraved pieces. */
.tile-svg {
	position: absolute;
	inset: 7px;
	width: calc(100% - 14px);
	height: calc(100% - 14px);
	object-fit: contain;
	pointer-events: none;
	display: block;
}

/* v0.8.0: classic-dark (black) tiles — their white details would be
   invisible on the default light face. Give them a dark face so the
   drawn suit/character stays readable. Class added in game.js. */
.tile.svg-black {
	background: linear-gradient(135deg, #475569 0%, #1e293b 55%, #0f172a 100%);
}
.tile.svg-black.blocked:not(.face-down) {
	background: linear-gradient(135deg, #334155 0%, #111827 100%);
}

/* Face-down classic tiles: hide the SVG and show the ? back. */
.tile.face-down .tile-svg { visibility: hidden; }

/* Badges for Layer and Number (hidden by default for regular players; active ONLY in Dev Mode) */
.plane-badge,
.num-badge {
	display: none;
}

body.dev-mode-active .plane-badge,
body.dev-mode-active .num-badge {
	display: block;
}

/* Never show number badges over face-down or obscured backs */
.tile.face-down .plane-badge,
.tile.face-down .num-badge,
.tile.obscured .plane-badge,
.tile.obscured .num-badge {
	display: none !important;
}

.plane-badge {
	position: absolute;
	top: 3px;
	left: 4px;
	font-size: 8px;
	font-weight: 900;
	line-height: 1;
	padding: 2px 4px;
	border-radius: 5px;
	color: #fff;
	background: #475569;
}
.plane-badge.p2 { background: #2563eb; }
.plane-badge.half-badge { background: #9333ea; }

.num-badge {
	position: absolute;
	top: 3px;
	right: 4px;
	font-size: 8px;
	font-weight: 900;
	line-height: 1;
	padding: 2px 4px;
	border-radius: 5px;
	color: #fff;
	background: rgba(30, 41, 59, 0.55);
}

/* v0.9.4 — ACTION DRAWER: secondary actions live in an openable
   panel (fixed bottom, slide-up) so the board keeps all the
   vertical space. Display none by default; .open shows it. */
.action-panel {
	display: none;
	position: fixed;
	left: 50%;
	transform: translateX(-50%);
	bottom: 14px;
	z-index: 1100;
	background: var(--bg-panel);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 16px;
	padding: 12px 14px;
	gap: 10px;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	width: calc(100vw - 28px);
	max-width: 380px;
	max-height: 84vh;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
	animation: drawer-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.action-panel.open { display: flex; }

@keyframes drawer-in {
	from { opacity: 0; transform: translate(-50%, 16px) scale(0.97); }
	to   { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* ============================================================
   SCORE COMPARISON CARD (v1.3.4)
   ============================================================ */
.score-comparison-card {
	width: 100%;
	background: rgba(15, 23, 42, 0.92);
	border: 1px solid rgba(245, 158, 11, 0.35);
	border-radius: 12px;
	padding: 10px 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	box-sizing: border-box;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.score-cmp-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.score-cmp-title {
	font-size: 0.76rem;
	font-weight: 800;
	letter-spacing: 0.5px;
	color: #fbbf24;
}
.score-cmp-lvl {
	font-size: 0.72rem;
	font-weight: 700;
	color: #94a3b8;
	background: rgba(255, 255, 255, 0.08);
	padding: 2px 8px;
	border-radius: 999px;
}
.score-cmp-body {
	display: flex;
	align-items: center;
	justify-content: space-around;
	background: rgba(0, 0, 0, 0.3);
	padding: 8px 6px;
	border-radius: 8px;
}
.score-cmp-box {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
}
.score-cmp-label {
	font-size: 0.68rem;
	font-weight: 700;
	color: #94a3b8;
	text-transform: uppercase;
}
.score-cmp-val {
	font-size: 1.15rem;
	font-weight: 900;
	font-variant-numeric: tabular-nums;
}
.score-best-val { color: #38bdf8; }
.score-curr-val { color: #4ade80; }
.score-cmp-divider {
	font-size: 0.75rem;
	font-weight: 800;
	color: #64748b;
}
.score-cmp-status {
	font-size: 0.72rem;
	font-weight: 700;
	text-align: center;
	padding: 4px 8px;
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.05);
	color: #cbd5e1;
	transition: all 0.2s ease;
}
.score-cmp-status.status-record {
	background: rgba(245, 158, 11, 0.2);
	border: 1px solid rgba(245, 158, 11, 0.4);
	color: #fde68a;
	font-weight: 800;
}
.score-cmp-status.status-tie {
	background: rgba(56, 189, 248, 0.15);
	border: 1px solid rgba(56, 189, 248, 0.35);
	color: #7dd3fc;
}
.score-cmp-status.status-behind {
	color: #94a3b8;
}

/* ============================================================
   DRAWER LEADERBOARD CARD (v1.3.4)
   ============================================================ */
.drawer-leaderboard-card {
	width: 100%;
	background: rgba(15, 23, 42, 0.92);
	border: 1px solid rgba(56, 189, 248, 0.25);
	border-radius: 12px;
	padding: 10px 12px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	box-sizing: border-box;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.drawer-lb-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.drawer-lb-title {
	font-size: 0.76rem;
	font-weight: 800;
	letter-spacing: 0.5px;
	color: #38bdf8;
}
.drawer-lb-refresh {
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 6px;
	color: #e2e8f0;
	font-size: 0.75rem;
	padding: 2px 6px;
	cursor: pointer;
	transition: all 0.15s ease;
}
.drawer-lb-refresh:hover {
	background: rgba(56, 189, 248, 0.3);
	border-color: #38bdf8;
}
.drawer-lb-list {
	display: flex;
	flex-direction: column;
	gap: 4px;
	max-height: 140px;
	overflow-y: auto;
	padding-right: 2px;
}
.drawer-lb-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 4px 8px;
	background: rgba(0, 0, 0, 0.25);
	border-radius: 6px;
	font-size: 0.75rem;
	transition: background 0.15s ease;
}
.drawer-lb-row:hover { background: rgba(56, 189, 248, 0.1); }
.drawer-lb-rank {
	font-weight: 800;
	width: 24px;
	text-align: left;
	font-variant-numeric: tabular-nums;
}
.drawer-lb-rank.gold { color: #facc15; }
.drawer-lb-rank.silver { color: #e2e8f0; }
.drawer-lb-rank.bronze { color: #f97316; }
.drawer-lb-name {
	flex: 1;
	font-weight: 700;
	color: #f1f5f9;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	padding: 0 6px;
}
.drawer-lb-score {
	font-weight: 800;
	color: #38bdf8;
	font-variant-numeric: tabular-nums;
}
.drawer-lb-empty, .drawer-lb-loading {
	font-size: 0.75rem;
	color: #94a3b8;
	text-align: center;
	padding: 8px 4px;
	font-style: italic;
}

/* ============================================================
   JUKEBOX ZEN PLAYER (v1.2.0)
   Compact audio dashboard inside the action drawer.
   ============================================================ */
.jukebox-panel {
	width: 100%;
	background: rgba(15, 23, 42, 0.9);
	border: 1px solid rgba(56, 189, 248, 0.25);
	border-radius: 14px;
	padding: 10px 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	box-sizing: border-box;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.jukebox-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.jukebox-badge {
	font-size: 0.75rem;
	font-weight: 800;
	letter-spacing: 0.5px;
	color: var(--accent);
}

.jukebox-track-tag {
	font-size: 0.7rem;
	font-weight: 700;
	color: #64748b;
	background: rgba(255, 255, 255, 0.06);
	padding: 2px 6px;
	border-radius: 999px;
	font-variant-numeric: tabular-nums;
}

.jukebox-title {
	font-size: 0.82rem;
	font-weight: 700;
	color: #f8fafc;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	background: rgba(0, 0, 0, 0.35);
	padding: 5px 8px;
	border-radius: 6px;
	text-align: center;
}

/* Timeline: current time, progress bar, duration */
.jukebox-timeline {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 2px 0;
}

.jukebox-time-num {
	font-size: 0.7rem;
	font-weight: 700;
	color: #38bdf8;
	font-variant-numeric: tabular-nums;
	min-width: 28px;
	text-align: center;
	user-select: none;
}

.jukebox-progress-wrap {
	display: flex;
	align-items: center;
	flex: 1;
}

.jukebox-progress-slider {
	width: 100%;
	height: 6px;
	border-radius: 999px;
	background: #1e293b;
	border: 1px solid rgba(56, 189, 248, 0.2);
	outline: none;
	accent-color: #38bdf8;
	cursor: pointer;
	transition: all 0.15s ease;
}
.jukebox-progress-slider:hover {
	background: #334155;
	border-color: #38bdf8;
}

.jukebox-controls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
}

.jukebox-btn {
	background: rgba(30, 41, 59, 0.85);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 8px;
	color: #fff;
	font-size: 1rem;
	width: 36px;
	height: 32px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: all 0.15s ease;
	user-select: none;
}
.jukebox-btn:hover {
	background: rgba(56, 189, 248, 0.35);
	border-color: var(--accent);
}
.jukebox-btn:active { transform: scale(0.92); }
.jukebox-btn.jukebox-play {
	background: var(--accent);
	color: #0f172a;
	width: 44px;
	font-size: 1.1rem;
}
.jukebox-btn.jukebox-play:hover {
	background: #7dd3fc;
}

.jukebox-select {
	background: #0f172a;
	color: var(--text);
	border: 1px solid #334155;
	border-radius: 6px;
	padding: 5px 8px;
	font-size: 0.8rem;
	font-family: inherit;
	font-weight: 600;
	outline: none;
	width: 100%;
	cursor: pointer;
	box-sizing: border-box;
}
.jukebox-select:focus {
	border-color: var(--accent);
}

/* Volume Control Pill Card */
.jukebox-volume-card {
	background: rgba(2, 6, 23, 0.65);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 8px;
	padding: 6px 10px;
	display: flex;
	align-items: center;
	gap: 10px;
	box-sizing: border-box;
}

.jukebox-vol-btn {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 1.1rem;
	padding: 2px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.15s ease;
	user-select: none;
}
.jukebox-vol-btn:hover {
	transform: scale(1.15);
}
.jukebox-vol-btn:active {
	transform: scale(0.9);
}

.jukebox-vol-slider-wrap {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.jukebox-vol-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.jukebox-vol-caption {
	font-size: 0.68rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	color: #94a3b8;
	user-select: none;
}

.jukebox-vol-pct {
	font-size: 0.72rem;
	font-weight: 800;
	color: #fbbf24;
	font-variant-numeric: tabular-nums;
	user-select: none;
}

.jukebox-volume-slider {
	width: 100%;
	height: 5px;
	border-radius: 999px;
	background: #334155;
	outline: none;
	accent-color: #f59e0b;
	cursor: pointer;
	transition: background 0.15s ease;
}
.jukebox-volume-slider:hover {
	background: #475569;
}

.drawer-action-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	width: 100%;
	justify-content: center;
}

.btn {
	padding: 7px 14px;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	font-size: 0.82rem;
	font-weight: 700;
	cursor: pointer;
	transition: all 0.15s ease;
	font-family: inherit;
	background: #1e293b;
	color: var(--text);
	user-select: none;
}
.btn:hover {
	background: #334155;
	border-color: rgba(56, 189, 248, 0.4);
}
.btn:active { transform: scale(0.95); }

.btn-action-main {
	flex: 1 1 42%;
	text-align: center;
	padding: 8px 10px;
}

/* ============================================================
   DEVELOPER TOOLS PANEL (v1.3.5)
   Hidden by default; visible ONLY when body has .dev-mode-active
   ============================================================ */
.dev-tools-card {
	display: none;
	width: 100%;
	background: rgba(30, 27, 75, 0.95);
	border: 1px dashed #a855f7;
	border-radius: 12px;
	padding: 10px 12px;
	flex-direction: column;
	gap: 8px;
	box-sizing: border-box;
	box-shadow: 0 4px 16px rgba(168, 85, 247, 0.2);
}

body.dev-mode-active .dev-tools-card {
	display: flex;
}

.dev-tools-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.dev-tools-title {
	font-size: 0.76rem;
	font-weight: 800;
	letter-spacing: 0.5px;
	color: #c084fc;
}
.dev-tools-badge {
	font-size: 0.68rem;
	font-weight: 800;
	color: #fff;
	background: #9333ea;
	padding: 1px 6px;
	border-radius: 999px;
}
.dev-layout-info {
	font-size: 0.72rem;
	font-family: monospace;
	color: #e9d5ff;
	background: rgba(0, 0, 0, 0.4);
	padding: 4px 8px;
	border-radius: 6px;
	line-height: 1.3;
}
.dev-tools-row {
	display: flex;
	align-items: center;
	gap: 6px;
}
.dev-label {
	font-size: 0.75rem;
	font-weight: 700;
	color: #d8b4fe;
}
.btn-level-input {
	width: 52px;
	padding: 5px 4px;
	border-radius: 6px;
	border: 1px solid #7e22ce;
	background: #0f172a;
	color: #fff;
	font-size: 0.85rem;
	font-weight: 700;
	text-align: center;
	font-family: inherit;
}
.btn-level-input:focus { outline: 2px solid #c084fc; }

.btn-dev-btn {
	background: #6b21a8;
	color: #fff;
	border: 1px solid #a855f7;
	padding: 5px 10px;
	font-size: 0.8rem;
}
.btn-dev-btn:hover { background: #9333ea; }

.btn-dev-off {
	background: rgba(239, 68, 68, 0.2);
	border: 1px solid rgba(239, 68, 68, 0.4);
	color: #fca5a5;
	font-size: 0.72rem;
	padding: 5px 10px;
	text-align: center;
	margin-top: 2px;
}
.btn-dev-off:hover { background: rgba(239, 68, 68, 0.4); }

/* ============================================================
   TOAST NOTIFICATION (v1.3.5)
   ============================================================ */
.toast-notify {
	position: fixed;
	top: 20px;
	left: 50%;
	transform: translateX(-50%) translateY(-30px);
	background: rgba(15, 23, 42, 0.96);
	border: 1px solid #a855f7;
	color: #f1f5f9;
	padding: 8px 18px;
	border-radius: 999px;
	font-size: 0.85rem;
	font-weight: 800;
	z-index: 9999;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
	opacity: 0;
	pointer-events: none;
	transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast-notify.show {
	transform: translateX(-50%) translateY(0);
	opacity: 1;
}

.overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.7);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 1000;
}
.overlay.show { display: flex; }

.modal {
	background: var(--bg-panel);
	padding: 24px 40px;
	border-radius: 16px;
	text-align: center;
	display: flex;
	flex-direction: column;
	gap: 12px;
	align-items: center;
}
.modal p { color: #94a3b8; font-weight: 600; }

.modal-login-hint {
	font-size: 0.85rem;
	color: #fbbf24 !important;
	background: rgba(251, 191, 36, 0.12);
	border: 1px solid rgba(251, 191, 36, 0.35);
	padding: 8px 16px;
	border-radius: 8px;
	margin-top: 4px;
	line-height: 1.4;
}
.modal-login-hint a {
	color: #38bdf8;
	font-weight: 700;
	text-decoration: underline;
}

/* STAR RATING (v0.7.0) — modal stars row */
#modal-stars { font-size: 2.2rem; letter-spacing: 6px; margin: 6px 0; }

.btn-modal-shuffle {
	background: linear-gradient(135deg, #0ea5e9, #6366f1);
	color: #fff;
	box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
	animation: pulse-shuffle 1.8s ease-in-out infinite;
}
.btn-modal-shuffle:hover {
	background: linear-gradient(135deg, #38bdf8, #818cf8);
	transform: scale(1.03);
}

@keyframes pulse-shuffle {
	0%, 100% { box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4); }
	50% { box-shadow: 0 6px 20px rgba(99, 102, 241, 0.7); }
}

/* ============================================================
   PARTICLE BURSTS & CONFETTI (v1.0.8)
   GPU-accelerated visual celebration on matches and clear
   ============================================================ */
.particle {
	position: fixed;
	pointer-events: none;
	border-radius: 50%;
	z-index: 9999;
	animation: particle-fly 0.55s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

@keyframes particle-fly {
	0% {
		opacity: 1;
		transform: translate(0, 0) scale(1);
	}
	100% {
		opacity: 0;
		transform: translate(var(--dx), var(--dy)) scale(0.2);
	}
}

.confetti {
	position: fixed;
	pointer-events: none;
	z-index: 9999;
	animation: confetti-fall var(--dur, 2s) ease-out forwards;
}

@keyframes confetti-fall {
	0% {
		opacity: 1;
		transform: translate(0, 0) rotate(0deg) scale(1);
	}
	100% {
		opacity: 0;
		transform: translate(var(--dx), var(--dy)) rotate(var(--rot, 360deg)) scale(0.5);
	}
}

/* ----------------------------------------------------------
   MOBILE — maximise board space on small screens
   ---------------------------------------------------------- */
@media (max-width: 480px) {
	.game-container { padding: 4px; gap: 4px; }
	.status-bar { padding: 3px 8px; gap: 6px; }
	.status-item { font-size: 0.78rem; gap: 3px; }
	.status-value { min-width: 16px; }
	.icon-btn { width: 28px; height: 28px; font-size: 0.85rem; }
	.staging-box { padding: 3px 8px; gap: 6px; min-height: 46px; }
	.staging-slot { width: 38px; height: 46px; font-size: 18px; }
	.btn { padding: 6px 14px; font-size: 0.8rem; }
	.tile-sym { font-size: 28px; }
	.board-wrap { border-radius: 10px; }
}

/* ============================================================
   CLASSIC MODE STYLES (v1.0.0)
   ============================================================ */
body.mode-classic .staging-box {
	display: none;
}

.badge-classic {
	display: inline-block;
	background: linear-gradient(135deg, #f59e0b, #d97706);
	color: #fff;
	font-size: 0.65rem;
	font-weight: 800;
	padding: 1px 6px;
	border-radius: 4px;
	margin-left: 4px;
	letter-spacing: 0.5px;
	box-shadow: 0 1px 4px rgba(245, 158, 11, 0.4);
	vertical-align: middle;
}

.tile.selected {
	outline: 3px solid #38bdf8;
	outline-offset: 1px;
	box-shadow: 0 0 16px rgba(56, 189, 248, 0.9), inset 0 0 8px rgba(56, 189, 248, 0.5) !important;
	z-index: 100 !important;
	transform: translate(var(--tx), calc(var(--ty) - 4px)) !important;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* ============================================================
   CONVEYOR RING MODE STYLES (v1.5.0)
   ============================================================ */
.badge-conveyor {
	display: inline-block;
	background: linear-gradient(135deg, #0284c7, #38bdf8);
	color: #041326;
	font-size: 0.65rem;
	font-weight: 900;
	padding: 1px 6px;
	border-radius: 4px;
	margin-left: 4px;
	letter-spacing: 0.5px;
	box-shadow: 0 1px 6px rgba(56, 189, 248, 0.4);
	vertical-align: middle;
}

.conveyor-track-layer {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 0;
}

/* Continuous glowing animated dashed path (subtle & elegant) */
.conveyor-track-svg {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	overflow: visible;
}

.conveyor-track-path {
	fill: none;
	stroke: #38bdf8;
	stroke-width: 2px;
	stroke-dasharray: 8 6;
	stroke-linecap: round;
	stroke-linejoin: round;
	opacity: 0.55;
	filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.5));
	animation: conveyor-flow 2.2s linear infinite;
}

@keyframes conveyor-flow {
	from {
		stroke-dashoffset: 0;
	}
	to {
		stroke-dashoffset: -28;
	}
}

/* Subtle dashed box around each conveyor position */
.conveyor-slot-indicator {
	position: absolute;
	width: 50px;
	height: 66px;
	transform: translate(var(--tx), var(--ty));
	border: 1.5px dashed rgba(56, 189, 248, 0.45);
	border-radius: 6px;
	box-sizing: border-box;
	background: rgba(14, 165, 233, 0.05);
	box-shadow: 0 0 6px rgba(56, 189, 248, 0.18);
	pointer-events: none;
	display: flex;
	align-items: center;
	justify-content: center;
	animation: conveyor-box-pulse 3s infinite ease-in-out;
}

.conveyor-slot-icon {
	font-size: 13px;
	opacity: 0.25;
	filter: drop-shadow(0 0 2px rgba(56, 189, 248, 0.4));
	animation: conveyor-icon-spin 8s linear infinite;
}

@keyframes conveyor-box-pulse {
	0%, 100% {
		border-color: rgba(56, 189, 248, 0.35);
		box-shadow: 0 0 5px rgba(56, 189, 248, 0.15);
	}
	50% {
		border-color: rgba(56, 189, 248, 0.65);
		box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
	}
}

@keyframes conveyor-icon-spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

.tile.conveyor-moving {
	transition: transform 480ms cubic-bezier(0.22, 1, 0.36, 1) !important;
	will-change: transform;
	z-index: 2 !important;
	box-shadow: 0 4px 14px rgba(56, 189, 248, 0.35) !important;
}

/* ============================================================
   SHIELD WARDS MODE STYLES (v1.7.0)
   ============================================================ */
.badge-shield {
	display: inline-block;
	background: linear-gradient(135deg, #d97706, #fbbf24);
	color: #261600;
	font-size: 0.65rem;
	font-weight: 900;
	padding: 1px 6px;
	border-radius: 4px;
	margin-left: 4px;
	letter-spacing: 0.5px;
	box-shadow: 0 1px 6px rgba(251, 191, 36, 0.45);
	vertical-align: middle;
}

/* Protected Shielded Tiles */
.tile.shielded {
	box-shadow: 0 0 10px rgba(56, 189, 248, 0.75), inset 0 0 8px rgba(14, 165, 233, 0.65) !important;
	cursor: not-allowed;
}

.tile.shielded::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: linear-gradient(135deg, rgba(14, 165, 233, 0.28) 0%, rgba(56, 189, 248, 0.12) 50%, rgba(186, 230, 253, 0.35) 100%);
	pointer-events: none;
	z-index: 5;
	border: 1.5px solid rgba(56, 189, 248, 0.85);
	box-sizing: border-box;
	animation: shield-pulse 2.2s infinite ease-in-out;
}

@keyframes shield-pulse {
	0%, 100% {
		box-shadow: inset 0 0 6px rgba(56, 189, 248, 0.5), 0 0 8px rgba(56, 189, 248, 0.5);
		opacity: 0.9;
	}
	50% {
		box-shadow: inset 0 0 14px rgba(14, 165, 233, 0.8), 0 0 16px rgba(56, 189, 248, 0.85);
		opacity: 1;
	}
}

/* Shield Deflection animation when clicking shielded tile */
.tile.shield-deflect {
	animation: shield-wobble 0.42s ease-out !important;
	z-index: 10 !important;
}

@keyframes shield-wobble {
	0% { transform: translate(var(--tx), var(--ty)) scale(1); filter: brightness(1.7); }
	20% { transform: translate(calc(var(--tx) - 3px), var(--ty)) scale(0.97) rotate(-2deg); filter: brightness(2.2); }
	40% { transform: translate(calc(var(--tx) + 3px), var(--ty)) scale(0.97) rotate(2deg); filter: brightness(2); }
	60% { transform: translate(calc(var(--tx) - 2px), var(--ty)) scale(0.98); filter: brightness(1.5); }
	80% { transform: translate(calc(var(--tx) + 1px), var(--ty)) scale(0.99); filter: brightness(1.2); }
	100% { transform: translate(var(--tx), var(--ty)) scale(1); filter: brightness(1); }
}

/* Guardian Crest & Tiles */
.guardian-badge {
	display: none;
	position: absolute;
	top: -6px;
	right: -6px;
	font-size: 13px;
	line-height: 1;
	z-index: 8;
	pointer-events: none;
	filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.85));
}

.tile.guardian .guardian-badge {
	display: flex;
	align-items: center;
	justify-content: center;
	animation: guardian-float 2.4s infinite ease-in-out;
}

@keyframes guardian-float {
	0%, 100% { transform: translateY(0) scale(1); }
	50% { transform: translateY(-2px) scale(1.1); }
}

.tile.guardian {
	box-shadow: 0 0 8px rgba(245, 158, 11, 0.7), inset 0 0 5px rgba(251, 191, 36, 0.6) !important;
}

/* Guardian Alert animation when player clicks protected tile */
.tile.guardian-alert {
	animation: guardian-ping 0.85s cubic-bezier(0.25, 1, 0.5, 1) !important;
	z-index: 9 !important;
}

@keyframes guardian-ping {
	0% {
		box-shadow: 0 0 0 rgba(245, 158, 11, 0.9), inset 0 0 0 rgba(251, 191, 36, 0.8);
		transform: translate(var(--tx), var(--ty)) scale(1);
	}
	30% {
		box-shadow: 0 0 20px rgba(245, 158, 11, 1), 0 0 35px rgba(251, 191, 36, 0.9), inset 0 0 10px rgba(251, 191, 36, 0.9);
		transform: translate(var(--tx), var(--ty)) scale(1.12);
	}
	100% {
		box-shadow: 0 0 8px rgba(245, 158, 11, 0.7), inset 0 0 5px rgba(251, 191, 36, 0.6);
		transform: translate(var(--tx), var(--ty)) scale(1);
	}
}