:root {
  --bg: #111018;
  --card: #ffffff12;
  --line: #ffffff24;
  --text: #fff;
  --muted: #c7c2d5;
  --dim: #9c95ae;
  --accent: #7657ed;
  --accent-2: #b9aaff;
  --good: #176b47;
  --good-line: #36c98b;
  --bad: #762e38;
  --bad-line: #dc6877;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(ellipse at top, #282044 0%, var(--bg) 68%) fixed;
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1; width: min(1100px, 100%); margin: 0 auto; padding: clamp(16px, 4vw, 40px); }
[hidden] { display: none !important; }

.kicker { color: var(--accent-2); font-size: 12px; letter-spacing: 2px; font-weight: 700; text-align: center; margin-top: 4vh; }
h1 { font-size: clamp(34px, 7vw, 64px); margin: 12px 0 8px; text-align: center; }
.lead { color: var(--muted); text-align: center; max-width: 560px; margin: 0 auto 28px; line-height: 1.5; }
.block { max-width: 760px; margin: 0 auto 24px; text-align: center; }
.hint { color: var(--dim); font-size: 13px; line-height: 1.5; text-align: center; }
.msg { min-height: 1.4em; text-align: center; color: var(--muted); }
code { background: #ffffff18; padding: 1px 5px; border-radius: 5px; }
a { color: var(--accent-2); }

.btn {
  border: 0; border-radius: 12px; padding: 13px 18px; cursor: pointer;
  font: 700 15px/1.2 inherit; background: #ffffff1c; color: var(--text);
}
.btn:hover { background: #ffffff2a; }
.btn.primary { background: var(--accent); }
.btn.primary:hover { background: #8569f2; }
.btn.big { font-size: 18px; padding: 16px 26px; }
.btn:disabled { opacity: .5; cursor: progress; }
.link { background: none; border: 0; color: var(--accent-2); cursor: pointer; font: inherit; padding: 6px; }
:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 3px; }

.lib-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); margin-bottom: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; text-align: left; }
.card {
  display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); color: var(--text); cursor: pointer; font: inherit; text-align: left;
}
.card:hover { background: #ffffff22; }
.card .thumb { width: 100%; aspect-ratio: 16 / 9; border-radius: 9px; background: #ffffff14 center / cover no-repeat; display: grid; place-items: center; font-size: 30px; }
.card .t { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .s { color: var(--dim); font-size: 12px; }

.link-form label { display: block; color: var(--muted); margin-bottom: 8px; }
.row { display: flex; gap: 8px; }
.row input {
  flex: 1; min-width: 0; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: #00000040; color: var(--text); font: inherit;
}

.bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.pool { flex: 1; color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.score { color: #ddd6ef; font-weight: 700; white-space: nowrap; }

.stage { display: grid; grid-template-columns: minmax(200px, 1.1fr) 1fr; gap: 18px; align-items: center; }
.player-box {
  position: relative; width: 100%; aspect-ratio: 16 / 9; min-width: 200px; min-height: 200px;
  border-radius: 16px; overflow: hidden; background: #000;
}
.player-box iframe, #player { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cover {
  position: absolute; inset: 0; pointer-events: none; /* taps reach the player underneath */
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(circle at 50% 40%, #3a2c6e, #17131f 75%);
  font-size: clamp(16px, 2.4vw, 22px); font-weight: 700;
}
.eq { display: flex; gap: 6px; align-items: flex-end; height: 48px; }
.eq i { width: 8px; background: var(--accent-2); border-radius: 3px; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.2s } .eq i:nth-child(3) { animation-delay: -.5s }
.eq i:nth-child(4) { animation-delay: -.7s } .eq i:nth-child(5) { animation-delay: -.35s }
@keyframes eq { 0%, 100% { height: 12px } 50% { height: 48px } }

.answer { padding: 18px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); min-height: 96px; text-align: center; }
#a-title { font-size: clamp(20px, 3vw, 28px); font-weight: 800; }
#a-artist { color: var(--muted); margin-top: 6px; }
.answer.revealed { border-color: var(--good-line); }
.status { display: inline-block; margin-top: 12px; padding: 7px 12px; border-radius: 999px; background: #ffffff14; color: #cfc6ee; font-size: 13px; }
.side { text-align: center; }
.map { margin-top: 12px; }
.map svg { display: block; width: 100%; height: 38px; }
#map-label { color: var(--dim); font-size: 11px; margin-top: 4px; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0 6px; }
.option {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
  text-align: left; padding: 14px 16px; min-height: 72px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit;
}
.option:hover:not(:disabled) { background: #ffffff25; }
.option .key { grid-row: span 2; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: #ffffff18; font-weight: 800; }
.option .o-title { font-weight: 800; font-size: clamp(15px, 2vw, 19px); }
.option .o-artist { color: var(--muted); font-size: 13px; }
.option.correct { background: var(--good); border-color: var(--good-line); }
.option.wrong { background: var(--bad); border-color: var(--bad-line); }
.option:disabled { cursor: default; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 12px; }
.foot { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; color: var(--dim); font-size: 12px; margin-top: 8px; }
.foot label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.legal { color: #7f7891; font-size: 11px; text-align: center; padding: 14px; }

@media (max-width: 760px) {
  .stage { grid-template-columns: 1fr; }
  .keys { display: none; }
}
@media (max-width: 520px) {
  .options { grid-template-columns: 1fr; }
  .option { min-height: 60px; }
  .row { flex-direction: column; }
  /* keep the controls reachable with one thumb */
  .actions { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 35%); }
}
/* Big screens (TV): scale everything up a notch */
@media (min-width: 1600px) {
  :root { font-size: 20px; }
  main { width: min(1500px, 100%); }
  .btn { font-size: 20px; padding: 16px 24px; }
}
