:root {
  --bg: #121016;
  --panel: #1c1922;
  --line: #2c2834;
  --text: #f2efe6;
  --muted: #a39dab;
  --faint: #6f6878;
  --accent: #f2efe6;
  --radius: 18px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  background-image: radial-gradient(120% 60% at 50% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  transition: background-image 0.6s;
}

.radio {
  max-width: 560px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Header */
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { margin: 0; font-size: 26px; letter-spacing: 0.04em; font-weight: 800; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--faint); flex: none; }
.playing .dot { background: #ff4d4d; box-shadow: 0 0 0 0 #ff4d4d88; animation: onair 1.8s infinite; }
@keyframes onair { 70% { box-shadow: 0 0 0 9px #ff4d4d00; } 100% { box-shadow: 0 0 0 0 #ff4d4d00; } }
.status { margin: 0; color: var(--muted); font-size: 13px; text-align: right; }

/* Channel dial */
.dial { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 2px 6px; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 8px; transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--chip); opacity: 0.8; }
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] {
  color: var(--bg); background: var(--chip); border-color: var(--chip);
}
.chip[aria-pressed="true"]::before { background: var(--bg); opacity: 0.5; }
.chip:focus-visible, .tune:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tagline { color: var(--muted); font-size: 14px; margin: 8px 2px 18px; min-height: 1.45em; }

/* Now playing */
.now {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 20px 18px; overflow: hidden;
}
.now::after {
  content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--accent); opacity: 0.85;
}
.label { margin: 0 0 6px; color: var(--faint); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; }
.title { margin: 0; font-size: clamp(24px, 7vw, 34px); line-height: 1.1; font-weight: 800; padding-right: 54px; overflow-wrap: anywhere; }
.meta { margin: 8px 0 0; color: var(--muted); font-size: 15px; }
.about { margin: 8px 0 0; color: var(--faint); font-size: 14px; min-height: 0; }
.about:empty { display: none; }
/* Progress bar you can drag (only moves your own listening; see player.js) */
.seek {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 20px; margin: 12px 0 0;
  background: transparent; cursor: pointer; --pct: 0%;
}
.seek::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--accent) var(--pct), var(--line) var(--pct));
}
.seek::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -4px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--panel);
}
.seek::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
.seek::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
.seek::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--panel); }
.times { display: flex; justify-content: space-between; margin-top: 4px; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.golive {
  margin-top: 12px; border: 1px solid var(--accent); background: transparent; color: var(--accent);
  border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.golive::before { content: "● "; }
.golive[hidden] { display: none; }

/* Not live: you skipped or dragged, so the on-air light goes amber */
.shifted .dot, .playing.shifted .dot { background: #f5b83d; box-shadow: none; animation: none; }

/* Equaliser (only moves while playing) */
.eq { position: absolute; top: 22px; right: 20px; display: flex; align-items: flex-end; gap: 3px; height: 26px; }
.eq i { width: 5px; height: 6px; border-radius: 2px; background: var(--accent); opacity: 0.35; }
.playing .eq i { opacity: 0.9; animation: bounce 0.9s ease-in-out infinite alternate; }
.playing .eq i:nth-child(2) { animation-delay: -0.3s; animation-duration: 0.7s; }
.playing .eq i:nth-child(3) { animation-delay: -0.6s; animation-duration: 1.1s; }
.playing .eq i:nth-child(4) { animation-delay: -0.2s; animation-duration: 0.8s; }
.playing .eq i:nth-child(5) { animation-delay: -0.5s; animation-duration: 1s; }
@keyframes bounce { from { height: 5px; } to { height: 26px; } }

/* Controls */
.controls { display: flex; align-items: center; gap: 12px; margin: 18px 0 26px; }
.tune {
  flex: none; display: flex; align-items: center; gap: 10px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: var(--bg); font: inherit; font-weight: 800; font-size: 16px; padding: 13px 22px 13px 18px;
}
.tune-icon { width: 0; height: 0; border-style: solid; border-width: 8px 0 8px 13px; border-color: transparent transparent transparent currentColor; }
.playing .tune-icon { border: 0; width: 13px; height: 14px; background: currentColor; border-radius: 2px; }
.icon-btn {
  flex: none; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn:focus-visible, .golive:focus-visible, .seek:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.volume { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--muted); }
.volume svg { width: 22px; height: 22px; flex: none; fill: currentColor; }
.volume svg .wave { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.volume input { flex: 1; min-width: 0; accent-color: var(--accent); }

/* Up next */
.next h3 { margin: 0 0 8px; color: var(--faint); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.next ol { list-style: none; margin: 0; padding: 0; }
.next li {
  display: flex; justify-content: space-between; gap: 12px; padding: 11px 2px; border-top: 1px solid var(--line);
}
.next li:first-child { border-top: 0; }
.next .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next .f { color: var(--faint); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next .when { color: var(--muted); font-size: 13px; flex: none; font-variant-numeric: tabular-nums; }
.next .left { min-width: 0; display: flex; flex-direction: column; }

.foot { margin-top: 28px; color: var(--faint); font-size: 13px; }
.foot p { margin: 4px 0; }
.foot a { color: var(--muted); text-underline-offset: 3px; }
.foot a:hover { color: var(--text); }
.small { font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  .playing .eq i, .playing .dot { animation: none; }
}
