:root {
  --bg: #09090b;
  --panel: #111113;
  --panel-2: #18181b;
  --line: #222226;
  --line-2: #2e2e33;
  --text: #fafafa;
  --muted: #a1a1aa;
  --faint: #6b6b74;
  --bad: #f43f5e;
  --accent: #38bdf8;
  --radius: 16px;
  --font: 'Geist', system-ui, -apple-system, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN',
    'Apple SD Gothic Neo', 'Noto Sans JP', 'Noto Sans KR', 'Malgun Gothic', 'Yu Gothic', sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
/* a faint wash of the category colour behind the header */
body::before {
  content: ''; position: fixed; inset: 0 0 auto; height: 520px; z-index: -1; pointer-events: none;
  background: radial-gradient(60% 100% at 20% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%);
  transition: background 0.4s;
}
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
a { color: inherit; }
img { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- layout ---------- */
.bar, main { width: 100%; max-width: 1120px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.bar { display: flex; align-items: center; justify-content: space-between; height: 68px; padding-top: env(safe-area-inset-top); }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: 17px; text-decoration: none; }
.brand-mark { width: 19px; height: 19px; fill: var(--text); }
.brand .tld { color: var(--faint); font-weight: 500; }
.brand-mark rect:nth-child(3) { fill: var(--accent); transition: fill 0.3s; }
body[data-playing] .brand-mark rect { animation: eq 0.55s ease-in-out infinite alternate; transform-origin: center; transform-box: fill-box; }
.brand-mark rect:nth-child(2) { animation-delay: -0.2s !important; }
.brand-mark rect:nth-child(4) { animation-delay: -0.35s !important; }
@keyframes eq { to { transform: scaleY(0.4); } }
.bar-right { display: flex; align-items: center; gap: 12px; }
.score { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.score b { color: var(--text); font-weight: 600; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { color: var(--text); background: var(--panel-2); }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }

main { flex: 1; padding-bottom: 40px; }
#game, #results { max-width: 680px; margin: 0 auto; }
.view { animation: fade 0.25s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

.card { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, #131316, #0f0f11); }

/* ---------- controls ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.seg button { height: 38px; border-radius: 9px; font-weight: 500; color: var(--muted); transition: background 0.15s, color 0.15s; }
.seg button:hover { color: var(--text); }
.seg button[aria-checked='true'] { background: var(--panel-2); color: var(--text); box-shadow: 0 0 0 1px var(--line-2) inset; }

.chips { display: flex; gap: 6px; margin: 14px -24px 0; padding: 0 24px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 99px;
  border: 1px solid var(--line); color: var(--muted); font-weight: 500; font-size: 14px; transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--dot); opacity: 0.55; }
.chip:hover { color: var(--text); }
.chip[aria-checked='true'] { color: var(--text); border-color: color-mix(in srgb, var(--dot) 45%, var(--line-2)); background: color-mix(in srgb, var(--dot) 10%, var(--panel)); }
.chip[aria-checked='true'] i { opacity: 1; }
.chip .done { color: var(--faint); font-size: 12px; }

.cta {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 50px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-weight: 600; font-size: 15px; transition: opacity 0.15s, transform 0.1s;
}
.cta:hover { opacity: 0.9; }
.cta:active { transform: scale(0.99); }
.cta:disabled { opacity: 0.4; }
.cta.small { width: auto; height: 38px; padding: 0 16px; font-size: 14px; border-radius: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 13px;
  border-radius: 10px; border: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 500; text-decoration: none;
  transition: color 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover:not(:disabled) { color: var(--text); border-color: var(--line-2); }
.btn:disabled { opacity: 0.35; }
.link-btn { display: block; margin: 18px auto 0; color: var(--faint); font-size: 13px; }
.link-btn.left { margin: 18px 0 0; }
.link-btn:hover { color: var(--muted); }

.search { position: relative; }
.search > svg { position: absolute; left: 14px; top: 50%; width: 17px; height: 17px; margin-top: -8.5px; fill: none; stroke: var(--faint); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search input {
  width: 100%; height: 48px; padding: 0 14px 0 40px; border-radius: 12px; font-size: 16px;
  background: var(--panel); border: 1px solid var(--line); outline: none; transition: border-color 0.15s;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { border-color: var(--line-2); background: var(--panel-2); }
.search.small input { height: 40px; font-size: 14px; border-radius: 10px; padding-left: 36px; background: var(--bg); }
.search.small > svg { left: 12px; width: 15px; height: 15px; margin-top: -7.5px; }
.search.shake { animation: shake 0.35s ease; }
@keyframes shake { 25%, 75% { transform: translateX(-5px); } 50% { transform: translateX(5px); } }

.menu {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 4px; list-style: none;
  border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.8);
  max-height: min(380px, 52vh); overflow-y: auto;
}
.menu li { display: flex; align-items: center; gap: 11px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.menu li[aria-selected='true'] { background: rgba(255, 255, 255, 0.06); }
.menu img { width: 36px; height: 36px; border-radius: 6px; background: var(--line); flex: none; object-fit: cover; }
.menu span { min-width: 0; display: grid; }
.menu b, .menu small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu b { font-weight: 500; }
.menu small { color: var(--muted); font-size: 12px; }

/* ---------- home ---------- */
.home { display: grid; gap: 28px; padding-top: 12px; }
@media (min-width: 980px) {
  .home { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: 48px; align-items: start; padding-top: 28px; }
  .home-main { position: sticky; top: 24px; }
}
.home h1 { margin: 8px 0 8px; font-size: clamp(30px, 5vw, 46px); line-height: 1.05; font-weight: 600; letter-spacing: -0.04em; }
.home .sub { margin: 0 0 26px; color: var(--muted); font-size: 16px; }
.launch { margin-top: 18px; padding: 18px; display: grid; gap: 14px; }
.launch-title { margin: 0; font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.launch-info { margin: 2px 0 0; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.tile { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.tile small { display: block; color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.tile b { display: block; margin-top: 2px; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.how { list-style: none; margin: 22px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; counter-reset: how; }
.how li { counter-increment: how; display: grid; gap: 2px; font-size: 13px; }
.how b { font-weight: 500; }
.how b::before { content: counter(how) '. '; color: var(--accent); }
.how span { color: var(--faint); }
@media (max-width: 520px) { .tiles { grid-template-columns: repeat(2, 1fr); } .how { grid-template-columns: 1fr; gap: 8px; } }

/* side panels */
.panel { overflow: hidden; }
.panel-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 16px 18px; text-align: left; font-weight: 600; font-size: 15px; }
.panel-head small { margin-left: auto; color: var(--muted); font-weight: 400; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.panel-head.static { cursor: default; }
.chev { width: 8px; height: 8px; flex: none; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-2px) rotate(45deg); transition: transform 0.2s; }
.panel-head[aria-expanded='true'] .chev { transform: translateY(2px) rotate(-135deg); }
.panel-note { margin: 0; padding: 12px 18px 16px; color: var(--faint); font-size: 13px; border-top: 1px solid var(--line); }
.opt-body { padding: 4px 18px 20px; border-top: 1px solid var(--line); }
.opt-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
@media (max-width: 560px) { .opt-grid { grid-template-columns: 1fr; gap: 0; } }
.opt-sec { padding-top: 18px; }
.opt-sec h3, .sub-h { margin: 0 0 10px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.sub-h { margin-top: 16px; }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills:empty { display: none; }
#picked { margin-top: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 99px;
  background: var(--panel-2); border: 1px solid transparent; color: var(--muted); font-size: 13px; font-weight: 500; transition: all 0.15s;
}
.pill:hover { color: var(--text); }
.pill small { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.pill[aria-pressed='true'] { color: var(--text); background: color-mix(in srgb, var(--accent) 16%, var(--panel)); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.pill[aria-pressed='true'] small { color: color-mix(in srgb, var(--accent) 60%, var(--text)); }
.pill.zero { opacity: 0.45; }
.pill img { width: 22px; height: 22px; border-radius: 50%; margin-left: -8px; object-fit: cover; }
.pill .x { color: var(--faint); font-size: 15px; line-height: 1; margin-right: -3px; }

.artist-list { margin-top: 10px; max-height: 236px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); padding: 4px; scrollbar-width: thin; }
.arow { width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; text-align: left; color: var(--muted); font-size: 14px; }
.arow:hover { background: var(--panel-2); color: var(--text); }
.arow span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arow small { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.arow img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; background: var(--line); }
.arow[aria-pressed='true'] { color: var(--text); }
.arow[aria-pressed='true']::after { content: '✓'; color: var(--accent); font-size: 12px; font-weight: 700; }
.arow.dim { opacity: 0.45; }
.alabel { padding: 8px 10px 4px; color: var(--faint); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.anote { padding: 10px; color: var(--faint); font-size: 13px; }

.select {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); font-size: 13px; font-weight: 500;
}
.select::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-2px) rotate(45deg); }
.select[aria-expanded='true']::after { transform: translateY(1px) rotate(-135deg); }
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; margin-top: 12px; max-height: 300px; overflow-y: auto; padding: 2px; }
.album { position: relative; text-align: left; display: grid; gap: 4px; min-width: 0; opacity: 0.7; transition: opacity 0.15s; }
.album:hover, .album[aria-pressed='true'] { opacity: 1; }
.album img { width: 100%; aspect-ratio: 1; border-radius: 8px; background: var(--line); object-fit: cover; }
.album[aria-pressed='true'] img { outline: 2px solid var(--accent); outline-offset: 2px; }
.album[aria-pressed='true']::after {
  content: '✓'; position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--accent); color: var(--bg);
}
.album span, .album small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.album small { color: var(--faint); font-size: 11px; margin-top: -4px; }
.small-note { color: var(--faint); font-size: 13px; margin: 8px 0 0; }

/* era: two range inputs sharing one track */
.era-labels { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.era-labels b { color: var(--text); font-weight: 600; font-size: 15px; }
.dual { position: relative; height: 36px; margin-top: 6px; }
.dual-track { position: absolute; left: 9px; right: 9px; top: 50%; height: 4px; margin-top: -2px; border-radius: 4px; background: var(--line-2); }
.dual-track i { position: absolute; top: 0; bottom: 0; border-radius: inherit; background: var(--accent); }
.dual input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.dual input::-webkit-slider-runnable-track { background: none; height: 36px; }
.dual input::-moz-range-track { background: none; }
.dual input::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 18px; height: 18px; margin-top: 9px; border-radius: 50%; background: var(--text); border: 0; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); cursor: grab; }
.dual input::-moz-range-thumb { pointer-events: auto; width: 18px; height: 18px; border-radius: 50%; background: var(--text); border: 0; cursor: grab; }
.dual input:focus-visible { outline: none; }
.dual input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent); }

/* switches */
.switch { display: flex; align-items: center; gap: 12px; padding: 6px 0; font-weight: 500; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.knob { position: relative; width: 40px; height: 24px; border-radius: 99px; background: var(--line-2); transition: background 0.2s; flex: none; }
.knob::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform 0.2s, background 0.2s; }
.switch input:checked + .knob { background: var(--accent); }
.switch input:checked + .knob::after { transform: translateX(16px); background: var(--bg); }
.switch input:focus-visible + .knob { outline: 2px solid var(--accent); outline-offset: 2px; }

/* today's dailies */
.today { list-style: none; margin: 0; padding: 0 8px 8px; border-top: 1px solid var(--line); }
.today li { display: flex; align-items: center; gap: 12px; padding: 12px 10px; border-radius: 10px; }
.today li + li { border-top: 1px solid var(--line); border-radius: 0; }
.today i { width: 8px; height: 8px; border-radius: 50%; background: var(--dot); flex: none; }
.today .name { font-weight: 500; min-width: 64px; }
.today .state { flex: 1; color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.today .state.done { color: var(--muted); }
.today .state b { color: var(--text); font-weight: 600; }

/* ---------- game ---------- */
.progress { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 6px 0 16px; }
.progress i { height: 3px; border-radius: 3px; background: var(--line); transition: background 0.3s; }
.progress i.cur { background: var(--faint); animation: blink 1.2s ease-in-out infinite; }
.progress i.ok { background: var(--accent); }
.progress i.miss { background: color-mix(in srgb, var(--bad) 70%, transparent); }
@keyframes blink { 50% { opacity: 0.4; } }

.deck { padding: 16px 16px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, #131316, #0f0f11); }
.deck-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.deck-head b { color: var(--text); font-weight: 600; }
.viz-wrap { position: relative; height: 140px; margin: 8px 0 4px; display: grid; place-items: center; transition: height 0.2s ease; }
@media (min-width: 720px) { .viz-wrap { height: 180px; } }
#viz { position: absolute; inset: 0; width: 100%; height: 100%; }
.play {
  position: relative; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: var(--text); color: var(--bg); box-shadow: 0 0 0 8px #121215; transition: transform 0.1s;
}
.play:active { transform: scale(0.95); }
.play:disabled { opacity: 0.4; }
.play svg { width: 24px; height: 24px; fill: currentColor; }
.play .i-stop, .play.is-playing .i-play { display: none; }
.play.is-playing .i-stop { display: block; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; background: color-mix(in srgb, #121215 75%, transparent); }
.loading:not(:disabled) { color: var(--text); text-decoration: underline; text-underline-offset: 4px; }

.clip-track { position: relative; height: 30px; }
.clip-rail { position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: 6px; background: var(--line); overflow: hidden; }
.clip-rail i { position: absolute; top: 0; bottom: 0; left: 0; border-radius: inherit; }
.clip-sel { background: var(--line-2); transition: width 0.08s; }
.clip-heard { background: var(--accent); transition: width 0.2s; }
.clip-head { width: 2px !important; background: var(--text); opacity: 0; }
body[data-playing] .clip-head { opacity: 1; }
#clipRange {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; touch-action: pan-y;
}
#clipRange::-webkit-slider-runnable-track { background: transparent; height: 30px; }
#clipRange::-moz-range-track { background: transparent; height: 30px; }
#clipRange::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: 6px; border-radius: 50%; background: var(--text); border: 0; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); }
#clipRange::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--text); border: 0; }
#clipRange:focus-visible { outline: none; }
#clipRange:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent); }
.clip-ticks { position: relative; height: 16px; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.clip-ticks span { position: absolute; transform: translateX(-50%); }
.clip-ticks span:first-child { transform: none; }
.clip-ticks span:last-child { transform: translateX(-100%); }
.deck-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.clip-len { font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; }
.deck.revealed .clip, .deck.revealed .deck-actions { display: none; }

.guess { margin-top: 12px; }
.hint-text { margin: 10px 2px 0; font-size: 13px; color: var(--muted); }
.hint-text b { color: var(--text); font-weight: 500; }
.wrongs { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.wrongs li { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; font-size: 13px; background: color-mix(in srgb, var(--bad) 8%, transparent); animation: fade 0.2s ease both; }
.wrongs li b { font-weight: 500; text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 70%, transparent); }
.wrongs li span { color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wrongs li em { margin-left: auto; font-style: normal; color: var(--bad); font-variant-numeric: tabular-nums; }

.reveal { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); animation: fade 0.25s ease both; }
.reveal-body { display: grid; grid-template-columns: 72px 1fr auto; gap: 14px; align-items: center; }
.reveal-cover { width: 72px; height: 72px; border-radius: 10px; background: var(--line); }
.reveal-meta { min-width: 0; }
.reveal-meta p { margin: 0; }
.reveal-meta .verdict { font-size: 12px; font-weight: 500; color: var(--accent); font-variant-numeric: tabular-nums; }
.reveal-meta .verdict.miss { color: var(--bad); }
.reveal-meta h2 { margin: 2px 0 1px; font-size: 18px; line-height: 1.25; font-weight: 600; overflow-wrap: anywhere; }
.reveal-meta .sub { color: var(--muted); font-size: 13px; }
.tag { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 500; color: var(--muted); border: 1px solid var(--line-2); }
.reveal-pts { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.reveal-pts.miss { color: var(--faint); }
.reveal-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
@media (max-width: 440px) {
  .reveal-body { grid-template-columns: 60px 1fr; }
  .reveal-cover { width: 60px; height: 60px; }
  .reveal-pts { grid-column: 2; font-size: 18px; margin-top: -8px; }
}

@media (max-width: 640px) {
  body.typing .viz-wrap { height: 64px; }
  body.typing .play { transform: scale(0.75); }
}

/* ---------- results ---------- */
.res-head { padding: 28px 0 22px; text-align: center; }
.res-label { margin: 0; color: var(--faint); font-size: 13px; }
.res-score { margin: 8px 0 2px; font-size: 56px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.res-score small { font-size: 16px; font-weight: 500; color: var(--faint); letter-spacing: 0; }
.rank { margin: 6px 0 0; font-weight: 500; color: var(--accent); }
.res-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 22px; }
.res-actions .btn { height: 50px; border-radius: 12px; font-size: 15px; color: var(--text); }
.res-next { margin: 12px 0 0; color: var(--faint); font-size: 13px; }
.res-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.res-list li + li { border-top: 1px solid var(--line); }
.res-row { display: grid; grid-template-columns: 40px 1fr auto auto; align-items: center; gap: 12px; padding: 10px 12px; text-decoration: none; animation: fade 0.25s ease both; }
.res-row:hover { background: rgba(255, 255, 255, 0.02); }
.res-row img { width: 40px; height: 40px; border-radius: 6px; background: var(--line); }
.res-meta { min-width: 0; display: grid; }
.res-meta b, .res-meta small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-meta b { font-weight: 500; }
.res-meta small { color: var(--faint); font-size: 12px; }
.res-time { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.res-time.miss { color: var(--bad); }
.res-pts { font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; min-width: 46px; text-align: right; }

/* ---------- stats page ---------- */
.nav-btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 10px; color: var(--muted); font-size: 14px; font-weight: 500; }
.nav-btn:hover { color: var(--text); background: var(--panel-2); }
.nav-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.stats-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 20px 0 18px; }
.stats-head h1, .stats-empty h1 { margin: 0; font-size: clamp(28px, 4vw, 38px); font-weight: 600; letter-spacing: -0.035em; }
.stats-head p { margin: 4px 0 0; color: var(--faint); font-size: 13px; }
.stats-empty { max-width: 460px; padding: 48px 0; }
.stats-empty p { color: var(--muted); }
.tiles.wide { grid-template-columns: repeat(6, 1fr); margin-top: 0; }
@media (max-width: 900px) { .tiles.wide { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .tiles.wide { grid-template-columns: repeat(2, 1fr); } }
.tile em { font-style: normal; color: var(--faint); font-weight: 500; font-size: 14px; }
.tile span { display: block; margin-top: 2px; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
@media (max-width: 820px) { .stats-grid { grid-template-columns: 1fr; } }
.scard { padding: 16px 18px 18px; min-width: 0; }
.scard.span2 { grid-column: 1 / -1; }
.scard h2 { margin: 0 0 12px; font-size: 14px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; }
.scard h2 small { color: var(--faint); font-weight: 400; font-size: 12px; }
.scard .cta.small { margin-top: 14px; width: 100%; }
.snote { margin: 0; color: var(--faint); font-size: 13px; }

.chart { width: 100%; overflow: hidden; }
.chart svg { display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .col { outline: none; cursor: default; }
.chart .col:hover .bar, .chart .col:focus .bar { filter: brightness(1.25); }

.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: 64px 1fr 44px 48px; align-items: center; gap: 10px; font-size: 13px; outline: none; border-radius: 6px; }
.hbar:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.hbar > span { color: var(--muted); }
.hbar .track { height: 10px; border-radius: 0 4px 4px 0; background: var(--panel-2); overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.hbar:hover .track i { filter: brightness(1.25); }
.hbar b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.hbar small { color: var(--faint); font-variant-numeric: tabular-nums; }

.stable { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.stable th { text-align: right; color: var(--faint); font-weight: 500; font-size: 12px; padding: 0 0 8px 8px; }
.stable td { text-align: right; padding: 8px 0 8px 8px; border-top: 1px solid var(--line); }
.stable th:first-child, .stable td:first-child { text-align: left; padding-left: 0; }

.slist, .alist, .rlist { list-style: none; margin: 0; padding: 0; }
.srow { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; text-decoration: none; }
.slist li + li .srow, .rlist li + li, .alist li + li { border-top: 1px solid var(--line); }
.srow img { width: 36px; height: 36px; border-radius: 6px; background: var(--line); }
.smeta { min-width: 0; display: grid; }
.smeta b, .smeta small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smeta b { font-weight: 500; font-size: 14px; }
.smeta small { color: var(--faint); font-size: 12px; }
.sright { font-size: 13px; font-variant-numeric: tabular-nums; }
.sright .miss { color: var(--bad); font-size: 12px; }
.srow:hover .smeta b { text-decoration: underline; text-underline-offset: 3px; }
.alist li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 14px; }
.alist small { color: var(--faint); font-variant-numeric: tabular-nums; }
.rlist li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 8px 0; }
.rl { min-width: 0; display: grid; }
.rl b, .rl small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl b { font-weight: 500; font-size: 14px; }
.rl small { color: var(--faint); font-size: 12px; }
.rsq { font-size: 11px; letter-spacing: 1px; }
.rt { font-variant-numeric: tabular-nums; font-size: 14px; min-width: 52px; text-align: right; }

.tip {
  position: fixed; z-index: 60; pointer-events: none; display: grid; gap: 1px; padding: 8px 10px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.8); font-size: 12px;
}
.tip b { font-size: 14px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.tip span { color: var(--muted); }

/* ---------- misc ---------- */
.foot { text-align: center; color: var(--faint); font-size: 12px; padding: 16px 20px max(18px, env(safe-area-inset-bottom)); }
.foot a { color: var(--muted); text-decoration: none; }
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 50; transform: translate(-50%, 12px);
  opacity: 0; pointer-events: none; padding: 10px 16px; border-radius: 10px; background: var(--text); color: var(--bg);
  font-weight: 500; font-size: 14px; transition: opacity 0.2s, transform 0.2s; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 420px) {
  .bar, main { padding-left: 18px; padding-right: 18px; }
  .chips { margin: 14px -18px 0; padding: 0 18px; gap: 5px; }
  .chip { padding: 0 10px; font-size: 13px; gap: 6px; }
}

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