/* =====================================================================
   Pareto : la lecture guide, la scène reste libre.
   - le guide (moments, consigne, « Montre-moi », figure) vit dans le panneau de lecture (#coach dans #coach-slot) ;
   - aucune figure ne s'ouvre seule ; le nom d'une sélection est posé à droite de la boussole et du zoom, jamais sur eux ;
   - la zone utile de la scène (app.js · syncSafeArea) se recentre au-dessus de l'étiquette.
   Chargé après design-v4.css. Aucun identifiant ni flux ne change.
   ===================================================================== */

/* ---------- guide dans le panneau ---------- */
#coach-slot { margin: 16px 0 0; }
#coach-slot:empty { display: none; }
#coach-slot #coach { position: static; inset: auto; max-width: none; max-height: none; margin: 0; z-index: auto; border: 1px solid var(--accent-line); border-radius: var(--r-m); background: var(--card); box-shadow: var(--sh-1); padding: 10px 14px 11px 18px; gap: 6px; animation: none; }
#coach-slot #coach::before { top: 10px; bottom: 10px; }
#coach-slot #coach .coach-top { font-size: 11px; }
#coach-slot #coach-text { font-size: 15.5px; line-height: 1.5; }
#coach-slot #coach-text:empty, #coach-slot #coach-title:empty { display: none; }
#coach-slot #coach-action .opts { grid-template-columns: minmax(0, 1fr); }
#coach-slot #coach-action .ord { grid-template-columns: minmax(0, 1fr); }
#coach-slot #coach-action { overflow: visible; }
#coach-controls .cbtn.primary:not(.revert) { order: 0; }

/* ---------- repères : libellé court, aide unique ---------- */
.refs { margin: 16px 0 0; }
.refs h3 { margin: 0 0 3px; }
.refs-help { margin: 0 0 8px; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.pills { gap: 5px; }
.pill { padding: 7px 11px; }
.pill .nm { font-size: 14.5px; }
.pill.hidden-name .nm { letter-spacing: .02em; }
.pill.sel { border-color: var(--c); }
.block { margin-top: 14px; padding: 10px 14px 11px; }
.block p { font-size: 15.5px; line-height: 1.52; }
.block.retain p + p { margin-top: 6px; }
.block.retain b { font-family: var(--ui); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.read p { font-size: 16.5px; line-height: 1.6; margin-bottom: 10px; }
h1.step-title { margin-bottom: 12px; }

/* ---------- étiquette de nom et message : bande basse à droite de la boussole et du zoom ---------- */
#stage:not(.has-slice):not(.hd-on):not(.figmode) #namecard,
#stage:not(.has-slice):not(.hd-on):not(.figmode) #toast,
#stage.plate-open:not(.has-slice):not(.hd-on):not(.figmode) #namecard,
#stage.plate-open:not(.has-slice):not(.hd-on):not(.figmode) #toast {
  left: 204px; right: auto; top: auto; bottom: var(--gap); transform: none; width: max-content;
  max-width: min(540px, calc(100% - 204px - var(--gap)));
}
#stage.plate-open:not(.has-slice):not(.hd-on):not(.figmode) #namecard,
#stage.plate-open:not(.has-slice):not(.hd-on):not(.figmode) #toast { max-width: min(540px, calc(100% - 204px - var(--plate-w) - 28px - 8px)); }
#namecard { padding: 8px 16px 9px 18px; }
#namecard .nm { font-size: 19px; line-height: 1.2; }
#namecard .sy { font-size: 13px; line-height: 1.35; }
#namecard .fid { margin-top: 4px; }

/* suite de vues (étapes à plusieurs vues) : même bande, sous l'étiquette */
#vues-seq, #stage.plate-open #vues-seq { left: 204px; right: auto; transform: none; bottom: var(--gap); flex-wrap: wrap; max-width: calc(100% - 204px - var(--gap)); }
#stage.plate-open #vues-seq { max-width: calc(100% - 204px - var(--plate-w) - 36px); }
#stage:has(#vues-seq:not([hidden])):not(.has-slice):not(.hd-on) #namecard,
#stage:has(#vues-seq:not([hidden])):not(.has-slice):not(.hd-on) #toast { bottom: 64px; }

/* figure ouverte sur demande : au-dessus des commandes de coupe, sans recouvrir la bande d'étiquette */
#stage.plate-open #slice-ui { right: calc(var(--plate-w) + 28px); }

/* ---------- compléments et liens essentiels : volets fermés, courts, en fin de lecture ---------- */
.folds { margin: 14px 0 0; display: grid; gap: 6px; }
.folds details.fold, .folds details.link { margin: 0; padding: 7px 12px; border-radius: var(--r-m); background: var(--card); border: 1px solid var(--line); }
.folds details > summary { cursor: pointer; font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--ink); }
.folds details .tag { display: block; font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 650; margin-bottom: 1px; }
.folds details p { margin: 8px 0 0; font-family: var(--read); font-size: 15.5px; line-height: 1.55; }
.folds details.fold.must { border-color: var(--accent-line); box-shadow: inset 3px 0 0 var(--accent); }
.folds details.fold.must .tag { color: var(--accent-2); }
.folds .fold-sub { font-style: italic; color: var(--ink-2); }
.welcome-gestes { font-family: var(--read); font-size: 15.5px; line-height: 1.55; color: var(--ink-2); margin: 0 0 12px; }

/* ---------- IRM HD (Colin27), avec ou sans figure : nom et message hors des lettres d'orientation ----------
   app.css (« #stage.has-slice.plate-open #namecard », spécificité 2-2-0) l'emportait sur design-v4 (« #stage.hd-on #namecard », 2-1-0) dès qu'une figure était ouverte : la carte
   se centrait en haut de la zone utile, sur la lettre « Sup ». Une seule règle, plus spécifique, pour les deux cas : sous la rangée du haut, à droite de la lettre « D »/« G » de gauche (x ≈ 30),
   largeur bornée, jamais sur l'échelle (bas gauche), le dock de coupe (bas droit), le zoom ni la figure. La lettre du haut (« Sup ») est à y0 + 16 : la carte commence à y0 + 34. */
#stage.hd-on.has-slice #namecard, #stage.hd-on.has-slice #toast,
#stage.hd-on.has-slice.plate-open #namecard, #stage.hd-on.has-slice.plate-open #toast {
  left: 56px; right: auto; bottom: auto; transform: none; width: max-content;
  top: calc(var(--safe-top, 150px) + 34px);
  max-width: min(300px, calc(var(--safe-w, 100%) - 56px - 44px)); overflow-wrap: anywhere;
}

/* ---------- mode libre : bloc « Vue 3D » (opacité continue des deux cortex, découpe 3D) ----------
   Dans le panneau de lecture, jamais sur la scène. Les curseurs réutilisent le style .libre-controls (design-v4) ; deux lignes d'opacité, puis la découpe repliée tant qu'elle est éteinte. */
.libre-view3d { margin-top: 14px; padding: 10px 14px 12px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--card); gap: 7px; }
.libre-view3d .v3-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.libre-view3d h3 { margin: 0; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.libre-view3d .v3-help { margin: 0; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.libre-view3d .v3-row { display: grid; grid-template-columns: 104px minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 14px; }
.libre-view3d .v3-name { color: var(--ink-2); }
.libre-view3d .v3-val { min-width: 46px; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink); text-align: right; white-space: nowrap; }
.libre-view3d .v3-cuthead { display: flex; align-items: center; gap: 10px; margin-top: 4px; padding-top: 9px; border-top: 1px solid var(--line); }
.libre-view3d .v3-val.wide { min-width: 108px; }
.libre-view3d .v3-toggle { padding: 6px 12px; font-size: 13.5px; }
.libre-view3d .v3-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.libre-view3d .v3-toggle[aria-pressed="true"]:hover:not(:disabled) { background: var(--accent-2); color: #fff; }
.libre-view3d .v3-hint { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.libre-view3d .v3-seg { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.libre-view3d .seg button:disabled { color: #a3a9b3; cursor: not-allowed; }
.libre-view3d .v3-range { margin: 0; font-size: 12px; color: var(--muted); }
.libre-view3d .v3-warn { margin: 0; font-size: 12.5px; color: var(--warn); background: var(--warn-soft); border-radius: var(--r-s); padding: 5px 9px; }
.libre-view3d input[type=range]:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- finitions de retour : support d'un repère, ouvertures courtes (≤ 200 ms, jamais en boucle, coupées par prefers-reduced-motion) ----------
   Ni la scène 3D ni les commandes ne sont animées ; seuls la figure et son contenu apparaissent en fondu léger. */
.pill { transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background-color .16s var(--ease), transform .08s var(--ease); }
.pill:hover:not(.sel) { background: var(--paper-2); }
.pill:active { transform: scale(.992); box-shadow: inset 0 0 0 1px var(--c), var(--sh-1); }
.pill:focus-visible { border-color: var(--c); }
.pill .detail .support-line { color: var(--ink); font-weight: 550; }
#plate .plate-tool:active, #plate .plate-close:active, #plate .plate-tabs button:active, .lame-chip:active { transform: translateY(1px); }
#plate .plate-tabs button:hover:not([aria-pressed="true"]) { background: var(--paper-2); }
#plate .plate-focus { margin: 0 0 6px; padding: 5px 9px; border-left: 4px solid var(--accent); background: var(--accent-soft); color: var(--ink); border-radius: 6px; font-weight: 600; font-size: 13px; line-height: 1.4; }
#plate .hs.focus { border-style: solid; border-width: 3px; background: color-mix(in srgb, var(--c) 34%, transparent); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--c); }
@media (prefers-reduced-motion: no-preference) {
  #plate:not([hidden]) { animation: plate-in .18s var(--ease); }
  #plate.swap .plate-view, #plate.swap .plate-cap { animation: fadein .16s var(--ease); }
}
@keyframes plate-in { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
