/* Rotation. Phone first: the video deck on top, now playing, then Up next or the DJ chat,
   with the suggestions and the message box pinned to the bottom of the screen.
   Wide screens: deck and queue on the left, the DJ booth on the right. */
:root {
  --bg: #0c0910;
  --surface: #15111b;
  --surface-2: #1e1827;
  --line: #2d2438;
  --fg: #f3ecf5;
  --muted: #a397ae;
  --faint: #6f637b;
  --amber: #f3a83b;
  --amber-ink: #2a1703;
  --rose: #e8508a;
  --violet: #9a7bff;
  --ok: #5fd39a;
  --font-display: "Big Shoulders Display", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  --radius: 14px;
  --bar-h: 132px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 var(--font-body);
  min-height: 100dvh;
  padding: 0 max(14px, env(safe-area-inset-right, 0px)) calc(var(--bar-h) + env(safe-area-inset-bottom, 0px) + 12px) max(14px, env(safe-area-inset-left, 0px));
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Ambient cover art behind everything */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); }
.backdrop img { width: 100%; height: 100%; object-fit: cover; filter: blur(70px) saturate(1.3); opacity: 0; transform: scale(1.25); transition: opacity 1.2s ease; }
.backdrop img.on { opacity: 0.3; }
.backdrop::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 90% at 20% 0%, transparent 0%, rgba(12, 9, 16, 0.75) 55%, var(--bg) 100%); }

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1280px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top, 0px)) 0 12px; }
.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; min-width: 0; }
.logo { font-family: var(--font-display); font-weight: 900; font-size: 28px; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1; }
.tagline { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: rgba(21, 17, 27, 0.7); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; flex: none; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.status[data-state="live"] .status-dot { background: var(--ok); animation: pulse 1.6s infinite; color: rgba(95, 211, 154, 0.6); }
.status[data-state="mixing"] .status-dot { background: var(--rose); animation: pulse 0.8s infinite; color: rgba(232, 80, 138, 0.6); }
.status[data-state="thinking"] .status-dot { background: var(--violet); animation: pulse 1s infinite; color: rgba(154, 123, 255, 0.6); }
.status[data-state="paused"] .status-dot { background: var(--amber); }
.status[data-state="live"], .status[data-state="mixing"], .status[data-state="thinking"] { color: var(--fg); }

/* Layout (phone): one column, a tab switch between Up next and the DJ */
.layout { max-width: 1280px; margin: 0 auto; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.deck, .queue, .booth { background: rgba(21, 17, 27, 0.8); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
/* No backdrop-filter on the booth on phones: it would pin the fixed message bar inside the booth. */
.deck, .queue { backdrop-filter: blur(12px); }
.layout[data-tab="queue"] .booth .vibe, .layout[data-tab="queue"] .booth .chat { display: none; }
.layout[data-tab="queue"] .booth { background: none; border: 0; }
.layout[data-tab="dj"] .queue { display: none; }

/* Deck: the video stage */
.deck { padding: 10px 10px 14px; display: grid; gap: 12px; overflow: hidden; }
/* YouTube's player needs at least 200 px of height, even on the narrowest phones. */
.stage { position: relative; aspect-ratio: 16 / 9; width: 100%; min-height: 200px; border-radius: 10px; overflow: hidden; background: #000; }
.screen { position: absolute; inset: 0; opacity: 0; transition: opacity 1.6s ease; z-index: 1; }
.screen.on { opacity: 1; z-index: 2; }
.screen.fading { opacity: 0; }
.screen iframe { width: 100%; height: 100%; border: 0; display: block; }
.poster { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; overflow: hidden; background: var(--surface); }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(18px) brightness(0.45) saturate(1.2); transform: scale(1.15); }
.poster-body { position: relative; display: grid; justify-items: center; gap: 10px; padding: 16px; text-align: center; }
.poster-hint { margin: 0; color: var(--fg); opacity: 0.85; font-size: 13px; }
.tap-hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 6; margin: 0; padding: 6px 14px; border-radius: 999px; background: rgba(12, 9, 16, 0.85); border: 1px solid var(--amber); color: var(--fg); font-size: 13px; white-space: nowrap; pointer-events: none; animation: pulse-border 1.4s infinite; }

.now { display: flex; gap: 14px; align-items: center; min-width: 0; padding: 0 4px; }
.now-art { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex: none; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.now-art:not([src]) { visibility: hidden; }
.meta { min-width: 0; display: grid; gap: 2px; }
.eyebrow { margin: 0; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--amber); }
.title { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: clamp(26px, 7vw, 46px); line-height: 0.95; letter-spacing: 0.01em; text-transform: uppercase; overflow-wrap: anywhere; }
.artist { margin: 2px 0 0; font-size: 15px; font-weight: 600; }
.note { margin: 0; color: var(--muted); font-size: 13px; }
.badge { display: inline-block; margin-left: 6px; padding: 0 5px; border: 1px solid var(--faint); border-radius: 4px; font-family: var(--font-mono); font-size: 10px; line-height: 15px; color: var(--muted); vertical-align: 2px; }
.badge-e { border-color: var(--muted); color: var(--fg); }

.progress { position: relative; height: 6px; margin: 0 4px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--amber), #ffcf7d); border-radius: 3px; }
.mix-zone { position: absolute; top: 0; bottom: 0; right: 0; left: 100%; background: repeating-linear-gradient(135deg, rgba(232, 80, 138, 0.6) 0 4px, rgba(232, 80, 138, 0.22) 4px 8px); }
.times { display: flex; justify-content: space-between; gap: 10px; padding: 0 4px; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
#mixLabel { text-align: center; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#mixLabel.hot { color: var(--rose); }
.transport { display: flex; gap: 10px; padding: 0 4px; }
.transport .btn { flex: 1; }

.btn { border: 1px solid transparent; border-radius: 999px; padding: 11px 18px; font-weight: 700; font-size: 14px; cursor: pointer; transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease; touch-action: manipulation; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--amber); color: var(--amber-ink); }
.btn-primary:hover:not(:disabled) { background: #ffbb57; }
.btn-ghost { background: rgba(255, 255, 255, 0.03); border-color: var(--line); color: var(--fg); }
.btn-ghost:hover:not(:disabled) { border-color: var(--muted); }
.btn-big { padding: 14px 30px; font-size: 16px; }

/* Tabs (phone only) */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: rgba(21, 17, 27, 0.8); position: sticky; top: 0; z-index: 10; }
.tab { border: 0; background: transparent; border-radius: 999px; padding: 9px 12px; font-weight: 700; font-size: 14px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; touch-action: manipulation; }
.tab[aria-selected="true"] { background: var(--surface-2); color: var(--fg); }
.tab-count { font-family: var(--font-mono); font-size: 11px; color: var(--amber); }
.tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--rose); }

/* Queue */
.queue { padding: 14px 10px 12px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 6px; }
.section-head h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 24px; letter-spacing: 0.03em; text-transform: uppercase; }
.count { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.queue-help { margin: 2px 6px 8px; font-size: 12.5px; color: var(--faint); }
.queue-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.q-btn { width: 100%; display: grid; grid-template-columns: 20px 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 6px; border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; animation: rise 0.45s ease both; touch-action: manipulation; }
.q-btn:hover, .q-btn:focus-visible { background: rgba(255, 255, 255, 0.05); }
.q-btn:active { background: rgba(243, 168, 59, 0.12); }
.q-btn .pos { font-family: var(--font-mono); font-size: 12px; color: var(--faint); text-align: right; }
.q-btn img { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; background: var(--surface-2); }
.q-text { min-width: 0; }
.q-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-artist { font-size: 13px; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-note { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-side { display: grid; justify-items: end; gap: 4px; }
.q-len { font-family: var(--font-mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.q-go { font-size: 11.5px; font-weight: 700; color: var(--amber); white-space: nowrap; opacity: 0; transition: opacity 0.15s ease; }
.q-btn:hover .q-go, .q-btn:focus-visible .q-go { opacity: 1; }
.queue-empty { color: var(--muted); padding: 14px 6px; }
.played { margin: 10px 6px 0; font-family: var(--font-mono); font-size: 11px; color: var(--faint); }

/* Booth */
.booth { display: flex; flex-direction: column; min-width: 0; }
.vibe { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.vibe-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.vibe-label { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 26px; line-height: 1; text-transform: uppercase; letter-spacing: 0.02em; overflow-wrap: anywhere; }
.clean-pill { padding: 2px 8px; border-radius: 999px; background: rgba(95, 211, 154, 0.14); color: var(--ok); font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.energy { display: flex; align-items: center; gap: 12px; }
.energy-cells { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; flex: 1; }
.energy-cells i { height: 10px; border-radius: 2px; background: var(--surface-2); transition: background 0.4s ease; }
.energy-num { font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 1px 9px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--muted); }

.chat { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; line-height: 1.45; animation: rise 0.35s ease both; overflow-wrap: anywhere; scroll-margin-bottom: calc(var(--bar-h) + 24px); }
.msg.dj { align-self: flex-start; background: var(--surface-2); border-top-left-radius: 4px; }
.msg.dj .who { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); margin-bottom: 2px; }
.msg.room { align-self: flex-end; background: rgba(243, 168, 59, 0.14); border: 1px solid rgba(243, 168, 59, 0.28); border-top-right-radius: 4px; }
.msg.notice { align-self: center; max-width: 100%; padding: 2px 8px; font-size: 12.5px; color: var(--muted); font-style: italic; text-align: center; }
.msg.error { align-self: center; background: rgba(232, 80, 138, 0.12); border: 1px solid rgba(232, 80, 138, 0.35); font-size: 13.5px; }
.msg.typing { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13.5px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--violet); animation: bounce 1s infinite; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }

/* The message bar: pinned to the bottom of the phone screen */
.ask { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; gap: 8px; padding: 10px max(12px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); background: rgba(12, 9, 16, 0.94); border-top: 1px solid var(--line); backdrop-filter: blur(14px); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); border-radius: 999px; padding: 7px 12px; font-size: 13px; color: var(--fg); cursor: pointer; white-space: nowrap; transition: border-color 0.2s ease, background 0.2s ease; animation: rise 0.3s ease both; touch-action: manipulation; }
.chip:hover { border-color: var(--amber); }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 11px 16px; color: var(--fg); font: inherit; font-size: 16px; }
.input-row input::placeholder { color: var(--faint); }
.input-row input:focus { border-color: var(--amber); outline: none; }

@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes pulse-border { 0%, 100% { border-color: var(--amber); } 50% { border-color: var(--rose); } }
@keyframes rise { from { opacity: 0.001; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.5; } 40% { transform: translateY(-4px); opacity: 1; } }

/* Wide screens: deck and queue on the left, the booth on the right, no tabs */
@media (min-width: 1020px) {
  body { padding: 0 24px 24px; }
  .logo { font-size: 34px; }
  .tagline { font-size: 12px; }
  .layout { gap: 20px; grid-template-columns: minmax(0, 1.5fr) minmax(340px, 1fr); grid-template-areas: "deck booth" "queue booth"; align-items: start; }
  .deck { grid-area: deck; padding: 14px 14px 18px; }
  .queue { grid-area: queue; display: block !important; padding: 18px 14px 14px; }
  .booth { grid-area: booth; position: sticky; top: 16px; height: calc(100dvh - 96px); min-height: 560px; overflow: hidden; background: rgba(21, 17, 27, 0.8) !important; border: 1px solid var(--line) !important; backdrop-filter: blur(12px); }
  .booth .vibe { display: grid !important; }
  .booth .chat { display: flex !important; flex: 1; overflow-y: auto; }
  .tabs { display: none; }
  .ask { position: static; background: none; backdrop-filter: none; padding: 12px 16px 16px; }
  .chips { flex-wrap: wrap; overflow: visible; }
  .now-art { width: 84px; height: 84px; }
  .q-btn { grid-template-columns: 22px 52px minmax(0, 1fr) auto; }
  .q-btn img { width: 52px; height: 52px; }
}

@media (hover: none) {
  .q-go { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .screen { transition: none; }
  .msg, .q-btn, .chip { animation: none; }
  .backdrop img { transition: none; }
  .tap-hint { animation: none; }
}
