:root {
  --page: #EAEFF3;
  --surface: #FFFFFF;
  --text: #13283B;
  --muted: #546474;
  --line: #CDD6DE;
  --night: #102A43;
  --night-2: #1B3A5A;
  --amber: #FFB000;
  --amber-glow: rgba(255, 176, 0, .45);
  --focus: #0B6BCB;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0D1C2B;
    --surface: #15293C;
    --text: #E8EEF3;
    --muted: #9AABBB;
    --line: #26405A;
    --night: #08131F;
    --night-2: #15293C;
    --focus: #6FB6FF;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: "Bricolage Grotesque", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  padding-bottom: calc(210px + env(safe-area-inset-bottom, 0px));
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: 6px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Header */
.top {
  max-width: 1240px; margin: 0 auto; padding: 20px 24px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--amber) 0 4px, transparent 5px),
    repeating-conic-gradient(var(--night) 0 6deg, var(--night-2) 6deg 12deg);
  box-shadow: inset 0 0 0 3px var(--night);
}
.search input {
  font: inherit; font-size: 1rem; width: min(320px, 70vw);
  padding: 10px 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
}

/* Intro */
.intro { max-width: 1240px; margin: 0 auto; padding: 36px 24px 8px; }
.intro h1 {
  margin: 0; max-width: 18ch;
  font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.02; font-weight: 800; letter-spacing: -.035em;
}
.intro p { margin: 14px 0 0; color: var(--muted); max-width: 52ch; }
.intro.compact h1 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); }

/* Genres */
.genres {
  max-width: 1240px; margin: 0 auto; padding: 20px 24px 6px;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
}
.genres::-webkit-scrollbar { display: none; }
.chip {
  font: inherit; font-size: .95rem; white-space: nowrap; cursor: pointer;
  padding: 7px 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: transparent; color: var(--text);
}
.chip[aria-pressed="true"] { background: var(--text); color: var(--page); border-color: var(--text); }
.chip .n { color: var(--muted); margin-left: 6px; font-size: .85em; }
.chip[aria-pressed="true"] .n { color: inherit; opacity: .7; }

/* Grid */
main { max-width: 1240px; margin: 0 auto; padding: 14px 24px 40px; }
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
}
.tile { position: relative; }
.tile a {
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 142px; gap: 8px; padding: 14px; border-radius: 10px;
  color: #fff; text-decoration: none;
  background: hsl(var(--h) 62% 36%);
  background-image: linear-gradient(160deg, hsl(var(--h) 70% 44%), hsl(calc(var(--h) + 24) 60% 28%));
}
.tile a:hover { filter: brightness(1.08); }
.tile .name { font-weight: 800; font-size: 1.15rem; line-height: 1.05; letter-spacing: -.02em; padding-right: 28px; }
.tile .tag { font-size: .82rem; opacity: .85; line-height: 1.25; }
.logo-plate {
  width: 56px; height: 56px; border-radius: 8px; padding: 5px;
  background: #fff; display: grid; place-items: center; overflow: hidden;
}
.logo-plate:not(.has-logo) { display: none; }
.logo-plate img, .np-badge img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tile .logo-plate + .name { font-size: 1rem; }
.tile.on a { box-shadow: 0 0 0 3px var(--page), 0 0 0 6px var(--amber); }
.tile.on .tag::before { content: "● "; color: var(--amber); }
.fav {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px;
  border: 0; border-radius: 50%; background: rgba(0,0,0,.18); color: #fff; cursor: pointer;
  display: grid; place-items: center;
}
.fav svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.fav[aria-pressed="true"] svg { fill: var(--amber); stroke: var(--amber); }
.empty { color: var(--muted); }

.foot { max-width: 1240px; margin: 0 auto; padding: 0 24px 24px; color: var(--muted); font-size: .85rem; }

/* Player: jaren-80 boombox */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 6px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to bottom, transparent, var(--page) 22px);
  pointer-events: none;
}
.bb { max-width: 1020px; margin: 0 auto; pointer-events: auto; }
.bb-handle {
  width: 56%; height: 20px; margin: 0 auto -4px;
  border: 7px solid #9AA3AB; border-bottom: 0; border-radius: 18px 18px 0 0;
  border-top-color: #D5DADF;
}
.bb-body {
  --chrome: linear-gradient(180deg, #F1F3F5 0%, #C9CFD4 38%, #AEB6BD 52%, #D6DBDF 72%, #9BA4AC 100%);
  display: grid; grid-template-columns: 124px 1fr 124px; gap: 14px; align-items: center;
  padding: 10px 14px; border-radius: 16px;
  background: var(--chrome);
  border: 2px solid #5F676F;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.8), inset 0 -3px 0 rgba(0,0,0,.18), 0 10px 24px rgba(10,20,30,.35);
  color: #1E2328;
}
.bb-speaker {
  aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background:
    radial-gradient(circle, #0D0F11 1.3px, transparent 1.8px) 0 0 / 6px 6px,
    radial-gradient(circle, #3C4247, #16191C 70%);
  box-shadow: 0 0 0 5px #7E878F, 0 0 0 7px #D9DEE2, inset 0 0 14px #000;
}
.cone {
  width: 42%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 42% 38%, #6A7076, #24282C 55%, #0F1113);
  box-shadow: 0 0 0 4px #1A1D20, 0 0 0 6px #3A4045;
}
.player.live .cone { animation: thump .47s ease-in-out infinite alternate; }
.player.live .bb-speaker + .bb-center + .bb-speaker .cone { animation-delay: .23s; }
@keyframes thump { to { transform: scale(1.07); } }

.bb-center { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.bb-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0 2px; }
.bb-brand { font-weight: 800; font-style: italic; font-size: 1.05rem; letter-spacing: -.01em; color: #1E2328; }
.bb-print, .bb-label {
  font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #3B434B;
}

.dial {
  position: relative; height: 30px; border-radius: 4px; overflow: hidden;
  background:
    repeating-linear-gradient(90deg, rgba(255,214,140,.55) 0 1px, transparent 1px 8px) left bottom / 100% 6px no-repeat,
    linear-gradient(180deg, #2B2213, #15110A);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.8), 0 0 0 2px #6E777F;
}
.scale {
  position: absolute; inset: 2px 3% 8px; display: flex; justify-content: space-between;
  font-family: "VT323", ui-monospace, monospace; font-size: 15px; line-height: 1; color: #E9C77A;
}
.scale i { font-style: normal; }
.needle {
  position: absolute; top: 0; bottom: 0; width: 3px; left: 0; margin-left: -1px;
  background: #FF3B1F; box-shadow: 0 0 8px 1px rgba(255,80,40,.8);
  opacity: 0; transition: left .8s cubic-bezier(.3,.9,.3,1), opacity .3s;
}
.player.has-station .needle { opacity: 1; }

.bb-row { display: flex; align-items: center; gap: 14px; }
.lcd {
  flex: 1; min-width: 0; height: 58px; display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 6px;
  background: linear-gradient(180deg, #1B1F14, #0F120B);
  box-shadow: inset 0 2px 6px #000, 0 0 0 2px #6E777F, 0 0 0 4px #E4E8EB;
}
.np-badge {
  flex: none; width: 42px; height: 42px; border-radius: 4px;
  display: grid; place-items: center; font-weight: 800; font-size: .9rem;
  background: #2A3020; color: #fff;
}
.np-badge.has-logo { background: #fff; padding: 3px; overflow: hidden; }
.np-badge img { max-width: 100%; max-height: 100%; object-fit: contain; }
.np-text { display: flex; flex-direction: column; min-width: 0; flex: 1; font-family: "VT323", ui-monospace, monospace; }
.np-text strong, .np-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-text strong { font-weight: 400; font-size: 1.45rem; line-height: 1; color: #FFB648; text-shadow: 0 0 6px rgba(255,170,50,.55); }
.np-text span { font-size: 1.05rem; line-height: 1.1; color: #8C7A55; }
.player.live .np-text span { color: #FFB648; }
.stereo {
  flex: none; font-family: "VT323", ui-monospace, monospace; font-size: 1rem; color: #3A3524;
  border: 1px solid currentColor; border-radius: 3px; padding: 0 4px;
}
.player.live .stereo { color: #FF5A3C; text-shadow: 0 0 6px rgba(255,80,50,.8); }

.keys { display: flex; gap: 4px; padding: 4px; border-radius: 6px; background: #2B3035; box-shadow: inset 0 2px 4px #000; }
.key {
  width: 54px; height: 46px; border: 0; border-radius: 3px 3px 5px 5px; cursor: pointer;
  display: grid; place-items: center; color: #E6E9EC;
  background: linear-gradient(180deg, #5A6168, #3A4046 60%, #2C3136);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 4px 0 #15181B;
  transform: translateY(-2px); transition: transform .06s, box-shadow .06s;
}
.key svg { width: 18px; height: 18px; fill: currentColor; }
.key.small { width: 42px; }
.key.play { background: linear-gradient(180deg, #E0573A, #B9361E 60%, #922814); }
.key:active:not(:disabled), .player.playing .key.play {
  transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 0 0 #15181B;
}
.key:disabled { opacity: .55; cursor: default; }
.key.play .i-pause, .player.playing .key.play .i-play { display: none; }
.player.playing .key.play .i-pause { display: block; }
.player.loading .key.play { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .6; } }

.vol { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.vol input {
  -webkit-appearance: none; appearance: none; width: 130px; height: 8px; border-radius: 4px;
  background: linear-gradient(180deg, #1A1D20, #3A4045); box-shadow: inset 0 1px 2px #000;
}
.vol input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 28px; border-radius: 3px; cursor: pointer;
  background: linear-gradient(90deg, #8B949C, #F4F6F8 45%, #A7AFB6); border: 1px solid #4E565D;
}
.vol input::-moz-range-thumb {
  width: 16px; height: 28px; border-radius: 3px; cursor: pointer;
  background: linear-gradient(90deg, #8B949C, #F4F6F8 45%, #A7AFB6); border: 1px solid #4E565D;
}
.bb :focus-visible { outline: 3px solid #FFB000; outline-offset: 2px; }

@media (max-width: 900px) {
  .bb-body { grid-template-columns: 1fr; padding: 10px; }
  .bb-speaker { display: none; }
  .vol { display: none; }
}
@media (max-width: 720px) {
  .top { padding: 16px 16px 0; }
  .search input { width: 100%; }
  .search { flex: 1 1 100%; }
  .intro, .genres, main, .foot { padding-left: 16px; padding-right: 16px; }
  .intro { padding-top: 24px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .player { padding-left: 6px; padding-right: 6px; }
  .bb-handle { width: 46%; height: 14px; border-width: 5px; }
  .bb-print { display: none; }
  .bb-row { gap: 8px; }
  .key { width: 44px; height: 42px; }
  .key.small { display: none; }
  .lcd { padding: 6px 8px; }
  .stereo { display: none; }
  body { padding-bottom: calc(200px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  .needle { transition: none; }
  .player.live .cone, .player.loading .key.play { animation: none; }
}
