/* =========================================================
 * Base reset + defaults
 * ========================================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  height: 100vh;
  width: 100vw;
  overflow: hidden;

  background: transparent;
  color: #fff;
  font-family: "SF Pro Text", "SF Pro Display", "Geist", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  position: relative;
}

/* =========================================================
 * Desktop/tablet variables (single consolidated root)
 * - 1080p baseline stays EXACT
 * ========================================================= */
:root {
  /* 1080p baseline */
  --artSize: 700px;
  --sidePad: 100px;
  --colGap: 100px;

  /* Typography ratios (scale off artSize) */
  --fs-artist: 0.085;
  --fs-title:  0.072;
  --fs-album:  0.068;
  --fs-file:   0.052;
  --fs-rating: 0.063;

  /* --- modal vars --- */
  --radius: 14px;
  --text: rgba(255,255,255,.92);
  --muted2: rgba(255,255,255,.55);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Scale down on smaller desktops/tablets */
@media (max-width: 1600px) {
  :root {
    --artSize: min(700px, 45vw, 80vh);

    --sidePad: clamp(12px, calc(var(--artSize) * 0.10), 100px);
    --colGap:  clamp(20px, calc(var(--artSize) * 0.14), 100px);
  }
}

/* =========================================================
 * Boot gating
 * ========================================================= */
body.booting #content {
  opacity: 0;
  transition: opacity 500ms ease;
}
body.booting #background-a,
body.booting #background-b {
  opacity: 0;
}
body.ready #content {
  opacity: 1;
  transition: none;
}
body.booting .fade-in,
body.booting .fade-out {
  transition: none !important;
}

/* =========================================================
 * Background layers (double buffer crossfade)
 * ========================================================= */
#background-a,
#background-b {
  position: fixed;
  inset: 0;

  background: #000 center / cover no-repeat;

  filter: blur(18px) brightness(0.3);
  transform: scale(1.08);

  z-index: -2;
  opacity: 0;
  transition: opacity 800ms ease;
}

/* =========================================================
 * Main layout (desktop/tablet)
 * ========================================================= */
#content {
  display: flex;
  align-items: center;
  justify-content: center;

  gap: var(--colGap);

  height: 100%;
  padding: 0 var(--sidePad);

  z-index: 1;
}

/* =========================================================
 * Album art (desktop/tablet)
 * ========================================================= */
#album-art-wrapper {
  flex: 0 0 auto;
  width: var(--artSize);
  aspect-ratio: 1 / 1;
  height: auto;

  position: relative;
  overflow: hidden;

  border-radius: 32px;
  background: #111;
}

/* Foreground art */
#album-art,
#album-art-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 24px;
  overflow: hidden;
  -webkit-mask-image: -webkit-radial-gradient(white, black);

  position: relative;
  z-index: 2;
}
#album-art-video { z-index: 3; }

/* Blurred halo */
#album-art-bg {
  position: absolute;
  inset: -30px;

  border-radius: 48px;
  background: center / cover no-repeat;

  filter: blur(24px) brightness(0.28);
  transform: scale(1.05);

  z-index: 1;
}

/* Album link should remain clickable */
#album-link {
  position: relative;
  z-index: 20;
  pointer-events: auto;
  font-size: clamp(22px, calc(var(--artSize) * var(--fs-album)), 48px);
  color: #ccc;
  text-decoration: none;
}

/* Album line: text + icon behave like one inline piece */
#album-text .album-inline {
  display: inline;
}

/* Share icon (rendered inside album line) */
#album-text .share-icon {
  width: 0.9em;
  height: 0.9em;
  display: inline-block;
  vertical-align: -0.12em;

  margin-left: 0.22em;
  fill: currentColor;
  opacity: 0.65;

  pointer-events: none; /* icon never steals taps/clicks */
}

/* =========================================================
 * Pause screensaver (CSS-side hide rules)
 * ========================================================= */
body.pause #album-art-wrapper {
  background: transparent !important;
  box-shadow: none !important;
}
body.pause #album-art-wrapper {
  border-radius: 24px !important;
  overflow: hidden !important;
  -webkit-mask-image: -webkit-radial-gradient(white, black);
}
body.pause #album-art,
body.pause #album-art-video {
  /* keep simple for older Pi Chromium */
}
body.pause #album-art-bg { display: none !important; }

/* =========================================================
 * Favorites heart overlay
 * - Default: visible (desktop + phone)
 * - Hidden when it does not apply: radio/stream/airplay/upnp/podcast/pause
 * ========================================================= */
#fav-heart {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  position: absolute;
  right: 14px;
  bottom: 14px;

  width: 32px;
  height: 32px;

  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;

  z-index: 9999;
  pointer-events: auto;

  opacity: 0.92;
  transition: transform 120ms ease, opacity 120ms ease;

  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#fav-heart svg {
  width: 100%;
  height: 100%;
  display: block;

  fill: transparent;
  stroke: rgba(210, 210, 210, 0.92);
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;

  transition: fill 140ms ease, stroke 140ms ease;
}

#fav-heart.on svg {
  fill: rgba(210, 210, 210, 0.92);
  stroke: rgba(210, 210, 210, 0.92);
}

#fav-heart:active { transform: scale(0.96); }
#fav-heart.busy { opacity: 0.55; pointer-events: none; }

/* Hide on modes where favorites don't make sense */
body.is-radio   #fav-heart,
body.is-stream  #fav-heart,
body.is-airplay #fav-heart,
body.is-upnp    #fav-heart,
body.is-podcast #fav-heart,
body.pause      #fav-heart {
  display: none !important;
}

/* =========================================================
 * Mode logo (desktop/tablet overlay)
 * ========================================================= */
#mode-logo {
  position: absolute;
  right: 0;
  bottom: 0;

  width: 100px;
  height: 100px;

  display: none;
}

#mode-logo.radio-logo {
  width: 75px;
  height: 75px;
  opacity: 0.85;
  border-radius: 8px;
}

/* =========================================================
 * Text column (desktop/tablet)
 * ========================================================= */
.text-column {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;

  height: var(--artSize);

  flex: 1 1 auto;
  min-width: 0;
  max-width: 1100px;

  position: relative;
}

/* =========================================================
 * Typography (desktop/tablet)
 * ========================================================= */
#artist-name {
  font-weight: 600;
  text-shadow: 0 4px 14px rgba(0,0,0,0.9);
  font-size: clamp(28px, calc(var(--artSize) * var(--fs-artist)), 60px);
  line-height: 1.2;
  padding-bottom: 0.14em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

#titleLine {
  display: block;
  min-width: 0;
}

#track-title {
  display: -webkit-box;
  font-weight: 600;
  text-shadow: 0 3px 12px rgba(0,0,0,0.9);
  font-size: clamp(24px, calc(var(--artSize) * var(--fs-title)), 50px);
  line-height: 1.14;
  padding-bottom: 0.08em;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.rating-stars {
  display: inline-flex;
  cursor: pointer;
  margin-top: 4px;

  text-shadow: 0 3px 12px rgba(0,0,0,0.9);
  font-size: clamp(22px, calc(var(--artSize) * var(--fs-rating)), 44px);
  letter-spacing: clamp(3px, calc(var(--artSize) * 0.011), 8px);
}
.rating-stars span.dim { opacity: 0.2; }
.rating-stars span.filled { color: #d4af37; }
.rating-stars span.loading {
  opacity: 1;
  color: #d4af37;
  display: inline-block;
  animation: ratingSpin 1s linear infinite;
  transform-origin: 50% 54%;
}
@keyframes ratingSpin { to { transform: rotate(360deg); } }

#file-info {
  font-size: clamp(18px, calc(var(--artSize) * var(--fs-file)), 36px);
  font-weight: 600;
  color: #aaa;
}

#mode-status {
  margin-left: 8px;
}

.hires-badge {
  display: none;
  margin-left: 8px;
  vertical-align: 0.2em;
  line-height: 1;
}

.hires-badge.is-hq {
  background: gold;
  color: #000;
  font-size: 0.6em;
  padding: 1px 4px;
  margin-bottom: 1px;
  border-radius: 6px;
}

.hires-badge.is-lossless {
  padding: 0;
  margin-left: 10px;
  vertical-align: -0.05em;
}

.hires-badge.is-lossless img {
  display: block;
  height: 0.81em;
  width: auto;
  filter: drop-shadow(0 0 1px rgba(0,0,0,0.98)) drop-shadow(0 0 2px rgba(0,0,0,0.95));
}

#personnel-info {
  font-size: 18px;
  color: #ccc;
  line-height: 1.3;
  padding-bottom: 0.08em;
  margin-bottom: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  line-clamp: 6;
}

/* =========================================================
 * Next Up (desktop/tablet)
 * ========================================================= */
#next-up {
  position: fixed;
  right: 24px;
  bottom: 28px;

  display: flex;
  align-items: flex-end;

  gap: clamp(8px, calc(var(--artSize) * 0.02), 14px);

  font-size: clamp(14px, calc(var(--artSize) * 0.037), 26px);
  font-weight: 600;
  z-index: 120;
  max-width: min(42vw, 760px);
}

#next-up-img {
  width: clamp(34px, calc(var(--artSize) * 0.1071429), 75px);
  height: clamp(34px, calc(var(--artSize) * 0.1071429), 75px);

  border-radius: clamp(8px, calc(var(--artSize) * 0.0171429), 12px);

  object-fit: cover;
  display: none; /* JS decides when it shows */
}

/* Non-phone views: disable marquee duplication */
body:not(.phone-ui) #next-up-text .marquee-copy:nth-child(2) {
  display: none;
}

body:not(.phone-ui) #next-up-text {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  align-self: flex-end;
  line-height: 1;
}

/* =========================================================
 * Progress bar (desktop/tablet)
 * ========================================================= */
#progress-bar-wrapper {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 900px;        /* 1080p baseline */
  max-width: 100%;
  height: 8px;

  background: rgba(210, 216, 228, 0.55);
  border-radius: 4px;

  margin-top: 0;
  overflow: hidden;
}

@media (max-width: 1600px) {
  #progress-bar-wrapper { width: clamp(260px, 52vw, 900px); }
}

#progress-fill {
  height: 12px;
  background: rgba(210, 216, 228, 0.92);

  transform: scaleX(0);
  transform-origin: left;
}

/* =========================================================
 * Modal open: hide fixed UI so it can’t bleed through
 * ========================================================= */
body.modal-open #progress-bar-wrapper,
body.modal-open #phone-controls,
body.modal-open #next-up,
body.modal-open #mode-logo {
  display: none !important;
}

/* =========================================================
 * Modal shell
 * ========================================================= */
#artist-details-container {
  position: fixed;
  inset: 0;

  background: rgba(0,0,0,0.75);
  display: none;

  z-index: 999;
  align-items: center;
  justify-content: center;
}

/* =========================================================
 * Personnel hotspot (default hidden; phone-ui will show)
 * ========================================================= */
#art-info-hotspot {
  display: none;

  position: absolute;
  top: 10px;
  left: 10px;

  width: 32px;
  height: 32px;

  border-radius: 999px;
  border: 0;
  background: transparent;

  color: rgba(210,210,210,0.92);

  align-items: center;
  justify-content: center;

  z-index: 65;
  pointer-events: auto;
  opacity: 0.92;
  transition: transform 120ms ease, opacity 120ms ease;
}
#art-info-hotspot svg{width:88%;height:88%;display:block;fill:currentColor}
#art-info-hotspot:active{transform:scale(0.96)}

/* =========================================================
 * Phone UI (JS-controlled) — use body.phone-ui everywhere
 * ========================================================= */
body.phone-ui {
  --nextUpLift: 6px;
  --padTop: 30px;
  --padSide: 16px;

  --gapUnderArt: 18px;
  --barH: 6px;

  --artRadius: 24px;
  --artSize: min(92vw, 44vh);

  --nextUpH: 34px;
  --controlsH: 88px;

  --bottomGap: 45px;

  --ctl: clamp(44px, 12vw, 52px);
  --ctl-big: clamp(54px, 15vw, 64px);
  --ctl-icon: clamp(22px, 6vw, 26px);
  --ctl-icon-big: clamp(26px, 7vw, 30px);
  --ctlGap: clamp(16px, 5vw, 22px);
}

/* ===== Phone UI marquee: single-line, no wrap, infinite scroll ===== */
body.phone-ui #next-up-text{
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  text-align: left;

  --marqueeGap: 24px;
  --marqueeDur: 10s;
}

body.phone-ui #next-up-text .marquee-track{
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  white-space: nowrap;

  width: max-content;
  will-change: transform;
  transform: translate3d(0,0,0);
}

body.phone-ui #next-up-text .marquee-copy{
  display: inline-block;
  white-space: nowrap;
  flex: 0 0 auto;
  padding-right: var(--marqueeGap);
}

body.phone-ui #next-up-text:not(.marquee) .marquee-copy:nth-child(2){
  display: none;
}
body.phone-ui #next-up-text:not(.marquee) .marquee-copy{
  padding-right: 0;
}

body.phone-ui #next-up-text.marquee .marquee-track{
  animation: nextup-marquee var(--marqueeDur) linear infinite;
}

@keyframes nextup-marquee{
  0%   { transform: translate3d(0,0,0); }
  100% { transform: translate3d(-50%,0,0); }
}

/* =========================================================
 * Phone UI layout
 * ========================================================= */
body.phone-ui #content {
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;

  width: 100% !important;
  height: 100% !important;

  padding-top: var(--padTop) !important;
  padding-right: 0 !important;
  padding-left: var(--padSide) !important;

  padding-bottom: calc(
    env(safe-area-inset-bottom, 0px) +
    var(--controlsH) +
    var(--bottomGap) +
    var(--nextUpH) +
    12px
  ) !important;

  gap: 14px !important;
}

body.phone-ui #album-art-wrapper {
  width: var(--artSize) !important;
  height: var(--artSize) !important;
  border-radius: var(--artRadius) !important;
}

body.phone-ui #personnel-info {
  display: none !important;
}

body.phone-ui .text-column {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: auto !important;

  align-items: center !important;
  text-align: center !important;
  gap: 10px !important;

  padding: 0 !important;
  margin-top: 18px !important;
}

/* Phone typography (UNCHANGED from your intent) */
body.phone-ui #artist-name { font-size: 20px !important; }
body.phone-ui #track-title { font-size: 18px !important; }
body.phone-ui .rating-stars { font-size: 24px !important; letter-spacing: 4px !important; }
body.phone-ui #album-link { font-size: 16px !important; }
body.phone-ui #file-info { font-size: 14px !important; }

body.phone-ui #titleLine {
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
}

body.phone-ui #ratingStars {
  display: flex !important;
  justify-content: center !important;
}

/* =========================================================
 * Progress bar (phone)
 * ========================================================= */
body.phone-ui #progress-bar-wrapper {
  position: fixed !important;

  width: calc(var(--artSize) - (var(--artRadius) * 2)) !important;
  height: var(--barH) !important;

  left: 50% !important;
  transform: translateX(-50%) !important;

  top: calc(var(--artBottom, 0px) + var(--gapUnderArt)) !important;

  margin: 0 !important;
  border-radius: 999px !important;
  background: rgba(210, 216, 228, 0.58) !important;

  z-index: 2000 !important;
  pointer-events: none !important;
}

body.phone-ui #progress-fill {
  height: 10px !important;
  pointer-events: none !important;
}

/* =========================================================
 * Next Up footer (phone)
 * ========================================================= */
body.phone-ui #next-up {
  position: fixed !important;

  left: var(--padSide) !important;
  right: 0 !important;
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--nextUpLift)) !important;

  height: var(--nextUpH) !important;

  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;

  gap: 10px !important;
  margin: 0 !important;

  font-size: 14px !important;
  font-weight: 600 !important;

  background: transparent !important;
  box-shadow: none !important;

  z-index: 5300 !important;
  pointer-events: none !important;
  max-width: none !important;
}

body.phone-ui #next-up-img {
  width: 35px !important;
  height: 35px !important;
  border-radius: 8px !important;
  display: block !important;
  object-fit: cover !important;
  flex: 0 0 auto !important;
}

/* =========================================================
 * Playback controls (phone-ui only)
 * ========================================================= */
#phone-controls { display: none; } /* default hidden */

body.phone-ui {
  --controlsRowW: calc(100vw - (var(--padSide) * 2));
  --ctlScaleW: clamp(1, calc(var(--controlsRowW) / 390px), 1.25);

  --ctl:     calc(52px * var(--ctlScaleW));
  --ctlBig:  calc(64px * var(--ctlScaleW));

  --ctlMax:     calc(var(--controlsH) - 12px);
  --ctlBigMax:  calc(var(--controlsH) - 4px);

  --ctlFinal:    min(var(--ctl), var(--ctlMax));
  --ctlBigFinal: min(var(--ctlBig), var(--ctlBigMax));

  --ctlIcon:     calc(var(--ctlFinal) * 0.50);
  --ctlIconBig:  calc(var(--ctlBigFinal) * 0.47);

  --ctlGap: clamp(18px, calc(var(--controlsRowW) * 0.06), 26px);
}

body.phone-ui #phone-controls {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;

  bottom: calc(
    env(safe-area-inset-bottom, 0px) +
    var(--nextUpH) +
    var(--bottomGap) - 25px
  ) !important;

  height: var(--controlsH) !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: var(--ctlGap) !important;

  padding: 0 !important;
  background: none !important;
  box-shadow: none !important;
  border: 0 !important;

  z-index: 5200 !important;
  pointer-events: auto !important;
}

body.phone-ui #phone-controls .ctl {
  -webkit-appearance: none;
  appearance: none;

  border: 0;
  outline: 0;

  width: var(--ctlFinal) !important;
  height: var(--ctlFinal) !important;

  min-width: 44px;
  min-height: 44px;

  border-radius: 50%;
  display: grid;
  place-items: center;

  background: rgba(255, 255, 255, 0.12);
  color: #fff;

  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);

  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body.phone-ui #phone-controls .ctl.big {
  width: var(--ctlBigFinal) !important;
  height: var(--ctlBigFinal) !important;

  min-width: 56px;
  min-height: 56px;

  background: rgba(255, 255, 255, 0.18);
}

body.phone-ui #phone-controls svg {
  width: var(--ctlIcon) !important;
  height: var(--ctlIcon) !important;

  display: block;
  flex: 0 0 auto;

  fill: currentColor;
  opacity: 0.95;
}

body.phone-ui #phone-controls .ctl.big svg {
  width: var(--ctlIconBig) !important;
  height: var(--ctlIconBig) !important;
}

body.phone-ui #phone-controls .ctl:active { transform: scale(0.96); }
body.phone-ui #phone-controls .ctl.on {
  background: rgba(34,197,94,0.24);
  box-shadow: 0 0 0 1px rgba(34,197,94,0.58) inset, 0 6px 18px rgba(0,0,0,0.35);
  color: #22c55e;
}
body.phone-ui #phone-controls .ctl.big.on {
  background: rgba(34,197,94,0.30);
  box-shadow: 0 0 0 1px rgba(34,197,94,0.72) inset, 0 8px 20px rgba(0,0,0,0.38);
}

/* =========================================================
 * Waveshare-style landscape strip (e.g., 1280x400)
 * Show compact transport controls on desktop-sized kiosk displays.
 * ========================================================= */
@media (orientation: landscape) and (min-width: 1180px) and (max-width: 1400px) and (max-height: 430px) {
  body:not(.phone-ui) {
    --artSize: min(700px, 48vw, 88vh);
  }

  body:not(.phone-ui) #content {
    align-items: center;
    padding-top: 0;
    padding-bottom: 0;
  }

  body:not(.phone-ui) #album-art-wrapper {
    align-self: center;
    margin-bottom: 0;
  }

  body:not(.phone-ui) .text-column {
    height: calc(100vh - 22px);
    max-height: none;
    gap: 18px;
    margin-top: 50px; /* nudge metadata block down so stars sit near art centerline */
    padding-bottom: 46px;
    padding-right: 300px; /* reserve top-right space so artist/title don't sit under controls */
  }

  body:not(.phone-ui) #artist-name {
    padding-top: 6px;
    padding-bottom: 4px;
    line-height: 1.14;
    font-size: clamp(37px, calc(var(--artSize) * 0.107), 78px);
  }

  body:not(.phone-ui) #titleLine {
    margin-bottom: 4px;
  }

  body:not(.phone-ui) #track-title {
    font-size: clamp(32px, calc(var(--artSize) * 0.090), 67px);
    margin-bottom: 10px;
  }

  body:not(.phone-ui) #titleLine .rating-stars {
    font-size: clamp(29px, calc(var(--artSize) * 0.084), 59px);
    margin-top: 8px;
  }

  body:not(.phone-ui) #album-link {
    font-size: clamp(25px, calc(var(--artSize) * 0.076), 55px);
    margin-top: 2px;
    margin-bottom: 4px;
  }

  body:not(.phone-ui) #file-info {
    font-size: clamp(20px, calc(var(--artSize) * 0.056), 40px);
  }

  body:not(.phone-ui) #personnel-info {
    display: none !important;
  }

  /* Show info hotspot in strip layout (same behavior as portrait mode) */
  body:not(.phone-ui) #art-info-hotspot {
    display: flex;
  }

  /* Bottom lane: progress under transport, next-up on the right */
  body:not(.phone-ui) #progress-bar-wrapper {
    position: fixed !important;
    left: calc(var(--sidePad) + var(--artSize) + var(--colGap));
    right: 410px;
    bottom: 28px;
    width: auto !important;
    max-width: none !important;
    z-index: 5100;
  }

  body:not(.phone-ui) #phone-controls {
    position: fixed !important;
    right: 18px !important;
    top: 14px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;

    padding: 6px 10px !important;
    border-radius: 999px;
    background: rgba(8, 12, 20, 0.20) !important;
    border: 1px solid rgba(255,255,255,0.10);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 5200 !important;
    opacity: .22;
    transition: opacity .22s ease, background-color .22s ease, border-color .22s ease;
  }

  body:not(.phone-ui) #phone-controls.controls-awake {
    opacity: 1;
    background: rgba(8, 12, 20, 0.45) !important;
    border-color: rgba(255,255,255,0.16);
  }

  body:not(.phone-ui) #phone-controls .ctl {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px;
    min-height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 0;
    background: rgba(255,255,255,0.14);
    color: #fff;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.3);
  }

  body:not(.phone-ui) #phone-controls .ctl.big {
    width: 50px !important;
    height: 50px !important;
    min-width: 50px;
    min-height: 50px;
    background: rgba(255,255,255,0.2);
  }

  body:not(.phone-ui) #phone-controls .ctl.on {
    background: rgba(34,197,94,0.24);
    box-shadow: 0 0 0 1px rgba(34,197,94,0.58) inset, 0 5px 14px rgba(0,0,0,0.3);
    color: #22c55e;
  }

  body:not(.phone-ui) #phone-controls .ctl.big.on {
    background: rgba(34,197,94,0.30);
    box-shadow: 0 0 0 1px rgba(34,197,94,0.72) inset, 0 6px 16px rgba(0,0,0,0.32);
  }

  body:not(.phone-ui) #phone-controls svg {
    width: 20px !important;
    height: 20px !important;
    fill: currentColor;
  }

  body:not(.phone-ui) #phone-controls .ctl.big svg {
    width: 24px !important;
    height: 24px !important;
  }

  body:not(.phone-ui) #next-up {
    right: 16px;
    bottom: 28px; /* align with progress bar lane */
    max-width: 320px;
    font-size: 15px;
    z-index: 5250;
  }

  body:not(.phone-ui) #mode-logo {
    bottom: 46px;
    width: 72px;
    height: 72px;
  }

  body:not(.phone-ui).is-airplay #mode-logo {
    width: 64px;
    height: 64px;
  }

  /* Personnel popup anchored over album-art region */
  body:not(.phone-ui) #artist-details-container {
    align-items: flex-start;
    justify-content: flex-start;
    background: rgba(0,0,0,0.22);
    padding: 18px 18px 18px 32px; /* nudge personnel card right */
  }
  body:not(.phone-ui) #artist-details {
    margin-left: 0;
    margin-top: 0;
    max-width: min(48vw, 560px);
  }
}

/* =========================================================
 * Personnel hotspot visibility (phone only)
 * ========================================================= */
body.phone-ui #art-info-hotspot { display: flex; }
body.is-radio #art-info-hotspot { display: none !important; }

/* =========================================================
 * Share icon visibility
 * - Default: hidden
 * - Show ONLY on phone-ui + radio + valid Apple Music href
 * ========================================================= */
#album-text .share-icon { display: none !important; }

body.phone-ui.is-radio #album-link[href] .share-icon {
  display: inline-block !important;
}

body.is-airplay #album-text .share-icon,
body.is-upnp    #album-text .share-icon,
body.is-podcast #album-text .share-icon {
  display: none !important;
}

/* Never show share icon unless the Apple Music link is actually present */
#album-link:not([href]) .share-icon {
  display: none !important;
}

/* ---------- Modal ---------- */
.modalOverlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 2000;
}
.modalOverlay.open{ display: flex; }

.modal{
  width: min(920px, 100%);
  max-height: min(78vh, 820px);
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(10,16,28,.92);
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
  display: flex;
  flex-direction: column;
}

.modalHead{
  display:flex;
  gap: 12px;
  align-items:center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
}
.modalTitleWrap{ min-width:0; flex: 1 1 auto; }
.modalTitle{
  margin:0;
  font-size: 15px;
  font-weight: 780;
  line-height: 1.2;
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modalSub{
  font-size: 12px;
  color: var(--muted2);
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modalClose{
  height: 36px;
  min-width: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.modalClose:hover{
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.20);
}

.modalBody{
  padding: 12px 14px 14px;
  overflow: auto;
}

.modalActions{
  display:flex;
  gap: 10px;
  align-items:center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.16);
}

.epList{ display:grid; gap: 10px; }

.epRow{
  display:grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.18);
}

.epTitle{
  font-size: 13px;
  font-weight: 720;
  line-height: 1.25;
  margin: 0 0 4px;
}
.epMeta{
  font-size: 12px;
  color: var(--muted2);
}
.epFile{
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255,255,255,.70);
  max-width: 300px;
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  justify-self: end;
}

.tinyMuted{ font-size: 12px; color: var(--muted2); }
