:root {
  --bg: #F4ECDC; --card: #F9F2E4; --ink: #2B1D12; --muted: #5A4733; --line: #D8C9AB;
  --brass: #7A5A1E; --primary: #6B3E1F; --on-primary: #FFF8EC; --cloth: #E6D5B6;
  --grille: rgba(194, 171, 132, 0.6); --walnut: #6A4529; --walnut-2: #52331D; --dial-ink: #F3E6CB;
  --needle: #FF7A4A; --eye: #8FDB5E; --knob: #6B4A30; --knob-ink: #F6EBD5; --ivory: #F2E8D3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1F160F; --card: #2E2117; --ink: #EDE0C8; --muted: #C9B79B; --line: #3E3125;
    --brass: #CDAE6E; --primary: #F0B565; --on-primary: #3D2300; --cloth: #33251A;
    --grille: rgba(232, 201, 138, 0.15); --walnut: #4A3220; --walnut-2: #3A2616; --dial-ink: #F0DDB8;
    --knob: #4E3624; --knob-ink: #F0E2C8; --ivory: #E6DAC0;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
h1, h2, h3, .brand span { font-family: Georgia, "Noto Serif", "Times New Roman", serif; font-weight: 500; }
a { color: var(--primary); }
[hidden] { display: none !important; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* Header */
.top { border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.bar { display: flex; align-items: center; gap: 14px; height: 58px; max-width: 980px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-size: 20px; }
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tabs a { color: var(--muted); text-decoration: none; padding: 7px 12px; border-radius: 999px; font-size: 15px; }
.tabs a[aria-current="page"] { background: var(--cloth); color: var(--ink); font-weight: 600; }
.get-app {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 14px; white-space: nowrap;
}

/* Dial */
.dial {
  margin: 22px 0 18px; background: linear-gradient(var(--walnut), var(--walnut-2)); color: var(--dial-ink);
  border-radius: 20px; padding: 14px 20px 30px; border: 1px solid rgba(0,0,0,.15);
}
.dial-label { font-size: 12px; letter-spacing: 2px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.eye { width: 10px; height: 10px; border-radius: 50%; background: #3F5A33; transition: background .4s, box-shadow .4s; }
.eye.on { background: var(--eye); box-shadow: 0 0 10px var(--eye); }
.scale { position: relative; height: 34px; margin-top: 10px; border-bottom: 1px solid rgba(243,230,203,.5); }
.scale i { position: absolute; bottom: 0; width: 1px; background: rgba(243,230,203,.6); }
.scale span { position: absolute; bottom: -22px; transform: translateX(-50%); font-size: 12px; opacity: .85; }
.needle {
  position: absolute; bottom: -6px; top: 0; width: 3px; margin-left: -1px; background: var(--needle);
  border-radius: 2px; left: 50%; box-shadow: 0 0 9px var(--needle); transition: left 1.2s ease-in-out;
}
.needle .yr { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 700; color: var(--needle); }

/* Player */
.player { display: grid; justify-items: center; gap: 14px; padding-bottom: 28px; }
.art {
  position: relative; width: min(280px, 72vw); aspect-ratio: 1; border-radius: 16px; overflow: hidden;
  background: var(--cloth); border: 1px solid var(--line); display: grid; place-items: center;
}
.art .record { width: 82%; height: 82%; }
.art.spin .record { animation: spin 3.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .art.spin .record { animation: none; } .needle { transition: none; } }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.now { text-align: center; min-height: 128px; max-width: 560px; }
.now h1 { font-size: clamp(22px, 5vw, 30px); line-height: 1.2; margin: 4px 0 6px; }
.artist { font-family: Georgia, serif; font-size: 18px; color: var(--muted); margin: 0 0 8px; }
.meta { margin: 0; color: var(--muted); font-size: 15px; }
.source { margin: 4px 0 0; font-style: italic; color: var(--muted); font-size: 14px; }
.status { margin: 8px 0 0; font-size: 14px; color: var(--muted); font-style: italic; min-height: 1.4em; }

.grille {
  width: 100%; max-width: 520px; display: flex; justify-content: center; align-items: center; gap: 28px;
  padding: 22px; border-radius: 20px; border: 1px solid var(--line);
  background-color: var(--cloth);
  background-image: repeating-linear-gradient(45deg, var(--grille) 0 1px, transparent 1px 9px),
                    repeating-linear-gradient(-45deg, var(--grille) 0 1px, transparent 1px 9px);
}
.knob {
  width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer; display: grid; place-items: center;
  background: var(--knob); color: var(--knob-ink); box-shadow: 0 2px 0 rgba(0,0,0,.25);
}
.knob svg { width: 28px; height: 28px; }
.knob.big { width: 84px; height: 84px; background: var(--ivory); color: var(--walnut-2); border: 3px solid var(--knob); }
.knob.big svg { width: 40px; height: 40px; }
.knob:focus-visible, .chip:focus-visible, .tabs a:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.knob:active { transform: translateY(1px); }
.actions { display: flex; gap: 26px; }
.actions a { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); text-decoration: none; font-size: 15px; }
.actions svg { width: 18px; height: 18px; }

/* Lists */
h2 { font-size: 28px; margin: 24px 0 6px; }
h3 { font-size: 19px; margin: 20px 0 8px; }
.intro { color: var(--muted); margin: 0 0 14px; }
.small { font-size: 14px; color: var(--muted); }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 8px 14px;
  border-radius: 999px; font: inherit; font-size: 15px; cursor: pointer;
}
.genre-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.genres { list-style: none; padding: 0; margin: 0 0 30px; display: grid; gap: 8px; }
.genres label {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line);
}
.genres input { width: 20px; height: 20px; accent-color: var(--primary); }
.genres .n { margin-left: auto; color: var(--muted); font-size: 14px; }
.tracks { list-style: none; padding: 0; margin: 0 0 18px; }
.tracks li button {
  width: 100%; text-align: left; border: none; background: none; color: inherit; font: inherit; cursor: pointer;
  padding: 10px 4px; border-bottom: 1px solid var(--line); display: grid; gap: 1px;
}
.tracks .t { font-family: Georgia, serif; font-size: 17px; }
.tracks .s { color: var(--muted); font-size: 14px; }
.tracks li.now-playing .t::before { content: "▶ "; color: var(--primary); }
.empty { color: var(--muted); font-style: italic; padding: 8px 4px; }

/* About */
.about .lede { font-size: 18px; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 4px 20px 14px; margin: 14px 0; }
.card.get { background: var(--cloth); }
.btn {
  display: inline-block; background: var(--primary); color: var(--on-primary); padding: 12px 20px;
  border-radius: 999px; text-decoration: none; font-weight: 600; margin: 4px 0 8px;
}
.switch { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--primary); }
.sources { padding-left: 18px; }
.sources li { margin: 6px 0; }
.foot { margin: 24px 0 40px; }

/* Desktop: player, genres on the right, history below both */
@media (min-width: 1000px) {
  .wrap, .bar { max-width: 1180px; }
  .tabs a[data-tab="genres"], .tabs a[data-tab="history"] { display: none; }
  .deck { display: grid; grid-template-columns: minmax(0, 1fr) 340px; column-gap: 36px; align-items: start; }
  #tab-radio { grid-column: 1; grid-row: 1; }
  #tab-genres { grid-column: 2; grid-row: 1; margin-top: 22px; }
  #tab-genres h2 { margin-top: 0; font-size: 24px; }
  #tab-genres .intro { font-size: 14px; }
  .genres { margin-bottom: 20px; max-height: 590px; overflow-y: auto; padding-right: 6px; gap: 6px; }
  .genres label { padding: 8px 14px; }
  #tab-history { grid-column: 1 / -1; grid-row: 2; border-top: 1px solid var(--line); padding-bottom: 30px; }
  .tracks.scroll { max-height: 420px; overflow-y: auto; padding-right: 6px; }
}

@media (max-width: 640px) {
  .bar { height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 8px; gap: 8px; }
  .brand { font-size: 18px; }
  .tabs { order: 3; width: 100%; margin: 0; justify-content: space-between; }
  .tabs a { flex: 1; text-align: center; padding: 7px 4px; }
  .get-app { margin-left: auto; }
  .grille { gap: 22px; padding: 18px 10px; }
}
