/* The station web player (/player on a station's website address): the same player as a station's own /player/ page
   – disc, live pill, now playing, volume, listeners, share, shoutouts and requests – in the station's colour. */
  :root {
    --bg: #0b1120; --panel: #111a2e; --panel2: #16213a; --line: #24324f;
    --text: #e5ecf6; --muted: #8a9bb8; --accent2: color-mix(in srgb, var(--accent) 65%, #fff);
    --live: #ef4444; --ok: #34d399;
  }
  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html, body { height: 100%; }
  body {
    margin: 0; color: var(--text); background: var(--bg);
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
    overflow-x: hidden;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .bg {
    position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg);
  }
  .bg span {
    position: absolute; border-radius: 50%; filter: blur(70px); opacity: .35;
    animation: drift 22s ease-in-out infinite alternate;
  }
  .bg span:nth-child(1) { width: 60vmax; height: 60vmax; top: -20vmax; left: -15vmax; background: var(--accent); }
  .bg span:nth-child(2) { width: 50vmax; height: 50vmax; bottom: -22vmax; right: -18vmax; background: #7c3aed; opacity: .25; animation-delay: -8s; }
  .bg span:nth-child(3) { width: 38vmax; height: 38vmax; bottom: 10vmax; left: -12vmax; background: #34d399; opacity: .12; animation-delay: -14s; }
  @keyframes drift { from { transform: translate(0,0) scale(1); } to { transform: translate(4vmax,3vmax) scale(1.08); } }

  .wrap { min-height: 100%; display: flex; flex-direction: column; align-items: center; padding: 28px 20px 24px; max-width: 460px; margin: 0 auto; }

  .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; align-self: stretch; }
  .brand img { width: 34px; height: 34px; border-radius: 9px; }
  .brand b { font-size: 17px; letter-spacing: .02em; }
  .brand small { display: block; color: var(--muted); font-size: 11px; margin-top: -1px; }
  .brand .sp { flex: 1; }
  .iconbtn { background: rgba(255,255,255,.06); border: 1px solid var(--line); color: var(--text); width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }
  .iconbtn:active { transform: scale(.94); }

  .stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; width: 100%; padding: 10px 0 6px; }

  .disc-wrap { position: relative; width: 220px; height: 220px; display: flex; align-items: center; justify-content: center; }
  .ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); opacity: 0; transition: opacity .5s; }
  .ring.on { opacity: 1; animation: pulse 2.6s ease-out infinite; }
  .ring.r2 { animation-delay: .9s; }
  @keyframes pulse { 0% { transform: scale(.82); opacity: .6; } 100% { transform: scale(1.18); opacity: 0; } }
  .disc {
    width: 180px; height: 180px; border-radius: 50%;
    background: radial-gradient(circle at 32% 28%, #1a2947, #0c1424 70%);
    border: 1px solid var(--line); box-shadow: 0 20px 50px -12px rgba(0,0,0,.6), inset 0 0 0 6px rgba(255,255,255,.02);
    display: flex; align-items: center; justify-content: center; position: relative; z-index: 1;
  }
  .disc img { width: 74px; height: 74px; opacity: .95; }
  .disc.spin img { animation: spin 9s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }

  .live-pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.35); color: #fca5a5; padding: 4px 11px 4px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; }
  .live-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 rgba(239,68,68,.6); animation: dot 1.6s ease-in-out infinite; }
  @keyframes dot { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.5); } 50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); } }
  .live-pill.off { background: rgba(138,155,184,.1); border-color: var(--line); color: var(--muted); }
  .live-pill.off i { background: var(--muted); animation: none; }

  .nowplaying { text-align: center; min-height: 54px; width: 100%; padding: 0 6px; }
  .np-status { color: var(--muted); font-size: 12px; margin-bottom: 6px; display: flex; align-items: center; justify-content: center; gap: 8px; }
  .eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
  .eq i { width: 3px; background: var(--accent); border-radius: 2px; height: 4px; animation: eq 1s ease-in-out infinite; animation-play-state: paused; }
  .eq i:nth-child(1) { animation-delay: -.9s; } .eq i:nth-child(2) { animation-delay: -.5s; } .eq i:nth-child(3) { animation-delay: -.7s; } .eq i:nth-child(4) { animation-delay: -.2s; }
  .playing .eq i { animation-play-state: running; }
  @keyframes eq { 0%,100% { height: 3px; } 50% { height: 12px; } }
  .np-title { font-size: 19px; font-weight: 700; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .np-artist { color: var(--muted); font-size: 14px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .np-sub { color: var(--muted); font-size: 12px; margin-top: 8px; }

  .controls { display: flex; align-items: center; justify-content: center; gap: 22px; }
  .playbtn {
    width: 80px; height: 80px; border-radius: 50%; border: none; cursor: pointer;
    background: linear-gradient(155deg, var(--accent2), var(--accent));
    color: var(--accent-ink); display: flex; align-items: center; justify-content: center;
    box-shadow: 0 14px 30px -8px color-mix(in srgb, var(--accent) 55%, transparent);
    transition: transform .15s;
  }
  .playbtn:active { transform: scale(.93); }
  .playbtn svg { width: 30px; height: 30px; }
  .playbtn.buffering { animation: spinring 1s linear infinite; }
  @keyframes spinring { to { filter: hue-rotate(20deg); } }

  .volrow { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 260px; }
  .volrow svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
  input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 2px; background: var(--panel2); outline: none; }
  input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%; background: var(--accent); cursor: pointer; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
  input[type=range]::-moz-range-thumb { width: 15px; height: 15px; border: none; border-radius: 50%; background: var(--accent); cursor: pointer; }

  .stats { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; }
  .stats span { display: inline-flex; align-items: center; gap: 5px; }
  .stats svg { width: 13px; height: 13px; }

  .install-tip { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; box-shadow: 0 20px 40px -14px rgba(0,0,0,.6); transform: translateY(140%); transition: transform .35s ease; max-width: 420px; margin: 0 auto; }
  .install-tip.show { transform: translateY(0); }
  .install-tip img { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; }
  .install-tip p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.4; flex: 1; }
  .install-tip b { color: var(--text); }
  .install-tip button { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 4px; line-height: 1; }

  footer { margin-top: 22px; color: var(--muted); font-size: 11px; opacity: .6; text-align: center; }

  .toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--panel2); border: 1px solid var(--line); color: var(--text); padding: 8px 16px; border-radius: 99px; font-size: 12.5px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 20; }
  .toast.show { opacity: 1; transform: translate(-50%, 0); }

  /* ---- shoutout / request FAB + sheet ---- */
  .fab { position: fixed; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 15; display: inline-flex; align-items: center; gap: 8px; padding: 13px 18px 13px 15px; border: none; border-radius: 99px; background: linear-gradient(155deg, var(--accent2), var(--accent)); color: var(--accent-ink); font-weight: 700; font-size: 13.5px; cursor: pointer; box-shadow: 0 14px 30px -10px color-mix(in srgb, var(--accent) 60%, transparent); }
  .fab:active { transform: scale(.96); }
  .fab svg { width: 18px; height: 18px; }
  .fab.off { background: var(--panel2); color: var(--muted); box-shadow: none; border: 1px solid var(--line); cursor: default; }

  .sheet-overlay { position: fixed; inset: 0; background: rgba(4,8,18,.6); backdrop-filter: blur(2px); z-index: 30; opacity: 0; pointer-events: none; transition: opacity .25s; }
  .sheet-overlay.show { opacity: 1; pointer-events: auto; }
  .sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; background: var(--panel); border: 1px solid var(--line); border-bottom: none; border-radius: 20px 20px 0 0; padding: 10px 18px calc(20px + env(safe-area-inset-bottom)); max-width: 460px; margin: 0 auto; max-height: 86vh; overflow: auto; transform: translateY(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1); box-shadow: 0 -20px 50px -10px rgba(0,0,0,.6); }
  .sheet-overlay.show .sheet { transform: translateY(0); }
  .sheet-grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 12px; }
  .sheet-h { display: flex; align-items: center; margin-bottom: 12px; }
  .sheet-h b { font-size: 16px; }
  .sheet-close { margin-left: auto; background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; }
  .sheet-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
  .sheet-tab { flex: 1; padding: 9px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
  .sheet-tab.active { color: var(--accent-ink); background: linear-gradient(155deg, var(--accent2), var(--accent)); border-color: transparent; }
  .field { display: block; margin-bottom: 12px; }
  .field span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
  .field input[type=text], .field textarea { width: 100%; background: #0c1424; color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14.5px; resize: none; }
  .field input[type=text]:focus, .field textarea:focus, .field input.searchbox:focus { outline: none; border-color: var(--accent); }
  .field textarea { min-height: 64px; }
  .charcount { text-align: right; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
  .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
  .results { list-style: none; margin: 0 0 12px; padding: 0; max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
  .results:empty { display: none; }
  .result-row { display: flex; flex-direction: column; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
  .result-row:last-child { border-bottom: none; }
  .result-row:active, .result-row:hover { background: var(--panel2); }
  .result-row b { font-size: 13.5px; }
  .result-row small { color: var(--muted); font-size: 12px; }
  .search-hint { font-size: 12px; color: var(--muted); padding: 8px 2px; }
  .selected-track { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--accent); border-radius: 10px; background: color-mix(in srgb, var(--accent) 10%, transparent); margin-bottom: 12px; }
  .selected-track .stinfo { flex: 1; min-width: 0; }
  .selected-track b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .selected-track small { color: var(--muted); }
  .selected-track button { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; }
  .sheet-submit { width: 100%; padding: 13px; border: none; border-radius: 12px; background: linear-gradient(155deg, var(--accent2), var(--accent)); color: var(--accent-ink); font-weight: 700; font-size: 14.5px; cursor: pointer; }
  .sheet-submit:disabled { opacity: .5; }
  .sheet-error { color: #fca5a5; font-size: 12.5px; margin: -4px 0 12px; }
  .sheet-success { text-align: center; padding: 30px 10px 10px; }
  .sheet-success .tick { width: 56px; height: 56px; border-radius: 50%; background: rgba(52,211,153,.15); border: 1px solid var(--ok); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
  .sheet-success .tick svg { width: 26px; height: 26px; color: var(--ok); }
  .sheet-success h3 { margin: 0 0 4px; }
  .sheet-success p { color: var(--muted); margin: 0; font-size: 13.5px; }

  body.player { margin: 0; }
  .disc img.logo { width: 120px; height: 120px; object-fit: contain; border-radius: 50%; }
  .disc img.cover { width: 150px; height: 150px; object-fit: cover; border-radius: 50%; opacity: 1; box-shadow: 0 0 0 6px rgba(0,0,0,.35); }
  .disc .mark { width: 96px; height: 96px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-size: 46px; font-weight: 800; }
  .np-show { color: var(--muted); font-size: 12.5px; margin-top: 8px; }
  .open-ext { color: var(--accent2); font-size: 13px; }
  .links { margin-top: 10px; font-size: 12px; display: flex; gap: 12px; justify-content: center; }
  .links a { color: var(--muted); }
  [hidden] { display: none !important; }
  body.sheet-open { overflow: hidden; }
  .volrow svg.muted { opacity: .4; }
  .volrow svg { cursor: pointer; }
  /* steady connection (steady.js): the listener-chosen buffer */
  .steady { margin-top: 16px; text-align: center; }
  .steady-head { display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .02em; margin-bottom: 8px; }
  .steady-head svg { width: 15px; height: 15px; }
  .steady-opts { display: inline-flex; gap: 6px; }
  .steady-opts button { border: 1px solid var(--line); background: none; color: var(--muted); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; font: inherit; font-size: 12.5px; }
  .steady-opts button.on { border-color: var(--accent); color: var(--accent2); background: color-mix(in srgb, var(--accent) 10%, transparent); }
  .steady-hint { color: var(--muted); font-size: 11.5px; margin: 8px auto 0; max-width: 330px; line-height: 1.45; }

/* stream watch (stream-watch.js): "Attempting to reconnect you to …" while a dropped stream is brought back */
.sw-banner { position: fixed; left: 50%; top: max(14px, env(safe-area-inset-top)); z-index: 9999; transform: translate(-50%, -160%);
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 24px); padding: 10px 16px; border-radius: 999px;
  background: rgba(15, 18, 26, .94); color: #fff; font: 600 14px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .12); transition: transform .3s ease; pointer-events: none; }
.sw-banner.show { transform: translate(-50%, 0); }
.sw-spin { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); border-top-color: #fff; animation: sw-spin .8s linear infinite; }
.sw-banner.ok .sw-spin { animation: none; border: 0; background: #34d399; width: 10px; height: 10px; }
@keyframes sw-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sw-banner { transition: none; } .sw-spin { animation-duration: 2s; } }

/* "Powered by Stationhand" (the Station Manager can switch it off per station) */
.powered { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: inherit; opacity: .75; text-decoration: none; margin-top: 6px; }
.powered:hover { opacity: 1; }
.powered img { width: 18px; height: 18px; display: block; }
.powered b { font-weight: 700; }
.em-powered { flex: none; display: inline-flex; opacity: .8; } .em-powered:hover { opacity: 1; } .em-powered img { width: 18px; height: 18px; display: block; }
body.player .powered { display: flex; width: max-content; margin: 12px auto 0; color: var(--muted, #9aa4b5); }
/* room under the page for the floating "Request" button, so the footer and its links aren't hidden behind it */
body.player .wrap { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
