/* ═══════════════════════════════════════════════════════════════════════════
   TV live — app unique (direct public, télécommande et enregistrements protégés)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg:          #0a0a0b;
  --bg-2:        #111113;
  --surface:     rgba(255, 255, 255, .035);
  --surface-2:   rgba(255, 255, 255, .06);
  --surface-3:   rgba(255, 255, 255, .095);
  --line:        rgba(255, 255, 255, .07);
  --line-2:      rgba(255, 255, 255, .12);
  --text:        #f5f5f4;
  --text-2:      #a1a1a8;
  --text-3:      #6b6b72;
  /* Accent volontairement neutre : le blanc porte l'action, le rouge le direct */
  --accent:      #f5f5f4;
  --accent-ink:  #fafafa;
  --accent-soft: rgba(255, 255, 255, .07);
  --live:        #e5484d;
  --live-soft:   rgba(229, 72, 77, .14);
  --ok:          #30a46c;
  --warn:        #f5a524;
  --grad:        linear-gradient(180deg, #fafafa, #e4e4e7);

  --r-xl: 20px;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;

  --rail-w: 252px;
  --tabbar-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, .7);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-feature-settings: "cv11", "ss01", "tnum";
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.ic {
  width: 20px; height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Structure ─────────────────────────────────────────────────────────────── */

.app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
}
.main {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 8px) 14px calc(var(--tabbar-h) + var(--safe-b) + 28px);
}

/* Marque */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark {
  position: relative;
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--grad);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
  display: grid; place-items: center;
}
.brand-mark span {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2.5px solid #0a0a0b;
}
.brand-name { font-weight: 650; font-size: 17px; letter-spacing: -.015em; }
.brand-name em {
  font-style: normal; font-weight: 600;
  margin-left: 3px;
  color: var(--text-2);
}

/* En-tête mobile */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
  padding: 0 4px;
  margin-bottom: 6px;
}
.session-chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 14px 0 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
  color: var(--text-2);
  transition: background .2s, color .2s, border-color .2s;
}
.session-chip .ic { width: 16px; height: 16px; }
.is-authed .session-chip { color: var(--text); background: var(--surface-2); border-color: var(--line-2); }

/* Barre latérale */
.rail { display: none; }

/* Barre d'onglets mobile */
.tabbar {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(10px + var(--safe-b));
  z-index: 40;
  height: var(--tabbar-h);
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px;
  border-radius: 20px;
  background: rgba(20, 20, 22, .8);
  border: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .8);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border-radius: 18px;
  font-size: 11px; font-weight: 600;
  color: var(--text-3);
  transition: color .25s var(--ease), background .25s var(--ease);
}
.tab-ic { position: relative; display: grid; place-items: center; }
.tab-ic > .ic { width: 22px; height: 22px; }
.tab.active { color: var(--text); background: var(--surface-2); }
.tab.active .tab-ic > .ic:first-child { color: var(--accent-ink); }
.tab-lock {
  position: absolute; right: -9px; top: -5px;
  width: 13px !important; height: 13px !important;
  padding: 2px;
  box-sizing: content-box;
  border-radius: 50%;
  background: #1c1c1f;
  color: var(--text-2);
  stroke-width: 2.4;
}
.is-authed .tab-lock, .is-authed .nav-lock { display: none; }
.nav-live {
  display: none;
  position: absolute; right: -4px; top: -2px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 2px #111113, 0 0 10px var(--live);
}
.is-live .nav-live { display: block; animation: pulse 1.6s ease-in-out infinite; }

/* ── Lecteur ───────────────────────────────────────────────────────────────── */

.stage { position: relative; z-index: 5; }

.player {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: #000;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
}
.player video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
  opacity: 0;
  transition: opacity .5s var(--ease);
}
.player[data-state="playing"] video,
.player[data-state="paused"] video { opacity: 1; }

.player:fullscreen { border-radius: 0; border: 0; }
.player:-webkit-full-screen { border-radius: 0; border: 0; }

/* Hors antenne */
.player-offline {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: radial-gradient(120% 120% at 50% 0%, #141416 0%, #0a0a0b 70%);
  transition: opacity .5s var(--ease), visibility .5s;
}
.player:not([data-state="offline"]) .player-offline { opacity: 0; visibility: hidden; }
.aurora {
  position: absolute; inset: -40%;
  background: radial-gradient(45% 40% at 50% 45%, rgba(255, 255, 255, .045), transparent 70%);
}
.offline-inner { position: relative; text-align: center; padding: 20px; }
.offline-ic {
  display: inline-grid; place-items: center;
  width: 54px; height: 54px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line-2);
  margin-bottom: 14px;
  color: var(--text-2);
}
.offline-ic .ic { width: 24px; height: 24px; }
.offline-title { font-size: clamp(17px, 2.4vw, 22px); font-weight: 700; letter-spacing: -.01em; }
.offline-sub { margin-top: 4px; font-size: 13.5px; color: var(--text-2); }

/* Chargement */
.player-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(0, 0, 0, .35);
  opacity: 0; visibility: hidden;
  transition: opacity .3s, visibility .3s;
  z-index: 2;
}
.player[data-state="loading"] .player-loading,
.player.is-waiting .player-loading { opacity: 1; visibility: visible; }
.player.is-waiting .loading-txt { display: none; }
.loading-txt { font-size: 13px; font-weight: 500; color: var(--text-2); }
.spinner {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .14);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
}

/* Bandeau haut */
.player-top {
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 30px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .6), transparent);
  z-index: 3;
  opacity: 0;
  transition: opacity .3s var(--ease);
  pointer-events: none;
}
.player-channel {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .5);
}
.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px;
  border-radius: 7px;
  background: var(--live);
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  
}
.live-badge i { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.4s ease-in-out infinite; }

/* Commandes */
.controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 4px;
  padding: 36px 10px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, .75), transparent);
  z-index: 3;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .3s var(--ease), transform .3s var(--ease);
  pointer-events: none;
}
.player.show-ui:not([data-state="offline"]):not([data-state="loading"]) .controls,
.player[data-state="paused"] .controls {
  opacity: 1; transform: none; pointer-events: auto;
}
.player.show-ui:not([data-state="offline"]) .player-top,
.player[data-state="paused"] .player-top { opacity: 1; }
.ctl {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  transition: background .2s;
}
.ctl:hover { background: rgba(255, 255, 255, .12); }
.ctl .ic { width: 22px; height: 22px; }
.ctl-spacer { flex: 1; }
.ic-pause, .ic-mute, .ic-shrink { display: none; }
.player.is-playing .ic-play { display: none; }
.player.is-playing .ic-pause { display: block; }
.player.is-muted .ic-vol { display: none; }
.player.is-muted .ic-mute { display: block; }
.player.is-fullscreen .ic-expand { display: none; }
.player.is-fullscreen .ic-shrink { display: block; }

.volume {
  -webkit-appearance: none; appearance: none;
  width: 90px; height: 4px;
  border-radius: 4px;
  background: linear-gradient(to right, #fff var(--vol, 100%), rgba(255, 255, 255, .25) var(--vol, 100%));
  margin: 0 8px 0 2px;
  cursor: pointer;
}
.volume::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .4); }
.volume::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }

.go-live {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 11px;
  border-radius: 9px;
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  color: var(--text-2);
  background: rgba(255, 255, 255, .1);
  transition: background .2s, color .2s;
}
.go-live i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.player.at-live .go-live { color: #fff; background: transparent; pointer-events: none; }
.player.at-live .go-live i { background: var(--live); box-shadow: 0 0 8px var(--live); }

/* « Activer le son » */
.unmute-pill {
  position: absolute; left: 50%; top: 50%;
  z-index: 4;
  display: inline-flex; align-items: center; gap: 9px;
  height: 46px; padding: 0 20px 0 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  color: #0a0a0b;
  font-size: 14.5px; font-weight: 700;
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, .7);
  transform: translate(-50%, -50%) scale(.92);
  opacity: 0; visibility: hidden;
  transition: opacity .35s var(--ease), transform .35s var(--ease), visibility .35s;
}
.unmute-pill .ic { width: 19px; height: 19px; stroke-width: 2.2; }
.player.needs-unmute[data-state="playing"] .unmute-pill {
  opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1);
}

/* ── Cartes ────────────────────────────────────────────────────────────────── */

.view { margin-top: 14px; animation: rise .45s var(--ease) both; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

/* Programme en cours */
.np {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px 14px;
  align-items: center;
  padding: 16px;
}
.np-logo {
  width: 60px; height: 60px;
  border-radius: 16px;
  display: grid; place-items: center;
  background: #161618;
  border: 1px solid var(--line-2);
  color: var(--text-3);
  overflow: hidden;
}
.np-logo img { width: 78%; height: 78%; object-fit: contain; }
.np-logo .initials { font-weight: 700; font-size: 19px; letter-spacing: -.02em; color: var(--text-2); }
.np-body { min-width: 0; }
.np-eyebrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 3px; }
.np-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3);
}
.np-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.np[data-state="live"] .np-status { color: var(--live); }
.np[data-state="live"] .np-status i { background: var(--live); box-shadow: 0 0 10px var(--live); animation: pulse 1.4s ease-in-out infinite; }
.np-tags { display: inline-flex; gap: 5px; }
.tag {
  height: 19px; padding: 0 6px;
  display: inline-flex; align-items: center;
  border-radius: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.np-title {
  font-size: clamp(19px, 3.2vw, 28px);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.15;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.np-sub { margin-top: 4px; font-size: 13.5px; color: var(--text-2); }
.np-actions {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px;
}
.is-guest .np-actions { grid-template-columns: 1fr; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 18px;
  border-radius: var(--r-md);
  font-size: 14.5px; font-weight: 650;
  white-space: nowrap;
  transition: transform .15s var(--ease), background .2s, box-shadow .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn .ic { width: 18px; height: 18px; }
.btn-primary {
  background: var(--grad);
  color: #0a0a0b;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .6);
}
.btn-primary:hover { background: #fff; }
.btn-ghost { background: var(--surface-2); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.is-guest [href="#/telecommande"].btn { display: none; }

.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 12px;
  color: var(--text-2);
  transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* Statistiques */
.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-top: 10px;
}
.stat {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px;
  min-width: 0;
}
.stat-ic {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  margin-bottom: 8px;
}
.stat-ic .ic { width: 17px; height: 17px; }
.stat-label { font-size: 11.5px; font-weight: 500; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-size: 19px; font-weight: 750; letter-spacing: -.02em; }

/* Vues à venir */
.placeholder {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 40px 24px;
}
.placeholder-ic {
  display: grid; place-items: center;
  width: 56px; height: 56px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  margin-bottom: 14px;
}
.placeholder-ic .ic { width: 26px; height: 26px; }
.placeholder h2 { font-size: 20px; font-weight: 750; letter-spacing: -.02em; }
.placeholder p { margin-top: 6px; max-width: 380px; color: var(--text-2); font-size: 14px; }

/* ── Feuilles (mot de passe, session) ─────────────────────────────────────── */

.sheet-backdrop {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, .62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: fade .25s ease both;
}
.sheet {
  position: relative;
  width: 100%; max-width: 440px;
  padding: 28px 22px calc(22px + var(--safe-b));
  border-radius: 28px 28px 0 0;
  background: linear-gradient(180deg, #1a1a1d, #121214);
  border: 1px solid var(--line-2);
  border-bottom: 0;
  box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, .8);
  text-align: center;
  animation: sheet-up .4s var(--ease) both;
}
.sheet::before {
  content: "";
  position: absolute; top: 8px; left: 50%;
  width: 38px; height: 4px; margin-left: -19px;
  border-radius: 4px;
  background: var(--line-2);
}
.sheet-close { position: absolute; top: 14px; right: 14px; }
.sheet-badge {
  display: inline-grid; place-items: center;
  width: 58px; height: 58px;
  border-radius: 19px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  color: var(--text);
  margin: 6px 0 16px;
}
.sheet-badge .ic { width: 26px; height: 26px; }
.sheet-badge.ok { background: rgba(48, 164, 108, .14); border-color: rgba(48, 164, 108, .35); color: #4cc38a; }
.sheet-title { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.sheet-sub { margin: 6px auto 20px; max-width: 320px; font-size: 14px; color: var(--text-2); }

.field { position: relative; display: block; }
.field input {
  width: 100%; height: 54px;
  padding: 0 52px 0 18px;
  border-radius: var(--r-md);
  background: rgba(0, 0, 0, .35);
  border: 1px solid var(--line-2);
  font-size: 16px; /* évite le zoom iOS */
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input::placeholder { color: var(--text-3); }
.field input:focus { border-color: rgba(255, 255, 255, .32); box-shadow: 0 0 0 4px rgba(255, 255, 255, .06); }
.field-eye { position: absolute; right: 6px; top: 7px; width: 40px; height: 40px; display: grid; place-items: center; color: var(--text-3); border-radius: 10px; }
.field-eye .ic-eye-off { display: none; }
.field.show .ic-eye { display: none; }
.field.show .ic-eye-off { display: block; }
.sheet-error { min-height: 22px; margin: 8px 0 6px; font-size: 13px; font-weight: 500; color: #fb7185; }
.sheet.shake { animation: shake .42s cubic-bezier(.36, .07, .19, .97) both; }

/* ── Toasts ────────────────────────────────────────────────────────────────── */

.toasts {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 22px);
  z-index: 120;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
  padding: 0 16px;
}
.toast {
  display: inline-flex; align-items: center; gap: 10px;
  max-width: 100%;
  padding: 11px 16px;
  border-radius: 14px;
  background: rgba(32, 32, 35, .94);
  border: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 14px 40px -12px rgba(0, 0, 0, .8);
  font-size: 14px; font-weight: 550;
  animation: toast-in .35s var(--ease) both;
}
.toast.out { animation: toast-out .3s var(--ease) both; }
.toast i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.toast.ok i { background: var(--ok); }
.toast.err i { background: var(--live); }

/* ── Animations ────────────────────────────────────────────────────────────── */

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.96); } }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ── Écrans tactiles : pas de survol, commandes plus grandes ──────────────── */

@media (hover: none) {
  .volume { display: none; }
  .ctl { width: 44px; height: 44px; }
}

/* ── Tablette ──────────────────────────────────────────────────────────────── */

@media (min-width: 640px) {
  .main { padding-left: 24px; padding-right: 24px; }
  .np { grid-template-columns: auto 1fr auto; padding: 20px; gap: 18px; }
  .np-logo { width: 72px; height: 72px; border-radius: 20px; }
  .np-actions { grid-column: auto; display: flex; }
  .stat { padding: 18px; }
  .stat-value { font-size: 22px; }
  .sheet-backdrop { align-items: center; padding: 20px; }
  .sheet { border-radius: var(--r-xl); border-bottom: 1px solid var(--line-2); padding-bottom: 26px; animation: pop .35s var(--ease) both; }
  .sheet::before { display: none; }
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }

/* ── Ordinateur : barre latérale ───────────────────────────────────────────── */

@media (min-width: 1000px) {
  .app { display: grid; grid-template-columns: var(--rail-w) 1fr; }
  .topbar, .tabbar { display: none; }
  .main { padding: 32px 40px 48px; }
  .toasts { bottom: 28px; }

  .rail {
    position: sticky; top: 0;
    height: 100dvh;
    display: flex; flex-direction: column;
    padding: 26px 16px 18px;
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, .01));
  }
  .rail .brand { padding: 0 10px; margin-bottom: 30px; }
  .rail-nav { display: flex; flex-direction: column; gap: 4px; }
  .nav-item {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    height: 46px; padding: 0 14px;
    border-radius: var(--r-md);
    font-weight: 600; font-size: 14.5px;
    color: var(--text-2);
    transition: background .2s, color .2s;
  }
  .nav-item:hover { background: var(--surface); color: var(--text); }
  .nav-item.active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05); }
  .nav-item.active > .ic:first-child { color: var(--accent-ink); }
  .nav-item .nav-lock { margin-left: auto; width: 15px; height: 15px; color: var(--text-3); }
  .nav-item .nav-live { position: static; margin-left: auto; box-shadow: 0 0 10px var(--live); }

  .rail-foot { margin-top: auto; }
  .session-btn {
    width: 100%;
    display: flex; align-items: center; gap: 12px;
    padding: 10px;
    border-radius: var(--r-md);
    background: var(--surface);
    border: 1px solid var(--line);
    text-align: left;
    transition: background .2s;
  }
  .session-btn:hover { background: var(--surface-2); }
  .session-ic {
    display: grid; place-items: center;
    width: 38px; height: 38px;
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text-2);
  }
  .session-ic .ic { width: 18px; height: 18px; }
  .is-authed .session-ic { background: var(--accent-soft); color: var(--accent-ink); }
  .session-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
  .session-txt strong { font-size: 13.5px; font-weight: 650; }
  .session-txt small { font-size: 12px; color: var(--text-3); }

  .player { border-radius: var(--r-xl); }
  .view { margin-top: 18px; }
  .stats { gap: 14px; margin-top: 14px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Télécommande
   ═══════════════════════════════════════════════════════════════════════════ */

.view-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin: 6px 2px 12px;
}
.view-title { font-size: 24px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.view-sub { margin-top: 3px; font-size: 13px; color: var(--text-3); }
.icon-btn.spinning .ic { animation: spin .9s linear infinite; }

/* Chaîne à l'antenne */
.onair {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
}
.onair-logo, .ch-logo, .mini-logo, .quick-logo {
  display: grid; place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  background: #161618;
  border: 1px solid var(--line);
  color: var(--text-3);
}
.onair-logo { width: 48px; height: 48px; border-radius: 14px; }
.onair-logo img, .ch-logo img, .mini-logo img, .quick-logo img { width: 76%; height: 76%; object-fit: contain; }
.initials { font-weight: 700; letter-spacing: -.02em; color: var(--text-2); font-size: 13px; }
.onair-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.onair-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3);
}
.onair-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.onair[data-state="live"] .onair-status { color: var(--live); }
.onair[data-state="live"] .onair-status i { background: var(--live); box-shadow: 0 0 8px var(--live); animation: pulse 1.4s ease-in-out infinite; }
.onair[data-state="starting"] .onair-status { color: var(--warn); }
.onair[data-state="starting"] .onair-status i { background: var(--warn); animation: pulse .8s ease-in-out infinite; }
.onair-name { font-size: 16px; font-weight: 750; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.onair-actions { display: flex; gap: 6px; }
.round-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 40px; height: 40px; padding: 0 10px;
  border-radius: 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px; font-weight: 700;
  transition: background .2s, color .2s, transform .15s var(--ease), min-width .25s var(--ease);
}
.round-btn:hover { background: var(--surface-3); }
.round-btn:active { transform: scale(.94); }
.round-btn .ic { width: 19px; height: 19px; }
.stop-btn { color: #fda4af; }
.stop-btn span { display: none; }
.stop-btn.confirm { background: var(--live); border-color: var(--live); color: #fff; box-shadow: 0 8px 22px -8px var(--live); }
.stop-btn.confirm span { display: inline; }
.onair[data-state="offline"] .stop-btn { display: none; }

/* Favoris en tuiles */
.quick { margin-top: 18px; }
.section-title {
  display: flex; align-items: center; gap: 7px;
  margin: 0 2px 10px;
  font-size: 13px; font-weight: 700; letter-spacing: .02em;
  color: var(--text-2);
}
.section-title .ic { width: 15px; height: 15px; color: #fbbf24; fill: #fbbf24; }
.quick-row {
  display: flex; gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  margin: 0 -14px; padding: 2px 14px 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.quick-row::-webkit-scrollbar { display: none; }
.quick-tile {
  position: relative;
  flex: 0 0 auto;
  width: 104px;
  scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 8px 10px;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .025));
  border: 1px solid var(--line);
  transition: transform .15s var(--ease), border-color .2s, background .2s;
}
.quick-tile:active { transform: scale(.96); }
.quick-tile:hover { border-color: var(--line-2); }
.quick-logo { width: 56px; height: 56px; border-radius: 16px; }
.quick-name { width: 100%; text-align: center; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-tile.is-onair { border-color: rgba(229, 72, 77, .5); background: linear-gradient(180deg, rgba(229, 72, 77, .14), rgba(229, 72, 77, .04)); }
.quick-tile.is-onair::after {
  content: ""; position: absolute; top: 9px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--live); box-shadow: 0 0 8px var(--live);
  animation: pulse 1.4s ease-in-out infinite;
}

/* Recherche + catégories (collant) */
.finder {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 18px -14px 0;
  padding: calc(var(--safe-t) + 10px) 14px 10px;
  background: var(--bg);
}
/* Fondu sous la barre collante */
.finder::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 100%;
  height: 14px;
  background: linear-gradient(var(--bg), transparent);
  pointer-events: none;
}
.search {
  position: relative;
  display: flex; align-items: center;
  height: 48px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.search:focus-within { border-color: rgba(255, 255, 255, .28); box-shadow: 0 0 0 4px rgba(255, 255, 255, .05); background: rgba(0, 0, 0, .3); }
.search > .ic { position: absolute; left: 14px; width: 19px; height: 19px; color: var(--text-3); pointer-events: none; }
.search input {
  width: 100%; height: 100%;
  padding: 0 44px 0 44px;
  background: none; border: 0; outline: none;
  font-size: 16px;
}
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear {
  position: absolute; right: 6px;
  width: 36px; height: 36px;
  display: none; place-items: center;
  border-radius: 10px;
  color: var(--text-2);
}
.search.has-value .search-clear { display: grid; }
.search-clear .ic { width: 17px; height: 17px; }

.chips {
  display: flex; gap: 8px;
  overflow-x: auto;
  margin: 10px -14px 0; padding: 0 14px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 260px;
  height: 34px; padding: 0 13px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s;
}
.chip > span:first-of-type { overflow: hidden; text-overflow: ellipsis; }
.chip .ic { width: 15px; height: 15px; }
.chip small { font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.chip:hover { color: var(--text); }
.chip.active { background: #f5f5f4; border-color: #f5f5f4; color: #0a0a0b; }
.chip.active small { color: #5c5c63; }
.finder.searching .chips { display: none; }

/* Liste des chaînes */
.channel-list { margin-top: 4px; }
.list-heading { margin: 14px 4px 6px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.ch {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 64px;
  padding: 8px 6px 8px 8px;
  border-radius: var(--r-md);
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: auto 64px;
  transition: background .15s;
}
.ch + .ch::before {
  content: ""; position: absolute; top: 0; left: 64px; right: 10px;
  height: 1px; background: var(--line);
}
.ch:hover { background: var(--surface); }
.ch:active { background: var(--surface-2); }
.ch-logo { width: 46px; height: 46px; border-radius: 13px; }
.ch-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ch-name { font-size: 15px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; }
.ch-meta .tag { height: 17px; font-size: 9.5px; padding: 0 5px; border-radius: 5px; }
.ch-meta .cat { overflow: hidden; text-overflow: ellipsis; }
.ch-fav {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  color: var(--text-3);
  flex-shrink: 0;
  transition: color .2s, transform .2s var(--ease);
}
.ch-fav:active { transform: scale(.85); }
.ch-fav .ic { width: 20px; height: 20px; }
.ch-fav[aria-pressed="true"] { color: #fbbf24; }
.ch-fav[aria-pressed="true"] .ic { fill: #fbbf24; animation: star-pop .35s var(--ease); }
@keyframes star-pop { 50% { transform: scale(1.3); } }

/* Égaliseur « à l'antenne » / démarrage */
.ch-state { display: none; align-items: flex-end; gap: 2px; height: 16px; margin-right: 2px; }
.ch-state i { width: 3px; border-radius: 2px; background: var(--live); animation: eq 1s ease-in-out infinite; }
.ch-state i:nth-child(1) { height: 60%; animation-delay: -.2s; }
.ch-state i:nth-child(2) { height: 100%; animation-delay: -.5s; }
.ch-state i:nth-child(3) { height: 40%; animation-delay: -.8s; }
@keyframes eq { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
.ch-state, .ch-state i { transform-origin: bottom; }
.ch.is-onair { background: linear-gradient(90deg, rgba(229, 72, 77, .12), transparent 80%); }
.ch.is-onair .ch-name { color: #fff; }
.ch.is-onair .ch-state { display: flex; }
.ch.is-starting .ch-state { display: flex; }
.ch.is-starting .ch-state i { background: var(--warn); }

.list-sentinel { height: 1px; }
.list-empty { padding: 40px 20px; text-align: center; color: var(--text-2); font-size: 14px; }
.list-empty strong { display: block; margin-bottom: 4px; color: var(--text); font-size: 16px; }
.skeleton { height: 64px; margin: 4px 0; border-radius: var(--r-md); background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Mini lecteur flottant (mobile) */
.mini {
  position: fixed;
  left: 20px; right: 20px;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 20px);
  z-index: 39;
  display: flex; align-items: center; gap: 11px;
  padding: 8px 12px 8px 8px;
  border-radius: 18px;
  background: rgba(30, 30, 33, .92);
  border: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 14px 40px -10px rgba(0, 0, 0, .85);
  text-align: left;
  animation: toast-in .3s var(--ease) both;
}
.mini-logo { width: 38px; height: 38px; border-radius: 11px; }
.mini-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.mini-txt small { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--live); }
.mini-txt small i { width: 6px; height: 6px; border-radius: 50%; background: var(--live); animation: pulse 1.4s ease-in-out infinite; }
.mini-txt strong { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini > .ic { width: 18px; height: 18px; color: var(--text-3); transform: rotate(-90deg); }
.app[data-route="telecommande"] .toasts { bottom: calc(var(--tabbar-h) + var(--safe-b) + 84px); }

@media (min-width: 640px) {
  .finder { margin-left: -24px; margin-right: -24px; padding-left: 24px; padding-right: 24px; }
  .chips, .quick-row { margin-left: -24px; margin-right: -24px; padding-left: 24px; padding-right: 24px; }
}

/* Ordinateur : lecteur à gauche (collant), télécommande à droite */
@media (min-width: 1000px) {
  .mini { display: none; }
  .app[data-route="telecommande"] .main {
    max-width: 1560px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(380px, 440px);
    column-gap: 28px;
    align-items: start;
  }
  .app[data-route="telecommande"] .stage { position: sticky; top: 32px; grid-column: 1; grid-row: 1; }
  .app[data-route="telecommande"] [data-view="telecommande"] { grid-column: 2; grid-row: 1; margin-top: 0; }
  .app[data-route="telecommande"] .toasts { bottom: 28px; }
  .view-head { margin-top: 0; }
  .finder { margin: 18px 0 0; padding: 10px 0; top: 0; }
  .chips {
    margin: 10px 0 0; padding: 0;
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
    mask-image: linear-gradient(90deg, #000 88%, transparent);
  }
  .quick-row { margin: 0; padding: 2px 0 6px; }
  .quick-tile { width: 96px; }
}
