:root {
  --font-scale: 1;
  --cream: #f7f1e7;
  --paper: #fffdf8;
  --navy: #1b3a63;
  --ink: #10233c;
  --muted: #637285;
  --orange: #ff6b35;
  --orange-deep: #c9451a;
  --blue: #3d7fca;
  --blue-soft: #84b7ec;
  --green: #1e7e54;
  --red: #c0392b;
  --amber: #b06a00;
  --line: rgba(27, 58, 99, .18);
  --shadow: 0 12px 34px rgba(27, 58, 99, .12);
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: Calibri, "Segoe UI", system-ui, Arial, sans-serif;
  font-size: calc(16px * var(--font-scale));
  line-height: 1.52;
}
button, select { font: inherit; }
button { touch-action: manipulation; }
button:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 50; left: 12px; top: -80px; padding: 10px 14px; color: #fff; background: var(--navy); border-radius: 9px; }
.skip-link:focus { top: 10px; }

.app-shell { height: 100dvh; display: grid; grid-template-rows: 76px minmax(0, 1fr) 66px; overflow: hidden; }
.topbar { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.3fr) minmax(290px, 1fr); align-items: center; gap: 16px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--paper); box-shadow: 0 2px 10px rgba(27,58,99,.08); z-index: 3; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; border-radius: 14px; background: var(--navy); color: #fff; font: 700 18px/1 "Trebuchet MS", Calibri, Arial, sans-serif; }
.brand-copy, .module-name { display: flex; flex-direction: column; min-width: 0; }
.brand-copy strong, .module-name strong { color: var(--navy); font-family: "Trebuchet MS", Calibri, Arial, sans-serif; }
.brand-copy span, .module-name span { color: var(--muted); font-size: .72em; letter-spacing: .06em; }
.module-name { align-items: center; text-align: center; }
.module-name strong { font-size: 1.12em; }
.top-tools, .voice-tools, .reading-tools { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.tool-button, .reading-tools button, .speed-control select, .source-button, .close-button { border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--navy); min-height: 36px; padding: 6px 10px; cursor: pointer; }
.tool-button.playing { background: var(--navy); color: #fff; }
.reading-tools button { min-width: 38px; padding-inline: 7px; }

.course-grid { min-height: 0; display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 12px; padding: 12px 14px; overflow: hidden; }
.stepper { display: grid; grid-template-rows: repeat(var(--step-count, 14), minmax(0, 1fr)); gap: 4px; min-height: 0; }
.step-button { width: 100%; min-height: 0; display: grid; grid-template-columns: 28px minmax(0,1fr); align-items: center; gap: 7px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,253,248,.7); color: var(--ink); text-align: left; cursor: pointer; }
.step-button .step-number { display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--navy); border-radius: 999px; color: var(--navy); font: 700 .76em/1 Consolas, monospace; }
.step-button .step-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78em; }
.step-button.active { border: 2px solid var(--blue); background: var(--paper); box-shadow: 0 2px 8px rgba(27,58,99,.1); }
.step-button.active .step-number { background: var(--navy); color: #fff; }
.step-button.reached:not(.active) .step-number::after { content: "✓"; font-family: inherit; font-size: .72em; margin-left: 1px; }

.lesson { min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(300px, 36%) minmax(0, 64%); gap: 12px; overflow: hidden; }
.lesson-copy, .visual-card { min-height: 0; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.lesson-copy { padding: clamp(12px, 2vh, 22px); display: flex; flex-direction: column; }
.kicker { margin: 0 0 4px; color: var(--orange-deep); font-size: .78em; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
h1, h2, h3 { margin-top: 0; color: var(--navy); font-family: "Trebuchet MS", Calibri, Arial, sans-serif; line-height: 1.12; }
h1 { margin-bottom: 8px; font-size: clamp(1.45em, 2vw, 2.15em); letter-spacing: -.015em; }
h2 { margin-bottom: 3px; font-size: 1.16em; }
.lesson-intro { margin: 0 0 10px; font-size: 1.03em; font-weight: 600; }
.lesson-detail { min-height: 0; overflow: hidden; font-size: .91em; }
.lesson-detail p { margin: 7px 0; }
.lesson-detail ul { margin: 5px 0; padding-left: 20px; }
.lesson-detail li + li { margin-top: 3px; }
.fact, .key-box, .warning-box, .neutral-box { margin: 7px 0; padding: 8px 10px; border: 2px solid var(--navy); border-radius: 10px; background: var(--paper); }
.key-box { border: 4px double var(--green); }
.warning-box { border: 3px dashed var(--orange-deep); }
.neutral-box { border-style: solid; }
.takeaway { margin: auto 0 0; padding: 9px 11px; border: 4px double var(--green); border-radius: 10px; background: #e3f5ec; font-weight: 700; font-size: .92em; }

.visual-card { padding: 12px; display: grid; grid-template-rows: auto auto minmax(0,1fr) auto; gap: 7px; }
.visual-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; min-height: 42px; }
.visual-heading p, .visual-caption { margin: 0; color: var(--muted); font-size: .78em; }
.source-button { flex: 0 0 auto; min-height: 31px; padding: 4px 8px; font-size: .76em; }
.visual-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; min-height: 32px; }
.action-button, .choice-button { min-height: 34px; padding: 6px 11px; border: 1px solid var(--navy); border-radius: 999px; background: var(--paper); color: var(--navy); font-weight: 700; cursor: pointer; }
.action-button.primary, .choice-button.active { background: var(--navy); color: #fff; }
.choice-button.correct { border: 4px double var(--green); background: #e3f5ec; color: var(--ink); }
.choice-button.wrong { border: 3px dashed var(--red); background: #fbe7e4; color: var(--ink); }
.visual-root { min-height: 0; position: relative; overflow: hidden; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(180deg, #fffdf8 0%, #f3f7fb 100%); }
.diagram { width: 100%; height: 100%; min-height: 0; display: grid; place-items: center; }
.diagram svg { display: block; width: 100%; height: 100%; max-height: 100%; }
.visual-caption { min-height: 18px; text-align: center; }

.receiver-shell { fill: #dce6ef; stroke: #1b3a63; stroke-width: 4; }
.receiver-shine { fill: rgba(255,255,255,.62); }
.liquid { fill: #84b7ec; opacity: .82; transition: y .35s ease, height .35s ease; }
.pipe { fill: none; stroke: #1b3a63; stroke-width: 12; stroke-linecap: round; stroke-linejoin: round; }
.dip-tube { fill: none; stroke: #c9451a; stroke-width: 8; stroke-linecap: round; }
.receiver-neck { fill: #b7c2c8; stroke: #1b3a63; stroke-width: 3; }
.receiver-neck-line { fill: none; stroke: #c9451a; stroke-width: 8; stroke-linecap: round; }
.service-valve { filter: drop-shadow(0 4px 4px rgba(27,58,99,.13)); }
.valve-body { fill: #e99b70; stroke: #1b3a63; stroke-width: 3; stroke-linejoin: round; }
.valve-union { fill: #cfd8dc; stroke: #1b3a63; stroke-width: 3; }
.valve-rotalock { fill: #efbd98; stroke: #1b3a63; stroke-width: 3; stroke-linejoin: round; }
.valve-bore { fill: none; stroke: #fff6eb; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.valve-stem { fill: none; stroke: #1b3a63; stroke-width: 9; stroke-linecap: round; }
.valve-cap-band { fill: #56616a; stroke: #1b3a63; stroke-width: 3; }
.valve-cap { fill: #29343e; stroke: #1b3a63; stroke-width: 3; stroke-linejoin: round; }
.valve-cap-ribs { fill: none; stroke: #79848d; stroke-width: 3; }
.outlet-pipe { stroke-width: 10; }
.flow-arrow { fill: #3d7fca; }
.service-port path, .service-valve > .service-port { fill: none; stroke: #1b3a63; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.service-port rect { fill: #fffdf8; stroke: #1b3a63; stroke-width: 3; }
.valve-service .service-port rect { stroke: #1e7e54; stroke-width: 5; }
.valve-stop { fill: #fffdf8; stroke: #c0392b; stroke-width: 4; }
.valve-stop-mark, .valve-shutter { fill: none; stroke: #c0392b; stroke-width: 6; stroke-linecap: round; }
.valve-closed .flow-arrow { fill: #c0392b; }
.label-line { stroke: #1b3a63; stroke-width: 2; stroke-dasharray: 5 4; }
.svg-label { fill: #10233c; font-family: Calibri, "Segoe UI", Arial, sans-serif; font-size: 20px; font-weight: 700; }
.svg-small { fill: #637285; font-family: Calibri, "Segoe UI", Arial, sans-serif; font-size: 16px; }
.svg-title { fill: #1b3a63; font-family: "Trebuchet MS", Calibri, Arial, sans-serif; font-size: 24px; font-weight: 700; }
.flow-trace { fill: none; stroke: #3d7fca; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 14 16; opacity: 0; }
.flowing .flow-trace { opacity: 1; animation: trace-flow 1.2s linear infinite; }
@keyframes trace-flow { to { stroke-dashoffset: -60; } }

@media (prefers-reduced-motion: reduce) {
  .liquid { transition: none; }
  .flowing .flow-trace { animation: none; stroke-dasharray: none; }
}

/* Symboles validés et schémas frigorifiques */
.library-symbol image { overflow: visible; }
.library-liquid, .circuit-level, .safety-liquid { fill: #84b7ec; opacity: .82; }
.symbol-name, .circuit-label, .liquid-line-title, .liquid-line-subtitle, .zone-bracket-label {
  fill: #10233c;
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
  text-anchor: middle;
  font-weight: 800;
}
.symbol-name { font-size: 14px; }
.symbol-subname { fill: #637285; font-size: 11px; font-weight: 800; text-anchor: middle; }
.connection-word { font-size: 10px; font-weight: 900; }
.inlet-word { fill: #3d7fca; text-anchor: end; }
.outlet-word { fill: #c9451a; text-anchor: start; }
.liquid-line-zone { fill: rgba(61,127,202,.045); stroke: #c9451a; stroke-width: 4; stroke-dasharray: 13 8; }
.liquid-line-title { text-anchor: start; font-size: 18px; fill: #c9451a; }
.liquid-line-subtitle { text-anchor: start; font-size: 14px; fill: #637285; }
.zone-bracket { fill: none; stroke: #c9451a; stroke-width: 4; stroke-linecap: round; }
.zone-bracket-label { font-size: 15px; fill: #c9451a; }
.receiver-location.symbol-correct image { filter: drop-shadow(0 0 7px rgba(30,126,84,.7)); }
.circuit-pipe { fill: none; stroke: #1b3a63; stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; }
.connector-pipe { fill: none; stroke: #1b3a63; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.connector-flow { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.circuit-flow, .flow-pass, .flow-blocked, .flow-draining, .flow-stopped { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.circuit-flow { stroke-width: 6; }
.flow-pass { stroke: #1e7e54; stroke-width: 7; stroke-dasharray: 16 11; animation: circuit-flow var(--flow-speed, 1.1s) linear infinite; }
.flow-blocked { stroke: #c0392b; stroke-width: 7; stroke-dasharray: 10 9; animation: blocked-pulse 1s ease-in-out infinite; }
.flow-draining { stroke: #b06a00; stroke-width: 7; stroke-dasharray: 3 11; animation: circuit-flow 1.45s linear infinite; }
.flow-stopped { stroke: #637285; stroke-width: 6; stroke-dasharray: 4 10; }
@keyframes circuit-flow { to { stroke-dashoffset: -54; } }
@keyframes blocked-pulse { 50% { opacity: .38; } }
.refrigeration-circuit svg, .service-valve-map svg, .safety-vessel svg { padding-bottom: 40px; }
.circuit-label { font-size: 14px; }
.level-pointer { fill: none; stroke: #3d7fca; stroke-width: 3; stroke-dasharray: 4 4; }
.level-word { fill: #1b3a63; font-size: 14px; font-weight: 900; text-anchor: middle; }
.circuit-status rect { fill: #fffdf8; stroke-width: 4; }
.circuit-status text { fill: #10233c; font-size: 15px; font-weight: 900; }
.status-open rect { stroke: #1e7e54; }
.status-blocked rect { stroke: #c0392b; stroke-dasharray: 12 7; }
.blocked-marker circle { fill: #fffdf8; stroke: #c0392b; stroke-width: 4; stroke-dasharray: 7 4; }
.blocked-marker path, .compressor-stop path { fill: none; stroke: #c0392b; stroke-width: 5; stroke-linecap: round; }
.blocked-marker text, .compressor-stop text { fill: #c0392b; font-size: 14px; font-weight: 900; }
.open-marker path { fill: none; stroke: #1e7e54; stroke-width: 5; }
.open-marker text { fill: #1e7e54; font-size: 14px; font-weight: 900; }
.compressor-stop circle { fill: rgba(255,253,248,.88); stroke: #c0392b; stroke-width: 5; stroke-dasharray: 10 6; }
.control-badge rect { fill: #fffdf8; stroke: #1b3a63; stroke-width: 3; }
.control-badge text, .bp-control text { fill: #10233c; font-size: 13px; font-weight: 900; text-anchor: middle; }
.control-badge.is-active rect, .bp-control.is-active image { filter: drop-shadow(0 0 6px rgba(192,57,43,.55)); }
.control-badge.is-active rect { stroke: #c0392b; stroke-dasharray: 8 5; }
.control-signal { fill: none; stroke: #637285; stroke-width: 3; stroke-dasharray: 5 5; }
.control-signal.is-active { stroke: #c0392b; stroke-width: 4; }
.opening-gauge > rect:first-child { fill: #fffdf8; stroke: #1b3a63; stroke-width: 3; }
.opening-fill { fill: #1e7e54; }
.opening-gauge text { fill: #10233c; font-size: 12px; font-weight: 900; }

.variation-lab { width: 100%; height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; gap: 5px; padding: 7px 10px; }
.variation-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.variation-controls label { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px 8px; padding: 5px 8px; border: 2px solid #1b3a63; border-radius: 10px; background: #fffdf8; color: #10233c; font-size: .8em; font-weight: 700; }
.variation-controls output { color: #1b3a63; font-family: Consolas, monospace; font-weight: 900; }
.variation-controls input { grid-column: 1 / -1; width: 100%; accent-color: #3d7fca; }
.variation-circuit { min-height: 0; overflow: hidden; }
.variation-circuit .diagram { height: 100%; }
.variation-status { padding: 5px 8px; border: 4px double #1e7e54; border-radius: 9px; background: #fffdf8; text-align: center; font-size: .78em; }

/* Repérage P / P1 de la vanne Rotalock étudiée */
.service-map-body { fill: #fff4e0; stroke: #1b3a63; stroke-width: 5; }
.service-map-cavity { fill: none; stroke: #84b7ec; stroke-width: 38; stroke-linecap: round; }
.service-map-stem { fill: none; stroke: #ff6b35; stroke-width: 18; stroke-linecap: square; }
.service-map-pointer { fill: #ff6b35; stroke: #1b3a63; stroke-width: 4; }
.service-map-port { fill: #fffdf8; stroke: #1b3a63; stroke-width: 5; }
.service-map-cap { fill: #29343e; stroke: #1b3a63; stroke-width: 3; }
.service-map-square { fill: #1b3a63; stroke: #10233c; stroke-width: 4; }
.service-map-square.is-selected { stroke: #ff6b35; stroke-width: 8; }
.square-mark { fill: none; stroke: #fffdf8; stroke-width: 6; stroke-linecap: round; }
.port-box rect { fill: #fffdf8; stroke-width: 4; }
.port-p rect { stroke: #1e7e54; stroke-dasharray: 16 6 3 6; }
.port-p1 rect { stroke: #c9451a; stroke-dasharray: 11 7; }
.port-box.is-selected rect { stroke-width: 8; filter: drop-shadow(0 0 5px rgba(27,58,99,.2)); }
.port-code { fill: #1b3a63; font-size: 21px; font-weight: 900; }
.port-role { fill: #10233c; font-size: 15px; font-weight: 900; }
.port-note { fill: #637285; font-size: 11px; font-weight: 800; }
.square-label rect { fill: #fffdf8; stroke: #1b3a63; stroke-width: 3; }
.square-label.is-selected rect { stroke: #ff6b35; stroke-width: 7; }
.square-label text { fill: #10233c; font-size: 13px; font-weight: 900; text-anchor: middle; }
.near-square { fill: none; stroke: #1e7e54; stroke-width: 3; stroke-dasharray: 7 5; }
.near-square-text { fill: #1e7e54; font-size: 13px; font-weight: 900; }

/* DESP et accessoires de sécurité */
.safety-shell { fill: #dce6ef; stroke: #1b3a63; stroke-width: 5; }
.safety-neck { fill: #b7c2c8; stroke: #1b3a63; stroke-width: 4; }
.pressure-wave { fill: none; stroke: #c0392b; stroke-width: 5; stroke-dasharray: 10 8; animation: blocked-pulse 1.1s ease-in-out infinite; }
.desp-plate rect { fill: #fffdf8; stroke: #1b3a63; stroke-width: 4; }
.desp-plate text { fill: #10233c; font-size: 15px; font-weight: 900; text-anchor: middle; }
.desp-shield path { fill: #fffdf8; stroke: #1e7e54; stroke-width: 5; }
.desp-shield text { fill: #1e7e54; font-size: 15px; font-weight: 900; text-anchor: middle; }
.plate-main-title { fill: #1b3a63; font-size: 18px; font-weight: 900; text-anchor: middle; }
.plate-frame { fill: #f5f7f8; stroke: #1b3a63; stroke-width: 4; }
.plate-header { fill: #1b3a63; }
.plate-header-text { fill: #fff; font-size: 14px; font-weight: 900; text-anchor: middle; }
.plate-rule { stroke: #a9b4bf; stroke-width: 2; }
.plate-field-label { fill: #1b3a63; font-size: 11px; font-weight: 900; }
.plate-field-value { fill: #10233c; font-size: 13px; font-weight: 700; }
.plate-field-critical .plate-field-label { fill: #c0392b; }
.plate-alert rect { fill: #fff4e0; stroke: #c9451a; stroke-width: 2; stroke-dasharray: 9 5; }
.plate-alert text { fill: #9b3718; font-size: 13px; font-weight: 900; text-anchor: middle; }
.receiver-plate-mark { fill: #fffdf8; stroke: #c9451a; stroke-width: 4; }
.receiver-plate-text { fill: #10233c; font-size: 9px; font-weight: 900; text-anchor: middle; }
.plate-pointer { fill: none; stroke: #c9451a; stroke-width: 4; }
.plate-pointer-head { fill: #c9451a; }
.plate-pointer-label { fill: #1b3a63; font-size: 13px; font-weight: 900; text-anchor: middle; }
.plate-legend rect { fill: #fffdf8; stroke: #1e7e54; stroke-width: 3; stroke-dasharray: 15 5 3 5; }
.plate-legend text { fill: #1e7e54; font-size: 10px; font-weight: 900; text-anchor: middle; }
.safety-discharge { fill: none; stroke: #c0392b; stroke-width: 8; stroke-dasharray: 12 10; animation: circuit-flow .9s linear infinite; }
.danger-word { fill: #c0392b; font-size: 17px; font-weight: 900; text-anchor: middle; }
.safety-small { fill: #637285; font-size: 12px; font-weight: 800; text-anchor: middle; }
.danger-badge rect { fill: #fffdf8; stroke: #c0392b; stroke-width: 5; stroke-dasharray: 12 7; }
.danger-badge text { fill: #c0392b; font-size: 14px; font-weight: 900; text-anchor: middle; }
.rupture-disc { fill: #fffdf8; stroke: #c0392b; stroke-width: 6; stroke-dasharray: 10 6; }
.rupture-break { fill: none; stroke: #c0392b; stroke-width: 7; animation: rupture-shift 1.2s ease-in-out infinite alternate; }
@keyframes rupture-shift { to { transform: translateX(8px); } }
.fusible-plug { fill: #f1b06f; stroke: #1b3a63; stroke-width: 4; }
.flame { fill: #ff6b35; stroke: #c9451a; stroke-width: 3; animation: blocked-pulse .8s ease-in-out infinite; }
.rupture-devices > g > text:not(.safety-small) { fill: #10233c; font-size: 14px; font-weight: 900; text-anchor: middle; }

@media (prefers-reduced-motion: reduce) {
  .flow-pass, .flow-blocked, .flow-draining, .pressure-wave, .safety-discharge, .rupture-break, .flame { animation: none; }
}

.component-grid, .safety-grid { width: 100%; height: 100%; display: grid; gap: 8px; padding: 10px; }
.component-grid { grid-template-columns: repeat(3, 1fr); }
.safety-grid { grid-template-columns: repeat(3, 1fr); }
.mini-card { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 10px; border: 2px solid var(--navy); border-radius: 12px; background: var(--paper); text-align: center; }
.mini-card strong { color: var(--navy); font-family: "Trebuchet MS", Calibri, Arial, sans-serif; }
.mini-card small { color: var(--muted); }
.mini-card.key { border: 4px double var(--green); }
.mini-card.warning { border: 3px dashed var(--orange-deep); }
.readout { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 2; padding: 7px 10px; border: 2px solid var(--navy); border-radius: 10px; background: rgba(255,253,248,.96); color: var(--ink); text-align: center; font-size: .86em; }
.range-panel { width: min(90%, 620px); height: 100%; display: grid; grid-template-rows: minmax(70px,1fr) auto auto; gap: 6px; padding: 8px; }
.range-panel input { width: 100%; accent-color: var(--blue); }
.range-panel label { font-size: .82em; }
.range-panel .neutral-box { margin: 0; padding: 5px 7px; font-size: .78em; }
.level-meter { height: 100%; max-height: 180px; min-height: 70px; width: 120px; margin: auto; position: relative; overflow: hidden; border: 4px solid var(--navy); border-radius: 42px 42px 16px 16px; background: #fff; }
.level-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 45%; background: var(--blue-soft); transition: height .3s ease; }
.level-meter span { position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; font: 700 1.25em Consolas, monospace; color: var(--navy); }

.quiz-shell { width: min(96%, 760px); display: grid; gap: 10px; padding: 10px; }
.quiz-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: .82em; }
.quiz-prompt { margin: 0; text-align: center; font-size: 1.05em; }
.quiz-answers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quiz-choice { min-height: 68px; padding: 8px; border: 2px solid var(--navy); border-radius: 12px; background: var(--paper); color: var(--ink); cursor: pointer; }
.quiz-choice.good { border: 4px double var(--green); background: #e3f5ec; }
.quiz-choice.bad { border: 3px dashed var(--red); background: #fbe7e4; }
.quiz-feedback { min-height: 42px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); text-align: center; }
.quiz-result { display: grid; place-items: center; gap: 8px; text-align: center; }
.quiz-score { display: grid; place-items: center; width: 100px; height: 100px; border: 6px double var(--green); border-radius: 999px; color: var(--navy); font: 700 1.8em Consolas, monospace; }

.bottom-nav { display: grid; grid-template-columns: 160px minmax(160px,1fr) 160px; align-items: center; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--line); background: var(--paper); z-index: 3; }
.nav-button { min-height: 44px; border: 1px solid var(--navy); border-radius: 12px; padding: 8px 14px; font-weight: 700; cursor: pointer; }
.nav-button.primary { background: var(--navy); color: #fff; }
.nav-button.secondary { background: var(--paper); color: var(--navy); }
.nav-button:disabled { opacity: .42; cursor: default; }
.progress-copy { display: grid; justify-items: center; gap: 4px; color: var(--muted); font-size: .78em; }
.progress-track { width: min(100%, 480px); height: 7px; overflow: hidden; border-radius: 999px; background: rgba(27,58,99,.12); }
.progress-track span { display: block; height: 100%; width: 0; background: var(--blue); transition: width .2s ease; }

.sources-dialog { width: min(720px, calc(100% - 24px)); max-height: calc(100dvh - 24px); border: 2px solid var(--navy); border-radius: 18px; padding: 0; color: var(--ink); background: var(--paper); }
.sources-dialog::backdrop { background: rgba(16,35,60,.35); }
.sources-dialog form { padding: 20px; }
.dialog-heading { display: flex; justify-content: space-between; gap: 12px; }
.close-button { font-size: 1.4em; }
.rights-rule { padding: 9px; border: 3px dashed var(--orange-deep); border-radius: 10px; }

/* Voyant liquide : SVG et activités propres au module */
.glass-comparison { width: 100%; height: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px 10px 54px; }
.glass-card { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 4px; padding: 8px; border: 2px solid var(--navy); border-radius: 14px; background: #fffdf8; text-align: center; }
.glass-card h3, .glass-card p { margin: 0; }
.glass-card h3 { font-size: 1em; }
.glass-card p { color: var(--ink); font-size: .77em; }
.glass-card .diagram { min-height: 0; }
.equipment-image { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.technical-illustration { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; padding: 5px 7px 52px; }
.line-reference { padding-inline: 10px; }
.restriction-reference { padding-inline: 5px; }
.connection-reference { padding: 0 0 30px; }
.glass-card.identified-simple { border: 3px solid var(--navy); }
.glass-card.identified-indicator { border: 5px double var(--green); }

.sg-pipe { fill: none; stroke: #1b3a63; stroke-width: 18; stroke-linecap: round; }
.sg-arrow { fill: #3d7fca; stroke: #1b3a63; stroke-width: 2; }
.sg-body { fill: #ead4a5; stroke: #1b3a63; stroke-width: 7; stroke-linejoin: round; }
.sg-body.is-selected { stroke: #ff6b35; stroke-width: 12; }
.sg-channel { fill: none; stroke: #84b7ec; stroke-width: 52; stroke-linecap: round; opacity: .76; }
.sg-flow { fill: none; stroke: #1e7e54; stroke-width: 10; stroke-linecap: round; stroke-dasharray: 18 14; animation: sight-flow 1.1s linear infinite; }
.sg-flow-bubbles { stroke: #3d7fca; }
.sg-bubbles circle { fill: #fffdf8; stroke: #3d7fca; stroke-width: 5; animation: bubble-drift 1.7s ease-in-out infinite alternate; }
.sg-bubbles circle:nth-child(even) { animation-delay: -.8s; }
.sg-window circle:first-child { fill: rgba(216,231,243,.82); stroke: #1b3a63; stroke-width: 7; }
.sg-window circle:nth-child(2) { fill: rgba(255,253,248,.18); stroke: #fffdf8; stroke-width: 5; }
.sg-simple-window rect { fill: rgba(255,253,248,.94); stroke: #1b3a63; stroke-width: 4; }
.sg-indicator-reference { fill: #fffdf8; stroke: #1b3a63; stroke-width: 5; }
.sg-indicator-disc { filter: drop-shadow(0 2px 2px rgba(16,35,60,.18)); }
.sg-simple-window text, .sg-indicator-word, .sg-model-label { fill: #10233c; font-family: Calibri, "Segoe UI", Arial, sans-serif; font-weight: 900; text-anchor: middle; }
.sg-simple-window text { font-size: 15px; }
.sg-indicator-word { font-size: 17px; }
.sg-model-label { font-size: 17px; }
.sg-stop circle { fill: rgba(255,253,248,.88); stroke: #c0392b; stroke-width: 7; stroke-dasharray: 12 8; }
.sg-stop path { fill: none; stroke: #c0392b; stroke-width: 10; stroke-linecap: round; }
.sg-stop text { fill: #c0392b; font-size: 17px; font-weight: 900; text-anchor: middle; }
@keyframes sight-flow { to { stroke-dashoffset: -64; } }
@keyframes bubble-drift { to { transform: translateY(-13px); } }

.symbol-focus image { filter: drop-shadow(0 0 8px rgba(30,126,84,.75)); }
.symbol-focus .symbol-name { fill: #1e7e54; font-size: 17px; }
.cutaway-seal { fill: #fff4e0; stroke: #1b3a63; stroke-width: 6; }
.cutaway-window { fill: rgba(216,231,243,.88); stroke: #1b3a63; stroke-width: 6; }
.cutaway-indicator { fill: #1e7e54; stroke: #fffdf8; stroke-width: 5; }
.cutaway-seal.is-selected, .cutaway-window.is-selected, .cutaway-indicator.is-selected { stroke: #ff6b35; stroke-width: 11; }

.cause-card, .reading-rule, .decision-card, .installation-card { z-index: 1; padding: 10px 12px; border: 2px solid var(--navy); border-radius: 12px; background: rgba(255,253,248,.97); box-shadow: 0 2px 10px rgba(27,58,99,.10); }
.cause-card, .reading-rule { position: absolute; top: 10px; right: 10px; width: min(42%, 350px); }
.cause-card strong, .reading-rule strong, .decision-card strong, .installation-card h3 { color: var(--navy); font-family: "Trebuchet MS", Calibri, Arial, sans-serif; }
.cause-card p, .reading-rule p, .decision-card p { margin: 4px 0; font-size: .82em; }
.reading-rule small { color: var(--muted); font-size: .72em; }

.diagnosis-layout { width: 100%; height: 100%; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(210px, .75fr); align-items: center; gap: 8px; padding: 6px 10px 54px; }
.diagnosis-layout .diagram { min-height: 0; }
.diagnosis-steps { margin: 0; padding: 10px 10px 10px 32px; border: 4px double var(--green); border-radius: 12px; background: #fffdf8; font-size: .83em; }
.diagnosis-steps li { margin: 7px 0; }

.installation-scene { width: 100%; height: 100%; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(220px, .75fr); align-items: center; gap: 10px; padding: 8px 10px 54px; }
.installation-scene .diagram { min-height: 0; }
.installation-card h3 { margin: 0 0 6px; font-size: 1em; }
.installation-card ul { margin: 0; padding-left: 18px; font-size: .8em; }
.installation-card li { margin: 5px 0; }

.visual-root > .safety-grid { height: 55%; align-self: start; padding-bottom: 0; }
.decision-card { position: absolute; left: 10%; right: 10%; top: 50%; text-align: center; }
.decision-card.key { border: 5px double var(--green); }
.decision-card.warning { border: 4px dashed var(--orange-deep); }

@media (prefers-reduced-motion: reduce) {
  .sg-flow, .sg-bubbles circle { animation: none; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-rows: 66px minmax(0,1fr) 60px; }
  .topbar { grid-template-columns: 1fr auto; padding: 7px 10px; }
  .module-name { display: none; }
  .course-grid { grid-template-columns: 128px minmax(0,1fr); padding: 8px; gap: 8px; }
  .lesson { grid-template-columns: minmax(240px, 42%) minmax(0,58%); gap: 8px; }
  .lesson-copy, .visual-card { border-radius: 14px; }
  .lesson-copy { padding: 10px; }
  .visual-card { padding: 8px; }
  .step-button { grid-template-columns: 22px minmax(0,1fr); padding: 2px 4px; }
  .step-button .step-number { width: 20px; height: 20px; }
  .bottom-nav { grid-template-columns: 120px 1fr 120px; padding: 7px 10px; }
}

@media (max-width: 700px) {
  body { font-size: calc(13px * var(--font-scale)); }
  .app-shell { grid-template-rows: 54px minmax(0,1fr) 54px; }
  .topbar { grid-template-columns: auto 1fr; gap: 6px; padding: 5px 7px; }
  .brand-mark { width: 35px; height: 35px; flex-basis: 35px; border-radius: 11px; font-size: 15px; }
  .brand-copy span, .tool-button span, .speed-control { display: none; }
  .brand-copy strong { font-size: .88em; }
  .top-tools { min-width: 0; gap: 3px; }
  .voice-tools, .reading-tools { gap: 3px; }
  .tool-button, .reading-tools button { min-width: 31px; min-height: 31px; padding: 3px 5px; border-radius: 8px; }
  .course-grid { display: grid; grid-template-columns: 1fr; grid-template-rows: 34px minmax(0,1fr); gap: 5px; padding: 5px 6px; }
  .stepper { grid-template-rows: 1fr; grid-template-columns: repeat(var(--step-count, 14), minmax(0,1fr)); gap: 2px; }
  .step-button { display: grid; place-items: center; padding: 0; border-radius: 6px; }
  .step-button .step-number { width: 18px; height: 18px; font-size: 8px; }
  .step-button .step-name { display: none; }
  .step-button.reached:not(.active) .step-number::after { display: none; }
  .lesson { display: grid; grid-template-columns: 1fr; grid-template-rows: minmax(0, 43%) minmax(0,57%); gap: 5px; }
  .lesson-copy { padding: 7px 9px; border-radius: 10px; box-shadow: 0 2px 8px rgba(27,58,99,.09); }
  .visual-card { padding: 6px; gap: 3px; border-radius: 10px; box-shadow: 0 2px 8px rgba(27,58,99,.09); }
  .kicker { font-size: .66em; margin-bottom: 1px; }
  h1 { font-size: 1.33em; margin-bottom: 3px; }
  h2 { font-size: 1em; margin-bottom: 1px; }
  .lesson-intro { margin-bottom: 3px; font-size: .91em; line-height: 1.24; }
  .lesson-detail { font-size: .78em; line-height: 1.26; }
  .lesson-detail p, .fact, .key-box, .warning-box, .neutral-box { margin: 3px 0; }
  .fact, .key-box, .warning-box, .neutral-box { padding: 4px 6px; border-width: 2px; border-radius: 7px; }
  .takeaway { padding: 4px 6px; font-size: .76em; border-width: 3px; border-radius: 7px; }
  .visual-heading { min-height: 26px; }
  .visual-heading p, .visual-caption { font-size: .65em; line-height: 1.15; }
  .source-button { min-height: 24px; padding: 2px 5px; }
  .visual-controls { min-height: 26px; gap: 3px; }
  .action-button, .choice-button { min-height: 26px; padding: 3px 7px; font-size: .74em; }
  .svg-title { font-size: 20px; }
  .svg-label { font-size: 16px; }
  .svg-small { font-size: 13px; }
  .component-grid, .safety-grid { padding: 5px; gap: 4px; }
  .variation-lab { padding: 3px 5px; gap: 2px; }
  .variation-controls { gap: 4px; }
  .variation-controls label { padding: 2px 4px; font-size: .67em; border-width: 1px; }
  .variation-status { padding: 2px 4px; font-size: .64em; border-width: 3px; }
  .mini-card { padding: 4px; border-radius: 7px; font-size: .72em; line-height: 1.18; }
  .readout { left: 5px; right: 5px; bottom: 5px; padding: 3px 5px; font-size: .68em; }
  .quiz-shell { padding: 4px; gap: 4px; }
  .quiz-prompt { font-size: .82em; }
  .quiz-choice { min-height: 45px; padding: 3px; font-size: .7em; line-height: 1.15; }
  .quiz-feedback { min-height: 30px; padding: 3px; font-size: .7em; }
  .quiz-score { width: 68px; height: 68px; font-size: 1.35em; }
  .bottom-nav { grid-template-columns: 92px 1fr 92px; gap: 5px; padding: 5px 6px; }
  .nav-button { min-height: 38px; padding: 4px 6px; font-size: .78em; }
  .progress-copy { font-size: .66em; }
}

@media (max-width: 370px), (max-height: 680px) {
  body { font-size: calc(12px * var(--font-scale)); }
  .app-shell { grid-template-rows: 48px minmax(0,1fr) 48px; }
  .course-grid { grid-template-rows: 30px minmax(0,1fr); padding: 4px; }
  .lesson { grid-template-rows: minmax(0,42%) minmax(0,58%); }
  .visual-caption { display: none; }
  .visual-card { grid-template-rows: auto auto minmax(0,1fr); }
  .brand-copy { display: none; }
  .lesson-detail { font-size: .72em; }
  .takeaway { font-size: .7em; }
  .visual-heading p { display: none; }
}

@media (max-width: 700px) {
  body { font-size: calc(13px * var(--font-scale)); }
  .lesson-detail { font-size: .92em; line-height: 1.22; }
  .takeaway { font-size: .82em; }
  .action-button, .choice-button { font-size: .78em; }
  .glass-comparison { gap: 4px; padding: 4px 4px 34px; }
  .glass-card { gap: 1px; padding: 3px; border-radius: 8px; }
  .glass-card h3 { font-size: .72em; }
  .glass-card p { font-size: .57em; line-height: 1.1; }
  .technical-illustration { padding: 2px 3px 34px; }
  .sg-model-label { font-size: 13px; }
  .cause-card, .reading-rule { top: 4px; right: 4px; width: 46%; padding: 4px 5px; border-radius: 7px; }
  .cause-card p, .reading-rule p { font-size: .61em; line-height: 1.15; }
  .reading-rule small { display: none; }
  .diagnosis-layout, .installation-scene { grid-template-columns: minmax(0, 1.2fr) minmax(120px, .8fr); gap: 3px; padding: 3px 4px 35px; }
  .diagnosis-steps, .installation-card { padding: 4px 4px 4px 18px; font-size: .68em; line-height: 1.15; border-radius: 7px; }
  .diagnosis-steps li, .installation-card li { margin: 3px 0; }
  .installation-card h3 { font-size: .78em; margin-bottom: 2px; }
  .installation-card ul { padding-left: 13px; font-size: .9em; }
  .visual-root > .safety-grid { height: 48%; }
  .decision-card { left: 5px; right: 5px; top: 46%; padding: 4px 5px; }
  .decision-card p { font-size: .72em; line-height: 1.15; }
}

/* Électrovanne — SVG et activités originales */
.action-button.active {
  border: 2px solid var(--blue);
  background: var(--navy);
  color: #fff;
}
.readout-key { border: 5px double var(--green); }
.readout-warning { border: 4px dashed var(--orange-deep); }
.state-pill {
  display: inline-flex;
  align-items: center;
  min-height: 31px;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: .78em;
  letter-spacing: .04em;
}
.state-closed-label { border: 3px dashed var(--orange-deep); color: var(--orange-deep); background: var(--paper); }

.ev-pipe, .ev-channel, .dv-pipe, .dv-channel, .sv-pipe, .sv-main-channel, .orientation-pipe,
.install-pipe, .cs-pipe {
  fill: none;
  stroke: var(--navy);
  stroke-width: 15;
  stroke-linecap: round;
}
.ev-channel, .dv-channel, .sv-main-channel { stroke: #fff8e8; stroke-width: 8; }
.ev-body { stroke: var(--navy); stroke-width: 5; stroke-linejoin: round; }
.ev-cover { fill: #dce4e9; stroke: var(--navy); stroke-width: 4; }
.ev-neck { stroke: var(--navy); stroke-width: 4; }
.ev-neck-top { fill: #eef2f3; stroke: var(--navy); stroke-width: 4; }
.ev-coil rect:first-child { fill: #e6edf2; stroke: var(--navy); stroke-width: 5; }
.ev-coil path { fill: none; stroke: var(--blue); stroke-width: 4; }
.ev-coil .ev-plug { fill: var(--paper); stroke: var(--navy); stroke-width: 4; }
.ev-coil .ev-wire { stroke: var(--navy); stroke-width: 7; }
.ev-bare-note path { fill: none; stroke: var(--orange-deep); stroke-width: 3; stroke-dasharray: 8 6; }
.ev-bare-note text, .ev-label {
  fill: var(--navy);
  font-family: "Trebuchet MS", Calibri, Arial, sans-serif;
  font-weight: 800;
  font-size: 18px;
  text-anchor: middle;
}
.ev-bare-note text { fill: var(--orange-deep); text-anchor: start; font-size: 16px; }
.ev-flow-arrow { fill: var(--blue); stroke: var(--navy); stroke-width: 2; }

.solenoid-location { transition: filter .2s ease, opacity .2s ease; }
.solenoid-location.symbol-focus image { filter: drop-shadow(0 0 5px rgba(201,69,26,.25)); }
.solenoid-location.confirmed image { filter: drop-shadow(0 0 10px rgba(30,126,84,.65)); }
.solenoid-location.confirmed .symbol-name { fill: var(--green); }

.command-layout {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(250px, .85fr) minmax(0, 1.15fr);
  align-items: center;
  gap: 8px;
  padding: 8px 10px 55px;
}
.command-chain { display: flex; align-items: center; justify-content: center; min-width: 0; gap: 6px; }
.command-node {
  min-width: 0;
  width: 31%;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 10px 5px;
  border: 2px solid var(--navy);
  border-radius: 12px;
  background: var(--paper);
  text-align: center;
}
.command-node.active { border: 5px double var(--green); background: #e3f5ec; }
.command-node small { color: var(--muted); line-height: 1.15; }
.node-icon { display: grid; place-items: center; width: 38px; height: 38px; border: 2px solid var(--navy); border-radius: 999px; font-weight: 900; }
.chain-arrow { color: var(--muted); font-size: 1.7em; font-weight: 900; }
.chain-arrow.active { color: var(--green); }
.command-layout .direct-valve { height: 100%; }

.dv-body, .sv-body, .install-body, .cs-body { fill: #ebc96f; stroke: var(--navy); stroke-width: 5; stroke-linejoin: round; }
.dv-body-section { fill: url(#dv-section-hatch); }
.dv-body-cutaway { fill: url(#cutaway-section-hatch); }
.sv-body-section { fill: url(#assisted-section-hatch); }
.dv-cavity, .sv-cavity, .dv-tube-cavity {
  fill: var(--paper);
  stroke: var(--navy);
  stroke-width: 4;
  stroke-linejoin: round;
}
.dv-tube-cavity { stroke-width: 3; }
.dv-seat-solid { fill: #d9a741; stroke: var(--navy); stroke-width: 4; stroke-linejoin: round; }
.section-legend-bg { fill: rgba(255,253,248,.96); stroke: var(--navy); stroke-width: 2; }
.section-legend-matter { fill: url(#dv-section-hatch); stroke: var(--navy); stroke-width: 2; }
.section-legend-matter.cutaway-matter { fill: url(#cutaway-section-hatch); }
.section-legend-cavity { fill: var(--paper); stroke: var(--navy); stroke-width: 2; }
.section-legend text {
  fill: var(--navy);
  font-family: "Trebuchet MS", Calibri, Arial, sans-serif;
  font-size: 11px;
  font-weight: 900;
}
.direct-valve.is-compact .section-legend { display: none; }
.dv-coil rect, .sv-coil rect, .cs-coil rect { fill: #e7edf2; stroke: var(--navy); stroke-width: 5; }
.dv-coil path, .sv-coil path, .cs-coil path { fill: none; stroke: var(--blue); stroke-width: 4; }
.dv-tube, .cs-neck, .install-neck { fill: #cbd7dc; stroke: var(--navy); stroke-width: 4; }
.dv-armature { fill: #7f8f9d; stroke: var(--navy); stroke-width: 3; }
.dv-spring { fill: none; stroke: var(--orange-deep); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.dv-stem { fill: none; stroke: var(--navy); stroke-width: 8; }
.dv-plate { fill: #8b9aa5; stroke: var(--navy); stroke-width: 4; }
.dv-seat { fill: none; stroke: var(--navy); stroke-width: 7; stroke-linecap: round; }
.dv-block { fill: none; stroke: var(--red); stroke-width: 12; stroke-linecap: round; }
.dv-flow, .sv-flow, .sv-pilot-flow { fill: none; stroke: var(--blue); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 15 12; animation: ev-flow 1.2s linear infinite; }
.dv-magnetic { fill: none; stroke: var(--orange-deep); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 10 9; animation: magnetic-pulse 1.3s ease-in-out infinite alternate; }
.dv-moving { transition: transform .45s ease; }
.dv-state rect { fill: var(--paper); stroke-width: 5; }
.dv-state text { fill: var(--navy); font-family: "Trebuchet MS", Calibri, Arial, sans-serif; font-size: 18px; font-weight: 900; text-anchor: middle; }
.dv-state.state-closed rect { stroke: var(--orange-deep); stroke-dasharray: 12 7; }
.dv-state.state-open rect { stroke: var(--green); stroke-dasharray: 2 3; }
.dv-small { fill: var(--muted); font-size: 15px; font-weight: 800; }
.direct-valve.is-compact svg { max-height: 330px; }
@keyframes ev-flow { to { stroke-dashoffset: -54; } }
@keyframes magnetic-pulse { to { opacity: .42; } }

.ev-cutaway { padding-bottom: 52px; }
.ev-cutaway .part { transition: stroke-width .15s ease, filter .15s ease; }
.ev-cutaway .part.is-selected { stroke: var(--orange-deep); stroke-width: 8; filter: drop-shadow(0 0 5px rgba(255,107,53,.42)); }
.ev-cutaway .dv-tube-part.is-selected .dv-tube { stroke: var(--orange-deep); stroke-width: 8; filter: drop-shadow(0 0 5px rgba(255,107,53,.42)); }
.ev-cutaway .dv-tube-part.is-selected .dv-tube-cavity { stroke: var(--orange-deep); }

.principle-card {
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
  display: grid;
  place-items: center;
  padding: 8px 12px 58px;
}
.principle-badge {
  position: absolute;
  z-index: 3;
  top: 9px;
  left: 12px;
  padding: 5px 10px;
  border: 2px solid var(--navy);
  border-radius: 999px;
  color: var(--navy);
  background: var(--paper);
  font-weight: 800;
}
.principle-card .direct-valve { height: 100%; }
.assisted-principle svg { width: 100%; height: 100%; }
.sv-diaphragm { fill: #d7e2e8; stroke: var(--navy); stroke-width: 6; }
.sv-control-cavity { fill: #f8fbfd; }
.sv-seat { fill: none; stroke: var(--navy); stroke-width: 7; }
.sv-pilot rect:first-child { fill: rgba(236,241,243,.9); stroke: var(--navy); stroke-width: 4; }
.sv-pilot rect:nth-child(2), .sv-pilot circle { fill: #82929f; stroke: var(--navy); stroke-width: 3; }
.sv-pilot path { stroke: var(--navy); stroke-width: 7; }
.sv-pilot-moving { transition: transform .4s ease; }
.sv-equalizing-hole { fill: var(--paper); stroke: var(--orange-deep); stroke-width: 4; }
.sv-equalizing-flow { fill: none; stroke: var(--orange-deep); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 9 8; animation: ev-flow 1.35s linear infinite; }
.sv-block { fill: none; stroke: var(--red); stroke-width: 12; stroke-linecap: round; }
.sv-pressure-label rect { fill: rgba(255,253,248,.96); stroke: var(--orange-deep); stroke-width: 3; stroke-dasharray: 8 5; }
.sv-pressure-label text { fill: var(--navy); font-size: 15px; font-weight: 900; }
.sv-pressure-label text:last-child { fill: var(--orange-deep); font-size: 13px; }
.sv-hole-label { font-size: 18px; }

.orientation-scene { width: 100%; height: 100%; position: relative; padding: 5px 8px 54px; }
.orientation-scene svg { width: 100%; height: 100%; }
.body-arrow, .body-arrow-head { fill: none; stroke: var(--blue); stroke-width: 9; stroke-linecap: round; }
.is-wrong .body-arrow, .is-wrong .body-arrow-head { stroke: var(--red); stroke-dasharray: 13 8; }
.orientation-label, .angle-word { fill: var(--navy); text-anchor: middle; font-family: "Trebuchet MS", Calibri, Arial, sans-serif; font-size: 18px; font-weight: 900; }
.is-wrong .orientation-label { fill: var(--red); }
.angle-arc { fill: none; stroke: var(--orange-deep); stroke-width: 4; stroke-dasharray: 8 6; }
.angle-word { fill: var(--orange-deep); font-size: 16px; }

.coil-match {
  width: min(96%, 820px);
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  align-content: center;
  padding: 16px 12px 58px;
}
.coil-top { min-height: 0; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(190px, .85fr); align-items: center; gap: 10px; }
.coil-illustration { width: 100%; height: 100%; min-height: 0; }
.coil-illustration svg { display: block; width: 100%; height: 100%; max-height: 145px; }
.coil-shadow { fill: rgba(16,35,60,.13); }
.coil-shell { fill: url(#coil-shell); stroke: var(--navy); stroke-width: 5; }
.coil-window { fill: var(--paper); stroke: var(--navy); stroke-width: 5; }
.coil-winding path { fill: none; stroke: var(--orange-deep); stroke-width: 4; stroke-linecap: round; }
.coil-connector { fill: #dce5ea; stroke: var(--navy); stroke-width: 5; }
.coil-contact { fill: var(--orange); stroke: var(--navy); stroke-width: 3; }
.coil-cable { fill: none; stroke: var(--navy); stroke-width: 7; stroke-linecap: round; }
.coil-tag rect { fill: var(--paper); stroke: var(--navy); stroke-width: 2; }
.coil-tag text { fill: var(--navy); font-size: 10px; font-weight: 900; text-anchor: middle; }
.coil-illustration .svg-label { font-size: 12px; font-weight: 900; }
.coil-nameplate {
  justify-self: center;
  width: min(94%, 520px);
  display: grid;
  gap: 3px;
  padding: 10px 16px;
  border: 3px solid var(--navy);
  border-radius: 12px;
  background: var(--paper);
  text-align: center;
}
.coil-nameplate span { color: var(--orange-deep); font-weight: 900; letter-spacing: .12em; }
.coil-nameplate small { color: var(--muted); }
.check-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-items: stretch; }
.check-card {
  min-width: 0;
  display: grid;
  place-items: center;
  gap: 5px;
  padding: 10px;
  border: 2px solid var(--navy);
  border-radius: 13px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  text-align: center;
}
.check-card span { font-size: 1.65em; color: var(--navy); }
.check-card small { color: var(--muted); line-height: 1.2; }
.check-card.checked { border: 5px double var(--green); background: #e3f5ec; }
.check-card.checked span { color: var(--green); }

.installation-layout {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, .8fr);
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
}
.installation-visual { width: 100%; height: 100%; min-height: 0; }
.installation-visual svg { display: block; width: 100%; height: 100%; }
.installation-card { padding: 12px 14px; border: 2px solid var(--navy); border-radius: 13px; background: var(--paper); }
.installation-card h3 { margin-bottom: 8px; }
.installation-card ul { margin: 0; padding-left: 18px; }
.install-checks circle, .install-verify circle { fill: var(--paper); stroke: var(--green); stroke-width: 6; }
.install-checks path, .install-verify path { fill: none; stroke: var(--green); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.install-braze .flame { fill: var(--orange); stroke: var(--orange-deep); stroke-width: 3; }
.wet-cloth { fill: var(--blue-soft); stroke: var(--navy); stroke-width: 4; }
.wet-fold { fill: none; stroke: var(--blue); stroke-width: 4; stroke-linecap: round; }
.water-drops path { fill: var(--blue); stroke: var(--navy); stroke-width: 2; }
.install-braze text { fill: var(--navy); font-size: 15px; font-weight: 900; text-anchor: middle; }
.install-removed-coil rect { fill: #dce5ea; stroke: var(--navy); stroke-width: 4; }
.install-removed-coil path { fill: none; stroke: var(--blue); stroke-width: 4; stroke-linecap: round; }
.install-removed-coil .lift-arrow { stroke: var(--orange-deep); stroke-width: 5; }
.install-removed-coil text { fill: var(--navy); font-size: 14px; font-weight: 900; text-anchor: middle; }

.coil-safety { width: 100%; height: 100%; position: relative; padding: 6px 10px 56px; }
.coil-safety svg { width: 100%; height: 100%; }
.cs-wire { fill: none; stroke: var(--navy); stroke-width: 7; }
.cs-coil { transition: transform .45s ease; }
.cs-power circle { fill: var(--paper); stroke-width: 6; }
.cs-power path { fill: none; stroke-width: 6; stroke-linecap: round; }
.cs-power text, .cs-danger text, .cs-safe text { font-family: "Trebuchet MS", Calibri, Arial, sans-serif; font-size: 16px; font-weight: 900; text-anchor: middle; }
.power-on circle, .power-on path { stroke: var(--red); }
.power-on text { fill: var(--red); }
.power-off circle, .power-off path { stroke: var(--green); }
.power-off text { fill: var(--green); }
.cs-danger path { fill: #fff4e0; stroke: var(--red); stroke-width: 5; }
.cs-danger text { fill: var(--red); }
.cs-danger text:first-of-type { font-size: 31px; }
.cs-safe circle { fill: #e3f5ec; stroke: var(--green); stroke-width: 6; }
.cs-safe path { fill: none; stroke: var(--green); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.cs-safe text { fill: var(--green); }

.normal-mode-layout {
  width: min(96%, 820px);
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 10px 14px 58px;
}
.normal-mode-heading { display: grid; justify-items: center; gap: 2px; text-align: center; }
.normal-mode-heading .principle-badge { position: static; margin-bottom: 1px; }
.normal-mode-heading strong { color: var(--navy); font-family: "Trebuchet MS", Calibri, Arial, sans-serif; font-size: 1.05em; }
.normal-mode-heading small { color: var(--muted); }
.normal-state-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; min-height: 0; }
.normal-state {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  place-items: center;
  gap: 2px;
  padding: 10px;
  border: 3px solid var(--navy);
  border-radius: 14px;
  background: var(--paper);
  text-align: center;
}
.normal-state.state-open { border: 5px double var(--green); }
.normal-state.state-closed { border: 4px dashed var(--orange-deep); }
.normal-state-order { color: var(--navy); font-weight: 900; }
.normal-state svg { width: 100%; height: 100%; max-height: 155px; }
.normal-state strong { color: var(--navy); font-family: "Trebuchet MS", Calibri, Arial, sans-serif; font-size: 1.15em; }
.normal-state small { color: var(--muted); }
.normal-pipe, .normal-seat { fill: none; stroke: var(--navy); stroke-width: 7; stroke-linecap: round; }
.normal-obturator { fill: none; stroke: var(--navy); stroke-width: 8; stroke-linecap: round; }
.normal-plate { fill: #8b9aa5; stroke: var(--navy); stroke-width: 4; }
.normal-flow { fill: none; stroke: var(--blue); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 14 10; animation: ev-flow 1.2s linear infinite; }
.normal-block { fill: none; stroke: var(--red); stroke-width: 12; stroke-linecap: round; }

.diagnosis-flow { width: min(98%, 900px); height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 7px; padding: 9px 12px 58px; }
.diagnosis-flow h3 { margin: 0; text-align: center; }
.diagnosis-content { min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 9px; }
.diagnosis-illustration { min-width: 0; min-height: 0; display: grid; place-items: center; border: 2px solid var(--navy); border-radius: 13px; background: var(--paper); }
.diagnosis-illustration svg { display: block; width: 100%; height: 100%; }
.diagnosis-flow ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; align-items: stretch; }
.diagnosis-flow li { position: relative; min-width: 0; display: grid; place-items: center; align-content: center; gap: 6px; padding: 10px 8px; border: 2px solid var(--navy); border-radius: 12px; background: var(--paper); text-align: center; }
.diagnosis-flow li span { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 999px; background: var(--navy); color: #fff; font-weight: 900; }
.diagnosis-flow li p { margin: 0; line-height: 1.25; }
.diag-pipe { fill: none; stroke: var(--navy); stroke-width: 13; stroke-linecap: round; }
.diag-body { fill: url(#diag-hatch); stroke: var(--navy); stroke-width: 5; stroke-linejoin: round; }
.diag-body-solid { fill: #ebc96f; stroke: var(--navy); stroke-width: 5; stroke-linejoin: round; }
.diag-cavity { fill: var(--paper); stroke: var(--navy); stroke-width: 4; stroke-linejoin: round; }
.diag-diaphragm { fill: #d7e2e8; stroke: var(--navy); stroke-width: 6; }
.diag-seat { fill: none; stroke: var(--navy); stroke-width: 7; }
.diag-equalizing { fill: var(--paper); stroke: var(--orange-deep); stroke-width: 4; }
.diag-pilot rect { fill: #dce5ea; stroke: var(--navy); stroke-width: 4; }
.diag-pilot path { fill: none; stroke: var(--navy); stroke-width: 7; }
.diag-pilot circle { fill: #82929f; stroke: var(--navy); stroke-width: 3; }
.diag-leak { fill: none; stroke: var(--blue); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 12 9; animation: ev-flow 1.2s linear infinite; }
.diag-chip { fill: var(--red); stroke: var(--navy); stroke-width: 3; }
.diag-callout { fill: none; stroke: var(--red); stroke-width: 3; stroke-dasharray: 7 5; }
.diag-callout-box rect { fill: var(--paper); stroke: var(--red); stroke-width: 3; stroke-dasharray: 7 5; }
.diag-callout-box text { fill: var(--navy); font-size: 11px; font-weight: 900; }
.diag-callout-box text:last-child { fill: var(--red); font-size: 10px; }
.diag-pressure { fill: none; stroke: var(--orange-deep); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 9 8; }
.diag-alert-ring { fill: var(--paper); stroke: var(--orange-deep); stroke-width: 4; stroke-dasharray: 7 4; }
.diag-help { fill: var(--orange-deep); font-size: 18px; font-weight: 900; text-anchor: middle; }
.diag-neck { fill: #cbd7dc; stroke: var(--navy); stroke-width: 4; }
.diag-coil rect:first-child { fill: #dce5ea; stroke: var(--navy); stroke-width: 5; }
.diag-coil path { fill: none; stroke: var(--blue); stroke-width: 4; }
.diag-coil rect:nth-of-type(2) { fill: var(--paper); stroke: var(--navy); stroke-width: 4; }
.diag-coil .diag-wire { stroke: var(--navy); stroke-width: 7; }
.diag-question circle { fill: #fff4e0; stroke: var(--orange-deep); stroke-width: 5; stroke-dasharray: 9 6; }
.diag-question text { fill: var(--orange-deep); font-size: 38px; font-weight: 900; text-anchor: middle; }
.diag-label { fill: var(--navy); font-family: "Trebuchet MS", Calibri, Arial, sans-serif; font-size: 16px; font-weight: 900; }
.diag-sub { fill: var(--muted); font-size: 12px; font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .dv-flow, .sv-flow, .sv-pilot-flow, .sv-equalizing-flow, .normal-flow, .diag-leak, .dv-magnetic { animation: none; }
  .dv-flow, .sv-flow, .sv-pilot-flow, .sv-equalizing-flow, .normal-flow, .diag-leak { stroke-dasharray: none; }
  .dv-moving, .sv-pilot-moving, .cs-coil, .solenoid-location { transition: none; }
}

@media (max-width: 900px) {
  .command-layout { grid-template-columns: minmax(210px, .9fr) minmax(0, 1.1fr); padding-inline: 5px; }
  .command-node { padding: 6px 3px; font-size: .8em; }
  .node-icon { width: 30px; height: 30px; }
  .installation-layout { grid-template-columns: minmax(0, 1.1fr) minmax(180px, .9fr); gap: 6px; padding: 4px; }
  .diagnosis-flow li { padding: 6px 4px; font-size: .82em; }
}

@media (max-width: 700px) {
  .state-pill { min-height: 24px; padding: 2px 7px; font-size: .65em; }
  .ev-label, .orientation-label { font-size: 14px; }
  .ev-bare-note text, .angle-word { font-size: 12px; }
  .dv-state text { font-size: 14px; }
  .dv-small { font-size: 12px; }
  .command-layout { grid-template-columns: minmax(150px, .95fr) minmax(0, 1.05fr); gap: 2px; padding: 2px 3px 34px; }
  .command-chain { gap: 2px; }
  .command-node { padding: 3px 2px; border-width: 1px; border-radius: 7px; font-size: .61em; }
  .command-node.active { border-width: 3px; }
  .command-node small { display: none; }
  .node-icon { width: 22px; height: 22px; }
  .chain-arrow { font-size: 1em; }
  .ev-cutaway, .principle-card, .orientation-scene, .coil-safety { padding-bottom: 34px; }
  .principle-badge { top: 3px; left: 4px; padding: 2px 5px; font-size: .6em; }
  .coil-match { width: 100%; gap: 4px; padding: 4px 4px 34px; }
  .coil-top { grid-template-columns: minmax(0, 1.15fr) minmax(105px, .85fr); gap: 3px; }
  .coil-illustration svg { max-height: 82px; }
  .coil-nameplate { padding: 3px 6px; border-width: 2px; border-radius: 7px; font-size: .64em; }
  .check-grid { gap: 3px; }
  .check-card { gap: 1px; padding: 3px 2px; border-width: 1px; border-radius: 7px; font-size: .62em; }
  .check-card.checked { border-width: 3px; }
  .check-card span { font-size: 1.25em; }
  .installation-layout { grid-template-columns: minmax(0, 1.15fr) minmax(120px, .85fr); gap: 3px; padding: 2px 3px; }
  .installation-card { padding: 4px; border-width: 1px; border-radius: 7px; font-size: .66em; line-height: 1.15; }
  .installation-card h3 { margin-bottom: 2px; font-size: .84em; }
  .installation-card ul { padding-left: 13px; }
  .normal-mode-layout { width: 100%; gap: 3px; padding: 3px 4px 34px; }
  .normal-mode-heading { font-size: .68em; }
  .normal-state-grid { gap: 4px; }
  .normal-state { gap: 0; padding: 3px; border-width: 2px; border-radius: 7px; font-size: .66em; }
  .normal-state.state-open { border-width: 3px; }
  .normal-state.state-closed { border-width: 2px; }
  .normal-state svg { max-height: 90px; }
  .diagnosis-flow { width: 100%; gap: 3px; padding: 3px 4px 34px; }
  .diagnosis-flow h3 { font-size: .76em; }
  .diagnosis-content { grid-template-columns: minmax(140px, 1.1fr) minmax(0, .9fr); gap: 3px; }
  .diagnosis-illustration { border-width: 1px; border-radius: 6px; }
  .diagnosis-flow ol { gap: 3px; }
  .diagnosis-flow li { padding: 3px 2px; border-width: 1px; border-radius: 6px; font-size: .6em; line-height: 1.1; }
  .diagnosis-flow li span { width: 20px; height: 20px; }
}

@media (max-width: 370px), (max-height: 680px) {
  .command-node strong { font-size: .9em; }
  .coil-nameplate small, .check-card small { display: none; }
  .normal-mode-heading small, .normal-state small { display: none; }
  .diagnosis-flow li p { font-size: .9em; }
}
