/* Stationhand listener app – phone first, dark by default (follows a light device too). Station colours come in as --st. */
:root {
  --bg: #0d1016; --panel: #161b25; --panel2: #1e2533; --line: #273043; --text: #eef1f6; --muted: #9aa3b4; --accent: #0ea5e9; --live: #ef4444;
  --r: 16px; --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark light;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f3f5f9; --panel: #ffffff; --panel2: #eceff5; --line: #dfe3ea; --text: #10141b; --muted: #5d6573; --accent: #0284c7; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--font); min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(20px + env(safe-area-inset-bottom)) env(safe-area-inset-left); }
body.with-mini { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
a { color: var(--accent); }
.muted { color: var(--muted); }
.pad { padding: 0 16px; }
.err { color: #f87171; }
main { max-width: 760px; margin: 0 auto; }
h1 { font-size: 26px; margin: 12px 0 2px; line-height: 1.2; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 16px 8px; font-weight: 700; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 19px; margin-right: auto; }
.logo img { width: 32px; height: 32px; }
.install { background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 7px 14px; font: 600 14px var(--font); }

.search { padding: 14px 16px 0; }
.search input { width: 100%; font: inherit; padding: 12px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hint { margin: 12px 16px 0; padding: 10px 14px; border-radius: 12px; background: var(--panel2); font-size: 14px; }
.linkish { background: none; border: 0; color: var(--accent); font: inherit; padding: 0 4px; cursor: pointer; }

.list { display: grid; gap: 8px; padding: 0 12px; }
@media (min-width: 700px) { .list { grid-template-columns: 1fr 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.st { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; color: var(--text); text-decoration: none; min-height: 76px; }
.st:active { background: var(--panel2); }
.st-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.st-text b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-text small { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-line { color: var(--text); }
.live-line b { font-weight: 600; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--live); margin-right: 6px; vertical-align: 1px; }

.art { --st: var(--accent); flex: none; width: 56px; height: 56px; border-radius: 12px; background: var(--panel2); display: grid; place-items: center; overflow: hidden; }
.art img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.art b { width: 100%; height: 100%; display: grid; place-items: center; background: var(--st); color: #fff; font-size: 24px; font-weight: 800; }
.art.big { width: min(220px, 58vw); height: min(220px, 58vw); border-radius: 28px; box-shadow: 0 18px 50px rgba(0,0,0,.35); }
.art.big b { font-size: 90px; }
.art.big img { padding: 14px; }

.playbtn { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; }
.playbtn.big { width: 76px; height: 76px; }
.playbtn.loading { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.i-play { display: inline-block; width: 0; height: 0; border-left: 14px solid currentColor; border-top: 9px solid transparent; border-bottom: 9px solid transparent; margin-left: 4px; }
.i-pause { display: inline-block; width: 13px; height: 16px; border-left: 4px solid currentColor; border-right: 4px solid currentColor; }
.playbtn.big .i-play { border-left-width: 22px; border-top-width: 14px; border-bottom-width: 14px; margin-left: 6px; }
.playbtn.big .i-pause { width: 20px; height: 24px; border-left-width: 6px; border-right-width: 6px; }

.back { margin: 12px 16px 0; }
.back a { text-decoration: none; font-weight: 600; }
.station { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 18px 20px 4px; }
.station .art.big { margin-bottom: 10px; }
.onair { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; margin: 12px 0 0; }
.live { font-size: 11px; font-weight: 800; letter-spacing: .08em; color: #fff; background: var(--live); padding: 2px 8px; border-radius: 6px; }
.np { font-size: 18px; font-weight: 650; margin: 6px 0 0; }
.controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; width: 100%; max-width: 360px; margin: 18px 0 6px; }
.fav, .ghostbtn { justify-self: end; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font: 600 14px var(--font); text-decoration: none; cursor: pointer; }
.ghostbtn { justify-self: start; }
.fav.on { color: #fbbf24; }
.spacer { display: block; }
.block { margin: 14px 12px 0; padding: 4px 16px 10px; }
.block h2 { margin: 12px 0 6px; }
.block p { margin: 0 0 10px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows li > span { display: flex; flex-direction: column; min-width: 0; }
.links { display: flex; gap: 14px; flex-wrap: wrap; }

.mini { position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 10; max-width: 744px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 8px; border-radius: 18px; background: color-mix(in srgb, var(--panel) 94%, transparent);
  border: 1px solid var(--line); box-shadow: 0 10px 34px rgba(0,0,0,.35); backdrop-filter: blur(14px); }
.mini[hidden] { display: none; }
.mini-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--text); text-align: left; font: inherit; padding: 0; cursor: pointer; }
.mini-art .art { width: 48px; height: 48px; border-radius: 10px; }
.mini-text { min-width: 0; display: flex; flex-direction: column; }
.mini-text b, .mini-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-text small { color: var(--muted); font-size: 13px; }
.mini-play { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; }

/* 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; } }
