/* =====================================================================
   Design V4 — « cabinet d'étude » : papier chaud, encre sobre, un seul accent pétrole, scène graphite.
   Design read : application pédagogique médicale de bureau, sérieuse et chaleureuse, objet 3D au centre, lisibilité du texte d'abord.
   Dials : DESIGN_VARIANCE 4 (grille stable), MOTION_INTENSITY 3 (fondus et décalages fonctionnels, coupés par prefers-reduced-motion), VISUAL_DENSITY 5.
   Chargé après app.css : il redéfinit les jetons et affine les composants ; aucun identifiant, aucune structure ni aucun flux ne change.
   ===================================================================== */
:root {
  --paper: #f6f3ec; --paper-2: #eeeadf; --paper-3: #e4dfd0; --card: #fffdf8;
  --ink: #1b2125; --ink-2: #38434a; --muted: #66717a;
  --line: #ddd6c6; --line-2: #c9c1ad;
  --accent: #17606a; --accent-2: #0f464e; --accent-soft: #e0eded; --accent-line: #b5d0d3; --accent-light: #7fc6cf;
  --warn: #77500a; --warn-soft: #f7ecd1; --ok: #2b7a4c; --ok-soft: #e3f0e7;
  --stage-a: #43484d; --stage-b: #181a1d;
  --r-s: 8px; --r-m: 12px; --r-l: 16px;
  --sh-1: 0 1px 2px rgba(58, 44, 18, .06), 0 6px 18px rgba(58, 44, 18, .07);
  --sh-pop: 0 16px 42px rgba(12, 10, 6, .34), 0 2px 6px rgba(12, 10, 6, .2);
  --glass: rgba(26, 29, 33, .68); --glass-line: rgba(255, 255, 255, .15); --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .08);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --read: "Iowan Old Style", "Charter", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --ui: -apple-system, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}
body { grid-template-rows: 56px 1fr; font-size: 15px; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body.capture { grid-template-rows: 0 1fr; }
:focus-visible { outline: 2px solid #e8a91a; outline-offset: 2px; border-radius: 6px; }
svg.ico { flex: none; display: block; }
button[hidden], label[hidden], .tool-switch[hidden], .real-row[hidden] { display: none !important; }
button:active:not(:disabled) { transform: translateY(1px); }
button { transition: background-color .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease), box-shadow .16s var(--ease), transform .08s; }

/* ---------- barre ---------- */
#bar { gap: 20px; padding: 0 20px; background: rgba(246, 243, 236, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset; z-index: 3; }
.brand { align-items: center; gap: 10px; min-width: 0; }
.brand-mark { color: var(--accent-2); flex: none; }
.brand-main { font-family: var(--read); font-size: 18.5px; font-weight: 600; letter-spacing: -.012em; }
.brand-sub { font-size: 11px; font-weight: 650; letter-spacing: .1em; color: var(--accent-2); background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 999px; padding: 2px 9px; }
#where { font-size: 13.5px; color: var(--muted); padding-left: 18px; border-left: 1px solid var(--line); }
#where b { color: var(--ink); font-weight: 600; }
.bar-actions { gap: 6px; }
button.ghost { border: 1px solid var(--line); background: rgba(255, 255, 255, .5); border-radius: 10px; padding: 7px 14px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
button.ghost:hover:not(:disabled) { background: #fff; border-color: var(--line-2); color: var(--ink); }
button.ghost.on, button.ghost.speaking { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 1px 2px rgba(15, 70, 78, .35); }
button.ghost.on:hover { background: var(--accent-2); }

/* ---------- scène ---------- */
#stage { background: radial-gradient(95% 85% at 50% 36%, var(--stage-a) 0%, #2b2f33 44%, var(--stage-b) 100%); }
#stage::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, 0) 24%), radial-gradient(60% 40% at 50% 100%, rgba(0, 0, 0, .28), transparent 70%); }
#loading { background: rgba(24, 26, 29, .92); color: #dfe4e8; font-family: var(--read); font-size: 16px; letter-spacing: .01em; }
#stage-ui { color: #e6eaee; }

#views { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 12px; background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--glass-hi); backdrop-filter: blur(10px); }
#views button { background: transparent; border: 0; border-radius: 9px; padding: 5px 10px; font-size: 12.5px; font-weight: 500; color: #dfe5ea; }
#views button:hover { background: rgba(255, 255, 255, .13); }
#views button[aria-pressed="true"] { background: #f2eee5; color: #1b2125; font-weight: 650; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
#stage.plate-open #views { display: inline-grid; grid-template-columns: repeat(4, auto); }
#tools { gap: 6px; margin-top: 6px; }
.tool-switch, button.mini { display: inline-flex; align-items: center; gap: 7px; background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--glass-hi); backdrop-filter: blur(10px); color: #e6eaee; border-radius: 10px; padding: 5px 10px; font-size: 12.5px; font-weight: 500; }
button.mini:hover, .tool-switch:hover { background: rgba(70, 76, 82, .78); }
.tool-switch input { appearance: none; -webkit-appearance: none; margin: 0; width: 26px; height: 15px; border-radius: 999px; background: rgba(255, 255, 255, .24); position: relative; cursor: pointer; transition: background-color .18s var(--ease); flex: none; }
.tool-switch input::after { content: ""; position: absolute; left: 2px; top: 2px; width: 11px; height: 11px; border-radius: 50%; background: #f2eee5; transition: transform .18s var(--ease); box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.tool-switch input:checked { background: var(--accent-light); }
.tool-switch input:checked::after { transform: translateX(11px); background: #fff; }
#btn-pan[aria-pressed="true"] { background: #f2eee5; color: #1b2125; border-color: #f2eee5; font-weight: 650; }
#orient-caption { margin-top: 9px; font-size: 12.5px; color: #cdd5db; letter-spacing: .005em; text-shadow: 0 1px 2px rgba(0, 0, 0, .45); }
#orient-caption b { color: #fff; font-weight: 650; }

#compass .ax { background: rgba(255, 255, 255, .11); color: #e3e8ec; border-radius: 6px; font-size: 10.5px; padding: 2px 6px; backdrop-filter: blur(4px); }
#compass .ax.main { background: #f2eee5; color: #1b2125; }
#zoom { gap: 0; background: var(--glass); border: 0; border-radius: 12px; box-shadow: var(--glass-hi), inset 0 0 0 1px var(--glass-line); backdrop-filter: blur(10px); overflow: hidden; }
#zoom button { width: 34px; height: 34px; display: grid; place-items: center; background: transparent; border: 0; border-radius: 0; color: #e6eaee; }
#zoom button + button { border-top: 1px solid var(--glass-line); }
#zoom button:hover { background: rgba(255, 255, 255, .14); }

#namecard { background: var(--paper); border-radius: 13px; border-left: 0; box-shadow: var(--sh-pop); padding: 10px 18px 11px 20px; overflow: hidden; }
#namecard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--c, var(--accent)); }
#namecard .nm { font-size: 20px; letter-spacing: -.008em; }
#toast { background: rgba(250, 247, 240, .97); border-radius: 12px; font-size: 13.5px; box-shadow: var(--sh-pop); }

/* ---------- consigne sur la scène ---------- */
#coach { background: rgba(252, 250, 245, .985); border: 1px solid rgba(255, 255, 255, .6); border-left: 1px solid rgba(255, 255, 255, .6); border-radius: 16px; box-shadow: var(--sh-pop); padding: 11px 16px 12px 22px; }
#coach::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
#coach .coach-top { font-size: 11px; font-weight: 650; letter-spacing: .12em; color: var(--muted); align-items: center; }
#coach #coach-title { font-family: var(--ui); font-size: 13px; font-weight: 650; letter-spacing: 0; color: var(--accent-2); }
#coach .coach-fold { display: grid; place-items: center; width: 26px; height: 24px; border-radius: 8px; background: var(--paper-2); border: 1px solid var(--line); color: var(--ink-2); }
#coach .coach-fold:hover { background: var(--paper-3); }
#coach-text { font-size: 15.5px; line-height: 1.45; color: #222a30; text-wrap: pretty; }
#coach-feedback { border-radius: 10px; }
#coach-controls { gap: 6px 8px; }
#coach-controls .cbtn, #coach-action .cbtn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 5px 12px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
#coach-controls .cbtn:hover:not(:disabled), #coach-action .cbtn:hover:not(:disabled) { background: var(--paper-2); border-color: var(--line-2); color: var(--ink); }
#coach-controls .cbtn.primary, #coach-action .cbtn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(15, 70, 78, .3); }
#coach-controls .cbtn.primary:hover, #coach-action .cbtn.primary:hover { background: var(--accent-2); color: #fff; }
#coach-controls .cbtn.icon-only { padding: 5px 8px; }
#coach-controls .cbtn.warn { background: var(--warn-soft); border-color: #e7d29b; color: var(--warn); }
#coach-controls .pager button { display: grid; place-items: center; border-radius: 8px; background: #fff; }
#coach-controls .dots i { width: 6px; height: 6px; }
@media (prefers-reduced-motion: no-preference) {
  #coach:not([hidden]) { animation: rise .26s var(--ease); }
  #namecard:not([hidden]), #toast:not([hidden]), #ctxmenu:not([hidden]) { animation: rise .2s var(--ease); }
  #plate:not([hidden]) { animation: fadein .24s var(--ease); }
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
/* nom et message sont centrés par transform : fondu seul, sans décalage */
#namecard:not([hidden]), #toast:not([hidden]) { animation-name: fadein; }

/* ---------- panneau d'explication ---------- */
#panel { background: var(--paper); border-left: 1px solid var(--line); box-shadow: -1px 0 0 rgba(255, 255, 255, .6) inset; }
#panel-body { padding: 24px 30px 20px; }
#panel-body::-webkit-scrollbar { width: 10px; }
#panel-body::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 3px solid var(--paper); }
#nav { padding: 12px 22px; background: rgba(250, 248, 242, .96); border-top: 1px solid var(--line); gap: 10px; }
#nav .sp { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
button.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 11px; padding: 9px 16px; font-size: 14px; font-weight: 500; color: var(--ink-2); box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset; }
button.btn:hover:not(:disabled) { background: var(--paper-2); border-color: var(--line-2); color: var(--ink); }
button.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(15, 70, 78, .32); }
button.btn.primary:hover:not(:disabled) { background: var(--accent-2); color: #fff; }
button.btn.quiet { color: var(--accent-2); border-color: transparent; background: transparent; box-shadow: none; }
button.btn.quiet:hover:not(:disabled) { background: var(--accent-soft); }

.eyebrow { font-size: 11px; font-weight: 650; letter-spacing: .13em; color: var(--accent-2); margin: 0 0 8px; }
.steps { gap: 4px; margin: 0 0 18px; }
.steps button { height: 4px; border-radius: 2px; }
.steps button:hover { background: var(--line-2); }
.steps button.cur:hover, .steps button.done:hover { filter: brightness(.95); }
h1.step-title { font-size: 27px; line-height: 1.17; letter-spacing: -.014em; margin: 0 0 16px; text-wrap: balance; }
.read p { font-size: 17px; line-height: 1.66; color: #242c32; margin: 0 0 13px; text-wrap: pretty; }
.lead { font-size: 18.5px; line-height: 1.58; text-wrap: pretty; }
.block { border-radius: var(--r-m); padding: 13px 16px 14px; background: var(--paper-2); border: 1px solid var(--line); margin-top: 18px; }
.block h3 { font-size: 11px; font-weight: 650; letter-spacing: .12em; margin: 0 0 5px; }
.block p { font-size: 16.3px; line-height: 1.55; }
.block.look { background: var(--accent-soft); border-color: var(--accent-line); box-shadow: inset 3px 0 0 var(--accent); }
.prereq { border-left: 0; box-shadow: inset 3px 0 0 var(--accent); border-radius: var(--r-m); }
.notice { border-radius: 10px; font-size: 13px; line-height: 1.45; }
.refs h3, .libre-group h3, .tp3 h3 { font-size: 11px; letter-spacing: .12em; font-weight: 650; }
.pill { border-radius: 12px; padding: 9px 12px; background: var(--card); transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background-color .16s var(--ease); }
.pill:hover { border-color: var(--line-2); box-shadow: var(--sh-1); }
.pill .dot { width: 13px; height: 13px; box-shadow: 0 0 0 2px var(--card), 0 0 0 3px var(--c); }
.pill.sel { box-shadow: inset 4px 0 0 var(--c), var(--sh-1); }
.pill .nm { font-size: 15px; font-weight: 500; }
.pill .fidtag { border-radius: 999px; font-weight: 500; }
.card { background: var(--card); border-radius: 14px; box-shadow: var(--sh-1); padding: 17px 19px; }
.card h2 { letter-spacing: -.01em; }
.q-prompt { font-size: 19px; line-height: 1.42; text-wrap: balance; }
.found .chip { border-radius: 999px; background: transparent; font-size: 13px; }
.found .chip.ok { background: var(--ok-soft); }
.feedback { border-radius: 11px; }
.correction { border-radius: 0 12px 12px 0; }
.opt { border-radius: 12px; border-width: 1.5px; transition: border-color .16s var(--ease), background-color .16s var(--ease), box-shadow .16s var(--ease); }
.opt:hover:not(:disabled) { border-color: var(--line-2); }
.opt[aria-pressed="true"] { box-shadow: 0 0 0 3px rgba(23, 96, 106, .12); }
.ord-row { border-radius: 12px; }
.ord-row button { display: grid; place-items: center; border-radius: 8px; }
.speak { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 11px 3px 9px; }
details.deeper, details.link, .compl { border-radius: var(--r-m); }
.obj-global { border-radius: var(--r-m); background: var(--card); }
.banner-revisit { border-radius: 10px; }
.sources { font-size: 12.5px; }

/* mode libre */
.libre-search { border-radius: 11px; padding: 10px 14px; background: var(--card); }
.libre-search:focus { border-color: var(--accent); outline: 2px solid rgba(23, 96, 106, .22); }
.libre-list button { border-radius: 999px; background: var(--card); }
.libre-list button:hover { border-color: var(--line-2); }
.layer { border-radius: 12px; background: var(--card); }
.seg { border-radius: 9px; }
.seg button { background: var(--card); }
.libre-state { border-radius: 11px; }
#stage-ui .libre-banner { background: var(--glass); border: 1px solid var(--glass-line); border-radius: 12px; box-shadow: var(--glass-hi); backdrop-filter: blur(10px); }
#ctxmenu { background: var(--paper); border-radius: 14px; box-shadow: var(--sh-pop); }
#ctxmenu .cm-head { font-size: 16px; }
#ctxmenu button[role="menuitem"] { border-radius: 9px; }
.libre-controls input[type=range], #slice-ui input[type=range] { appearance: none; -webkit-appearance: none; height: 20px; background: transparent; cursor: pointer; }
.libre-controls input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 3px; background: var(--line-2); }
.libre-controls input[type=range]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }

/* ---------- plan du cours ---------- */
dialog { border-radius: 18px; box-shadow: 0 24px 70px rgba(10, 8, 4, .42); background: var(--paper); }
dialog::backdrop { background: rgba(14, 16, 18, .6); backdrop-filter: blur(3px); }
#plan-body { padding: 26px 30px 24px; }
#plan-body h2 { font-size: 24px; letter-spacing: -.012em; }
.plan-ch { border-radius: 12px; background: var(--card); padding: 10px 14px; gap: 14px; transition: border-color .16s var(--ease), background-color .16s var(--ease), box-shadow .16s var(--ease); }
.plan-ch:hover { border-color: var(--line-2); background: #fff; box-shadow: var(--sh-1); }
.plan-ch .n { width: 28px; height: 28px; font-family: var(--read); font-size: 14px; font-variant-numeric: tabular-nums; background: var(--paper-2); }
.plan-ch.done .n { background: var(--ok); }
.plan-ch.cur { box-shadow: inset 4px 0 0 var(--accent); }
.plan-ch .s { font-variant-numeric: tabular-nums; }
.tp3-card { border-radius: 12px; background: var(--card); }

/* ---------- coupe IRM ---------- */
#slice-ui { background: rgba(24, 27, 31, .84); border: 1px solid var(--glass-line); border-radius: 14px; box-shadow: var(--glass-hi), 0 10px 28px rgba(0, 0, 0, .35); backdrop-filter: blur(12px); padding: 6px 10px 7px; }
#slice-label { font-size: 12.5px; color: #cfd6dc; }
#slice-label b { color: #fff; font-variant-numeric: tabular-nums; }
#slice-ui .sd-btn { display: grid; place-items: center; width: 24px; height: 22px; border-radius: 8px; background: rgba(255, 255, 255, .09); border: 1px solid var(--glass-line); color: #eef1f4; }
#slice-ui .sd-btn:hover { background: rgba(255, 255, 255, .2); }
#slice-ui #slice-planes { background: rgba(255, 255, 255, .07); border-radius: 10px; padding: 2px; gap: 2px; }
#slice-ui #slice-planes button { background: transparent; border: 0; border-radius: 8px; padding: 3px 0; font-size: 12px; color: #d6dde3; }
#slice-ui #slice-planes button:hover { background: rgba(255, 255, 255, .12); }
#slice-ui #slice-planes button[aria-pressed="true"] { background: #f2eee5; color: #1b2125; font-weight: 650; }
#slice-ui .slice-row button { display: grid; place-items: center; width: 26px; height: 22px; border-radius: 8px; background: rgba(255, 255, 255, .09); border: 1px solid var(--glass-line); }
#slice-ui .slice-row button:hover { background: rgba(255, 255, 255, .2); }
#slice-ui input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 3px; background: rgba(255, 255, 255, .26); }
#slice-ui input[type=range]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #f2eee5; border: 2px solid var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .45); }
.real-row input { appearance: none; -webkit-appearance: none; margin: 0; width: 26px; height: 15px; border-radius: 999px; background: rgba(255, 255, 255, .24); position: relative; cursor: pointer; transition: background-color .18s var(--ease); flex: none; }
.real-row input::after { content: ""; position: absolute; left: 2px; top: 2px; width: 11px; height: 11px; border-radius: 50%; background: #f2eee5; transition: transform .18s var(--ease); }
.real-row input:checked { background: var(--accent-light); }
.real-row input:checked::after { transform: translateX(11px); background: #fff; }
#slice-ui #slice-hint, #slice-ui #slice-help, #slice-ui #slice-more summary { color: #b3bec9; }
#slice-mark { border-color: #ffd27a; }
/* image agrandie : la figure du cahier est masquée (jamais fermée) ; la zone utile s'élargit et l'image prend la place */
#stage.slice-focus #plate { display: none; }
#stage.slice-focus.plate-open #coach { right: var(--gap); }
#stage.slice-focus.plate-open #slice-ui { right: 14px; }
#stage.slice-focus.plate-open #topleft { max-width: calc(100% - 320px); }
#stage.slice-focus #slice-focus { background: #f2eee5; color: #1b2125; }

/* ---------- planche de figure ---------- */
#plate { background: var(--paper); border: 1px solid rgba(255, 255, 255, .5); border-radius: 16px; box-shadow: var(--sh-pop); }
#plate .plate-head { padding: 7px 9px; gap: 6px; }
#plate .plate-title { font-size: 13.5px; letter-spacing: -.005em; }
#plate .plate-tool, #zoom-body .plate-tool { display: inline-flex; align-items: center; gap: 6px; border-radius: 9px; font-weight: 500; }
#plate .plate-tool.icon-only, #zoom-body .plate-tool.icon-only { padding: 4px 7px; }
#plate .plate-close { display: grid; place-items: center; border-radius: 9px; width: 28px; height: 26px; }
#plate .plate-tabs button { border-radius: 8px; }
#plate .plate-view { background: #202428; }
#plate .plate-fig img { border-radius: 2px; }
#plate .plate-cap { border-top: 1px solid var(--line); background: var(--paper); }
#plate .plate-leg { font-family: var(--read); font-size: 14.5px; line-height: 1.38; }
#plate .plate-q { border-radius: 10px; }
#dlg-zoom { border-radius: 18px; }
#zoom-body .zoom-stage { border-radius: 10px; background: #202428; }
.hs { border-radius: 5px; }

/* ---------- petites fenêtres desktop : on garde le même rythme ---------- */
@media (max-width: 1100px) { #where { padding-left: 12px; } .brand-sub { display: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- IRM HD Colin27 (V4) : image seule d'un autre sujet ; le 3D fsaverage, ses vues, sa boussole et ses épingles sont masqués */
#stage.hd-on #views, #stage.hd-on #compass, #stage.hd-on #pins, #stage.hd-on #vues-seq, #stage.hd-on #btn-pan, #stage.hd-on #tools .tool-switch:first-child { display: none !important; }
#hd-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
#hd-overlay[hidden] { display: none; }
#hd-overlay .hd-letter { position: absolute; transform: translate(-50%, -50%); min-width: 22px; padding: 2px 7px; border-radius: 999px; text-align: center; font-size: 12px; font-weight: 650; letter-spacing: .03em; color: #eef1f4; background: rgba(20, 23, 26, .62); border: 1px solid rgba(255, 255, 255, .18); backdrop-filter: blur(6px); text-shadow: 0 1px 1px rgba(0, 0, 0, .5); }
#hd-scale { position: absolute; height: 7px; border: 2px solid rgba(238, 241, 244, .92); border-top: 0; box-shadow: 0 1px 0 rgba(0, 0, 0, .5); filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .55)); }
#hd-scale::before { content: attr(data-mm); position: absolute; left: 50%; top: -18px; transform: translateX(-50%); font-size: 11.5px; color: #eef1f4; text-shadow: 0 1px 2px rgba(0, 0, 0, .75); white-space: nowrap; font-variant-numeric: tabular-nums; }
#hd-note { margin-top: 4px; font-size: 11px; line-height: 1.35; color: #f0c78a; }
#hd-note[hidden] { display: none; }
#stage.hd-on #webgl { cursor: grab; }
#stage.hd-on #webgl:active { cursor: grabbing; }
#stage.hd-on #namecard, #stage.hd-on #toast { left: 14px; transform: none; top: calc(var(--safe-top, 150px) + 28px); max-width: min(320px, calc(var(--safe-w, 100%) - 40px)); }
#stage.hd-on #orient-caption { display: inline-block; padding: 3px 10px; border-radius: 999px; background: rgba(20, 23, 26, .66); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(6px); color: #d9e0e6; text-shadow: none; }

/* accès « Coupe IRM » : toujours visible ; verrouillé (et expliqué par son infobulle) pendant une question à vue imposée */
.tool-switch.locked { opacity: .62; cursor: not-allowed; }
.tool-switch.locked input { cursor: not-allowed; }

/* =====================================================================
   TP3 : sélecteur de parcours (navigation), planche de test (locate-figure), rappel TP1–TP2, avertissements source
   ===================================================================== */
#parcours-switch { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-2); }
#parcours-switch[hidden] { display: none; }
#parcours-switch a { padding: 4px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-2); text-decoration: none; letter-spacing: .02em; }
#parcours-switch a:hover { background: rgba(0, 0, 0, .06); }
#parcours-switch a[aria-current="page"] { background: var(--accent); color: #fff; cursor: default; }
#parcours-switch a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#figquiz { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; background: #14181d; pointer-events: auto; }
#figquiz[hidden] { display: none; }
#figquiz .fq-tools { display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: #cfd6dd; font-size: 13px; }
#figquiz .fq-btn { min-width: 34px; height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .08); color: #fff; font-size: 15px; line-height: 1; }
#figquiz .fq-btn:hover { background: rgba(255, 255, 255, .2); }
#figquiz .fq-level { min-width: 84px; text-align: center; font-variant-numeric: tabular-nums; }
#figquiz .fq-view { position: relative; flex: 1; min-height: 0; overflow: hidden; cursor: crosshair; touch-action: none; user-select: none; outline: none; }
#figquiz .fq-view.panning { cursor: grabbing; }
#figquiz .fq-view:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
#figquiz .fq-pan { position: absolute; left: 50%; top: 50%; transform-origin: center center; will-change: transform; }
#figquiz .fq-img { display: block; pointer-events: none; image-rendering: auto; border-radius: 2px; background: #fff; }
#figquiz .fq-ov { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#figquiz .fq-fail { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); max-width: 420px; background: rgba(248, 245, 239, .97); color: #1d2a2e; border-radius: 12px; padding: 12px 18px; text-align: center; font-size: 15px; box-shadow: 0 8px 28px rgba(0, 0, 0, .35); }
#stage.figmode #compass, #stage.figmode #zoom, #stage.figmode #pins, #stage.figmode #vues-seq, #stage.figmode #slice-ui, #stage.figmode #hd-overlay, #stage.figmode #slice-mark, #stage.figmode #coach, #stage.figmode #slice-status { display: none !important; }
#stage.figmode #namecard, #stage.figmode #toast { z-index: 6; bottom: 16px; left: 16px; right: auto; top: auto; transform: none; max-width: min(380px, calc(100% - 330px)); }
/* planche imposée : seul l'accès « Coupe IRM » reste visible, à droite, verrouillé et expliqué ; vues 3D, boussole et outils de scène sont masqués */
#stage.figmode #topleft { z-index: 5; left: auto; right: 14px; top: 10px; max-width: none; }
#stage.figmode #views, #stage.figmode #orient-caption, #stage.figmode #tools > :not(#slice-switch) { display: none !important; }

#plate .plate-warn { margin: 4px 0; padding: 6px 10px; border-left: 4px solid var(--warn); background: var(--warn-soft); color: #5c3a05; border-radius: 6px; font-size: 13px; line-height: 1.4; }
#zoom-body .plate-warn { margin: 4px 0; font-weight: 600; color: #5c3a05; }
.block.tp12 { border-left: 4px solid #8793a3; }
.tp12-row p { margin: 0 0 4px; }

/* lames d'enseignement (UBC, Duke) : régions sources en surimpression sur la base vierge, légende nommée cliquable */
#plate .lame-ov { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.lame-legend { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 4px; }
.lame-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 12.5px; line-height: 1.3; }
.lame-chip i { width: 11px; height: 11px; border-radius: 50%; background: var(--c); flex: none; }
.lame-chip[aria-pressed="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 16%, #fff); font-weight: 600; }
.lame-chip:hover { background: var(--paper-2); }

#coach-feedback .demo-hint { display: block; margin-top: 3px; font-size: 12.5px; opacity: .8; }

/* barre du haut : le libellé de position (long en TP3) se tronque avec « … » au lieu d'élargir la page */
body { grid-template-columns: minmax(0, 1fr); }
#bar { min-width: 0; }
#where { min-width: 0; }
