:root {
  /* Sunset Polaroid: 80s Miami dusk, Malibu sun, old-camera warmth */
  --bg: #1c0e30;
  --surface: #29163f;
  --surface-2: #352050;
  --line: #4f3373;
  --text: #fff1e8;
  --muted: #d9c2dd;
  --faint: #9d82ad;
  --accent: #ff3d8b;
  --accent-ink: #2a0a24;
  --accent-soft: rgba(255, 61, 139, 0.15);
  --pink: #ff3d8b;
  --sun: #ffcc66;
  --teal: #2fe0d0;
  --ok: #2fe0d0;
  --danger: #ff6b6b;
  --sunset: linear-gradient(120deg, #ffd877 0%, #ff8a5c 42%, #ff3d8b 100%);
  --stripe: linear-gradient(90deg, #2fe0d0 0 25%, #ff9ecb 25% 50%, #ff3d8b 50% 75%, #ffb347 75% 100%);
  --aqua-soft: rgba(47, 224, 208, 0.12);
  --cream: #fff1e8;

  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2.25rem, 1.4rem + 3vw, 3.5rem);

  --script: 'Shrikhand', 'Cabinet Grotesk', system-ui, serif;
  --display: 'Cabinet Grotesk', 'Satoshi', system-ui, sans-serif;
  --body: 'Satoshi', system-ui, -apple-system, sans-serif;
  --r: 20px;
  --r-sm: 12px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); }
body {
  font-family: var(--body);
  font-size: var(--text-base);
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(60rem 26rem at 50% -8%, rgba(255, 61, 139, 0.30), transparent 62%),
    radial-gradient(36rem 22rem at 100% 0%, rgba(255, 138, 92, 0.16), transparent 60%),
    radial-gradient(50rem 32rem at 0% 105%, rgba(47, 224, 208, 0.20), transparent 62%),
    linear-gradient(180deg, #1c0e30 0%, #22103a 55%, #15122e 100%);
  background-attachment: fixed;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 20px 14px;
  max-width: 640px; margin: 0 auto;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 34px; height: 34px; color: var(--text); }
.wordmark { font-family: var(--display); font-weight: 600; font-size: var(--text-base); letter-spacing: .01em; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: var(--text-xs); font-weight: 500; color: var(--muted);
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.chip.on { color: var(--text); border-color: rgba(123, 224, 166, .4); }
.chip.on .dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); }

/* Layout */
#app {
  position: relative; z-index: 1;
  max-width: 640px; margin: 0 auto;
  padding: 8px 20px calc(40px + env(safe-area-inset-bottom));
}
.screen { animation: rise .45s var(--ease) both; display: flex; flex-direction: column; gap: 20px; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.eyebrow { font-size: var(--text-xs); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.05; letter-spacing: -0.01em; }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
.muted { color: var(--muted); }
.fine { font-size: var(--text-xs); color: var(--faint); }
.error { color: var(--danger); font-size: var(--text-sm); }
.center { text-align: center; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 20px; border-radius: 999px;
  font-size: var(--text-sm); font-weight: 700;
  transition: transform .15s var(--ease), background .2s, border-color .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--sunset); color: var(--accent-ink); box-shadow: 0 10px 30px -12px rgba(255, 106, 90, .7), inset 0 1px 0 rgba(255,255,255,.35); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border: 1px solid var(--line); background: var(--surface); }
.btn.ghost:hover { border-color: var(--faint); }
.btn.block { width: 100%; min-height: 56px; font-size: var(--text-base); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-grid; place-items: center; color: var(--muted);
  border: 1px solid var(--line); background: var(--surface);
}
.icon-btn:hover { color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 20px;
}

/* Home */
.hero { padding-top: 28px; display: flex; flex-direction: column; gap: 18px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.record-wrap { display: grid; place-items: center; padding: 14px 0 4px; }
.record {
  width: min(56vw, 236px); aspect-ratio: 1; border-radius: 50%;
  background:
    repeating-radial-gradient(circle, #170b26 0 2px, #231334 2px 4px);
  box-shadow: 0 0 0 3px #170b26, 0 0 0 4px rgba(255,158,203,.35), 0 18px 50px -10px rgba(23, 11, 38, .8);
  animation: spin 6s linear infinite;
  position: relative;
}
.record::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 30deg, transparent 0 10%, rgba(255,255,255,.07) 14%, transparent 20% 60%, rgba(255,255,255,.05) 64%, transparent 70%);
}
.record::before {
  content: ''; position: absolute; inset: 31%; border-radius: 50%; z-index: 1;
  background:
    radial-gradient(circle, #1c0e30 0 7%, transparent 7.5%),
    linear-gradient(transparent 0 58%, #1c0e30 58% 62%, transparent 62% 70%, #1c0e30 70% 75%, transparent 75% 82%, #1c0e30 82% 88%, transparent 88%),
    linear-gradient(#ffd877, #ff8a5c 55%, #ff3d8b);
}
.record.paused { animation-play-state: paused; }
@keyframes spin { to { transform: rotate(360deg); } }
.how { counter-reset: step; display: grid; gap: 12px; }
.how li { list-style: none; display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; color: var(--muted); font-size: var(--text-sm); }
.how li::before {
  counter-increment: step; content: counter(step);
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: var(--text-xs);
}
.how b { color: var(--text); font-weight: 700; }

/* Setup */
.field { display: flex; flex-direction: column; gap: 8px; font-size: var(--text-sm); font-weight: 500; color: var(--muted); }
.input, .field textarea {
  width: 100%; min-height: 52px; padding: 12px 16px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--text); font-size: var(--text-base);
}
.field textarea { font-family: ui-monospace, monospace; font-size: var(--text-xs); resize: vertical; }
.input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.input::placeholder, textarea::placeholder { color: var(--faint); }
.add-row { display: flex; gap: 10px; }
.add-row .input { flex: 1; }
.players { display: flex; flex-wrap: wrap; gap: 8px; }
.player-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 6px 6px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-weight: 500; font-size: var(--text-sm);
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: var(--text-xs); color: var(--accent-ink);
}
.avatar.lg { width: 64px; height: 64px; font-size: var(--text-lg); font-family: var(--display); }
.player-pill button { width: 26px; height: 26px; border-radius: 50%; color: var(--faint); display: grid; place-items: center; }
.player-pill button:hover { color: var(--text); background: var(--line); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.seg button { padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: var(--text-sm); color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }

/* Category */
.cat-current {
  font-family: var(--display); font-size: var(--text-xl); font-weight: 600; line-height: 1.1;
  padding: 26px 22px; border-radius: var(--r);
  background: var(--sunset); color: var(--accent-ink);
  min-height: 130px; display: flex; align-items: flex-end;
}
.cat-current.empty { background: var(--surface); color: var(--faint); border: 1px dashed var(--line); }
.cat-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip {
  padding: 10px 14px; border-radius: 999px; font-size: var(--text-sm); font-weight: 500;
  background: var(--surface); border: 1px solid var(--line); text-align: left;
  transition: border-color .2s, background .2s;
}
.cat-chip:hover { border-color: var(--accent); }
.cat-chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

/* Handoff */
.handoff { min-height: 64dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 18px; }
.handoff .cat-tag { font-size: var(--text-sm); color: var(--muted); max-width: 32ch; }
.handoff .cat-tag b { color: var(--text); }
.progress { display: flex; gap: 6px; justify-content: center; }
.progress span { width: 22px; height: 4px; border-radius: 4px; background: var(--line); }
.progress span.done { background: var(--accent); }

/* Search */
.search-box { position: relative; }
.search-box svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); }
.search-box .input { padding-left: 46px; }
.results { display: flex; flex-direction: column; gap: 6px; }
.track {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center;
  padding: 8px; border-radius: var(--r-sm); text-align: left; width: 100%;
  border: 1px solid transparent; transition: background .15s, border-color .15s;
}
.track:hover { background: var(--surface); }
.track[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.track img, .track .art-ph { width: 52px; height: 52px; border-radius: 8px; background: var(--surface-2); object-fit: cover; }
.track .t { font-weight: 700; font-size: var(--text-sm); line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.track .a { font-size: var(--text-xs); color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.track .yr { font-size: var(--text-xs); color: var(--faint); font-variant-numeric: tabular-nums; }
.skel { height: 68px; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty-state { padding: 28px 12px; text-align: center; color: var(--faint); font-size: var(--text-sm); }

.lockbar {
  position: sticky; bottom: 0; padding: 14px 0 calc(6px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 30%);
}

/* Playback */
.now { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; padding-top: 6px; }
.cover {
  width: min(72vw, 300px); aspect-ratio: 1; border-radius: 22px; overflow: hidden; position: relative;
  box-shadow: 0 30px 80px -24px rgba(255, 61, 139, .45);
  background: var(--surface-2);
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover.hidden img { filter: blur(26px) saturate(1.3); transform: scale(1.2); }
.cover .q {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--display); font-size: 5rem; color: rgba(255,255,255,.9);
  background: rgba(18, 13, 22, .35);
}
.eq { display: flex; gap: 4px; height: 22px; align-items: flex-end; }
.eq i { width: 4px; background: var(--accent); border-radius: 2px; animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s } .eq i:nth-child(3) { animation-delay: -.6s } .eq i:nth-child(4) { animation-delay: -.15s }
.eq.off i { animation: none; height: 4px !important; }
@keyframes eq { 0%,100% { height: 5px } 50% { height: 22px } }
.bar { width: 100%; height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }
.reveal-card {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line);
  animation: rise .4s var(--ease) both;
}
.song-title { font-family: var(--display); font-size: var(--text-lg); font-weight: 600; line-height: 1.15; }
.controls { display: flex; gap: 12px; justify-content: center; align-items: center; }
.play-btn { width: 64px; height: 64px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; }
.play-btn svg { width: 24px; height: 24px; }

/* Vote + scores */
.vote-list { display: flex; flex-direction: column; gap: 8px; }
.vote-item {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center;
  padding: 10px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); text-align: left;
}
.vote-item img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; }
.vote-item[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.vote-item .by { font-size: var(--text-xs); color: var(--muted); }
.crown { color: var(--accent); width: 22px; height: 22px; }
.board { display: flex; flex-direction: column; gap: 8px; }
.board-row {
  display: grid; grid-template-columns: 28px 36px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line);
}
.board-row.lead { border-color: var(--accent); }
.board-row .rank { color: var(--faint); font-weight: 700; font-variant-numeric: tabular-nums; }
.board-row .pts { font-family: var(--display); font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.winner-banner { padding: 22px; border-radius: var(--r); background: var(--sunset); color: var(--accent-ink); display: flex; gap: 14px; align-items: center; }
.winner-banner img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; }
.winner-banner .song-title { color: var(--accent-ink); }

/* Sheet */
.sheet {
  margin: auto auto 0; width: 100%; max-width: 640px; border: 0; border-radius: 24px 24px 0 0;
  background: var(--surface); color: var(--text); padding: 0;
}
.sheet::backdrop { background: rgba(8, 5, 10, .7); backdrop-filter: blur(4px); }
.sheet-inner { padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 24px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.btn svg { width: 20px; height: 20px; flex: none; }

/* ---------- Multiplayer ---------- */
.btn.text { min-height: 44px; color: var(--muted); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.btn.text:hover { color: var(--text); }
.toggle { display: flex; gap: 14px; align-items: center; text-align: left; padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); width: 100%; }
.toggle .switch { flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; transition: background .2s; }
.toggle .switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--text); transition: transform .2s var(--ease); }
.toggle[aria-pressed="true"] .switch { background: var(--accent); }
.toggle[aria-pressed="true"] .switch::after { transform: translateX(18px); background: var(--accent-ink); }
.code-card { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px 20px; border-radius: var(--r); text-align: center;
  background: linear-gradient(160deg, rgba(255,61,139,.16), rgba(255,79,139,.10)); border: 1px solid rgba(255,61,139,.35); }
.room-code { font-family: var(--display); font-weight: 700; font-size: var(--text-2xl); letter-spacing: .18em; padding-left: .18em; line-height: 1; font-variant-numeric: tabular-nums; }
.qr { width: 168px; height: 168px; padding: 8px; border-radius: 14px; background: #fff; }
.qr svg { width: 100%; height: 100%; display: block; }
.code-input { font-family: var(--display); font-size: var(--text-lg); letter-spacing: .3em; text-transform: uppercase; text-align: center; }
.board-row.slim { grid-template-columns: auto 1fr auto auto; padding: 10px 12px; }
.board-row.off { opacity: .55; }
.board-row .nm { min-width: 0; display: flex; flex-direction: column; font-weight: 600; font-size: var(--text-sm); }
.board-row .nm .fine, .board-row .nm .tag { display: inline; }
.tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: var(--text-xs); font-weight: 700; background: var(--accent-soft); color: var(--accent); vertical-align: 1px; }
.icon-btn.sm { width: 32px; height: 32px; } .icon-btn.sm svg { width: 14px; height: 14px; }
.ok { color: var(--ok); display: grid; place-items: center; } .ok-ic { width: 20px; height: 20px; }
.typing { display: inline-flex; gap: 4px; vertical-align: middle; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s } .typing i:nth-child(3) { animation-delay: .4s }
@keyframes blink { 0%, 80%, 100% { opacity: .25 } 40% { opacity: 1 } }
.conn-banner { padding: 10px 14px; border-radius: var(--r-sm); background: rgba(255,107,107,.12); border: 1px solid rgba(255,107,107,.35); color: var(--text); font-size: var(--text-sm); }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  max-width: min(92vw, 520px); padding: 12px 18px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 600; font-size: var(--text-sm);
  box-shadow: 0 12px 40px rgba(0,0,0,.45); animation: rise .3s var(--ease) both; text-align: center; overflow-wrap: anywhere; }
.cat-current.small { min-height: 0; padding: 18px 20px; font-size: var(--text-lg); }
.thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; }
.thumb.sm { width: 40px; height: 40px; border-radius: 8px; }
.pts.sm { font-size: var(--text-base); color: var(--accent); }
.clamp { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.wb-label { font-weight: 700; font-size: var(--text-xs); letter-spacing: .12em; text-transform: uppercase; }
.vote-item[disabled] { opacity: .5; cursor: default; }
.vote-item.static { cursor: default; }
.board-row .nm { display: block; line-height: 1.35; }
.toast { bottom: auto; top: calc(72px + env(safe-area-inset-top)); }
.guess-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.guess { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: var(--text-sm); text-align: left; min-height: 52px; transition: border-color .15s, background .15s; }
.guess span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guess:hover { border-color: var(--faint); }
.guess[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.guess-hit { color: var(--ok); font-weight: 700; }

/* ---------- DJ ---------- */
.tag.dj { background: rgba(47,224,208,.16); color: var(--ok); }
.btn.mini { min-height: 32px; padding: 4px 12px; font-size: var(--text-xs); border: 1px solid var(--line); background: var(--surface-2); }
.btn.mini.on { background: rgba(47,224,208,.16); border-color: rgba(47,224,208,.5); color: var(--ok); }
.dj-card { width: 100%; padding: 16px; border-radius: var(--r); border: 1px solid rgba(47,224,208,.35); background: rgba(47,224,208,.06); display: flex; flex-direction: column; gap: 10px; text-align: left; }
.dj-card .eyebrow { color: var(--ok); }

/* ---------- Big-screen (TV) mode ---------- */
body.tv {
  --text-xs: clamp(0.85rem, 0.5rem + 0.5vw, 1.15rem);
  --text-sm: clamp(1rem, 0.6rem + 0.6vw, 1.35rem);
  --text-base: clamp(1.1rem, 0.6rem + 0.8vw, 1.6rem);
  --text-lg: clamp(1.4rem, 0.8rem + 1vw, 2.2rem);
  --text-xl: clamp(1.9rem, 1rem + 1.6vw, 3.2rem);
}
body.tv .topbar, body.tv #app { max-width: 1680px; padding-left: clamp(20px, 3vw, 64px); padding-right: clamp(20px, 3vw, 64px); }
body.tv .logo { width: 44px; height: 44px; }
body.tv .wordmark { font-size: var(--text-lg); }
body.tv .avatar.lg { width: clamp(64px, 5vw, 104px); height: clamp(64px, 5vw, 104px); font-size: var(--text-xl); }
body.tv .avatar { width: clamp(28px, 2vw, 40px); height: clamp(28px, 2vw, 40px); font-size: var(--text-xs); }
.tv-wrap { display: flex; flex-direction: column; gap: clamp(16px, 2vw, 32px); }
.tv-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tv-pill { padding: 8px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: var(--text-sm); color: var(--muted); }
.tv-pill b { color: var(--text); }
.tv-pill-code { font-family: var(--display); letter-spacing: .12em; color: var(--accent) !important; }
.tv-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 3vw, 64px); align-items: start; }
.tv-grid.play { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: center; }
.tv-side { display: flex; flex-direction: column; gap: clamp(14px, 1.4vw, 24px); }
.tv-join { display: flex; flex-direction: column; align-items: center; text-align: center; gap: clamp(10px, 1.2vw, 20px);
  padding: clamp(24px, 3vw, 56px); border-radius: 28px; background: linear-gradient(160deg, rgba(255,61,139,.16), rgba(255,79,139,.10)); border: 1px solid rgba(255,61,139,.35); }
.tv-url { font-size: var(--text-lg); font-weight: 700; }
.tv-code { font-family: var(--display); font-weight: 700; font-size: clamp(4rem, 2rem + 6vw, 9rem); letter-spacing: .14em; padding-left: .14em; line-height: 1; }
.tv-qr { width: clamp(180px, 16vw, 300px); height: clamp(180px, 16vw, 300px); }
.tv-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(130px, 11vw, 200px), 1fr)); gap: 12px; }
.tv-tiles.wide { grid-template-columns: repeat(auto-fill, minmax(clamp(150px, 13vw, 230px), 1fr)); }
.tv-tile { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); text-align: center; animation: rise .4s var(--ease) both; }
.tv-tile.off { opacity: .5; }
.tv-tile-name { font-weight: 700; font-size: var(--text-base); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-tile-status { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--muted); }
.tv-tile-actions { display: flex; gap: 6px; align-items: center; }
.tv-center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: clamp(12px, 1.4vw, 24px); min-height: 60dvh; }
.tv-avatar-xl .avatar.lg { width: clamp(110px, 9vw, 180px); height: clamp(110px, 9vw, 180px); font-size: clamp(2.5rem, 1rem + 3vw, 4.5rem); }
.tv-h1 { font-family: var(--display); font-weight: 600; font-size: clamp(2.4rem, 1rem + 3.4vw, 5.5rem); line-height: 1.02; letter-spacing: -0.015em; max-width: 22ch; }
.tv-sub { font-size: var(--text-lg); }
.tv-cta { min-height: clamp(56px, 4.5vw, 80px); font-size: var(--text-lg); padding: 0 clamp(24px, 3vw, 48px); }
.tv-catpick { width: min(100%, 900px); display: flex; flex-direction: column; gap: 14px; text-align: left; }
.tv-banner { padding: clamp(22px, 2.6vw, 44px) clamp(24px, 3vw, 52px); border-radius: 28px; background: var(--sunset); color: var(--accent-ink); }
.tv-banner-text { font-family: var(--display); font-weight: 600; font-size: clamp(2.4rem, 1rem + 3.4vw, 5.5rem); line-height: 1.02; }
.tv-count { font-family: var(--display); font-size: var(--text-xl); color: var(--accent); font-variant-numeric: tabular-nums; }
.tv-player { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.tv-cover { width: min(100%, 38vw, 62dvh); border-radius: 28px; }
.tv-cover .q { font-size: clamp(6rem, 3rem + 6vw, 12rem); }
.tv-record { width: min(30vw, 40dvh); }
.tv-picked { display: flex; align-items: center; gap: 18px; padding: 18px 22px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); animation: rise .45s var(--ease) both; }
.tv-picked-name { font-family: var(--display); font-weight: 600; font-size: var(--text-xl); }
.chips, .tv-guessers { display: flex; flex-wrap: wrap; gap: 10px; }
.player-pill.done { border-color: rgba(47,224,208,.5); }
body.tv .player-pill { font-size: var(--text-sm); padding: 8px 14px 8px 8px; }
.tv-songs { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(160px, 14vw, 260px), 1fr)); gap: 16px; }
.tv-song { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); animation: rise .4s var(--ease) both; }
.tv-song img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; }
.tv-song-t { font-weight: 700; font-size: var(--text-base); }
.tv-winner { display: flex; gap: clamp(16px, 2vw, 32px); align-items: center; padding: clamp(20px, 2.4vw, 40px); border-radius: 28px; background: var(--sunset); color: var(--accent-ink); }
.tv-winner img { width: clamp(120px, 12vw, 220px); height: clamp(120px, 12vw, 220px); border-radius: 18px; object-fit: cover; flex: none; }
.tv-winner .tv-h1 { font-size: clamp(2rem, 1rem + 2.4vw, 4rem); }
body.tv .board-row { padding: 14px 18px; }
body.tv .toast { font-size: var(--text-base); }
@media (max-width: 900px) {
  .tv-grid, .tv-grid.play { grid-template-columns: 1fr; }
  .tv-cover { width: min(100%, 70vw); }
}

/* ---------- Auto-play countdown ---------- */
.auto-bar { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r); background: var(--accent-soft); border: 1px solid rgba(255,61,139,.4); font-size: var(--text-sm); text-align: left; animation: rise .3s var(--ease) both; }
.auto-bar b { color: var(--accent); font-variant-numeric: tabular-nums; }
.auto-ring { width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(255,61,139,.3); border-top-color: var(--accent); animation: spin 1s linear infinite; flex: none; }
.auto-note { text-align: center; }

[hidden] { display: none !important; }

/* ---- Sunset Polaroid theme details ---- */
body::before {
  content: ''; position: fixed; top: 0; left: 0; right: 0; height: 5px; z-index: 20;
  background: var(--stripe);
}
h1, .wordmark, .tv-h1, .tv-banner-text, .winner-banner h2, .winner-banner h3 { font-family: var(--script); font-weight: 400; letter-spacing: 0; }
h1 { line-height: 1.08; }
h2, h3 { font-weight: 800; letter-spacing: -0.015em; }
.wordmark { font-size: var(--text-lg); line-height: 1; background: var(--sunset); -webkit-background-clip: text; background-clip: text; color: transparent; padding: 2px 0 4px; }
.hero h1 em { background: var(--sunset); -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: .08em; }
.eyebrow { color: var(--teal); }
h1 { text-shadow: 0 0 28px rgba(255, 61, 139, .45); }
.hero h1 em { text-shadow: none; filter: drop-shadow(0 0 18px rgba(255, 61, 139, .45)); }
.btn.ghost { border-color: rgba(47, 224, 208, .38); background: var(--aqua-soft); }
.btn.ghost:hover { border-color: var(--teal); }
.chip { border-color: rgba(47, 224, 208, .28); }
/* retro striped sun behind the home record, with a teal horizon */
.record-wrap { position: relative; padding: 34px 0 30px; overflow: hidden; }
.record-wrap::before {
  content: ''; position: absolute; left: 50%; top: 6px; width: min(80vw, 340px); aspect-ratio: 1; transform: translateX(-50%); border-radius: 50%; z-index: 0;
  background:
    linear-gradient(transparent 0 52%, var(--bg) 52% 55%, transparent 55% 63%, var(--bg) 63% 67%, transparent 67% 74%, var(--bg) 74% 79%, transparent 79% 85%, var(--bg) 85% 91%, transparent 91%),
    linear-gradient(#ffd877, #ff8a5c 50%, #ff3d8b);
  opacity: .9;
}
.record-wrap::after {
  content: ''; position: absolute; left: -20px; right: -20px; bottom: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--teal), transparent); box-shadow: 0 0 18px var(--teal);
}
.record { position: relative; z-index: 1; }
.logo { width: 38px; height: 38px; border-radius: 10px; box-shadow: 0 4px 14px -4px rgba(0,0,0,.6); }
.code-card, .tv-join { position: relative; overflow: hidden; }
.code-card::before, .tv-join::before {
  content: ''; position: absolute; left: 22px; top: 0; width: 64px; height: 5px; background: var(--stripe); border-radius: 0 0 3px 3px;
}
.chip.on { border-color: rgba(47, 224, 208, .45); }
.how li::before { color: var(--accent-ink); }
.how li:nth-child(4n+1)::before { background: #2fe0d0; }
.how li:nth-child(4n+2)::before { background: #ff9ecb; }
.how li:nth-child(4n+3)::before { background: #ff3d8b; }
.how li:nth-child(4n+4)::before { background: #ffb347; }

/* Apple Music link shown with every revealed song (App Store guideline 5.2.5) */
.am-link{display:inline-flex;align-items:center;gap:6px;margin-top:8px;padding:6px 12px;border-radius:999px;
  font-size:var(--text-xs);font-weight:700;color:var(--text);text-decoration:none;
  background:color-mix(in srgb,var(--text) 8%,transparent);border:1px solid color-mix(in srgb,var(--text) 18%,transparent);width:max-content;max-width:100%}
.am-link svg{width:14px;height:14px;flex:none}
.am-link:hover{background:color-mix(in srgb,var(--text) 14%,transparent)}
.am-need{border-color:color-mix(in srgb,var(--accent) 45%,transparent)}
