/* Bravura : police de référence SMuFL, pour les altérations musicales
   (dièses, bémols, quarts de ton...) dans les annotations. */
@font-face {
  font-family: 'Bravura';
  src: url('https://cdn.jsdelivr.net/npm/@vexflow-fonts/bravura/bravura.woff2') format('woff2');
  font-display: swap;
}

/* ================================================================
   Design : doux et chaleureux -- fond beige/crème, texte quasi noir,
   surfaces en aplats gris/beige (jamais de bordure : les surfaces se
   distinguent par l'espace et la couleur, pas par un trait), coins
   arrondis. Une seule couleur d'accent. Police unique pour toute
   l'interface (Inter) -- la monospace ne sert plus qu'aux valeurs
   numériques techniques (chronomètre, métriques de synchro) où
   l'alignement des chiffres compte. Les panneaux qui flottent
   PAR-DESSUS la vidéo (outils, infos, saisie de texte) restent sombres
   et translucides (même famille chaude, juste inversée) -- ils doivent
   surtout rester lisibles sur une image vidéo quelconque, comme les
   contrôles de n'importe quel lecteur vidéo.
   ================================================================ */

:root {
  --bg: #F2EBDC;
  --surface: #ECE3D3;
  --surface-strong: #DFD2B9;
  --text: #211D17;
  --text-muted: #6E6355;
  --text-faint: #A79C88;
  --accent: #E3001B;
  --accent-text: #FFFFFF;
  --good: #1C8A4B;
  --warn: #B26A00;
  --bad: #D0021B;

  /* Onglets/panneaux flottants : entièrement opaques désormais (plus de
     transparence sur la vidéo), donc même thème clair que le reste de
     l'appli plutôt qu'un thème sombre séparé. */
  --overlay-bg: var(--bg);
  --overlay-bg-strong: var(--surface-strong);
  --overlay-text: var(--text);
  --overlay-text-muted: var(--text-muted);
  --overlay-fill: rgba(33, 29, 23, 0.08);
  --overlay-fill-hover: rgba(33, 29, 23, 0.15);

  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --radius: 10px;
  --radius-lg: 18px;

  /* Largeur des panneaux (outils/infos) -- une seule source, utilisée par
     .overlay-panel.open et par le contenu (header/body) qui doit rester à
     largeur fixe pendant l'animation d'ouverture (voir .overlay-panel en
     CSS plus bas). Réduite ~60% par rapport à l'ancienne largeur (300px). */
  --panel-w: 180px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
}

/* Compte admin : fond très légèrement grisé sur toute l'appli (bascule
   sur <body>, voir isAdmin en JS), pour qu'on distingue au premier coup
   d'oeil un compte qui peut éditer les repères/la couche publique d'un
   compte qui ne peut pas -- discret exprès, pas un bandeau ou une bordure. */
body.is-admin {
  --bg: #E9E2D5;
  --surface: #E2D9C8;
  --surface-strong: #D5C7AC;
}

.hidden { display: none !important; }

.icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.icon-letter {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
}
.icon-xl { width: 34px; height: 34px; }
/* Glyphe Bravura utilisé comme icône (ex : bouton "Symboles") plutôt
   qu'un SVG -- même principe que .icon-letter (un caractère à la place
   d'un tracé), juste avec la police à molette. */
.icon-glyph {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bravura', sans-serif;
  font-size: 15px;
  line-height: 1;
}

/* ---------- Écrans plein page (connexion, bibliothèque) ---------- */

.screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.login-card {
  max-width: 380px;
  margin: 10vh auto;
  padding: 32px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.login-brand { justify-content: center; margin-bottom: 12px; }
.login-submit { width: 100%; margin-top: 6px; }
.login-forgot {
  width: 100%;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-faint);
}

.field-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 10px 0 4px;
}
.text-input {
  width: 100%;
  background: var(--surface-strong);
  border: none;
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 13px;
  padding: 10px 10px;
  caret-color: var(--accent);
}
.text-input:focus {
  outline: none;
  background: var(--surface-strong);
  box-shadow: inset 0 -2px 0 0 var(--accent);
}

.library-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.library-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.library-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius-lg);
}
.library-item-info { flex: 1; min-width: 0; }
.library-item-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.library-item-meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
}
.library-item-buttons { display: flex; gap: 8px; flex-shrink: 0; }
.library-empty { color: var(--text-faint); font-size: 13px; padding: 10px 0; }

/* Indique si la vidéo est déjà en cache local (voir isVideoCached en JS)
   -- surtout utile sur tablette, où on veut savoir avant de partir en
   répétition si "Ouvrir" va nécessiter du réseau ou pas. */
.library-cache-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-faint);
}
.library-cache-badge .dot { width: 6px; height: 6px; }
.library-cache-badge.is-cached { color: var(--good); }
.library-cache-badge.is-cached .dot { background: var(--good); }

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 10px;
  padding: 20px 24px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.5px;
}

.brand-mark {
  color: var(--accent);
  font-size: 20px;
}

.brand-name { color: var(--text); }
.brand-name .accent { color: var(--accent); font-weight: 500; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.topbar-actions {
  display: flex;
  gap: 4px;
}

.topbar-status {
  display: flex;
  gap: 16px;
}

.status-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-muted);
}
.status-item#roleChip.is-master { color: var(--accent); font-weight: 600; }

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}
.dot-off { background: var(--bad); }
.dot-on { background: var(--good); }

/* ---------- Boutons texte (chrome de page, pas de fond ni de bordure) --- */

.text-btn {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: none;
  border: none;
  padding: 8px 10px;
  cursor: pointer;
}
.text-btn:hover { background: var(--surface); }
.text-btn-accent { color: var(--accent); font-weight: 600; }

/* Raccourci maître/esclave dans la barre du haut -- même bascule que
   Devenir maître/Redevenir esclave (voir #quickRoleToggleBtn en JS), en
   un clic. Deux traitements de couleur opposés plutôt qu'un seul état
   neutre : plein/accent quand on EST déjà maître (état actif), fond
   clair/icône noire sinon (invite à cliquer pour le devenir) -- demande
   explicite de l'inversion des couleurs entre les deux. */
.role-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 28px;
  padding: 4px;
  margin: 0 2px;
  border: none;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.role-toggle-btn:hover:not(:disabled) { background: var(--surface-strong); }
.role-toggle-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.role-toggle-btn.is-master { background: var(--accent); color: var(--accent-text); }

.icon-role { width: 30px; height: 18px; flex-shrink: 0; }

/* ---------- Video pane ---------- */

.video-pane {
  /* Bord à bord horizontalement -- comme en plein écran (voir
     .fake-fullscreen), aucune marge ni largeur max ne doit empêcher la
     vidéo d'atteindre les bords gauche/droit de la fenêtre. */
  padding: 0 0 40px;
  /* Budget de hauteur réel pour la vidéo (voir --video-max-h ci-dessous) :
     mesuré, pas deviné -- barre du haut (~70px) + titre (~24px) + barre
     de lecture en dessous (~64px) + marge basse de video-pane (40px) =
     ~198px, avec un peu de marge. Un pourcentage fixe de vh (ex: 82vh)
     ne colle qu'à UNE hauteur d'écran précise -- ailleurs, soit ça
     déborde (barre de lecture coupée), soit ça laisse un vide en dessous.
     Ce calc() s'adapte à n'importe quelle fenêtre. */
  --video-max-h: calc(100vh - 200px);
}

.video-frame {
  position: relative;
  display: flex;
  background: var(--bg);
  /* Hauteur fixe = tout le budget dispo (voir --video-max-h sur
     .video-pane) ; largeur = bord à bord. Le cadre n'épouse plus le ratio
     de la vidéo -- c'est la vidéo elle-même (object-fit:contain, voir plus
     bas) qui s'adapte à l'intérieur de ce cadre sans le déborder, pile
     comme en plein écran (.fake-fullscreen), juste avec une hauteur
     limitée au budget dispo plutôt que tout l'écran. */
  height: var(--video-max-h);
  width: 100%;
  /* Pas de overflow:hidden ici : la vidéo (object-fit:contain) et le
     canevas ne débordent jamais de toute façon, mais les panneaux flottants
     (outils/infos) doivent parfois dépasser ce cadre -- typiquement en
     mobile portrait, où un cadre 16/9 est bas et n'offrirait sinon presque
     aucune place pour leur contenu. */
}

/* Plein écran SIMULÉ en CSS plutôt que via l'API Fullscreen du navigateur
   -- Safari iOS ne permet le vrai plein écran que sur <video> seul, ce qui
   masquerait tous nos outils d'annotation. Les boutons ronds et panneaux
   flottants vivent dans video-area, position:relative dans les deux cas
   -- ils fonctionnent donc à l'identique en plein écran et en mode normal,
   sans aucun code séparé. */
.video-frame.fake-fullscreen {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 1000;
  /* Volontairement PAS de width:100vw / height:100vh : sur Safari iOS,
     ces unités ne correspondent pas toujours à la zone réellement visible
     (la barre d'outils du navigateur peut la recouvrir). position:fixed
     avec top/right/bottom/left:0 seul s'aligne sur la zone visible réelle. */
  /* Annule la hauteur/largeur fixes du mode normal -- ici les quatre
     coins déjà posés définissent la taille, plein écran réel. */
  width: auto;
  height: auto;
}
/* Coins vifs en plein écran réel -- arrondis contre le bord même de
   l'écran, ça ressemblerait à un bug d'affichage plutôt qu'un choix. */
.video-frame.fake-fullscreen video,
.video-frame.fake-fullscreen .anno-canvas,
.video-frame.fake-fullscreen .drop-overlay {
  border-radius: 0;
}

.video-area {
  position: relative;
  /* Rétrécit quand un panneau (outils/infos) s'ouvre à côté -- voir
     .overlay-panel, qui prend alors une largeur réelle et pousse ceci. */
  flex: 1 1 auto;
  min-width: 0;
}

video {
  width: 100%;
  height: 100%;
  display: block;
  /* Fond TRANSPARENT, volontairement -- pas var(--bg) ici. Les bandes
     (object-fit:contain, quand le ratio de la fenêtre ne colle pas à
     celui de la vidéo) doivent montrer le fond de .video-frame tel quel,
     pile en dessous et de la même couleur. S'il était peint ICI, sur cet
     élément, il subirait le mix-blend-mode ci-dessous comme le reste --
     crème multiplié par le crème du fond juste derrière donne un ton
     plus sombre que --bg (c'est ce qui rendait les bandes "sales" en
     plein écran). Transparent : rien à fusionner, le fond de .video-frame
     apparaît intact. */
  background: transparent;
  object-fit: contain;
  /* Fond blanc de la partition -> se fond avec le fond de la page : sur
     les pixels de l'IMAGE vidéo (opaques), multiply avec --bg juste
     derrière rend le blanc transparent (blanc × une couleur = cette
     couleur) tout en gardant les noirs intacts (noir × n'importe quoi =
     noir). Coût GPU natif (pas de traitement image par image en JS),
     mais à surveiller quand même sur tablette moins puissante. */
  mix-blend-mode: multiply;
  /* Arrondi léger sur la vidéo elle-même (et le canevas/l'écran de dépôt
     juste en dessous) plutôt que sur .video-frame : ce dernier reste en
     overflow:visible (les panneaux flottants doivent parfois le
     déborder, voir plus haut) donc un radius posé dessus ne découperait
     rien. */
  border-radius: var(--radius);
}

/* Cet écran (avant tout chargement vidéo) reste volontairement sombre --
   --overlay-text/-muted servent maintenant aux panneaux clairs, donc ses
   propres couleurs de texte sont explicites plutôt que liées à ces
   variables. */
.drop-overlay {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(19, 16, 12, 0.92);
  transition: opacity 0.2s ease, background 0.15s ease;
  z-index: 8;
  color: #FBF7EF;
  border-radius: var(--radius);
}

.drop-overlay.hidden { display: none; }
.drop-overlay.drag-active { background: rgba(19, 16, 12, 0.8); }

.drop-inner {
  text-align: center;
  max-width: 340px;
  padding: 20px;
}

.drop-inner .icon-xl {
  color: #FBF7EF;
  margin-bottom: 10px;
}

.drop-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 6px;
  color: #FBF7EF;
}

.drop-sub {
  font-size: 13px;
  color: rgba(251, 247, 239, 0.68);
  margin: 0 0 14px;
}

.file-link {
  color: #FBF7EF;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.drop-note {
  font-size: 11px;
  color: rgba(251, 247, 239, 0.68);
  line-height: 1.5;
  margin: 0;
}

.anno-canvas {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  touch-action: none;
  z-index: 5;
  border-radius: var(--radius);
}
.anno-canvas.drawable { pointer-events: auto; cursor: crosshair; }

/* ---------- Boutons ronds flottants + panneaux translucides ---------- */
/* Le panneau ne redimensionne JAMAIS la vidéo : il flotte par-dessus,
   à 40% d'opacité au repos (on voit l'image au travers), et se ferme au
   clic ailleurs sur la vidéo. */

.round-btn {
  position: absolute;
  z-index: 16;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  /* Volontairement PAS lié à --overlay-bg (devenu clair) : ce bouton
     flotte seul sur une vidéo quelconque et doit rester repérable quelle
     que soit l'image derrière, contrairement aux panneaux qui sont
     maintenant pleinement opaques. */
  background: rgba(19, 16, 12, 0.92);
  color: #FBF7EF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.round-btn:hover { background: rgba(19, 16, 12, 0.75); }
.round-btn.active { background: var(--accent); }

.fs-exit-btn {
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: calc(14px + env(safe-area-inset-right, 0px));
}
.fs-exit-btn.hidden { display: none; }

.overlay-panel {
  /* Pousse la vidéo au lieu de flotter par-dessus : un vrai membre de la
     mise en page flex de .video-frame, replié à largeur 0 par défaut.
     L'ouverture anime cette largeur (voir .open) -- .video-area, qui se
     partage le reste (flex:1), rétrécit d'autant en retour. */
  flex: 0 0 auto;
  width: 0;
  overflow: hidden;
  background: var(--overlay-bg);
  color: var(--overlay-text);
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease;
}
.overlay-panel.open { width: min(var(--panel-w), calc(100% - 32px)); }
/* Arrondi seulement du côté libre -- le côté collé au bord de la vidéo
   reste net, sinon un interstice réapparaît. */
.overlay-panel-left { border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.overlay-panel-right { border-radius: var(--radius-lg) 0 0 var(--radius-lg); }

.overlay-panel-header {
  /* Largeur fixe (indépendante de la largeur animée du panneau parent,
     voir .overlay-panel) : sans ça, le contenu se réenroulerait à vue
     pendant l'animation d'ouverture/fermeture au lieu d'être simplement
     révélé/masqué par l'overflow:hidden du parent. */
  width: var(--panel-w);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--overlay-text);
  cursor: pointer;
  padding: 4px;
  display: flex;
}
.icon-btn:hover { opacity: 0.7; }

.overlay-panel-body {
  width: var(--panel-w);
  overflow-y: auto;
  overflow-x: hidden;
  /* En plein écran, dégage la barre de lecture quand elle est réaffichée
     par-dessus (même beige qu'elle, donc invisible en temps normal, où
     rien ne flotte plus au-dessus du panneau). */
  padding: 4px 14px 64px;
  flex: 1;
  min-height: 0;
}

.overlay-section { padding: 10px 0; }

.overlay-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--overlay-text-muted);
  margin-bottom: 8px;
}

.overlay-hint {
  font-size: 11.5px;
  color: var(--overlay-text-muted);
  margin: 8px 0 0;
  line-height: 1.5;
}

/* ---------- Boutons à l'intérieur des panneaux flottants ---------- */

.ov-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-family: var(--font-display);
  font-size: 12.5px;
  color: var(--overlay-text);
  background: none;
  border: none;
  border-radius: var(--radius);
  padding: 8px 8px;
  margin-bottom: 4px;
  cursor: pointer;
  text-align: left;
}
.ov-btn:hover:not(:disabled) { background: var(--overlay-fill); }
.ov-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.ov-btn-primary { background: var(--accent); font-weight: 600; justify-content: center; }
.ov-btn-primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.15); }

.role-buttons { display: flex; flex-direction: column; gap: 0; }

.public-visible-btn .eye-slash { opacity: 0; }
.public-visible-btn.is-hidden-state .eye-slash { opacity: 1; }
.public-visible-btn.is-hidden-state { color: var(--overlay-text-muted); }

.anno-tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 8px;
}
.anno-tools .tool-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--overlay-text);
  background: var(--overlay-fill);
  border: none;
  border-radius: var(--radius);
  padding: 9px 8px;
  cursor: pointer;
}
/* Icônes un peu plus grandes que le standard des autres boutons du
   panneau (voir .icon) -- ce sont les outils les plus utilisés du
   panneau, ils gagnent à rester repérables au premier coup d'oeil. */
.anno-tools .tool-btn .icon { width: 20px; height: 20px; }
.anno-tools .tool-btn .icon-letter { width: 20px; height: 20px; font-size: 16px; }
.anno-tools .tool-btn:hover:not(:disabled) { background: var(--overlay-fill-hover); }
.anno-tools .tool-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.anno-tools .tool-btn.active {
  background: var(--accent);
  color: var(--overlay-text);
}

.anno-colors {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  padding: 2px 2px;
}
.swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--c);
  cursor: pointer;
  padding: 0;
  transform: scale(1);
  transition: transform 0.1s ease;
}
.swatch.active { transform: scale(1.3); }

/* Nav de page -- commune à tout le monde (admin ou non), voir HTML.
   #pageCurrentBox affiche juste le numéro ; le détail mm:ss reste en
   title (survol) plutôt que dans la boîte elle-même. */
.page-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.page-nav-arrow {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay-fill);
  color: var(--overlay-text);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}
.page-nav-arrow:hover:not(:disabled) { background: var(--overlay-fill-hover); }
.page-nav-arrow:disabled { opacity: 0.35; cursor: not-allowed; }
.page-nav-current {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 700;
  color: var(--overlay-text);
  background: var(--overlay-fill);
  border-radius: var(--radius);
  padding: 6px;
}

.page-goto {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.page-goto-label {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--overlay-text-muted);
}
.page-select {
  flex: 1;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--overlay-text);
  background: var(--overlay-fill);
  border: none;
  border-radius: var(--radius);
  padding: 6px 8px;
  cursor: pointer;
}

.page-breaks-list {
  max-height: 130px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
/* Le tiroir des repères n'a que ça comme contenu scrollable (contrairement
   aux autres panneaux, qui empilent plusieurs sections) -- la liste peut
   donc remplir toute la hauteur dispo plutôt que rester plafonnée à
   130px, ça fait mieux. */
#repereDrawer .overlay-panel-body { display: flex; flex-direction: column; }
#repereDrawer .page-breaks-list { flex: 1; max-height: none; }

.page-break-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--radius);
  background: var(--overlay-fill);
  font-size: 11px;
}
.page-break-row.current { background: var(--accent); }
.page-break-row .pb-index { color: var(--overlay-text-muted); width: 16px; flex-shrink: 0; }
.page-break-row.current .pb-index { color: var(--overlay-text); }
.page-break-row .pb-time {
  flex: 1;
  color: var(--overlay-text);
  font-family: var(--font-mono);
  cursor: pointer;
}
.pb-time-input {
  /* Fond propre plutôt que transparent : la ligne éditée peut être la
     page en cours (fond plein --accent) -- un texte transparent hérite
     alors du rouge sur rouge et devient invisible. Un petit chip clair
     reste lisible quel que soit le fond de la ligne en dessous. */
  flex: 1;
  width: 100%;
  min-width: 0;
  background: var(--bg);
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: inherit;
  padding: 1px 5px;
  border-radius: 4px;
}
.page-break-row .pb-remove {
  background: none;
  border: none;
  color: var(--overlay-text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 0 2px;
  line-height: 1;
}
.page-break-row .pb-remove:hover { color: var(--overlay-text); }
.page-break-row .pb-remove:disabled { visibility: hidden; }

/* Menu contextuel (clic droit sur un repère) -- position:fixed, ajouté
   directement à <body> pour échapper au défilement/au overflow du
   panneau et rester en coordonnées écran. */
.ctx-menu {
  position: fixed;
  /* Plus haut que .video-frame.fake-fullscreen (z-index:1000) : ce menu
     est ajouté à <body>, donc en dehors de son contexte d'empilement --
     sans ça il resterait cachÉ derrière la vidéo en plein écran. */
  z-index: 1100;
  min-width: 160px;
  background: var(--overlay-bg-strong);
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.ctx-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--overlay-text);
  font-family: var(--font-display);
  font-size: 12.5px;
  padding: 8px 10px;
  cursor: pointer;
}
.ctx-menu-item:hover:not(:disabled) { background: var(--overlay-fill-hover); }
.ctx-menu-item:disabled { opacity: 0.35; cursor: not-allowed; }
.ctx-menu-info {
  padding: 8px 10px;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--overlay-text-muted);
  max-width: 200px;
}

.share-progress {
  height: 4px;
  background: var(--surface-strong);
  overflow: hidden;
  margin: 8px 0 4px;
}
.share-progress.hidden { display: none; }
.share-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.15s ease;
}

/* Favoris : bande compacte, toujours visible (voir renderFavSymbolsRow
   en JS) -- pas une grille rigide comme le plein catalogue (voir
   #symbolsDrawer), son nombre d'entrées varie librement selon les
   favoris de chacun. Cadre pour bien délimiter la zone (demande
   explicite -- contrairement au reste du panneau, qui s'appuie sur
   l'espace plutôt que sur un trait). */
.anno-symbols-fav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--overlay-fill-hover);
  border-radius: var(--radius);
}
/* Même taille que dans le tiroir #symbolsDrawer (voir .symbol-btn) --
   demande explicite, pas de version réduite ici. */
.anno-symbols-fav .symbol-btn { width: 46px; height: 46px; flex-shrink: 0; }

/* Catalogue complet (voir #symbolsDrawer) -- chaque sous-groupe (Clés,
   Nuances...) réutilise directement .overlay-label en JS (voir
   renderFullSymbolBrowser) plutôt qu'une classe dédiée : même style que
   les autres titres de section, pas un composant à part. */
.symbol-group + .symbol-group { margin-top: 10px; }
.symbol-grid {
  display: grid;
  /* 3 colonnes plutôt que 4 -- le panneau, réduit (voir --panel-w), ne
     laisse plus assez de place pour 4 cellules confortables. */
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.symbol-btn {
  width: 100%;
  aspect-ratio: 1;
  border: none;
  background: var(--overlay-fill);
  color: var(--overlay-text);
  border-radius: var(--radius);
  font-family: 'Bravura', sans-serif;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.symbol-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.symbol-btn.active { background: var(--accent); }
/* Favori : rester appuyé (voir la détection de longue pression en JS,
   pas de bouton étoile séparé) entoure le glyphe de jaune -- même jaune
   que la nuance de couleur de dessin (--c:#FFE45E), pas une nouvelle
   couleur ad hoc. */
.symbol-btn.is-fav { box-shadow: 0 0 0 2px #FFE45E inset; }

.text-input-overlay {
  position: absolute;
  z-index: 20;
  background: var(--overlay-bg-strong);
  border-radius: var(--radius);
  padding: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.text-input-overlay input {
  background: transparent;
  border: none;
  color: var(--overlay-text);
  font-family: var(--font-display);
  font-size: 14px;
  outline: none;
  min-width: 80px;
}
.text-case-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: var(--radius);
  border: none;
  background: var(--overlay-fill);
  color: var(--overlay-text);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}
.text-case-btn:hover { background: var(--overlay-fill-hover); }

/* ---------- Barre de lecture -- PAR-DESSUS la vidéo, toujours visible
   (jamais en dessous : c'est le premier réflexe pour lire/mettre en pause,
   elle doit rester sous les yeux, pas à chercher plus bas). Même traitement
   translucide sombre que les panneaux flottants. ---------- */

/* Mode normal : hors du cadre vidéo, juste en dessous, à raz (pas de
   dégradé -- fond plein, comme les panneaux). Bord à bord comme le cadre
   au-dessus, pour rester alignée avec lui. */
.controls-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  margin: 10px 0 0;
  padding: 10px 14px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  transition: opacity 0.15s ease;
}

/* Plein écran : le JS déplace cette même barre à l'intérieur de
   video-area (aucun "dessous" possible quand la vidéo remplit l'écran) --
   elle flotte alors par-dessus, tout en bas, affichable/masquable. */
.video-area .controls-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 15;
  width: auto;
  margin: 0;
  border-radius: 0;
}
.video-area .controls-bar.fs-hidden {
  opacity: 0;
  pointer-events: none;
}

.ctrl-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: none;
  background: none;
  color: var(--overlay-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ctrl-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ctrl-btn:not(:disabled):hover { background: var(--overlay-fill); }
.ctrl-btn.active { background: var(--accent); color: var(--accent-text); }
.ctrl-btn .pause-icon { display: none; }
.ctrl-btn.is-playing .play-icon { display: none; }
.ctrl-btn.is-playing .pause-icon { display: block; }

.seek-wrap { flex: 1; min-width: 80px; }

#seek {
  width: 100%;
  accent-color: var(--accent);
}
#seek:disabled { opacity: 0.5; }

.time-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--overlay-text-muted);
  white-space: nowrap;
  min-width: 100px;
  text-align: right;
}

.rate-buttons { display: flex; gap: 4px; }
.rate-btn {
  padding: 7px 8px;
  border-radius: var(--radius);
  border: none;
  background: none;
  color: var(--overlay-text);
  font-family: var(--font-display);
  font-size: 12px;
  cursor: pointer;
}
.rate-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.rate-btn:not(:disabled):hover { background: var(--overlay-fill); }
.rate-btn.active {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

/* ---------- Boutons génériques (écrans connexion / bibliothèque) ------- */

.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  background: var(--surface-strong);
  color: var(--text);
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}
.btn-primary:not(:disabled):hover { filter: brightness(1.15); }

.btn-ghost:not(:disabled):hover { background: var(--surface-strong); }

.panel-hint {
  font-size: 11.5px;
  color: var(--text-faint);
  margin: 10px 0 0;
  line-height: 1.5;
}

.anno-add-break { width: 100%; font-size: 12px; margin-bottom: 8px; justify-content: center; }
/* Le champ Titre juste au-dessus (.text-input) n'a pas de marge basse --
   même trou que .login-submit sur l'écran de connexion, pour le même
   bouton juste après un champ. */
#libraryUploadBtn { margin-top: 6px; }

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
  font-size: 12px;
}

.metric-label { color: var(--overlay-text-muted); }
.metric-value { color: var(--overlay-text); font-weight: 500; font-family: var(--font-mono); }
.metric-value.warn { color: var(--warn); }
.metric-value.bad { color: var(--bad); }


/* ---------- Mobile ---------- */

@media (max-width: 640px) {
  .video-pane {
    padding: 0 0 32px;
    /* Budget plus large qu'en desktop : la barre du haut peut passer sur
       deux lignes ici, et la barre de lecture aussi (les boutons de
       vitesse prennent leur propre ligne, voir .rate-buttons-inline plus
       bas). */
    --video-max-h: calc(100vh - 280px);
  }
  .controls-bar { gap: 8px; }
  .rate-buttons-inline { order: 5; width: 100%; justify-content: center; }
}
