:root {
  --bg: #0e0b1a;
  --panel: #19142c;
  --panel-2: #231c3d;
  --line: #342a58;
  --text: #f3efff;
  --muted: #a99fc9;
  --accent: #ff4d8d;
  --accent-2: #7c5cff;
  --ok: #3ddc97;
  --warn: #ffb547;
  --radius: 16px;
  color-scheme: dark;
}
body[data-persona="blaze"] { --accent: #ff7a1a; --accent-2: #ff2e63; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(900px 500px at 10% -10%, color-mix(in srgb, var(--accent-2) 35%, transparent), transparent 60%),
    radial-gradient(700px 400px at 100% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
}
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.topbar { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; padding: 20px clamp(16px, 4vw, 40px) 8px; }
.brand { font-weight: 800; font-size: 1.5rem; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.tagline { margin: 0; color: var(--muted); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 24px;
  padding: 16px clamp(16px, 4vw, 40px) 32px;
  max-width: 1280px;
  margin: 0 auto;
}
@media (max-width: 880px) { .layout { grid-template-columns: 1fr; } }

.booth, .browse {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(16px, 3vw, 28px);
}
.booth { align-self: start; position: sticky; top: 16px; }
@media (max-width: 880px) { .booth { position: static; } }

/* now playing */
.now { display: flex; gap: 20px; align-items: center; }
.art {
  flex: none; width: 112px; height: 112px; border-radius: 20px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  display: grid; place-items: center; font-size: 2.4rem; font-weight: 800; overflow: hidden;
  box-shadow: 0 10px 40px color-mix(in srgb, var(--accent) 35%, transparent);
}
.art img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.now-text { min-width: 0; }
.now-text h2 { margin: 4px 0; font-size: clamp(1.3rem, 3vw, 1.9rem); line-height: 1.15; overflow-wrap: anywhere; }
.now-meta { margin: 0; color: var(--muted); }
.on-air { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.on-air .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
body[data-status="playing"] .on-air { color: var(--ok); }
body[data-status="playing"] .on-air .dot { background: var(--ok); box-shadow: 0 0 12px var(--ok); animation: pulse 1.6s infinite; }
body[data-status="loading"] .on-air .dot { background: var(--warn); animation: pulse .8s infinite; }
body[data-status="error"] .on-air { color: var(--accent); }
body[data-status="error"] .on-air .dot { background: var(--accent); }
@keyframes pulse { 50% { opacity: .35; } }

/* equalizer */
.eq { display: flex; align-items: flex-end; gap: 5px; height: 56px; margin: 22px 0 18px; }
.eq span { flex: 1; height: 12%; border-radius: 4px 4px 2px 2px; background: linear-gradient(to top, var(--accent-2), var(--accent)); opacity: .45; transition: height .3s; }
body[data-status="playing"] .eq span { opacity: 1; animation: bounce 1s ease-in-out infinite alternate; }
.eq span:nth-child(3n) { animation-duration: .7s !important; }
.eq span:nth-child(4n+1) { animation-duration: 1.3s !important; }
.eq span:nth-child(5n+2) { animation-duration: .9s !important; animation-delay: -.4s; }
.eq span:nth-child(2n) { animation-delay: -.2s; }
@keyframes bounce { 0% { height: 15%; } 40% { height: 85%; } 70% { height: 40%; } 100% { height: 100%; } }
@media (prefers-reduced-motion: reduce) { .eq span, .on-air .dot { animation: none !important; } }

/* buttons */
.btn {
  border: 1px solid var(--line); background: var(--panel-2); border-radius: 999px;
  padding: 10px 18px; cursor: pointer; transition: transform .1s, background .2s, border-color .2s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent-2), var(--accent)); border-color: transparent; font-weight: 700; }
.btn.round { width: 56px; height: 56px; padding: 0; display: grid; place-items: center; background: var(--text); color: var(--bg); border: none; }
.btn.round svg { width: 26px; height: 26px; fill: currentColor; }
.icon-pause { display: none; }
body[data-status="playing"] .icon-play, body[data-status="loading"] .icon-play { display: none; }
body[data-status="playing"] .icon-pause, body[data-status="loading"] .icon-pause { display: block; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.volume { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.volume input { width: 120px; accent-color: var(--accent); }

/* DJ */
.dj-panel { margin-top: 24px; padding: 18px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); }
body.dj-on .dj-panel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 8px 30px color-mix(in srgb, var(--accent) 25%, transparent); }
.dj-head { display: flex; gap: 14px; align-items: center; }
.dj-head h2 { margin: 0 0 4px; font-size: 1.1rem; }
.dj-avatar { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; background: linear-gradient(135deg, var(--accent-2), var(--accent)); flex: none; }
.dj-avatar.talking { animation: talk .25s ease-in-out 8 alternate; }
@keyframes talk { to { transform: scale(1.12) rotate(-4deg); } }
.persona-pick { display: flex; gap: 14px; flex-wrap: wrap; font-size: .95rem; }
.persona-pick label { cursor: pointer; display: flex; align-items: center; gap: 6px; }
.persona-pick input { accent-color: var(--accent); }
.persona-pick small { color: var(--muted); }
.dj-says { margin: 14px 0; font-size: 1.05rem; font-style: italic; min-height: 3em; }
.dj-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rotate, .check { color: var(--muted); display: flex; align-items: center; gap: 6px; font-size: .9rem; }
.rotate select { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }
.check input { accent-color: var(--accent); }
.dj-next { margin: 12px 0 0; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }

/* browse */
.browse h2 { margin: 0 0 14px; }
.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: .85rem; text-transform: capitalize; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: none; padding: 8px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab span { background: var(--panel-2); border-radius: 999px; padding: 1px 8px; font-size: .8rem; margin-left: 4px; }
.source { color: var(--muted); font-size: .85rem; margin: 10px 0; min-height: 1.2em; }

.stations { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.stations[aria-busy="true"] { opacity: .5; }
.station { display: flex; align-items: center; border-radius: 12px; border: 1px solid transparent; }
.station:hover { background: var(--panel-2); }
.station.playing { background: var(--panel-2); border-color: var(--accent); }
.station-play { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: center; background: none; border: none; padding: 8px 10px; cursor: pointer; text-align: left; }
.logo { flex: none; width: 44px; height: 44px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: .85rem; overflow: hidden; color: var(--muted); }
.logo img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.station-text { min-width: 0; display: grid; }
.station-text strong, .station-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.station-text small { color: var(--muted); }
.station-fav { background: none; border: none; font-size: 1.3rem; padding: 8px 14px; cursor: pointer; color: var(--accent); }
.empty { color: var(--muted); padding: 20px 8px; }

.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 16px 32px; }

@media (max-width: 520px) {
  .art { width: 84px; height: 84px; font-size: 1.8rem; }
  .volume { margin-left: 0; width: 100%; }
  .volume input { flex: 1; width: auto; }
}
