/* ==========================================================================
   Real or Fake? — design system
   Dark indigo "game-show" palette · Bricolage Grotesque + DM Sans
   Motion scale from transitions.dev (tokens below), interaction details from
   make-interfaces-feel-better (concentric radii, layered shadows, 0.96 press,
   tabular numbers, balanced text, 44px hit areas, no `transition: all`).
   ========================================================================== */

:root {
  color-scheme: dark;

  /* colour */
  --bg: #12102a;
  --bg-2: #1a1740;
  --surface: #221e4f;
  --surface-2: #2c2766;
  --line: rgba(255, 255, 255, .09);
  --text: #f5f2ff;
  --dim: #aca6da;
  --dim-2: #8c86c2;
  --gold: #ffd166;
  --gold-ink: #261a00;
  --violet: #7c5cff;
  --real: #3ddc97;
  --fake: #ff5d73;

  /* type */
  --font-display: "Bricolage Grotesque", "Noto Sans Devanagari", system-ui, sans-serif;
  --font-body: "DM Sans", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* shape — outer radius = inner radius + padding */
  --r-card: 26px;      /* 12 icon chip + 14 padding */
  --r-opt: 20px;
  --r-tile: 16px;
  --r-pill: 999px;

  /* elevation: layered transparent shadows instead of hard borders */
  --ring: 0 0 0 1px rgba(255, 255, 255, .08);
  --edge: inset 0 1px 0 rgba(255, 255, 255, .07);
  --shadow-card: var(--ring), var(--edge), 0 14px 30px -16px rgba(4, 2, 26, .75), 0 2px 6px rgba(4, 2, 26, .32);
  --shadow-hover: 0 0 0 1px rgba(255, 209, 102, .55), var(--edge), 0 18px 34px -16px rgba(4, 2, 26, .8), 0 2px 8px rgba(4, 2, 26, .35);

  /* motion tokens (transitions.dev) */
  --duration-stagger: 40ms;
  --duration-micro: 80ms;
  --duration-quick: 150ms;
  --duration-fast: 250ms;
  --duration-medium: 350ms;
  --duration-slow: 400ms;
  --duration-very-slow: 500ms;
  --ease-smooth-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: ease-out;
  --ease-in-out: ease-in-out;
  --distance-micro: 4px;
  --distance-small: 6px;
  --distance-base: 8px;
  --distance-medium: 12px;
  --scale-large: 0.96;
  --blur-small: 2px;
  --blur-medium: 3px;

  /* transitions.dev: error shake */
  --shake-distance: 6px;
  --shake-overshoot: 4px;
  --shake-dur-a: 80ms;
  --shake-dur-b: 60ms;
  --shake-ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* transitions.dev: toggle */
  --toggle-dur: 350ms;
  --toggle-travel: 22px;
  --toggle-ov1: 2px;
  --toggle-ov2: 0px;
  --toggle-ease: cubic-bezier(0.34, 1.35, 0.64, 1);

  /* transitions.dev: tabs sliding */
  --tabs-dur: 250ms;
  --tabs-ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* transitions.dev: modal */
  --modal-open-dur: 250ms;
  --modal-scale: 0.96;
  --modal-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(900px 520px at 50% -8%, rgba(124, 92, 255, .34), transparent 70%),
    radial-gradient(700px 420px at 105% 105%, rgba(255, 209, 102, .08), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.5 var(--font-body);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
/* faint dot grid, fades toward the bottom */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.4px);
  background-size: 26px 26px;
  mask-image: linear-gradient(to bottom, #000, transparent 55%);
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 55%);
}
.app, #sidebar { position: relative; z-index: 1; }
#sidebar { position: fixed; }

::selection { background: rgba(124, 92, 255, .55); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
button, select, input { font: inherit; color: inherit; }
button { -webkit-appearance: none; appearance: none; }

.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.app { max-width: 720px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 18px 32px; }
.screen[hidden], [hidden] { display: none !important; }

h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; }
h2 { margin: 14px 0 12px; font-size: 28px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
h3 { margin: 26px 0 10px; font-family: var(--font-body); font-size: 12px; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: .12em; }
p { text-wrap: pretty; }
b, .big, .hud b, .pill b, .clock, #clock, td, .catrow span { font-variant-numeric: tabular-nums; }

/* ---------- header ---------- */
.top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.logo {
  background: none; border: 0; cursor: pointer; padding: 8px 4px; color: var(--text); text-decoration: none;
  font: 800 28px/1 var(--font-display); letter-spacing: -.03em;
}
.logo span { color: var(--dim); font-weight: 600; font-size: .66em; letter-spacing: 0; margin: 0 .12em; }
.logo b { display: inline-block; color: var(--gold); transform: rotate(9deg) translateY(-1px); margin-left: .04em; text-shadow: 0 0 22px rgba(255, 209, 102, .45); }

/* ---------- buttons ---------- */
.ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px;
  background: rgba(255, 255, 255, .04); color: var(--dim); border: 0; border-radius: var(--r-pill);
  padding: 8px 16px; font-size: 14px; font-weight: 500; cursor: pointer; box-shadow: var(--ring);
  transition-property: transform, background-color, color, box-shadow, opacity;
  transition-duration: var(--duration-quick); transition-timing-function: var(--ease-out);
}
.ghost .ic { width: 18px; height: 18px; }
.ghost:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, .08); }
.ghost:active:not(:disabled) { transform: scale(var(--scale-large)); }
.ghost:disabled { opacity: .35; cursor: default; }
.ghost.icon { width: 44px; min-height: 44px; padding: 0; }
.ghost.icon .ic { width: 22px; height: 22px; }
.back { margin-top: 22px; }
.danger { color: var(--fake); box-shadow: 0 0 0 1px rgba(255, 93, 115, .45); }
.danger:hover:not(:disabled) { color: #fff; background: rgba(255, 93, 115, .22); }

.primary {
  display: block; width: 100%; min-height: 52px; margin-top: 14px; padding: 14px; border: 0; cursor: pointer;
  border-radius: var(--r-opt); color: var(--gold-ink); font: 800 17px/1.2 var(--font-body); letter-spacing: -.01em;
  background: linear-gradient(180deg, #ffe08c, var(--gold));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 0 0 1px rgba(255, 209, 102, .5), 0 14px 28px -12px rgba(255, 209, 102, .45);
  transition-property: transform, box-shadow, filter;
  transition-duration: var(--duration-quick); transition-timing-function: var(--ease-out);
}
.primary:hover { filter: brightness(1.05); }
.primary:active { transform: scale(var(--scale-large)); }

/* ---------- home ---------- */
.hero { display: grid; justify-items: center; gap: 4px; padding: 10px 0 6px; text-align: center; }
.hero-art { position: relative; width: min(100%, 340px); height: 118px; margin-bottom: 8px; }
.hc {
  position: absolute; left: 50%; bottom: 0; width: 82px; height: 104px; margin-left: -41px; border-radius: 18px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); box-shadow: var(--shadow-card);
  transform: translateX(var(--x)) rotate(var(--rot)); transform-origin: 50% 110%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 11px;
  animation: float 5s var(--ease-in-out) infinite; animation-delay: var(--d);
}
.hc::before { content: ''; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.hc::after { content: ''; width: 46px; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .13); box-shadow: 0 12px 0 -1px rgba(255, 255, 255, .07); margin-bottom: 12px; }
.c1 { --x: -132px; --rot: -10deg; --d: 0s; }
.c2 { --x: -44px; --rot: -3.5deg; --d: -1.2s; }
.c3 { --x: 44px; --rot: 3.5deg; --d: -2.4s; }
.c4 { --x: 132px; --rot: 10deg; --d: -3.6s; }
.hc.fake { box-shadow: 0 0 0 1.5px rgba(255, 93, 115, .8), var(--edge), 0 0 34px -4px rgba(255, 93, 115, .55); }
.hc.fake::before { content: '?'; display: grid; place-items: center; width: 38px; height: 38px; background: rgba(255, 93, 115, .18); color: var(--fake); font: 800 22px/1 var(--font-display); }
@keyframes float { 50% { translate: 0 -5px; } }

.lead { margin: 6px 0 22px; color: var(--dim); font-size: 19px; line-height: 1.4; text-wrap: balance; }
@media (min-width: 520px) { .lead { font-size: 21px; } }

.modes { display: grid; gap: 10px; }
.mode {
  position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  width: 100%; text-align: left; padding: 14px; border: 0; border-radius: var(--r-card); cursor: pointer; color: var(--text);
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .02)), var(--surface);
  box-shadow: var(--shadow-card);
  transition-property: transform, box-shadow;
  transition-duration: var(--duration-fast); transition-timing-function: var(--ease-smooth-out);
}
.mode:hover { box-shadow: var(--shadow-hover); }
.mode:active { transform: scale(.98); }
.mi {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; color: var(--gold);
  background: rgba(255, 209, 102, .1); box-shadow: inset 0 0 0 1px rgba(255, 209, 102, .18);
}
.mi .ic { width: 24px; height: 24px; }
.mt { display: grid; gap: 1px; min-width: 0; }
.mode strong { font: 700 18px/1.25 var(--font-display); letter-spacing: -.01em; color: var(--text); }
.mode .mt > span, .mode > span:not(.mi):not(.mt) { color: var(--dim); font-size: 14px; line-height: 1.35; text-wrap: pretty; }
.mode .chev { color: var(--dim-2); transition: transform var(--duration-fast) var(--ease-smooth-out), color var(--duration-fast) var(--ease-smooth-out); }
.mode:hover .chev { color: var(--gold); transform: translateX(3px); }
.mode em { font-style: normal; font-size: 13px; font-weight: 700; color: var(--gold); margin-top: 4px; }
.mode em:empty { display: none; }

.mode.featured {
  padding: 18px 16px; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(420px 200px at 100% 0%, rgba(255, 209, 102, .28), transparent 60%),
    linear-gradient(135deg, #5a43ee 0%, #8a3fd8 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .16), inset 0 1px 0 rgba(255, 255, 255, .25), 0 22px 40px -18px rgba(124, 92, 255, .75);
}
.mode.featured::after {
  content: ''; position: absolute; inset: 0; z-index: -1; opacity: .5; pointer-events: none;
  background: repeating-linear-gradient(115deg, transparent 0 14px, rgba(255, 255, 255, .035) 14px 15px);
}
.mode.featured:hover { box-shadow: 0 0 0 1px rgba(255, 209, 102, .7), inset 0 1px 0 rgba(255, 255, 255, .25), 0 24px 44px -18px rgba(124, 92, 255, .85); }
.mode.featured .mi { background: rgba(20, 10, 60, .35); color: var(--gold); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); width: 54px; height: 54px; }
.mode.featured strong { font-size: 22px; }
.mode.featured .mt > span { color: #e9e1ff; }
.mode.featured .chev { color: rgba(255, 255, 255, .7); }

/* category picker (buttons are built by game.js: strong + span) */
.mode:not(:has(> .mi)) { grid-template-columns: 1fr; gap: 3px; padding: 14px 16px; }

@media (min-width: 640px) {
  .modes { grid-template-columns: 1fr 1fr; }
  .mode.featured { grid-column: 1 / -1; }
  .modes .mode:last-child:nth-child(even) { grid-column: 1 / -1; }
  .mode:not(.featured):has(> .mi) { grid-template-columns: auto 1fr; align-items: start; }
  .mode:not(.featured) .chev { display: none; }
}

.navrow { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.fbtn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: fit-content; margin: 16px auto 0; padding: 10px 18px; min-height: 44px;
  border-radius: var(--r-pill); color: var(--gold); text-decoration: none; font-size: 14px; font-weight: 700;
  background: rgba(255, 209, 102, .08); box-shadow: 0 0 0 1px rgba(255, 209, 102, .4);
  transition-property: transform, background-color, color; transition-duration: var(--duration-quick); transition-timing-function: var(--ease-out);
}
.fbtn .ic { width: 18px; height: 18px; }
.fbtn:hover { background: var(--gold); color: var(--gold-ink); }
.fbtn:active { transform: scale(var(--scale-large)); }
.fbtn[hidden] { display: none; }
.fbfoot { color: var(--gold) !important; font-weight: 700; }

.about { margin-top: 30px; padding: 18px 18px 20px; border-radius: var(--r-opt); background: rgba(255, 255, 255, .03); box-shadow: var(--ring); color: var(--dim); font-size: 14px; }
.about h1 { margin: 0 0 8px; font-size: 17px; font-weight: 800; letter-spacing: -.01em; color: var(--text); }
.about p { margin: 0; }

/* ---------- play ---------- */
.playtop { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 6px 0 12px; }
.chip {
  display: inline-flex; align-items: center; padding: 5px 14px; border-radius: var(--r-pill); font-size: 13px; font-weight: 700; letter-spacing: .02em;
  color: var(--text); background: rgba(124, 92, 255, .22); box-shadow: inset 0 0 0 1px rgba(160, 140, 255, .35);
}
#clock { min-width: 64px; text-align: right; color: var(--dim); font-size: 14px; font-weight: 700; }
.hud { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.hud div { padding: 8px 6px 9px; border-radius: var(--r-tile); text-align: center; background: var(--bg-2); box-shadow: var(--ring), var(--edge); }
.hud small { display: block; color: var(--dim-2); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.hud b { display: block; font: 800 22px/1.2 var(--font-display); }
#hLives { color: var(--fake); letter-spacing: 3px; font-size: 18px; line-height: 1.45; }
.hud b.pop { animation: pop var(--duration-fast) var(--ease-smooth-out); }
@keyframes pop { 0% { transform: scale(1.18); color: var(--gold); } 100% { transform: scale(1); } }

.bar { height: 10px; border-radius: var(--r-pill); background: var(--bg-2); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .4), var(--ring); overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--real), var(--gold)); box-shadow: 0 0 14px rgba(61, 220, 151, .5); transition: width .1s linear; }
.bar i.low { background: var(--fake); box-shadow: 0 0 14px rgba(255, 93, 115, .6); }

.prompt { margin: 20px 0 16px; text-align: center; font-size: clamp(28px, 6.4vw, 38px); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.prompt u { text-decoration: none; padding: 0 .1em; border-radius: 6px; background: linear-gradient(transparent 58%, rgba(255, 93, 115, .5) 58% 92%, transparent 92%); }

.options { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.options li { min-width: 0; display: grid; }
@media (min-width: 640px) { .options { grid-template-columns: 1fr 1fr; gap: 12px; } }
.opt {
  position: relative; display: grid; align-content: start; gap: 3px; width: 100%; text-align: left; padding: 16px 16px 16px; color: var(--text);
  border: 0; border-radius: var(--r-opt); cursor: pointer;
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .02)), var(--surface);
  box-shadow: var(--shadow-card);
  transition-property: transform, box-shadow, background-color, opacity;
  transition-duration: var(--duration-fast); transition-timing-function: var(--ease-smooth-out);
  animation: opt-in 200ms var(--ease-out) backwards;
}
.options li:nth-child(2) .opt { animation-delay: var(--duration-stagger); }
.options li:nth-child(3) .opt { animation-delay: calc(var(--duration-stagger) * 2); }
.options li:nth-child(4) .opt { animation-delay: calc(var(--duration-stagger) * 3); }
@keyframes opt-in { from { opacity: 0; transform: translateY(var(--distance-micro)); } }
/* Speed Round advances instantly after each tap: no entrance choreography there */
#play:has(#skipBtn:not([hidden])) .opt { animation: none; }
.opt:hover:not(:disabled) { box-shadow: var(--shadow-hover); }
.opt:active:not(:disabled) { transform: scale(.98); }
.opt .t { font: 700 18px/1.25 var(--font-display); letter-spacing: -.01em; padding-right: 34px; text-wrap: balance; }
.opt .d { color: var(--dim); font-size: 14px; line-height: 1.4; text-wrap: pretty; }
.opt .k {
  position: absolute; top: 14px; right: 14px; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 7px;
  font-size: 12px; font-weight: 700; color: var(--dim); background: rgba(255, 255, 255, .06); box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .08), var(--ring);
}
@media (hover: none) { .opt .k { display: none; } .opt .t { padding-right: 0; } }
.opt .n { margin-top: 10px; padding-top: 10px; font-size: 14px; line-height: 1.45; color: var(--text); border-top: 1px dashed rgba(255, 255, 255, .2); animation: note-in var(--duration-medium) var(--ease-smooth-out) backwards; animation-delay: var(--duration-micro); }
@keyframes note-in { from { opacity: 0; transform: translateY(var(--distance-micro)); } }
.opt .n a { color: var(--gold); text-underline-offset: 3px; }
.opt.out { opacity: .28; pointer-events: none; }
.opt.out .t { text-decoration: line-through; text-decoration-thickness: 2px; }
.opt:disabled { cursor: default; }
.opt.is-real { background: linear-gradient(180deg, rgba(61, 220, 151, .16), rgba(61, 220, 151, .07)), var(--surface); box-shadow: 0 0 0 1.5px rgba(61, 220, 151, .75), var(--edge), 0 14px 30px -18px rgba(61, 220, 151, .5); }
.opt.is-fake { background: linear-gradient(180deg, rgba(255, 93, 115, .22), rgba(255, 93, 115, .09)), var(--surface); box-shadow: 0 0 0 1.5px rgba(255, 93, 115, .9), var(--edge), 0 16px 36px -14px rgba(255, 93, 115, .7); }
.opt.picked { outline: 2px solid rgba(255, 255, 255, .55); outline-offset: 3px; }
.opt .tag {
  position: absolute; top: 12px; right: 12px; padding: 3px 9px; border-radius: var(--r-pill); font-size: 11px; font-weight: 800; letter-spacing: .1em;
  animation: stamp var(--duration-fast) var(--ease-smooth-out) backwards;
}
.is-real .tag { background: var(--real); color: #04301b; }
.is-fake .tag { background: var(--fake); color: #3a0510; }
@keyframes stamp { from { opacity: 0; transform: scale(1.5) rotate(-8deg); } }

/* transitions.dev error shake: per-segment easing, 280ms */
.options.shake { animation: shake calc(var(--shake-dur-a) * 2 + var(--shake-dur-b) * 2) linear; }
@keyframes shake {
  0%     { transform: translateX(0);                                 animation-timing-function: var(--shake-ease); }
  28.57% { transform: translateX(var(--shake-distance));             animation-timing-function: var(--shake-ease); }
  57.14% { transform: translateX(calc(var(--shake-distance) * -1));  animation-timing-function: var(--shake-ease); }
  78.57% { transform: translateX(var(--shake-overshoot));            animation-timing-function: var(--shake-ease); }
  100%   { transform: translateX(0); }
}

.hints { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; justify-content: center; }
.skip { display: flex; margin: 12px auto 0; }
.clue { margin-top: 10px; padding: 10px 14px; border-left: 4px solid var(--gold); background: var(--bg-2); border-radius: 8px; color: var(--gold); font-size: 14px; }

.verdict {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin: 14px 0; padding: 13px 16px; border-radius: var(--r-opt);
  font: 700 17px/1.3 var(--font-display); text-align: center; text-wrap: balance;
  animation: verdict-in var(--duration-medium) var(--ease-smooth-out) backwards;
}
@keyframes verdict-in { from { opacity: 0; transform: translateY(var(--distance-base)); filter: blur(var(--blur-small)); } }
.verdict.ok { background: rgba(61, 220, 151, .14); color: var(--real); box-shadow: inset 0 0 0 1px rgba(61, 220, 151, .35); }
.verdict.bad { background: rgba(255, 93, 115, .14); color: var(--fake); box-shadow: inset 0 0 0 1px rgba(255, 93, 115, .38); }
.verdict.ok::before, .verdict.bad::before { content: ''; flex: none; width: 22px; height: 22px; background: currentColor; -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat; }
.verdict.ok { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }
.verdict.bad { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E"); }
/* Next (above the options) stays in view while scrolling through the explanations */
#next { position: sticky; top: 8px; z-index: 5; animation: verdict-in var(--duration-medium) var(--ease-smooth-out) backwards; animation-delay: var(--duration-micro); }

.prev { margin-top: 18px; padding: 12px 14px; border-radius: var(--r-tile); background: var(--bg-2); box-shadow: var(--ring); font-size: 14px; }
.prev b { display: block; margin-bottom: 4px; }
.prev.ok b { color: var(--real); } .prev.bad b { color: var(--fake); } .prev.skipped b { color: var(--dim); }
.prev p { margin: 2px 0; color: var(--dim); }
.prev p strong { color: var(--text); }

/* ---------- end + stats ---------- */
#end, #stats { text-align: center; }
.big {
  margin: 4px 0 14px; font: 800 clamp(76px, 22vw, 120px)/1 var(--font-display); letter-spacing: -.05em; color: var(--gold);
  text-shadow: 0 0 60px rgba(255, 209, 102, .35), 0 6px 0 rgba(255, 209, 102, .08);
}
.pills { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.pill { flex: 1 1 108px; max-width: 200px; padding: 10px 14px 11px; border-radius: var(--r-tile); background: var(--bg-2); box-shadow: var(--ring), var(--edge); }
.pill small { display: block; color: var(--dim-2); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.pill b { display: block; margin-top: 2px; font: 800 21px/1.2 var(--font-display); text-wrap: balance; }
.tiny { color: var(--dim-2); font-size: 12px; margin: 0; }
.grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 8px 0 14px; font-size: 26px; }
.sq { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px; background: transparent; font-size: 26px; line-height: 1; cursor: pointer;
  transition-property: transform, background-color; transition-duration: var(--duration-quick); transition-timing-function: var(--ease-out); }
.sq:hover:not(:disabled) { background: rgba(255, 255, 255, .08); transform: scale(1.12); }
.sq:active:not(:disabled) { transform: scale(var(--scale-large)); }
.sq:disabled { cursor: default; }
.note { color: var(--dim); }
.actions { display: grid; gap: 8px; margin-top: 14px; }
.actions .ghost { min-height: 48px; }
.actions .fbtn { margin-top: 6px; }
.toast { color: var(--real); font-weight: 700; animation: verdict-in var(--duration-medium) var(--ease-smooth-out) backwards; }
.catrow { display: grid; grid-template-columns: 112px 1fr 56px; gap: 12px; align-items: center; margin: 12px 0; text-align: left; font-size: 14px; }
.meter { height: 10px; border-radius: var(--r-pill); background: var(--bg-2); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .4), var(--ring); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--real), #8ff0c3); transform-origin: left; animation: fill var(--duration-very-slow) var(--ease-smooth-out) backwards; animation-delay: var(--duration-fast); }
@keyframes fill { from { transform: scaleX(0); } }
.catrow span:last-child { text-align: right; color: var(--dim); }

/* ---------- settings ---------- */
.setgroup { border-radius: var(--r-opt); background: rgba(255, 255, 255, .03); box-shadow: var(--ring); padding: 2px 16px; }
.setrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; min-height: 64px; }
.setrow + .setrow { border-top: 1px solid var(--line); }
.setrow label small { display: block; color: var(--dim-2); font-size: 12px; }
.setctl { display: inline-flex; align-items: center; gap: 12px; flex: none; }
.setrow select {
  -webkit-appearance: none; appearance: none; min-height: 40px; padding: 8px 36px 8px 14px; border: 0; border-radius: 12px; cursor: pointer; color: var(--text); background-color: var(--surface); box-shadow: var(--ring);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aca6da' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px;
}
/* transitions.dev toggle: double-bounce thumb, track colour on its own clock */
.switch { -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 52px; height: 30px; margin: 0; border-radius: var(--r-pill); cursor: pointer; background: rgba(255, 255, 255, .14); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); transition: background-color var(--duration-fast) var(--ease-out); }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .35); translate: 0 0; }
.switch:checked { background: var(--real); }
.switch:checked::after { translate: var(--toggle-travel) 0; }
.switch.is-init:checked::after { animation: toggle-on var(--toggle-dur) var(--toggle-ease) both; }
.switch.is-init:not(:checked)::after { animation: toggle-off var(--toggle-dur) var(--toggle-ease) both; }
@keyframes toggle-on { 0% { translate: 0 0; } 55% { translate: calc(var(--toggle-travel) + var(--toggle-ov1)) 0; } 80% { translate: calc(var(--toggle-travel) - var(--toggle-ov2)) 0; } 100% { translate: var(--toggle-travel) 0; } }
@keyframes toggle-off { 0% { translate: var(--toggle-travel) 0; } 55% { translate: calc(0px - var(--toggle-ov1)) 0; } 80% { translate: var(--toggle-ov2) 0; } 100% { translate: 0 0; } }
/* volume slider: gold fill follows --fill (kept in sync by ui.js) */
.slider { -webkit-appearance: none; appearance: none; flex: 1 1 140px; max-width: 220px; height: 44px; margin: 0; background: transparent; cursor: pointer; --fill: 100%; }
.slider::-webkit-slider-runnable-track { height: 8px; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--gold) var(--fill), rgba(255, 255, 255, .14) var(--fill)); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); }
.slider::-moz-range-track { height: 8px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .14); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); }
.slider::-moz-range-progress { height: 8px; border-radius: var(--r-pill); background: var(--gold); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -8px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .4), 0 0 0 1px rgba(0, 0, 0, .06); transition: transform var(--duration-quick) var(--ease-out); }
.slider::-moz-range-thumb { width: 24px; height: 24px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.slider:active::-webkit-slider-thumb { transform: scale(var(--scale-large)); }
.slider:focus-visible { outline: none; }
.slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--gold); }
.slider:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--gold); }

.testmsg { margin: 10px 2px 0; color: var(--gold); font-size: 13px; }

/* ---------- leaderboard / sidebar ---------- */
#sidebar {
  top: 0; left: 0; bottom: 0; width: min(360px, 90vw); padding: max(16px, env(safe-area-inset-top)) 18px 20px; overflow-y: auto; z-index: 8;
  background: rgba(24, 21, 60, .86); -webkit-backdrop-filter: blur(22px) saturate(1.3); backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: 1px 0 0 rgba(255, 255, 255, .08), 30px 0 60px -20px rgba(2, 0, 20, .7);
  transform: translateX(-100%); transition: transform var(--duration-medium) var(--ease-smooth-out);
}
body.sb-open #sidebar { transform: none; }
.sbhead { display: flex; justify-content: space-between; align-items: center; }
.sbhead h2 { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 22px; }
.sbhead h2 .ic { color: var(--gold); width: 22px; height: 22px; }
.sbnav { display: flex; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.backdrop { position: fixed; inset: 0; z-index: 7; background: rgba(6, 4, 22, .6); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade var(--duration-fast) var(--ease-out); }
@keyframes fade { from { opacity: 0; } }
@media (min-width: 1000px) {
  body { transition: padding-left var(--duration-medium) var(--ease-smooth-out); }
  body.sb-open { padding-left: 360px; }
  .backdrop { display: none !important; }
}

/* transitions.dev tabs sliding: JS (ui.js) writes the pill's position, CSS owns the tween */
.tabs { position: relative; display: flex; gap: 3px; margin: 14px 0; padding: 4px; border-radius: var(--r-pill); background: rgba(0, 0, 0, .28); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); }
.tabs-pill { position: absolute; top: 4px; left: 0; height: calc(100% - 8px); border-radius: var(--r-pill); z-index: 0; background: var(--gold); box-shadow: 0 6px 16px -6px rgba(255, 209, 102, .6), inset 0 1px 0 rgba(255, 255, 255, .55); transition: transform var(--tabs-dur) var(--tabs-ease); }
.tabs-pill.no-anim { transition: none; }
.tab { position: relative; z-index: 1; flex: 1; min-height: 40px; padding: 6px 10px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--dim); font-size: 14px; font-weight: 700; cursor: pointer; transition: color var(--tabs-dur) var(--tabs-ease), transform var(--duration-quick) var(--ease-out); }
.tab:hover:not(.active) { color: var(--text); }
.tab:active { transform: scale(var(--scale-large)); }
.tab.active { color: var(--gold-ink); }
/* no-JS fallback: if the pill never mounts the active tab still reads */
.tabs:not(:has(.tabs-pill)) .tab.active { background: var(--gold); }

table.lb { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
.lb th { color: var(--dim-2); font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; text-align: right; padding: 6px 4px; }
.lb td { text-align: right; padding: 12px 4px; border-top: 1px solid var(--line); }
.lb th:first-child, .lb td:first-child { text-align: left; width: 28px; color: var(--dim-2); font-weight: 700; }
.lb tr:nth-child(2) td:first-child { color: var(--gold); }
.lb td.score { color: var(--gold); font: 800 17px/1 var(--font-display); }
.lb tr.new td { background: rgba(255, 209, 102, .12); }
.empty { color: var(--dim); text-align: center; padding: 28px 0; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; overflow-y: auto; background: rgba(6, 4, 22, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade var(--duration-fast) var(--ease-out); }
.dialog {
  width: min(520px, 100%); max-height: 90dvh; overflow-y: auto; margin: auto; padding: 22px; border-radius: 28px; text-align: left;
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .015)), var(--bg-2);
  box-shadow: var(--ring), var(--edge), 0 40px 80px -24px rgba(0, 0, 0, .8);
  animation: modal-in var(--modal-open-dur) var(--modal-ease) backwards;
}
@keyframes modal-in { from { opacity: 0; transform: scale(var(--modal-scale)); } }
.dialog h3 { margin: 0 0 12px; font: 800 22px/1.2 var(--font-display); letter-spacing: -.02em; text-transform: none; color: var(--text); }
.dialog p { margin: 0 0 6px; color: var(--dim); }
.mbtns { display: flex; gap: 8px; margin-top: 18px; justify-content: flex-end; flex-wrap: wrap; }
.mbtns .primary { width: auto; margin: 0; min-height: 44px; padding: 10px 22px; font-size: 15px; border-radius: var(--r-pill); }
.mbtns .ghost { min-height: 44px; padding: 10px 18px; }
.dialog .opt { cursor: default; animation: none; }
.shareimg { display: block; width: 100%; border-radius: 18px; box-shadow: var(--ring); outline: 1px solid oklch(1 0 0 / .1); outline-offset: -1px; }
.sharetext { margin: 12px 0 0; font-size: 13px; white-space: pre-wrap; word-break: break-word; }

.busy { position: fixed; left: 50%; bottom: 28px; z-index: 20; transform: translateX(-50%); padding: 11px 22px; border-radius: var(--r-pill); font-weight: 700; color: var(--gold); background: var(--surface); box-shadow: 0 0 0 1px rgba(255, 209, 102, .5), 0 16px 30px -10px rgba(0, 0, 0, .7); }

/* ---------- footer ---------- */
footer.foot { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); text-align: center; color: var(--dim-2); font-size: 13px; }
.foot nav { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 12px; }
.foot a { color: var(--dim); text-underline-offset: 3px; transition: color var(--duration-quick) var(--ease-out); }
.foot a:hover { color: var(--gold); }
.foot p { margin: 8px 0 0; font-size: 12px; opacity: .85; }

/* ---------- legal pages ---------- */
.doc { line-height: 1.65; }
.doc h1 { margin: 18px 0 10px; font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
.doc h2 { margin: 28px 0 6px; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.doc p, .doc li { color: var(--dim); }
.doc strong { color: var(--text); }
.doc a { color: var(--gold); text-underline-offset: 3px; }
.doc a.logo { color: var(--text); }

/* ---------- screen transitions (transitions.dev page slide + texts reveal) ---------- */
.screen:not([hidden]) { animation: screen-in var(--duration-slow) var(--ease-smooth-out) backwards; }
@keyframes screen-in { from { opacity: 0; transform: translateY(var(--distance-base)); filter: blur(var(--blur-medium)); } }
#home:not([hidden]) { animation: none; }
#home:not([hidden]) > * { animation: rise var(--duration-very-slow) var(--ease-smooth-out) backwards; }
#home > .modes { animation-delay: var(--duration-micro); }
#home > .navrow { animation-delay: calc(var(--duration-micro) + var(--duration-stagger) * 2); }
#home > .fbtn { animation-delay: calc(var(--duration-micro) + var(--duration-stagger) * 3); }
#home > .about { animation-delay: calc(var(--duration-micro) + var(--duration-stagger) * 4); }
@keyframes rise { from { opacity: 0; transform: translateY(var(--distance-medium)); filter: blur(var(--blur-medium)); } }

@media (max-width: 380px) {
  .app { padding-inline: 14px; }
  .logo { font-size: 25px; }
  .opt .t { font-size: 16px; }
  .c1 { --x: -112px; } .c4 { --x: 112px; } .c2 { --x: -38px; } .c3 { --x: 38px; }
  .catrow { grid-template-columns: 96px 1fr 48px; }
}

/* in-game "Reduce animations" switch and the OS-level preference */
body.reduce *, body.reduce *::before, body.reduce *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- wide screens (studio embed runs this full-bleed) ---------- */
@media (min-width: 1000px) {
  .app { max-width: 1240px; padding-inline: 48px; }
  .screen:not(#home) { max-width: 980px; margin-inline: auto; }
  #home { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); column-gap: 64px; align-items: center; align-content: center; min-height: calc(100dvh - 130px); }
  #home .hero { grid-column: 1; grid-row: 1; justify-items: start; text-align: left; padding-top: 0; }
  #home .hero-art { width: 340px; margin-left: 0; }
  #home .lead { font-size: 26px; margin-bottom: 8px; }
  #home .modes { grid-column: 2; grid-row: 1 / span 3; }
  #home .navrow { grid-column: 1; grid-row: 2; justify-content: flex-start; }
  #home .fbtn { grid-column: 1; grid-row: 3; margin-left: 0; }
  #home .about { grid-column: 1 / -1; grid-row: 4; margin-top: 56px; }
  .modes .mode.featured { padding: 20px; }
}
@media (min-width: 1500px) {
  .app { max-width: 1400px; }
}
