/* Lunar New Year Trivia 2027 — Year of the Fire Goat.
   Pixel-inspired festival night, designed for a phone held upright first. No external assets
   except the bundled Silkscreen pixel font (SIL Open Font License, fonts/OFL-Silkscreen.txt). */

@font-face {
  font-family: "Silkscreen";
  src: url("fonts/Silkscreen-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  /* Night sky */
  --night-0: #07061a;
  --night-1: #140f30;
  --night-2: #2a1a52;
  --plum: #5a2a6e;
  --rose: #c4506a;
  --glow: #ff8a4c;
  /* Panels & text */
  --panel: rgba(12, 8, 28, 0.9);
  --panel-solid: #0c081c;
  --cream: #fff1d6;
  --muted: #b9a9d9;
  /* Festival accents */
  --gold: #ffc94a;
  --ember: #ff7a2f;
  --lantern: #e8384f;
  --lantern-deep: #c8213b;
  --lantern-light: #ff6b7d;
  --valid: #6fe39a;
  --invalid: #ff7d8c;
  --suggest-bg: #fff3d6;
  --ink: #2a1210;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", "Liberation Mono", monospace;
  --font-px: "Silkscreen", var(--font-mono);

  /* Stepped "pixel" corners for panels and buttons */
  --px-corners: polygon(0 6px, 3px 6px, 3px 3px, 6px 3px, 6px 0, calc(100% - 6px) 0, calc(100% - 6px) 3px,
    calc(100% - 3px) 3px, calc(100% - 3px) 6px, 100% 6px, 100% calc(100% - 6px), calc(100% - 3px) calc(100% - 6px),
    calc(100% - 3px) calc(100% - 3px), calc(100% - 6px) calc(100% - 3px), calc(100% - 6px) 100%, 6px 100%,
    6px calc(100% - 3px), 3px calc(100% - 3px), 3px calc(100% - 6px), 0 calc(100% - 6px));
  --ease-rise: cubic-bezier(.45, .05, .25, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--night-1);
  color: var(--cream);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid var(--cream); outline-offset: 2px; }

/* ------------------------------------------------------------------ the world */

.world { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--night-0); }
.world-inner {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to top, var(--glow) 0, var(--rose) 70px, var(--plum) 230px, var(--night-2) 900px,
    var(--night-1) 1900px, #0b0920 2700px, var(--night-0) 100%);
  transition: transform 1200ms var(--ease-rise);
  will-change: transform;
}
.world-front { background: none; pointer-events: none; }
.ambient-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.world.is-instant .world-inner, .world.is-instant .you-marker { transition: none; }
.sprite { position: absolute; line-height: 0; }
.sprite svg { display: block; }
.street-glow {
  position: absolute; left: 0; right: 0; bottom: 0; height: 170px;
  background: radial-gradient(ellipse 70% 100% at 50% 100%, rgba(255, 160, 90, 0.5), transparent 75%);
}
.ground { position: absolute; left: 0; right: 0; bottom: 0; height: 18px; background: #0d0818; border-top: 2px solid #3b1630; }
.lantern-strings { position: absolute; left: 0; bottom: 74px; width: 100%; height: 26px; }
.hanging-lantern { transform-origin: 50% 0; animation: lny-sway 3.2s ease-in-out infinite alternate; }
.sky-lantern { animation: lny-bob 5s ease-in-out infinite alternate; }
.kite { transform-origin: 50% 20%; animation: lny-kite 4.4s ease-in-out infinite alternate; }
.cloud { opacity: 0.4; }
.star { position: absolute; background: var(--cream); opacity: 0.75; }
.star.twinkle { animation: lny-twinkle 2.6s steps(2) infinite; }
.frames { overflow: hidden; }
.frames svg { animation: lny-frames var(--dur) steps(var(--n)) infinite; }
@keyframes lny-frames { to { transform: translateX(-100%); } }
/* The dancers parade along the street and turn around at each end. */
.dragon { transform-origin: 50% 100%; animation: lny-parade-right 14s linear infinite; }
.lion { transform-origin: 50% 100%; animation: lny-parade-left 11s linear infinite; }
.lion .frames { animation: lny-hop 0.34s ease-in-out infinite alternate; }
.goat { animation: lny-hop 2.4s steps(2) infinite; }
@keyframes lny-sway { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
@keyframes lny-bob { from { transform: translateY(0); } to { transform: translateY(-14px); } }
@keyframes lny-kite { from { transform: rotate(-7deg) translateX(-4px); } to { transform: rotate(7deg) translateX(4px); } }
@keyframes lny-twinkle { 50% { opacity: 0.15; } }
@keyframes lny-parade-right {
  0% { transform: translateX(0) scaleX(1); }
  47% { transform: translateX(30vw) scaleX(1); }
  50% { transform: translateX(30vw) scaleX(-1); }
  97% { transform: translateX(0) scaleX(-1); }
  100% { transform: translateX(0) scaleX(1); }
}
@keyframes lny-parade-left {
  0% { transform: translateX(0) scaleX(-1); }
  47% { transform: translateX(-26vw) scaleX(-1); }
  50% { transform: translateX(-26vw) scaleX(1); }
  97% { transform: translateX(0) scaleX(1); }
  100% { transform: translateX(0) scaleX(-1); }
}
@keyframes lny-hop { 50% { transform: translateY(-2px); } }

/* The table's lion and its poles (src/scene.js, src/climb.js), and the "YOU" marker on the ruler */
.poles { position: absolute; inset: 0; pointer-events: none; }
.pole { position: absolute; opacity: 0; transition: opacity 500ms ease, height 450ms var(--ease-rise); } /* height: GROW_MS in scene.js */
.world.is-instant .pole { transition: none; }
.pole.is-rising .pole-disc { filter: drop-shadow(0 0 6px var(--gold)) drop-shadow(0 0 2px #fff); }
.pole.is-shown { opacity: 1; }
.pole-shaft { position: absolute; bottom: 0; background-repeat: repeat-y; image-rendering: pixelated; }
.pole-disc { position: absolute; left: 0; top: 0; display: block; }
.table-lion { position: absolute; z-index: 2; pointer-events: none; }
.lion-rig { position: absolute; inset: 0; will-change: transform; }
.lion-rig > *, .lion-drop > * { position: absolute; left: 0; top: 0; }
.lion-drop { position: absolute; inset: 0; }
.lion-rig[data-pose="crouch"] .lion-drop { transform: translateY(var(--drop)); }
.table-lion svg { display: block; }
/* Idle life: the fur ripples (body frames), the head bobs a pixel, the eyes blink now and then.
   Both eye states sit exactly on top of each other inside one bobbing wrapper, so a blink only
   ever swaps the eyes (never a second, offset head). */
.lion-bob { position: absolute; inset: 0; animation: lny-lion-bob 1.3s steps(2) infinite; }
.lion-bob svg { position: absolute; left: 0; top: 0; }
@keyframes lny-lion-bob { 50% { transform: translateY(-2px); } }
.lion-eyes-shut { opacity: 0; animation: lny-lion-blink 5.2s steps(1) infinite; }
@keyframes lny-lion-blink { 0%, 95% { opacity: 0; } 96%, 100% { opacity: 1; } }
.lion-rig.is-blinking .lion-eyes-shut { opacity: 1; animation: none; }
/* Results screen: the greens (cai qing) on the lion's next platform — a rod tilted towards the lion,
   a string, a lettuce that sways, and is yanked up (string shortened by --pull, set by scene.js)
   when the lion lunges. */
.greens { position: absolute; width: 0; height: 0; z-index: 2; opacity: 0; transition: opacity 500ms ease; pointer-events: none; }
.greens.is-shown { opacity: 1; }
.greens-rod { position: absolute; left: 0; bottom: 0; overflow: visible; }
.greens-rod path { fill: none; stroke-linecap: butt; }
.greens-rod-cane { stroke: #e2a93b; stroke-width: 5px; }
.greens-rod-nodes { stroke: #8a5523; stroke-width: 5px; stroke-dasharray: 2px 13px; }
.greens-hang { position: absolute; width: 0; transform-origin: 0 0; animation: lny-greens-sway 2.6s ease-in-out infinite alternate; }
.greens-string { position: absolute; left: -1px; top: 0; width: 2px; background: var(--cream); opacity: 0.85; transform-origin: 50% 0; }
.greens-lettuce { position: absolute; left: -12px; bottom: 0; line-height: 0; }
.greens-lettuce svg { display: block; }
.greens-hang.is-dodging .greens-string { animation: lny-greens-pull-string 1.3s ease-in-out; }
.greens-hang.is-dodging .greens-lettuce { animation: lny-greens-pull 1.3s ease-in-out; }
@keyframes lny-greens-sway { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
@keyframes lny-greens-pull { 0%, 25%, 100% { transform: translateY(0); } 45%, 62% { transform: translateY(-8px); } } /* GREENS_PULL_PX: yanked as the lion arrives */
@keyframes lny-greens-pull-string { 0%, 25%, 100% { transform: scaleY(1); } 45%, 62% { transform: scaleY(var(--pull, 0.9)); } }
/* Moving to or from the side stage (wide screens, see below). */
.world.is-restaging .table-lion, .world.is-restaging .pole { transition: left 600ms var(--ease-rise), bottom 600ms var(--ease-rise), height 600ms var(--ease-rise), opacity 500ms ease; }
.ruler { position: absolute; top: 0; bottom: 0; right: 0; width: 52px; }
.ruler::before { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 2px; background: rgba(255, 241, 214, 0.18); }
.tick { position: absolute; right: 0; width: 6px; height: 2px; transform: translateY(50%); background: rgba(255, 241, 214, 0.3); }
.tick.major { width: 12px; background: rgba(255, 241, 214, 0.6); }
.tick-label {
  position: absolute; right: 15px; transform: translateY(50%);
  font: 8px/1 var(--font-px); color: rgba(255, 241, 214, 0.7); white-space: nowrap;
}
.you-marker {
  position: absolute; right: 0; transform: translateY(50%); z-index: 3;
  display: flex; align-items: center; gap: 4px;
  font: 8px/1 var(--font-px); color: var(--lantern-light); letter-spacing: 0.1em;
  transition: bottom 1200ms var(--ease-rise);
}
.you-marker::after {
  content: ""; width: 22px; height: 2px; background: var(--lantern-light);
  box-shadow: 4px 0 0 0 var(--lantern-light);
}

.scanlines {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, 0.13) 2px 3px);
}
.fx-canvas { position: fixed; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }

/* ------------------------------------------------------------------ app shell */

/* Sized to the *visible* viewport (src/ui.js keeps --app-h/--app-top in step with the on-screen
   keyboard), so the answer dock always sits just above the keyboard. */
.app {
  position: fixed; left: 0; right: 0; z-index: 3;
  top: var(--app-top, 0px); height: var(--app-h, 100dvh);
  max-width: 520px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 12px 0;
}
main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.screen-center { justify-content: center; }
/* Start, question and pause screens: the content group sits just below the middle of the visible
   area. A bottom spacer (a share of the visible height, never less than the lion's platforms
   need) anchors the group from below, so the answer box stays put when a message appears. */
:root { --launch-clear: 168px; } /* room for the lion's platforms below the content */
.screen-start::after, .screen-play::after { content: ""; flex: 0 100 auto; min-height: var(--launch-clear); } /* gives up space first */
.screen-start::after { height: calc(var(--app-h, 100dvh) * 0.2); }
.screen-play::after { height: calc(var(--app-h, 100dvh) * 0.29); }
.loading { text-align: center; font: 12px var(--font-px); letter-spacing: 0.3em; color: var(--gold); }

.corner-left { position: absolute; left: 12px; top: calc(env(safe-area-inset-top) + var(--corner-top, 12px)); z-index: 4; }
.badge {
  display: inline-block; padding: 4px 7px 3px;
  background: var(--gold); color: var(--ink);
  font: 8px/1 var(--font-px); letter-spacing: 0.15em; clip-path: var(--px-corners);
}
body[data-screen="question"] { --corner-top: 70px; }

/* Panels */
.px-panel {
  background: var(--panel); color: var(--cream);
  clip-path: var(--px-corners);
  padding: 18px;
  box-shadow: inset 0 2px 0 rgba(255, 241, 214, 0.07);
}
.panel-title { margin: 0 0 10px; font: 12px/1.3 var(--font-px); letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 18px;
  border: 0; clip-path: var(--px-corners);
  font: 14px/1 var(--font-px); letter-spacing: 0.2em; text-transform: uppercase;
  cursor: pointer; touch-action: manipulation;
  transition: filter 120ms, transform 80ms;
}
.btn:active { transform: translateY(1px); filter: brightness(0.92); }
.btn:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--cream), inset 0 0 0 5px var(--ink); }
.btn-primary {
  color: #fff; background: var(--lantern-deep);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.2);
}
.btn-secondary { color: var(--ink); background: var(--gold); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.2); }
.btn-wide { width: 100%; }

/* Text inputs */
.text-input {
  display: block; width: 100%; min-height: 52px; padding: 0 12px;
  font: 700 1.125rem var(--font-mono); /* ≥16px: no iOS zoom on focus */
  color: var(--cream); background: rgba(7, 6, 26, 0.85);
  border: 2px solid var(--gold); border-radius: 0;
}
.text-input::placeholder { color: #8f80b3; opacity: 1; }
.text-input:focus { outline: none; border-color: var(--cream); box-shadow: 0 0 0 3px rgba(255, 201, 74, 0.45); }
.text-input[aria-invalid="true"] { border-color: var(--invalid); }
.text-input:read-only { opacity: 0.7; }

/* ------------------------------------------------------------------ start */

.screen-start { justify-content: flex-end; gap: 22px; padding-top: 52px; overflow-y: auto; }
.start-hero { text-align: center; padding: 10px 6px 14px; background: radial-gradient(ellipse 85% 80% at 50% 50%, rgba(8, 5, 22, 0.82), rgba(8, 5, 22, 0) 78%); }
.eyebrow { margin: 0; font: 10px/1.4 var(--font-px); letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold); }
.logo { margin: 14px 0 0; font-family: var(--font-px); font-weight: 400; line-height: 1; text-transform: uppercase; }
.logo-top { display: block; font-size: clamp(20px, 6.6vw, 30px); letter-spacing: 0.08em; color: var(--cream); }
.logo-main {
  display: block; margin-top: 8px; font-size: clamp(48px, 17vw, 76px); letter-spacing: 0.04em; color: var(--gold);
  text-shadow: 3px 0 0 rgba(232, 56, 79, 0.9), -3px 0 0 rgba(255, 122, 47, 0.55), 0 0 24px rgba(255, 201, 74, 0.35);
}
.field-label { display: block; margin-bottom: 8px; font: 10px var(--font-px); letter-spacing: 0.25em; text-transform: uppercase; color: var(--gold); }
.field-error { margin: 4px 0 6px; min-height: 1.3em; font-size: 0.9375rem; font-weight: 700; color: var(--invalid); }

/* ------------------------------------------------------------------ how to play */

.screen-rules { justify-content: center; padding: 52px 0 120px; overflow-y: auto; }
.rules-panel { text-align: center; }
.rules-title {
  margin: 8px 0 18px; font: 22px/1.1 var(--font-px); font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold);
  text-shadow: 2px 0 0 rgba(232, 56, 79, 0.9), -2px 0 0 rgba(255, 122, 47, 0.5);
}
.how-to { display: grid; gap: 14px; margin: 0 0 20px; padding: 0; list-style: none; text-align: left; }
.how-to li { display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: start; }
.how-num {
  display: grid; place-items: center; height: 44px;
  font: 14px/1 var(--font-px); color: var(--gold);
  background: rgba(255, 201, 74, 0.12); clip-path: var(--px-corners);
}
.how-to p { margin: 0; font-size: 0.9375rem; line-height: 1.45; color: var(--muted); }
.how-to strong { display: block; margin-bottom: 2px; font-size: 1rem; color: var(--cream); }
.btn-link {
  display: block; min-height: 44px; margin: 10px auto 0; padding: 0 12px;
  border: 0; background: none; cursor: pointer;
  font: 10px/1 var(--font-px); letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted);
}
.btn-link:hover { color: var(--cream); }

/* ------------------------------------------------------------------ question */

.hud { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding-top: 8px; }
.hud-chip { min-width: 80px; padding: 7px 10px 8px; background: var(--panel); clip-path: var(--px-corners); }
.hud-chip-right { text-align: right; min-width: 64px; }
.hud-label { display: block; font: 8px/1 var(--font-px); letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.hud-value { display: block; margin-top: 5px; font: 16px/1 var(--font-px); font-variant-numeric: tabular-nums; color: var(--gold); white-space: nowrap; }
.hud-valid { color: var(--lantern-light); }
.hud-progress { text-align: center; }
.pips { display: flex; justify-content: center; gap: 3px; margin: 0; padding: 0; list-style: none; }
.pips li { width: 12px; height: 12px; background: var(--panel-solid); box-shadow: inset 0 0 0 1px rgba(255, 241, 214, 0.3); }
.pips li.is-valid { background: var(--gold); box-shadow: none; }
.pips li.is-miss { background: #4a3a63; box-shadow: none; }
.pips li.is-current { background: var(--lantern); box-shadow: 0 0 0 2px rgba(232, 56, 79, 0.35); }
.progress { margin: 6px 0 0; font: 8px/1 var(--font-px); letter-spacing: 0.18em; text-transform: uppercase; color: var(--cream); text-shadow: 0 1px 2px #000; }

.stage { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 50px 0 14px; overflow-y: auto; }
.question-panel { padding: 18px 18px 16px; }
.panel-kicker { margin: 0 0 10px; font: 9px/1 var(--font-px); letter-spacing: 0.32em; text-transform: uppercase; color: var(--lantern-light); }
.question-text { margin: 0; font: 700 clamp(1.4rem, 6.4vw, 1.9rem)/1.25 var(--font-mono); letter-spacing: -0.01em; color: var(--cream); }
.question-text:focus { outline: none; }
.panel-hint { margin: 14px 0 0; font: 8px/1.4 var(--font-px); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }

/* Answer pause screen */
.pause {
  text-align: center; padding: 20px 8px 10px;
  background: radial-gradient(ellipse 80% 70% at 50% 55%, rgba(8, 5, 22, 0.82), rgba(8, 5, 22, 0) 75%);
}
.pause-kicker { margin: 0; font: 10px/1 var(--font-px); letter-spacing: 0.3em; text-transform: uppercase; color: var(--valid); }
.pause.is-fizzle .pause-kicker { color: var(--invalid); }
.pause-title {
  margin: 10px 0 14px; font: 34px/1.1 var(--font-px); font-weight: 400; letter-spacing: 0.08em; color: var(--gold);
  text-shadow: 3px 0 0 rgba(232, 56, 79, 0.9), -2px 0 0 rgba(255, 122, 47, 0.55), 0 0 22px rgba(255, 201, 74, 0.5);
}
.pause.is-fizzle .pause-title { color: var(--muted); text-shadow: 2px 0 0 rgba(90, 42, 110, 0.9); }
.pause-answer { margin: 0 0 4px; font: 700 1.25rem/1.3 var(--font-mono); color: var(--cream); overflow-wrap: anywhere; }
.pause-answer:empty { display: none; }
.pause-detail { margin: 0; font-size: 1rem; color: var(--cream); overflow-wrap: anywhere; }
.pause-detail strong { color: var(--gold); }
.pause-points { margin: 14px 0 6px; font: 14px/1.2 var(--font-px); letter-spacing: 0.1em; color: var(--gold); }
.pause.is-fizzle .pause-points { color: var(--muted); }
.pause-flavour { margin: 0; font: 0.875rem/1.4 var(--font-mono); letter-spacing: 0.06em; color: var(--muted); }
.is-glow { animation: lny-glow 1200ms ease-out both; }
@keyframes lny-glow { 0%, 70% { filter: drop-shadow(0 0 14px rgba(255, 201, 74, 0.9)); } 100% { filter: none; } }

/* Dock: answer box directly under the question (pinned to the bottom when the keyboard is open) */
.dock { padding-top: 0; }
.answer-row { display: flex; align-items: stretch; gap: 8px; }
.answer-input { flex: 1; min-width: 0; }
.btn-launch { flex: 0 0 auto; padding: 0 14px; }
.timer { position: relative; flex: 0 0 52px; height: 52px; }
.timer-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-track { fill: var(--panel-solid); stroke: rgba(255, 241, 214, 0.18); stroke-width: 4; }
.timer-fill {
  fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: butt;
  stroke-dasharray: 119.38; stroke-dashoffset: 0; transition: stroke-dashoffset 250ms linear, stroke 200ms;
}
.timer-num { position: absolute; inset: 0; display: grid; place-items: center; font: 16px/1 var(--font-px); color: var(--cream); font-variant-numeric: tabular-nums; }
.timer.is-low .timer-fill { stroke: var(--lantern-light); }
.timer.is-low .timer-num { color: #ffd2cb; }
.timer.is-stopped { opacity: 0.55; }
.time-bar { height: 4px; margin-top: 7px; background: rgba(255, 241, 214, 0.12); }
.time-bar span { display: block; height: 100%; width: 100%; background: var(--gold); transform-origin: 0 50%; transition: transform 250ms linear; }
.time-bar.is-low span { background: var(--lantern-light); }
.dock.is-paused .answer-row, .dock.is-paused .time-bar { display: none; }

.miss-msg { margin: 0 0 8px; font-size: 1rem; font-weight: 700; color: var(--invalid); overflow-wrap: anywhere; text-shadow: 0 1px 2px #000; }
.suggestion { margin: 0 0 8px; font-size: 1.0625rem; font-weight: 600; line-height: 2.6; color: var(--cream); }
.suggestion-btn {
  min-height: 40px; margin: 0 2px 0 4px; padding: 4px 14px;
  border: 0; clip-path: var(--px-corners);
  background: var(--suggest-bg); color: var(--ink);
  font: 700 1.0625rem var(--font-mono); line-height: 1.3; cursor: pointer; overflow-wrap: anywhere;
}
.suggestion-btn:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--lantern-deep); }

/* §7.4 — slight shake (4–6px, ~350ms) and its reduced-motion fallback */
.is-shaking { animation: lny-shake 360ms cubic-bezier(.36, .07, .19, .97) both; }
@keyframes lny-shake {
  15% { transform: translateX(-5px); } 35% { transform: translateX(5px); } 55% { transform: translateX(-4px); }
  75% { transform: translateX(3px); } 90% { transform: translateX(-1px); } 100% { transform: translateX(0); }
}
.is-flash-invalid { animation: lny-flash-invalid 700ms ease-out both; }
@keyframes lny-flash-invalid { 0%, 60% { box-shadow: inset 0 0 0 3px var(--invalid); } 100% { box-shadow: inset 0 0 0 0 transparent; } }

/* ------------------------------------------------------------------ results */

/* The flight log scrolls above the lion's band, so the lion stays in view on its final platform. */
.screen-results {
  padding: 52px 0 16px; overflow-y: auto; gap: 14px; margin-bottom: calc(var(--launch-clear) + 84px); /* phones: the lion (58 px up) and the greens' rod tip (~245 px) */
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
}
.results-hero { text-align: center; padding: 6px 8px 12px; background: radial-gradient(ellipse 80% 80% at 50% 50%, rgba(8, 5, 22, 0.7), transparent 75%); }
.results-points {
  margin: 10px 0 4px; font: clamp(40px, 13vw, 56px)/1 var(--font-px); color: var(--gold);
  text-shadow: 3px 0 0 rgba(232, 56, 79, 0.9), -2px 0 0 rgba(255, 122, 47, 0.55), 0 0 24px rgba(255, 201, 74, 0.4);
}
.results-score { margin: 0; font: 11px/1.4 var(--font-px); letter-spacing: 0.2em; text-transform: uppercase; color: var(--cream); }
.results-tiers { margin: 6px 0 0; font: 10px/1.4 var(--font-px); letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); }
.results-tiers:empty { display: none; }
.results-headline { margin: 12px auto 0; max-width: 24ch; font: 700 1.25rem/1.3 var(--font-mono); color: var(--cream); }
.results-headline:focus { outline: none; }
.breakdown { list-style: none; margin: 0 0 6px; padding: 0; counter-reset: q; }
.breakdown li { counter-increment: q; display: grid; grid-template-columns: 26px 1fr; gap: 2px 10px; padding: 11px 0; border-top: 1px solid rgba(255, 241, 214, 0.12); }
.breakdown li:first-child { border-top: 0; padding-top: 2px; }
.breakdown .mark { grid-row: span 3; width: 22px; height: 22px; display: grid; place-items: center; font: 700 0.875rem var(--font-mono); clip-path: var(--px-corners); }
.breakdown .is-valid .mark { background: var(--gold); color: var(--ink); }
.breakdown .is-invalid .mark { background: #4a3a63; color: var(--cream); }
.breakdown .q { margin: 0; font-weight: 700; font-size: 0.9375rem; }
.breakdown .q::before { content: counter(q) ". "; color: var(--muted); }
.breakdown .a, .breakdown .m { margin: 0; font-size: 0.875rem; color: var(--muted); overflow-wrap: anywhere; }
.breakdown .m strong { color: var(--cream); }
.breakdown .is-valid .m strong { color: var(--gold); }
.error-details { margin-top: 12px; font-size: 0.9375rem; }
.error-details ul { padding-left: 1.2em; color: var(--invalid); }

/* ------------------------------------------------------------------ small screens & keyboard */

@media (max-width: 359px) {
  .pips li { width: 10px; height: 10px; gap: 2px; }
  .hud-chip { min-width: 70px; padding: 6px 8px 7px; }
  .hud-value { font-size: 14px; }
  .btn-launch { padding: 0 10px; letter-spacing: 0.1em; }
}
/* Short visible area (usually the on-screen keyboard is open): keep the question readable. */
.app.is-compact .panel-hint { display: none; }
.app.is-compact .corner-left { display: none; }
.app.is-compact .stage { padding-top: 8px; justify-content: flex-start; }
.app.is-compact .screen-start::after, .app.is-compact .screen-play::after { display: none; }
.app.is-compact .screen-start { justify-content: center; }
.app.is-compact .dock {
  margin: 0 -12px; padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(7, 6, 26, 0.96) 0, rgba(7, 6, 26, 0.88) 75%, rgba(7, 6, 26, 0));
}
.app.is-compact .question-panel { padding: 12px 14px; }
.app.is-compact .panel-kicker { margin-bottom: 6px; }
.app.is-compact .question-text { font-size: 1.2rem; }
.app.is-compact .screen-start, .app.is-compact .screen-rules { padding: 12px 0; }
.app.is-compact .screen-results { margin-bottom: 0; }
.app.is-compact .logo-main { font-size: 40px; }

@media (min-width: 720px) {
  .app { padding-top: 12px; }
}
/* Wide screens: once the game starts (question, answer pause, results), the content column moves
   left and the lion and its poles take a stage of their own on the right. Keep in step with
   SIDE_STAGE_* in src/scene.js. */
:root { --stage-shift: 180px; }
@media (min-width: 1000px) {
  .app { transition: transform 600ms var(--ease-rise); }
  body[data-screen="question"] .app, body[data-screen="results"] .app { transform: translateX(calc(-1 * var(--stage-shift))); }
  body[data-screen="results"] .screen-results { margin-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .world-inner, .you-marker, .pole, .timer-fill, .time-bar span, .btn { transition: none !important; }
  .hanging-lantern, .sky-lantern, .kite, .star, .dragon, .lion, .goat, .frames, .frames svg { animation: none !important; }
  .lion-bob, .lion-eyes-shut, .greens-hang, .greens-string, .greens-lettuce { animation: none !important; }
  .app { transition: none !important; }
  .is-shaking { animation: lny-flash-invalid 700ms ease-out both; }
}
