/* Hitster Mobile — one phone, passed around a table. Light and dark. */

:root {
  --paper: #F7F6F2;
  --surface: #FFFFFF;
  --ink: #1D1B22;
  --muted: #6A6675;
  --line: #E2DFDA;
  --accent: #D6336C;
  --accent-ink: #FFFFFF;
  --accent-soft: #FBE7EF;
  --good: #1F7A4D;
  --good-soft: #E4F3EB;
  --bad: #C03A2B;
  --bad-soft: #F9E7E4;
  --token: #94610F;
  --token-soft: #FAEFDC;
  --card-face: #26232E;
  --card-text: #F5F2EE;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17151C;
    --surface: #211E28;
    --ink: #ECE9F1;
    --muted: #9B95A8;
    --line: #37333F;
    --accent: #F0568A;
    --accent-ink: #1D1B22;
    --accent-soft: #3A2230;
    --good: #4FBC87;
    --good-soft: #1E3229;
    --bad: #E06A5B;
    --bad-soft: #3A241F;
    --token: #E8A13C;
    --token-soft: #382D1B;
    --card-face: #2C2836;
    --card-text: #F5F2EE;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

.screen {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: calc(16px + env(safe-area-inset-top))
    calc(18px + env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom))
    calc(18px + env(safe-area-inset-left));
}
.hidden { display: none !important; }

h1, h2, h3 { margin: 0; text-wrap: balance; }
h2 { font-family: "Unbounded", sans-serif; font-size: 1.15rem; font-weight: 700; }
h3 {
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 10px;
}
p { margin: 0; }
.muted { color: var(--muted); font-size: 0.92rem; }
.center { text-align: center; }
code {
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-size: 0.82em;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  word-break: break-all;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 18px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.small { font-size: 0.88rem; padding: 8px 14px; border-radius: 10px; }
.btn.big { font-size: 1.1rem; padding: 16px 18px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Panels & forms ──────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
input[type="text"], input[type="search"] {
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  width: 100%;
}
select {
  font-family: inherit;
  font-size: 1rem; /* below 16px, iOS Safari zooms the page on focus */
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}
details summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
details ol { margin: 10px 0 0; padding-left: 20px; font-size: 0.9rem; color: var(--muted); }
details li { margin-bottom: 8px; }

.error {
  background: var(--bad-soft);
  color: var(--bad);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.92rem;
}
.warn { color: var(--token); font-size: 0.92rem; }
.health { color: var(--good); font-weight: 600; }

/* ── Home ────────────────────────────────────────────── */
.home-hero { text-align: center; padding: 26px 0 6px; }
.wordmark {
  font-family: "Unbounded", sans-serif;
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-top: 14px;
}
.wordmark-sub {
  display: block;
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 2px;
}
.tagline { color: var(--muted); margin-top: 12px; font-size: 0.95rem; }
.demo-link { margin-top: auto; align-self: center; color: var(--muted); }

/* Vinyl disc */
.disc-mark, .disc {
  width: 120px; height: 120px;
  margin: 0 auto;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at 50% 50%,
      var(--card-face) 0 5px, #3A3644 5px 6px);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.disc-mark.small { width: 84px; height: 84px; }
.disc-hole {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  border: 4px solid var(--paper);
}
.disc-mark.small .disc-hole { width: 26px; height: 26px; }
.disc { width: 168px; height: 168px; }
.disc .disc-hole { width: 46px; height: 46px; }
.disc.spinning { animation: spin 1.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .disc.spinning { animation: none; }
}

/* ── Header bars ─────────────────────────────────────── */
.bar { display: flex; align-items: center; gap: 12px; }
.bar h2 { flex: 1; }
.center-head { justify-content: center; text-align: center; }

/* ── Playlist picker ─────────────────────────────────── */
.deck-list { display: flex; flex-direction: column; gap: 8px; }
.deck-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px 10px 10px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  cursor: pointer;
}
.deck-row:active { transform: scale(0.99); }
.deck-art {
  width: 52px; height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--accent-soft);
}
.deck-art.liked {
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 1.4rem;
}
.deck-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-count {
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── Deck build ──────────────────────────────────────── */
.deck-name { text-align: center; font-weight: 600; font-size: 1.05rem; }
.progress {
  height: 10px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: var(--accent);
  transition: width 0.25s ease;
}

/* ── Table setup ─────────────────────────────────────── */
.player-row {
  display: grid;
  grid-template-columns: 40px 1fr 44px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.color-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid var(--line);
  cursor: pointer;
  padding: 0;
}
.player-x {
  font-size: 1.2rem;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
}
.rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 0.98rem;
}
.rule-row.toggle input {
  width: 22px; height: 22px;
  accent-color: var(--accent);
}

/* ── Pass screen ─────────────────────────────────────── */
.screen.pass { justify-content: center; text-align: center; }
.pass-inner { display: flex; flex-direction: column; gap: 18px; align-items: center; }
.pass-label {
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.pass-name {
  font-family: "Unbounded", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  /* Blend the player color toward the ink so every palette entry stays
     readable as text on both grounds; raw hex stays for dots and borders. */
  color: var(--pcolor, var(--accent));
  color: color-mix(in srgb, var(--pcolor, var(--accent)) 65%, var(--ink) 35%);
}
.scoreboard {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
}
.score-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 5px 12px;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.score-chip.active { border-color: var(--pcolor, var(--accent)); }
.score-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pcolor, var(--accent)); }
.score-chip b { font-family: "Spline Sans Mono", ui-monospace, monospace; font-weight: 600; }
.score-chip .toks { color: var(--token); }
.cashin-note { color: var(--good); font-size: 0.92rem; max-width: 34ch; }
.endgame { margin-top: 26px; color: var(--muted); }
#pass-start { width: 100%; }

/* ── Turn screen ─────────────────────────────────────── */
.turn-head { display: flex; align-items: baseline; justify-content: space-between; }
.turn-who {
  font-family: "Unbounded", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--pcolor, var(--accent));
  color: color-mix(in srgb, var(--pcolor, var(--accent)) 65%, var(--ink) 35%);
}
.toks {
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  color: var(--token);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}
.listen { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 6px 0; }
.listen .btn { min-width: 150px; }
.listen-extras { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.call {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 34ch;
  cursor: pointer;
}
.call input { width: 20px; height: 20px; accent-color: var(--token); flex-shrink: 0; margin-top: 1px; }

/* ── Timeline ────────────────────────────────────────── */
.tl {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 14px 4px 18px;
  -webkit-overflow-scrolling: touch;
}
.tl-card {
  flex: 0 0 auto;
  width: 92px;
  min-height: 116px;
  border-radius: 12px;
  background: var(--card-face);
  color: var(--card-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.tl-card .y {
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tl-card .t {
  font-size: 0.68rem;
  line-height: 1.3;
  color: var(--card-text);
  opacity: 0.75;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tl-card.just-added { outline: 3px solid var(--good); animation: pop 0.4s ease; }
@keyframes pop { from { transform: scale(0.85); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .tl-card.just-added { animation: none; }
}
.tl-slot {
  flex: 0 0 auto;
  width: 40px;
  height: 116px;
  border: 2px dashed var(--line);
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font-size: 1.3rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tl-slot.selected {
  border-color: var(--accent);
  border-style: solid;
  color: var(--accent);
  background: var(--accent-soft);
}
.tl-slot:disabled { opacity: 0.35; cursor: default; }

.lock-bar {
  position: sticky;
  bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
.lock-claim { flex: 1; font-size: 0.9rem; color: var(--muted); }

/* ── Steal screen ────────────────────────────────────── */
.steal-list { display: flex; flex-direction: column; gap: 8px; }
.steal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  cursor: pointer;
}
.steal-row .score-dot { flex-shrink: 0; }
.steal-row .name { flex: 1; text-align: left; font-weight: 600; }
.steal-row .state { font-size: 0.85rem; color: var(--muted); }
.steal-row.committed { border-color: var(--token); }
.steal-row.committed .state { color: var(--token); font-weight: 600; }
#steal-cancel { align-self: center; }

/* ── Reveal ──────────────────────────────────────────── */
.flip-scene { perspective: 900px; padding: 10px 0 0; }
.flip-card {
  position: relative;
  width: 210px;
  height: 270px;
  margin: 0 auto;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.flip-card.flipped { transform: rotateY(180deg); }
@media (prefers-reduced-motion: reduce) {
  .flip-card { transition: none; }
}
.flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
}
.flip-back {
  background: var(--card-face);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.flip-front {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  transform: rotateY(180deg);
}
.reveal-art {
  width: 110px; height: 110px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--accent-soft);
}
.reveal-title { font-weight: 600; font-size: 0.98rem; line-height: 1.25; }
.reveal-artist { color: var(--muted); font-size: 0.85rem; }
.reveal-year {
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.verdicts { display: flex; flex-direction: column; gap: 6px; }
.verdict {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.92rem;
}
.verdict.good { background: var(--good-soft); color: var(--good); }
.verdict.bad { background: var(--bad-soft); color: var(--bad); }
.verdict b { font-weight: 600; }

.call-judge {
  background: var(--token-soft);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.92rem;
  color: var(--token);
}
.call-btns { display: flex; gap: 10px; }

/* ── Game over ───────────────────────────────────────── */
.over-hero { text-align: center; padding: 24px 0 4px; }
.superla { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.superla-chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 0.85rem;
  color: var(--muted);
}
.superla-chip b { color: var(--ink); font-weight: 600; }
.final-boards { display: flex; flex-direction: column; gap: 16px; }
.final-board .fb-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 2px;
}
.final-board .fb-head .count {
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.85rem;
}

/* ── Toast ───────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  border-radius: 99px;
  padding: 10px 20px;
  font-size: 0.9rem;
  max-width: 90vw;
  text-align: center;
  z-index: 50;
}
