:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #171a21;
  --border: #2a2f3a;
  --text: #e8eaf0;
  --muted: #9aa1ae;
  --accent: #4f8cff;
  --danger: #ff6b6b;
  --ok: #4fd18b;
  --focus-ring: #ffffff;
  --hit: 48px;
}
* { box-sizing: border-box; }

/* Coquille plein écran : le document ne défile jamais. Seuls des panneaux
   internes (listes, grilles, cartes) défilent, chacun avec sa propre
   overflow-y:auto — voir #list, #guideList, .vod-grid, .preview, .fiche-scroll,
   .historique-list ci-dessous. */
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}
body {
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Barre de défilement discrète pour tous les panneaux internes. */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* En-tête : jamais de retour à la ligne (header sur une seule ligne, quelle
   que soit la largeur — box/TV en fenêtre étroite). Le titre est fixe, les
   onglets (nav#mainNav) se partagent l'espace restant et défilent
   horizontalement en interne s'ils manquent de place, le bouton de mise à
   jour reste ancré à droite (margin-left:auto) et ne passe jamais dessous. */
header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px 14px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
header h1 { margin: 0; font-size: 1.25rem; flex: 0 0 auto; white-space: nowrap; }
#counter {
  color: var(--muted);
  font-size: 0.85rem;
  flex: 0 1 auto;
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

nav#mainNav {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
nav#mainNav::-webkit-scrollbar { display: none; }
nav#mainNav .nav-btn {
  background: linear-gradient(180deg, #1c1f27, #14161c);
  border: 1px solid var(--border);
  color: var(--muted);
  min-height: var(--hit);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  white-space: nowrap;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
nav#mainNav .nav-btn.active {
  background: linear-gradient(180deg, #6aa0ff, var(--accent));
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79, 140, 255, .35);
}
nav#mainNav .nav-btn:hover:not(.active) { border-color: var(--accent); color: var(--text); }

/* Sous ~900px, les libellés d'onglets et le compteur cèdent un peu de place
   avant de recourir au défilement horizontal du nav ; le libellé du bouton
   de mise à jour se réduit à une icône (jamais de retour à la ligne). */
@media (max-width: 900px) {
  header { padding: 8px 14px; gap: 8px 10px; }
  header h1 { font-size: 1.05rem; }
  #counter { display: none; }
  nav#mainNav .nav-btn { padding: 6px 10px; font-size: 0.82rem; }
  .update-header-btn .btn-label { display: none; }
  .update-header-btn { padding: 8px 10px; }
}

/* Bouton de mise à jour d'en-tête : action prioritaire, toujours visible tout
   à droite (après #counter, qui pousse le reste du header via margin-left:auto),
   à côté de « Réglages ». La bannière #updateBanner et le bouton Réglages
   #checkUpdateBtn restent inchangés, ce bouton n'est qu'un raccourci de plus. */
.update-header-btn {
  flex: 0 0 auto;
  margin-left: auto;
  min-height: var(--hit);
  padding: 6px 16px;
  font-size: 0.9rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #6aa0ff, var(--accent));
  color: #fff;
  border: 1px solid var(--accent);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(79, 140, 255, .35);
  transition: filter .15s ease, transform .1s ease;
}
.update-header-btn .btn-icon { font-size: 1rem; line-height: 1; }
.update-header-btn:hover { filter: brightness(1.1); }
.update-header-btn:active { transform: translateY(1px); }
/* Signal visuel sobre quand une nouvelle version est détectée en arrière-plan
   (vérification périodique / visibilitychange) : halo + pulsation douce, sans
   jamais changer la taille de la boîte (contrainte de mise en page --hit). */
.update-header-btn.update-available {
  box-shadow: 0 0 0 3px rgba(79, 140, 255, .35);
  animation: update-header-pulse 1.6s ease-in-out infinite;
}
@keyframes update-header-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(79, 140, 255, .35); }
  50% { box-shadow: 0 0 0 6px rgba(79, 140, 255, .12); }
}
@media (prefers-reduced-motion: reduce) {
  .update-header-btn.update-available { animation: none; }
}

/* Cible focusable : jamais d'outline supprimé sans remplacement (anneau visible
   + léger agrandissement), pour rester lisible à la télécommande comme au doigt. */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--accent), 0 0 16px 4px rgba(79, 140, 255, .5);
  position: relative;
  z-index: 2;
}
button:focus-visible,
.row:focus-visible,
.guide-row:focus-visible,
.vod-card:focus-visible,
.nav-btn:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
select:focus-visible {
  transform: scale(1.03);
}

.view { display: none; flex-direction: column; min-height: 0; overflow: hidden; }
.view:not([hidden]) { display: flex; }

.warning {
  flex: 0 0 auto;
  margin: 12px 20px 0;
  padding: 10px 14px;
  background: #3a2c12;
  border: 1px solid #6a4e18;
  color: #f3c76a;
  border-radius: 6px;
  font-size: 0.9rem;
}
.warning[hidden] { display: none; }

/* Bandeau de mise à jour : un panneau de plus dans la colonne flex du body
   (comme .warning ci-dessus), jamais en position fixed/absolute — il pousse
   #appContent au lieu de flotter par-dessus, donc jamais de superposition ni
   de défilement de page (voir "Coquille plein écran", app/README.md). */
.update-banner {
  flex: 0 0 auto;
  margin: 12px 20px 0;
  padding: 10px 14px;
  min-height: var(--hit);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  background: #123a2c;
  border: 1px solid #1e6a4e;
  color: #6ad19b;
  border-radius: 6px;
  font-size: 0.9rem;
}
.update-banner[hidden] { display: none; }
.fiche-scroll .update-settings { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

/* Zone de contenu : occupe toute la hauteur restante sous l'en-tête ; chaque
   écran (.view) y est empilé en position absolute pour ne jamais influer sur
   la hauteur du document, quel que soit son contenu. */
#appContent {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
#appContent .view {
  position: absolute;
  inset: 0;
}

.controls {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 20px;
  align-items: center;
}
.controls input[type="search"], .controls select {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  min-height: var(--hit);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 1rem;
}
.controls input[type="search"] { flex: 1 1 240px; min-width: 200px; }
.controls select { flex: 0 0 auto; max-width: 260px; }
button {
  background: linear-gradient(180deg, #1e222b, #14161c);
  border: 1px solid var(--border);
  color: var(--text);
  min-height: var(--hit);
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .04);
  transition: border-color .15s ease, background .15s ease, transform .1s ease, box-shadow .15s ease;
}
button:hover:not(:disabled) { border-color: var(--accent); background: linear-gradient(180deg, #262b37, #1a1e26); }
button:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .4); }
button:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
button.primary {
  background: linear-gradient(180deg, #6aa0ff, var(--accent));
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 6px rgba(79, 140, 255, .35);
}
button.primary:hover:not(:disabled) { background: linear-gradient(180deg, #7aacff, #5a92ff); }
button.danger { background: linear-gradient(180deg, #4a1a1a, #3a1414); border-color: #6a1e1e; color: #ff9b9b; }

/* Chaînes : deux colonnes en paysage (liste | aperçu), empilées en portrait —
   chaque colonne gère son propre défilement interne, jamais le document. */
main {
  display: flex;
  flex-direction: row;
  flex: 1 1 auto;
  min-height: 0;
  gap: 16px;
  padding: 0 20px 20px;
}
.list-col {
  flex: 1 1 360px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
@media (max-width: 900px) {
  main { flex-direction: column; }
  .list-col, .preview { flex: 1 1 0; min-height: 0; }
}
#status { flex: 0 0 auto; padding: 0 20px 8px; color: var(--muted); font-size: 0.9rem; min-height: 1.2em; }
#status.error { color: var(--danger); }
#list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--hit);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.row:last-child { border-bottom: none; }
.row:hover, .row.active { background: #20242e; }
.row img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  background: #0008;
  border-radius: 4px;
  flex-shrink: 0;
}
.row .meta { flex: 1; min-width: 0; }
.row .name { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .group { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#moreWrap { flex: 0 0 auto; padding: 10px; text-align: center; }
#moreBtn { width: 100%; }
#filteredCount { color: var(--muted); font-size: 0.85rem; margin-left: auto; }
.preview {
  flex: 1.1 1 380px;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}
.preview h2 { margin: 0 0 10px; font-size: 1.05rem; }
video {
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 60vh;
  background: #000;
  border-radius: 6px;
  display: block;
}
#playbackStatus { flex: 0 0 auto; margin-top: 8px; font-size: 0.9rem; color: var(--muted); }
#playbackStatus.error { color: var(--danger); }
#playbackStatus.ok { color: var(--ok); }
.preview-actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.copy-feedback { font-size: 0.8rem; color: var(--ok); margin-left: 6px; }
.live-status {
  flex: 0 0 auto;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}
.live-status[hidden] { display: none; }
.live-status dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin: 8px 0 0;
}
.live-status dt { color: var(--muted); }
.live-status dd { margin: 0; color: var(--text); }
.live-status dd.error { color: var(--danger); }
.public-url {
  flex: 0 0 auto;
  margin-top: 12px;
  padding: 10px;
  background: #0d0f14;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  word-break: break-all;
}
.public-url[hidden] { display: none; }
.public-url code { color: var(--accent); }
.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.78rem;
  background: #2a2f3a;
}
.badge.ok { background: #16351f; color: var(--ok); }
.badge.warn { background: #3a2c12; color: #f3c76a; }

/* Réglages (overlay) + Historique (vue plein panneau) partagent cette carte. */
#view-historique { padding: 20px; align-items: center; }
.settings-card {
  width: 100%;
  max-width: 720px;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 auto;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.fiche-scroll .settings-card {
  border: none;
  background: transparent;
  padding: 0;
  max-width: none;
  margin: 0;
  flex: none;
  overflow: visible;
}
.settings-card h2 { margin-top: 0; font-size: 1.1rem; flex: 0 0 auto; }
.settings-card h3 { font-size: 0.95rem; margin: 18px 0 10px; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 4px 0 0; }
.direct-settings[hidden] { display: none; }
.direct-settings label,
.field-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 10px;
}
.direct-settings input,
.field-group input {
  display: block;
  width: 100%;
  min-height: var(--hit);
  margin-top: 4px;
  background: #0d0f14;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 1rem;
}
.direct-settings button, .field-group button { margin-top: 14px; margin-right: 8px; }
.copy-feedback.error { color: var(--danger); }

/* Favoris */
.chip-toggle {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
}
.chip-toggle.active {
  background: #3a2f10;
  border-color: #caa23a;
  color: #f3c76a;
}
.chip-toggle[hidden] { display: none; }
.fav-star {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  min-width: var(--hit);
  min-height: var(--hit);
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 6px;
}
.fav-star:hover { color: #f3c76a; background: #20242e; }
.fav-star.active { color: #f3c76a; }
.fav-star[hidden] { display: none; }

.preview-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
}
.preview-title-row h2 { margin: 0; }

/* Historique */
.historique-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.historique-header h2 { margin: 0; }
.historique-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}
.hist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--hit);
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}
.hist-row:last-child { border-bottom: none; }
.hist-row .meta { min-width: 0; }
.hist-row .name { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-row .group { font-size: 0.78rem; color: var(--muted); }
#historiqueEmpty, #historiqueStorageHint { flex: 0 0 auto; }

/* Guide TV (EPG) */
#view-guide .controls { flex: 0 0 auto; }
.guide-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  margin: 0 20px 16px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}
.guide-row { min-height: var(--hit); }
.guide-row .meta { flex: 1; min-width: 0; }
.guide-prog { margin-top: 3px; font-size: 0.82rem; }
.guide-now { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guide-next { color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guide-none { color: var(--muted); font-style: italic; }
#guideMoreWrap { flex: 0 0 auto; padding: 0 20px 20px; text-align: center; }
#guideMoreBtn { width: 100%; }
#guideStatus.hint { display: block; flex: 0 0 auto; }
#guideStatus[hidden] { display: none; }

/* Films / Séries (VOD) */
.vod-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  align-content: start;
  gap: 14px;
  margin: 0 20px 16px;
  padding: 4px;
}
.vod-card {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.vod-card:hover, .vod-card:focus-visible { border-color: var(--accent); }
.vod-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: #0008;
  display: block;
}
.vod-poster-fallback {
  width: 100%;
  aspect-ratio: 2 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #20242e;
  color: var(--muted);
  font-size: 1.6rem;
  font-weight: 700;
}
.vod-card .vod-name {
  padding: 8px;
  min-height: var(--hit);
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#filmMoreWrap, #serieMoreWrap { flex: 0 0 auto; padding: 0 20px 20px; text-align: center; }
#filmMoreBtn, #serieMoreBtn { width: 100%; }
#filmCount, #serieCount { margin-left: auto; }
#filmStatus, #serieStatus { flex: 0 0 auto; margin: 0 20px 12px; }

/* Fiche film/série et Réglages : overlay plein écran, carte centrée qui ne
   dépasse jamais la fenêtre (max-height:100%) et défile en interne
   (.fiche-scroll) — le bouton fermer reste toujours visible, hors du flux
   qui défile. */
.fiche-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 7, 10, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.fiche-overlay[hidden] { display: none; }
.fiche-card {
  position: relative;
  max-width: 720px;
  width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.fiche-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 64px 20px 20px;
}
.fiche-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  border-radius: 50%;
  width: var(--hit);
  height: var(--hit);
  min-height: var(--hit);
  padding: 0;
  line-height: 1;
}
.fiche-body { display: flex; gap: 16px; flex-wrap: wrap; }
.fiche-poster {
  width: 140px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: #0008;
  flex-shrink: 0;
}
.fiche-info { flex: 1 1 260px; min-width: 0; }
.fiche-info h2 { margin: 0 0 6px; font-size: 1.2rem; }
.fiche-meta { color: var(--muted); font-size: 0.85rem; margin: 0 0 8px; }
.fiche-plot { font-size: 0.9rem; line-height: 1.4; color: var(--text); margin: 0 0 14px; }
.fiche-player { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.fiche-player[hidden] { display: none; }
.fiche-seasons { margin-top: 6px; }
.fiche-season { margin-bottom: 14px; }
.fiche-season h3 { font-size: 0.95rem; margin: 0 0 8px; }
.fiche-episode-list { list-style: none; margin: 0; padding: 0; }
.fiche-episode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--hit);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.fiche-episode:last-child { border-bottom: none; }
.fiche-episode .ep-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Réglages 10-foot : lignes de réglage pleine largeur (label à gauche, valeur
   à droite) au lieu d'un formulaire — cible télécommande (≥64 px, focus très
   visible réutilisant button:focus-visible ci-dessus : anneau + agrandissement). */
.settings-panel-card { max-width: 760px; }
.settings-panel { display: flex; flex-direction: column; gap: 26px; }
.settings-section h2 { margin: 0 0 10px; font-size: 1.1rem; }
.setting-info {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 10px;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 64px;
  padding: 12px 18px;
  margin-top: 10px;
  background: #0d0f14;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  text-align: left;
}
.setting-row:hover { border-color: var(--accent); }
.setting-label { font-weight: 600; }
.setting-value {
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.setting-row-action .setting-value { color: var(--accent); font-size: 1.1rem; }
.setting-row-info { cursor: default; }
.setting-row-danger { border-color: #6a1e1e; }
.setting-row-danger .setting-value { color: var(--danger); }
.setting-row-danger.confirm-pending { background: #3a1414; border-color: var(--danger); }
.setting-row-danger.confirm-pending .setting-value { color: #fff; font-weight: 700; }
.setting-row-toggle .setting-value { color: var(--text); font-weight: 600; font-size: 1rem; }
.setting-arrow-glyph { color: var(--accent); font-size: 1.3rem; line-height: 1; }
.setting-row[hidden] { display: none; }

.setting-field {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 10px;
}
.setting-field input {
  display: block;
  width: 100%;
  min-height: 64px;
  margin-top: 4px;
  background: #0d0f14;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 1rem;
}

/* Pavé numérique / hexadécimal en surcouche : saisie du code PIN et de
   l'adresse MAC sans clavier virtuel système — touches énormes (≥72 px),
   navigables aux flèches comme tout le reste (moveFocus() générique). */
.keypad-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 7, 10, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
}
.keypad-overlay[hidden] { display: none; }
.keypad-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: 100%;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 60px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.keypad-card h2 { margin: 0; font-size: 1.1rem; }
.keypad-display {
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0f14;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1.5rem;
  letter-spacing: 0.1em;
  padding: 8px 12px;
  word-break: break-all;
  text-align: center;
}
.keypad-grid {
  display: grid;
  gap: 10px;
  width: 100%;
}
.keypad-grid-numeric { grid-template-columns: repeat(3, 1fr); }
.keypad-grid-hex { grid-template-columns: repeat(4, 1fr); }
.keypad-key {
  min-height: 72px;
  min-width: 72px;
  font-size: 1.4rem;
  font-weight: 600;
  border-radius: 10px;
}
.keypad-key-empty { visibility: hidden; pointer-events: none; }
.keypad-actions { display: flex; gap: 10px; width: 100%; }
.keypad-actions .keypad-key { flex: 1 1 0; min-height: 72px; }

/* Chaines H.265 : marquees comme non lisibles dans un navigateur de PC. */
.row .badge-hevc {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #7a5a1f;
  background: #3a2c10;
  color: #f0c674;
}
.row.hevc .name { color: #b9c0cc; }
