/* Prisme — laboratoires de physique-chimie (ohm-lab, density-lab, motion-lab, weight-lab, heating-lab).
   Couleurs : uniquement les variables du thème (clair / sombre), sauf les écrans LCD des appareils.
   Préfixes : pck- (commun), ohm-, dens-, mot-, wt-, heat-. */

.pck {
  --lcd-bg: #111a16; --lcd-ink: #a6f2c0; --lcd-dim: #4f7a62;
  --water: color-mix(in srgb, var(--classe) 20%, transparent);
  --water-line: color-mix(in srgb, var(--classe) 70%, var(--ink));
  --glass: color-mix(in srgb, var(--paper-2) 55%, transparent);
  --metal: color-mix(in srgb, var(--ink-3) 55%, var(--card));
  display: grid; gap: 16px;
}
.pck svg text { font-family: var(--font-body); }
.pck-intro { margin: 0; color: var(--ink-2); max-width: 75ch; }
.pck-bench { margin: 0; min-width: 0; }
.pck-panel { background: color-mix(in srgb, var(--paper-2) 45%, var(--card)); border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 12px 14px; min-width: 0; }
/* pas de text-transform : « m = f(V) » ne doit pas devenir « M = F(V) » (symboles physiques) */
.pck-panel h4 { font-family: var(--font-body); font-size: .92rem; font-weight: 700; color: var(--ink-2); margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px dashed var(--rule-2); }
.pck-exploit { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
.pck .btn-row { margin-top: 8px; }
.pck-tip { margin: 0; }

/* Messages */
.pck-msg { min-height: 1.4em; margin: 6px 0 0; padding-left: 10px; border-left: 3px solid transparent; }
.pck-msg:empty { border-left-color: transparent; }
.pck-msg[data-kind="warn"] { border-left-color: var(--ko); color: var(--ink); }
.pck-msg[data-kind="ok"] { border-left-color: var(--ok); }

/* Curseur */
.pck-slider { display: grid; gap: 4px; }
.pck-slider label { font-weight: 700; font-size: .9rem; }
.pck-slider-row { display: flex; align-items: center; gap: 10px; }
.pck-slider-row input[type="range"] { flex: 1; min-height: 32px; }
.ohm-knob { font-family: var(--font-mono); font-weight: 700; min-width: 5.5ch; text-align: right; }

/* Sélecteurs (calibre, astre, vitesse…) */
.pck-choice { border: none; margin: 0; padding: 0; min-width: 0; }
.pck-choice legend { font-weight: 700; font-size: .9rem; padding: 0; margin-bottom: 6px; }
.pck-choice-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pck .pck-choice-opt { display: inline-flex; align-items: center; font-weight: 700; font-size: .9rem; cursor: pointer; }
.pck-choice-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pck-choice-opt span { display: inline-block; padding: 6px 12px; min-height: 36px; line-height: 22px; border: 1.5px solid var(--rule-2); border-radius: 999px; background: var(--card); color: var(--ink-2); transition: background .15s, border-color .15s; }
.pck-choice-opt:hover span { border-color: var(--ink); }
.pck-choice-opt input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.pck-choice-opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Afficheurs LCD */
.pck-lcd { display: grid; gap: 3px; background: var(--card); border: 1px solid var(--rule-2); border-radius: 10px; padding: 7px 9px 9px; box-shadow: var(--shadow-1); min-width: 0; }
.pck-lcd-name { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.pck-lcd-screen { display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; background: var(--lcd-bg); color: var(--lcd-ink); border-radius: 5px; padding: 6px 10px; font-family: var(--font-mono); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .55); }
.pck-lcd-val { font-size: 1.55rem; line-height: 1.1; letter-spacing: .06em; font-variant-numeric: tabular-nums; min-width: 5ch; text-align: right; }
.pck-lcd-unit { font-size: .95rem; color: var(--lcd-ink); opacity: .8; min-width: 2ch; }
.pck-lcd.is-alert .pck-lcd-val { text-align: left; color: #ffb38a; }
.pck-lcd-svg { fill: var(--lcd-bg); }

/* Tableau de mesures */
.pck-table-scroll { max-height: 280px; overflow: auto; border: 1px solid var(--rule); border-radius: var(--radius-s); background: var(--card); }
.pck-table-scroll:focus-visible { outline: 3px solid var(--focus); }
/* bordures séparées : avec « collapse », les lignes défilantes transparaissent au-dessus de l'en-tête collant */
.pck-table { font-variant-numeric: tabular-nums; border-collapse: separate; border-spacing: 0; }
.pck-table thead th { position: sticky; top: 0; background: var(--paper-2); z-index: 1; box-shadow: 0 -2px 0 var(--paper-2); }
.pck-table td, .pck-table th { white-space: nowrap; }
.pck-table .pck-col-n { color: var(--ink-3); width: 2.5em; }
.pck-table .pck-col-del { width: 2.5em; text-align: center; }
.pck-del { min-height: 28px; font-size: 1.05rem; line-height: 1; }
.pck-del:hover { border-color: var(--ko); color: var(--ko); }
.pck-empty td { text-align: center; color: var(--ink-3); padding: 14px 8px; white-space: normal; }
.pck-table-tools { justify-content: flex-end; }

/* Graphique (papier millimétré) */
.pck-plot-fig { margin: 0; }
.pck-plot { width: 100%; height: auto; display: block; }
.pck-plot-paper { fill: var(--card); stroke: var(--rule-2); }
.pck-plot-minor { stroke: color-mix(in srgb, var(--hg) 16%, transparent); stroke-width: .6; }
.pck-plot-major { stroke: color-mix(in srgb, var(--hg) 34%, transparent); stroke-width: .9; }
.pck-plot-axis { stroke: var(--ink); stroke-width: 1.6; }
.pck-plot-arrow { fill: var(--ink); }
.pck-plot-labels text { font-size: 11px; fill: var(--ink-2); }
.pck-plot-labels .pck-plot-title { font-size: 12.5px; font-weight: 700; fill: var(--ink); }
.pck-plot-pt { fill: none; stroke: var(--s); stroke-width: 2; stroke-linecap: round; }
.pck-plot-line { stroke: var(--s); stroke-width: 1.6; stroke-dasharray: 7 4; opacity: .9; }
.pck-plot-join { fill: none; stroke: var(--s); stroke-width: 1.4; opacity: .7; }
.pck-s0 { --s: var(--pc); } .pck-s1 { --s: var(--francais); } .pck-s2 { --s: var(--numerique); }
.pck-s3 { --s: var(--hg); } .pck-s4 { --s: var(--maths); } .pck-s5 { --s: var(--ok); }
.pck-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0 0; padding: 0; font-size: .85rem; color: var(--ink-2); }
.pck-legend li { display: inline-flex; align-items: center; gap: 6px; }
.pck-legend i { width: 14px; height: 3px; border-radius: 2px; background: var(--s); }
.pck-fit-out p { margin: 6px 0 0; font-family: var(--font-mono); font-size: .9rem; }
.pck-ref { margin-top: 10px; }
.pck-ref summary { cursor: pointer; font-weight: 700; color: var(--ink-2); }
.pck-ref table { margin-top: 6px; max-width: 320px; }

/* Loupe */
.pck-loupe-fig { margin: 0; display: grid; justify-items: center; gap: 2px; }
.pck-loupe { width: 140px; height: auto; }
.pck-loupe-bg { fill: var(--card); }
.pck-loupe-liquid { fill: var(--water); }
.pck-loupe-surface { fill: none; stroke: var(--water-line); stroke-width: 2; }
.pck-loupe-tick { stroke: var(--ink); stroke-width: 1.3; }
.pck-loupe-txt { font-size: 14px; font-weight: 700; fill: var(--ink); }
.pck-loupe-needle { fill: var(--ko); }
.pck-loupe-needle-line { stroke: var(--ko); stroke-width: 1.5; }
.pck-loupe-rim { fill: none; stroke: var(--ink-2); stroke-width: 4; }

/* ---------- Loi d'Ohm ---------- */
.ohm-circuit { max-width: 560px; }
.ohm-wire { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.ohm-node { fill: var(--ink); }
.ohm-sym { fill: var(--card); stroke: var(--ink); stroke-width: 2; }
.ohm-adjust { stroke: var(--ink-2); stroke-width: 1.5; }
.ohm-adjust-head { fill: var(--ink-2); }
.ohm-arrow { fill: var(--ink); }
.ohm-uarrow { stroke: var(--pc); stroke-width: 2; }
.ohm-uarrow-head { fill: var(--pc); }
.ohm-txt { fill: var(--ink); }
.ohm-name { font-size: 16px; font-style: italic; font-family: var(--font-display); font-weight: 700; }
.ohm-letter { font-size: 17px; font-weight: 700; }
.ohm-term { font-size: 9.5px; fill: var(--ink-3); font-weight: 700; }
.ohm-pol { font-size: 15px; font-weight: 700; }
.ohm-glow { fill: var(--focus); filter: blur(4px); }
.ohm-meters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- Masse volumique ---------- */
.dens-bench { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(240px, .9fr); gap: 14px; align-items: start; }
.dens-balance { max-width: 340px; display: block; margin: 0 auto; }
.dens-bal-body { fill: color-mix(in srgb, var(--paper-2) 70%, var(--card)); stroke: var(--ink-2); stroke-width: 1.5; }
.dens-bal-stem { fill: var(--ink-3); }
.dens-bal-plate { fill: var(--metal); stroke: var(--ink-2); stroke-width: 1.2; }
.dens-bal-digits { font-family: var(--font-mono); font-size: 22px; fill: var(--lcd-ink); letter-spacing: 1px; }
.dens-bal-unit { font-family: var(--font-mono); font-size: 14px; fill: var(--lcd-ink); }
.dens-bal-key { fill: var(--card); stroke: var(--ink-2); stroke-width: 1.2; }
.dens-bal-keytxt { font-size: 11px; font-weight: 700; fill: var(--ink-2); }
.dens-bal-spec { font-size: 9.5px; fill: var(--ink-3); }
.dens-coupelle { fill: color-mix(in srgb, var(--ink-3) 30%, var(--card)); stroke: var(--ink-2); stroke-width: 1.2; }
.dens-obj > * { fill: var(--mat); stroke: color-mix(in srgb, var(--ink) 75%, transparent); stroke-width: 1.2; }
.dens-obj .dens-top { fill: color-mix(in srgb, var(--mat) 70%, var(--card)); }
.dens-obj .dens-side { fill: color-mix(in srgb, var(--mat) 75%, var(--ink)); }
.dens-obj .dens-shine { fill: color-mix(in srgb, var(--card) 70%, transparent); stroke: none; }
.dens-mat-dense { --mat: color-mix(in srgb, var(--hg) 60%, var(--ink-3)); }
.dens-mat-mineral { --mat: color-mix(in srgb, var(--ink-3) 65%, var(--card)); }
.dens-mat-plastic { --mat: color-mix(in srgb, var(--numerique) 45%, var(--card)); }
.dens-mat-wood { --mat: color-mix(in srgb, var(--approfondissement) 50%, var(--card)); }
.dens-cyl-row { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.dens-cyl { width: 128px; max-width: 46%; height: auto; }
.dens-glass { fill: var(--glass); }
.dens-glass-edge { fill: none; stroke: var(--ink-2); stroke-width: 2; }
.dens-foot { fill: var(--ink-3); }
.dens-tick, .dens-tick-l { stroke: var(--ink); stroke-width: .8; }
.dens-tick-l { stroke-width: 1.2; }
.dens-tick-txt { font-size: 10px; fill: var(--ink-2); font-weight: 700; }
.dens-water { fill: var(--water); }
.dens-surface { fill: none; stroke: var(--water-line); stroke-width: 1.4; }
.dens-rod { stroke: var(--ink-2); stroke-width: 1.5; }
.dens-form-grid { display: grid; gap: 6px; }
.dens-mass-out { font-family: var(--font-mono); font-weight: 700; font-size: 1.1rem; padding: 6px 0; }
.dens-in { max-width: 10em; }

/* ---------- Chronophotographie ---------- */
/* la chronophotographie reste une photo sombre dans les deux thèmes */
.mot { --mot-photo: color-mix(in srgb, var(--ink) 92%, var(--paper)); --mot-light: var(--paper); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mot { --mot-photo: color-mix(in srgb, var(--paper) 70%, #000); --mot-light: var(--ink); }
}
.mot-strip { display: block; touch-action: manipulation; }
.mot-photo { fill: var(--mot-photo); }
.mot-rail { stroke: color-mix(in srgb, var(--mot-light) 30%, transparent); stroke-width: 1.5; stroke-dasharray: 2 4; }
.mot-ruler { fill: color-mix(in srgb, var(--hg) 18%, var(--card)); stroke: var(--rule-2); }
.mot-tick { stroke: var(--ink); stroke-width: 1; }
.mot-tick-txt { font-size: 11px; fill: var(--ink); font-weight: 700; }
.mot-img { cursor: pointer; outline: none; }
.mot-hit { fill: transparent; }
.mot-puck { fill: color-mix(in srgb, var(--mot-light) 85%, transparent); stroke: var(--mot-light); stroke-width: 1; }
.mot-center { fill: var(--mot-photo); }
.mot-lbl { font-size: 10.5px; fill: color-mix(in srgb, var(--mot-light) 80%, transparent); font-weight: 700; pointer-events: none; }
.mot-img:hover .mot-puck { stroke: var(--focus); stroke-width: 2.5; }
.mot-img.is-sel .mot-puck { fill: var(--focus); stroke: var(--mot-light); stroke-width: 2; }
.mot-img.is-sel .mot-lbl { fill: var(--focus); }
.mot-img:focus-visible .mot-puck { stroke: var(--focus); stroke-width: 4; }
.mot-live { fill: none; stroke: var(--ko); stroke-width: 3; pointer-events: none; }
.mot-measure { stroke: var(--focus); stroke-width: 2; }
.mot-controls { display: grid; grid-template-columns: minmax(220px, .7fr) minmax(0, 1.3fr); gap: 16px; align-items: start; }
.mot-read { margin: 0; min-height: 3em; font-variant-numeric: tabular-nums; }
.mot-lcd { min-width: 150px; }
.mot-anim .btn-row { align-items: center; }

/* ---------- Poids ---------- */
.wt-bench { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.wt-fig { margin: 0; }
.wt-svg { width: 190px; max-width: 100%; height: auto; }
.wt-stand { fill: var(--metal); }
.wt-rod { stroke: var(--ink-2); stroke-width: 2; }
.wt-ring { fill: none; stroke: var(--ink-2); stroke-width: 2; }
.wt-tube { fill: var(--glass); }
.wt-tube-edge { fill: none; stroke: var(--ink-2); stroke-width: 1.6; }
.wt-tick { stroke: var(--ink); stroke-width: .9; }
.wt-tick-txt { font-size: 10.5px; fill: var(--ink); font-weight: 700; }
.wt-unit { font-style: italic; }
.wt-cal { font-size: 10px; fill: var(--ink-3); font-weight: 700; }
.wt-spring { fill: none; stroke: var(--ink-2); stroke-width: 1.6; stroke-linejoin: round; }
.wt-index { fill: var(--ko); }
.wt-hook { fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; }
.wt-mass { fill: color-mix(in srgb, var(--hg) 45%, var(--ink-3)); stroke: var(--ink); stroke-width: 1.2; }
.wt-mass-txt { font-size: 11px; font-weight: 700; fill: var(--ink); }
.wt-planet { font-size: 13px; font-family: var(--font-display); font-style: italic; fill: var(--ink-2); }
.wt-mass-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.wt-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- Changement d'état ---------- */
.heat-bench { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(90px, .35fr) minmax(240px, 1fr); gap: 14px; align-items: start; }
.heat-beaker { max-width: 380px; display: block; margin: 0 auto; }
.heat-thermo { max-height: 420px; width: 100%; }
.heat-heater { fill: color-mix(in srgb, var(--ink-3) 35%, var(--card)); stroke: var(--ink-2); stroke-width: 1.2; }
.heat-knob { fill: var(--card); stroke: var(--ink-2); stroke-width: 1.5; }
.heat-led { fill: var(--rule-2); }
.heat-led.is-on { fill: var(--ko); }
.heat-plate { fill: var(--ink-3); transition: fill .6s; }
.heat-plate.is-on { fill: color-mix(in srgb, var(--ko) 75%, var(--ink-3)); }
.heat-glass { fill: none; stroke: var(--ink-2); stroke-width: 2.2; stroke-linejoin: round; }
.heat-sample { font-size: 12px; fill: var(--ink-3); font-style: italic; }
.heat-probe { stroke: var(--ink-3); stroke-width: 3; stroke-linecap: round; }
.heat-probe-tip { fill: var(--ko); }
.heat-liquid { fill: var(--water); }
.heat-surface { stroke: var(--water-line); stroke-width: 1.4; }
.heat-ice { fill: color-mix(in srgb, var(--classe) 10%, var(--card)); stroke: color-mix(in srgb, var(--classe) 55%, var(--ink-3)); stroke-width: 1.3; opacity: .95; }
.heat-thermo-glass { fill: var(--glass); stroke: var(--ink-2); stroke-width: 1.4; }
.heat-bulb, .heat-column { fill: var(--ko); }
.heat-tick { stroke: var(--ink); stroke-width: .9; }
.heat-tick-txt { font-size: 12px; font-weight: 700; fill: var(--ink); }
.heat-statebox { margin-top: 8px; display: grid; gap: 4px; }
.heat-state { margin: 0; font-weight: 700; }
.heat-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; border: 1px solid var(--rule-2); background: var(--card); }
.heat-bar-s { background: color-mix(in srgb, var(--classe) 25%, var(--card)); }
.heat-bar-l { background: color-mix(in srgb, var(--classe) 65%, var(--card)); }
.heat-bar-legend { display: flex; justify-content: space-between; }
.heat-lcds { display: grid; gap: 8px; }
.heat-auto { font-weight: 400 !important; display: flex !important; align-items: center; gap: 8px; }
.heat-auto input { width: 20px; height: 20px; accent-color: var(--ink); }

/* ---------- Adaptation tablette / téléphone ---------- */
@media (max-width: 1000px) {
  .dens-bench { grid-template-columns: 1fr 1fr; }
  .dens-form { grid-column: 1 / -1; }
  .heat-bench { grid-template-columns: minmax(0, 1fr) 110px; }
  .heat-controls { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .pck-exploit, .mot-controls { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .dens-bench { grid-template-columns: 1fr; }
  .ohm-meters, .wt-form { grid-template-columns: 1fr; }
  .pck-lcd-val { font-size: 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  .heat-plate, .pck-choice-opt span { transition: none; }
}
