/* Pokéquizzle
   Layout: one centered column (max 640px) — a home screen with the two daily modes, a question card,
   a results card. Look (Round 2, Oct 30): pixel fonts like the energy card cutout site — Jersey 25 for
   everything, Silkscreen only for the Pokéquizzle wordmark (Faith's call) — and a red accent. The fonts
   are served with the site (fonts/), so nothing loads from Google. Jersey 25 has no →, ←, ′, ″, ♀, ♂ or ✕, so those few
   come from "Pokequizzle Symbols", a 1 KB cut of Tiny5 that keeps them pixel-style too
   (pokequiz_pull_fonts.py makes it). Multipliers are written 0.25× / 0.5×: no pixel font here has a
   readable ¼ or ½. */
@font-face { font-family: "Jersey 25"; src: url("fonts/jersey-25-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Silkscreen"; src: url("fonts/silkscreen-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Pokequizzle Symbols"; src: url("fonts/pq-symbols.woff2") format("woff2"); font-weight: 400; font-display: swap;
             unicode-range: U+2032-2033, U+2190, U+2192, U+2640, U+2642, U+2715; }
:root {
  --bg: #F6F4F1;
  --surface: #FFFFFF;
  --stage: #F0ECE7;
  --ink: #1B1718;
  --ink-2: #645C5D;
  --line: #E3DDD7;
  --accent: #D7322B;
  --accent-ink: #FFFFFF;
  --accent-soft: #FBE3E0;
  --good: #1B8F50;
  --good-soft: #DCF1E4;
  --bad: #B0302B;
  --bad-soft: #F6E0DE;
  --gold: #E9B020;
  --sil: brightness(0);
  --shadow: 0 1px 2px rgba(27, 23, 24, 0.06), 0 6px 20px rgba(27, 23, 24, 0.06);
  --sans: "Jersey 25", "Pokequizzle Symbols", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --title: "Silkscreen", "Pokequizzle Symbols", "Jersey 25", system-ui, sans-serif;   /* the wordmark only */
  --mono: var(--sans);
  --r: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141112; --surface: #1D191A; --stage: #2A2425; --ink: #F1ECEB; --ink-2: #B3A9A8; --line: #3A3233;
    --accent: #FF5D52; --accent-ink: #1E0A08; --accent-soft: #3D1A18; --good: #3CC67D; --good-soft: #15301F;
    --bad: #E9776F; --bad-soft: #3A1E1D; --gold: #F2C443; --sil: brightness(0) invert(1);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141112; --surface: #1D191A; --stage: #2A2425; --ink: #F1ECEB; --ink-2: #B3A9A8; --line: #3A3233;
  --accent: #FF5D52; --accent-ink: #1E0A08; --accent-soft: #3D1A18; --good: #3CC67D; --good-soft: #15301F;
  --bad: #E9776F; --bad-soft: #3A1E1D; --gold: #F2C443; --sil: brightness(0) invert(1);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 19px/1.35 var(--sans); font-synthesis: none; letter-spacing: 0.01em; }
img { max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.shell {
  max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px;
  min-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  padding-block: 8px 24px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ---- header ---- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 8px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; color: var(--ink); }   /* 44 px: easy to tap */
.mark { width: 30px; height: 30px; flex: none; shape-rendering: crispEdges; }
/* the mark: four answer bubbles, one right (green check) and one wrong (red X), in the game's colors */
.mark .m-ring { fill: var(--ink-2); }
.mark .m-yes { fill: var(--good); }
.mark .m-no { fill: var(--bad); }
.mark .m-ink { fill: var(--surface); }
.wordmark { font-family: var(--title); font-weight: 700; font-size: 22px; letter-spacing: 0; }
.wordmark span { color: var(--accent); }
.bar-actions { display: flex; gap: 4px; }
.ghost { background: none; border: 0; padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 19px; color: var(--ink-2); min-height: 44px; }
.ghost:hover { background: var(--surface); color: var(--ink); }

/* ---- preview strip (only in the offline preview) ---- */
.preview { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; font-size: 17px; color: var(--ink-2); }
.preview strong { color: var(--ink); font-weight: 400; text-transform: uppercase; letter-spacing: 0.06em; }
.preview select, .preview button { font: inherit; font-size: 17px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-height: 36px; cursor: pointer; }

main { flex: 1; outline: none; }
.loading, .empty { color: var(--ink-2); padding: 48px 0; text-align: center; }

/* ---- shared bits ---- */
.eyebrow { margin: 0; font-size: 16px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.dexno { letter-spacing: 0.04em; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 20px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.link { background: none; border: 0; padding: 8px 0; color: var(--accent); font-size: 18px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* difficulty: four bars, filled to the level */
.diff { display: inline-flex; align-items: center; gap: 7px; font-size: 16px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.diff i { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.diff i b { width: 4px; border-radius: 1px; background: var(--line); }
.diff i b:nth-child(1) { height: 5px; } .diff i b:nth-child(2) { height: 7px; } .diff i b:nth-child(3) { height: 9.5px; } .diff i b:nth-child(4) { height: 12px; }
.diff[data-level="1"] i b:nth-child(-n+1), .diff[data-level="2"] i b:nth-child(-n+2),
.diff[data-level="3"] i b:nth-child(-n+3), .diff[data-level="4"] i b { background: var(--accent); }

/* ---- home ---- */
.home { display: flex; flex-direction: column; gap: 20px; padding-block: 16px 8px; }
.home-head { display: flex; flex-direction: column; gap: 4px; }
.home-head .dexno { color: var(--accent); font-size: 19px; text-transform: uppercase; }
.home-head h1 { margin: 0; font-weight: 400; font-size: clamp(38px, 9vw, 52px); line-height: 1; letter-spacing: 0.01em; text-wrap: balance; }
.home-head p { margin: 4px 0 0; color: var(--ink-2); max-width: 52ch; }
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
/* the two mode buttons (Round 2: just the buttons, no cards) */
.mode-btn { min-height: 76px; padding: 14px 20px; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.mode-btn .mode-label { font-size: 27px; line-height: 1; letter-spacing: 0.03em; }
.mode-btn .mode-sub { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; }
.mode-btn.primary .squares span { background: rgba(255, 255, 255, 0.35); }
.mode-btn.primary .squares .y { background: var(--good); } .mode-btn.primary .squares .n { background: var(--bad); }
.mode-btn.is-done .mode-sub { color: var(--ink-2); }
.mode-btn.is-done .mode-sub .mono { color: var(--ink); }
.countdown { margin: 0; color: var(--ink-2); font-size: 18px; }
.countdown .mono { color: var(--ink); }

/* the five squares, used on home, results and in the share text */
.squares { display: inline-flex; gap: 4px; }
.squares span { width: 18px; height: 18px; border-radius: 4px; background: var(--line); }
.squares .y { background: var(--good); }
.squares .n { background: var(--bad); }
.squares.big span { width: 30px; height: 30px; border-radius: 6px; }

/* ---- quiz ---- */
.quiz { display: flex; flex-direction: column; gap: 12px; padding-block: 8px; }
.quiz-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.quiz-top .where { font-size: 18px; color: var(--ink-2); }
.quiz-top .where b { color: var(--ink); font-weight: 400; }
.pips { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.pips li { width: 26px; height: 6px; border-radius: 3px; background: var(--line); }
.pips .y { background: var(--good); } .pips .n { background: var(--bad); } .pips .now { background: var(--ink); }
.back { background: none; border: 0; padding: 10px 4px; cursor: pointer; color: var(--ink-2); font-size: 18px; min-height: 44px; }
.back:hover { color: var(--ink); }

.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow); }
.qmeta { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.qnum { font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.prompt { margin: 0; font-weight: 400; font-size: clamp(26px, 5.8vw, 32px); line-height: 1.12; letter-spacing: 0.01em; text-wrap: balance; outline: none; }
.detail { margin: 0; padding: 14px 16px; background: var(--stage); border-radius: 10px; font-size: 19px; line-height: 1.35; }

.stage { display: flex; justify-content: center; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--stage); border-radius: 12px; padding: 16px; min-height: 120px; }
.stage .im-art { width: min(220px, 60vw); aspect-ratio: 1; object-fit: contain; }
.stage.two .im-art { width: min(150px, 38vw); }
.stage .im-type { width: 200px; height: auto; }
.stage .im-item { width: 90px; height: 90px; image-rendering: pixelated; }
.stage .im-trainer { width: 160px; height: 160px; image-rendering: pixelated; }
.stage .im-badge { width: 96px; height: 96px; object-fit: contain; }
.im-art { transition: filter 450ms ease; }
.is-silhouette { filter: var(--sil); }

.bars { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center; font-size: 18px; }
.bars .lab { color: var(--ink-2); }
.bars .track { display: block; height: 10px; border-radius: 5px; background: var(--stage); overflow: hidden; }
.bars .fill { display: block; height: 100%; border-radius: 5px; background: var(--accent); }
.bars .val { text-align: right; min-width: 3ch; }

/* options */
.options { display: grid; gap: 10px; }
.options.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.opt { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 12px 14px; text-align: left;
       background: var(--surface); border: 2px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color 150ms, background 150ms, opacity 150ms; }
.opt:hover:not(:disabled) { border-color: var(--ink-2); }
.opt:disabled { cursor: default; }
.opt-key { flex: none; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 16px; background: var(--stage); color: var(--ink-2); }
.opt-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.opt-text { font-size: 21px; line-height: 1.15; overflow-wrap: anywhere; }
.opt-note { font-size: 17px; color: var(--ink-2); line-height: 1.2; }
.opt-media { display: flex; gap: 6px; align-items: center; justify-content: center; flex: none; }
.options.move .opt-media .im-type { height: 20px; width: auto; }
/* item and Berry rows (Round 2): the sprite on the left, the name, and after answering its effect */
.options.itemlist .opt-media { width: 44px; }
.options.itemlist .opt-media .im-item { width: 40px; height: 40px; image-rendering: pixelated; }
.options.itemlist .opt-note { font-size: 17px; }

/* tile options: picture on top, name under */
.options.grid .opt { flex-direction: column; justify-content: flex-start; text-align: center; padding: 12px 10px 14px; gap: 8px; }
.options.grid .opt-key { position: absolute; top: 8px; left: 8px; }
.options.grid .opt-body { align-items: center; }
.options.grid .opt-media .im-art { width: min(112px, 30vw); aspect-ratio: 1; object-fit: contain; }
.options.kind-pair .opt-media .im-art { width: min(64px, 17vw); }
.options.grid .opt-media.is-after.many .im-art { width: min(64px, 17vw); }   /* two Megas side by side */
.options.grid .opt-media .im-item { width: 60px; height: 60px; image-rendering: pixelated; }
.options.grid .opt-media .im-badge { width: 64px; height: 64px; object-fit: contain; }
.options.kind-type .opt { padding: 40px 12px 12px; justify-content: center; }
.options.kind-type .opt-media { flex-direction: column; gap: 6px; width: 100%; align-items: center; }
.options.kind-type .opt-media .im-type { width: 100%; max-width: 128px; height: auto; }   /* Round 2: a little smaller */
.options.kind-type .opt-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.options.kind-type .opt-body { gap: 0; }

/* answered */
.opt.is-right { border-color: var(--good); background: var(--good-soft); opacity: 1; }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); opacity: 1; }
.opt.is-dim { opacity: 0.62; }
.opt .flag { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #FFFFFF; }
.opt.is-right .flag { background: var(--good); }
.opt.is-wrong .flag { background: var(--bad); }
.options:not(.grid) .opt .flag { position: static; margin-left: auto; flex: none; }

.actions { display: flex; justify-content: flex-end; }

/* ---- results ---- */
.results { display: flex; flex-direction: column; gap: 16px; padding-block: 8px; }
.rcard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; box-shadow: var(--shadow); }
.score { margin: 0; font-weight: 400; font-size: 80px; line-height: 0.9; letter-spacing: 0; }
.score small { font-size: 36px; color: var(--ink-2); }
.rcard .verdict { margin: 0; font-size: 28px; line-height: 1.1; text-wrap: balance; }
.rcard .verdict b { font-weight: 400; color: var(--accent); }
/* trainer sprites are 80×80; 1.5× keeps the pixels square on phone screens (3 screen pixels each) */
.rank-pic { width: 120px; height: 120px; object-fit: contain; image-rendering: pixelated; margin: 2px 0 -6px; }
.share-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; }
.share-status { font-size: 18px; color: var(--good); min-height: 1.5em; margin: 0; }
.share-text { width: 100%; max-width: 320px; font-family: var(--sans); font-size: 18px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--stage); color: var(--ink); resize: none; }
.recap { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.recap li { display: grid; grid-template-columns: 24px 1fr; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.recap .mk { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #FFFFFF; }
.ico { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.recap .mk.y { background: var(--good); } .recap .mk.n { background: var(--bad); }
.recap .q { margin: 0; font-size: 20px; line-height: 1.2; }
.recap .a { margin: 2px 0 0; font-size: 17px; color: var(--ink-2); }
.next-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ---- footer ---- */
.foot { display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; padding-block: 16px 0; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 16px; }
.foot p { margin: 0; max-width: 60ch; font-size: 16px; line-height: 1.3; }

/* ---- dialogs ---- */
dialog { border: 0; padding: 0; border-radius: 16px; background: var(--surface); color: var(--ink); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
dialog::backdrop { background: rgba(10, 13, 20, 0.55); }
.dlg { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 12px; }
.dlg p { margin: 0; }
.dlg h3 { margin: 6px 0 0; font-weight: 400; font-size: 22px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dlg-head h2 { margin: 0; font-weight: 400; font-size: 30px; }
.close { background: none; border: 0; width: 44px; height: 44px; border-radius: 10px; cursor: pointer; font-size: 18px; color: var(--ink-2); }
.close:hover { background: var(--stage); color: var(--ink); }
.plain { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.hint { font-size: 16px; color: var(--ink-2); }

@media (max-width: 420px) {
  .qcard { padding: 16px 14px; }
  .opt { padding: 10px 12px; }
  .opt-text { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
