/* ══════════════════════════════════════════════════════════════════════
   Simulation pédagogique — Physique-Chimie Lycée
   Auteur  : Mathieu Berdous
   Licence : CC BY-NC 4.0 — https://creativecommons.org/licenses/by-nc/4.0/
   ══════════════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════════════
   style.css — Interférences (fentes et trous d'Young)
   ══════════════════════════════════════════════════════════════════════ */

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 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;
}

html { height: 100%; }
body {
  background: #e8e4de;
  color: #2c3e50;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  /* dvh : suit la hauteur réellement visible (barres dynamiques du navigateur) ;
     vh reste le repli pour les navigateurs sans support dvh. */
  height: 100vh;
  max-height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Grille principale : colonne gauche + panneau droit ── */
main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr clamp(200px, 22vw, 300px);
  grid-template-rows: 1fr;
  overflow: hidden;
}

/* ── Colonne gauche : scène 3D + splitter + graphe ── */
#left-col {
  grid-row: 1;
  grid-column: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ── Onglet Ondes lumineuses : conteneur scène 3D + splitter + graphe ── */
#lumineuses-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  position: relative; /* référentiel de #graph-lien-overlay, cf. plus bas */
}

/* Overlay pointillés reliant graphe ↔ figure (vue Écran, cf. graph.js → dessinerLienFigure) :
   recouvre exactement scène 3D + splitter + graphe, jamais interactif. */
#graph-lien-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
}

/* ── Onglet Principe ── */
/* Colonne qui contient la zone de tracé (mode 1D) OU le placeholder du mode 2D,
   cf. js/principe.js → setPrincipeMode. */
#principe-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* Fond ivoire "simulation" de la charte, et NON le #14181d des deux autres
   onglets : celui-ci trace des courbes sur des axes, pas un champ. */
#prin-scene-area {
  flex: 1;
  min-height: 0;
  background: #fdf8f0;
  border-right: 1px solid #c8c0b4;
  overflow: hidden;
  position: relative;
}
#principe-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
/* Le canvas est focusable (tabindex) pour le pilotage clavier : on garde un
   liseré discret plutôt que le contour par défaut du navigateur, très épais. */
#principe-canvas:focus { outline: none; box-shadow: inset 0 0 0 2px rgba(42, 106, 170, 0.35); }
#principe-canvas:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgba(42, 106, 170, 0.55); }
/* Blocs de réglages propres au mode 1D de l'onglet Principe : la mise en page
   est ici et non en style inline, car setPrincipeMode() les réaffiche en
   remettant style.display à '' — un display:flex inline serait alors perdu. */
#prin-1d-blocks {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tab-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #7a8a96;
  font-size: clamp(14px, 1.6vw, 20px);
  font-weight: 600;
}
.tab-placeholder-icon { font-size: clamp(36px, 5vw, 56px); }
/* Placeholder du mode 2D : reprend le fond sombre et le centrage que
   #principe-area portait lui-même quand tout l'onglet était un placeholder. */
#prin-2d-placeholder {
  flex: 1;
  min-height: 0;
  justify-content: center;
  background: #14181d;
  border-right: 1px solid #c8c0b4;
}

/* ── Fenêtres volantes des graphes temporels y(M, t) (onglet Principe) ──
   Superposées à la zone de tracé (#prin-scene-area, en position:relative :
   c'est lui le référentiel de leur left/top, et donc aussi celui que lit
   principe.js pour tracer la flèche de rattachement sur le canvas).
   Déplaçables par leur barre de titre, souris comme doigt (touch-action:none
   sur la barre — sans quoi le geste part en défilement de page).
   Largeur en clamp() plutôt qu'en px : lisible au vidéoprojecteur (plein
   écran) sans dévorer une petite fenêtre. */
.prin-graph-win {
  position: absolute; left: 0; top: 0; z-index: 20;
  width: clamp(190px, 26%, 460px);
  display: flex; flex-direction: column;
  /* Corps d'APPAREIL (et non une fiche posée sur la scène) : c'est ce qui
     empêche de lire l'écran comme un morceau du tracé — cf. le bandeau
     PRIN_COL_SCOPE_* de principe.js. */
  background: #2b3138;
  border: 2px solid #2c3e50; border-radius: 8px;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.prin-graph-head {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 4px 4px 8px;
  background: #2c3e50; color: #fff;
  font-size: clamp(11px, 1.15vw, 16px); font-weight: 700;
  cursor: grab; touch-action: none; user-select: none;
}
.prin-graph-head.dragging { cursor: grabbing; }
.prin-graph-title { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prin-graph-close {
  flex: 0 0 auto; border: none; border-radius: 4px; cursor: pointer;
  background: rgba(255, 255, 255, 0.18); color: #fff;
  font-family: inherit; font-size: clamp(11px, 1.1vw, 15px); line-height: 1;
  padding: 3px 6px;
}
.prin-graph-close:hover { background: rgba(255, 255, 255, 0.38); }
/* L'écran, encastré dans le boîtier : la marge est la façade de l'appareil,
   le liseré sombre le joint du verre. Le rapport largeur/hauteur est fixé ici,
   la hauteur de l'écran suit donc la largeur en clamp() ci-dessus, et le tracé
   reste lisible à toutes les tailles (principe.js recalibre police et traits
   dessus). */
.prin-graph-canvas {
  display: block;
  width: calc(100% - 12px); margin: 6px; aspect-ratio: 5 / 3;
  border: 1px solid #171c22; border-radius: 3px;
  background: #0f1720;
}
/* Légende cliquable de la fenêtre "y₁ + y₂" : superpose les deux termes à leur
   somme. Elle est logée DANS la barre de titre — sous le graphe, elle coûtait
   une rangée de hauteur à une fenêtre déjà petite. C'est le titre qui cède la
   place le premier (flex:1 + min-width:0 → ellipsis), jamais les cases.
   accent-color: currentColor → la case reprend la couleur de son libellé, donc
   celle de la source. */
.prin-graph-legend {
  flex: 0 0 auto;
  display: flex; flex-wrap: nowrap; gap: 0 8px;
  font-size: clamp(10px, 1.05vw, 14px); font-weight: 700;
}
.prin-graph-legend label { display: flex; align-items: center; gap: 3px; cursor: pointer; }
.prin-graph-legend input {
  margin: 0; cursor: pointer; accent-color: currentColor;
  width: clamp(11px, 1.15vw, 15px); height: clamp(11px, 1.15vw, 15px);
}
/* Teintes ÉCLAIRCIES de PRIN_COL_S1/S2 : les tons du tracé sont calibrés pour
   le fond ivoire de la scène et manquent de contraste sur le bleu foncé de la
   barre de titre — surtout le rose, au fond d'une salle de classe. */
.prin-graph-legend .lg-y1 { color: #ffa85c; }
.prin-graph-legend .lg-y2 { color: #ff8ab4; }
/* Code couleur des lignes du tracé (PRIN_COL_S1/S2/SOMME de principe.js) :
   c'est ce qui relie visuellement une fenêtre à sa ligne, avec la flèche. */
#prin-win-y1 { border-color: #e07020; }
#prin-win-y1 .prin-graph-head { background: #e07020; }
#prin-win-y2 { border-color: #e0397a; }
#prin-win-y2 .prin-graph-head { background: #e0397a; }

/* ── Onglet Ondes de surfaces : bassin (vue de dessus) + splitter + graphe ── */
#surfaces-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
#surf-scene-area {
  background: #14181d;
  border-right: 1px solid #c8c0b4;
  overflow: hidden;
  flex: 3;
  min-height: clamp(80px, 18vh, 160px);
  position: relative;
}
#surf-canvas { display: block; width: 100%; height: 100%; cursor: grab; }
#surf-canvas:active { cursor: grabbing; }

/* Bouton de vue (overlay coin haut-droit du bassin), cf. #view-buttons/.btn-view (onglet
   Ondes lumineuses) — dupliqué plutôt que factorisé pour ne rien risquer de casser là-bas. */
#surf-view-buttons {
  position: absolute;
  top: clamp(6px, 1vw, 12px);
  right: clamp(6px, 1vw, 12px);
  z-index: 10;
  display: flex;
  gap: 5px;
  background: rgba(20,24,29,0.55);
  padding: 5px;
  border-radius: 7px;
}

/* Slider d'angle (overlay sous #surf-view-buttons, vue plongeante uniquement), même famille que
   #echelle-angle-buttons : caché par défaut, visible via la classe .visible (cf. surfaces.js →
   setSurfViewMode). */
#surf-tilt-slider {
  position: absolute;
  top: calc(clamp(6px, 1vw, 12px) + 42px);
  right: clamp(6px, 1vw, 12px);
  z-index: 10;
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(20,24,29,0.55);
  padding: 6px 10px;
  border-radius: 7px;
  color: #cfd8df;
  font-size: clamp(11px, 1.05vw, 13px);
  font-weight: 700;
}
#surf-tilt-slider.visible { display: flex; }
#surf-tilt-slider input[type="range"] { width: clamp(80px, 10vw, 130px); }

#surf-splitter {
  flex: 0 0 6px;
  background: #c8c0b4;
  cursor: row-resize;
  position: relative;
  z-index: 20;
  transition: background 0.15s;
  border-right: 1px solid #c8c0b4;
}
#surf-splitter:hover, #surf-splitter.dragging { background: #2a6aaa; }

#surf-graph-area {
  flex: 2;
  background: #faf9f6;
  border-top: 1px solid #c8c0b4;
  border-right: 1px solid #c8c0b4;
  display: none;
  flex-direction: column;
  min-height: clamp(80px, 14vh, 140px);
  overflow: hidden;
  position: relative;
}
/* Barre contrôle graphe(s) — même structure que #graph-time-control (I(x)) */
#surf-graph-ctrl {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: clamp(4px, 0.5vw, 6px);
  padding: clamp(3px, 0.4vh, 5px) clamp(6px, 0.8vw, 10px);
  flex-wrap: wrap;
  border-bottom: 1px solid #c8c0b4;
  background: #f0ede8;
}
#surf-graph-canvas {
  background: #ffffff;
  border: 1px solid #c8c0b4;
  border-radius: 3px;
  display: block;
  flex: 1;
  min-height: 0;
  cursor: default;
}
#surf-graph-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 10px 8px;
}

/* Séparateur mode dual (2 graphes) — overlay sur toute la hauteur de #surf-graph-area */
#surf-graph-dual-sep {
  display: none;
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: #c8c0b4;
  pointer-events: none;
  z-index: 10;
}

.graph-select {
  height: clamp(22px, 2.6vh, 28px);
  padding: 0 clamp(4px, 0.5vw, 7px);
  font-family: inherit;
  font-size: clamp(10px, 1vw, 12px);
  font-weight: 600;
  color: #2c3e50;
  background: #e8e4de;
  border: 1px solid #b0a898;
  border-radius: 5px;
  cursor: pointer;
  min-width: 0;
  flex: 0 0 auto;
  width: clamp(90px, 9vw, 110px);
}
.graph-select:focus { outline: none; }

.graph-mode-btn {
  height: clamp(22px, 2.6vh, 28px);
  padding: 0 clamp(5px, 0.7vw, 9px);
  font-weight: 700;
  font-size: clamp(10px, 1vw, 12px);
  background: #e8e4de;
  color: #5a6a78;
  border: 1px solid #b0a898;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}
.graph-mode-btn:hover { background: #d0ccc4; color: #2c3e50; }
.graph-mode-btn.active {
  background: #d0dce8;
  border-color: #5a80a8;
  color: #1a3a5a;
}

/* Zone de la scène 3D */
#scene-area {
  background: #14181d;
  border-right: 1px solid #c8c0b4;
  overflow: hidden;
  flex: 3;
  min-height: clamp(80px, 18vh, 160px);
  position: relative;
}
#scene-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
#scene-canvas:active { cursor: grabbing; }

/* Boutons de vue (overlay coin haut-droit de la scène) */
#view-buttons {
  position: absolute;
  top: clamp(6px, 1vw, 12px);
  right: clamp(6px, 1vw, 12px);
  z-index: 10;
  display: flex;
  gap: 5px;
  background: rgba(20,24,29,0.55);
  padding: 5px;
  border-radius: 7px;
}
.btn-view {
  padding: 6px 10px;
  font-size: clamp(11px, 1.05vw, 13px);
  font-weight: 700;
  border: 1px solid #4a5560;
  border-radius: 5px;
  background: rgba(255,255,255,0.08);
  color: #cfd8df;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.btn-view:hover { background: rgba(255,255,255,0.18); color: #fff; }
.btn-view.active { background: #2a6aaa; border-color: #1a5a9a; color: #fff; }

/* Bouton "Décomposer la figure de diffraction" (overlay sous #view-buttons, vue Écran +
   lumière blanche uniquement, cf. scene.js → syncBoutonDecompose) */
#decompose-buttons {
  position: absolute;
  top: calc(clamp(6px, 1vw, 12px) + 42px);
  right: clamp(6px, 1vw, 12px);
  z-index: 10;
  display: none;
  padding-right: 5px; /* aligne la bordure droite du bouton sur celle de #view-buttons (padding:5px) */
}
#decompose-buttons.visible { display: flex; }

/* Bouton "Adapter l'échelle à l'angle de diffraction" (overlay sous #view-buttons, vue
   Dessus uniquement, cf. scene.js → syncBoutonEchelleAngle) */
#echelle-angle-buttons {
  position: absolute;
  top: calc(clamp(6px, 1vw, 12px) + 42px);
  right: clamp(6px, 1vw, 12px);
  z-index: 10;
  display: none;
  padding-right: 5px; /* aligne la bordure droite du bouton sur celle de #view-buttons (padding:5px) */
}
#echelle-angle-buttons.visible { display: flex; }

/* ── Splitter draggable ── */
#left-splitter {
  flex: 0 0 6px;
  background: #c8c0b4;
  cursor: row-resize;
  position: relative;
  z-index: 20;
  transition: background 0.15s;
  border-right: 1px solid #c8c0b4;
}
#left-splitter:hover, #left-splitter.dragging {
  background: #2a6aaa;
}

/* Zone graphe I(x) */
#graph-area {
  flex: 2;
  background: #faf9f6;
  border-top: 1px solid #c8c0b4;
  border-right: 1px solid #c8c0b4;
  display: flex;
  flex-direction: column;
  min-height: clamp(80px, 14vh, 140px);
  overflow: hidden;
  position: relative;
}

/* Barre de contrôle du graphe */
#graph-time-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-shrink: 0;
  padding: 6px 10px 4px;
}
#graph-btns-left { display: flex; gap: 6px; align-items: center; }
#graph-btns-right { display: flex; gap: 6px; align-items: center; }

.graph-title {
  font-size: 15px; color: #2c3e50; font-weight: 700;
}

#graph-btns-right button, #graph-btns-left button {
  height: 30px; padding: 0 12px; font-weight: 700; line-height: 30px;
  background: #e8e4de; color: #5a6a78;
  border: 1px solid #b0a898; border-radius: 5px;
  cursor: pointer; box-sizing: border-box; white-space: nowrap;
}
#btn-graph-pin  { font-size: 13px; }
#btn-graph-lien { font-size: 13px; }

#graph-btns-right button:hover, #graph-btns-left button:hover { background: #d0ccc4; color: #2c3e50; }
#graph-btns-right button.active, #graph-btns-left button.active {
  background: #2a6aaa; color: #fff; border-color: #1a5a9a;
}
#graph-btns-right button.active:hover { background: #1a5a9a; }
#graph-btns-right button:disabled {
  opacity: 0.4; cursor: not-allowed; background: #e8e4de; color: #5a6a78;
}

/* Zone du canvas de graphe */
.graph-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
  padding: 0 10px 8px;
  position: relative; /* référentiel de .graph-legend-blanche */
}

/* Légende à cases à cocher du graphe en mode Lumière blanche (cf. graph.js) */
.graph-legend-blanche {
  display: none;
  position: absolute;
  top: 16px; right: 40px;
  background: rgba(255,255,255,0.95);
  border: 1px solid #c8c0b4;
  border-radius: 5px;
  padding: 5px 8px;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  max-height: calc(100% - 12px);
  overflow-y: auto;
  z-index: 5;
}
.graph-legend-blanche.visible { display: flex; }
.graph-legend-blanche label { display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.graph-legend-blanche input[type=checkbox] { margin: 0; cursor: pointer; }
.legend-swatch {
  display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.25);
}
.graph-wrap canvas {
  background: #ffffff;
  border: 1px solid #c8c0b4;
  border-radius: 3px;
  display: block;
  flex: 1;
  min-height: 0;
  cursor: pointer;
}

/* ── Panneau droit : styles communs ── */
#panel {
  background: #e8e4de;
  border-left: 1.5px solid #c8c0b4;
  display: flex;
  flex-direction: column;
  grid-row: 1;
  grid-column: 2;
  min-height: 0;
  overflow: hidden;
  font-size: clamp(11px, 1.1vw, 14px);
}
/* ── Onglets principaux ──────────────────────────── */
.panel-main-tabs {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1.5px solid #b0a898;
}
.panel-main-tab {
  flex: 1;
  padding: 9px 4px;
  font-size: clamp(12px, 1.2vw, 15px);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: #d4d0c8;
  color: #8a9aaa;
  border-right: 1px solid #b0a898;
  transition: background 0.12s, color 0.12s;
}
.panel-main-tab:last-child { border-right: none; }
.panel-main-tab:hover { background: #ccc8c0; color: #2c3e50; }
.panel-main-tab.active {
  background: #e8e4de;
  color: #2a6aaa;
  border-bottom: 1.5px solid #e8e4de;
  margin-bottom: -1.5px;
}

#panel-body {
  flex: 1;
  min-height: 0;
  padding: clamp(8px, 1.2vw, 16px) clamp(6px, 1vw, 14px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.panel-main-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: #7a8a96; margin-bottom: 4px;
}

/* Paramètres (label + slider) */
.param-row { display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
.param-row label { display: flex; justify-content: space-between; font-size: clamp(12px, 1.15vw, 15px); color: #2c3e50; }
.param-row label span { color: #2a5080; font-weight: 600; }
input[type=range] { width: 100%; accent-color: #4a7aaa; cursor: pointer; }
input[type=range]:disabled { accent-color: #b0aca4; cursor: not-allowed; }
/* Sélecteur de forme (repris de .diss-select de dissolution/) */
#sl-mask-shape {
  width: 100%; padding: 7px 8px; border: 1px solid #c8c0b4; border-radius: 5px;
  background: #fff; color: #2c3e50; font-family: inherit;
  font-size: clamp(12px, 1.25vw, 15px); cursor: pointer;
}
#sl-mask-shape:focus { outline: none; border-color: #2a6aaa; }

/* Sélecteur Source lumineuse — bascule à 2 options de même poids visuel (mono/blanche),
   PAS un on/off (repris de .diss-unit-toggle de dissolution/) : contrairement à
   .btn-toggle-one (état actif/inactif d'une fonctionnalité), les deux boutons sont
   toujours présents et seule l'option choisie est mise en évidence. */
.light-source-toggle {
  display: flex;
  border: 1px solid #c8c0b4;
  border-radius: 6px;
  overflow: hidden;
}
.light-source-btn {
  flex: 1;
  padding: 8px 4px;
  font-size: clamp(12px, 1.1vw, 14px);
  font-weight: 700;
  font-family: inherit;
  border: none;
  background: #ece8e0;
  color: #5a6a78;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.light-source-btn:not(:last-child) { border-right: 1px solid #c8c0b4; }
.light-source-btn:hover { background: #ddd8ce; }
.light-source-btn.active { background: #2a6aaa; color: #fff; }

/* Sélecteur segmenté générique (deux choix exclusifs de même poids, ex. le mode
   1D/2D de l'onglet Principe) — repris de ondes/css/style.css, où il porte le
   bouton "Aspect de la corde : Continu/Discret". Rendu identique à
   .light-source-toggle ci-dessus, dont le nom est lié à son usage (source
   lumineuse) : les deux coexistent plutôt que d'être fusionnés. */
.seg-toggle {
  display: flex;
  border: 1px solid #c8c0b4;
  border-radius: 6px;
  overflow: hidden;
}
.seg-btn {
  flex: 1;
  padding: 8px 4px;
  font-size: clamp(12px, 1.1vw, 14px);
  font-weight: 700;
  font-family: inherit;
  border: none;
  background: #ece8e0;
  color: #5a6a78;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.seg-btn:not(:last-child) { border-right: 1px solid #c8c0b4; }
.seg-btn:hover  { background: #ddd8ce; }
.seg-btn.active { background: #2a6aaa; color: #fff; }

.param-row.disabled label { color: #a8a49c; }
.param-row.disabled label span { color: #a8a49c; }
.input-hint { font-size: clamp(10px, 0.9vw, 13px); color: #7a8a96; }

/* Cases à cocher Source 1/2 (onglet Ondes de surface) — couleurs reprises des flèches de
   distance S1M/S2M (SURF_COL_DIST_S1/S2 de surfaces.js) pour associer visuellement chaque
   case à sa source. */
.surf-src-toggles { display: flex; gap: 8px; margin-bottom: 10px; }
.surf-src-toggle {
  display: flex; align-items: center; gap: 6px; flex: 1;
  font-size: clamp(11px, 1.05vw, 13px); font-weight: 600; color: #5a6a78;
  cursor: pointer; padding: 6px 8px;
  border: 1px solid #c8c0b4; border-left: 3px solid; border-radius: 5px;
  background: #ece8e0;
}
.surf-src-toggle:hover { background: #ddd8ce; }
.surf-src-toggle input[type="checkbox"] { margin: 0; cursor: pointer; flex-shrink: 0; }

/* Pastille de couleur du laser à côté du réglage λ */
#lambda-swatch {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.25);
  vertical-align: -1px;
  margin-right: 5px;
}

/* Boutons génériques */
.btn {
  width: 100%; padding: 9px 6px; border: 1px solid transparent; border-radius: 6px;
  font-size: clamp(12px, 1.2vw, 15px); font-weight: 700; cursor: pointer;
  font-family: inherit; transition: transform 0.1s, background 0.15s; letter-spacing: 0.3px;
}
.btn:active { transform: scale(0.97); }

.btn-toggle-one {
  background: #ece8e0; color: #5a6a78; border: 1px solid #c8c0b4;
}
.btn-toggle-one.active {
  background: #fde8c8; color: #7a3a10; border-color: #d0a060;
}
.btn-toggle-one:hover { background: #ddd8ce; }
.btn-toggle-one.active:hover { background: #f8dcb0; }

.btn-reset {
  background: #dedad2; color: #5a6a78; border: 1px solid #b0a898;
}
.btn-reset:hover { background: #d0ccc4; color: #2c3e50; }

.btn-pause { background: #c08020; color: #fff; }
.btn-pause:hover { background: #a06010; }
.btn-play { background: #2a8a50; color: #fff; }
.btn-play:hover { background: #1a6a38; }

.btn-raz { background: #dedad2; color: #5a6a78; border: 1px solid #b0a898; }
.btn-raz:hover { background: #ccc8c0; color: #2c3e50; }

/* Ligne de boutons côte à côte (ex. Lancer/Pause + RAZ) : chacun garde le style
   .btn habituel, seule la largeur devient partagée au lieu de 100%. RAZ reste
   étroit (texte court et fixe) pour laisser toute la place à Lancer/Pause, dont
   le texte change et ne doit pas passer à la ligne. */
.btn-row { display: flex; gap: 6px; }
.btn-row > .btn { width: auto; flex: 1 1 0; white-space: nowrap; }
.btn-row > .btn-raz { flex: 0 0 auto; }
/* Trois boutons sur une même ligne dans un panneau qui descend à 200 px de
   large (cf. grid-template-columns de main) : padding et police resserrés,
   sinon les libellés y₁(M) / y₂(M) / y₁(M)+y₂(M) débordent. */
/* flex 1 1 auto (et non une base 0 partagée) : « y₁(M)+y₂(M) » est deux fois
   plus long que « y₁(M) », des largeurs égales le tronqueraient. */
.btn-row-tight > .btn { flex: 1 1 auto; padding: 8px 4px; font-size: clamp(11px, 1.05vw, 14px); letter-spacing: 0; }

/* Encarts de valeurs instantanées */
.readouts { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout { background: #fff; border: 1px solid #c8c0b4; border-radius: 6px; padding: 7px 9px; }
.readout.full-width { grid-column: 1 / -1; }
.readout .ro-label { font-size: clamp(13.2px, 1.2vw, 15.6px); color: #7a8a96; margin-bottom: 2px; }
.readout .ro-value { font-size: clamp(16.8px, 1.8vw, 21.6px); font-weight: 700; color: #2a5080; font-variant-numeric: tabular-nums; }
.readout .ro-value.ro-value-split { display: flex; justify-content: space-between; align-items: baseline; }
.readout .ro-value.ro-value-detail {
  font-size: clamp(14px, 1.7vw, 22.8px);
  font-variant-numeric: tabular-nums;
  display: grid;
  grid-template-columns: max-content max-content;
  justify-content: start;
  column-gap: 6px;
  row-gap: 2px;
}
.readout .ro-value-detail .rvd-lhs { text-align: left; }
.readout .ro-value-detail .rvd-eq  { white-space: nowrap; }
.readout .ro-unit  { font-size: 14.4px; color: #7a8a96; }
/* Ligne de conclusion sous une valeur (nature de l'interférence, onglet
   Principe) : sa couleur est posée en JS selon le cas — ocre si constructive,
   violet si destructive, gris sinon (cf. principe.js → _prinUpdateValeurs). */
.ro-conclusion {
  margin-top: 4px;
  font-size: clamp(11.5px, 1.05vw, 14px);
  font-weight: 700;
  line-height: 1.3;
}

/* Point de couleur identifiant une longueur d'onde dans les cadres de valeurs (lumière blanche) */
.swatch-blanche { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.15); margin-right: 4px; vertical-align: middle; flex: none; }

/* Cadre θ / largeur en lumière blanche : une ligne par couleur de référence à l'intérieur
   d'un seul cadre (au lieu d'un cadre par couleur), même famille visuelle que .readout. */
.ro-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 3px 0; }
.ro-row:not(:last-child) { border-bottom: 1px solid #ece8e0; }
.ro-row .ro-row-nom { font-size: clamp(11px, 1vw, 13px); color: #45505a; display: flex; align-items: center; }
.ro-row .ro-row-nom.ro-row-nom-theta { font-size: clamp(10px, 0.85vw, 12px); }
.ro-row .ro-row-value { font-size: clamp(13px, 1.4vw, 17px); font-weight: 700; color: #2a5080; font-variant-numeric: tabular-nums; display: flex; gap: 10px; }

/* ════════════════════════════════════════════════════
   BANDEAU INSTRUCTIONS
════════════════════════════════════════════════════ */
.panel-hint {
  flex-shrink: 0;
  color: #5a6a78;
  line-height: 1.5;
  background: #fff;
  border: 1.5px solid #b0a898;
  /* Pas de bordure gauche propre : #panel a déjà la sienne (border-left,
     cf. ci-dessus) — sinon les deux bordures se superposent avec un léger
     décalage sous-pixel, visible uniquement ici. */
  border-left: none;
  overflow: hidden;
  transition: padding 0.2s;
}
.panel-hint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
}
.panel-hint-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #7a8a96;
  margin-left: auto;
  margin-right: 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.panel-hint-menu-btn {
  background: #f0f4f7;
  border: 1px solid #c8d4dc;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: #4a5a68;
  padding: 4px 9px;
  line-height: 1.2;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.panel-hint-menu-btn:hover { background: #dde6ec; color: #2a6aaa; }
.panel-hint-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: #7a8a96;
  padding: 0 2px;
  line-height: 1;
  transition: transform 0.2s;
}
.panel-hint-toggle:hover { color: #2a6aaa; }
.panel-hint-body {
  font-size: clamp(11px, 1.1vw, 14px);
  padding: 0 10px 8px;
  overflow-y: auto;
  overflow-x: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease;
  max-height: 250px;
}
.panel-hint.collapsed .panel-hint-body {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}
.panel-hint:not(.collapsed) .panel-hint-toggle { transform: rotate(180deg); }


/* Labels alignés sur les 4 crans d'un slider pas=1 (0-3) */
.speed-ticks {
  display: grid;
  grid-template-columns: repeat(3, 1fr) 0fr;
  font-size: clamp(9px, 0.85vw, 11px);
  color: #7a8a96;
  padding: 0 7px;
  line-height: 1;
  margin-top: 1px;
}
.speed-ticks span:not(:last-child) {
  text-align: left;
}
.speed-ticks span:last-child {
  text-align: right;
  white-space: nowrap;
}
