:root {
  color-scheme: dark;
  --bg: #050608;
  --bg-letters: #0b0d10;
  --fg: #f4f5f6;
  --muted: #b9bdc3;
  --dim: #6b7078;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Grote vage letters op de achtergrond */
.bg {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 900;
  font-size: min(62vw, 80vh);
  line-height: .78;
  letter-spacing: -.04em;
  color: var(--bg-letters);
  word-break: break-all;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  z-index: 0;
}

main {
  position: relative;
  z-index: 1;
  width: min(90vw, 560px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.station {
  margin: 0 0 1.25rem;
  font-size: .75rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--dim);
}

.title {
  margin: 0;
  font-size: clamp(1.4rem, 5vw, 1.9rem);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .02em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.artist {
  margin: .7rem 0 0;
  font-size: clamp(1.1rem, 4vw, 1.4rem);
  font-weight: 700;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* Afspeelknop */
.play {
  position: relative;
  margin-top: 2rem;
  width: 86px;
  height: 86px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #000;
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform .12s ease;
}
.play:active { transform: scale(.94); }
.play:focus-visible { outline: 2px solid var(--muted); outline-offset: 6px; }

.play svg { width: 40px; height: 40px; fill: currentColor; grid-area: 1 / 1; }
.play .i-play { margin-left: 4px; }
.play .i-stop { display: none; }

body[data-state="playing"] .i-play,
body[data-state="loading"] .i-play { display: none; }
body[data-state="playing"] .i-stop,
body[data-state="loading"] .i-stop { display: block; }

/* Draaiende ring tijdens verbinden/bufferen */
.play::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 2px solid transparent;
}
body[data-state="loading"] .play::after {
  border-top-color: var(--fg);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status {
  min-height: 1.2em;
  margin: 1rem 0 0;
  font-size: .8rem;
  color: var(--dim);
}

/* Volume (wordt verborgen op iPhone/iPad: daar regelen de knoppen het volume) */
.volume {
  margin-top: .75rem;
  width: 64px;
  height: 20px;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}
.volume[hidden] { display: none; }
.volume::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: #3a3e44; }
.volume::-moz-range-track { height: 4px; border-radius: 2px; background: #3a3e44; }
.volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; margin-top: -5px;
  border-radius: 50%; background: var(--muted); border: 0;
}
.volume::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); border: 0; }

.footer {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  z-index: 1;
  text-align: center;
  font-size: .7rem;
  color: var(--dim);
}

@media (prefers-reduced-motion: reduce) {
  body[data-state="loading"] .play::after { animation-duration: 3s; }
  .play { transition: none; }
}
.station[hidden] { display: none; }

/* Ingebouwde audiobalk van Safari (alleen bij HLS) */
.native-audio {
  display: block;
  margin-top: 1.5rem;
  width: min(80vw, 300px);
  height: 40px;
  color-scheme: dark;
  opacity: .85;
}
