.player-bar {
  position: fixed;
  left: 24px;
  right: 24px;
  bottom: 24px;
  max-width: var(--container);
  margin: 0 auto;
  background: linear-gradient(180deg, #3d2818 0%, #1f1108 100%);
  color: var(--paper);
  border: 2px solid var(--brass);
  border-radius: 8px;
  padding: 14px 22px;
  box-shadow:
    inset 0 1px 0 rgba(232, 154, 60, 0.3),
    inset 0 0 30px rgba(232, 154, 60, 0.05),
    0 -4px 20px rgba(0, 0, 0, 0.4),
    0 8px 30px rgba(0, 0, 0, 0.5);
  z-index: 50;
}
.player-bar::before {
  content: '';
  position: absolute; inset: 4px;
  border: 1px solid rgba(184, 134, 42, 0.3);
  border-radius: 5px;
  pointer-events: none;
}

.player-inner {
  display: grid;
  /* Genoeg auto-kolommen voor: play, info, airplay, cast, save, vol, sleep, meta, donate
     (sommige zijn voorwaardelijk zichtbaar — Grid laat verborgen children geen cel claimen). */
  grid-template-columns: auto minmax(0, 1fr) repeat(7, auto);
  gap: 14px;
  align-items: center;
  position: relative;
  z-index: 1;
}

/* Brass play knob */
.play-knob {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffd47a, var(--brass) 40%, #8a5e1c 100%);
  border: 2px solid var(--wood-dark);
  display: flex; align-items: center; justify-content: center;
  color: var(--wood-dark);
  cursor: pointer;
  position: relative;
  flex: none;
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.4),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3),
    0 4px 8px rgba(0, 0, 0, 0.4);
  transition: transform 80ms var(--ease);
}
.play-knob:hover { transform: scale(1.04); }
.play-knob:active { transform: scale(0.96); }

/* Sleep timer — vintage custom dropdown */
.sleep-timer {
  position: relative;
  display: inline-flex;
  font-family: var(--font-mono);
  font-size: 11px;
}
.sleep-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.5);
  color: var(--paper, #f5ecd9);
  font-family: var(--font-mono-tight);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.02em;
  border: 1px solid rgba(194, 165, 114, 0.7);
  border-radius: 3px;
  padding: 5px 10px;
  cursor: pointer;
  transition: border-color 100ms ease, background 100ms ease;
}
.sleep-toggle:hover,
.sleep-toggle:focus-visible {
  border-color: var(--brass, #c2a572);
  outline: none;
}
.sleep-icon {
  width: 14px;
  height: 14px;
  filter: drop-shadow(0 0 4px rgba(184, 134, 42, 0.4));
}
.sleep-toggle-text { font-weight: 400; }
.sleep-arrow {
  font-size: 9px;
  opacity: 0.6;
  margin-left: 2px;
}
.sleep-timer[data-active="true"] .sleep-toggle-text {
  color: var(--amber-glow, #e89a3c);
  font-variant-numeric: tabular-nums;
}
.sleep-timer[data-active="true"] .sleep-toggle-text:hover {
  text-decoration: line-through;
  text-decoration-color: rgba(232, 154, 60, 0.6);
}
.sleep-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: var(--wood-deep, #2c1810);
  border: 1px solid var(--brass, #c2a572);
  border-radius: 4px;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
  z-index: 60;
}
.sleep-menu li[role="option"] {
  cursor: pointer;
}
.sleep-menu-item {
  display: block;
  padding: 7px 16px;
  font-family: var(--font-mono-tight);
  font-size: 13px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--paper, #f5ecd9);
  transition: background 100ms ease;
}
.sleep-menu li[role="option"]:hover .sleep-menu-item {
  background: rgba(184, 134, 42, 0.15);
}
.sleep-menu-divider {
  border-top: 1px dashed rgba(184, 134, 42, 0.3);
  margin: 4px 0;
}
[x-cloak] { display: none !important; }
.play-knob-glyph {
  position: relative;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
}
.play-knob .icon {
  width: 22px; height: 22px;
  position: absolute; opacity: 0;
  transition: opacity 80ms var(--ease);
}
.player-bar[data-state="idle"]    .icon-play,
.player-bar[data-state="ready"]   .icon-play,
.player-bar[data-state="paused"]  .icon-play { opacity: 1; }
.player-bar[data-state="playing"] .icon-pause { opacity: 1; }
.player-bar[data-state="loading"] .icon-loading {
  opacity: 1;
  animation: spin 1s linear infinite;
}
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* Station + track text */
.player-info { min-width: 0; }
.pl-station {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--amber-glow);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 6px rgba(255, 184, 77, 0.35);
}
/* Marquee-scroll als de station-naam OF de track-titel te lang is voor
   de container. player.js applyMarquee() wraps de tekst in een
   .marquee-inner span met verdubbelde inhoud; CSS triggert keyframes.
   -50% translateX past bij verdubbeling zodat 't continu lijkt te
   scrollen zonder zichtbare 'jump' aan het einde. */
.pl-station.is-marquee,
.pl-track.is-marquee {
  text-overflow: clip;
}
.pl-station.is-marquee .marquee-inner,
.pl-track.is-marquee .marquee-inner {
  display: inline-block;
  white-space: nowrap;
  /* 20s cycle: 0-50% scrollt, 50-100% pauzeert aan begin. Track krijgt
     -10s delay zodat 'ie pauzeert terwijl station scrollt en vice versa
     — netter dan beide tegelijk laten lopen. */
  animation: pl-marquee 20s linear infinite;
  padding-right: 0;
}
.pl-track.is-marquee .marquee-inner {
  animation-delay: -10s;
}
@keyframes pl-marquee {
  0%      { transform: translateX(0); }
  50%     { transform: translateX(-50%); }
  50.01%  { transform: translateX(0); }
  100%    { transform: translateX(0); }
}
.pl-track {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--paper);
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.pl-track:empty::before { content: '\200b'; }

/* Volume knob + track */
.vol-knob {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  color: var(--amber);
  font-size: 16px;
  letter-spacing: 0.1em;
}
.vol-label, .vol-readout {
  font-family: var(--font-mono);
  color: var(--amber);
  font-size: 16px;
  text-shadow: 0 0 4px rgba(255, 184, 77, 0.4);
}
.vol-track {
  position: relative;
  width: 140px; height: 8px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  border: 1px solid var(--wood-mid);
  overflow: visible;
}
.vol-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 80%;
  background: linear-gradient(90deg, var(--amber), var(--amber-glow));
  box-shadow: 0 0 8px rgba(255, 184, 77, 0.6);
  border-radius: 3px;
  pointer-events: none;
}
.vol-dot {
  position: absolute; left: 80%; top: 50%;
  transform: translate(-50%, -50%);
  width: 18px; height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffd47a, var(--brass));
  border: 1.5px solid var(--wood-dark);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.vol-track input[type="range"] {
  position: absolute; inset: -8px 0;
  width: 100%; height: 24px;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

/* Signal meta block */
.pl-meta {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--amber);
  letter-spacing: 0.15em;
  border-left: 1px solid rgba(232, 154, 60, 0.3);
  padding-left: 16px;
  text-shadow: 0 0 4px rgba(255, 184, 77, 0.3);
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.pl-meta-text {
  text-align: right;
}
.pl-meta-text div + div {
  color: var(--paper);
  opacity: 0.6;
  font-size: 12px;
  letter-spacing: 0.1em;
  margin-top: 2px;
}

/* Status dot prefix on meta line 1, state-driven color */
#player-meta-line1::before {
  content: '●';
  display: inline-block;
  margin-right: 0.45em;
  font-size: 0.85em;
  vertical-align: 0.05em;
  text-shadow: none;
  color: rgba(245, 243, 236, 0.35);
}
.player-bar[data-state="idle"]    #player-meta-line1::before,
.player-bar[data-state="paused"]  #player-meta-line1::before {
  color: rgba(245, 243, 236, 0.35);
}
.player-bar[data-state="loading"] #player-meta-line1::before {
  color: var(--amber-glow);
  text-shadow: 0 0 6px rgba(255, 184, 77, 0.7);
  animation: meta-pulse 1.2s ease-in-out infinite;
}
.player-bar[data-state="playing"] #player-meta-line1::before {
  color: #4ade80;
  text-shadow: 0 0 8px rgba(74, 222, 128, 0.75);
  animation: meta-pulse 1.6s ease-in-out infinite;
}
@keyframes meta-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

/* TLS-indicator: aparte kolom rechts van de meta-tekst.
   - hidden: standby/loading/paused — geheel onzichtbaar
   - secure: pulserend groen lock — directe HTTPS-stream
   - proxy:  gedimde lock met diagonale slash — HTTP-upstream via /api/stream */
.pl-tls {
  position: relative;
  width: 11px;
  height: 1em;        /* matcht line-height van .pl-meta line1 (14px) */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.4s ease, color 0.4s ease;
}
.pl-tls-icon {
  width: 11px;
  height: 14px;
  display: block;
}
.pl-tls-slash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.pl-tls[data-state="secure"] {
  opacity: 0.95;
  color: #4ade80;
  filter: drop-shadow(0 0 5px rgba(74, 222, 128, 0.55));
  animation: tls-pulse 1.8s ease-in-out infinite;
}
.pl-tls[data-state="proxy"] {
  opacity: 0.55;
  color: rgba(245, 243, 236, 0.65);
}
.pl-tls[data-state="proxy"] .pl-tls-slash {
  opacity: 0.85;
  background: linear-gradient(
    135deg,
    transparent calc(50% - 1.1px),
    #d97757 calc(50% - 1px),
    #d97757 calc(50% + 1px),
    transparent calc(50% + 1.1px)
  );
}
@keyframes tls-pulse {
  0%, 100% { opacity: 0.95; }
  50%      { opacity: 0.40; }
}

/* Save-as-preset widget — inline 1-6 verlaten in v0.20.3 ten gunste van
   een universele .save-toggle-btn (💾) die op alle schermbreedtes een
   modal opent. Discoverability wordt geregeld via een pulse-animatie
   op de toggle wanneer de gebruiker op een lege piano-toets klikt. */
.save-widget { display: none !important; }
.save-widget[hidden] { display: none !important; }
.save-label {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.15em;
  color: var(--amber);
  text-shadow: 0 0 4px rgba(255, 184, 77, 0.4);
}
.save-slots {
  display: flex;
  gap: 4px;
}
.save-slot {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: 1px solid var(--wood-mid);
  background: linear-gradient(180deg, #3d2a18, #1f1108);
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms var(--ease), border-color 120ms var(--ease), transform 80ms var(--ease);
  box-shadow: inset 0 1px 0 rgba(232, 154, 60, 0.15);
}
.save-slot:hover {
  border-color: var(--brass);
  background: linear-gradient(180deg, #5a3a20, #2c1810);
}
.save-slot:active { transform: translateY(1px); }
.save-slot.is-occupied {
  border-color: var(--brass);
  color: var(--amber-glow);
}
.save-slot-num { line-height: 1; }
.save-slot-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brass-light);
  box-shadow: 0 0 4px var(--amber-glow);
}
.save-slot.just-saved {
  animation: save-flash 700ms var(--ease);
  border-color: var(--amber-glow);
}
@keyframes save-flash {
  0%   { background: linear-gradient(180deg, var(--amber-glow), var(--amber)); transform: scale(1.1); }
  100% { background: linear-gradient(180deg, #5a3a20, #2c1810); transform: scale(1); }
}

/* Donate buttons in player-bar — official BMC + PayPal brand colors */
.donate-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: none;
}
.donate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--wood-dark);
  cursor: pointer;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 2px 0 rgba(0, 0, 0, 0.3);
  transition: transform 80ms var(--ease), filter 120ms var(--ease);
}
.donate-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.donate-btn:active { transform: translateY(1px); }
.donate-btn svg { width: 20px; height: 20px; display: block; }

.donate-btn-bmc {
  background: #FFDD00;
}
.donate-btn-paypal {
  background: #ffffff;
}

@media (max-width: 980px) {
  .player-bar { left: 12px; right: 12px; bottom: 12px; padding: 10px 14px; }
  /* 7 auto-kolommen: airplay, cast, share, save, sleep, tls, donate
     — sommige zijn vaak hidden maar die nemen geen kolom in grid. */
  .player-inner { grid-template-columns: auto minmax(0, 1fr) repeat(7, auto); gap: 8px; }
  .pl-meta { display: none; }
  .vol-knob { display: none; }
  .save-widget { display: none; }
  .donate-btn { width: 32px; height: 32px; }
  .donate-btn svg { width: 18px; height: 18px; }
  /* Mobiel: sleep-toggle krijgt zelfde stijl als save/share-toggle —
     rond, icoon-only, paper-bg met brass-border. Geen label-tekst, geen
     arrow. Active-state countdown wordt mini-badge bovenop het icoon. */
  .sleep-toggle {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    background: var(--paper, #f0e3bf);
    color: var(--wood-dark, #2c1810);
    border: 1px solid var(--brass, #b8862a);
    justify-content: center;
    gap: 0;
  }
  .sleep-toggle:hover { background: var(--paper-warm, #e8d8a8); }
  .sleep-toggle-text { display: none !important; }
  .sleep-arrow { display: none; }
  .sleep-icon {
    width: 20px;
    height: 20px;
    filter: none;
  }
  /* Active-countdown indicator: kleine amber dot rechtsboven het icoon */
  .sleep-timer[data-active="true"] .sleep-toggle::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--amber-glow, #e89a3c);
    box-shadow: 0 0 4px rgba(232, 154, 60, 0.7);
  }
  .sleep-timer { position: relative; }
}
@media (max-width: 480px) {
  /* Drop donate buttons on phones — toast handles the donate prompt */
  .donate-buttons { display: none; }
}
@media (max-width: 480px) {
  .play-knob { width: 48px; height: 48px; }
}
