:root {
  --bg: #100d09;
  --surface: #1c1712;
  --surface-2: #241d15;
  --amber: #d97706;
  --amber-light: #f2a93c;
  --gold: #d4af37;
  --felt: #1f7a4d;
  --felt-dark: #124430;
  --cream: #f3ead8;
  --muted: #a89a82;
  --border: rgba(243, 234, 216, 0.14);
  --danger: #e05252;
  --success: #3fae76;
  --radius: 14px;
  --font-display: 'Cinzel', serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  background:
    radial-gradient(ellipse at top, rgba(31, 122, 77, 0.14), transparent 55%),
    radial-gradient(ellipse at bottom, rgba(217, 119, 6, 0.08), transparent 55%),
    var(--bg);
  color: var(--cream);
  font-family: var(--font-body);
  line-height: 1.5;
  font-size: 16px;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.01em; margin: 0 0 0.4em; }
h1 { font-size: clamp(1.5rem, 2.2vw + 1rem, 2.2rem); color: var(--amber-light); }
h2 { font-size: 1.15rem; color: var(--gold); }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
code { background: var(--surface-2); padding: 0.15em 0.45em; border-radius: 6px; font-size: 0.9em; }
a { color: var(--amber-light); cursor: pointer; }

.view { max-width: 720px; margin: 0 auto; padding: 2rem 1.25rem 4rem; min-height: 100vh; }
.view[hidden] { display: none !important; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.8rem 1.25rem; background: linear-gradient(180deg, var(--surface), var(--bg));
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.topbar-brand { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-display); color: var(--amber-light); font-size: 1rem; }
.topbar-suit { color: var(--felt); }
.topbar-player { display: flex; align-items: center; gap: 0.75rem; font-size: 0.85rem; color: var(--muted); }

.btn {
  font-family: var(--font-body); font-weight: 600; border-radius: 10px; border: 1px solid transparent;
  padding: 0.7rem 1.4rem; font-size: 0.95rem; cursor: pointer; min-height: 44px;
  transition: transform 120ms ease, box-shadow 150ms ease, background 150ms ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, var(--amber-light), var(--amber)); color: #1a1207; box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35); }
.btn-primary:disabled { background: var(--surface-2); color: var(--muted); box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--cream); }
.btn-ghost:hover { border-color: var(--amber); color: var(--amber-light); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-small { padding: 0.4rem 0.85rem; min-height: 36px; font-size: 0.8rem; }
.btn-wide { display: block; width: 100%; text-align: center; }

.input, select.input, textarea.input {
  font-family: var(--font-body); background: var(--surface-2); border: 1px solid var(--border);
  color: var(--cream); border-radius: 10px; padding: 0.65rem 0.85rem; font-size: 1rem; min-height: 44px; width: 100%;
}
textarea.input { min-height: 64px; resize: vertical; }
.input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--amber-light); outline-offset: 2px; }
.input-code { text-align: center; letter-spacing: 0.15em; text-transform: uppercase; font-family: var(--font-display); font-size: 1.2rem; }

.error { color: var(--danger); font-size: 0.9rem; }

/* landing */
.landing-suit { color: var(--felt); letter-spacing: 0.4em; text-align: center; margin-bottom: 0.5rem; }
.landing-tag { text-align: center; color: var(--muted); margin-bottom: 1.5rem; }
.flight-blurb { border-left: 2px solid var(--felt); padding-left: 0.75rem; margin-bottom: 0.75rem; font-size: 0.95rem; }
.flight-blurb b { color: var(--cream); }

/* login */
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 2.5rem 2rem; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
.login-card form { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1.25rem; }

/* tease */
.tease-card { text-align: center; padding-top: 1rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.78rem; color: var(--felt); font-weight: 600; margin-bottom: 0.4rem; }
.tagline { font-style: italic; color: var(--cream); margin: 1rem 0; }

/* listen */
.listen-view { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 80vh; text-align: center; }
#listenVisualizer { margin: 1rem auto; }

/* bottle cards */
.bottle-grid { display: grid; gap: 1.1rem; }
.bottle-card { background: linear-gradient(160deg, var(--surface), var(--surface-2)); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; }
.bottle-card-label { display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--felt-dark); border: 1px solid var(--felt); color: var(--gold); font-family: var(--font-display); font-weight: 700; margin-bottom: 0.6rem; }
.field-label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0.8rem 0 0.3rem; }
.candidate-note { display: block; font-size: 0.72rem; color: var(--muted); margin-top: 0.15rem; }
.stars { display: flex; gap: 0.25rem; }
.star { background: none; border: none; font-size: 1.5rem; color: var(--border); cursor: pointer; padding: 0; min-height: 40px; min-width: 30px; }
.star.filled { color: var(--gold); }

.lock-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1rem 0; flex-wrap: wrap; }
.countdown { font-family: var(--font-display); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.45rem 0.9rem; font-size: 0.9rem; color: var(--amber-light); }
.countdown.urgent { color: var(--danger); }

/* waiting */
.waiting-card { text-align: center; padding-top: 1rem; }
.wax-seal { width: 50px; height: 50px; border-radius: 50%; margin: 0 auto 1rem; background: radial-gradient(circle at 35% 30%, var(--amber-light), var(--amber) 60%, #7a3d02 100%); display: flex; align-items: center; justify-content: center; color: #2a1600; font-size: 1.3rem; }
.count-row { font-size: 0.9rem; color: var(--muted); margin-top: 1rem; }
.progress-row { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--muted); justify-content: center; margin-top: 0.4rem; }

/* reveal */
.reveal-bottle { display: flex; align-items: center; gap: 0.9rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
.reveal-bottle:last-child { border-bottom: none; }
.reveal-verdict { font-size: 1.2rem; width: 1.4rem; text-align: center; }
.reveal-verdict.ok { color: var(--success); }
.reveal-verdict.no { color: var(--danger); }
.score-pill { font-family: var(--font-display); background: var(--felt-dark); border: 1px solid var(--felt); color: var(--gold); border-radius: 999px; padding: 0.25rem 0.8rem; font-size: 0.85rem; }

/* leaderboard */
.leaderboard-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-rank { font-family: var(--font-display); color: var(--gold); width: 1.5rem; }
.leaderboard-total { margin-left: auto; font-family: var(--font-display); color: var(--amber-light); }

/* crown */
.crown-view { text-align: center; padding-top: 3rem; }
.crown-emoji { font-size: 2.2rem; margin-bottom: 0.5rem; }

/* history */
.history-list a { display: block; padding: 0.4rem 0; }

@media (prefers-reduced-motion: reduce) {
  .btn, .star { transition: none; animation: none; }
}
