/* Now tab: a full-screen "now playing" screen, like a music app. Phones first */
.player {
  display: flex; flex-direction: column; align-items: center; gap: clamp(var(--space-3), 2.4dvh, var(--space-5));
  padding: calc(env(safe-area-inset-top) + var(--space-3)) var(--space-5) var(--space-5);
}

.top { width: 100%; display: flex; align-items: center; justify-content: center; position: relative; min-height: 44px; }
.eyebrow { font-size: var(--fs-meta); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: color-mix(in srgb, var(--text) 66%, transparent); }
/* Install app: on the left, only while the browser offers it */
.install {
  position: absolute; left: 0; top: 50%; translate: 0 -50%; height: 32px; padding: 0 var(--space-3);
  border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--text);
  font-size: var(--fs-meta); font-weight: 600; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.install::after { content: ""; position: absolute; inset: -6px -2px; }   /* a 44px tall touch target */
.install[hidden] { display: none; }

/* Cover: as big as the screen allows, square */
.art {
  position: relative; width: min(100%, 44dvh, 380px); aspect-ratio: 1; flex: none; margin-top: clamp(var(--space-1), 2dvh, var(--space-5));
  border-radius: var(--r-xl); display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #5b2bd6));
  box-shadow: 0 24px 60px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform .4s ease;
}
.art span { font-weight: 800; font-size: clamp(56px, 13dvh, 112px); color: #fff; letter-spacing: .02em; }
.art:not(.live) { transform: scale(.94); }
.eq { position: absolute; bottom: 9%; left: 50%; translate: -50% 0; display: flex; gap: 5px; align-items: flex-end; height: 26px; opacity: 0; transition: opacity .3s; }
.eq i { width: 5px; height: 30%; border-radius: 3px; background: rgba(255,255,255,.85); }
.art.live .eq { opacity: 1; }
.art.live .eq i { animation: eq 1s ease-in-out infinite; }
.art.live .eq i:nth-child(2) { animation-delay: -.4s; }
.art.live .eq i:nth-child(3) { animation-delay: -.7s; }
.art.live .eq i:nth-child(4) { animation-delay: -.2s; }
.art.live .eq i:nth-child(5) { animation-delay: -.55s; }
@keyframes eq { 0%,100% { height: 25%; } 50% { height: 100%; } }
@media (prefers-reduced-motion: reduce) { .art.live .eq i { animation: none; height: 60%; } .art { transition: none; } }

.now {   /* room for title, song and status even before the song is known, so nothing below jumps when it arrives */
  width: 100%; text-align: center;
  min-height: calc(var(--fs-title) * 1.15 + var(--fs-body) * 1.4 + var(--space-1) * 2 + 20px);
}
.now h1 { margin: 0 0 var(--space-1); }
.now .status { margin: 0; min-height: 20px; }

.controls { display: flex; justify-content: center; }
.player .play-btn {
  width: clamp(72px, 11dvh, 92px); aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 45%, transparent);
  -webkit-tap-highlight-color: transparent; transition: transform .1s;
}
.player .play-btn:active { transform: scale(.94); }
.player .play-btn svg { width: 44%; height: 44%; fill: currentColor; }

.vol { width: 100%; display: flex; align-items: center; gap: var(--space-3); color: var(--muted); }
.vol svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); height: 32px; }

/* Hover, only where there's a pointer (on phones it would stick after a tap) */
@media (hover: hover) {
  .play-btn { transition: transform .1s, background-color .15s, filter .15s; }
  .player .play-btn:hover { filter: brightness(1.08); }
  .install:hover { border-color: var(--accent-text); color: var(--accent-text); }
}

/* Short phones: a smaller cover and tighter spacing, so everything fits without scrolling */
@media (max-height: 680px) {
  .player { gap: var(--space-2); padding-top: calc(env(safe-area-inset-top) + var(--space-1)); }
  .art { width: min(100%, 36dvh); margin-top: 0; border-radius: var(--r-lg); }
}

/* Phones on their side: the cover on the left, the song and the controls beside it, all on one screen */
@media (orientation: landscape) and (max-height: 520px) {
  .player {
    display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto 1fr auto auto auto 1fr;
    column-gap: var(--space-6); row-gap: var(--space-3); align-items: center;
    padding: var(--space-1) var(--space-5) var(--space-4);
  }
  .top { grid-column: 1 / -1; }
  .art { grid-column: 1; grid-row: 2 / -1; width: min(40vw, calc(100dvh - 160px)); margin: 0; border-radius: var(--r-lg); }
  .art span { font-size: clamp(40px, 12dvh, 72px); }
  .now { grid-column: 2; grid-row: 3; min-height: 0; }
  .controls { grid-column: 2; grid-row: 4; }
  .vol { grid-column: 2; grid-row: 5; }
  .player .play-btn { width: 64px; }
}

@media (min-width: 700px) and (min-height: 700px) {
  .player { padding: var(--space-4) var(--space-6) var(--space-5); }
  .art { width: min(100%, 36dvh, 340px); }
}

/* What's playing: the album cover over the station artwork, and the song under the station name */
.art .cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.art .cover[hidden] { display: none; }
.art:has(.cover:not([hidden])) .eq { background: rgba(0,0,0,.35); padding: var(--space-1) var(--space-2); border-radius: var(--r-sm); height: 36px; }
.now .track {
  margin: 0 0 var(--space-1); font-size: var(--fs-body); color: var(--text); opacity: .85;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.now .track:empty { display: none; }   /* empty: the status moves up under the title; .now keeps the space */

/* Recent tab: the song on now, then the radio's last songs */
.recent { padding: calc(env(safe-area-inset-top) + var(--space-5)) var(--space-5) var(--space-5); }
.recent h1 { font-size: var(--fs-title); }
.recent-note { margin: 0 0 var(--space-4); font-size: var(--fs-label); color: var(--muted); text-wrap: pretty; }
.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; }
.recent-item img { width: 48px; height: 48px; border-radius: var(--r-sm); object-fit: cover; background: var(--card); }
.recent-item .song { display: block; font-size: var(--fs-body); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-item .by { display: block; font-size: var(--fs-label); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-item .at { font-size: var(--fs-meta); color: var(--muted); font-variant-numeric: tabular-nums; }
.recent-item.is-live { margin-bottom: var(--space-2); padding: var(--space-3); border-radius: var(--r-md); background: var(--card); }
.recent-item.is-live img { box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.recent-item.is-live .at { color: var(--accent-text); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.recent-empty { color: var(--muted); font-size: var(--fs-label); }
.recent-empty[hidden] { display: none; }

/* Computers: Now sits in the middle column with the biggest cover the height allows. Play and the status
   live in the player bar along the bottom (style.css), so they leave this column */
@media (min-width: 1024px) and (min-height: 600px) {
  .player {
    --col: min(520px, calc(100dvh - 380px), 100%);
    gap: var(--space-4); padding: var(--space-4) var(--space-6) var(--space-5);
  }
  .top { margin-bottom: auto; }
  .vol { margin-bottom: auto; }   /* with the auto above: cover, song and volume centred under the top line */
  .art, .now, .vol { width: var(--col); }
  .art { margin-top: 0; border-radius: var(--r-xl); }
  .art span { font-size: clamp(72px, 14dvh, 132px); }
  .now { min-height: 0; }
  .now h1 { font-size: clamp(1.875rem, 2.6vw, 2.5rem); letter-spacing: -.01em; }
  .now .track { font-size: 1.125rem; }
  .now .status, .controls { display: none; }

  .recent { padding: var(--space-6) var(--space-6) var(--space-5); }
  .recent-item { padding-inline: var(--space-2); border-radius: var(--r-md); }
  .recent-item.is-live { padding-inline: var(--space-3); }
}
