/* UNDRGRND: a burned CD-R. Violet like the dye side of a blank disc, silver like the label side,
   handwriting like the Sharpie on it. The disc is the one loud thing; everything else stays quiet. */

@font-face { font-family: "Sedgwick Ave"; src: url("../fonts/sedgwick-ave-latin-400-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Sedgwick Ave Display"; src: url("../fonts/sedgwick-ave-display-latin-400-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Familjen Grotesk"; font-weight: 400; src: url("../fonts/familjen-grotesk-latin-400-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Familjen Grotesk"; font-weight: 500; src: url("../fonts/familjen-grotesk-latin-500-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Familjen Grotesk"; font-weight: 600; src: url("../fonts/familjen-grotesk-latin-600-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Familjen Grotesk"; font-weight: 700; src: url("../fonts/familjen-grotesk-latin-700-normal.woff2") format("woff2"); font-display: swap; }

:root {
  --azo: #1d1744;          /* page: CD-R dye violet */
  --azo-deep: #140f35;     /* wells, inputs */
  --azo-raise: #251e53;    /* sheets */
  --azo-line: #3d3479;     /* hairlines */
  --ink: #f3f1fb;
  --ink-dim: #b3acd9;
  --ink-faint: #7f78ae;
  --chrome: #e6e8f0;       /* primary buttons: the silver label side */
  --chrome-ink: #17123d;   /* Sharpie */
  --hit: #5ee5d0;          /* right */
  --half: #f7c75a;         /* artist right, title missed */
  --miss: #ff62a3;         /* wrong */
  --font-ui: "Familjen Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-hand: "Sedgwick Ave", "Marker Felt", "Comic Sans MS", cursive;
  --font-logo: "Sedgwick Ave Display", var(--font-hand);
  --disc: clamp(172px, 31vh, 250px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font: 400 16px/1.45 var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(60rem 36rem at 50% -8rem, #2b2266 0%, transparent 70%),
    var(--azo);
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--hit); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.icon { display: inline-block; width: 1.25em; height: 1.25em; flex: none; }
.icon svg { display: block; width: 100%; height: 100%; }

/* ---------- frame ---------- */
.app {
  max-width: 980px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo {
  margin: 0;
  font: 400 30px/1 var(--font-logo);
  letter-spacing: 0.02em;
  transform: rotate(-2deg);
  transform-origin: left center;
}
.top-actions { display: flex; gap: 4px; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px;
  border: 0; border-radius: 12px;
  background: transparent; color: var(--ink-dim);
}
.icon-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.icon-btn .icon { width: 22px; height: 22px; }
.icon-btn.small { width: 34px; height: 34px; }
.icon-btn.small .icon { width: 18px; height: 18px; }

.modebar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin: 10px 0 4px; min-height: 40px; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--azo-deep); border: 1px solid var(--azo-line); }
.seg button { border: 0; background: transparent; color: var(--ink-dim); font-weight: 600; font-size: 14px; padding: 6px 13px; border-radius: 999px; }
.seg button[aria-pressed="true"] { background: var(--chrome); color: var(--chrome-ink); }
.meta { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-dim); text-align: right; min-width: 0; }
.meta-num { font: 400 22px/1 var(--font-hand); color: var(--ink); }
.meta-back { border: 0; background: none; color: var(--hit); font-weight: 600; font-size: 14px; padding: 4px 0; text-decoration: underline; text-underline-offset: 3px; }
.lives { display: inline-flex; gap: 2px; color: var(--miss); }
.lives .icon { width: 17px; height: 17px; }
.lives .icon.lost { color: var(--azo-line); }
.score { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- layout: one column on phones, deck + panel side by side on wide screens ---------- */
.game { display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 820px) and (min-height: 560px) {
  .game {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) minmax(360px, 420px);
    grid-template-areas: "deck panel" "deck log";
    grid-template-rows: auto 1fr;
    column-gap: 40px;
    align-items: start;
    margin-top: 12px;
  }
  .deck { grid-area: deck; position: sticky; top: 16px; padding-top: 8px; }
  .panel { grid-area: panel; }
  .log { grid-area: log; }
  :root { --disc: clamp(260px, 52vh, 380px); }
}

/* ---------- the disc ---------- */
.deck { display: flex; flex-direction: column; align-items: center; }
.disc {
  position: relative;
  width: var(--disc); height: var(--disc);
  margin: 6px auto 0;
  padding: 0; border: 0; border-radius: 50%;
  background: transparent;
  box-shadow: 0 22px 46px -18px rgba(6, 2, 30, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.disc:focus-visible { outline: 3px solid var(--hit); outline-offset: 6px; }
.disc-spin, .disc-face, .disc-rings, .disc-writing { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; }
.disc-face {
  background:
    radial-gradient(circle closest-side, transparent 0 27%, rgba(255, 255, 255, 0.55) 27.5% 28.4%, transparent 28.6%),
    radial-gradient(circle closest-side, rgba(226, 228, 238, 0.5) 0 27%, transparent 27.2%),
    repeating-radial-gradient(circle closest-side, rgba(255, 255, 255, 0.08) 0 0.6%, rgba(26, 16, 70, 0.05) 0.6% 1.2%),
    conic-gradient(from 210deg, #d3d5de, #f4f5f8 7%, #bdeee5 13%, #d6cbf6 19%, #f6d8e9 25%, #e8e9ef 33%, #c3c6d2 47%, #f1f2f6 58%, #c1e6f4 66%, #dfcef6 72%, #f5e2c9 79%, #d6d8e1 88%, #d3d5de);
  -webkit-mask: radial-gradient(circle closest-side, transparent 0 8.3%, #000 8.6%);
  mask: radial-gradient(circle closest-side, transparent 0 8.3%, #000 8.6%);
}
.disc-hand { font-family: var(--font-hand); fill: var(--chrome-ink); }
.disc-hand-top { font-size: 19px; letter-spacing: 1.5px; }
.disc-hand-bottom { font-size: 34px; }
.disc-rings { pointer-events: none; }
.ring { fill: none; stroke: transparent; transition: stroke 0.4s ease; }
.ring.is-open { stroke: rgba(92, 58, 205, 0.36); }
.ring.is-current { stroke: rgba(92, 58, 205, 0.56); }
.groove { fill: none; stroke: rgba(30, 20, 84, 0.2); stroke-width: 0.6; }
.sweep { fill: none; stroke: rgba(94, 229, 208, 0.82); }
.rim-sweep { fill: none; stroke: var(--hit); stroke-width: 3.5; }
.disc[data-outcome="win"] .ring.is-open { stroke: rgba(44, 190, 170, 0.42); }
.disc[data-outcome="partial"] .ring.is-open { stroke: rgba(240, 180, 50, 0.4); }
.disc[data-outcome="loss"] .ring.is-open { stroke: rgba(255, 70, 140, 0.34); }
.disc-hub {
  position: absolute; left: 50%; top: 50%;
  width: 24%; height: 24%;
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--azo-deep);
  color: var(--ink);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5), 0 6px 16px rgba(5, 2, 28, 0.55);
  transition: background 0.2s ease, transform 0.15s ease;
}
.disc:hover .disc-hub { background: #2a2168; }
.disc:active .disc-hub { transform: translate(-50%, -50%) scale(0.94); }
.disc-hub > * { grid-area: 1 / 1; }
.disc-hub .icon { width: 42%; height: 42%; }
.hub-play { margin-left: 6%; }
.hub-stop, .hub-spinner { display: none; }
.disc[data-state="playing"] .hub-play { display: none; }
.disc[data-state="playing"] .hub-stop { display: block; }
.disc[data-state="loading"] .hub-play { display: none; }
.disc[data-state="loading"] .hub-spinner { display: block; }
.disc[data-state="error"] .disc-hub { color: var(--miss); }
.hub-spinner { width: 38%; height: 38%; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.25); border-top-color: var(--ink); animation: spin 0.9s linear infinite; }
.disc[data-state="playing"] .disc-spin { animation: spin 2.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.ladder { display: flex; justify-content: center; gap: 2px; margin: 16px 0 0; padding: 0; list-style: none; }
.ladder li { min-width: 38px; padding: 3px 7px; border-radius: 999px; text-align: center; font-size: 13px; font-weight: 600; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.ladder li.is-open { color: var(--ink-dim); }
.ladder li.is-current { background: var(--chrome); color: var(--chrome-ink); }
.deck-row { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 6px; min-height: 34px; }
.time { min-width: 52px; font-size: 13px; color: var(--ink-faint); font-variant-numeric: tabular-nums; text-align: right; }
#volume { width: 96px; accent-color: var(--chrome); }

/* ---------- guessing panel ---------- */
.panel { min-width: 0; }
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.slot { position: relative; padding: 6px 2px 8px; border-bottom: 2px dashed var(--azo-line); min-width: 0; }
.slot-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-faint); }
.slot-value { display: block; min-height: 30px; font: 400 23px/1.25 var(--font-hand); color: var(--ink); overflow-wrap: anywhere; }
.slot.is-current { border-bottom: 2px solid var(--chrome); }
.slot.is-current .slot-label { color: var(--ink); }
.slot.is-solved { border-bottom: 2px solid var(--hit); }
.slot.is-solved .slot-label { color: var(--hit); }
.slot.is-missed { border-bottom: 2px solid var(--miss); }
.slot.is-missed .slot-value { color: var(--ink-dim); }

.clues { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; padding: 0; list-style: none; }
.clues:empty { display: none; }
.clue { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 6px 10px; border-radius: 10px; background: rgba(247, 199, 90, 0.12); color: #fbe3a6; font-size: 14px; }
.clue .icon { width: 16px; height: 16px; color: var(--half); }
.clue-boxes { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.clue-word { display: inline-flex; gap: 2px; }
.clue-word i { display: block; width: 9px; height: 14px; border-bottom: 2px solid #fbe3a6; }
.clue-play { border: 0; background: var(--half); color: var(--chrome-ink); border-radius: 8px; padding: 3px 10px; font-weight: 700; font-size: 13px; }

.form-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.guess-form label { font-weight: 600; font-size: 15px; }
.side-actions { display: flex; gap: 6px; }
.input-row { display: flex; gap: 8px; }
.combo { position: relative; flex: 1; min-width: 0; }
#guess {
  width: 100%; height: 50px;
  padding: 0 14px;
  border: 1px solid var(--azo-line); border-radius: 12px;
  background: var(--azo-deep);
  font-size: 17px;
}
#guess::placeholder { color: var(--ink-faint); }
#guess:focus { outline: none; border-color: var(--chrome); box-shadow: 0 0 0 3px rgba(230, 232, 240, 0.15); }
#guess.shake { animation: shake 0.3s ease; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.suggestions {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: 4px; list-style: none;
  border: 1px solid var(--azo-line); border-radius: 12px;
  background: var(--azo-raise);
  box-shadow: 0 16px 34px rgba(5, 2, 28, 0.6);
}
.suggestions li { padding: 10px 12px; border-radius: 8px; cursor: pointer; }
/* Phones: open upward so the keyboard never hides the list. */
@media (max-width: 819px) {
  .suggestions { top: auto; bottom: calc(100% + 4px); display: flex; flex-direction: column-reverse; }
  .suggestions li { padding: 12px; }
}
.suggestions li[aria-selected="true"], .suggestions li:hover { background: rgba(230, 232, 240, 0.12); }
.suggestions mark { background: none; color: var(--hit); font-weight: 700; }


.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 14px;
  border-radius: 12px; border: 1px solid var(--azo-line);
  background: transparent; color: var(--ink);
  font-weight: 600; font-size: 15px; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--chrome); border-color: var(--chrome); color: var(--chrome-ink); }
.btn-primary:hover:not(:disabled) { background: #ffffff; }
.btn small { font-size: 13px; font-weight: 600; color: var(--ink-faint); }
.btn .badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: rgba(247, 199, 90, 0.18); color: var(--half); font-size: 13px; }
.btn.wide { width: 100%; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
#guessBtn { min-height: 50px; min-width: 96px; }
.notice { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: rgba(255, 98, 163, 0.12); color: #ffc2dc; font-size: 14px; }

/* ---------- log ---------- */
.first-tip { margin: 6px 0 0; font-size: 14px; color: var(--ink-faint); }
@media (min-width: 820px) and (min-height: 560px) { .first-tip { grid-area: log; } }
.log { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.log:empty { display: none; }
.log li { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 4px 12px; border-radius: 10px; background: rgba(20, 15, 53, 0.55); font-size: 15px; }
.log .icon { width: 18px; height: 18px; }
.log .log-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log .log-field { font-size: 12px; color: var(--ink-faint); }
.log .is-wrong .icon, .log li.is-wrong .icon { color: var(--miss); }
.log li.is-right .icon { color: var(--hit); }
.log li.is-skip { color: var(--ink-dim); }
.log li.is-hint { color: #fbe3a6; background: rgba(247, 199, 90, 0.07); }
.log li.is-hint .icon { color: var(--half); }

/* ---------- round over ---------- */
.done { padding-top: 2px; }
.verdict { margin: 0; font-weight: 700; font-size: 15px; }
.verdict.win { color: var(--hit); }
.verdict.partial { color: var(--half); }
.verdict.loss { color: var(--miss); }
.answer { margin: 6px 0 2px; display: flex; flex-direction: column; }
.answer-artist { font: 400 22px/1.2 var(--font-hand); color: var(--ink-dim); }
.answer-title { font: 400 42px/1.05 var(--font-hand); color: var(--ink); overflow-wrap: anywhere; }
.share-row { margin: 10px 0 0; font-size: 22px; letter-spacing: 3px; min-height: 1em; }
.done-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.done-actions .btn { flex: 1 1 140px; }
.listen { margin: 14px 0 0; font-size: 14px; color: var(--ink-dim); }
.listen a { color: var(--ink); font-weight: 600; text-underline-offset: 3px; margin-left: 8px; }
.next-up { margin: 16px 0 0; padding-top: 14px; border-top: 1px dashed var(--azo-line); font-size: 14px; color: var(--ink-dim); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.countdown { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.run-score { font: 400 56px/1 var(--font-hand); margin: 6px 0; }
.stamp { display: inline-block; margin-left: 8px; padding: 1px 8px; border: 2px solid currentColor; border-radius: 6px; transform: rotate(-4deg); font: 400 18px/1.2 var(--font-hand); }

/* ---------- lanes, challenges, Blitz ---------- */
.lanes { display: flex; align-items: center; gap: 6px; overflow-x: auto; margin: 2px 0 8px; padding-bottom: 2px; scrollbar-width: none; }
.lanes::-webkit-scrollbar { display: none; }
.lanes-label { flex: none; font-size: 13px; color: var(--ink-faint); }
.lane { flex: none; border: 1px solid var(--azo-line); background: transparent; color: var(--ink-dim); border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 600; }
.lane small { margin-left: 5px; color: var(--ink-faint); font-size: 12px; }
.lane[aria-pressed="true"] { background: var(--chrome); border-color: var(--chrome); color: var(--chrome-ink); }
.lane[aria-pressed="true"] small { color: var(--chrome-ink); opacity: 0.6; }
.lane.is-leaks { border-style: dashed; }

.vs-banner { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: rgba(94, 229, 208, 0.1); color: #c9f6ee; font-size: 14px; }
.vs-banner .icon { color: var(--hit); width: 18px; height: 18px; }
.versus { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; border: 1px solid rgba(94, 229, 208, 0.35); background: rgba(94, 229, 208, 0.06); }
.vs-call { margin: 0 0 6px; font: 400 24px/1.1 var(--font-hand); }
.vs-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--ink-dim); }
.vs-row b { color: var(--ink); font-weight: 600; }

.blitz { padding-top: 4px; }
.blitz-title { margin: 0; font: 400 44px/1 var(--font-hand); }
.blitz-copy { margin: 8px 0 14px; color: var(--ink-dim); max-width: 38ch; }
.blitz .btn .icon, .done-actions .icon { width: 18px; height: 18px; }
.blitz-clock { display: inline-block; margin-left: 8px; padding: 1px 10px; border-radius: 999px; background: var(--chrome); color: var(--chrome-ink); font-variant-numeric: tabular-nums; font-weight: 700; }
body.is-blitz .ladder, body.is-blitz .time { display: none; }

/* ---------- crate ---------- */
.crate-top { margin-bottom: 14px; }
.crate-count { margin: 0; font: 400 30px/1.1 var(--font-hand); }
.crate-bar { height: 8px; margin: 10px 0 8px; border-radius: 999px; background: var(--azo-deep); overflow: hidden; }
.crate-bar span { display: block; height: 100%; background: var(--hit); }
.crate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.crate-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px 12px; border: 0; border-radius: 12px; background: transparent; text-align: center; min-width: 0; }
.crate-item:hover:not(:disabled) { background: rgba(255, 255, 255, 0.05); }
.crate-item:disabled { cursor: default; }
.mini-disc {
  width: 72px; height: 72px; margin-bottom: 4px; border-radius: 50%;
  background:
    radial-gradient(circle closest-side, var(--azo-deep) 0 22%, rgba(255, 255, 255, 0.6) 23% 26%, transparent 27%),
    radial-gradient(circle closest-side, transparent 0 34%, rgba(92, 58, 205, 0.35) 35% 96%, transparent 97%),
    conic-gradient(from 210deg, #d3d5de, #f4f5f8 7%, #bdeee5 13%, #d6cbf6 19%, #f6d8e9 25%, #e8e9ef 33%, #c3c6d2 47%, #f1f2f6 58%, #c1e6f4 66%, #dfcef6 72%, #f5e2c9 79%, #d3d5de);
  box-shadow: 0 8px 18px -8px rgba(5, 2, 28, 0.8);
}
.crate-item.is-full .mini-disc { background:
    radial-gradient(circle closest-side, var(--azo-deep) 0 22%, rgba(255, 255, 255, 0.6) 23% 26%, transparent 27%),
    radial-gradient(circle closest-side, transparent 0 34%, rgba(44, 190, 170, 0.38) 35% 96%, transparent 97%),
    conic-gradient(from 210deg, #d3d5de, #f4f5f8 7%, #bdeee5 13%, #d6cbf6 19%, #f6d8e9 25%, #e8e9ef 33%, #c3c6d2 47%, #f1f2f6 58%, #c1e6f4 66%, #dfcef6 72%, #f5e2c9 79%, #d3d5de); }
.crate-item.is-half .mini-disc { filter: saturate(0.5) brightness(0.85); }
.crate-item.is-locked .mini-disc { background: var(--azo-deep); border: 2px dashed var(--azo-line); box-shadow: none; }
.crate-item.is-playing .mini-disc { animation: spin 2.6s linear infinite; }
.crate-artist { font-size: 12px; color: var(--ink-dim); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crate-title { font: 400 19px/1.1 var(--font-hand); max-width: 100%; overflow-wrap: anywhere; }
.crate-item.is-locked .crate-title { color: var(--ink-faint); }
.crate-best { font-size: 11px; font-weight: 700; color: var(--hit); }
.crate-best.leak { color: var(--half); }
.field-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--ink-dim); }
#nameInput { width: 100%; height: 46px; margin-bottom: 14px; padding: 0 12px; border: 1px solid var(--azo-line); border-radius: 10px; background: var(--azo-deep); font-size: 16px; }

/* ---------- toast + sheets ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  padding: 10px 16px; border-radius: 999px;
  background: var(--chrome); color: var(--chrome-ink);
  font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

dialog.sheet {
  width: min(460px, calc(100vw - 24px));
  max-height: min(680px, calc(100dvh - 32px));
  padding: 0; border: 1px solid var(--azo-line); border-radius: 18px;
  background: var(--azo-raise); color: var(--ink);
  box-shadow: 0 30px 80px rgba(5, 2, 28, 0.7);
}
dialog.sheet[open] { display: flex; flex-direction: column; }
dialog.sheet::backdrop { background: rgba(10, 6, 32, 0.66); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 6px 20px; }
.sheet-head h2 { margin: 0; font: 400 28px/1.1 var(--font-hand); }
.sheet-body { padding: 4px 20px 20px; overflow-y: auto; }
.sheet-body p { margin: 0 0 12px; }
@media (max-width: 560px) {
  dialog.sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
}

.help-lede { font-size: 17px; }
.help-ladder { display: flex; gap: 4px; margin: 0 0 14px; }
.help-ladder span { flex: 1; text-align: center; padding: 6px 0; border-radius: 8px; background: rgba(92, 58, 205, 0.35); font-size: 13px; font-weight: 700; }
.help-rules { margin: 0 0 14px; padding-left: 18px; }
.help-rules li { margin-bottom: 8px; }
.fine { font-size: 14px; color: var(--ink-dim); }

.stat-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 18px; text-align: center; }
.stat-nums b { display: block; font: 400 34px/1.1 var(--font-hand); }
.stat-nums span { font-size: 13px; color: var(--ink-dim); }
.dist-title { margin: 0 0 8px; font-weight: 700; font-size: 15px; }
.dist { display: grid; grid-template-columns: auto 1fr; gap: 5px 10px; align-items: center; margin-bottom: 18px; }
.dist-label { font-size: 13px; color: var(--ink-dim); font-variant-numeric: tabular-nums; text-align: right; }
.dist-bar { min-width: 26px; padding: 2px 8px; border-radius: 6px; background: rgba(92, 58, 205, 0.45); text-align: right; font-size: 13px; font-weight: 700; }
.dist-bar.is-today { background: var(--hit); color: var(--chrome-ink); }
.endless-best { padding-top: 14px; border-top: 1px dashed var(--azo-line); color: var(--ink-dim); font-size: 15px; }
.endless-best b { color: var(--ink); }

.archive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.day {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px; border-radius: 12px;
  border: 1px solid var(--azo-line); background: var(--azo-deep);
  text-align: left;
}
.day:hover { border-color: var(--ink-faint); }
.day-num { font: 400 22px/1 var(--font-hand); }
.day-date { font-size: 12px; color: var(--ink-faint); }
.day-mark { font-size: 12px; font-weight: 700; margin-top: 4px; color: var(--ink-faint); }
.day.win { border-color: rgba(94, 229, 208, 0.5); }
.day.win .day-mark { color: var(--hit); }
.day.partial .day-mark { color: var(--half); }
.day.loss .day-mark { color: var(--miss); }
.day.today { border-color: var(--chrome); }
.archive-empty { color: var(--ink-dim); }

.hint-list { display: flex; flex-direction: column; gap: 8px; }
.hint-option { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--azo-line); background: var(--azo-deep); text-align: left; }
.hint-option:hover:not(:disabled) { border-color: var(--half); }
.hint-option:disabled { opacity: 0.45; cursor: not-allowed; }
.hint-option .icon { width: 20px; height: 20px; color: var(--half); }
.hint-option b { display: block; font-size: 16px; }
.hint-option span span { font-size: 13px; color: var(--ink-dim); }
.hint-left { margin: 0 0 12px; color: var(--ink-dim); }
#shareText { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--azo-line); background: var(--azo-deep); font-size: 15px; }

/* ---------- empty / error state ---------- */
.empty { max-width: 520px; margin: 18vh auto 0; text-align: center; }
.empty h2 { font: 400 34px/1.1 var(--font-hand); margin: 0 0 10px; }
.empty p { color: var(--ink-dim); }
.empty code { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .disc[data-state="playing"] .disc-spin { animation: none; }
}
@media (max-width: 380px) {
  .logo { font-size: 26px; }
  .seg button { padding: 6px 11px; }
  .btn { padding: 0 10px; }
  #guessBtn { min-width: 78px; }
}
