/* ───────────────────────────────────────────────────────────────────────────
   Daily VS — Music Game frontend
   Dark, high-contrast, neon-edge. Mobile-first; two vertical TikTok embeds sit
   side-by-side on wide screens and stack on phones.
   ─────────────────────────────────────────────────────────────────────────── */

:root {
  --bg: #0a0a0f;
  --bg-2: #14141d;
  --panel: #1b1b27;
  --ink: #f4f4fb;
  --muted: #8a8aa3;
  --line: #2a2a3a;
  --a: #21e6c1;      /* side A accent (teal) */
  --b: #ff4d8d;      /* side B accent (pink) */
  --vs: #ffd23f;     /* the VS / brand gold */
  --good: #3ddc84;
  --bad: #ff5468;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(33, 230, 193, 0.10), transparent 60%),
    radial-gradient(1000px 600px at 110% 0%, rgba(255, 77, 141, 0.12), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

/* ── top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 18px clamp(14px, 4vw, 40px);
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(180deg, rgba(10, 10, 15, 0.92), rgba(10, 10, 15, 0.55) 70%, transparent);
  backdrop-filter: blur(8px);
}
.brand {
  font-weight: 900;
  letter-spacing: 0.14em;
  font-size: clamp(18px, 3.6vw, 26px);
}
.brand .vs {
  color: var(--vs);
  text-shadow: 0 0 18px rgba(255, 210, 63, 0.45);
}
.meta { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ── layout shell ────────────────────────────────────────────────────────── */
#app { padding: clamp(10px, 3vw, 26px) clamp(12px, 4vw, 40px) 64px; }
.screen {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}
.muted { color: var(--muted); }

/* ── progress dots ───────────────────────────────────────────────────────── */
.progress {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 4px 0 6px;
}
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--line);
  transition: background 0.2s, transform 0.2s;
}
.dot.done { background: var(--vs); }
.dot.active { background: var(--ink); transform: scale(1.35); }

/* ── prompt ──────────────────────────────────────────────────────────────── */
.prompt {
  font-size: clamp(20px, 4.4vw, 30px);
  font-weight: 800;
  margin: 6px 0 2px;
  line-height: 1.15;
}
.prompt .hl-a { color: var(--a); }
.prompt .hl-b { color: var(--b); }
.subprompt { color: var(--muted); margin: 0 0 8px; font-size: 14px; }

/* ── the two clips ───────────────────────────────────────────────────────── */
.arena {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(12px, 2.5vw, 22px);
  width: 100%;
  align-items: stretch;
}
@media (max-width: 720px) {
  .arena { grid-template-columns: 1fr; }
}

.clip {
  position: relative;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.clip[data-side="a"].selectable:hover { border-color: var(--a); transform: translateY(-3px); }
.clip[data-side="b"].selectable:hover { border-color: var(--b); transform: translateY(-3px); }
.clip.selectable { cursor: pointer; }

.clip[data-side="a"].picked { border-color: var(--a); box-shadow: 0 0 0 3px rgba(33, 230, 193, 0.35), var(--shadow); }
.clip[data-side="b"].picked { border-color: var(--b); box-shadow: 0 0 0 3px rgba(255, 77, 141, 0.35), var(--shadow); }

.clip.answer { border-color: var(--good); box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.4), var(--shadow); }
.clip.miss   { opacity: 0.72; }

.clip-frame {
  position: relative;
  width: 100%;
  /* TikTok's v2 embed is a tall card; this ratio avoids inner scroll on most clips */
  aspect-ratio: 9 / 16;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}
.clip-frame iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}

.clip-tag {
  position: absolute;
  top: 18px; left: 18px;
  z-index: 2;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.12em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
.clip[data-side="a"] .clip-tag { color: var(--a); }
.clip[data-side="b"] .clip-tag { color: var(--b); }

.clip-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 22px;
}
.handle {
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.handle:hover { text-decoration: underline; }
.likes {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 15px;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.3s, color 0.3s;
}
.likes.shown { opacity: 1; }
.likes.win { color: var(--good); }

/* ── pick buttons (explicit tap targets under each clip) ─────────────────── */
.pickbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(12px, 2.5vw, 22px);
  width: 100%;
  margin-top: 4px;
}
@media (max-width: 720px) { .pickbar { grid-template-columns: 1fr 1fr; } }

.pick {
  appearance: none;
  border: 2px solid var(--line);
  background: var(--bg-2);
  color: var(--ink);
  font-weight: 800;
  font-size: 15px;
  padding: 14px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.pick:active { transform: scale(0.98); }
.pick.a:hover { border-color: var(--a); background: rgba(33, 230, 193, 0.08); }
.pick.b:hover { border-color: var(--b); background: rgba(255, 77, 141, 0.08); }
.pick[disabled] { opacity: 0.4; cursor: default; }

/* ── reveal banner ───────────────────────────────────────────────────────── */
.reveal {
  width: 100%;
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 800;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 2px solid var(--line);
}
.reveal.good { border-color: var(--good); color: var(--good); background: rgba(61, 220, 132, 0.08); }
.reveal.bad  { border-color: var(--bad);  color: var(--bad);  background: rgba(255, 84, 104, 0.08); }
.reveal .sub { color: var(--muted); font-weight: 600; font-size: 14px; }

.next {
  appearance: none;
  border: 0;
  background: var(--vs);
  color: #1a1500;
  font-weight: 900;
  letter-spacing: 0.03em;
  font-size: 16px;
  padding: 15px 34px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(255, 210, 63, 0.3);
  transition: transform 0.1s, filter 0.15s;
}
.next:hover { filter: brightness(1.06); }
.next:active { transform: scale(0.97); }

/* ── summary screen ──────────────────────────────────────────────────────── */
.summary { gap: 22px; }
.scorecard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: 100%;
  max-width: 520px;
}
.stat {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat .big {
  font-size: clamp(34px, 9vw, 52px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat.guess .big { color: var(--vs); }
.stat.taste .big { color: var(--b); }
.stat .label { color: var(--muted); margin-top: 8px; font-size: 13px; letter-spacing: 0.04em; }

.sharebox {
  width: 100%;
  max-width: 520px;
  background: var(--bg-2);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  text-align: left;
  color: var(--ink);
}
.share-actions { display: flex; gap: 12px; }
.copybtn {
  appearance: none;
  border: 2px solid var(--vs);
  background: transparent;
  color: var(--vs);
  font-weight: 800;
  padding: 12px 26px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.copybtn:hover { background: var(--vs); color: #1a1500; }
.copybtn.copied { background: var(--good); border-color: var(--good); color: #06210f; }

/* ── error / empty states ────────────────────────────────────────────────── */
.notice {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px;
  max-width: 460px;
  box-shadow: var(--shadow);
}
.notice h2 { margin: 0 0 8px; }
.notice .emoji { font-size: 40px; }
.retry {
  margin-top: 16px;
  appearance: none;
  border: 2px solid var(--line);
  background: var(--bg-2);
  color: var(--ink);
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 999px;
  cursor: pointer;
}
.retry:hover { border-color: var(--vs); }

/* ── spinner ─────────────────────────────────────────────────────────────── */
.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--line);
  border-top-color: var(--vs);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
