/* Layout (v2, visual): every event is shown as a picture first (card thumbnails, live previews),
   words are kept to labels. The one bold place is the stage where numbers flash: light in light
   mode, near-black in dark mode, like a championship monitor. */
:root {
  --paper: #EEF1F3;
  --paper-2: #E5EAEE;
  --grid: #D9E0E5;
  --surface: #FBFCFC;
  --ink: #121A21;
  --muted: #56626C;
  --line: #D2D9DE;
  --accent: #23439B;
  --accent-ink: #FFFFFF;
  --accent-soft: #DFE5F5;
  --band: #E4E9F5;
  --good: #16703E;
  --good-soft: #DCEFE3;
  --bad: #B0342B;
  --bad-soft: #F6E0DD;
  --gold: #B57D00;
  --flame: #F0661A;
  --flame-2: #FFC23D;
  --flame-soft: #FDE8D7;
  --bead: #2A1F19;
  --shadow: 0 1px 0 rgb(18 26 33 / .04), 0 12px 32px -20px rgb(18 26 33 / .4);

  /* the flash stage follows the theme: light here, near-black in the dark blocks below */
  --stage: #F8FAFB;
  --stage-raise: #FFFFFF;
  --stage-ink: #0F1720;
  --stage-muted: #5B6773;
  --stage-line: #D6DDE3;
  --stage-minus: #C2382E;
  --stage-good: #17703F;
  --stage-accent: #23439B;
  --stage-flame-soft: #FDE8D7;
  --stage-scheme: light;
  /* graph paper, as on the World Cup cards; --grid changes with the theme */
  --grid-pattern: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);

  /* medal colours (same in both themes) */
  --m1: #D4A017;
  --m2: #A3ADB8;
  --m3: #C47A3D;
  --medal-ink: #1A1408;

  --f-display: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  --f-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-num: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 12px;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0D1216;
    --paper-2: #10171C;
    --grid: #182129;
    --surface: #141B21;
    --ink: #E5EAEE;
    --muted: #93A0AB;
    --line: #26313A;
    --accent: #93A9FF;
    --accent-ink: #0B1020;
    --accent-soft: #1A2342;
    --band: #111A2B;
    --good: #62C98C;
    --good-soft: #10261A;
    --bad: #F2857A;
    --bad-soft: #30171A;
    --gold: #F2C14E;
    --flame-soft: #2E1C10;
    --bead: #D8B99A;
    --shadow: 0 1px 0 rgb(0 0 0 / .3), 0 12px 32px -20px rgb(0 0 0 / .9);
    --stage: #05070A;
    --stage-raise: #0E1318;
    --stage-ink: #FFF0C7;
    --stage-muted: #8B96A1;
    --stage-line: #222B34;
    --stage-minus: #FF8E7E;
    --stage-good: #6FD69A;
    --stage-accent: #93A9FF;
    --stage-flame-soft: #2B1A0C;
    --stage-scheme: dark;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0D1216;
  --paper-2: #10171C;
  --grid: #182129;
  --surface: #141B21;
  --ink: #E5EAEE;
  --muted: #93A0AB;
  --line: #26313A;
  --accent: #93A9FF;
  --accent-ink: #0B1020;
  --accent-soft: #1A2342;
  --band: #111A2B;
  --good: #62C98C;
  --good-soft: #10261A;
  --bad: #F2857A;
  --bad-soft: #30171A;
  --gold: #F2C14E;
  --flame-soft: #2E1C10;
  --bead: #D8B99A;
  --shadow: 0 1px 0 rgb(0 0 0 / .3), 0 12px 32px -20px rgb(0 0 0 / .9);
  --stage: #05070A;
  --stage-raise: #0E1318;
  --stage-ink: #FFF0C7;
  --stage-muted: #8B96A1;
  --stage-line: #222B34;
  --stage-minus: #FF8E7E;
  --stage-good: #6FD69A;
  --stage-accent: #93A9FF;
  --stage-flame-soft: #2B1A0C;
  --stage-scheme: dark;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.5 var(--f-body); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--paper); }
html.is-playing body { overflow: hidden; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; line-height: 1.15; text-wrap: balance; margin: 0; }
p { margin: 0; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.wrap { max-width: 1140px; margin-inline: auto; padding-left: var(--gutter); padding-right: var(--gutter-r); }
.mono { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 1.15em; height: 1.15em; flex: none; }
.native { font-family: var(--f-display); font-weight: 700; color: var(--muted); font-size: .5em; white-space: nowrap; }
kbd { font-family: var(--f-num); font-size: .72em; padding: .1em .45em; border-radius: 4px; border: 1px solid currentColor; opacity: .65; line-height: 1.3; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
input[type="range"] { accent-color: var(--accent); width: 100%; min-width: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 44px; padding: .55em 1.1em; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 700 16px/1.2 var(--f-body); text-decoration: none; cursor: pointer;
  transition: border-color .15s, background-color .15s, transform .1s, filter .15s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-big { min-height: 54px; padding-inline: 1.5em; font-size: 18px; }
.btn-small { min-height: 36px; padding: .35em .8em; font-size: 14px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 900 19px/1 var(--f-display); }
.brand svg { width: 34px; height: 26px; color: var(--bead); flex: none; }
.top-right { display: flex; align-items: center; gap: 8px; }
.icon-btn { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); cursor: pointer; }
.icon-btn:hover, .lang-pick:hover { border-color: var(--accent); }
.icon-btn .ico { width: 20px; height: 20px; }
.icon-btn[aria-pressed="false"] { color: var(--muted); }
.lang-pick { position: relative; display: inline-flex; align-items: center; gap: 5px; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: 700; font-size: 14px; cursor: pointer; }
.lang-pick .ico { width: 18px; height: 18px; color: var(--accent); }
.lang-pick select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.lang-pick:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- streaks ---------- */
.flame { width: 1em; height: 1em; overflow: visible; }
.flame path:first-child { fill: var(--flame); stroke: none; }
.flame .flame-core { fill: var(--flame-2); stroke: none; }
.streak-pill { position: relative; display: inline-flex; align-items: center; gap: 5px; height: 42px; padding: 0 14px 0 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font: 700 17px var(--f-num); }
.streak-flame { position: relative; display: grid; }
.streak-flame .flame { width: 22px; height: 22px; transform-origin: 50% 90%; animation: flicker 2.6s ease-in-out infinite; }
.streak-pill.is-cold .flame path:first-child { fill: var(--line); }
.streak-pill.is-cold .flame .flame-core { fill: var(--muted); }
.streak-pill.is-cold .flame { animation: none; }
.streak-pill.is-cold { color: var(--muted); }
.streak-pill.is-up .flame { animation: flame-pop .8s cubic-bezier(.2, 1.6, .4, 1); }
.streak-pill.is-up { border-color: var(--flame); background: var(--flame-soft); }
.roll { display: inline-grid; overflow: hidden; height: 1.25em; line-height: 1.25em; }
.roll > span { grid-area: 1 / 1; }
.roll-out { animation: roll-out .5s ease-in forwards; }
.roll-in { animation: roll-in .5s ease-out; }
@keyframes roll-out { to { transform: translateY(-110%); opacity: 0; } }
@keyframes roll-in { from { transform: translateY(110%); opacity: 0; } }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.05, 1.1) rotate(2deg); } }
@keyframes flame-pop { 0% { transform: scale(.5); } 55% { transform: scale(1.5) rotate(-6deg); } 100% { transform: scale(1); } }

.burst { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; z-index: 5; }
.burst i { position: absolute; width: 7px; height: 7px; margin: -3.5px; border-radius: 50%; background: var(--flame-2); opacity: 0; animation: spark .8s var(--delay, 0ms) cubic-bezier(.15, .7, .3, 1) forwards; }
.burst i:nth-child(3n) { background: var(--flame); }
.burst i:nth-child(4n) { width: 5px; height: 5px; background: var(--accent); }
@keyframes spark { 0% { opacity: 1; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.3); } }

.streak-badge { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 6px 16px 6px 10px; border-radius: 999px; background: var(--flame-soft); color: var(--ink); font-weight: 700; white-space: nowrap; }
.streak-badge .flame { width: 28px; height: 28px; transform-origin: 50% 90%; animation: flicker 1.6s ease-in-out infinite; }
.streak-badge b { font-size: 26px; line-height: 1; }
.streak-badge.is-bump { animation: bump .5s cubic-bezier(.2, 1.6, .4, 1); }
.streak-badge.is-milestone { box-shadow: 0 0 0 2px var(--flame), 0 0 28px -4px var(--flame); }
.streak-badge.is-broken { background: transparent; color: var(--muted); border: 1px dashed var(--line); font-weight: 500; }
.streak-badge.is-broken .flame { animation: none; }
.streak-badge.is-broken .flame path { fill: var(--muted); }
.streak-badge.is-broken b { font-size: inherit; }
.streak-badge.is-static { margin-top: 8px; }
.is-shake { animation: shake .45s; }
@keyframes bump { 0% { transform: scale(.6); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.run-streak { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px 4px 8px; border-radius: 999px; background: var(--flame-soft); font: 700 22px var(--f-num); }
.run-streak .flame { width: 26px; height: 26px; animation: flicker 1.6s ease-in-out infinite; }
.run-streak.is-bump { animation: bump .45s cubic-bezier(.2, 1.6, .4, 1); }
.run-streak.is-broken { opacity: .5; }

.day-pop {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 18px); left: 50%; z-index: 80;
  display: flex; align-items: center; gap: 12px; padding: 12px 24px 12px 16px; border-radius: 999px;
  background: var(--ink); color: var(--paper); font-weight: 700; font-size: 17px; box-shadow: var(--shadow), 0 0 0 2px var(--flame);
  transform: translateX(-50%); animation: pop-in .55s cubic-bezier(.2, 1.6, .4, 1); transition: opacity .4s, transform .4s;
}
.day-pop .flame-wrap { position: relative; display: grid; }
.day-pop .flame { width: 36px; height: 36px; transform-origin: 50% 90%; animation: flicker 1.1s ease-in-out infinite; }
.day-pop b { font-size: 24px; }
.day-pop.is-out { opacity: 0; transform: translate(-50%, -14px); }
@keyframes pop-in { from { opacity: 0; transform: translate(-50%, -24px) scale(.8); } }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 44px; align-items: center; padding-block: 44px 36px; }
.hero-copy { display: grid; gap: 20px; justify-items: start; min-width: 0; }
.hero h1 { font-size: clamp(36px, 5.2vw, 60px); font-weight: 900; letter-spacing: -.01em; }
.hero-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.hero-tags li { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 700; font-size: 15px; }
.hero-tags .ico { color: var(--accent); }
.hero-stage { display: grid; gap: 12px; min-width: 0; }
.hero-screen.is-grid { background-color: var(--paper-2) !important; background-image: var(--grid-pattern); background-size: 24px 24px; }
.hero-screen { position: relative; aspect-ratio: 16 / 9; max-width: 100%; background: var(--stage); border-radius: 18px; display: grid; place-items: center; overflow: hidden; box-shadow: var(--shadow), inset 0 0 0 1px var(--stage-line); }
.hero-num { color: var(--stage-ink); font-weight: 700; font-size: clamp(80px, 14vw, 180px); line-height: 1; transition: opacity .16s ease; }
.hero-num.is-out { opacity: 0; }
.pick-pulse { position: absolute; left: 22px; bottom: 22px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--stage-ink); opacity: 0; }
.pick-pulse.go { animation: pulse .6s ease-out; }
@keyframes pulse { 0% { opacity: .9; transform: scale(.6); } 100% { opacity: 0; transform: scale(2.6); } }
.dots { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); transition: background .15s; }
.dots i.on { background: var(--accent); }
.hero-dots { justify-content: center; }

.group { padding-block: 28px; }
.group h2 { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 24px; margin-bottom: 16px; }
.group h2 > .ico { width: 26px; height: 26px; color: var(--accent); }
.group-worldcup { background: var(--band); border-block: 1px solid var(--line); }
.badge { display: inline-flex; align-items: center; gap: 5px; width: fit-content; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font: 700 12px var(--f-body); letter-spacing: .06em; text-transform: uppercase; }
.badge .ico { width: 14px; height: 14px; }
.group-worldcup .badge { background: var(--surface); }
.cards { display: grid; gap: 14px; }
.cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cards-1 { grid-template-columns: minmax(0, 1fr); }
.card { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.cards-1 .card { flex-direction: row; }
.cards-1 .thumb { width: min(40%, 320px); flex: none; }
.cards-1 .card-text { align-content: center; gap: 6px; padding-inline: 22px; }
.cards-1 .card-name { font-size: 22px; }
.card-chips { display: none; }
.cards-1 .card-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.card-chips > span { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.card-chips .ico { color: var(--accent); }
.thumb { position: relative; aspect-ratio: 16 / 10; display: block; background: var(--paper-2); }
.th-screen, .th-paper { position: absolute; inset: 0; display: grid; place-items: center; }
.th-screen { background: var(--stage); color: var(--stage-ink); }
.th-screen .mono { font-size: clamp(34px, 4.4vw, 52px); font-weight: 700; }
.th-paper { background-color: var(--paper-2); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 16px 16px; color: var(--ink); }
.th-wave { display: flex; align-items: center; gap: 5px; height: 46%; }
.th-wave i { width: 6px; border-radius: 3px; background: var(--stage-ink); opacity: .85; }
.th-wave i:nth-child(1), .th-wave i:nth-child(7) { height: 30%; }
.th-wave i:nth-child(2), .th-wave i:nth-child(6) { height: 60%; }
.th-wave i:nth-child(3), .th-wave i:nth-child(5) { height: 85%; }
.th-wave i:nth-child(4) { height: 100%; }
.mini-col { display: grid; justify-items: end; font-size: 13px; font-weight: 700; line-height: 1.35; }
.mini-col .neg { color: var(--bad); }
.mini-col b { width: 100%; border-top: 2px solid var(--accent); margin-top: 3px; }
.mini-root, .mini-expr { font-size: clamp(24px, 3vw, 32px); font-weight: 700; }
.mini-flash { font-size: clamp(34px, 4.4vw, 52px); font-weight: 700; color: var(--ink); }
/* square-root sign: the tick and the bar over the number are one line */
.rad { position: relative; display: inline-block; padding-left: .62em; line-height: 1.2; }
.rad-sign { position: absolute; left: 0; top: 0; width: .64em; height: 100%; overflow: visible; }
.rad-sign path { fill: none; stroke: var(--accent); stroke-width: .07em; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.rad-body { display: inline-block; padding: .1em .08em 0 .1em; border-top: .07em solid var(--accent); }
.mini-cal { display: grid; gap: 10px; justify-items: center; font-weight: 700; font-size: 18px; }
.mini-days { display: flex; gap: 4px; }
.mini-days i { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; border: 1px solid var(--line); background: var(--surface); font: 700 11px var(--f-body); }
.mini-days i.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.th-best { position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px 3px 6px; border-radius: 999px; background: var(--surface); color: var(--ink); font: 700 13px var(--f-num); box-shadow: var(--shadow); }
.th-best .ico { color: var(--gold); width: 15px; height: 15px; }
.card-text { display: grid; gap: 2px; padding: 12px 14px 14px; }
.card-name { font: 700 18px/1.2 var(--f-display); }
.card-tag { font-size: 12px; color: var(--muted); }
.foot { padding-block: 26px 48px; color: var(--muted); font-size: 13px; }

/* ---------- page text (v8): short explanation under each page, About, Privacy, footer ---------- */
.about { padding-block: 8px 36px; }
.about h2, .prose h2 { font-size: 19px; margin: 26px 0 8px; }
.about p, .prose p, .noscript p { max-width: 68ch; margin: 0 0 10px; color: var(--muted); }
.prose { padding-block: 16px 40px; }
.prose h1 { font-size: clamp(30px, 4.4vw, 44px); font-weight: 900; margin: 18px 0 12px; }
.prose p { color: var(--ink); }
.prose .btn { margin-top: 8px; }
.prose-date { font-size: 14px; color: var(--muted) !important; }
.noscript { padding-block: 24px; }
.site-foot { border-top: 1px solid var(--line); }
.site-foot .wrap { display: grid; gap: 10px; padding-block: 22px 40px; color: var(--muted); font-size: 13px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.foot-links a { color: var(--ink); font-weight: 700; text-decoration: none; }
.foot-links a:hover { color: var(--accent); text-decoration: underline; }
.foot-links span { margin-left: auto; }

/* ---------- World Cup mode ---------- */
.wc-banner { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 20px 28px; align-items: center; margin-bottom: 14px; padding: 20px 24px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: inherit; text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.wc-banner:hover { border-color: var(--accent); transform: translateY(-2px); }
.wc-banner-text { display: grid; gap: 4px; justify-items: start; }
.wc-banner-icon .ico { width: 36px; height: 36px; color: var(--m1); }
.wc-banner-name { font: 900 26px/1.15 var(--f-display); }
.wc-banner-tag { color: var(--muted); }
.th-best.is-inline { position: static; margin-top: 6px; box-shadow: none; border: 1px solid var(--line); }
.wc-stations { position: relative; list-style: none; margin: 0; padding: 0; width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wc-stations::before { content: ""; position: absolute; left: 12.5%; right: 12.5%; top: 22px; height: 2px; background: var(--line); }
.wc-stations li { position: relative; display: grid; justify-items: center; align-content: start; gap: 4px; text-align: center; font-size: 14px; min-width: 0; }
.wc-stations b { font-size: 14px; }
.wc-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); color: var(--muted); transition: background .3s, border-color .3s, transform .3s, box-shadow .3s; }
.wc-dot .ico { width: 20px; height: 20px; }
.wc-stations li.is-now .wc-dot { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 6px var(--accent-soft); transform: scale(1.08); }
.wc-stations li.is-done .wc-dot { border-color: var(--good); background: var(--good); color: var(--surface); }
.wc-sub { font-size: 13px; color: var(--muted); }
.wc-stations li.is-done .wc-sub { color: var(--ink); font-weight: 700; }
.wc-gold { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); }
.wc-gold .ico { width: 13px; height: 13px; color: var(--m1); }
.pv-wc { padding: 24px 18px; }
.wc-between, .wc-final { display: grid; gap: 30px; align-content: start; width: min(100%, 760px); margin-inline: auto; padding-top: 4vh; }
.wc-next { display: grid; justify-items: center; gap: 14px; text-align: center; }
.wc-round { font-size: 13px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.wc-title { display: inline-flex; align-items: center; gap: 12px; font-size: clamp(30px, 5vw, 44px); font-weight: 900; }
.wc-title .ico { color: var(--accent); }
.wc-final { gap: 22px; padding-top: 0; }
.wc-rows { display: grid; gap: 10px; }
.wc-row { display: grid; gap: 10px; padding: 14px 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.wc-row-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.wc-row-name { display: inline-flex; align-items: center; gap: 8px; font-size: 17px; }
.wc-row-name .ico { color: var(--accent); }
.wc-medal { position: relative; padding: 2px 10px; border-radius: 999px; color: var(--medal-ink); font-weight: 700; font-size: 13px; }
.wc-medal.m1, .wc-tick.m1, .wc-legend .m1 { background: var(--m1); }
.wc-medal.m2, .wc-tick.m2, .wc-legend .m2 { background: var(--m2); }
.wc-medal.m3, .wc-tick.m3, .wc-legend .m3 { background: var(--m3); }
.wc-pts { margin-left: auto; font-size: 22px; font-weight: 700; }
.wc-pts small { font-size: 13px; font-weight: 500; color: var(--muted); }
.wc-bar { position: relative; height: 12px; margin-top: 22px; border-radius: 6px; background: var(--paper-2); }
.wc-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--accent); }
.wc-tick { position: absolute; top: -5px; bottom: -5px; width: 4px; margin-left: -2px; border-radius: 2px; box-shadow: 0 0 0 2px var(--surface); }
.wc-you { position: absolute; bottom: calc(100% + 6px); transform: translateX(-50%); font-size: 14px; font-weight: 700; white-space: nowrap; }
.wc-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.wc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wc-legend i { width: 10px; height: 10px; border-radius: 50%; }

/* ---------- event page ---------- */
.ev { padding-block: 16px 48px; }
.back { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; text-decoration: none; }
.back:hover { text-decoration: underline; }
.ev-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin: 12px 0 18px; }
.ev-title { display: grid; gap: 6px; }
.ev-top { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 24px; align-items: start; }
.pv { display: grid; gap: 10px; min-width: 0; overflow-anchor: none; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 76px); }
.ev-side { display: grid; gap: 12px; min-width: 0; }
.ctl-main { display: grid; gap: 10px; }
.ctl-main .ctl { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); gap: 8px; }
.num-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.num-unit { color: var(--muted); font-size: 14px; }
.num-slider { margin-top: 2px; }
.advanced { margin-top: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.advanced > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 16px 20px; font: 700 18px var(--f-display); cursor: pointer; }
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary .ico { color: var(--accent); }
.advanced > summary::after { content: "+"; margin-left: auto; font: 400 26px/1 var(--f-body); color: var(--muted); }
.advanced[open] > summary::after { content: "\2212"; }
.advanced > .ctl-grid { padding: 0 16px 16px; }
.ops { display: grid; gap: 8px; }
.op-row { display: grid; gap: 4px; padding: 8px 10px; border-radius: 8px; background: var(--paper); }
.op-row.is-off .op-body { opacity: .45; }
.op-check { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.op-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.op-body { font-size: 14px; color: var(--muted); }
.op-body .rng { width: 4.6em; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 14px; text-align: center; }
.pv-screen { background-image: var(--flash-pattern, none) !important; background-size: 22px 22px !important; }
.pv-screen { position: relative; aspect-ratio: 16 / 10; background: var(--flash-bg, var(--stage)); border-radius: 16px; display: grid; place-items: center; container-type: size; overflow: hidden; box-shadow: var(--shadow), inset 0 0 0 1px var(--stage-line); }
.pv-screen > * { grid-area: 1 / 1; }
.pv-sound { position: absolute; right: 12px; bottom: 12px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--stage-line); background: var(--stage-raise); color: var(--stage-ink); display: grid; place-items: center; cursor: pointer; }
.pv-sound[aria-pressed="false"] { color: var(--stage-muted); }
.pv-strip { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 26px; }
.pv-time { color: var(--muted); font-size: 14px; white-space: nowrap; }
.pv-clock { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 18px; }
.pv-clock .ico { color: var(--accent); }
.pv-paper { position: relative; aspect-ratio: 16 / 10; border-radius: 16px; border: 1px solid var(--line); background-color: var(--paper-2); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 22px 22px; display: grid; place-items: center; padding: 18px; container-type: size; overflow: hidden; }
.pv-paper .task-body { display: grid; place-items: center; width: 100%; }
.pv-paper .column { font-size: clamp(11px, min(3.6cqw, 6.4cqh), 28px); }
.pv-paper .mult, .pv-paper .root { font-size: clamp(18px, 6.4cqw, 50px); }
.pv-paper .column.op-stack { font-size: clamp(18px, min(6.4cqw, 11cqh), 50px); }
.pv-refresh { position: absolute; right: 10px; top: 10px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.pv-refresh:hover { border-color: var(--accent); }
.pv-cal { align-content: center; gap: 18px; }
.pv-cal .date { font-size: clamp(28px, 10cqw, 68px); font-weight: 700; }
.pv-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; width: min(100%, 520px); }
.pv-day { display: grid; justify-items: center; gap: 1px; padding: 7px 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-weight: 700; font-size: 13px; transition: background .2s, transform .2s, color .2s; }
.pv-day b { font-size: 11px; color: var(--muted); }
.pv-day.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); transform: scale(1.08); }
.pv-day.on b { color: inherit; }
.pv-paper .expr { font-size: clamp(32px, 12cqw, 80px); }
.pv-ans { color: var(--accent); }
.pv-listen .wave { display: flex; align-items: center; gap: 7px; height: 40%; }
.pv-listen .wave i { width: 9px; border-radius: 5px; background: var(--stage-muted); height: 30%; }
.pv-listen .wave i:nth-child(2n) { height: 55%; }
.pv-listen .wave i:nth-child(3n) { height: 80%; }
.pv-listen .wave i:nth-child(5) { height: 100%; }
.pv-listen.is-playing .wave i { background: var(--stage-ink); animation: wave .9s ease-in-out infinite; }
.pv-listen.is-playing .wave i:nth-child(2n) { animation-delay: .15s; }
.pv-listen.is-playing .wave i:nth-child(3n) { animation-delay: .3s; }
@keyframes wave { 50% { transform: scaleY(.35); } }
.pv-listen .pv-play { position: absolute; bottom: 16px; }
.pv-listen.is-playing .pv-play { display: none; }
.pv-listen .listen-dots { position: absolute; top: 18px; }
.pv-answer { position: absolute; top: 14px; font-size: 30px; font-weight: 700; color: var(--stage-ink); }

.ev-info { display: grid; gap: 14px; align-content: start; min-width: 0; }
.ev-info h1 { font-size: clamp(32px, 4.2vw, 46px); font-weight: 900; }
.tagline { font-size: 20px; color: var(--muted); }
.steps, .rules { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.steps { gap: 8px 26px; }
.steps li, .rules li { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 700; font-size: 15px; }
.steps li .ico, .rules li .ico { color: var(--accent); }
.steps li + li::before { content: "→"; position: absolute; left: -21px; color: var(--muted); font-weight: 400; }
.rules li.is-good { color: var(--good); background: var(--good-soft); border-color: transparent; }
.rules li.is-good .ico { color: var(--good); }
.rules li.is-bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.rules li.is-bad .ico { color: var(--bad); }
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.level { display: grid; gap: 2px; justify-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; transition: border-color .15s, background-color .15s; }
.level:hover { border-color: var(--accent); }
.level[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.level-name { display: inline-flex; align-items: center; gap: 4px; font: 700 12px var(--f-body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.level-name .ico { width: 13px; height: 13px; color: var(--gold); }
.level-big { font-size: 22px; font-weight: 700; line-height: 1.15; white-space: nowrap; }
.level-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.launch { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.launch .summary { flex: 1 1 160px; font-size: 14px; color: var(--muted); }
.launch .btn { min-width: 170px; }

/* customize */
.customize { margin-top: 30px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.customize > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 16px 20px; font: 700 18px var(--f-display); cursor: pointer; }
.customize > summary::-webkit-details-marker { display: none; }
.customize > summary .ico { color: var(--accent); }
.customize > summary::after { content: "+"; margin-left: auto; font: 400 26px/1 var(--f-body); color: var(--muted); }
.customize[open] > summary::after { content: "\2212"; }
.ctl-form { display: grid; gap: 12px; padding: 0 16px 16px; }
.ctl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); grid-auto-flow: dense; align-items: start; gap: 12px; }
.ctl-example { margin-left: auto; font-weight: 500; font-size: 13px; color: var(--muted); }
.seg-bar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg-btn { min-height: 42px; border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--ink); font: 700 16px var(--f-num); cursor: pointer; }
.seg-btn:first-child { border-left: 0; }
.seg-btn:hover { background: var(--accent-soft); }
.seg-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg-btn:focus-visible { outline-offset: -3px; }
.speed-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.speed-unit { color: var(--muted); font-size: 14px; }
.swatch-picks { gap: 8px; }
.swatch { display: grid; justify-items: center; gap: 4px; padding: 0 0 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; overflow: hidden; min-width: 58px; }
.swatch span { display: grid; place-items: center; width: 100%; height: 36px; background: var(--sw-bg); color: var(--sw-ink); font-weight: 700; font-size: 17px; }
.swatch em, .size-pick em, .font-pick em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); }
.swatch[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.swatch.is-grid span { background-color: var(--paper-2); background-image: var(--grid-pattern); background-size: 8px 8px; color: var(--ink); }
.swatch.is-auto span { background: linear-gradient(135deg, #F8FAFB 0 50%, #05070A 50% 100%); color: transparent; position: relative; }
.swatch.is-auto span::after { content: "A"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--accent); font-weight: 700; text-shadow: 0 0 6px var(--surface), 0 0 2px var(--surface); }
.swatch span { box-shadow: inset 0 -1px 0 var(--line); }
.size-pick, .font-pick { flex-direction: column; gap: 2px; min-width: 54px; min-height: 58px; }
.size-pick span, .font-pick span { font-weight: 700; line-height: 1.1; }
.font-pick span { font-size: 20px; }
.size-pick[aria-pressed="true"] em, .font-pick[aria-pressed="true"] em { color: inherit; }
.ctl { display: grid; gap: 10px; align-content: start; padding: 14px; border-radius: 10px; background: var(--paper); min-width: 0; }
.ctl-label { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.ctl-label .ico { width: 18px; height: 18px; color: var(--accent); }
.picks { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; min-width: 44px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: 700 15px var(--f-body); cursor: pointer; transition: background-color .12s, border-color .12s; }
.pick.mono { font-family: var(--f-num); }
.pick:hover { border-color: var(--accent); }
.pick[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pick:disabled { opacity: .45; cursor: not-allowed; }
.trans { flex-direction: column; gap: 3px; font-size: 12px; padding: 8px 10px; }
.profile { width: 44px; height: 22px; }
.profile path { fill: currentColor; fill-opacity: .3; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.profile .base { fill: none; stroke-opacity: .5; }
.slots { width: 100%; height: auto; display: block; }
.slot-fill { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.slot-base { stroke: var(--line); stroke-width: 2; }
.slot-num { font: 700 20px var(--f-num); fill: var(--ink); text-anchor: middle; }
.mini-ranges { display: grid; gap: 6px; }
.mini-range { display: grid; grid-template-columns: 72px minmax(0, 1fr) 44px; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.mini-range output { text-align: right; color: var(--ink); }
.mini-range.is-off { opacity: .45; }
.sound-picks .snd { flex-direction: column; gap: 2px; font-size: 12px; min-width: 58px; }
.sound-picks .ico { width: 20px; height: 20px; }
.mode-picks .mode { flex-direction: column; align-items: flex-start; gap: 2px; padding: 9px 12px; text-align: left; }
.mode .ico { width: 20px; height: 20px; }
.mode-name { font-size: 14px; }
.mode-meta { font-size: 11px; font-weight: 500; opacity: .8; }
.series-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.count-row { display: flex; align-items: center; gap: 12px; }
.big { font-size: 24px; font-weight: 700; min-width: 2.6ch; text-align: right; color: var(--ink); }
.dots-static i { width: 7px; height: 7px; background: var(--accent); opacity: .6; }
.speed-read { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.speed-read .big { text-align: left; }
.speed-total { color: var(--muted); font-size: 14px; }
.range-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: -6px; }
.exact { display: flex; flex-wrap: wrap; gap: 10px; }
.exact label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.exact input { width: 6.5em; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 15px; }
.tog { display: flex; align-items: center; gap: 10px; min-height: 42px; cursor: pointer; font-weight: 700; }
.tog-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.tog-ico .ico { color: var(--accent); }
.tog input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.track { position: relative; width: 46px; height: 26px; margin-left: auto; border-radius: 999px; background: var(--line); transition: background .15s; flex: none; }
.track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform .15s; }
.tog input:checked ~ .track { background: var(--accent); }
.tog input:checked ~ .track::after { transform: translateX(20px); }
.tog input:focus-visible ~ .track { outline: 3px solid var(--accent); outline-offset: 2px; }
.stepper { display: inline-flex; align-items: stretch; width: fit-content; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.stepper input, .stepper output { width: 4.5em; border: 0; display: grid; place-items: center; text-align: center; font-size: 18px; font-weight: 700; background: transparent; color: var(--ink); -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.step { width: 44px; min-height: 42px; border: 0; background: transparent; color: var(--ink); font: 700 20px/1 var(--f-body); cursor: pointer; }
.step:hover { background: var(--accent-soft); }
.step:first-child { border-right: 1px solid var(--line); }
.step:last-child { border-left: 1px solid var(--line); }
.voice-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.voice-row select { flex: 1 1 200px; min-width: 0; min-height: 42px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 15px var(--f-body); }

/* results chart */
.stats { margin-top: 30px; display: grid; gap: 14px; }
.stats h2 { display: flex; align-items: center; gap: 10px; font-size: 20px; }
.stats h2 .ico { color: var(--accent); }
.stats-row { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: 24px; align-items: end; }
.stat { display: grid; gap: 4px; }
.stat-value { font-size: 46px; font-weight: 700; line-height: 1; }
.stat-label { color: var(--muted); font-size: 14px; }
.bars-fig { margin: 0; display: grid; gap: 6px; min-width: 0; }
.bars-cap { font-size: 13px; color: var(--muted); }
.bars-plot { position: relative; height: 120px; padding-left: 42px; border-bottom: 1px solid var(--line); }
.bars-plot::before { content: ""; position: absolute; left: 42px; right: 0; top: 0; border-top: 1px dashed var(--line); }
.bars-max { position: absolute; left: 0; top: -8px; font-size: 12px; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 100%; }
.bar-slot { position: relative; flex: 1 1 0; max-width: 30px; height: 100%; display: flex; align-items: flex-end; outline-offset: 1px; }
.bar { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; transition: filter .12s; }
.bar-slot:hover .bar, .bar-slot:focus-visible .bar { filter: brightness(1.2); }
.bar-slot:hover::after, .bar-slot:focus-visible::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 3; padding: 5px 9px; border-radius: 6px; background: var(--ink); color: var(--paper); font-size: 12px; white-space: nowrap; pointer-events: none; }
.bar-slot.tip-left:hover::after, .bar-slot.tip-left:focus-visible::after { left: auto; right: 0; transform: none; }
.bar-slot.is-ghost .bar { background: var(--line); }
.bars-empty { position: absolute; left: 42px; right: 0; top: 40%; text-align: center; color: var(--muted); font-size: 14px; font-weight: 700; }
.stat-value.is-empty { color: var(--line); }
.stat-value.is-empty .ico { width: 44px; height: 44px; }

/* ---------- stage ---------- */
.stage { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); overflow: auto; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.stage.is-dark {
  background: var(--flash-bg, var(--stage)); color: var(--stage-ink);
  background-image: var(--flash-pattern, none); background-size: 28px 28px;
  --surface: var(--stage-raise); --ink: var(--stage-ink); --muted: var(--stage-muted); --line: var(--stage-line);
  --accent: var(--stage-accent); --accent-ink: var(--stage); --good: var(--stage-good); --bad: var(--stage-minus);
  --flame-soft: var(--stage-flame-soft); --paper: var(--stage);
  color-scheme: var(--stage-scheme);
}
.stage-bar { display: flex; align-items: center; gap: 12px 20px; padding-block: 10px; padding-left: var(--gutter); padding-right: var(--gutter-r); border-bottom: 1px solid var(--line); }
.stage-title { font: 700 14px var(--f-display); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stage-status { flex: 1; font-size: 14px; color: var(--muted); text-align: right; min-width: 0; }
.stage-quit { min-height: 36px; padding: 4px 12px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: inherit; font: 700 14px var(--f-body); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.stage-quit:hover { border-color: var(--accent); }
.stage-body { flex: 1; display: grid; padding-block: 20px 32px; padding-left: var(--gutter); padding-right: var(--gutter-r); }
.stage-note { color: var(--muted); text-align: center; max-width: 40ch; }

.countdown { display: grid; justify-items: center; gap: 22px; }
.countdown-text { font: 700 clamp(18px, 3vw, 26px) var(--f-display); color: var(--muted); text-align: center; }
.countdown-dots { display: flex; gap: 22px; }
.countdown-dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--muted); transition: background .12s, border-color .12s; }
.countdown-dots i.on { background: var(--ink); border-color: var(--ink); }
.countdown-page { padding-block: 12vh; }

.run { display: grid; place-items: center; min-height: 100%; }
.screen { display: grid; place-items: center; width: 100%; min-height: 60vh; position: relative; }
.screen > * { grid-area: 1 / 1; }
.flash-num { font-family: var(--f-num); font-variant-numeric: tabular-nums; font-weight: 700; line-height: 1; color: var(--flash-ink, var(--stage-ink)); white-space: nowrap; opacity: 0; will-change: opacity; user-select: none; }
.flash-num .grp + .grp, .column .grp + .grp, .mult .grp + .grp, .root .grp + .grp { margin-left: .28em; }
.flash-num .sign { color: var(--stage-minus); margin-right: .06em; }
.listen-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 520px; }
.listen-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--stage-muted); }
.listen-dots i.now { border-color: var(--stage-ink); }
.listen-dots i.on { background: var(--stage-muted); }

.answer { display: grid; gap: 12px; width: min(100%, 520px); }
.answer label { font: 700 26px var(--f-display); text-align: center; }
.answer-row { display: flex; gap: 10px; }
.answer-row input { flex: 1; min-width: 0; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 30px; font-weight: 700; text-align: center; }
.answer-row input:focus-visible { outline-offset: 0; }
.answer-msg { min-height: 1.4em; color: var(--bad); text-align: center; font-size: 15px; }

.verdict { display: grid; gap: 22px; width: min(100%, 720px); }
.verdict.has-col { grid-template-columns: minmax(0, auto) auto; justify-content: center; gap: 24px 48px; align-items: start; width: min(100%, 820px); }
.verdict-main { display: grid; gap: 20px; align-content: start; justify-items: start; min-width: 0; }
.verdict-main .verdict-actions { justify-content: flex-start; }
.seq-col { display: grid; gap: 6px; min-width: 10ch; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 19px; font-weight: 700; }
.seq-col ol { list-style: none; margin: 0; padding: 0 2px 0 0; display: grid; max-height: min(56vh, 560px); overflow-y: auto; }
.seq-col li, .seq-total, .seq-yours { display: flex; justify-content: space-between; gap: 1.2ch; line-height: 1.4; text-align: right; }
.seq-col .sg { min-width: 1ch; text-align: left; color: var(--muted); font-weight: 500; }
.seq-col li.neg { color: var(--bad); }
.seq-col li.neg .sg { color: var(--bad); }
.seq-total { border-top: 2px solid var(--ink); padding-top: 6px; }
.seq-col.is-ok .seq-total { color: var(--good); }
.seq-yours { color: var(--bad); font-size: 15px; font-weight: 500; }
.verdict-head { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: center; }
.verdict-head .streak-badge { margin-left: auto; }
.mark { flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; font-size: 30px; font-weight: 700; }
.is-ok .mark { background: var(--good); color: var(--stage); }
.is-bad .mark { background: var(--bad); color: var(--stage); }
.verdict-text { display: grid; gap: 6px; min-width: 0; }
.verdict-title { font: 900 30px/1.1 var(--f-display); }
.verdict-sub { font-size: 18px; }
.verdict-meta { color: var(--muted); font-size: 14px; }
.seq { list-style: none; margin: 0; padding: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(8ch, 1fr)); gap: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 15px; }
.seq li { text-align: right; }
.seq li.neg { color: var(--bad); }
.verdict-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

.score-head { display: grid; gap: 6px; text-align: center; justify-items: center; }
.summary-big { font-size: clamp(56px, 10vw, 96px); font-weight: 700; line-height: 1; }
.summary-line { font-size: 17px; max-width: 56ch; }
.summary-meta { color: var(--muted); font-size: 14px; }
.score-split { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; font-weight: 700; }
.score-split .ok { color: var(--good); }
.score-split .bad { color: var(--bad); }
.score-split .muted { font-weight: 400; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.results { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.results th, .results td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.results th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.results td { font-family: var(--f-num); }
.results tr:last-child td { border-bottom: 0; }
.results tr.is-ok td:last-child { color: var(--good); font-weight: 700; }
.results tr.is-bad td:last-child { color: var(--bad); font-weight: 700; }
.results-title { font-size: 16px; margin-top: 4px; }

.sheet, .rapid { display: grid; gap: 22px; align-content: start; width: min(100%, 760px); margin-inline: auto; }
.sheet-top, .rapid-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; position: relative; }
.timer { font-size: 34px; font-weight: 700; line-height: 1; }
.timer.is-low { color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 700 13px var(--f-num); cursor: pointer; }
.chip.is-done { background: var(--accent-soft); border-color: var(--accent); }
.chip.is-current { outline: 2px solid var(--accent); outline-offset: 1px; }
.toast { position: absolute; right: 0; top: calc(100% + 6px); z-index: 2; padding: 6px 12px; border-radius: 8px; background: var(--ink); color: var(--paper); font-weight: 700; font-size: 14px; opacity: 0; transform: translateY(-4px); transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.is-on { opacity: 1; transform: none; }
.task { display: grid; gap: 14px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.task-no { font-size: 13px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.task-body { display: grid; justify-items: center; overflow-x: auto; }
.column { display: inline-grid; justify-items: end; font-size: clamp(22px, 5.2vw, 34px); font-weight: 700; line-height: 1.3; }
.column .row { display: flex; gap: .4ch; }
.column .sign { min-width: 1ch; color: var(--bad); text-align: left; }
.column .rule { width: 100%; border-top: 3px solid var(--accent); margin-top: 6px; }
.column .sign.op { color: var(--accent); }
.op-stack { font-size: clamp(26px, 5.6vw, 42px); }
.mult, .root { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: .2em .5em; font-size: clamp(28px, 6vw, 46px); font-weight: 700; }
.mult .times { color: var(--accent); }
.root .rad { font-size: 1.05em; }
.sheet-form { display: grid; gap: 10px; }
.sheet-form > label { font-weight: 700; }
.hint { font-size: 14px; color: var(--muted); }
.sheet-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.sheet-results { display: grid; gap: 20px; }

.sprint-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 18px; color: var(--muted); }
.sprint-top b { color: var(--ink); font-size: 26px; }
.sprint-top b.is-low { color: var(--bad); }
.sprint-line { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 14px; padding: 8vh 0 2vh; }
.sprint-line .expr { font-size: clamp(36px, 8vw, 64px); }
.sprint-eq { font-size: clamp(32px, 7vw, 56px); color: var(--muted); }
.sprint-line input { width: 4.2em; padding: 6px 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: clamp(32px, 7vw, 56px); font-weight: 700; text-align: center; }
.sprint-line input:focus-visible { border-color: var(--accent); outline: none; }
.pv-sprint { align-content: center; gap: 10px; }
.pv-sprint .pv-sprint-top { position: absolute; left: 16px; right: 16px; top: 12px; display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.pv-sprint .pv-sprint-top b { color: var(--ink); }
.pv-sprint .sprint-line { padding: 0; }
.pv-sprint .expr, .pv-sprint .sprint-eq, .pv-sprint .pv-input { font-size: clamp(26px, 8cqw, 60px); font-weight: 700; }
.pv-input { min-width: 3ch; padding: 2px 10px; border: 2px solid var(--line); border-radius: 8px; background: var(--surface); text-align: center; color: var(--accent); }
.rapid-score { color: var(--muted); }
.rapid-score b { color: var(--ink); font-size: 22px; }
.rapid-q { display: grid; place-items: center; min-height: 28vh; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.rapid-q.is-ok { animation: flash-good .35s ease-out; }
.rapid-q.is-bad { animation: flash-bad .45s ease-out; }
@keyframes flash-good { from { background: var(--good-soft); border-color: var(--good); } }
@keyframes flash-bad { from { background: var(--bad-soft); border-color: var(--bad); } }
.date, .expr { font-size: clamp(36px, 8vw, 72px); font-weight: 700; line-height: 1.1; text-align: center; }
.weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { display: grid; justify-items: center; gap: 4px; min-height: 64px; padding: 8px 4px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 700 16px var(--f-body); cursor: pointer; }
.day:hover, .day.is-pressed { border-color: var(--accent); background: var(--accent-soft); }
.day kbd { font-size: 12px; }
.rapid-input input { width: 100%; padding: 14px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 34px; font-weight: 700; text-align: center; }
.rapid-hint { text-align: center; }

/* ---------- narrower screens ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-block: 28px 20px; }
  .hero-stage { order: -1; }
  .cards-5 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .cards-5 .card { grid-column: span 2; }
  .cards-5 .card:nth-child(n+4) { grid-column: span 3; }
  .ev-top { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .pv { position: static; }
  .ev { padding-bottom: 120px; }
  .launch {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; margin: 0;
    padding-top: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    padding-left: var(--gutter); padding-right: var(--gutter-r);
    background: var(--surface); border-top: 1px solid var(--line); box-shadow: var(--shadow); flex-wrap: nowrap;
  }
  .launch .btn { min-width: 0; }
}
@media (max-width: 640px) {
  .verdict.has-col { grid-template-columns: minmax(0, 1fr); }
  .wc-banner { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .wc-stations b { font-size: 12px; }
  .wc-dot { width: 38px; height: 38px; }
  .wc-stations::before { top: 19px; }
  .cards-3, .cards-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards-5 .card, .cards-5 .card:nth-child(n+4) { grid-column: auto; }
  .cards-5 .card:last-child, .cards-3 .card:last-child { grid-column: 1 / -1; flex-direction: row; }
  .cards-5 .card:last-child .thumb, .cards-3 .card:last-child .thumb, .cards-1 .thumb { width: 46%; flex: none; aspect-ratio: auto; min-height: 120px; }
  .cards-5 .card:last-child .card-text, .cards-3 .card:last-child .card-text { align-content: center; }
  .cards-1 .card-text { padding-inline: 14px; }
  .cards-1 .card-name { font-size: 17px; }
  .card-chips > span { font-size: 12px; padding: 4px 9px; }
  .card-name { font-size: 16px; }
  .stats-row { grid-template-columns: minmax(0, 1fr); }
  .stage-title { display: none; }
  .stage-status { text-align: left; }
  .stage-quit kbd { display: none; }
  .answer-row { flex-direction: column; }
  .weekdays { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .day { min-height: 56px; }
  .verdict-actions .btn { flex: 1 1 100%; }
  .mark { width: 44px; height: 44px; font-size: 24px; }
  .verdict-title { font-size: 24px; }
  .verdict-head .streak-badge { margin-left: 0; }
  .streak-pill { height: 38px; padding: 0 11px 0 9px; }
  .sound-toggle { width: 38px; height: 38px; }
  .brand span { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
