/* Standalone player in the Spotify idiom.
   Portrait: one column, art, title, then the dock inline, then the queue.
   Landscape: header / scrolling content / fixed bottom dock, so the page height never
   depends on the controls. */
.player-page {
  --bg: #121212;
  --surface: #181818;
  --surface-2: #232323;
  --surface-3: #2e2e2e;
  --line: #2a2a2a;
  --line-strong: #3a3a3a;
  --tint: 30, 30, 34;              /* replaced at runtime from the artwork's average colour */
  --play-bg: #ffffff;
  --play-ink: #0a0a0a;
  --dock-h: 96px;

  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}
.tint {
  position: fixed; inset: 0 0 auto 0; height: 78vh; z-index: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(var(--tint), 0.85) 0%, rgba(var(--tint), 0.35) 45%, var(--bg) 100%);
  transition: background 0.8s ease;
}
/* Station logo as a faint watermark, bleeding off the lower right; sits between the tint and the content. */
.watermark {
  position: fixed; right: -14vmin; bottom: -10vmin; z-index: 0; pointer-events: none;
  width: min(78vmin, 640px); aspect-ratio: 1;
  opacity: 0.09; filter: blur(1.2px) grayscale(0.25);
  mix-blend-mode: screen;
  transform: rotate(-6deg);
  transition: opacity 0.6s ease;
}
.watermark img { width: 100%; height: 100%; object-fit: contain; }
.bar, .player, .dock { position: relative; z-index: 1; }

.eyebrow-sm {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; margin: 0;
}

/* Header */
.bar {
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px;
  padding: 10px 12px 0;
  padding-top: max(10px, env(safe-area-inset-top));
}
.bar-link { width: 44px; height: 44px; display: grid; place-items: center; color: var(--ink-2); border-radius: 50%; }
.bar-link:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.bar-link svg { width: 26px; height: 26px; fill: currentColor; }
.bar-title { display: flex; align-items: center; justify-content: center; gap: 10px; text-align: left; line-height: 1.2; }
.badge { width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6)); }
.bar-title strong { display: block; font-size: 13px; font-weight: 600; letter-spacing: 0.02em; }
.bar .chip { justify-self: end; grid-column: 3; width: max-content; }

/* Stage */
.player {
  flex: 1; width: 100%; max-width: 480px; margin: 0 auto;
  padding: 18px 20px 0;
  display: grid; gap: 22px; align-content: start;
}
.stage { display: grid; gap: 14px; }
.art {
  margin: 0; width: 100%; aspect-ratio: 1;
  border-radius: 8px; overflow: hidden;
  background: var(--surface-2);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
.art { position: relative; }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity 0.6s ease; }
.art .art-b { opacity: 0; }
.art.is-b #art { opacity: 0; }
.art.is-b .art-b { opacity: 1; }
.art.is-loading img { opacity: 0.4; }
.art { cursor: pointer; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 calc(18px + var(--bass, 0) * 70px) rgba(var(--tint), calc(0.25 + var(--bass, 0) * 0.55)); transition: box-shadow 0.12s linear; }
.title { cursor: pointer; }
.art-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }

.now { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-top: 8px; }
.now-text { min-width: 0; }
.title {
  font-family: var(--font-body); font-weight: 700;
  font-size: clamp(22px, 6vw, 28px); line-height: 1.2; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.now.is-voice .title { color: var(--voice); }
.meta { color: var(--muted); font-size: 15px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .sep { padding: 0 5px; opacity: 0.6; }
.live { flex: none; display: inline-flex; align-items: center; gap: 6px; color: var(--accent); padding-bottom: 4px; }
.live .live-dot { width: 7px; height: 7px; }
.now.is-voice .live { color: var(--voice); }

/* Dock (portrait: inline) */
.dock {
  width: 100%; margin: 0;
  padding: 0 0 6px;
  display: grid; gap: 10px;
}
.dock-now { display: none; }
.dock-center { display: grid; gap: 10px; }
.scrub { display: grid; grid-template-columns: 38px 1fr 38px; align-items: center; gap: 10px; }
.scrub .t { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.scrub .t:last-child { text-align: right; }
.progress { height: 4px; background: rgba(255, 255, 255, 0.18); border-radius: 2px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--ink); border-radius: 2px; transition: width 0.5s linear; }
.transport { display: flex; align-items: center; justify-content: center; gap: 28px; }
.play {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--play-bg); color: var(--play-ink);
  display: grid; place-items: center;
  transition: transform 0.12s ease;
}
.play:hover { transform: scale(1.05); }
.play:active { transform: scale(0.97); }
.play svg { width: 26px; height: 26px; fill: currentColor; }
.play[aria-pressed="true"] { box-shadow: 0 0 0 calc(var(--level, 0) * 16px) rgba(255, 255, 255, calc(0.08 + var(--level, 0) * 0.25)); transition: box-shadow 0.1s linear; }
.coming-up { margin-top: 12px; color: var(--ink-2); text-transform: none; letter-spacing: 0; font-size: 12px; display: flex; gap: 8px; align-items: center; }
.coming-up b { color: var(--program, var(--accent)); font-weight: 600; }
.coming-up::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--program, var(--accent)); box-shadow: 0 0 8px var(--program, var(--accent)); }
.play .ico-play { margin-left: 3px; }
.play .ico-stop { display: none; }
.play[aria-pressed="true"] .ico-play { display: none; }
.play[aria-pressed="true"] .ico-stop { display: block; }
.play.is-connecting { animation: ring 1.1s ease-out infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.45); } 100% { box-shadow: 0 0 0 14px transparent; } }
.btn-icon.ghost { width: 40px; height: 40px; color: var(--muted); }
.btn-icon.ghost:hover { color: var(--ink); background: transparent; }
.btn-icon.ghost svg { width: 22px; height: 22px; fill: currentColor; }
.btn-icon .ico-muted { display: none; }
.btn-icon[aria-pressed="true"] .ico-vol { display: none; }
.btn-icon[aria-pressed="true"] .ico-muted { display: block; }
.dock-right { display: flex; align-items: center; justify-content: center; gap: 4px; }
.dock-right input { width: 160px; height: 20px; accent-color: #ffffff; }
.dock-right input:hover { accent-color: var(--accent); }
.dock .status-line { text-align: center; font-size: 11px; min-height: 14px; }

/* Queue */
.queue { display: grid; gap: 10px; padding-bottom: 24px; }
.queue .eyebrow-sm { padding: 0 2px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 7px 4px; border-radius: 6px;
}
.rows > li:hover { background: rgba(255, 255, 255, 0.05); }
.rows .thumb { width: 44px; height: 44px; border-radius: 4px; object-fit: cover; background: var(--surface-2); }
.rows .n { min-width: 0; }
.rows .n strong { display: block; font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .n small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .t { font-family: var(--font-mono); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rows li.is-voice .n strong { color: var(--voice); }
.rows li.is-voice .thumb { object-fit: cover; }
.rows .empty { color: var(--muted); font-size: 13px; padding: 8px 4px; display: block; }
.history summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; padding: 8px 2px; }
.history summary::-webkit-details-marker { display: none; }
.history summary::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); margin-left: 2px; transition: transform 0.2s; }
.history[open] summary::after { transform: rotate(45deg); }
.foot { font-size: 10px; color: var(--faint); padding: 6px 2px 0; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--ink); }

/* Landscape: fixed bottom dock, scrolling content, art sized to the height that is left. */
@media (orientation: landscape) and (min-width: 700px) {
  .player-page { height: 100dvh; min-height: 0; overflow: hidden; }
  .watermark { right: -8vmin; bottom: calc(var(--dock-h) - 6vmin); width: min(70vmin, 560px); opacity: 0.075; }
  .bar { flex: none; }
  .player {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    max-width: 1100px; padding: 16px 28px calc(var(--dock-h) + 24px);
    grid-template-columns: minmax(200px, 38%) minmax(0, 1fr); column-gap: 48px; align-content: start; align-items: start;
  }
  .stage { position: sticky; top: 0; }
  .art { width: min(100%, calc(100dvh - var(--dock-h) - 190px)); margin: 0 auto; }
  .title { font-size: clamp(18px, 2.2vw, 24px); }
  .meta { font-size: 13px; }
  .queue { padding-bottom: 8px; }

  .dock {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
    max-width: none; height: var(--dock-h); margin: 0;
    padding: 0 20px; padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line);
    display: grid; grid-template-columns: minmax(180px, 30%) minmax(0, 1fr) minmax(180px, 30%); align-items: center; column-gap: 16px;
  }
  .dock-now { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .dock-thumb { width: 56px; height: 56px; border-radius: 4px; object-fit: cover; background: var(--surface-2); flex: none; }
  .dock-text { min-width: 0; }
  .dock-text strong { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dock-text small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dock-center { gap: 4px; max-width: 620px; width: 100%; justify-self: center; }
  .transport { gap: 20px; }
  .play { width: 40px; height: 40px; }
  .play svg { width: 18px; height: 18px; }
  .play .ico-play { margin-left: 2px; }
  .btn-icon.ghost { width: 32px; height: 32px; }
  .btn-icon.ghost svg { width: 18px; height: 18px; }
  .dock .status-line { display: none; }
  .dock-right { justify-content: flex-end; }
  .dock-right input { width: 120px; }
}

/* program rows */
.rows > li.in-program { box-shadow: inset 3px 0 0 var(--program); padding-left: 10px; }
.program-tag { background: color-mix(in srgb, var(--program) 22%, transparent); color: var(--program); margin-right: 6px; }

/* Footer stream switch */
.foot .link-btn { font: inherit; color: var(--muted); padding: 0 2px; }
.foot .link-btn[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.foot .link-btn:hover { color: var(--ink); }

/* Diagnostics panel */
.diag { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; max-height: 46vh; display: flex; flex-direction: column; background: rgba(8, 8, 8, 0.96); border-top: 1px solid var(--accent); font: 11px/1.4 var(--font-mono); color: #ddd; padding-bottom: env(safe-area-inset-bottom); }
.diag-head { display: flex; gap: 12px; align-items: center; padding: 6px 10px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.diag-head b { color: var(--accent); letter-spacing: 0.1em; }
.diag-head .link-btn { color: #bbb; }
.diag-live { padding: 4px 10px; color: #fff; white-space: pre-wrap; word-break: break-word; background: rgba(255,255,255,0.04); }
.diag-log { overflow: auto; padding: 4px 10px; flex: 1; }
.diag-log div { white-space: pre-wrap; word-break: break-word; color: #9a9a9a; }
.diag-log div:last-child { color: #eee; }
body.diag-open .dock { bottom: 46vh; }
