/* Hook, Line & Singer — living-room-TV friendly: big type, high contrast, two record sides. */

:root {
  --bg: #15112b;
  --bg-2: #211a45;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-2: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.16);
  --ink: #fbf5e6;
  --muted: #c0b9de;
  --gold: #ffd166;
  --good: #5fe08f;
  --bad: #ff6b6b;
  --a: #ff7a59;          /* Side A: coral */
  --a-deep: #c2412a;
  --b: #36cfc9;          /* Side B: teal */
  --b-deep: #12827d;
  --danger: #e63946;
  --radius: 16px;
  --font-display: "Rockwell", "Roboto Slab", "Cambria", Georgia, serif;
  --font-body: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: clamp(16px, 0.85vw + 9px, 30px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; overscroll-behavior-y: contain; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(ellipse 60% 45% at 50% -10%, rgba(255, 209, 102, 0.18), transparent 70%),
    radial-gradient(ellipse 50% 60% at 0% 100%, rgba(255, 122, 89, 0.12), transparent 70%),
    radial-gradient(ellipse 50% 60% at 100% 100%, rgba(54, 207, 201, 0.12), transparent 70%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  background-attachment: fixed;
  line-height: 1.4;
}

#app {
  max-width: 1500px;
  margin: 0 auto;
  padding: max(0.6rem, env(safe-area-inset-top)) max(1.2rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1.2rem, env(safe-area-inset-left));
}

code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 0.9em; background: var(--panel-2); padding: 0.05em 0.35em; border-radius: 6px; }

/* ---------- Top bar ---------- */

#topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.2rem 0 0.6rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em; }
.brand-disc {
  width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: radial-gradient(circle, var(--gold) 0 18%, #111 19% 22%, #222 23% 100%);
  box-shadow: 0 0 0 2px #000 inset;
}
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
.chip { font-size: 0.7rem; padding: 0.25rem 0.6rem; border-radius: 999px; background: var(--panel); color: var(--muted); white-space: nowrap; }
.chip.status-samples { color: var(--good); }
.chip.status-synth, .chip.status-unavailable { color: var(--gold); }
.chip.status-test { color: #2a1c00; background: var(--gold); font-weight: 700; }

/* ---------- Buttons ---------- */

.btn {
  font: inherit; font-weight: 600; color: var(--ink);
  background: var(--panel-2); border: 2px solid var(--line); border-radius: 12px;
  padding: 0.55rem 1.1rem; cursor: pointer; touch-action: manipulation;
  transition: transform 0.08s, background 0.15s, border-color 0.15s;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.18); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:focus-visible, .pkey-bid:focus-visible, .buzzer:focus-visible, input:focus-visible { outline: 4px solid var(--gold); outline-offset: 3px; }
.btn-primary { background: var(--gold); color: #2a1c00; border-color: var(--gold); }
.btn-primary:hover:not(:disabled) { background: #ffdd85; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #f0525e; }
.btn-ghost { background: transparent; }
.btn-big { font-size: 1.2rem; padding: 0.75rem 1.6rem; border-radius: 14px; }
.btn-small { font-size: 0.75rem; padding: 0.3rem 0.7rem; border-radius: 9px; }
.actions { display: flex; gap: 0.8rem; flex-wrap: wrap; align-items: center; justify-content: center; margin: 1rem 0; }

/* ---------- Screens ---------- */

.screen { display: none; animation: fade-in 0.3s ease; }
.screen.active { display: block; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.screen-title { font-family: var(--font-display); font-size: 2rem; margin: 0.4rem 0; text-align: center; }
.sub { text-align: center; color: var(--muted); margin: 0.2rem 0 0.8rem; }
.notice { background: var(--panel); border-left: 5px solid var(--muted); padding: 0.6rem 0.9rem; border-radius: 10px; max-width: 52rem; margin: 0.6rem auto; }
.notice.warn { border-left-color: var(--gold); }
.notice.test { border-left-color: var(--gold); background: rgba(255, 209, 102, 0.14); }
.notice.big { font-size: 1.3rem; text-align: center; }
.msg { min-height: 1.4em; color: var(--gold); text-align: center; }
.hint, .controls-hint { color: var(--muted); font-size: 0.75rem; text-align: center; }
.field-label { display: block; font-weight: 600; margin: 0.4rem 0; }

/* ---------- Side tags (colour + icon + words) ---------- */

.side-tag { display: inline-flex; align-items: center; gap: 0.35em; font-weight: 700; padding: 0.1em 0.55em; border-radius: 999px; white-space: nowrap; }
.side-tag.side-a { background: rgba(255, 122, 89, 0.2); color: #ffb39f; box-shadow: inset 0 0 0 2px var(--a); }
.side-tag.side-b { background: rgba(54, 207, 201, 0.18); color: #9df0ec; box-shadow: inset 0 0 0 2px var(--b); }
.side-name { color: var(--ink); font-weight: 600; }
.side-name::before { content: "\00b7"; margin-right: 0.35em; opacity: 0.6; }

/* ---------- Vinyl record ---------- */

.vinyl {
  --size: 15rem;
  width: var(--size); height: var(--size); border-radius: 50%; position: relative; flex: none;
  background:
    radial-gradient(circle, transparent 0 34%, rgba(255, 255, 255, 0.05) 34.5% 35%, transparent 35.5%),
    repeating-radial-gradient(circle, #151515 0 2px, #222 2px 3px, #181818 3px 5px),
    #111;
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.55), inset 0 0 0 3px #000;
  display: grid; place-items: center;
}
.vinyl::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 20deg, transparent 0 15%, rgba(255, 255, 255, 0.12) 20%, transparent 26% 63%, rgba(255, 255, 255, 0.09) 68%, transparent 74%);
}
.vinyl-label {
  width: 42%; height: 42%; border-radius: 50%; position: relative; z-index: 1;
  background: radial-gradient(circle, #ffe08f, var(--gold) 60%, #e9a92b);
  color: #3a2500; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 0.6rem; overflow: hidden;
}
.vl-title { font-family: var(--font-display); font-weight: 700; font-size: 0.85rem; line-height: 1.1; }
.vl-artist, .vl-year { font-size: 0.55rem; opacity: 0.85; }
.vl-hole { position: absolute; width: 8%; height: 8%; border-radius: 50%; background: var(--bg); top: 46%; left: 46%; }
.vinyl.spinning { animation: spin 2.2s linear infinite; }
.vinyl.logo { --size: 13rem; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.install-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 0.9rem; flex-wrap: wrap;
  max-width: 42rem; margin: 1rem auto 0.2rem; padding: 0.75rem 1rem; border-radius: var(--radius);
  background: var(--panel); box-shadow: inset 0 0 0 2px rgba(255, 209, 102, 0.45);
  text-align: left;
}
.install-text { display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.9rem; flex: 1 1 14rem; }
.install-text strong { color: var(--gold); }

.judge-override { margin: 0.7rem 0; font-size: 0.9rem; }
.judge-override summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.notice.good { border-left-color: var(--good); }

/* ---------- Welcome ---------- */

.welcome { text-align: center; padding: 1.5rem 0; }
.game-title { font-family: var(--font-display); font-size: 3.6rem; margin: 1rem 0 0.2rem; letter-spacing: 0.01em; text-shadow: 0 0.2rem 0 rgba(0, 0, 0, 0.35); }
.tagline { color: var(--muted); font-size: 1.15rem; margin: 0; }
.help { max-width: 46rem; margin: 0.6rem auto; color: var(--muted); font-size: 0.85rem; }

/* ---------- Setup ---------- */

.side-cards { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; max-width: 62rem; margin: 1rem auto; }
.side-card { background: var(--panel); border-radius: var(--radius); padding: 1rem 1.2rem; border-top: 8px solid; }
.side-card.side-a { border-color: var(--a); }
.side-card.side-b { border-color: var(--b); }
.side-card-head { font-size: 1.2rem; margin-bottom: 0.3rem; }
.name-input, .answer-input {
  width: 100%; font: inherit; font-size: 1.4rem; color: var(--ink);
  background: rgba(0, 0, 0, 0.3); border: 2px solid var(--line); border-radius: 12px; padding: 0.55rem 0.8rem;
}
.answer-input:disabled { opacity: 0.7; }
.played-note { min-height: 1.3em; color: var(--muted); font-size: 0.8rem; margin-top: 0.4rem; }
.vs { font-family: var(--font-display); font-size: 1.6rem; color: var(--muted); }
.fresh { max-width: 52rem; margin: 0.5rem auto; text-align: center; padding: 0.7rem 1rem; border-radius: 12px; background: var(--panel); }
.fresh.good { box-shadow: inset 0 0 0 2px rgba(95, 224, 143, 0.5); }
.fresh.warn { box-shadow: inset 0 0 0 2px rgba(255, 209, 102, 0.6); }
.fresh-count { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; color: var(--gold); margin-right: 0.2em; vertical-align: -0.1em; }

/* ---------- Scoreboard ---------- */

.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 1rem; margin-bottom: 0.6rem; }
.sb-side { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding-top: 0.4rem; }
.spot { position: absolute; top: -1.2rem; width: 13rem; height: 11rem; pointer-events: none; opacity: 0; transition: opacity 0.4s;
  background: radial-gradient(ellipse 50% 100% at 50% 0%, rgba(255, 240, 200, 0.35), transparent 75%); clip-path: polygon(38% 0, 62% 0, 100% 100%, 0 100%); }
.sb-side.active .spot { opacity: 1; }
.record {
  width: 6.2rem; height: 6.2rem; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: repeating-radial-gradient(circle, #141414 0 2px, #262626 2px 3px), #111;
  box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.5), inset 0 0 0 2px #000;
}
.record::after { content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 10deg, transparent 0 18%, rgba(255, 255, 255, 0.14) 22%, transparent 27% 66%, rgba(255, 255, 255, 0.1) 70%, transparent 75%); }
.record-label { width: 56%; height: 56%; border-radius: 50%; display: grid; place-items: center; position: relative; z-index: 1; }
.side-a .record-label { background: radial-gradient(circle, #ffad94, var(--a) 70%, var(--a-deep)); }
.side-b .record-label { background: radial-gradient(circle, #93f2ee, var(--b) 70%, var(--b-deep)); }
.score { font-family: var(--font-display); font-weight: 800; font-size: 1.7rem; color: #1a1030; }
.record.spinning { animation: spin 3s linear infinite; }
.record.spinning .score { animation: spin 3s linear infinite reverse; }   /* keep the number upright */
.sb-turn { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); min-height: 1.1em; }
.baton { position: absolute; top: 0.6rem; left: calc(50% + 3.4rem); width: 3.2rem; height: 0.5rem; transform-origin: 0 50%; animation: wave 1.2s ease-in-out infinite; z-index: 2; }
.side-b .baton { left: auto; right: calc(50% + 3.4rem); transform-origin: 100% 50%; animation-name: wave-b; }
.baton-stick { position: absolute; inset: 0.15rem 0 0.15rem 0.6rem; background: #fff; border-radius: 2px; }
.side-b .baton-stick { inset: 0.15rem 0.6rem 0.15rem 0; }
.baton-handle { position: absolute; left: 0; top: -0.1rem; width: 0.8rem; height: 0.7rem; border-radius: 40%; background: #8b5a2b; }
.side-b .baton-handle { left: auto; right: 0; }
@keyframes wave { 0%, 100% { transform: rotate(160deg); } 50% { transform: rotate(200deg); } }
@keyframes wave-b { 0%, 100% { transform: rotate(-160deg); } 50% { transform: rotate(-200deg); } }

.measure { text-align: center; padding-bottom: 1.4rem; }
.measure-text { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; margin-bottom: 0.4rem; }
.bars { display: flex; align-items: stretch; height: 1.6rem; border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); justify-content: center;
  background: repeating-linear-gradient(180deg, transparent 0 calc(25% - 1px), var(--line) calc(25% - 1px) 25%); }
.bar { width: 1.6rem; border-left: 2px solid var(--muted); position: relative; }
.bar.done::after { content: "\2669"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 1rem; }
.bar.current { background: rgba(255, 209, 102, 0.35); }
.final-bar { width: 0.5rem; border-left: 2px solid var(--muted); border-right: 5px solid var(--muted); }
.bars.sudden .final-bar { border-color: var(--gold); }

/* ---------- Bidding ---------- */

.turn-banner {
  display: flex; align-items: center; justify-content: center; gap: 0.6rem; text-align: center;
  font-size: 1.45rem; font-weight: 700; padding: 0.6rem 1rem; border-radius: var(--radius); margin: 0.2rem 0 0.8rem;
  animation: pulse-in 0.4s ease;
}
.turn-banner.side-a { background: linear-gradient(90deg, rgba(255, 122, 89, 0.35), rgba(255, 122, 89, 0.12)); box-shadow: inset 0 0 0 3px var(--a); }
.turn-banner.side-b { background: linear-gradient(90deg, rgba(54, 207, 201, 0.12), rgba(54, 207, 201, 0.32)); box-shadow: inset 0 0 0 3px var(--b); }
.turn-banner .side-icon { font-size: 1.6rem; }
.side-a .side-icon { color: var(--a); }
.side-b .side-icon { color: var(--b); }
@keyframes pulse-in { from { transform: scale(0.97); opacity: 0.4; } to { transform: none; opacity: 1; } }

.clues { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem; margin-bottom: 0.9rem; perspective: 1200px; }
.clue-card { min-height: 7.2rem; }
/* Both faces share one grid cell, so the card grows to fit the longer face (the clue text). */
.clue-inner { display: grid; width: 100%; height: 100%; min-height: 7.2rem; transition: transform 0.7s cubic-bezier(0.3, 1.4, 0.5, 1); transform-style: preserve-3d; }
.clue-card.revealed .clue-inner { transform: rotateY(180deg); }
.clue-face { grid-area: 1 / 1; border-radius: var(--radius); backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0.7rem 1rem; text-align: center; overflow-wrap: anywhere; }
.clue-back {
  background:
    repeating-linear-gradient(0deg, transparent 0 0.9rem, rgba(255, 255, 255, 0.08) 0.9rem calc(0.9rem + 1px)),
    linear-gradient(135deg, #3a2f74, #2a2257);
  box-shadow: inset 0 0 0 2px var(--line); color: var(--muted);
}
.clue-front { transform: rotateY(180deg); background: linear-gradient(160deg, #fff7e0, #f6e3b4); color: #2b1d00; box-shadow: 0 0.5rem 1.4rem rgba(0, 0, 0, 0.35); }
.clue-label { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; }
.clue-front .clue-label { color: #8a5a00; margin-bottom: 0.3rem; }
.clue-note { font-size: 2rem; line-height: 1.1; }
.clue-when { font-size: 0.7rem; }
.clue-text { font-size: 1.15rem; font-weight: 600; line-height: 1.25; }

.bid-board { background: var(--panel); border-radius: var(--radius); padding: 0.7rem 1rem 0.9rem; margin-bottom: 0.9rem; }
.bid-board-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.3rem; }
.lowest { font-size: 1.1rem; }
.turn-count { color: var(--muted); font-weight: 600; }

.staff {
  position: relative; display: flex; align-items: center; padding: 0 0.6rem;
  background: repeating-linear-gradient(180deg, transparent 0 calc(1.1rem - 2px), rgba(255, 255, 255, 0.45) calc(1.1rem - 2px) 1.1rem);
  background-size: 100% 5.5rem; background-repeat: no-repeat; background-position: 0 1.1rem;
  height: 7.8rem;
}
.clef { font-size: 5.6rem; line-height: 1; margin-right: 0.6rem; margin-top: 0.4rem; color: var(--ink); font-family: "Segoe UI Symbol", "Noto Music", "Bravura", serif; }
.bid-notes { flex: 1; display: grid; grid-template-columns: repeat(10, 1fr); align-items: center; height: 100%; }
.bid-note { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: opacity 0.4s; }
.head { display: block; width: 1.9rem; height: 1.35rem; border-radius: 50%; transform: rotate(-20deg); background: var(--ink); margin-top: 1.6rem; }
.stem { position: absolute; width: 3px; height: 3.3rem; background: var(--ink); left: calc(50% + 0.82rem); top: calc(50% - 2.75rem); }
.num { position: absolute; bottom: -0.3rem; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.bid-note.open .head, .bid-note.open .stem { background: rgba(255, 255, 255, 0.85); }
.bid-note.kept.side-a .head, .bid-note.kept.side-a .stem { background: var(--a); }
.bid-note.kept.side-b .head, .bid-note.kept.side-b .stem { background: var(--b); }
.bid-note.erased { opacity: 0.13; }
.bid-note.erasing { animation: erase 0.75s ease forwards; }
.bid-note.erasing::after {
  content: ""; position: absolute; width: 2.6rem; height: 1.4rem; border-radius: 4px; top: 40%;
  background: linear-gradient(90deg, #f7a1b6 0 70%, #8ab4f8 70%); animation: rub 0.75s ease forwards;
}
@keyframes erase { 0% { opacity: 1; filter: none; } 60% { opacity: 0.6; filter: blur(2px); } 100% { opacity: 0.13; filter: blur(0); } }
@keyframes rub { 0% { transform: translateX(-0.8rem) rotate(-15deg); opacity: 1; } 25% { transform: translateX(0.8rem) rotate(-15deg); }
  50% { transform: translateX(-0.8rem) rotate(-15deg); } 75% { transform: translateX(0.8rem) rotate(-15deg); opacity: 1; } 100% { opacity: 0; } }

.move-log { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; margin-top: 0.6rem; }
.move-chip { font-size: 0.8rem; font-weight: 600; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--panel-2); }
.move-chip.side-a { box-shadow: inset 0 0 0 2px var(--a); }
.move-chip.side-b { box-shadow: inset 0 0 0 2px var(--b); }

.bid-controls { display: grid; grid-template-columns: 1fr auto auto; gap: 1.5rem; align-items: center; }
.controls-label { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; margin-bottom: 0.4rem; }
.bid-keys { position: relative; display: grid; grid-template-columns: repeat(10, 1fr); height: 9rem; background: #0c0a17; padding: 0.4rem 0.3rem 0.3rem; border-radius: 12px; border-top: 0.6rem solid #3a1d10; }
.pkey-bid {
  font: inherit; position: relative; border: 1px solid #b7b0a0; border-radius: 0 0 9px 9px; margin: 0 1px; cursor: pointer;
  background: linear-gradient(180deg, #fffdf6 0%, #f2ecdd 88%, #d9d1bd 100%);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 0.5rem;
  box-shadow: 0 4px 0 #a69d88; transition: transform 0.06s, box-shadow 0.06s, background 0.15s;
}
.pkey-bid:hover:not(:disabled) { background: linear-gradient(180deg, #fff, #fff3cf 88%, #f3d98c 100%); }
.pkey-bid:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #a69d88; }
.pkey-bid:disabled { cursor: not-allowed; background: linear-gradient(180deg, #6b6878, #55525f); box-shadow: 0 4px 0 #3a3843; border-color: #3a3843; }
.key-num { font-family: var(--font-display); font-weight: 800; font-size: 1.7rem; color: #2a1c00; }
.pkey-bid:disabled .key-num { color: #8f8c99; text-decoration: line-through; text-decoration-thickness: 3px; }
.pkey-black { position: absolute; top: 0.4rem; width: 5.6%; height: 46%; margin-left: -2.8%; background: linear-gradient(180deg, #333, #000); border-radius: 0 0 5px 5px; pointer-events: none; box-shadow: 0 3px 0 #000; }
.pkey-black:nth-of-type(1) { margin-left: -2.5%; }

.move-chip.pass { background: transparent; font-style: italic; }

.pass-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.pass-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem; width: 9rem; min-height: 6.5rem; }
.pass-title { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; line-height: 1; }
.pass-sub { font-size: 0.85rem; font-weight: 600; opacity: 0.85; }
.pass-btn:disabled { cursor: not-allowed; opacity: 0.45; }

.buzzer-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.buzzer {
  width: 11rem; height: 11rem; border-radius: 50%; cursor: pointer; border: none; padding: 0;
  background: radial-gradient(circle at 35% 30%, #ff8c8c, var(--danger) 45%, #8f0f1a 100%);
  box-shadow: 0 0.6rem 0 #5a0710, 0 0 0 0.6rem #2b2b33, 0 0 0 0.8rem #555, 0 1.2rem 2rem rgba(0, 0, 0, 0.5);
  transition: transform 0.08s, box-shadow 0.08s;
}
.buzzer:not(:disabled) { animation: buzz-glow 1.6s ease-in-out infinite; }
.buzzer:active:not(:disabled) { transform: translateY(0.45rem); box-shadow: 0 0.15rem 0 #5a0710, 0 0 0 0.6rem #2b2b33, 0 0 0 0.8rem #555; }
.buzzer:disabled { cursor: not-allowed; filter: grayscale(0.85) brightness(0.6); }
.buzzer-cap { display: block; font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); padding: 0 1rem; line-height: 1.1; }
@keyframes buzz-glow { 0%, 100% { filter: none; } 50% { filter: brightness(1.15) drop-shadow(0 0 0.8rem rgba(255, 80, 80, 0.6)); } }

/* ---------- Listen / steal ---------- */

.listen { text-align: center; max-width: 62rem; margin: 0 auto; }
.listen-head { font-family: var(--font-display); font-size: 2rem; margin: 0.4rem 0; }
.listen-sub { font-size: 1.3rem; margin: 0.4rem 0 1rem; }
.steal-flash {
  font-family: var(--font-display); font-size: 4rem; margin: 0.2rem 0; letter-spacing: 0.08em; color: var(--gold);
  text-shadow: 0 0 1.2rem rgba(255, 209, 102, 0.6); animation: steal-in 0.9s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes steal-in { from { transform: scale(0.3) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
.listen.steal { border-radius: var(--radius); }

.counter { background: var(--panel); border-radius: var(--radius); padding: 0.6rem 1rem 0.8rem; margin: 0 auto 1rem; }
.counter-staff .slots { flex: 1; display: flex; justify-content: space-around; align-items: center; height: 100%; }
.slot { position: relative; height: 100%; width: 2.6rem; display: flex; justify-content: center; align-items: center; }
.slot .head { background: transparent; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25); margin-top: 1.6rem; }
.slot .stem { opacity: 0; }
.slot.on .head { background: var(--ink); box-shadow: none; animation: pop 0.35s cubic-bezier(0.2, 2, 0.4, 1); }
.slot.on .stem { opacity: 1; }
.side-a .slot.on .head, .side-a .slot.on .stem { background: var(--a); }
.side-b .slot.on .head, .side-b .slot.on .stem { background: var(--b); }
@keyframes pop { from { transform: rotate(-20deg) scale(0.1); } to { transform: rotate(-20deg) scale(1); } }
.barline.end { width: 0.5rem; height: 4.4rem; border-left: 2px solid rgba(255, 255, 255, 0.45); border-right: 5px solid rgba(255, 255, 255, 0.45); margin-top: 0.4rem; }
.counter-label { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; }

.answer-form { max-width: 44rem; margin: 0 auto; }
.answer-row { display: flex; gap: 0.7rem; }
.answer-row .btn { font-size: 1.2rem; }

.verdict { max-width: 44rem; margin: 1rem auto; padding: 1rem 1.2rem; border-radius: var(--radius); background: var(--panel); animation: pulse-in 0.35s ease; }
.verdict.is-correct { box-shadow: inset 0 0 0 3px var(--good); }
.verdict.is-wrong { box-shadow: inset 0 0 0 3px var(--bad); }
.verdict-head { font-family: var(--font-display); font-size: 2.2rem; font-weight: 800; }
.is-correct .verdict-head { color: var(--good); }
.is-wrong .verdict-head { color: var(--bad); }
.verdict-answer { font-size: 1.15rem; margin: 0.3rem 0; }
.verdict-title { font-size: 1.2rem; }
.verdict-note { color: var(--muted); font-size: 0.85rem; }
.judge { display: flex; align-items: center; justify-content: center; gap: 0.7rem; margin: 0.8rem 0; flex-wrap: wrap; }
.judge-label { font-weight: 700; color: var(--muted); }

/* ---------- Lightning Round ---------- */

.bar.lt { background: rgba(255, 209, 102, 0.07); }
.bar.lt.done::after { content: "\26A1"; font-size: 0.8rem; }
.bar.lt-first { border-left-width: 5px; border-left-color: var(--gold); }
.bar.lt.current { background: rgba(255, 209, 102, 0.4); }

kbd { font-family: Consolas, "Cascadia Mono", monospace; font-weight: 700; font-size: 0.9em; padding: 0.05em 0.45em; border-radius: 6px;
  background: var(--panel-2); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.35), 0 0 0 1px var(--line); }

.lt-intro { max-width: 52rem; margin: 0 auto; text-align: center; }
.lt-title { font-family: var(--font-display); font-size: 3.4rem; margin: 0.3rem 0; color: var(--gold);
  text-shadow: 0 0 1.4rem rgba(255, 209, 102, 0.55); animation: steal-in 0.9s cubic-bezier(0.2, 1.6, 0.4, 1); }
.lt-lead { font-size: 1.3rem; }
.lt-rules { text-align: left; font-size: 1.1rem; line-height: 1.5; background: var(--panel); border-radius: var(--radius); padding: 1rem 1.4rem 1rem 2.6rem; }
.lt-rules li { margin: 0.35rem 0; }

/* Two tall STOP buttons on the outside edges, the song in the middle. */
.lightning { display: grid; grid-template-columns: minmax(9rem, 1fr) minmax(0, 3fr) minmax(9rem, 1fr); gap: 1.2rem; align-items: stretch; min-height: 62vh; }
.lt-center { text-align: center; display: flex; flex-direction: column; justify-content: flex-start; min-width: 0; }
.lt-kicker { font-family: var(--font-display); font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); font-size: 1rem; }
.lt-clue { background: linear-gradient(160deg, #fff7e0, #f6e3b4); color: #2b1d00; border-radius: var(--radius); padding: 1rem 1.4rem; margin: 0.6rem 0 1rem;
  box-shadow: 0 0.5rem 1.4rem rgba(0, 0, 0, 0.35); }
.lt-clue .clue-label { color: #8a5a00; }
.lt-clue-text { font-size: 1.5rem; font-weight: 600; line-height: 1.3; margin: 0.4rem 0 0; overflow-wrap: anywhere; }
.lt-play { font-size: 1.5rem; padding: 0.9rem 2.2rem; }
.lt-clock { font-family: var(--font-display); font-size: 4.5rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 0.4rem; }
.lt-track { height: 0.8rem; border-radius: 999px; background: var(--panel-2); overflow: hidden; margin: 0.6rem auto; max-width: 40rem; width: 100%; }
.lt-progress { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), #ff9f43); }
.lt-prompt { font-size: 1.3rem; font-weight: 700; }
.lightning.stealing .lt-progress { background: linear-gradient(90deg, var(--gold), var(--bad)); }

.stop-btn {
  font: inherit; color: #fff; cursor: pointer; border: none; border-radius: 1.4rem; padding: 1rem 0.6rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.7rem;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform 0.06s, filter 0.15s, opacity 0.15s;
}
.stop-btn.side-a { background: radial-gradient(circle at 40% 30%, #ff9a7f, var(--a) 45%, var(--a-deep) 100%); box-shadow: 0 0.5rem 0 #7a2414, 0 1rem 2rem rgba(0, 0, 0, 0.45); }
.stop-btn.side-b { background: radial-gradient(circle at 40% 30%, #7fe6e1, var(--b) 45%, var(--b-deep) 100%); box-shadow: 0 0.5rem 0 #0a4f4b, 0 1rem 2rem rgba(0, 0, 0, 0.45); }
.stop-btn .side-tag { background: rgba(0, 0, 0, 0.3); color: #fff; }
.stop-word { font-family: var(--font-display); font-weight: 900; font-size: 2.8rem; letter-spacing: 0.06em; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.3); }
.stop-key { font-size: 0.85rem; opacity: 0.9; }
.stop-btn.live { animation: stop-glow 1.1s ease-in-out infinite; }
.stop-btn.live:active { transform: translateY(0.4rem); }
.stop-btn:disabled { cursor: default; filter: grayscale(0.8) brightness(0.55); }
.stop-btn.pressed:disabled { filter: none; outline: 0.35rem solid var(--gold); outline-offset: 0.3rem; }
.stop-btn:focus-visible { outline: 4px solid var(--gold); outline-offset: 3px; }
@keyframes stop-glow { 0%, 100% { filter: none; } 50% { filter: brightness(1.18) drop-shadow(0 0 1rem rgba(255, 255, 255, 0.35)); } }

.say-it { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; margin-top: 0.4rem; animation: pulse-in 0.3s ease; }
.say-ring { --p: 1; width: 10rem; height: 10rem; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--ring) calc(var(--p) * 360deg), var(--panel-2) 0); }
.side-a .say-ring { --ring: var(--a); }
.side-b .say-ring { --ring: var(--b); }
.say-num { width: 8rem; height: 8rem; border-radius: 50%; background: var(--bg); display: grid; place-items: center;
  font-family: var(--font-display); font-size: 4.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.say-label { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; }
.say-sub { color: var(--muted); font-size: 1.05rem; }
.final-songs .lt-mark { color: var(--gold); }

/* ---------- Reveal ---------- */

.reveal { max-width: 70rem; margin: 0 auto; }
.round-result { text-align: center; font-size: 1.5rem; font-weight: 800; padding: 0.5rem; border-radius: var(--radius); background: var(--panel); margin-bottom: 1rem; animation: pulse-in 0.4s ease; }
.round-result.none { color: var(--muted); }
.reveal-main { display: flex; gap: 2rem; align-items: center; justify-content: center; margin-bottom: 1.2rem; }
.reveal-art { flex: none; }
.reveal-art .vinyl { --size: 16rem; }
.sleeve { width: 16rem; height: 16rem; border-radius: 6px; overflow: hidden; box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.15); background: #000; animation: pulse-in 0.5s ease; }
.sleeve img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reveal-text { max-width: 36rem; }
.reveal-kicker { text-transform: uppercase; letter-spacing: 0.15em; font-size: 0.8rem; color: var(--muted); font-weight: 700; }
.reveal-title { font-family: var(--font-display); font-size: 2.8rem; margin: 0.1rem 0 0.2rem; line-height: 1.05; }
.reveal-artist { font-size: 1.25rem; color: var(--gold); margin: 0 0 0.6rem; }
.reveal-fact { font-size: 1.05rem; background: var(--panel); border-radius: 12px; padding: 0.6rem 0.9rem; }
.answers { list-style: none; padding: 0; margin: 0.6rem 0 0; display: grid; gap: 0.35rem; font-size: 0.95rem; }
.answers .mark { font-weight: 800; }
.answers .right .mark { color: var(--good); }
.answers .wrong .mark { color: var(--bad); }
.judged { color: var(--muted); font-size: 0.8rem; }
.answers .judge-btn { margin-left: 0.5rem; vertical-align: middle; }
.judge-settings { text-align: left; }
.judge-settings .answer-input { width: 100%; font-size: 1rem; }
.judge-settings .actions { justify-content: flex-end; margin-top: 0.8rem; }
.check-row { display: flex; align-items: center; gap: 0.5rem; margin: 0.8rem 0 0.4rem; font-weight: 600; cursor: pointer; }
.verdict-ai { font-size: 0.95rem; color: var(--muted); margin: 0.2rem 0; }
.checking { color: var(--muted); font-weight: 600; animation: pulse-in 0.6s ease infinite alternate; }

.piano { position: relative; display: flex; height: 7rem; background: #0c0a17; padding: 0.3rem; border-radius: 12px; border-top: 0.5rem solid #3a1d10; }
.pk.white { position: relative; height: 100%; background: linear-gradient(180deg, #fffdf6, #ece5d3); border: 1px solid #aaa; border-radius: 0 0 6px 6px; transition: background 0.08s; }
.pk.black { position: absolute; top: 0.3rem; height: 58%; background: linear-gradient(180deg, #333, #000); border-radius: 0 0 4px 4px; z-index: 1; transition: background 0.08s; }
.pk.white.lit { background: linear-gradient(180deg, #fff4c4, var(--gold)); }
.pk.black.lit { background: linear-gradient(180deg, #ffd166, #c98a00); }
.pk-label { position: absolute; bottom: 0.25rem; width: 100%; text-align: center; font-size: 0.55rem; color: #777; }

/* ---------- Final ---------- */

.final { text-align: center; max-width: 60rem; margin: 0 auto; }
.final-head { font-family: var(--font-display); font-size: 3.2rem; margin: 0.6rem 0 0.2rem; }
.final-reason { color: var(--muted); font-size: 1.15rem; margin: 0 0 1rem; }
.final-scores { display: flex; gap: 2.5rem; align-items: center; justify-content: center; margin: 1rem 0; }
.final-side { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.final-side .record { width: 10rem; height: 10rem; }
.final-side .score { font-size: 2.6rem; }
.record.gold { background: repeating-radial-gradient(circle, #b8860b 0 2px, #ffd166 2px 3px, #d4a017 3px 5px); box-shadow: 0 0 2rem rgba(255, 209, 102, 0.6); }
.gold-text { font-family: var(--font-display); font-weight: 800; color: var(--gold); font-size: 1.2rem; }
.final-songs { text-align: left; background: var(--panel); border-radius: var(--radius); padding: 0.6rem 1.4rem; }
.final-songs h3 { font-family: var(--font-display); margin: 0.3rem 0; }
.final-songs ol { margin: 0.3rem 0 0.6rem; padding-left: 1.6rem; display: grid; gap: 0.3rem; }
.song-result { margin-left: 0.6rem; font-size: 0.85rem; color: var(--muted); }

/* ---------- Song Library ---------- */

.library-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.library-head .actions { margin: 0; }
.lib-section { background: var(--panel); border-radius: var(--radius); padding: 0.5rem 1rem 0.8rem; margin: 1rem 0; }
.lib-section h3 { font-family: var(--font-display); margin: 0.4rem 0; }
.table-scroll { overflow-x: auto; }
.lib-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.lib-table th, .lib-table td { text-align: left; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.lib-table th { color: var(--muted); font-weight: 700; }
.lib-title { font-weight: 700; }
.lib-artist { color: var(--muted); }
.lib-msgs { margin: 0; padding-left: 1.1rem; }
.status-chip { display: inline-block; font-weight: 800; font-size: 0.7rem; padding: 0.15rem 0.55rem; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.05em; }
.status-chip.st-ok { background: rgba(95, 224, 143, 0.2); color: var(--good); }
.status-chip.st-warning { background: rgba(255, 209, 102, 0.2); color: var(--gold); }
.status-chip.st-invalid { background: rgba(255, 107, 107, 0.2); color: var(--bad); }
.status-chip.st-duplicate { background: rgba(192, 185, 222, 0.2); color: var(--muted); }
.status-chip.st-ok::before { content: "\2714 "; }
.status-chip.st-warning::before { content: "! "; }
.status-chip.st-invalid::before { content: "\2718 "; }
.status-chip.st-duplicate::before { content: "= "; }

/* ---------- Dialogs and toasts ---------- */

.overlay { position: fixed; inset: 0; background: rgba(5, 3, 15, 0.75); display: grid; place-items: center; z-index: 50; padding: 1rem; animation: fade-in 0.2s; }
.dialog { background: var(--bg-2); border-radius: var(--radius); padding: 1.2rem 1.6rem; max-width: 36rem; box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.6), inset 0 0 0 2px var(--line); text-align: center; }
.dialog-title { font-family: var(--font-display); margin: 0.2rem 0 0.4rem; }
#toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); display: grid; gap: 0.5rem; z-index: 60; }
.toast { background: #2d2560; padding: 0.6rem 1rem; border-radius: 12px; box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.5); transition: opacity 0.6s, transform 0.6s; animation: fade-in 0.3s; }
.toast.error { background: #6b1d26; }
.toast.leaving { opacity: 0; transform: translateY(0.5rem); }

/* ---------- Smaller screens (tablets) ---------- */

@media (max-width: 1000px) {
  :root { font-size: 15px; }
  .bid-controls { grid-template-columns: 1fr; }
  .buzzer { width: 9rem; height: 9rem; }
  .reveal-main { flex-direction: column; text-align: center; }
  .clue-text { font-size: 1rem; }
  .game-title { font-size: 2.6rem; }
  .lightning { grid-template-columns: minmax(7rem, 1fr) minmax(0, 2.4fr) minmax(7rem, 1fr); gap: 0.7rem; }
  .stop-word { font-size: 2rem; }
}
@media (max-width: 720px) {
  .side-cards { grid-template-columns: 1fr; }
  .vs { text-align: center; }
  .clues { grid-template-columns: 1fr; }
  .clue-card, .clue-inner { min-height: 5.5rem; }
  .scoreboard { grid-template-columns: 1fr 1fr; }
  .measure { grid-column: 1 / -1; order: -1; padding-bottom: 0.3rem; }
  .baton { display: none; }
  .bar { width: 1rem; }
  .answer-row { flex-direction: column; }
  .final-scores { gap: 1rem; }
  .final-side .record { width: 7rem; height: 7rem; }
  .final-side .score { font-size: 1.8rem; }
  .final-head { font-size: 2.2rem; }
  /* Phones: the song on top, the two STOP buttons side by side underneath. */
  .lightning { grid-template-columns: 1fr 1fr; min-height: 0; }
  .lt-center { grid-column: 1 / -1; order: -1; }
  .stop-btn { min-height: 9rem; }
  .lt-title { font-size: 2.4rem; }
}

@media (max-width: 540px) {
  #app { padding-left: max(0.75rem, env(safe-area-inset-left)); padding-right: max(0.75rem, env(safe-area-inset-right)); }
  #topbar { flex-wrap: wrap; gap: 0.5rem; }
  .brand { font-size: 1rem; }
  .topbar-actions { gap: 0.35rem; }
  .name-input, .answer-input { font-size: max(16px, 1.15rem); }
  .staff { padding: 0 0.35rem; }
  .clef { font-size: 4.2rem; margin-right: 0.3rem; }
  .bid-notes .head { width: 1.25rem; height: 0.95rem; }
  .bid-notes .stem { height: 2.4rem; left: calc(50% + 0.52rem); top: calc(50% - 1.9rem); }
  .bid-keys { grid-template-columns: repeat(5, 1fr); height: auto; gap: 0.35rem; padding: 0.45rem; }
  .pkey-bid { min-height: 3.4rem; border-radius: 9px; padding: 0.4rem 0; align-items: center; margin: 0; }
  .pkey-black { display: none; }
  .pass-btn { width: 100%; min-height: 4.5rem; }
  .buzzer { width: 8.2rem; height: 8.2rem; }
  .reveal-art .vinyl, .sleeve { width: 12rem; height: 12rem; --size: 12rem; }
}

@media (hover: none) and (pointer: coarse) {
  .kbd-only { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
