/* Snap: loud and quick */
@font-face { font-family: "Young Serif"; font-display: swap; src: url(../fonts/young-serif-latin-400-normal.woff2) format("woff2"); }

:root {
  --bg: #F2F3FF;
  --card: #FFFFFF;
  --ink: #17142B;
  --muted: #615C7A;
  --line: #DCDDF0;
  --hot: #FF4F7A;
  --good: #16A865;
  --bad: #E5484D;
  --skip: #C9CBE0;
  --display: "Young Serif", Georgia, serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14121F; --card: #1F1C30; --ink: #F1EFFA; --muted: #A9A4C2; --line: #343049; --skip: #4A4660; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--ui); line-height: 1.45; min-height: 100vh; }
a { color: inherit; }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--hot); outline-offset: 2px; }

.wrap { max-width: 560px; margin: 0 auto; padding: 0 14px; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 0 0; }
.back { text-decoration: none; color: var(--muted); font-size: 0.95rem; }
.top-actions { display: flex; gap: 4px; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; }
.icon-btn:hover { background: var(--card); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.title-row { display: flex; align-items: baseline; justify-content: space-between; padding: 4px 0 12px; }
h1 { font-family: var(--display); font-weight: 400; font-size: 2.2rem; margin: 0; line-height: 1; }
.sub { margin: 0; color: var(--muted); font-size: 0.95rem; }

.card { background: var(--card); border-radius: 22px; padding: 22px 18px; box-shadow: 0 1px 0 var(--line), 0 18px 40px -28px rgba(23, 20, 43, .5); }
.kicker { margin: 0; color: var(--muted); font-weight: 600; }
.category { font-family: var(--display); font-size: clamp(2.6rem, 11vw, 3.6rem); line-height: 1.05; margin: 4px 0 10px; }
.rule { margin: 0 0 18px; font-size: 1.1rem; }
.go { width: 100%; border: 0; border-radius: 16px; padding: 16px; background: var(--hot); color: #fff; font-weight: 800; font-size: 1.2rem; cursor: pointer; }
.fine { color: var(--muted); font-size: 0.85rem; text-align: center; margin: 10px 0 0; }

/* play */
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; width: 100%; background: var(--hot); transform-origin: left; }
.play-hud { display: flex; justify-content: space-between; align-items: center; margin: 12px 2px; font-weight: 700; font-variant-numeric: tabular-nums; }
#lives { letter-spacing: 3px; color: var(--hot); font-size: 1.2rem; }
.tap-zone {
  position: relative; width: 100%; aspect-ratio: 1 / 0.9; border: 0; border-radius: 18px; cursor: pointer;
  background: var(--bg); display: grid; place-items: center; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: background-color .12s;
}
.tap-zone.hit { background: color-mix(in srgb, var(--good) 22%, var(--bg)); }
.tap-zone.wrong { background: color-mix(in srgb, var(--bad) 25%, var(--bg)); }
.word { font-weight: 850; font-size: clamp(2.2rem, 10vw, 3.4rem); line-height: 1.05; text-align: center; padding: 0 12px; }
.pop { position: absolute; top: 14px; right: 16px; font-weight: 800; font-variant-numeric: tabular-nums; opacity: 0; }
.pop.show { opacity: 1; }
.pop.good { color: var(--good); }
.pop.bad { color: var(--bad); }
.hint { color: var(--muted); font-size: 0.9rem; text-align: center; margin: 12px 0 0; }

/* done */
.big { font-family: var(--display); font-size: 3.4rem; line-height: 1; margin: 6px 0 4px; }
.detail { margin: 0 0 14px; color: var(--muted); }
.strip { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; margin-bottom: 14px; }
.strip span { aspect-ratio: 1; border-radius: 4px; background: var(--skip); }
.strip .hit { background: var(--good); }
.strip .wrong, .strip .miss { background: var(--bad); }
.strip .unseen { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.misses { list-style: none; padding: 0; margin: 0 0 14px; color: var(--muted); font-size: 0.92rem; }
.misses li + li { margin-top: 2px; }

/* ads */
.ad-inline { margin-top: 26px; }
.ad-slot { display: block; margin: 0 auto; overflow: hidden; }
.ad-banner { width: 100%; max-width: 728px; min-height: 100px; }
.ad-slot.placeholder { border: 1.5px dashed var(--line); border-radius: 12px; display: grid; place-items: center; color: var(--muted); font-size: 0.85rem; }
.ad-slot.placeholder::before { content: "Ad space " attr(data-size); }
.ad-slot.collapsed { min-height: 0; }
.ad-slot ins[data-ad-status="unfilled"] { display: none !important; }
.ad-label { font-size: 11px; color: var(--muted); text-align: center; margin: 0 0 4px; }

.foot { display: flex; justify-content: center; gap: 22px; padding: 26px 0 40px; color: var(--muted); font-size: 0.9rem; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.dlg { border: 0; border-radius: 16px; padding: 22px; width: min(420px, calc(100vw - 32px)); background: var(--card); color: var(--ink); }
.dlg::backdrop { background: rgba(10, 8, 20, .5); }
.dlg h2 { font-family: var(--display); font-weight: 400; margin: 0 0 10px; font-size: 1.6rem; }
.dlg p { color: var(--muted); }
.dlg .x { position: absolute; right: 10px; top: 8px; border: 0; background: transparent; font-size: 26px; cursor: pointer; color: var(--muted); width: 40px; height: 40px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0; }
.stats div { display: flex; flex-direction: column-reverse; background: var(--bg); border-radius: 10px; padding: 10px; }
.stats dt { color: var(--muted); font-size: 0.85rem; }
.stats dd { margin: 0; font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .tap-zone, .toast { transition: none; } }
