:root {
  --bg: #0b0f16;
  --panel: #141a24;
  --panel2: #1b2330;
  --line: #242e3d;
  --text: #e8edf5;
  --muted: #8b98a8;
  --accent: #5b8def;
  --danger: #e05a5a;
  --ok: #5bc98d;
  --shadow: rgba(0, 0, 0, 0.35);
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f5f8;
    --panel: #ffffff;
    --panel2: #f0f2f6;
    --line: #e2e6ec;
    --text: #171b22;
    --muted: #667085;
    --accent: #3f6fd8;
    --danger: #c2453f;
    --ok: #23895f;
    --shadow: rgba(20, 25, 35, 0.12);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  min-height: 100svh;
  font: 16px/1.45 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.i { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; width: 20px; height: 20px; vertical-align: -4px; }

.hub-back-btn {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: env(safe-area-inset-left, 0px);
  z-index: 25;
  width: 26px; height: 40px;
  border-radius: 0 10px 10px 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 2px 3px 10px var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: transform .08s ease;
}
.hub-back-btn:active { transform: scale(.94); }
.hub-back-btn svg { display: block; width: 15px; height: 15px; }

.topbar {
  padding: 16px 16px 12px calc(env(safe-area-inset-left, 0px) + 52px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
}
.topbar h1 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 8px; }
.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

main { max-width: 640px; margin: 0 auto; padding: 14px 12px 48px; }

footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 12px 40px; }

.view[hidden] { display: none; }

/* --- Onglets Radio / TV --- */
.kind-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.kind-tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  border-radius: 10px; padding: 9px 0; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.kind-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.kind-tab .i { width: 16px; height: 16px; }

/* --- Liste des stations --- */
.station-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.station-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; cursor: pointer; text-align: left; width: 100%;
  color: inherit; font: inherit; position: relative; overflow: hidden;
  content-visibility: auto; contain-intrinsic-size: 74px;
}
.station-row:active { transform: scale(.99); }
.station-row.no-titling { opacity: .6; }
.badge {
  flex: none; width: 46px; height: 46px; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; line-height: 1;
}
.badge .abbr { font-size: 12px; letter-spacing: .02em; }
.badge .freq { font-size: 9px; opacity: .85; margin-top: 2px; }
.row-main { min-width: 0; flex: 1; }
.row-name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.row-now { color: var(--muted); font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.row-cover { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; flex: none; background: var(--panel2); }
.approx-badge { font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 4px; flex: none; }
.programme-pill { font-size: 10px; background: var(--panel2); color: var(--muted); border-radius: 6px; padding: 1px 6px; flex: none; }
.progress-track { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: transparent; }
.progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width 1s linear; }
.play-btn {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.play-btn svg { width: 15px; height: 15px; }
.play-btn.playing { background: var(--accent); color: #fff; border-color: var(--accent); }

/* --- Vue station --- */
.btn-back-list {
  display: inline-flex; align-items: center; gap: 4px; background: none; border: none; color: var(--muted);
  font: inherit; font-size: 13px; cursor: pointer; padding: 6px 0 12px; margin: 0;
}
.station-header {
  border-radius: 14px; padding: 16px; color: #fff; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.station-header .name { font-size: 20px; font-weight: 800; }
.station-header .freq { font-size: 13px; opacity: .85; }

.now-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 12px;
  display: flex; gap: 14px;
}
.now-card .cover { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; flex: none; background: var(--panel2); }
.now-card .info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.now-card .title { font-size: 17px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-card .artist { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-card .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.now-progress { height: 4px; border-radius: 2px; background: var(--panel2); overflow: hidden; margin-top: 6px; }
.now-progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width 1s linear; }
.no-track { color: var(--muted); font-style: italic; }

.next-block, .programme-block {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px;
  font-size: 13px;
}
.next-block .label, .programme-block .label { color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: .05em; margin-bottom: 4px; }
.next-block .content, .programme-block .content { display: flex; align-items: center; gap: 8px; }
.next-block img { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; }

.timeline-title { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 20px 0 8px; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.timeline li {
  position: relative; padding: 8px 0 8px 22px; display: flex; gap: 10px; align-items: center;
  content-visibility: auto; contain-intrinsic-size: 56px;
}
.timeline li::before { content: ""; position: absolute; left: 1px; top: 50%; transform: translateY(-50%); width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.timeline .t-cover { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; background: var(--panel2); }
.timeline .t-info { min-width: 0; flex: 1; }
.timeline .t-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline .t-artist { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline .t-time { font-size: 11px; color: var(--muted); flex: none; text-align: right; white-space: nowrap; }

.btn {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 14px; font: inherit; font-size: 14px; cursor: pointer;
}
.btn.ghost { background: transparent; }
.btn:active { transform: scale(.98); }

.muted { color: var(--muted); font-size: 13px; }
.centered { text-align: center; }

.hour-sep { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 0 2px 22px; }
