/* Lucidle. One dark theme: the night palette from the test build, a handheld-console frame, pixel titles. */
@font-face { font-family: "Pixelify Sans"; src: url("../assets/fonts/pixelify-sans-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Geist"; src: url("../assets/fonts/geist-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Geist"; src: url("../assets/fonts/geist-latin-ext.woff2") format("woff2"); font-weight: 400 700; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: dark;
  /* Brand palette, exactly as given. */
  --bg: #0b1020;
  --panel: #141b33;
  --line: #2a3460;
  --text: #e8ebf7;
  --dim: #97a0c2;
  --accent: #b9a7ff;
  --accent-ink: #171230;
  --warn: #ffb38a;
  --accent-deep: #8a78d6; /* the accent, darker: the edge under a pressed key */
  /* Score colours, lowest to highest. Used for scores only. */
  --t0: #9aa1b5;
  --t1: #ffae6b; /* Shut-eye: light orange */
  --t2: #4a86e8; /* Nap: a blue darker than Shut-eye */
  --t3: #f0616d;
  --t4: #9d6bff;
  --t5: #f2c14e;
  --pixel: "Pixelify Sans", ui-monospace, "Courier New", monospace;
  --body: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* One corner rule: the console frame is 10px, everything inside it is 6px. */
  --r: 6px;
  --col: 640px;
  /* Layers: side ads 1. The menu is a dialog and sits in the browser's top layer. */
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text); font: 16px/1.55 var(--body); }
a { color: var(--accent); }
h1, h2, h3, p { margin: 0 0 10px; }
h1 { font-size: 22px; line-height: 1.3; font-weight: 600; }
h2, h3, .brand, .tabs, .tagline, .tag, .clock-num, .score, .chart text, .scene .z, .title { font-family: var(--pixel); }
h2 { font-size: 22px; line-height: 1.2; font-weight: 600; }
h3 { font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { display: inline-flex; width: 1.15em; height: 1.15em; flex: none; }
.icon svg { width: 100%; height: 100%; }

/* Top bar and mode tabs */
.top, .page, .foot { max-width: var(--col); margin: 0 auto; padding: 0 16px; }
.bar { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.bar-btns { display: flex; gap: 8px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 28px; font-weight: 700; letter-spacing: 0.04em; color: var(--text); text-decoration: none; }
.brand .mascot { display: block; width: 36px; height: 36px; image-rendering: pixelated; }
.tabs { display: flex; gap: 6px; padding-bottom: 12px; font-size: 16px; }
.tabs a {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 6px 8px;
  border: 2px solid var(--line); border-radius: var(--r); background: var(--panel); color: var(--dim); text-decoration: none;
}
.tabs a[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Buttons: flat keys with a hard edge that disappears when pressed */
.btn, .icon-btn, .stake {
  font: inherit; font-weight: 600; color: var(--text); background: var(--panel); border: 2px solid var(--line); border-radius: var(--r);
  box-shadow: 0 3px 0 var(--line); cursor: pointer; transition: transform 80ms ease-out, box-shadow 80ms ease-out;
}
.btn { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; text-decoration: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; font-size: 20px; }
.btn.primary, .stake.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 3px 0 var(--accent-deep); }
.btn.ghost { width: 100%; justify-content: center; color: var(--dim); font-weight: 400; }
/* Earlier's "Another clue": light gold with dark words, so it stands apart from the purple Guess button */
.btn.ghost.clue-btn { color: #2a2008; background: #f6d987; border-color: #f6d987; box-shadow: 0 3px 0 #b98f2c; font-weight: 600; }
.btn.ghost.clue-btn:hover { background: #fbe3a3; border-color: #fbe3a3; }
/* A destructive choice: the warm warning colour, never the main purple */
.btn.danger { color: var(--warn); border-color: var(--warn); box-shadow: 0 3px 0 var(--warn); }
.menu.confirm { width: min(380px, calc(100vw - 32px)); }
.btn:active, .icon-btn:active, .stake:active { transform: translateY(3px); box-shadow: none; }
.btn:disabled, .stake:disabled, input:disabled { opacity: 0.45; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.actions + .note { margin-top: 14px; }

/* The console: a framed screen with a faint pixel grid, like an old handheld display */
.console {
  max-width: var(--col); margin: 14px auto 28px; padding: 0 14px 6px; border: 2px solid var(--line); border-radius: 10px;
  box-shadow: 0 0 0 8px var(--panel), 0 0 0 10px var(--line), 0 16px 0 0 var(--line);
  background: linear-gradient(rgba(232, 235, 247, 0.04) 1px, transparent 1px) 0 0 / 4px 4px,
    linear-gradient(90deg, rgba(232, 235, 247, 0.04) 1px, transparent 1px) 0 0 / 4px 4px, var(--bg);
}
.stage { padding: 14px 0 8px; background: var(--bg); }
.scene { display: block; width: 100%; height: auto; max-height: 24vh; image-rendering: pixelated; }
.scene .sky { fill: var(--panel); }
.scene .star, .scene .moon, .scene .spark { fill: var(--t5); }
/* Tapping the sleeper: he tosses and turns, or tugs his blanket (js/main.js takes turns between the two) */
.scene .body, .scene .cover { transform-box: fill-box; transform-origin: center; }
.stage.poke-toss .scene .body { animation: poke-toss 460ms steps(4); }
.stage.poke-tug .scene .cover { animation: poke-tug 520ms steps(4); }
@keyframes poke-toss { 0%, 100% { transform: none; } 25% { transform: translate(-2px, 0); } 50% { transform: translate(2px, -1px); } 75% { transform: translate(-1px, 0); } }
@keyframes poke-tug { 0%, 100% { transform: none; } 33% { transform: translate(-4px, -1px); } 66% { transform: translate(2px, 0); } }
/* The moon scoots off when reached for, in little pixel hops */
.scene .sky-moon { transition: transform 480ms steps(6); }
/* The mascot moon in the sky shows one face at a time (data-face is set by js/main.js) */
.scene .mf { display: none; }
.scene .sky-moon[data-face="sleepy"] .mf-sleepy, .scene .sky-moon[data-face="lucid"] .mf-lucid,
.scene .sky-moon[data-face="smug"] .mf-smug, .scene .sky-moon[data-face="cross"] .mf-cross { display: inline; }
.scene .star { opacity: 0.15; transition: opacity 600ms; }
.scene .floorline, .scene .wood { fill: var(--line); }
.scene .mattress { fill: var(--dim); }
.scene .pillow { fill: var(--text); }
.scene .skin { fill: #f0c9a8; }
.scene .hair { fill: var(--accent-deep); }
.scene .eye, .scene .pupil { fill: var(--accent-ink); }
.scene .blanket, .scene .hood { fill: var(--accent); }
.scene .pyjama { fill: #5fa8f5; }
.scene .shade { fill: var(--dim); }
.scene .glow { fill: var(--t5); opacity: 0; }
.scene .shadow { fill: var(--accent-ink); opacity: 0; }
.scene .z { fill: var(--dim); font-size: 7px; font-weight: 700; opacity: 0; }
.scene .sitting, .scene .hood, .scene .dream { opacity: 0; }
.pose-0 .lying { opacity: 0; }
.pose-0 .sitting { opacity: 1; }
.pose-0 .glow { opacity: 0.16; }
.pose-0 .shade { fill: var(--t5); }
.pose-1 .lying { animation: toss 1.2s steps(1) infinite; }
.pose-2 .lying { animation: turn 4s steps(1) infinite; }
.pose-3 .blanket, .pose-4 .blanket, .pose-4 .hood { animation: breathe 4s steps(1) infinite; }
.pose-4 .hood { opacity: 1; }
/* Lucid: he floats clear of the bed, blanket and all, on a little cloud, and dreams in sparks instead of Zs. */
.pose-5 .lying { animation: float 3s steps(1) infinite; }
.pose-5 .dream { opacity: 1; animation: twinkle 1.6s steps(1) infinite; }
.pose-5 .shadow { opacity: 0.6; }
.pose-2 .star { opacity: 0.3; }
.pose-3 .star { opacity: 0.5; }
.pose-4 .star { opacity: 0.75; }
.pose-5 .star { opacity: 1; }
.pose-1 .z1, .pose-2 .z1, .pose-3 .z1, .pose-3 .z2, .pose-4 .z { animation: zzz 2.4s steps(1) infinite; }
.scene .z2 { animation-delay: 0.4s; }
.scene .z3 { animation-delay: 0.8s; }
/* The "bruh" speech bubble: drawn into the scene, its tail on the sleeper's head in every pose */
.scene .bubble { opacity: 0; transition: opacity 120ms steps(2); }
.scene .bubble .edge, .scene .bubble .fill { fill: var(--text); }
.scene .bubble text { fill: var(--accent-ink); font-family: var(--pixel); font-size: 7px; font-weight: 700; }
.stage.bruh:not(.twice) .scene .bubble.one, .stage.bruh.twice .scene .bubble.two { opacity: 1; }
.stage.bruh .scene .z { visibility: hidden; }
.pose-0 .bubble { transform: translateY(-9px); }
/* Woken up cross: slanted brows, a frown, flushed cheeks and a throbbing anger mark (only while sitting up) */
.scene .mad { opacity: 0; }
.scene .flush, .scene .vein { fill: var(--t3); }
.scene .vein { transform-box: fill-box; transform-origin: center; }
.stage.angry .pose-0 .mad { opacity: 1; }
.stage.angry .pose-0 .calm { opacity: 0; }
.stage.angry .pose-0 .sitting .skin { fill: #f29a86; }
.stage.angry .pose-0 .vein { animation: throb 0.6s steps(1) infinite; }
.stage.angry .bubble { visibility: hidden; }
.pose-5 .bubble { transform: translateY(-6px); }
@keyframes toss { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-1px); } 75% { transform: translateX(1px); } }
@keyframes turn { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(2px); } }
@keyframes breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1px); } }
@keyframes float { 0%, 100% { transform: translateY(-12px); } 50% { transform: translateY(-14px); } }
@keyframes float-cloud { 0%, 100% { transform: translateY(-10px); } 50% { transform: translateY(-12px); } }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes throb { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
@keyframes zzz { 0%, 100% { opacity: 0; } 30%, 70% { opacity: 1; } }

.chart { display: block; width: 100%; height: auto; max-height: 18vh; margin-top: 6px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .lab { font-size: 13px; opacity: 0.75; }
.chart .num { fill: var(--dim); font-size: 12px; }
.chart .trace { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: miter; }
.t0, .chart .t0 { color: var(--t0); fill: var(--t0); }
.t1, .chart .t1 { color: var(--t1); fill: var(--t1); }
.t2, .chart .t2 { color: var(--t2); fill: var(--t2); }
.t3, .chart .t3 { color: var(--t3); fill: var(--t3); }
.t4, .chart .t4 { color: var(--t4); fill: var(--t4); }
.t5, .chart .t5 { color: var(--t5); fill: var(--t5); }

/* Game content. Sections are separated by a line, not boxed, because the console is already the frame. */
.card { padding: 18px 0; }
.card + .card { border-top: 2px solid var(--line); }
.meta { margin-bottom: 6px; color: var(--dim); font-size: 14px; }
.note { color: var(--dim); min-height: 1.5em; }
.wrong { color: var(--warn); font-size: 14px; }
.tagline { font-size: 26px; line-height: 1.2; font-weight: 700; }
.start { text-align: center; }
.start .actions { justify-content: center; }
.start .blurb { margin: 6px 0 0; font-family: var(--pixel); font-size: 20px; font-weight: 600; line-height: 1.3; color: var(--text); }
/* The start button: centred, in the pixel font, bobbing gently to catch the eye */
.btn.go { justify-content: center; min-height: 52px; padding: 10px 30px; font-family: var(--pixel); font-size: 20px; animation: bob 1.6s steps(2) infinite; }
@keyframes bob { 0%, 100% { translate: 0 0; filter: none; } 50% { translate: 0 -4px; filter: drop-shadow(0 0 10px rgba(185, 167, 255, 0.55)); } }
/* "How to play", kept quiet under the start button */
.quiet {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; margin-top: 12px; padding: 4px 8px; font: inherit; font-size: 14px;
  color: var(--dim); background: none; border: 0; border-radius: var(--r); cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.quiet:hover { color: var(--text); }
/* The small print at the bottom of the start screen: game number, streak, and the ways to the archive, skins and Unlimited */
.dock { margin-top: 22px; padding-top: 14px; border-top: 2px dashed var(--line); font-size: 13px; color: var(--dim); }
.dock-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-bottom: 10px; }
.dock-stats span { display: inline-flex; align-items: center; gap: 6px; }
.dock-stats .icon { color: var(--t5); }
.dock-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.dock-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--dim); background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); cursor: pointer; text-decoration: none;
}
.dock-btn:hover { color: var(--text); border-color: var(--accent); }
/* "Modes you haven't tried yet": a button to each mode this browser has never played */
.try-new { margin-top: 18px; text-align: center; }
.try-new-label { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--dim); }
.try-new-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.try-new-btn { gap: 8px; border-color: var(--accent); }
.try-new-btn .icon { color: var(--accent); }
.try-new-tag { padding: 1px 6px; font-size: 12px; font-weight: 700; color: var(--accent-ink); background: var(--accent); border-radius: 4px; }
.tile .tile-new { color: var(--accent); font-weight: 600; }
/* How to play: numbered steps, then the six score levels */
.howto h2 { font-size: 20px; }
.steps { display: grid; gap: 10px; margin: 14px 0; padding-left: 24px; }
.steps li::marker { color: var(--accent); font-weight: 700; }
.levels { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0; font-size: 14px; color: var(--dim); }
.clues { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.clues li { display: grid; grid-template-columns: 104px 1fr; gap: 10px; align-items: baseline; }
.tag { font-size: 15px; font-weight: 600; }
.clues .seen .clue { color: var(--dim); }
.clues .hidden .tag { opacity: 0.5; }
/* After the answer: the step the player reached, boxed in its score colour (the li's t0..t5 class sets currentColor) */
.clues .got { margin: 0 -10px; padding: 8px 10px; border: 2px solid currentColor; border-radius: var(--r); background: var(--panel); }
.clues .got .clue { color: var(--text); font-weight: 600; }
.clues .now .clue { font-size: 18px; animation: focus-in 700ms ease-out both; }
.veil { display: block; height: 8px; width: 55%; background: var(--line); align-self: center; }
@keyframes focus-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.answer { display: flex; gap: 10px; margin-bottom: 12px; }
.answer input {
  flex: 1; min-width: 0; min-height: 44px; padding: 8px 12px; font: inherit; color: var(--text); background: var(--panel);
  border: 2px solid var(--line); border-radius: var(--r);
}
.answer input::placeholder { color: var(--dim); }
.unit { align-self: center; color: var(--dim); font-size: 14px; }
.stakes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 12px; }
.stake { display: grid; gap: 2px; padding: 8px 4px; text-align: center; }
.stake-name { font-size: 13px; }
.stake-pts { font-size: 12px; font-weight: 400; color: var(--dim); }
.stake.on .stake-pts { color: var(--accent-ink); }
.clock { display: flex; align-items: center; gap: 10px; margin: 2px 0 12px; }
/* The answer bar, pinned to the bottom of the screen while a question is on it */
.play-bar {
  position: sticky; bottom: 0; z-index: 2; margin: 14px -14px 0; padding: 10px 14px max(12px, env(safe-area-inset-bottom));
  background: var(--bg); border-top: 2px solid var(--line); box-shadow: 0 -10px 16px -8px rgba(11, 16, 32, 0.9);
}
.play-bar .clock { margin: 0 0 6px; }
.play-bar .note { margin-bottom: 8px; font-size: 14px; }
.play-bar .answer { margin-bottom: 0; }
.play-bar .stakes { margin-bottom: 8px; }
.play-bar .btn.ghost { min-height: 38px; margin-top: 8px; padding: 4px 12px; font-size: 14px; }
/* The newest clue stays clear of the answer bar when it is scrolled into view */
.clues .now { scroll-margin-bottom: 200px; }
/* While a question is on screen the sleeper scene shrinks, so the question fits with the answer bar */
.console:has(.play-bar) .stage { padding: 8px 0 2px; }
.console:has(.play-bar) .scene { max-height: 16vh; }
/* The play screen fills the screen (fitCard), so the answer bar sits at its foot: any spare height goes above the
   bar, never in an empty strip under the answer box. */
.console:has(.play-bar), .console:has(.play-bar) #app, .console:has(.play-bar) #app > .card { display: flex; flex-direction: column; }
.console:has(.play-bar) #app, .console:has(.play-bar) #app > .card { flex: 1 0 auto; }
.console:has(.play-bar) #app > .card > .play-bar { margin-top: auto; }
.console:has(.play-bar) #app > .card > :nth-last-child(2) { margin-bottom: 14px; }
.clock-bar { flex: 1; height: 8px; background: var(--line); overflow: hidden; }
.clock-fill { display: block; height: 100%; background: var(--accent); transform-origin: left center; transition: transform 100ms linear; }
.clock-fill.low { background: var(--warn); }
.clock-num { min-width: 2ch; text-align: right; font-size: 18px; font-variant-numeric: tabular-nums; }
.read { color: var(--accent); font-size: 14px; }
/* The answer after each question: its own box, large and bold, straight under the score name */
.reveal { display: grid; gap: 2px; margin: 2px 0 14px; padding: 10px 14px; background: var(--panel); border: 2px solid var(--accent); border-radius: var(--r); }
.reveal-label { font-size: 13px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
.reveal-answer { font-size: 26px; line-height: 1.2; font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.score { font-size: 20px; color: var(--t5); }
.learned { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.learned li { display: grid; grid-template-columns: 104px 1fr; gap: 10px; align-items: baseline; }
.share { font-size: 18px; padding: 10px 12px; white-space: pre-line; background: var(--panel); border: 2px dashed var(--line); border-radius: var(--r); word-break: break-word; }
.gets { margin: 0 0 12px; padding-left: 20px; }
.gets li { margin-bottom: 4px; }

/* The centre-stage result after each question: a full-screen layer, the sleeper large in the middle, a depth bar
   from Awake to Lucid that fills as he sinks, then the level's name lands with a burst of pixels in its colour. */
.spot {
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; color: var(--text); overflow-x: hidden;
  background: linear-gradient(rgba(232, 235, 247, 0.04) 1px, transparent 1px) 0 0 / 4px 4px,
    linear-gradient(90deg, rgba(232, 235, 247, 0.04) 1px, transparent 1px) 0 0 / 4px 4px, var(--bg);
}
.spot::backdrop { background: var(--bg); }
.spot-body { display: flex; flex-direction: column; justify-content: center; min-height: 100%; max-width: var(--col); margin: 0 auto; padding: 20px 16px 0; }
.spot .meta { text-align: center; }
.spot-stage { position: relative; }
.spot .stage { padding: 6px 0; background: none; }
.spot .scene { max-height: 38vh; border: 2px solid var(--line); border-radius: var(--r); }
.depth { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-top: 12px; }
.depth .seg { height: 10px; background: var(--line); }
.depth .seg.lit { background: currentColor; }
.depth-ends { display: flex; justify-content: space-between; margin: 4px 0 0; font-family: var(--pixel); font-size: 13px; color: var(--dim); }
.spot-name { margin: 10px 0 14px; font-size: 44px; line-height: 1.1; text-align: center; }
.spot:not(.landed) .spot-name, .spot:not(.landed) .spot-rest { visibility: hidden; }
.spot.landed .spot-name { animation: land 420ms steps(4) both; }
.spot.landed .spot-rest { animation: focus-in 500ms 200ms ease-out both; }
/* "Next question" stays pinned to the bottom of the screen, so it never needs scrolling to */
.spot .actions {
  position: sticky; bottom: 0; justify-content: center; margin: 16px -16px 0; padding: 12px 16px max(14px, env(safe-area-inset-bottom));
  background: var(--bg); border-top: 2px solid var(--line);
}
.spot .actions .btn { min-width: 220px; justify-content: center; }
@keyframes land { from { opacity: 0; transform: scale(1.6); } to { opacity: 1; transform: none; } }
/* The burst: eight pixels thrown out from the sleeper. Waking up gets a shake instead. */
.burst { position: absolute; left: 38%; top: 48%; width: 0; height: 0; pointer-events: none; }
.burst.t0 { display: none; }
.burst i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; background: currentColor; opacity: 0; }
.spot.landed .burst i { animation: fling 700ms steps(7) forwards; }
@keyframes fling { 0% { opacity: 1; transform: rotate(var(--a)) translateX(10px); } 100% { opacity: 0; transform: rotate(var(--a)) translateX(110px); } }
.spot.shake .spot-body { animation: shake 520ms steps(8); }
@keyframes shake {
  0%, 100% { transform: none; } 12% { transform: translate(-10px, 2px) rotate(-1deg); } 25% { transform: translate(9px, -3px) rotate(1deg); }
  37% { transform: translate(-8px, 3px); } 50% { transform: translate(7px, -2px) rotate(0.5deg); } 62% { transform: translate(-5px, 1px); }
  75% { transform: translate(4px, -1px); } 87% { transform: translate(-2px, 0); }
}

/* Pages outside the console: subscription, profile, legal */
.page { padding-top: 8px; padding-bottom: 24px; }
.title { font-size: 30px; line-height: 1.15; font-weight: 700; }
/* The pixel font draws 5 almost like S, so a price is set in the reading font where it must be read exactly. */
.price { font-family: var(--body); font-weight: 700; white-space: nowrap; }
.facts { width: 100%; border-collapse: collapse; margin-bottom: 18px; font-size: 15px; }
.facts th, .facts td { text-align: left; padding: 8px 6px; vertical-align: top; }
.facts tr + tr td { border-top: 1px solid var(--line); }
.facts th { color: var(--dim); font-weight: 600; }
.offer { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: center; padding: 20px 0; }
.offer .stage { padding: 0; background: none; }
.offer .scene { max-height: none; border: 2px solid var(--line); border-radius: var(--r); }
/* The second "Buy Unlimited Now" at the bottom of the page, with the price and renewal terms right under it */
/* "Plus tax where it applies" right under the price, in full-size text so it is seen with the price; the asterisk
   note gives the detail */
.plus-tax { margin: -2px 0 10px; font-weight: 600; }
.tax-note { margin: 12px 0 0; font-size: 13px; }
.tax-note.page-end { margin: 8px 0 0; padding-top: 14px; border-top: 2px solid var(--line); }
/* "I agree" beside each buy button: a box to tick, with the Terms linked */
.agree { display: flex; align-items: flex-start; gap: 10px; margin: 14px 0 0; cursor: pointer; }
.agree input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
.agree-note { margin: 8px 0 0; color: var(--warn); min-height: 0; }
.agree-note:empty { display: none; }
/* The record shown after cancelling: its date and reference, set apart so it is easy to keep */
.receipt { padding: 10px 12px; border: 2px dashed var(--line); border-radius: var(--r); font-size: 15px; }
.buy-end .agree { margin-top: 0; }
.buy-end .actions { margin-top: 12px; }
.buy-end p { margin: 12px 0 0; }
.perks { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 12px; }
.perks li { display: flex; align-items: center; gap: 12px; font-size: 17px; }
.perks .icon { font-size: 22px; color: var(--t5); }
.legal h3 { margin-top: 26px; }
.legal p, .legal li { max-width: 65ch; }
.legal ul { padding-left: 20px; }
.policies__table { overflow-x: auto; margin: 12px 0; }
.policies__table table { border-collapse: collapse; min-width: 560px; font-size: 14px; }
.policies__table th, .policies__table td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }

/* Menu popup */
.menu {
  width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; color: var(--text); background: var(--panel);
  border: 2px solid var(--line); border-radius: 10px;
}
.menu::backdrop { background: rgba(11, 16, 32, 0.75); }
.menu-body { padding: 14px 16px 20px; }
.menu-head { display: flex; align-items: center; justify-content: space-between; }
.menu-head h2 { margin: 0; }
/* Menu boxes: two to a row, an icon above the name; a locked mode shows a small lock in the corner */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.tiles.three { grid-template-columns: repeat(3, 1fr); }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 88px; padding: 12px 8px; color: var(--text); background: var(--bg); border: 2px solid var(--line); border-radius: var(--r);
  box-shadow: 0 3px 0 var(--line); font-weight: 600; text-align: center; text-decoration: none;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out;
}
.tile > .icon { font-size: 28px; color: var(--accent); }
.tile:active { transform: translateY(3px); box-shadow: none; }
.tile-lock { position: absolute; top: 8px; right: 8px; color: var(--dim); }
button.tile { width: 100%; font: inherit; font-weight: 600; cursor: pointer; }
.tile small { font-size: 12px; font-weight: 400; }
/* The Multiplayer teaser: one box across the full width, under the four modes */
.tile[data-view="multiplayer"] { grid-column: 1 / -1; flex-direction: row; min-height: 60px; gap: 10px; }
.tile[data-view="multiplayer"] small { color: var(--dim); }
.menu-title { margin: 12px 0 0; }
.menu-view .card:first-child { padding-top: 10px; }
.btn.back { gap: 6px; padding: 8px 14px 8px 10px; }
.btn.wide { display: flex; width: 100%; justify-content: center; gap: 8px; margin: 2px 0 6px; }
.menu-part { padding-top: 14px; }
.menu-part > a { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.switch { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
/* A locked setting: hover, focus or tap shows the note about Unlimited */
.locked-setting { position: relative; cursor: pointer; }
.locked-setting .switch, .locked-setting input:disabled { pointer-events: none; }
.tip {
  display: none; position: absolute; left: 0; top: calc(100% + 4px); z-index: 2; max-width: 320px; padding: 10px 12px;
  background: var(--panel); border: 2px solid var(--accent); border-radius: var(--r); font-size: 14px; cursor: default;
}
.locked-setting:hover .tip, .locked-setting:focus-within .tip, .locked-setting.open .tip { display: block; }
.menu code { font-size: 12px; word-break: break-all; }
/* Archive: a mode picker, then one row per past game */
.picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.picker .btn { justify-content: center; gap: 4px; min-height: 40px; padding: 6px 4px; font-size: 14px; }
.archive { list-style: none; margin: 0 0 12px; padding: 0; }
.archive li + li { border-top: 1px solid var(--line); }
.archive a { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; min-height: 44px; padding: 6px 2px; color: var(--text); text-decoration: none; }
.archive a:hover .arc-name { color: var(--accent); }
.arc-name { font-weight: 600; }
.arc-date { color: var(--dim); font-size: 14px; }
.arc-end { color: var(--accent); font-weight: 600; letter-spacing: 0.05em; }

/* "About Lucidle" under each game, folded to one line: open it to read. The text is in the page itself, so search
   engines and AI tools that do not run the game still understand the site. */
.about { max-width: var(--col); margin: 0 auto 28px; padding: 0 16px; color: var(--dim); font-size: 15px; }
.about summary { display: flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; list-style: none; }
.about summary::-webkit-details-marker { display: none; }
.about summary::before { content: "+"; width: 1ch; font-family: var(--pixel); font-size: 18px; color: var(--accent); }
.about[open] summary::before { content: "-"; }
.about summary h2 { margin: 0; font-size: 16px; color: var(--dim); }
.about summary:hover h2, .about[open] summary h2 { color: var(--text); }
.about[open] summary { margin-bottom: 6px; }
/* Sources and credits: kept quiet, smaller text; reached only from the end of the About page */
.credits-link { margin-top: 28px; font-size: 13px; }
.credits-link a { color: var(--dim); }
.credits-page { font-size: 14px; color: var(--dim); }
.credits-page .title { color: var(--text); }
.credits-page h2 { margin-top: 22px; font-size: 17px; color: var(--text); }
.credits-page ul { padding-left: 20px; }
.credits-page li { margin-bottom: 8px; }
.credits-page strong { color: var(--text); }
.licence-text summary { cursor: pointer; }
.licence-text pre { overflow-x: auto; padding: 10px; font-size: 11px; white-space: pre-wrap; background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); }
/* The About page */
.about-page h2 { margin-top: 26px; font-size: 20px; }
.about-page .lead { font-size: 17px; }
.about-page ul { padding-left: 20px; }
.about-page li { margin-bottom: 6px; }
.levels-row { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.about ul { margin: 0 0 10px; padding-left: 20px; }
.about li { margin-bottom: 4px; }
.about strong { color: var(--text); }

/* Footer and ad spaces */
.foot { padding-bottom: 28px; color: var(--dim); font-size: 14px; text-align: center; }
.foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-bottom: 8px; }
.foot a { color: var(--dim); }
/* "Cookie settings" opens a dialog, so it is a button dressed like the footer's links */
.linkish { padding: 0; font: inherit; color: var(--dim); background: none; border: 0; text-decoration: underline; cursor: pointer; }
/* A real ad has no dashed frame; the side ad is the standard 160 by 600 */
.ad.live, .ad-side.live { padding: 0; border: 0; }
.ad.live ins { display: block; }
.ad-side.live ins { display: inline-block; width: 160px; height: 600px; }
.ad, .ad-side { border: 2px dashed var(--line); border-radius: var(--r); color: var(--dim); font-size: 13px; text-align: center; }
.ad { max-width: var(--col); margin: 0 auto 28px; padding: 28px 16px; }
.ad-side { display: none; }
@media (min-width: 1056px) {
  .ad-side { display: flex; align-items: center; justify-content: center; position: fixed; z-index: 1; top: 120px; width: 160px; height: 600px; max-height: calc(100vh - 140px); }
  .ad-side.left { right: calc(50% + 354px); }
  .ad-side.right { left: calc(50% + 354px); }
}

@media (max-width: 767px) {
  .console { margin: 10px 12px 26px; padding: 0 10px 4px; box-shadow: 0 0 0 5px var(--panel), 0 0 0 7px var(--line), 0 12px 0 0 var(--line); }
  .tabs { font-size: 14px; }
  .clues li, .learned li { grid-template-columns: 88px 1fr; }
  .stake-name { font-size: 11px; }
  .spot-body { padding-top: 12px; }
  .spot .scene { max-height: 26vh; }
  .spot-name { margin: 6px 0 10px; font-size: 36px; }
  .play-bar { margin: 12px -10px 0; padding: 8px 10px max(10px, env(safe-area-inset-bottom)); }
  .console:has(.play-bar) .scene { max-height: 13vh; }
  .offer { grid-template-columns: 1fr; }
  .title { font-size: 26px; }
}
@media (prefers-reduced-motion: no-preference) {
  .menu[open] { animation: pop 140ms ease-out; }
}
@keyframes pop { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .scene *, .clues .now .clue, .btn.go, .spot *, .spot-body { animation: none !important; }
  .spot.landed .burst { display: none; }
  .scene .sky-moon { transition: none; }
  .pose-5 .lying { transform: translateY(-12px); }
  .pose-5 g.cloud { transform: translateY(-10px); }
  .btn, .icon-btn, .stake { transition: none; }
}

/* Closer: the Metric / Imperial choice under the answer box and in Settings. */
.units { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--dim); font-size: 14px; }
.unit-btn { min-height: 34px; padding: 4px 12px; font: inherit; color: var(--dim); background: transparent; border: 2px solid var(--line); border-radius: var(--r); cursor: pointer; }
.unit-btn[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.unit-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card > .units { min-height: 44px; margin-top: 0; }
/* The bell curve at the end of a game, in every mode. */
.bell svg { display: block; width: 100%; height: auto; }
.bell text { font-family: var(--pixel); }
.bell .area { fill: var(--accent); opacity: 0.14; }
.bell .curve { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.bell .axis, .bell .tick { stroke: var(--line); stroke-width: 2; }
.bell .num { fill: var(--dim); font-size: 12px; }
.bell line.you { stroke: var(--t5); stroke-width: 3; }
.bell circle.you { fill: var(--t5); }
.bell text.you { fill: var(--t5); font-size: 13px; letter-spacing: 1px; }
.bell-note { font-family: var(--pixel); color: var(--t5); }

/* Badges: the icon and its name. Grey with a lock until earned; then the colour of its rarity (.k1 to .k5, under
   "Achievements by rarity" below; the old streak ranks .r0 to .r5 went with the achievement pop-ups, 25 Nov 2026). */
.badge { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 2px 9px; font-family: var(--pixel); font-size: 14px;
  color: var(--dim); border: 2px solid var(--line); border-radius: var(--r); opacity: 0.6; white-space: nowrap; }
.badge .icon { width: 15px; height: 15px; }
.badge.got { opacity: 1; color: var(--rank); border-color: var(--rank); background: color-mix(in srgb, var(--rank) 14%, transparent); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge-new { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 2px solid var(--t5); border-radius: var(--r); background: color-mix(in srgb, var(--t5) 10%, transparent); }
.next-badge { color: var(--dim); }

/* The volume slider that opens under the speaker button. */
.bar-btns { position: relative; }
.volume { position: absolute; top: 52px; right: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); }
.volume .icon { color: var(--dim); }
.volume input[type="range"] { width: 150px; height: 28px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.volume-pct { min-width: 44px; text-align: right; font-family: var(--pixel); font-size: 14px; color: var(--dim); }

/* The Standard or Hard choice at the start of a game: two large buttons, side by side (stacked on a phone). */
.difficulties { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 14px; }
.btn.difficulty { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 96px; padding: 14px 16px; text-align: left; white-space: normal; }
.btn.difficulty strong { font-family: var(--pixel); font-size: 20px; }
.btn.difficulty span { font-size: 14px; line-height: 1.4; font-weight: 400; }
@media (max-width: 520px) { .difficulties { grid-template-columns: 1fr; } }

/* The start screen: the mode's one-line brief, under the start button, in the score yellow. */
.start .blurb.brief { margin: 14px 0 0; color: var(--t5); }
/* Frequently asked questions, in the menu: each question opens to its answer. */
.faq details { border-bottom: 1px solid var(--line); }
.faq details:last-child { border-bottom: 0; }
.faq summary { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 0; font-weight: 600; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+"; flex: none; width: 1ch; font-family: var(--pixel); font-size: 18px; line-height: 1.3; color: var(--accent); }
.faq details[open] summary::before { content: "-"; }
.faq summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.faq-answer { padding: 0 0 12px 20px; color: var(--dim); font-size: 15px; }
.faq-answer p, .faq-answer ul { margin: 0 0 8px; }
.faq-answer ul { padding-left: 18px; }
.faq-answer li { margin-bottom: 4px; }

/* Negative: the level below Awake, for a Bolder score under zero. Its own red, brighter than Deep Sleep's. */
:root { --tn: #ff4a4a; }
.tn, .chart .tn { color: var(--tn); fill: var(--tn); }
.burst.tn { display: none; }
/* The score so far, beside the question number while playing and on every result. */
.scoreline { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.spot .scoreline { justify-content: center; gap: 4px 18px; }
.live-score { display: inline-flex; align-items: baseline; gap: 6px; font-family: var(--pixel); color: var(--t5); white-space: nowrap; }
.live-score strong { font-size: 20px; line-height: 1; }
.live-score .live-label, .live-score .live-of { font-size: 13px; color: var(--dim); }
.live-score.minus strong { color: var(--tn); }
.live-score .gain { font-style: normal; font-size: 15px; padding: 0 6px; border: 2px solid currentColor; border-radius: var(--r); }
.live-score .gain.minus { color: var(--tn); }
/* Bolder: six confidence levels in a row, and the locked-in answer above them. */
.stakes.levels { grid-template-columns: repeat(6, 1fr); }
.stakes.levels .stake-name { font-family: var(--pixel); font-size: 20px; }
.stakes.levels .stake-pts { font-size: 11px; }
.play-bar .answer > .btn:only-child { flex: 1; justify-content: center; }
.reveal.locked { border-style: dashed; }
/* The end of a Bolder game: the average a question, large, with its level. */
.average { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin: 2px 0 12px; padding: 10px 14px; background: var(--panel); border: 2px solid currentColor; border-radius: var(--r); font-family: var(--pixel); }
.average-label { font-size: 15px; color: var(--dim); }
.average strong { font-size: 38px; line-height: 1; }
.average .tag { font-size: 22px; }
.remark-line { font-size: 17px; font-weight: 600; color: var(--tn); }
/* The sleeper's remark: a speech bubble drawn into the scene beside his head. */
.scene .remark .edge, .scene .remark .fill { fill: var(--text); }
.scene .remark text { fill: var(--accent-ink); font-family: var(--body); font-size: 4.3px; font-weight: 700; }
.stage.says .scene .vein { display: none; }
@media (max-width: 767px) {
  .stakes.levels .stake-pts { font-size: 9px; }
  .average strong { font-size: 32px; }
}

/* The sleeper's room. The sky takes the colour of the level of sleep and gets darker the deeper he goes: grey awake,
   then light orange, blue, red and purple. Lucid is all of them at once: a sky that runs through every level's colour,
   with bands of them drifting across it. */
.scene .sky { transition: fill 500ms steps(5); }
.pose-0 .sky { fill: color-mix(in srgb, var(--t0) 34%, #10162b); }
.pose-1 .sky { fill: color-mix(in srgb, var(--t1) 30%, #0e1428); }
.pose-2 .sky { fill: color-mix(in srgb, var(--t2) 23%, #0c1123); }
.pose-3 .sky { fill: color-mix(in srgb, var(--t3) 18%, #0a0e1e); }
.pose-4 .sky { fill: color-mix(in srgb, var(--t4) 14%, #070a17); }
.pose-5 .sky { fill: color-mix(in srgb, var(--t4) 10%, #05070f); }
.stage.angry .pose-0 .sky { fill: color-mix(in srgb, var(--tn) 22%, #10162b); }
#lucid-sky .ls0 { stop-color: color-mix(in srgb, var(--t0) 42%, #070a17); }
#lucid-sky .ls1 { stop-color: color-mix(in srgb, var(--t1) 42%, #070a17); }
#lucid-sky .ls2 { stop-color: color-mix(in srgb, var(--t2) 38%, #070a17); }
#lucid-sky .ls3 { stop-color: color-mix(in srgb, var(--t3) 38%, #070a17); }
#lucid-sky .ls4 { stop-color: color-mix(in srgb, var(--t4) 42%, #070a17); }
.scene .aurora { opacity: 0; transition: opacity 600ms steps(4); }
.scene .au { opacity: 0.26; }
.pose-5 .aurora { opacity: 1; }
.pose-5 .au { animation: drift 7s steps(14) infinite alternate; }
.pose-5 .au.t1, .pose-5 .au.t3 { animation-direction: alternate-reverse; animation-duration: 9s; }
@keyframes drift { from { transform: translateX(-14px); } to { transform: translateX(14px); } }
/* The room's furniture. */
.scene .floor { fill: var(--bg); opacity: 0.55; }
.scene .rug { fill: var(--accent-deep); opacity: 0.55; }
.scene .rug-trim { fill: var(--t5); opacity: 0.5; }
.scene .wood-dark { fill: var(--bg); opacity: 0.5; }
.scene .knob, .scene .clock-face { fill: var(--t5); }
.scene .clock { fill: var(--dim); }
.scene .mattress-hi { fill: var(--text); opacity: 0.35; }
.scene .pillow-shade { fill: var(--dim); opacity: 0.6; }
.scene .slipper { fill: var(--t3); }
.scene .slipper-hi { fill: var(--text); opacity: 0.5; }
.scene .cat { fill: #f79a4b; }
.scene .cat-eye { fill: var(--accent-ink); }
.scene .cat-tail { transform-box: fill-box; transform-origin: right bottom; animation: tail 3.2s steps(2) infinite; }
@keyframes tail { 0%, 100% { transform: none; } 50% { transform: translate(1px, -1px); } }
.scene .cloud { opacity: 0; }
.scene .cloud .cloud { opacity: 1; fill: var(--text); }
.pose-5 g.cloud { opacity: 0.85; animation: float-cloud 3s steps(1) infinite; }
/* The sleeper, in more detail. */
.scene .skin-shade { fill: #d9a887; }
.scene .lash, .scene .mouth { fill: var(--accent-ink); }
.scene .blush { fill: var(--t3); opacity: 0.7; }
.scene .blanket.hi, .scene .hood.hi { fill: var(--text); opacity: 0.35; }
.scene .blanket.stripe { fill: var(--accent-deep); }
.scene .blanket.fold { fill: var(--accent-deep); opacity: 0.6; }
.scene .pyjama-stripe { fill: var(--text); opacity: 0.45; }
.scene .button { fill: var(--t5); }
.scene .hood.hi { opacity: 0; }
.pose-4 .hood.hi { opacity: 0.35; }
/* Awake: he blinks. Shut-eye: his eye flutters open. Deep Sleep and deeper: a snore bubble swells and pops. */
.scene .blink { transform-box: fill-box; transform-origin: center; }
.pose-0 .blink { animation: blink 3.4s steps(1) infinite; }
.stage.angry .pose-0 .blink { animation: none; }
@keyframes blink { 0%, 92%, 100% { transform: none; } 94%, 98% { transform: scaleY(0.2); } }
.scene .lash { opacity: 0; }
.pose-1 .lash { animation: flutter 2.6s steps(1) infinite; }
@keyframes flutter { 0%, 70%, 100% { opacity: 0; } 75%, 90% { opacity: 1; } }
.scene .snore { fill: var(--text); opacity: 0; transform-box: fill-box; transform-origin: left bottom; }
.pose-3 .snore, .pose-4 .snore { animation: snore 4s steps(4) infinite; }
@keyframes snore { 0% { opacity: 0; transform: scale(0.4); } 40% { opacity: 0.8; transform: scale(1); } 70% { opacity: 0.8; transform: scale(1.5); } 75%, 100% { opacity: 0; transform: scale(1.5); } }
.pose-4 .hood { animation: none; }
.pose-5 .hood { opacity: 0; }
/* Sinking a level: the whole sleeper drops a notch and settles. Coming back up, he bobs the other way. */
.scene.drop .body { animation: drop 300ms steps(3); }
.scene.rise .body { animation: rise 300ms steps(3); }
@keyframes drop { 0% { transform: translateY(-3px); } 60% { transform: translateY(1px); } 100% { transform: none; } }
@keyframes rise { 0% { transform: translateY(3px); } 60% { transform: translateY(-1px); } 100% { transform: none; } }
.pose-5 .dream .spark:nth-child(4n) { animation: twinkle 1.1s steps(1) infinite reverse; }

/* The depths, on the results screen: each level of sleep, the scores that land on it and a line about it. */
.depths { margin: 4px 0 18px; }
.depths-title { display: flex; align-items: center; gap: 12px; margin: 0 0 4px; font-family: var(--pixel); font-size: 14px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--dim); }
.depths-title::after { content: ""; flex: 1; border-top: 2px dashed var(--line); }
.depths ol { list-style: none; margin: 0; padding: 0; }
.depths li { display: grid; grid-template-columns: 26px 92px 1fr; gap: 10px; align-items: baseline; padding: 9px 4px; border-top: 1px solid var(--line); font-family: var(--pixel); font-size: 15px; color: var(--dim); }
.depths li:first-child { border-top: 0; }
.depths-icon { font-size: 13px; opacity: 0.55; }
/* The pixel font draws 5 almost like S, so the scores are set in the reading font. */
.depths-range { opacity: 0.7; font-family: var(--body); font-weight: 700; font-variant-numeric: tabular-nums; }
.depths-line { color: var(--dim); opacity: 0.75; }
.depths li.mine { background: var(--panel); margin: 0 -8px; padding: 9px 12px; border-radius: var(--r); border-top-color: transparent; }
.depths li.mine + li { border-top-color: transparent; }
.depths li.mine .depths-icon, .depths li.mine .depths-range { opacity: 1; }
.depths li.mine .depths-line { color: var(--text); opacity: 1; font-weight: 700; }
@media (max-width: 767px) { .depths li { grid-template-columns: 22px 78px 1fr; font-size: 13px; } }
@media (prefers-reduced-motion: reduce) { .scene .sky, .scene .aurora { transition: none; } }

/* The descent: during a game the sky follows the running score (js sets --sky and --lucid on the scene), gliding
   from one level's colour to the next. The Lucid sky is a layer over it that fades in. */
.stage { position: relative; }
.scene .sky-lucid { fill: url(#lucid-sky); opacity: 0; transition: opacity 500ms steps(5); }
.pose-5 .sky-lucid { opacity: 1; }
.stage .scene.depth .sky { fill: var(--sky); transition: none; }
.stage .scene.depth .sky-lucid, .stage .scene.depth .aurora { opacity: var(--lucid, 0); transition: none; }
.scene.depth .au { animation: drift 7s steps(14) infinite alternate; }
/* The depth chip: the total so far and the level it has reached, in the corner of the scene. */
.depth-chip { position: absolute; top: 20px; left: 6px; z-index: 1; display: flex; align-items: baseline; gap: 8px; margin: 0; padding: 4px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); border: 2px solid currentColor; border-radius: var(--r); font-family: var(--pixel); pointer-events: none; }
.depth-chip-label { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); }
.depth-chip strong { font-family: var(--body); font-size: 18px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.depth-chip-level { font-size: 14px; }
.spot .depth-chip { top: 14px; left: 10px; }
.console:has(.play-bar) .depth-chip { top: 12px; padding: 2px 8px; }
.console:has(.play-bar) .depth-chip strong { font-size: 15px; }
@media (max-width: 767px) { .depth-chip { padding: 2px 7px; gap: 6px; } .depth-chip strong { font-size: 15px; } .depth-chip-level { font-size: 12px; } }

/* While a move is with the server: the sleeper stirs in his bed, and the button dims. It is usually a blink. */
.stage.waiting .scene .body { animation: stir 700ms steps(4) infinite; }
@keyframes stir { 0%, 100% { transform: none; } 25% { transform: translate(-1px, 0); } 50% { transform: translate(0, -1px); } 75% { transform: translate(1px, 0); } }
.console:has(.stage.waiting) .play-bar .btn.primary { opacity: 0.6; }

/* Longer and Shorter: the chain so far, the letter needed next and (in Shorter) the end word, joined by arrows. */
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 0; list-style: none; margin: 10px 0 4px; padding: 0; }
.chain .link { position: relative; margin-left: 22px; padding: 4px 10px; border: 2px solid var(--line); border-radius: 999px; background: var(--panel); font-weight: 600; overflow-wrap: anywhere; }
.chain .link:first-child { margin-left: 0; }
.chain .link::before { content: '→'; position: absolute; left: -18px; top: 50%; transform: translateY(-50%); color: var(--dim); font-weight: 400; }
.chain .link:first-child::before { content: none; }
.chain .given { color: var(--dim); }
.chain .next { border-style: dashed; color: var(--accent); }
.chain .goal { border-color: var(--accent); color: var(--accent); }
.chain-count { margin: 2px 0 0; }

/* The start screen: the status line under the start button takes no room until it has something to say, so the
   mode's yellow line sits close under the button. */
.start .actions + .note:empty { min-height: 0; margin: 0; }
/* The Unlimited screen for a locked mode: the mode's yellow line, as on its start screen. */
.pitch-blurb { margin: 4px 0 12px; font-family: var(--pixel); font-size: 20px; font-weight: 600; line-height: 1.3; color: var(--t5); }
/* Longer and Shorter: what counts in the theme, under the puzzle. */
.chain-about { margin: 4px 0 0; color: var(--dim); font-size: 14px; }


/* Phones too narrow for the five mode tabs in one row: the tabs keep their size and sit on two rows, Earlier, Closer
   and Bolder above, Longer and Shorter below, each row filling the width, so the page fits the screen with no zooming. */
@media (max-width: 459px) {
  .tabs { display: grid; grid-template-columns: repeat(6, 1fr); }
  .tabs a { grid-column: span 2; }
  .tabs a:nth-child(n + 4) { grid-column: span 3; }
}

/* The fall into the level, over the whole screen while an answer's level is revealed (fallInto in the game code). */
.spot .fall { position: fixed; z-index: 5; border-radius: 8px; pointer-events: none; image-rendering: pixelated; transition: opacity 650ms ease-in-out; }
/* While the fall plays, only the game card falls: the reveal is see-through around it, so the page stays in view. */
.spot.falling, .spot.falling::backdrop { background: transparent; }
.spot.falling .spot-body { opacity: 0; }
/* The reveal in the game card's box (spotlight in the game code sets its place): the page shows around it, the box
   looks like the card, and its content scrolls inside it with "Next question" pinned to its bottom. The fall fades
   out as the reveal fades in, in the same box. */
.spot.boxed { background: transparent; overflow: visible; }
.spot.boxed::backdrop { background: rgba(11, 16, 32, 0.35); }
.spot.boxed .spot-body {
  position: fixed; justify-content: flex-start; min-height: 0; max-width: none; margin: 0; padding: 14px 14px 0; overflow-y: auto; overscroll-behavior: contain;
  border: 2px solid var(--line); border-radius: 10px; transition: opacity 650ms ease-in-out;
  box-shadow: 0 0 0 8px var(--panel), 0 0 0 10px var(--line), 0 16px 0 0 var(--line);
  background: linear-gradient(rgba(232, 235, 247, 0.04) 1px, transparent 1px) 0 0 / 4px 4px,
    linear-gradient(90deg, rgba(232, 235, 247, 0.04) 1px, transparent 1px) 0 0 / 4px 4px, var(--bg);
}
.spot.boxed .actions { margin: auto -14px 0; border-radius: 0 0 8px 8px; }
.spot.boxed .spot-rest { margin-bottom: 16px; }
@media (max-width: 767px) { .spot.boxed .spot-body { padding: 10px 10px 0; box-shadow: 0 0 0 5px var(--panel), 0 0 0 7px var(--line), 0 12px 0 0 var(--line); } .spot.boxed .actions { margin: auto -10px 0; } }
.spot .fall.out { opacity: 0; }
/* A thin scrollbar in the game's colours when a reveal is longer than its box (PCs show the scrollbar). */
.spot.boxed .spot-body { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* Bolder's answers that count: a dropdown with a search box and a rarity filter. */
.answers { margin: 0 0 14px; border: 2px solid var(--line); border-radius: var(--r); background: var(--panel); }
.answers summary { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; cursor: pointer; list-style: none; font-weight: 600; }
.answers summary::-webkit-details-marker { display: none; }
.answers summary::after { content: "+"; margin-left: auto; font-family: var(--pixel); font-size: 18px; color: var(--accent); }
.answers[open] summary::after { content: "-"; }
.answers summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.answers-tools { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px 12px; }
.answers-search, .answers-filter { min-height: 40px; padding: 0 10px; font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 2px solid var(--line); border-radius: var(--r); }
.answers-search { flex: 1 1 160px; min-width: 0; }
.answers-filter { flex: 0 1 auto; }
.answers-search:focus, .answers-filter:focus { outline: none; border-color: var(--accent); }
.answers-search::placeholder { color: var(--dim); }
.answers .answer-rows { margin: 0; padding: 0 12px 12px; }
.answers .answer-rows li { grid-template-columns: 140px 1fr; }
.answers .answer-rows .got { margin: 0 -10px; }
.answers-none { margin: 0; padding: 0 12px 12px; }
@media (max-width: 480px) { .answers .answer-rows li { grid-template-columns: 1fr; gap: 2px; } }

/* Sign-in popup: the email and code boxes. */
.signin { display: grid; gap: 8px; margin: 0 0 8px; }
.signin input { min-height: 44px; padding: 8px 12px; font: inherit; font-size: 16px; color: var(--text); background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); }
.signin input:focus { outline: none; border-color: var(--accent); }
.signin input::placeholder { color: var(--dim); }
.signin-again { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 8px; }
.signin-again .quiet:disabled { opacity: 0.6; cursor: default; }

/* "Sign in with Google", in Google's own style (blue, with the G on a white square). */
.google-btn { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; padding: 4px 18px 4px 4px; border-radius: 10px;
  background: #4285F4; color: #fff; font-family: var(--body); font-size: 16px; font-weight: 600; text-decoration: none; }
.google-btn:hover { background: #3b78e7; color: #fff; }
/* The same raised, pressable edge as the other buttons, in a deeper Google blue. */
.google-btn { border: 2px solid #4285F4; border-radius: var(--r); box-shadow: 0 3px 0 #2a5db0; transition: transform 80ms ease-out, box-shadow 80ms ease-out; }
.google-btn .google-mark { border-radius: 4px; width: 36px; height: 36px; }
.google-btn { padding: 2px 18px 2px 2px; }
.google-btn:hover { border-color: #3b78e7; }
.google-btn:active { transform: translateY(3px); box-shadow: none; }
.google-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.google-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 7px; background: #fff; flex: none; }
.google-mark svg { width: 22px; height: 22px; }
/* No empty gaps in the sign-in popup before a code is sent. */
.signin-again:not(:has(> :not([hidden]))) { display: none; }
dialog.confirm .note:empty { display: none; }
/* Signing in replaces this browser's progress with the account's: the warning stands out. */
.signin-agree { margin: 0 0 10px; font-size: 0.9em; }
.signin-warn { margin: 0 0 10px; padding: 8px 10px; border: 2px solid var(--warn); border-radius: var(--r); color: var(--warn); font-weight: 600; }
/* The account button in the top bar: the person icon with "Sign in" or the username. On narrow screens, the name
   is cut short; on the narrowest, only the icon shows. */
.account-btn { width: auto; gap: 6px; padding: 0 12px; font-size: 15px; }
.account-label { max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 400px) { .account-btn { padding: 0; width: 44px; } .account-label { display: none; } }

/* Easter eggs in the bedroom scene (js/main.js). The lamp: a tap flips it, on when he sleeps, off when he sits up. */
.stage.lamp-flip .scene:not(.pose-0) .glow { opacity: 0.16; }
.stage.lamp-flip .scene:not(.pose-0) .shade { fill: var(--t5); }
.stage.lamp-flip .scene.pose-0 .glow { opacity: 0; }
.stage.lamp-flip .scene.pose-0 .shade { fill: var(--dim); }
/* The cat: one tap wags its tail; three in a row and it jumps up cross, with an anger mark. */
.scene g.cat { transform-box: fill-box; transform-origin: center bottom; }
.scene .cat-vein { fill: var(--t3); opacity: 0; }
.stage.cat-wag .scene .cat-tail { animation: wag 180ms steps(2) 5; }
@keyframes wag { 0%, 100% { transform: none; } 50% { transform: translate(-1px, -2px); } }
.stage.cat-mad .scene g.cat { animation: cat-jump 1100ms steps(10); }
.stage.cat-mad .scene rect.cat { fill: #f2683a; }
.stage.cat-mad .scene .cat-vein { opacity: 1; animation: throb 0.3s steps(1) infinite; }
.stage.cat-mad .scene .cat-tail { transform: translate(0, -2px); }
@keyframes cat-jump { 0% { transform: none; } 15% { transform: translateY(-7px); } 30% { transform: translateY(-8px); } 50% { transform: translateY(-2px); }
  60% { transform: none; } 70% { transform: translateX(-1px); } 80% { transform: translateX(1px); } 90% { transform: translateX(-1px); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .stage.cat-wag .scene .cat-tail, .stage.cat-mad .scene g.cat { animation: none !important; } }

/* Achievements by rarity (25 Nov 2026): each badge takes the colour of its depth, Shut-eye (k1) to Lucid (k5). */
.badge.k1 { --rank: var(--t1); } .badge.k2 { --rank: var(--t2); } .badge.k3 { --rank: var(--t3); }
.badge.k4 { --rank: var(--t4); } .badge.k5 { --rank: var(--t5); }
.badge.ach .icon { width: 14px; height: 14px; }
.badge.ach:not(.got) { border-color: color-mix(in srgb, var(--rank) 35%, var(--line)); }
.achievements { display: grid; gap: 12px; }
.ach-group { display: grid; gap: 8px; padding: 10px 12px; border: 2px solid color-mix(in srgb, var(--rank) 45%, var(--line)); border-radius: var(--r);
  background: color-mix(in srgb, var(--rank) 6%, transparent); }
.ach-group.k1 { --rank: var(--t1); } .ach-group.k2 { --rank: var(--t2); } .ach-group.k3 { --rank: var(--t3); }
.ach-group.k4 { --rank: var(--t4); } .ach-group.k5 { --rank: var(--t5); }
.ach-group h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; font-size: 15px; }
.ach-count { font-family: var(--pixel); font-size: 13px; color: var(--dim); }
.badge-new.k1 { border-color: var(--t1); } .badge-new.k2 { border-color: var(--t2); } .badge-new.k3 { border-color: var(--t3); }
.badge-new.k4 { border-color: var(--t4); } .badge-new.k5 { border-color: var(--t5); }

/* Achievement pop-ups: one at a time at the top of the screen, in the badge's rarity colour. The rarer the badge,
   the more it does: Shut-eye glows, Nap adds a shine, Deep Sleep pulses, Hibernation throws sparks, Lucid showers
   gold and white sparks and its gem bounces. */
.achieve { --c: var(--t5); position: fixed; top: 14px; left: 50%; z-index: 1000; display: flex; align-items: center; gap: 12px;
  width: min(420px, calc(100vw - 32px)); padding: 12px 10px 12px 14px; color: var(--text); background: var(--panel);
  border: 2px solid var(--c); border-radius: var(--r); overflow: hidden; opacity: 0; transform: translate(-50%, -18px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 0 16px color-mix(in srgb, var(--c) 35%, transparent);
  transition: opacity 300ms, transform 300ms; }
.achieve.on { opacity: 1; transform: translate(-50%, 0); }
.achieve.k1 { --c: var(--t1); } .achieve.k2 { --c: var(--t2); } .achieve.k3 { --c: var(--t3); }
.achieve.k4 { --c: var(--t4); } .achieve.k5 { --c: var(--t5); }
.achieve::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--c) 30%, transparent) 50%, transparent 70%); }
.achieve-icon { position: relative; z-index: 1; flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); border: 2px solid var(--c); }
.achieve-icon .icon { width: 20px; height: 20px; }
.achieve-text { position: relative; z-index: 1; flex: 1; min-width: 0; display: grid; gap: 2px; }
.achieve-label { font-family: var(--pixel); font-size: 12px; color: var(--c); }
.achieve-text strong { font-size: 16px; line-height: 1.25; }
.achieve-what { font-size: 13px; line-height: 1.35; color: var(--dim); }
.achieve-close { position: relative; z-index: 1; flex: none; display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  color: var(--dim); background: none; border: 0; border-radius: var(--r); cursor: pointer; }
.achieve-close:hover, .achieve-close:focus-visible { color: var(--text); background: color-mix(in srgb, var(--c) 14%, transparent); }
.achieve-close .icon { width: 16px; height: 16px; }
.achieve-spark { position: absolute; left: 34px; top: 50%; width: 6px; height: 6px; background: var(--c); opacity: 0; pointer-events: none; }
.achieve-spark.white { background: #fff; width: 4px; height: 4px; }
@media (prefers-reduced-motion: no-preference) {
  .achieve.on:not(.k1)::after { animation: achieve-shine 1.1s ease-out 250ms both; }
  .achieve.k5.on::after { animation-iteration-count: 2; }
  .achieve.k3.on, .achieve.k4.on, .achieve.k5.on { animation: achieve-pulse 1.4s ease-in-out 300ms 3; }
  .achieve.on .achieve-spark { animation: achieve-spark 900ms ease-out var(--delay) both; }
  .achieve.k5.on .achieve-icon { animation: achieve-pop 650ms ease-out 150ms both; }
}
@keyframes achieve-shine { from { opacity: 1; transform: translateX(-110%); } to { opacity: 1; transform: translateX(110%); } }
@keyframes achieve-pulse { 50% { box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 0 30px color-mix(in srgb, var(--c) 70%, transparent); } }
@keyframes achieve-spark { 0% { opacity: 1; transform: translate(0, -50%) scale(1); } 100% { opacity: 0; transform: translate(var(--x), calc(var(--y) - 50%)) scale(0.4); } }
@keyframes achieve-pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
/* The share of players who have each achievement. */
.ach-pct { font-family: var(--body); font-size: 11px; color: var(--dim); }
.ach-pct:empty { display: none; }
.achieve-share { position: relative; z-index: 1; font-size: 12px; color: var(--c); }
.achieve-share:empty { display: none; }

/* Earlier Party (party.html): the room code, the players, reactions, each question's results and the podium. */
.party .meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.party-code { font-family: var(--pixel); color: var(--accent); letter-spacing: 0.18em; }
.party-code-in { text-transform: uppercase; letter-spacing: 0.18em; max-width: 9em; }
.party-pick { margin-top: 8px; }
.party-players { list-style: none; margin: 8px 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.party-players li { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); font-size: 14px; }
.party-players li.me { border-color: var(--accent); }
.party-players li.away { opacity: 0.55; }
.party-players small { color: var(--dim); }
.party-done { color: var(--t5); font-weight: 700; }
.party-score { font-family: var(--pixel); color: var(--accent); }
.party-rows, .party-podium { list-style: none; margin: 10px 0 16px; padding: 0; display: grid; gap: 6px; }
.party-rows li, .party-podium li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: baseline; padding: 8px 10px; background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); }
.party-podium li { grid-template-columns: 2.6em 1fr auto; font-size: 18px; }
.party-rows li.me, .party-podium li.me { border-color: var(--accent); }
.party-podium li.p1 { border-color: var(--t5); }
.party-place { font-family: var(--pixel); text-align: center; }
.party-name { overflow-wrap: anywhere; }
.party-reactions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.party-reactions .icon-btn { font-size: 20px; }
.party-floats { position: fixed; right: 16px; bottom: 16px; z-index: 30; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none; }
.party-float { padding: 6px 10px; background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); font-size: 14px; animation: party-float 3.2s ease-out both; }
.party-emoji { font-size: 20px; }
@keyframes party-float { 0% { opacity: 0; transform: translateY(10px); } 12%, 75% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-14px); } }
@media (prefers-reduced-motion: reduce) { .party-float { animation: none; } }
.party-banner { color: var(--warn); }
.party-timer { font-family: var(--pixel); }
.party h2 { margin-top: 22px; }
.card.party-start .blurb, .party .blurb { font-family: var(--body); }
/* The code box and its Join button, centred under "Have a code?". */
.party-join { justify-content: center; }
.party-join .party-code-in { flex: 0 1 9em; }
/* Every start screen: "Play with friends" (Sleepover) above the start button, the same width. */
.start .actions.stack { display: grid; justify-content: center; }
.btn.friends { justify-content: center; gap: 10px; }

/* Sleepover, round two (27 Nov 2026). "Play with friends": outlined in the accent, under nothing louder than the
   filled start button below it. */
.btn.friends { border-color: var(--accent); color: var(--accent); background: var(--panel); box-shadow: 0 3px 0 var(--accent-deep); }
.btn.friends:hover { background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
/* A little more room between it and the start button below. */
.actions.stack > .btn.friends { margin-bottom: 6px; }
/* The setup screen: numbered sections, mode cards (Bolder marked as the party favourite), topic buttons. */
.party-setup { margin-top: 8px; }
.party-setup h2 { margin: 22px 0 8px; }
.party-room { margin-bottom: 4px; }
.party-invite { margin-top: 6px; }
.party-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.party-mode { display: grid; gap: 6px; align-content: start; text-align: left; padding: 12px; font: inherit; color: var(--text); background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); cursor: pointer; }
.party-mode-name { font-family: var(--pixel); font-size: 18px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.party-mode-text { font-size: 14px; color: var(--dim); line-height: 1.4; }
.party-mode.fav { border-color: var(--t5); box-shadow: 0 0 0 1px var(--t5) inset; }
.party-fav { font-family: var(--body); font-size: 11px; font-weight: 700; color: var(--accent-ink); background: var(--t5); border-radius: 999px; padding: 1px 8px; }
.party-mode.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--panel)); box-shadow: 0 0 0 2px var(--accent) inset; }
.party-mode.on .party-mode-name::before { content: "✓"; color: var(--accent); }
.party-mode:disabled, .party-topic:disabled { cursor: default; }
.party-mode:disabled:not(.on) { opacity: 0.75; }
.party-topics { display: flex; flex-wrap: wrap; gap: 8px; }
.party-topic { display: grid; padding: 8px 12px; font: inherit; font-size: 14px; color: var(--text); background: var(--panel); border: 2px solid var(--line); border-radius: 999px; cursor: pointer; }
.party-topic.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--panel)); }
.party-topic.empty { opacity: 0.45; border-style: dashed; }
.party-topic small { font-size: 11px; color: var(--dim); }
.party-rules { margin: 16px 0 4px; color: var(--dim); font-size: 14px; }
.party-rules summary { cursor: pointer; color: var(--text); }
.party-check:empty { display: none; }
.party-check { display: flex; justify-content: center; margin: 12px 0; }
/* Bolder rounds: what you have found, the vote, and the results with each answer's rarity. */
.party-ask-kind { margin: 0; color: var(--t5); font-family: var(--pixel); }
.party-found { list-style: none; margin: 8px 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.party-found li { padding: 4px 10px; background: var(--panel); border: 2px solid var(--line); border-radius: 999px; font-size: 14px; }
.party-count { color: var(--t5); }
.party-votes { display: grid; gap: 8px; margin: 12px 0; }
.party-vote { display: grid; gap: 4px; text-align: left; padding: 10px 12px; font: inherit; color: var(--text); background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); cursor: pointer; }
.party-vote.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.party-vote-answers { font-size: 14px; color: var(--dim); overflow-wrap: anywhere; }
.party-bolder { list-style: none; margin: 10px 0 16px; padding: 0; display: grid; gap: 8px; }
.party-bolder li { padding: 10px 12px; background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); }
.party-bolder li.me { border-color: var(--accent); }
.party-bolder li.top { border-color: var(--t5); }
.party-bolder-head { display: flex; justify-content: space-between; gap: 10px; }
.party-bolder-sum { margin: 4px 0 8px; font-size: 13px; color: var(--dim); }
.party-bolder-answers { display: flex; flex-wrap: wrap; gap: 6px; }
.party-answer { padding: 2px 8px; border: 2px solid currentColor; border-radius: 999px; font-size: 13px; }
.party-said { display: block; color: var(--dim); font-size: 13px; }
@media (max-width: 520px) { .party-modes { grid-template-columns: 1fr; } }
.party-label { display: block; margin: 10px 0 6px; font-size: 14px; color: var(--dim); }
.party-topics { align-items: center; }
.party .note:empty { min-height: 0; margin: 0; }

/* Sleepover, round three (27 Nov 2026, the owner after playing it). */
/* The room code in the plain typeface, which reads more clearly than the pixel one. */
.party-code { font-family: var(--body); font-weight: 800; letter-spacing: 0.14em; }
/* The chat and the emoji row, in a section of their own under the game. */
.party-social { max-width: var(--col); margin: 0 auto; padding: 0 16px 8px; }
.party-chat-log { list-style: none; margin: 0 0 8px; padding: 8px 10px; max-height: 180px; overflow-y: auto; background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); font-size: 14px; display: grid; gap: 4px; }
.party-chat-log li { overflow-wrap: anywhere; }
.party-chat-log li strong { color: var(--accent); }
.party-chat-log li.me strong { color: var(--t5); }
.party-chat-empty { color: var(--dim); }
.party-chat-form { margin-bottom: 4px; }
.party-social .party-reactions { margin-top: 6px; }
.party-ad { max-width: var(--col); margin: 8px auto 0; }
/* Bolder: own answers with their rarity at once; how many are done. */
.party-found li.party-answer { background: transparent; }
.party-done-count { text-align: center; }
/* The vote: square tiles in a grid. */
.party-votes { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.party-vote { aspect-ratio: 1 / 1; align-content: start; overflow-y: auto; }
/* Bolder results: the rarest three, then every player in boxes of one size that grow only downwards. */
.party-top { list-style: none; margin: 10px 0 18px; padding: 0; display: grid; gap: 8px; }
.party-top li { display: grid; grid-template-columns: 2.4em auto 1fr; gap: 10px; align-items: center; padding: 8px 10px; background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); }
.party-top-by { color: var(--dim); font-size: 14px; text-align: right; overflow-wrap: anywhere; }
.party-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); grid-auto-rows: minmax(150px, auto); gap: 10px; margin: 10px 0 14px; }
.party-card { padding: 10px 12px; background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); }
.party-card.me { border-color: var(--accent); }
.party-card.top { border-color: var(--t5); }
/* The end of a Sleepover game: the top three on a podium (second, first, third), then the player's achievements. */
.party-podium3 { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 8px; margin: 14px 0 16px; }
.party-step { display: grid; justify-items: center; gap: 4px; text-align: center; min-width: 0; }
.party-step-medal { font-size: 28px; }
.party-step-name { overflow-wrap: anywhere; font-size: 15px; }
.party-step-block { display: grid; place-items: center; width: 100%; border-radius: var(--r) var(--r) 0 0; background: var(--panel); border: 2px solid var(--line); border-bottom: 0; font-family: var(--pixel); color: var(--dim); }
.party-step.p1 .party-step-block { height: 96px; border-color: var(--t5); color: var(--t5); }
.party-step.p2 .party-step-block { height: 72px; }
.party-step.p3 .party-step-block { height: 52px; }
.party-step.me .party-step-name { color: var(--accent); }
.party-awards { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.party-awards .note { margin: 0; }
.party-agree { font-size: 13px; }

/* Sleepover, round four (27 Nov 2026). The Sleepover page in the arcade box, with its own scene. */
.party-stage { margin: 0 -14px 6px; }
.party-stage .scene { max-height: 28vh; }
@media (prefers-reduced-motion: no-preference) {
  .party-zs { animation: party-zs 3s ease-in-out infinite; }
  @keyframes party-zs { 0%, 100% { transform: translateY(0); opacity: 0.6; } 50% { transform: translateY(-2px); opacity: 1; } }
}
.console .party-social { padding: 0 0 10px; }
/* The invite link, in every room. */
.party-invite-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.party-invite-url { font-size: 13px; color: var(--dim); overflow-wrap: anywhere; flex: 1 1 180px; }
/* A Hibernation or Lucid answer: the screen lights up in its colour, with its name and a burst of sparks. */
.party-fx { position: fixed; inset: 0; z-index: 60; pointer-events: none; display: grid; place-items: center; --c: var(--t4);
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--c) 34%, transparent), transparent 62%); animation: party-fx-glow 1.6s ease-out both; }
.party-fx.k5 { --c: var(--t5); background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--c) 42%, transparent), color-mix(in srgb, var(--t4) 14%, transparent) 45%, transparent 70%); }
.party-fx-word { grid-area: 1 / 1; font-family: var(--pixel); font-size: clamp(34px, 9vw, 64px); color: var(--c); text-shadow: 0 0 18px var(--c), 0 4px 0 #0b1020; animation: party-fx-word 1.6s ease-out both; }
.party-fx-spark { grid-area: 1 / 1; width: 8px; height: 8px; background: var(--c); animation: party-fx-spark 1.1s var(--d, 0ms) ease-out both; }
.party-fx-spark.white { background: #fff; width: 6px; height: 6px; }
@keyframes party-fx-glow { 0% { opacity: 0; } 12% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
@keyframes party-fx-word { 0% { transform: scale(0.4); opacity: 0; } 18% { transform: scale(1.12); opacity: 1; } 30% { transform: scale(1); } 75% { opacity: 1; } 100% { transform: translateY(-14px); opacity: 0; } }
@keyframes party-fx-spark { 0% { transform: translate(0, 0) scale(1); opacity: 1; } 100% { transform: translate(var(--x), var(--y)) scale(0.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .party-fx, .party-fx-word { animation-duration: 1.2s; } .party-fx-word { animation-name: party-fx-glow; } }

/* Sleepover, round five (27 Nov 2026, the owner): yellow and blue where the player should look (the clock, what to
   do next), the vote as player icons with a box that explains it, and the chat in a blue box of its own. */
:root { --room-sun: #ffd166; --room-sun-ink: #2a2008; --room-sky: #6cb8ff; --room-sky-ink: #06223f; --room-mint: #5ed6a3; --room-rose: #ff7a8a; }
/* The round's name in the top line, in blue. */
.party .meta span:last-child { color: var(--room-sky); font-weight: 600; }
.party-code { color: var(--room-sun); }
/* The clock: a yellow pill with a pixel dot; red for the last seconds. */
.party-timer { display: inline-flex; align-items: center; gap: 8px; width: fit-content; padding: 3px 12px; color: var(--room-sun);
  background: color-mix(in srgb, var(--room-sun) 12%, var(--panel)); border: 2px solid var(--room-sun); border-radius: 999px; font-size: 16px; }
.party-timer::before { content: ""; width: 8px; height: 8px; background: currentColor; flex: none; }
.party-timer:empty { display: none; }
.party-timer.low { color: var(--room-rose); border-color: var(--room-rose); background: color-mix(in srgb, var(--room-rose) 14%, var(--panel)); }
@media (prefers-reduced-motion: no-preference) {
  .party-timer.low::before { animation: party-blink 1s steps(2, start) infinite; }
  @keyframes party-blink { to { visibility: hidden; } }
}
/* Where answers go, in blue; how many are done, and the wait for the next question, in blue too. */
.card.party .answer input { border-color: color-mix(in srgb, var(--room-sky) 70%, var(--line)); }
.card.party .answer input:focus-visible { outline-color: var(--room-sky); }
.party-done-count, .party-next { color: var(--room-sky); }
/* A box that says what to do (the vote), in blue. */
.party-how { margin: 12px 0; padding: 10px 14px; background: color-mix(in srgb, var(--room-sky) 10%, var(--panel)); border: 2px solid var(--room-sky); border-radius: var(--r); }
.party-how-lead { margin: 0 0 6px; font-weight: 700; color: var(--room-sky); }
.party-how ul { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 2px; }
/* The vote: one icon per player (their initial in their colour) and their name; the chosen one in yellow. */
.party-votes { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.party-vote { aspect-ratio: auto; overflow: visible; justify-items: center; align-content: start; gap: 6px; padding: 14px 8px 10px; text-align: center; }
.party-vote:hover:not(:disabled) { border-color: var(--room-sky); }
.party-vote.on { border-color: var(--room-sun); background: color-mix(in srgb, var(--room-sun) 12%, var(--panel)); box-shadow: 0 0 0 2px var(--room-sun) inset; }
.party-avatar { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; font-family: var(--pixel); font-size: 26px; line-height: 1;
  color: #10142a; background: var(--c, var(--accent)); box-shadow: 0 3px 0 rgb(0 0 0 / 0.35); }
.party-avatar.c0, .party-chat-name.c0 { --c: var(--room-sun); }
.party-avatar.c1, .party-chat-name.c1 { --c: var(--room-sky); }
.party-avatar.c2, .party-chat-name.c2 { --c: var(--room-mint); }
.party-avatar.c3, .party-chat-name.c3 { --c: var(--room-rose); }
.party-avatar.c4, .party-chat-name.c4 { --c: var(--accent); }
.party-avatar.c5, .party-chat-name.c5 { --c: var(--t1); }
.party-vote-name { overflow-wrap: anywhere; font-size: 15px; }
.party-vote-you { margin-top: -4px; color: var(--dim); font-size: 12px; }
.party-vote-mark { display: none; padding: 1px 8px; font-size: 11px; font-weight: 700; color: var(--room-sun-ink); background: var(--room-sun); border-radius: 999px; }
.party-vote.on .party-vote-mark { display: inline-block; }
.party-vote-status { margin: 4px 0 10px; padding: 8px 12px; text-align: center; font-weight: 600; color: var(--room-sun);
  background: color-mix(in srgb, var(--room-sun) 10%, var(--panel)); border: 2px dashed var(--room-sun); border-radius: var(--r); }
.party-vote-status.done { color: var(--room-mint); border: 2px solid var(--room-mint); background: color-mix(in srgb, var(--room-mint) 10%, var(--panel)); }
/* The chat: a blue box with its own header, and speech bubbles (yours on the right, in blue). */
.party-chat { margin: 6px 0 8px; padding: 10px 12px 8px; background: color-mix(in srgb, var(--room-sky) 7%, var(--bg)); border: 2px solid var(--room-sky);
  border-radius: var(--r); box-shadow: 0 3px 0 color-mix(in srgb, var(--room-sky) 45%, var(--bg)); }
.party-chat-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--room-sky); }
.party-chat-head .icon { width: 22px; height: 22px; }
.party-chat-head h2 { margin: 0; font-size: 18px; color: var(--room-sky); }
.party-chat-log { max-height: 220px; padding: 8px; gap: 6px; background: var(--bg); border: 2px solid color-mix(in srgb, var(--room-sky) 35%, var(--line)); }
.party-chat-log li { justify-self: start; max-width: 88%; padding: 5px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px 12px 12px 3px; }
.party-chat-log li.me { justify-self: end; background: color-mix(in srgb, var(--room-sky) 22%, var(--panel)); border-color: color-mix(in srgb, var(--room-sky) 55%, var(--line)); border-radius: 12px 12px 3px 12px; }
.party-chat-log li .party-chat-name { display: block; font-size: 12px; color: var(--c, var(--accent)); }
.party-chat-log li.party-chat-empty { justify-self: stretch; max-width: none; text-align: center; background: transparent; border: 0; }
.party-chat-form input { border-color: color-mix(in srgb, var(--room-sky) 60%, var(--line)); }
.party-chat-form input:focus-visible { outline-color: var(--room-sky); }
.btn.party-chat-send { color: var(--room-sky-ink); background: var(--room-sky); border-color: var(--room-sky); box-shadow: 0 3px 0 #3d7fc0; }
.party-chat .note:empty { display: none; }
.party-chat .note { margin: 6px 0 0; }

/* Public rooms (27 Nov 2026, the owner): the list on the Sleepover page, and the host's private/public switch. */
.party-public { list-style: none; margin: 8px 0 14px; padding: 0; display: grid; gap: 8px; }
.party-public li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 10px 12px;
  background: var(--panel); border: 2px solid color-mix(in srgb, var(--room-sky) 45%, var(--line)); border-radius: var(--r); }
.party-public li .btn { min-height: 40px; }
.party-public-info { display: grid; gap: 2px; min-width: 0; font-size: 14px; }
.party-public-info strong { font-size: 15px; }
.party-public-open { color: var(--room-mint); }
.party-public-busy { color: var(--room-sun); }
.party-public-count { font-family: var(--pixel); color: var(--room-sky); white-space: nowrap; }
@media (max-width: 420px) { .party-public li { grid-template-columns: 1fr auto; } .party-public li .btn { grid-column: 1 / -1; justify-content: center; } }
.party-access { margin-top: 10px; }
.party-access-note { color: var(--dim); }
.party-access-note.on { color: var(--room-mint); }
.party-public-info { text-align: left; }
