/* ---------------------------------------------------------------------------
   2mn.info TV - Styles de l'application PWA
   --------------------------------------------------------------------------- */

:root {
  --bg: #080b16;
  --bg-elevated: #0f1320;
  --text: #e8eaf0;
  --text-muted: #8b8fa3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --border: #1f2937;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --tv-header-h: 104px;
}

/* Header masque au scroll descendant : le lecteur sticky remonte sous le bord. */
body.is-nav-hidden { --tv-header-h: 0px; }

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Les regles auteur (display:inline-flex sur .button) priment sur la feuille UA :
   sans cela l'attribut hidden reste inoperant. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  z-index: 10000;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.button-primary {
  background: var(--accent);
  color: #fff;
}
.button-primary:hover { background: var(--accent-hover); }
.button-quiet {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.button-quiet:hover { color: var(--text); border-color: var(--text-muted); }

/* Header */
.tv-topbar {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 10px 0 0;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: transform 0.28s ease, box-shadow 0.28s ease;
}
body.is-nav-hidden .tv-topbar {
  transform: translateY(-100%);
  box-shadow: none;
}
.tv-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
}
.tv-brand { flex: 0 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; }
.tv-brand-mark { width: 26px; height: 26px; flex: 0 0 auto; border-radius: 6px; }
.tv-brand-copy { display: flex; flex-direction: column; min-width: 0; }
.tv-brand-name {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tv-brand-name em { color: var(--accent); font-style: normal; }
.tv-brand-sub { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.tv-topbar-actions { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.tv-topbar-player-link,
.tv-remote-button {
  padding: 7px 11px;
  font-size: 12px;
  border-radius: 9px;
  white-space: nowrap;
}
.tv-remote-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-weight: 600;
}
.tv-remote-button:hover { border-color: var(--accent); }
.tv-remote-button-mark { color: var(--accent); font-size: 13px; }

/* Filtres dans le header */
.tv-topbar-filters {
  border-top: 1px solid var(--border);
  padding: 8px 0;
  background: rgba(0,0,0,0.18);
}
.tv-filters-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 8px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 12px;
  font-weight: 600;
}
.tv-filters-toggle-mark { color: var(--accent); }
.tv-filters-toggle-caret { margin-left: auto; transition: transform 0.2s ease; }
.tv-filters-toggle[aria-expanded="true"] .tv-filters-toggle-caret { transform: rotate(180deg); }
.tv-filters-toggle-summary {
  background: var(--accent);
  color: #fff;
  border-radius: 20px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
}
.tv-filters-toggle-summary[hidden] { display: none; }
.tv-filters-body { padding-top: 8px; }

/* Hero */
.tv-hero {
  padding: 48px 0 32px;
  text-align: center;
}
/* Hero compact : l'ecran principal doit aller droit au lecteur et a la grille. */
.tv-hero {
  padding: 12px 0 4px;
}
.eyebrow {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.tv-hero-title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.tv-hero-lead {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 600px;
  margin: 8px auto 0;
}
.tv-install { margin-top: 12px; }

/* Selecteur de mode : une seule application, deux usages. */
.tv-mode {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.tv-mode-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.tv-mode-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.tv-mode-option {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.tv-mode-option:hover { color: var(--text); }
.tv-mode-option.is-active {
  background: var(--accent);
  color: #fff;
}
.tv-screen-panel .tv-mode { margin-bottom: 14px; }
.tv-hero .tv-mode { margin-bottom: 0; }
.tv-install-pill {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 999px;
}

/* Deux applications a installer : l'application et le lecteur de television. */
.tv-install-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 20px;
  text-align: left;
}
.tv-install-choice {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
}
.tv-install-choice-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}
.tv-install-choice-lead {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}
.tv-install-choice .tv-install { margin-top: 12px; }
.tv-install-choice .button { justify-content: center; text-align: center; }
.tv-install-choice-manual {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}
.tv-install-choice-manual[hidden] { display: none; }

.tv-install-warning {
  margin-top: 12px;
  padding: 12px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius);
  color: #fca5a5;
  font-size: 14px;
}

/* Workspace */
.tv-workspace { display: flex; flex-direction: column; gap: 24px; padding-bottom: 48px; }

/* Player */
.tv-player {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  scroll-margin-top: calc(var(--tv-header-h) + 8px);
}
/* Colle en haut seulement quand une chaîne est lancee : le bloc d'attente
   d'ecran scroll normalement et ne reste jamais affiche. */
.tv-player.is-live {
  position: sticky;
  top: var(--tv-header-h);
  z-index: 40;
  transition: top 0.28s ease;
  box-shadow: 0 6px 28px rgba(0,0,0,0.55);
}
.tv-player-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}
.tv-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.tv-player-idle {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.tv-player-idle-mark {
  font-size: 34px;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 8px;
}
.tv-player-idle-lead { font-size: 13px; }
.tv-player-idle-note {
  font-size: 11px;
  margin-top: 6px;
  opacity: 0.7;
  display: none;
}
.tv-player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  overflow: hidden;
  transition: max-height 0.18s ease, opacity 0.16s ease, padding 0.18s ease;
  max-height: 120px;
}
/* Au scroll descendant la barre se replie : seule l'ecran reste colle. */
body.is-nav-hidden .tv-player-bar {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-top-color: transparent;
}
.tv-player-meta { flex: 1; min-width: 0; }
.tv-player-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tv-player-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tv-player-tools { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.tv-tool-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12px;
  white-space: nowrap;
}
.tv-tool-button:hover { border-color: var(--accent); }
.tv-cast-button.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.tv-cast-button[hidden] { display: none; }
.tv-cast-glyph { display: block; }
/* Seul l'icone de l'etat courant reste visible : disponible, puis diffuse. */
.tv-cast-glyph--live { display: none; }
.tv-cast-button.is-active .tv-cast-glyph--ready { display: none; }
.tv-cast-button.is-active .tv-cast-glyph--live { display: block; }
.tv-player-unstick {
  display: none;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12px;
  white-space: nowrap;
}
.tv-player-error {
  padding: 12px 16px;
  background: rgba(239,68,68,0.1);
  border-top: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  font-size: 14px;
}

/* Search */
.tv-search {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.tv-search-field {
  flex: 1 1 240px;
  position: relative;
}
.tv-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
}
.tv-search-input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 15px;
}
.tv-search-input:focus { outline: none; border-color: var(--accent); }
.tv-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-muted);
}
.tv-search-clear:hover { color: var(--text); }
.tv-select {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  min-width: 160px;
}
.tv-select:focus { outline: none; border-color: var(--accent); }
.tv-search-submit { padding: 10px 20px; }
.tv-search-reset { padding: 10px 16px; }

/* Quickfilters */
.tv-quickfilters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.tv-chip {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}
.tv-chip:hover { border-color: var(--accent); }
.tv-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Status */
.tv-status {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-muted);
}

/* Grid */
.tv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.tv-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}
.tv-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.tv-card-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 16px;
  gap: 10px;
  text-align: center;
}
.tv-card-logo {
  position: relative;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tv-card-logo img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--bg);
}
.tv-card-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  border-radius: 8px;
  font-size: 32px;
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s;
}
.tv-card-button:hover .tv-card-play { opacity: 1; }
.tv-card-body { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.tv-card-name {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tv-card-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}
.tv-card-quality {
  background: var(--accent);
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}
.tv-card-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tv-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.3);
}
.tv-tag--geo-blocked { background: rgba(234,179,8,0.15); color: #fde047; border-color: rgba(234,179,8,0.3); }
.tv-tag--24-7 { background: rgba(34,197,94,0.15); color: #86efac; border-color: rgba(34,197,94,0.3); }
.tv-card-cast {
  padding: 8px;
  width: 100%;
  font-size: 12px;
  color: var(--accent);
  border-top: 1px solid var(--border);
}

/* Empty state */
.tv-empty {
  text-align: center;
  padding: 48px 16px;
}
.tv-empty-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.tv-empty p { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }

/* Pagination */
.tv-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
  padding: 16px;
}
.tv-page-link {
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
}
.tv-page-link:hover { text-decoration: underline; }
.tv-page-status { font-size: 14px; color: var(--text-muted); }

/* Page A propos : le texte long ne vit plus sur l'ecran principal. */
.tv-about {
  padding: 20px 0 8px;
  max-width: 720px;
}
.tv-about .tv-mode { margin-bottom: 24px; }
.tv-about-title {
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.tv-about-lead {
  font-size: 15px;
  color: var(--text);
  line-height: 1.6;
}
.tv-about-catalogue {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}
.tv-about-block {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.tv-about-block h2 { font-size: 16px; margin-bottom: 8px; }
.tv-about-block p { font-size: 14px; color: var(--text-muted); line-height: 1.7; }
.tv-about-list {
  margin-top: 12px;
  padding-left: 18px;
  list-style: disc;
}
.tv-about-list li { font-size: 13px; color: var(--text-muted); line-height: 1.7; }
.tv-about-back { margin-top: 30px; }
.tv-about-back .button { width: 100%; justify-content: center; }

/* Footer */
.tv-footer {
  padding: 32px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.tv-footer-note { margin-top: 8px; font-size: 12px; }
.tv-footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}
.tv-footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.tv-footer-links a:hover { border-color: var(--accent); color: var(--text); }
.tv-footer-links span { font-size: 15px; color: var(--accent); }

/* Modal */
.tv-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.tv-modal[hidden] { display: none; }
.tv-modal-backdrop {
  position: absolute;
  inset: 0;
}
.tv-modal-panel {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.tv-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.tv-modal-head h2 { font-size: 16px; }
.tv-modal-close {
  font-size: 24px;
  line-height: 1;
  color: var(--text-muted);
}
.tv-modal-close:hover { color: var(--text); }
.tv-modal-body { padding: 20px; }
.tv-remote-steps {
  padding-left: 20px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.6;
}
.tv-remote-steps li { margin-bottom: 8px; }
.tv-remote-form { display: flex; flex-direction: column; gap: 10px; }
.tv-remote-input {
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-align: center;
}
.tv-remote-input:focus { outline: none; border-color: var(--accent); }
.tv-remote-submit { width: 100%; justify-content: center; }
.tv-modal-note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* Remote bar */
.tv-remote-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 12px 16px 24px;
  z-index: 200;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
}
.tv-remote-bar[hidden] { display: none; }
.tv-remote-bar-inner {
  max-width: 480px;
  margin: 0 auto;
}
.tv-remote-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.tv-remote-head-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}
.tv-remote-head-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}
.tv-remote-head-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  min-width: 0;
}
.tv-remote-head-channel {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 46vw;
}
.tv-remote-head-channel[hidden] { display: none; }
.tv-remote-round {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.tv-remote-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.tv-remote-key {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12px;
}
.tv-remote-key:hover { border-color: var(--accent); }
.tv-remote-key-main { background: var(--accent); border-color: var(--accent); color: #fff; }
.tv-remote-key-glyph { font-size: 20px; }
.tv-remote-volume {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tv-remote-volume-slider { flex: 1; }
.tv-remote-volume-level {
  font-size: 13px;
  color: var(--text-muted);
  min-width: 32px;
  text-align: right;
}

/* Remote toast/note */
.tv-remote-toast, .tv-remote-note {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 300;
  box-shadow: var(--shadow);
}
.tv-remote-toast[hidden], .tv-remote-note[hidden] { display: none; }

/* Player page */
/* margin:auto et non align-items:center : quand le panneau depasse la hauteur
   de l'ecran, un centrage par alignement deborde aussi vers le haut et le
   selecteur de mode devient inatteignable. */
.tv-player-page { background: #000; }
.tv-screen {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background: #000;
  overflow-y: auto;
}
.tv-screen-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.tv-screen-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  background: rgba(0,0,0,0.9);
  overflow-y: auto;
  z-index: 10;
}
.tv-screen-overlay[hidden] { display: none; }
.tv-screen-panel {
  text-align: center;
  padding: clamp(16px, 5vw, 32px);
  max-width: 480px;
  width: 100%;
  min-width: 0;
  margin: auto;
}
.tv-screen-kicker {
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}
.tv-screen-title {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 700;
  margin-bottom: 12px;
}
.tv-screen-lead {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.tv-screen-qr { margin: 20px 0; }
.tv-screen-qr-image {
  width: clamp(180px, 62vw, 240px);
  height: clamp(180px, 62vw, 240px);
  background: #fff;
  border-radius: var(--radius);
  margin: 0 auto;
}
.tv-screen-qr-hint {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.tv-screen-code-details { margin: 20px 0; }
.tv-screen-code-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.tv-screen-code {
  display: block;
  font-size: clamp(30px, 13vw, 48px);
  font-weight: 700;
  letter-spacing: clamp(6px, 3.4vw, 12px);
  color: var(--accent);
  font-family: monospace;
  margin-top: 8px;
}
.tv-screen-status {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 16px;
}
.tv-screen-install {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.tv-screen-install[hidden] { display: none; }
.tv-screen-install-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}
.tv-screen-install-button:hover { background: var(--accent-hover); }
.tv-screen-install-note {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 320px;
}
.tv-screen-fallback {
  margin-top: 24px;
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.tv-screen-fallback summary {
  font-weight: 600;
  margin-bottom: 12px;
  cursor: pointer;
  color: var(--accent);
}
.tv-screen-form { display: flex; flex-direction: column; gap: 10px; }
.tv-screen-input {
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-align: center;
}
.tv-screen-input:focus { outline: none; border-color: var(--accent); }
.tv-screen-submit {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.tv-screen-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  z-index: 20;
}
.tv-screen-bar[hidden] { display: none; }
.tv-screen-bar-copy { flex: 1; }
.tv-screen-bar-title { font-weight: 600; font-size: 16px; }
.tv-screen-bar-sub { font-size: 13px; color: var(--text-muted); }
.tv-screen-bar-actions { display: flex; gap: 10px; }
.tv-screen-bar-button {
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tv-screen-bar-button:hover { background: rgba(255,255,255,0.2); }
.tv-screen-bar-error {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 30;
}
.tv-screen-osd {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 15;
  pointer-events: none;
}
.tv-screen-osd-title {
  font-size: clamp(32px, 6vw, 64px);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

/* Offline */
.tv-offline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  padding: 48px 16px;
}
.tv-offline-mark { margin-bottom: 24px; }
.tv-offline h1 { font-size: 24px; margin-bottom: 12px; }
.tv-offline-lead { color: var(--text-muted); max-width: 400px; margin-bottom: 24px; }
.tv-offline-favorites { margin-top: 48px; width: 100%; max-width: 800px; text-align: left; }
.tv-offline-favorites h2 { font-size: 18px; margin-bottom: 16px; }
.tv-offline-note { font-size: 13px; color: var(--text-muted); margin-top: 12px; }

/* Responsive */

/* --- Largeur de reference 280px : on compacte d'abord, on elargit ensuite --- */
@media (max-width: 420px) {
  .container { padding: 0 10px; }
  .tv-topbar-inner { gap: 8px; }
  /* Sous 421px l'icone devient illisible et le nom assure l'identite. */
  .tv-brand-mark { display: none; }
  .tv-brand-name { font-size: 15px; }
  .tv-brand-sub { display: none; }
  .tv-topbar-player-link,
  .tv-remote-button { padding: 6px 9px; font-size: 11px; gap: 4px; }
  /* « Lecteur » devient une icône : le libellé reste dans aria-label. */
  .tv-topbar-player-text { display: none; }
  .tv-topbar-player-link { padding: 6px 10px; font-size: 14px; }
  .tv-remote-button-label { display: none; }
  .tv-remote-button::after { content: 'Commander'; font-size: 11px; font-weight: 600; }
  .tv-topbar-filters { padding: 8px 0; }
  .tv-search-input { font-size: 16px; padding: 8px 10px 8px 32px; }
  .tv-select { font-size: 13px; padding: 8px 10px; min-width: 0; }
  .tv-search-icon { left: 10px; font-size: 16px; }
  .tv-search-submit,
  .tv-search-reset { padding: 8px 12px; font-size: 13px; }
  .tv-chip { padding: 5px 11px; font-size: 12px; }
  .tv-quickfilters { margin-top: 8px; }
  .tv-card-button { padding: 10px; gap: 8px; }
  .tv-card-logo { width: 64px; height: 64px; }
  .tv-card-logo img { width: 64px; height: 64px; }
  .tv-card-play { font-size: 24px; }
  .tv-player-idle-note { display: none; }
  .tv-player-idle-mark { font-size: 26px; margin-bottom: 4px; }
  .tv-player-idle-lead { font-size: 11px; }
  .tv-tool-button { padding: 5px 7px; font-size: 11px; }
  .tv-tool-button span:not([aria-hidden]):not(.sr-only) { display: none; }
  .tv-player-unstick { padding: 6px 8px; font-size: 12px; }
  .tv-player-unstick span:not([aria-hidden]) { display: none; }
  .tv-remote-key { padding: 10px 4px; font-size: 11px; }
  .tv-remote-bar { padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
  .tv-pagination { gap: 10px; padding: 12px 0; }
  .tv-remote-head-channel { max-width: 40vw; }
  .tv-modal-body { padding: 16px; }
}

/* Largeur de reference du projet : 280px, tout doit y tenir sans rognage. */
@media (max-width: 300px) {
  .container { padding: 0 8px; }
  .tv-topbar-inner { gap: 6px; }
  .tv-brand { gap: 6px; }
  .tv-brand-name { font-size: 14px; }
  .tv-topbar-player-link { padding: 6px 8px; }
  .tv-remote-button { padding: 6px 7px; }
}

/* Le nom de chaine sous " telecommande active " n'apparait qu'a partir d ici. */
@media (min-width: 421px) {
  .tv-remote-head-channel { display: none; }
  .tv-remote-head-channel:not([hidden]) { display: block; }
}

@media (max-width: 640px) {
  .tv-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tv-player-bar { flex-wrap: nowrap; }
  .tv-search-field { flex: 1 1 100%; }
  .tv-select { flex: 1 1 calc(50% - 5px); }
  .tv-search-submit,
  .tv-search-reset { flex: 1 1 100%; justify-content: center; }
  .tv-tool-button { padding: 7px 9px; }
}

/* Colonne unique : le lecteur se colle en haut pendant qu'on parcourt la liste. */
@media (max-width: 1023px) {
  .tv-workspace { gap: 16px; }
  .tv-player-unstick { display: inline-flex; align-items: center; gap: 4px; }
}

/* Sous 700px les filtres se replient : le header reste bas. */
@media (max-width: 700px) {
  .tv-filters-toggle { display: flex; }
  .tv-filters-body { display: none; }
  .tv-filters-body.is-open { display: block; }
  .tv-search { gap: 8px; }
}

/* 701-899px : formulaire sur une ligne, chips en dessous. */
@media (min-width: 701px) {
  .tv-search-field { flex: 1 1 180px; }
  .tv-select { flex: 0 1 210px; min-width: 148px; }
}
@media (min-width: 701px) and (max-width: 899px) {
  .tv-quickfilters { margin-top: 10px; }
}

/* 900px et plus : filtres et chips tiennent sur une seule ligne. */
@media (min-width: 900px) {
  .tv-filters-body { display: flex; align-items: flex-end; gap: 12px; }
  .tv-search { flex: 1; min-width: 0; }
  .tv-quickfilters { margin-top: 0; flex: 0 0 auto; padding-bottom: 5px; }
}

@media (min-width: 1024px) {
  .tv-workspace { flex-direction: row; align-items: flex-start; }
  .tv-player { width: 50%; align-self: flex-start; }
  .tv-panel { flex: 1; }
  .tv-player-idle-note { display: block; }
}
