/* ─────────────────────────────────────────────────────────────
   TOKENS
───────────────────────────────────────────────────────────── */
:root {
  --ink: #16130f;
  --ink-2: #1e1a14;
  --graphite: #2a2521;
  --graphite-2: #352f28;
  --paper: #efe6d2;
  --paper-dim: rgba(239, 230, 210, 0.55);
  --paper-faint: rgba(239, 230, 210, 0.12);
  --amber: #e8a33d;
  --amber-dim: rgba(232, 163, 61, 0.18);
  --teal: #3f8c82;
  --teal-dim: rgba(63, 140, 130, 0.18);
  --cherry: #c1443b;
  --cherry-dim: rgba(193, 68, 59, 0.18);

  --font-display: "Anton", "Arial Narrow", sans-serif;
  --font-body: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;

  --radius: 14px;
}

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

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
}

body {
  background-image:
    radial-gradient(circle at 20% 0%, rgba(232, 163, 61, 0.06), transparent 45%),
    radial-gradient(circle at 80% 100%, rgba(63, 140, 130, 0.05), transparent 45%);
}

button { font-family: inherit; }

.app-shell {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 20px 32px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.hidden { display: none !important; }

/* ── Typography ─────────────────────────────────────────────── */

.wordmark {
  font-family: var(--font-display);
  font-size: 3rem;
  letter-spacing: 0.04em;
  color: var(--amber);
  text-transform: uppercase;
  margin: 0 0 4px;
  line-height: 0.95;
}

.subtitle {
  color: var(--paper-dim);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 28px;
}

h2 {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 1.5rem;
  margin: 0 0 16px;
  color: var(--paper);
}

label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--paper-dim);
  margin-bottom: 6px;
}

.hint {
  font-size: 0.8rem;
  color: var(--paper-dim);
  line-height: 1.5;
}

.mono { font-family: var(--font-mono); }

/* ── Buttons & fields ───────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 20px;
  border-radius: var(--radius);
  border: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--amber); color: var(--ink); }
.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost {
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--paper-faint);
}
.btn-ghost:hover { border-color: var(--paper-dim); }

.btn-teal { background: var(--teal); color: var(--ink); }

.btn-row { display: flex; gap: 10px; margin-top: 8px; }

input[type="text"], input[type="number"] {
  width: 100%;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid var(--paper-faint);
  background: var(--ink-2);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 1rem;
  margin-bottom: 14px;
}
input:focus {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}

.field-group { margin-bottom: 20px; }

/* ── Login screen ───────────────────────────────────────────── */

#screen-login { flex: 1; display: flex; flex-direction: column; justify-content: center; }

.dial {
  width: 120px; height: 120px;
  border-radius: 50%;
  border: 3px solid var(--amber);
  margin: 0 auto 28px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.dial::before {
  content: "";
  width: 8px; height: 34px;
  background: var(--amber);
  border-radius: 4px;
  position: absolute;
  top: 14px;
  transform-origin: bottom center;
  animation: tune 5s ease-in-out infinite;
}
@keyframes tune {
  0%, 100% { transform: rotate(-35deg); }
  50% { transform: rotate(35deg); }
}

.error-box {
  background: var(--cherry-dim);
  border: 1px solid var(--cherry);
  color: var(--paper);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* ── Setup screen ───────────────────────────────────────────── */

.playlist-row {
  display: flex; gap: 8px; margin-bottom: 8px;
}
.playlist-row input { margin-bottom: 0; }

.playlist-chip {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--ink-2);
  border: 1px solid var(--paper-faint);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}
.playlist-chip .count { color: var(--teal); font-family: var(--font-mono); font-size: 0.8rem; }

.team-row {
  display: flex; gap: 8px; align-items: center; margin-bottom: 10px;
}
.team-row .swatch {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.team-row input { margin-bottom: 0; }
.icon-btn {
  background: none; border: none; color: var(--paper-dim);
  font-size: 1.1rem; cursor: pointer; padding: 6px;
}

.target-row {
  display: flex; align-items: center; gap: 12px;
}
.target-row input[type="number"] { width: 80px; margin-bottom: 0; }

/* ── Handoff screen ─────────────────────────────────────────── */

#screen-handoff {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  border-radius: var(--radius);
  padding: 40px 24px;
}
.handoff-eyebrow {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.15em;
  color: var(--paper-dim); margin-bottom: 10px;
}
.handoff-team {
  font-family: var(--font-display);
  font-size: 2.6rem;
  text-transform: uppercase;
  margin: 0 0 6px;
}
.handoff-score {
  font-family: var(--font-mono);
  color: var(--paper-dim);
  margin-bottom: 32px;
}
.handoff-warn { font-size: 0.85rem; color: var(--paper-dim); margin-top: 24px; }

.tone-amber { color: var(--amber); }
.tone-teal { color: var(--teal); }
.tone-cherry { color: var(--cherry); }
.tone-paper { color: var(--paper); }

.bg-amber { background: var(--amber-dim); }
.bg-teal { background: var(--teal-dim); }
.bg-cherry { background: var(--cherry-dim); }
.bg-paper { background: var(--paper-faint); }

/* ── Play / mystery disc ────────────────────────────────────── */

#screen-play { flex: 1; display: flex; flex-direction: column; }

.deck-counter {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--paper-dim);
  text-align: center;
  margin-bottom: 18px;
}

.mystery-disc {
  width: 180px; height: 180px;
  border-radius: 50%;
  margin: 0 auto 20px;
  background: repeating-radial-gradient(circle, var(--graphite) 0px, var(--graphite) 3px, var(--graphite-2) 3px, var(--graphite-2) 6px);
  border: 4px solid var(--ink-2);
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.mystery-disc::after {
  content: "?";
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--amber);
}
.mystery-disc.spinning { animation: spin 3s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.transport {
  display: flex; justify-content: center; gap: 16px; margin-bottom: 28px;
}
.transport-btn {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--amber); color: var(--ink);
  border: none; font-size: 1.3rem; cursor: pointer;
}

/* ── Timeline / tape strip ──────────────────────────────────── */

.timeline-label {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--paper-dim); margin-bottom: 10px;
}

.timeline-strip {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  padding: 6px 2px 14px;
  -webkit-overflow-scrolling: touch;
}

.ticket {
  flex: 0 0 auto;
  width: 92px;
  background: var(--graphite);
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
  position: relative;
  margin: 0 2px;
}
.ticket::before, .ticket::after {
  content: "";
  position: absolute; left: 0; right: 0; height: 6px;
  background-image: radial-gradient(circle, var(--ink) 2.5px, transparent 2.6px);
  background-size: 10px 10px;
  background-repeat: repeat-x;
}
.ticket::before { top: -3px; }
.ticket::after { bottom: -3px; }

.ticket .year {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--amber);
  font-size: 1rem;
}
.ticket .meta {
  font-size: 0.65rem;
  color: var(--paper-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 4px;
}

.gap {
  flex: 0 0 auto;
  width: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.gap .splice {
  width: 2px; height: 60%;
  border-left: 2px dashed var(--paper-faint);
  transition: border-color 0.15s ease;
}
.gap:hover .splice, .gap:focus-visible .splice { border-color: var(--amber); }
.gap.active .splice {
  border-left: 2px dashed var(--amber);
  box-shadow: 0 0 8px var(--amber);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
.gap:first-child, .gap:last-child { width: 34px; }

.empty-timeline-note {
  font-size: 0.85rem;
  color: var(--paper-dim);
  padding: 20px 0;
  text-align: center;
}

/* ── Result screen ──────────────────────────────────────────── */

#screen-result { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; }

.result-banner {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 1.8rem;
  margin-bottom: 20px;
}
.result-banner.correct { color: var(--teal); }
.result-banner.wrong { color: var(--cherry); }

.reveal-art {
  width: 140px; height: 140px;
  border-radius: 10px;
  object-fit: cover;
  margin: 0 auto 16px;
  background: var(--graphite);
}
.reveal-year {
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--amber);
}
.reveal-title { font-weight: 700; margin-top: 4px; }
.reveal-artist { color: var(--paper-dim); margin-bottom: 24px; }

/* ── Game over ──────────────────────────────────────────────── */

#screen-gameover { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; }
.winner-name {
  font-family: var(--font-display);
  font-size: 2.4rem;
  text-transform: uppercase;
  color: var(--amber);
  margin: 8px 0 24px;
}
.final-standings { text-align: left; margin-bottom: 28px; }
.standing-row {
  display: flex; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--paper-faint);
  font-family: var(--font-mono); font-size: 0.9rem;
}

/* ── Misc ───────────────────────────────────────────────────── */

.top-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.top-nav .mono { font-size: 0.75rem; color: var(--paper-dim); }

.center-note { text-align: center; color: var(--paper-dim); font-size: 0.9rem; margin: 40px 0; }
