/* From cuts to real roots — presentation layer (Apache-2.0). Sibling of the nonnested-matchings demo:
   Latin Modern text, KaTeX mathematics, wine #751a2c for identity, teal for success, ochre for witnesses. */
@font-face{font-family:'Latin Modern';src:url('assets/fonts/latin-modern/lmroman10-regular.otf') format('opentype');font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:'Latin Modern';src:url('assets/fonts/latin-modern/lmroman10-italic.otf') format('opentype');font-weight:400;font-style:italic;font-display:swap}
@font-face{font-family:'Latin Modern';src:url('assets/fonts/latin-modern/lmroman12-bold.otf') format('opentype');font-weight:700;font-style:normal;font-display:swap}
@font-face{font-family:'Latin Modern Mono';src:url('assets/fonts/latin-modern/lmmono10-regular.otf') format('opentype');font-weight:400;font-display:swap}

.lab-chapter-link{text-decoration:none!important}
.lab-return{max-width:1120px;margin:12px auto;padding:10px 16px;font-size:15px;line-height:1.4;background:#f5ecee}
:root{
  --wine:#751a2c;--wine-dark:#591321;--wine-tint:#f5ecee;--wine-line:#d9bcc3;
  --ink:#202938;--muted:#536070;--line:#d5d9dc;--soft-line:#e6e9eb;--control-line:#858f98;
  --paper:#f7f6f4;--card:#fff;--panel:#fbfaf8;
  --teal:#246c63;--teal-tint:#e8f2ef;--teal-line:#a9cbc3;
  --ochre:#8a4a10;--ochre-fill:#c98a3c;--ochre-tint:#fbf1e6;--ochre-line:#e3c49f;
  --red:#a32f3c;--red-tint:#fbeceb;--blue:#3d6a96;--blue-tint:#ebf1f7;--slate:#59646c;
  --focus:#ab6070;--radius:9px;
  --serif:'Latin Modern',Georgia,'Times New Roman',serif;--mono:'Latin Modern Mono',Consolas,monospace;
  font-family:var(--serif);font-size:17px;line-height:1.5;color:var(--ink);background:var(--paper);font-synthesis:none;
  font-variant-numeric:lining-nums;
}
*{box-sizing:border-box}
html{scroll-padding-top:12px}
body{margin:0;background:var(--paper);min-width:320px}
h1,h2,h3,h4,p{margin:0}
a{color:var(--wine);text-underline-offset:3px}
a:hover{color:var(--wine-dark)}
button,input,select{font:inherit;color:inherit}
:focus-visible{outline:3px solid var(--focus);outline-offset:3px}
svg :focus-visible{outline:none}
.visually-hidden{position:absolute!important;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
[hidden]{display:none!important}
.skip:not(:focus){position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.skip:focus{position:fixed;z-index:40;top:8px;left:8px;background:#fff;padding:12px;border:2px solid var(--wine)}
.eyebrow{font-size:13px;font-weight:700;letter-spacing:.8px;text-transform:uppercase;color:var(--wine)}
.math{font-family:inherit}.math>.katex{font-size:1.05em}
.katex{text-transform:none;letter-spacing:normal}
.math-display{display:block;overflow-x:auto;overflow-y:hidden;padding:2px 0;max-width:100%}
.mono{font-family:var(--mono)}

/* ---------- Buttons and controls ---------- */
.btn{min-height:44px;min-width:44px;padding:8px 14px;border:1px solid var(--control-line);border-radius:7px;background:#fff;cursor:pointer;font-size:16px;line-height:1.3;-webkit-tap-highlight-color:rgb(117 26 44 / .12);display:inline-flex;align-items:center;justify-content:center;gap:6px;text-align:center}
.btn:hover:not(:disabled){background:#f2efec;border-color:#5d6872}
.btn:disabled{opacity:.5;cursor:default}
.btn[aria-pressed=true]{background:var(--wine);border-color:var(--wine);color:#fff}
.btn[aria-pressed=true]:hover:not(:disabled){background:var(--wine-dark)}
.btn-primary{background:var(--wine);border-color:var(--wine);color:#fff}
.btn-primary:hover:not(:disabled){background:var(--wine-dark);border-color:var(--wine-dark);color:#fff}
.btn-quiet{border-color:transparent;background:transparent;color:var(--wine);text-decoration:underline;text-underline-offset:3px;padding-left:6px;padding-right:6px}
.btn-quiet:hover:not(:disabled){background:var(--wine-tint);border-color:transparent}
.btn.is-right{border-color:var(--teal);background:var(--teal-tint);color:var(--teal)}
.btn.is-right[aria-pressed=true]{background:var(--teal);color:#fff;border-color:var(--teal)}
.btn.is-wrong[aria-pressed=true]{background:var(--ochre-tint);color:var(--ochre);border-color:var(--ochre)}
.btn .mark{font-weight:700}
select{min-height:44px;border:1px solid var(--control-line);border-radius:7px;background:#fff;padding:6px 30px 6px 10px;font-size:16px;max-width:100%}
input[type=range]{width:100%;min-height:44px;accent-color:var(--wine);margin:0}
input[type=file]{font-size:15px;max-width:100%}
label{font-size:15px}
.seg{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.seg-label{font-size:15px;color:var(--muted)}
.seg-options{display:inline-flex;flex-wrap:wrap;gap:0;border:1px solid var(--control-line);border-radius:8px;overflow:hidden;background:#fff}
.seg-options .btn{border:none;border-radius:0;border-right:1px solid var(--line);min-width:52px}
.seg-options .btn:last-child{border-right:none}
.choice{display:flex;flex-direction:column;gap:8px}
.choice-prompt{font-size:16px}
.choice-options{display:flex;flex-wrap:wrap;gap:8px}
.control-row{display:flex;flex-wrap:wrap;align-items:center;gap:10px 14px}
.control-row+.control-row,.choice+.control-row,.control-row+.choice,.choice+.choice{margin-top:10px}
.control-note{font-size:15px;color:var(--muted)}
.slider-row{display:grid;grid-template-columns:auto minmax(140px,1fr) auto;align-items:center;gap:12px;width:100%}
.slider-row output{font-variant-numeric:tabular-nums;min-width:5.5em;text-align:right}

/* ---------- Header and journey ---------- */
.site-head{background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:16px;padding:10px max(20px,calc((100vw - 1440px)/2));min-height:64px}
.identity{display:flex;align-items:center;min-height:44px;flex:none}
.identity img{width:40px;height:40px;display:block}
.site-title h1{font-size:23px;line-height:1.1;font-weight:700;letter-spacing:-.2px}
.site-title p{font-size:15px;color:var(--muted);margin-top:2px}
.site-links{display:flex;gap:20px;margin-left:auto}
.site-links a{display:flex;align-items:center;min-height:44px;font-size:15px;text-decoration:none}
.site-links a:hover{text-decoration:underline}
.journey{display:flex;align-items:stretch;gap:12px;padding:0 max(20px,calc((100vw - 1440px)/2));background:#fff;border-bottom:1px solid var(--line)}
.chapters{display:flex;gap:2px;flex:1;min-width:0;overflow-x:auto;scrollbar-width:thin}
.chapter-tab{border:none;background:transparent;border-bottom:3px solid transparent;border-radius:0;min-height:50px;padding:8px 12px 6px;font-size:16px;color:var(--muted);cursor:pointer;white-space:nowrap;display:flex;align-items:center;gap:8px}
.chapter-tab:hover{color:var(--ink);background:#f6f4f2}
.chapter-tab[aria-current=page]{color:var(--wine);border-bottom-color:var(--wine);background:var(--wine-tint)}
.chapter-tab .num{font-size:12px;letter-spacing:1px;opacity:.75}
.chapter-tab .done-count{font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums}
.chapter-tab[aria-current=page] .done-count{color:var(--wine)}
.chapter-select{display:none}
.journey-tools{display:flex;align-items:center;gap:6px;flex:none;padding:3px 0}
.btn-tool{font-size:15px;padding:6px 10px}
.btn-map{font-size:15px;padding:6px 12px}
.map-count{font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums}
.step-dots{display:flex;gap:6px;flex-wrap:wrap;align-items:center;justify-content:flex-end;max-width:520px;padding-top:4px}
.dot{width:30px;height:30px;min-height:30px;min-width:30px;padding:0;border-radius:50%;border:1.5px solid var(--control-line);background:#fff;font-size:13px;color:var(--muted);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;font-variant-numeric:tabular-nums;position:relative}
.dot::after{content:'';position:absolute;inset:-7px}
.dot:hover{border-color:var(--wine);color:var(--wine)}
.dot.visited{border-color:var(--slate);color:var(--ink)}
.dot.solved,.dot.inspected{background:var(--teal);border-color:var(--teal);color:#fff}
.dot.demonstrated{background:var(--blue-tint);border-color:var(--blue);color:var(--blue);border-style:dashed}
.dot[aria-current=step]{outline:2px solid var(--wine);outline-offset:2px}
.dots-label{font-size:14px;color:var(--muted);margin-right:4px}
.scene-head.many-dots{flex-direction:column;gap:4px}
.scene-head.many-dots .step-dots{justify-content:flex-start;max-width:none;padding-top:2px}
#scene-eyebrow .eb-short{display:none}
.lead-more{display:none}

/* ---------- Scene head ---------- */
main{max-width:1440px;margin:0 auto;padding:10px 20px 18px}
.scene-head{padding:2px 0 10px;display:flex;justify-content:space-between;align-items:flex-start;gap:18px}
.scene-titles{min-width:0;flex:1}
.scene-head h2{font-size:29px;line-height:1.15;letter-spacing:-.4px;margin-top:1px}
.scene-head h2:focus{outline:none}
.scene-head h2:focus-visible{outline:3px solid var(--focus)}
.lead{font-size:17px;color:var(--muted);margin-top:3px;max-width:110ch}

/* ---------- Workspace ---------- */
.workspace{display:grid;grid-template-columns:minmax(0,1fr) 350px;gap:16px;align-items:start}
.stage,.side{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);min-width:0}
.stage{display:flex;flex-direction:column}
.stage-goal{display:block;padding:12px 18px;border-bottom:1px solid var(--soft-line);background:var(--panel);border-radius:var(--radius) var(--radius) 0 0}
.goal-step{font-size:13px;font-weight:700;letter-spacing:.7px;text-transform:uppercase;color:var(--wine);white-space:nowrap;margin-right:10px}
.goal-text{font-size:18px;line-height:1.35}
.action-cue{min-height:2.5em;margin:0;padding:8px 18px 2px;color:var(--wine);font-size:14px;font-weight:650;line-height:1.35;background:var(--panel)}
.completion-action{margin:10px 18px 0;padding:12px 14px;border:1px solid var(--teal);border-radius:8px;background:var(--teal-tint);display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.completion-action[hidden]{display:none}
.completion-action span{font-weight:600}
.goal-text.done{color:var(--teal)}
.stage-controls{padding:12px 18px 4px;display:flex;flex-direction:column;gap:10px}
.stage-controls:empty{display:none}
.stage-figure{padding:8px 14px 4px;min-height:200px;position:relative}
.stage-figure:empty{display:none}
.stage-figure>svg,.fig-main{display:block;width:100%;height:auto;max-height:min(54vh,470px)}
.stage-caption{font-size:15px;color:var(--muted);padding:0 18px 8px}
.stage-caption:empty{display:none}
.stage-feedback{margin:0 18px;min-height:52px;padding:11px 14px;border-left:4px solid var(--slate);background:#f3f4f5;font-size:16px;line-height:1.45;border-radius:0 6px 6px 0}
.stage:has(.cut-lesson) .stage-feedback:empty{display:none}
.stage-feedback.tone-info{border-color:var(--wine);background:var(--wine-tint)}
.stage-feedback.tone-hint{border-color:var(--slate);background:#f3f4f5}
.stage-feedback.tone-warn{border-color:var(--ochre);background:var(--ochre-tint)}
.stage-feedback.tone-success{border-color:var(--teal);background:var(--teal-tint)}
.stage-feedback.tone-fail{border-color:var(--red);background:var(--red-tint)}
.stage-feedback .fb-icon{font-weight:700;margin-right:6px}
.stage-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:8px 12px 10px}
.stage-actions-note{font-size:14px;color:var(--muted);flex:1;min-width:180px}

/* ---------- Side panel ---------- */
.side{padding:16px 18px 18px;display:flex;flex-direction:column;gap:12px}
.side-head{display:flex;justify-content:space-between;align-items:center;gap:8px}
.status-badge{font-size:14px;padding:3px 9px;border-radius:999px;border:1px solid var(--line);color:var(--muted);white-space:nowrap}
.status-badge.solved,.status-badge.inspected{background:var(--teal);border-color:var(--teal);color:#fff}
.status-badge.demonstrated{background:var(--blue-tint);border-color:var(--blue);color:var(--blue)}
.status-badge.progress{border-color:var(--wine-line);color:var(--wine);background:var(--wine-tint)}
.metric{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}
.metric:empty{display:none}
.metric strong{font-size:40px;line-height:1.1;font-weight:400;letter-spacing:-1px;color:var(--teal);font-variant-numeric:tabular-nums}
.metric.warn strong{color:var(--ochre)}.metric.wine strong{color:var(--wine)}.metric.fail strong{color:var(--red)}
.metric span{font-size:15px;color:var(--muted);line-height:1.35}
.tasks{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px;counter-reset:task}
.tasks li{display:grid;grid-template-columns:26px 1fr;gap:8px;font-size:16px;line-height:1.4;align-items:start;padding:6px 8px;border-radius:6px}
.tasks li .box{width:22px;height:22px;border:1.5px solid var(--control-line);border-radius:5px;display:inline-flex;align-items:center;justify-content:center;font-size:14px;margin-top:1px;background:#fff;color:#fff}
.tasks li.done .box{background:var(--teal);border-color:var(--teal)}
.tasks li.done{color:var(--muted)}
.tasks li.current{background:var(--wine-tint)}
.tasks li.current .box{border-color:var(--wine)}
.tasks .task-state{display:block;font-size:13px;color:var(--teal)}
.learned{border:1px solid var(--teal-line);background:var(--teal-tint);border-radius:8px;padding:12px 14px;font-size:16px}
.learned h3{font-size:15px;text-transform:uppercase;letter-spacing:.7px;color:var(--teal);margin-bottom:4px}
.learned p+p{margin-top:8px}
.learned .btn{margin-top:10px}
.evidence{font-size:16px;display:flex;flex-direction:column;gap:8px}
.evidence:empty{display:none}
.evidence h3{font-size:14px;text-transform:uppercase;letter-spacing:.7px;color:var(--muted)}
.evidence p{line-height:1.45}
.evidence dl{display:grid;grid-template-columns:auto 1fr;gap:4px 12px;margin:0}
.evidence dt{color:var(--muted);font-size:15px}
.evidence dd{margin:0;font-variant-numeric:tabular-nums;min-width:0;overflow-wrap:anywhere}
.why{border-top:1px solid var(--soft-line);padding-top:10px;font-size:16px}
.why summary{cursor:pointer;font-weight:700;min-height:36px;display:flex;align-items:center;color:var(--wine)}
.why[open] summary{margin-bottom:6px}
.why p+p{margin-top:8px}
.why .paper-ref{font-size:14px;color:var(--muted)}
.exact-value,.approx-value{display:inline-flex;align-items:baseline;gap:6px;flex-wrap:wrap}
.exact-value .tag,.approx-value .tag{font-size:11px;letter-spacing:.6px;text-transform:uppercase;border-radius:4px;padding:1px 5px;line-height:1.5}
.exact-value .tag{background:var(--teal-tint);color:var(--teal);border:1px solid var(--teal-line)}
.approx-value .tag{background:#fff;color:var(--muted);border:1px dashed var(--control-line)}
.approx-value{color:var(--muted)}
.big-int{font-family:var(--mono);font-size:15px;overflow-wrap:anywhere;word-break:break-all}

/* ---------- Scene nav, scope, footer ---------- */
.scene-nav{display:flex;justify-content:space-between;gap:12px;margin-top:14px}
.scene-nav .btn{min-width:150px;max-width:48%}
.btn-next.ready{background:var(--wine);border-color:var(--wine);color:#fff}
.btn-next.ready:hover{background:var(--wine-dark)}
.btn-next.skip{color:var(--muted)}
.scope-line{margin-top:14px;font-size:15px;color:var(--muted);text-align:center}
.source-note{max-width:1440px;margin:8px auto 0;padding:16px max(20px,calc((100vw - 1440px)/2)) 26px;border-top:1px solid var(--line);font-size:14px;color:var(--muted);display:flex;flex-direction:column;gap:6px}
.source-note .acknowledgments{font-size:13px}
.source-note .demo-rights{font-size:13px}
.source-note nav{display:flex;gap:6px 18px;flex-wrap:wrap}
.source-note nav a{min-height:44px;display:inline-flex;align-items:center}
.noscript{padding:20px;font-size:18px}

/* ---------- Map dialog ---------- */
dialog{border:1px solid var(--line);border-radius:12px;padding:0;max-width:min(980px,96vw);width:100%;max-height:92vh;color:var(--ink);background:#fff}
dialog::backdrop{background:rgb(32 41 56 / .45)}
.dialog-head{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:16px 20px;border-bottom:1px solid var(--soft-line);position:sticky;top:0;background:#fff;z-index:1}
.dialog-head h2{font-size:24px}
.dialog-intro{padding:12px 20px 0;font-size:16px;color:var(--muted)}
.map-legend{display:flex;flex-wrap:wrap;gap:8px 16px;padding:10px 20px 4px;font-size:14px;color:var(--muted)}
.map-legend span{display:inline-flex;align-items:center;gap:6px}
.map-chapter{padding:14px 20px 4px}
.map-chapter h3{font-size:19px;display:flex;gap:10px;align-items:baseline;flex-wrap:wrap}
.map-chapter h3 small{font-size:14px;color:var(--muted);font-weight:400}
.map-chapter>p{font-size:15px;color:var(--muted);margin:2px 0 8px}
.map-rows{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:6px}
.map-row{display:grid;grid-template-columns:30px 1fr;gap:10px;align-items:start;text-align:left;border:1px solid var(--line);border-radius:8px;padding:8px 10px;background:#fff;cursor:pointer;min-height:56px;font-size:15px;line-height:1.35}
.map-row:hover{border-color:var(--wine);background:var(--wine-tint)}
.map-row[aria-current=step]{border:2px solid var(--wine);padding:7px 9px}
.map-row .dot{pointer-events:none}
.map-row strong{display:block;font-size:16px}
.map-row small{display:block;color:var(--muted);font-size:14px}
.dialog-foot{padding:14px 20px 18px;display:flex;justify-content:flex-end}

/* ---------- Generic figure vocabulary (SVG) ---------- */
svg text{font-family:var(--serif);fill:var(--ink);font-size:15px}
svg .lbl-muted{fill:var(--muted)}
svg .lbl-small{font-size:13px}
svg .lbl-big{font-size:20px}
svg .lbl-wine{fill:var(--wine)}
svg .lbl-teal{fill:var(--teal)}
svg .lbl-ochre{fill:var(--ochre)}
svg .lbl-white{fill:#fff}
svg .lbl-bold{font-weight:700}
.axis{stroke:#9aa3aa;stroke-width:1.5;fill:none}
.grid{stroke:#e3e6e8;stroke-width:1;fill:none}
.hit{cursor:pointer;outline:none}
.hit .hit-area{fill:transparent}
.hit:hover .hit-area{fill:rgb(117 26 44 / .07)}
.hit:focus-visible .hit-area{fill:rgb(171 96 112 / .14);stroke:var(--focus);stroke-width:3}
.edge{stroke:#b8bfc5;stroke-width:2;fill:none}
.edge-strong{stroke:var(--teal);stroke-width:4;fill:none}
.fill-face{fill:var(--teal-tint);stroke:var(--teal);stroke-width:2}
.fill-poly{fill:var(--wine-tint);stroke:var(--wine);stroke-width:2}
.mk-wine{fill:var(--wine)}.mk-teal{fill:var(--teal)}.mk-ochre{fill:var(--ochre-fill)}.mk-white{fill:#fff;stroke:var(--slate);stroke-width:2}
.mk-ghost{fill:none;stroke:var(--slate);stroke-width:2;stroke-dasharray:4 4}
.stroke-wine{stroke:var(--wine)}.stroke-teal{stroke:var(--teal)}.stroke-ochre{stroke:var(--ochre)}.stroke-slate{stroke:var(--slate)}
.arrow-wine{fill:var(--wine)}.arrow-teal{fill:var(--teal)}.arrow-slate{fill:var(--slate)}.arrow-ochre{fill:var(--ochre)}

/* ---------- Responsive ---------- */
@media (max-width:1180px){.workspace{grid-template-columns:minmax(0,1fr) 300px}.site-title p{display:none}}
@media (max-width:900px){
  .workspace{grid-template-columns:minmax(0,1fr)}
  .chapters{display:none}
  .chapter-select{display:flex;align-items:center;flex:1;min-width:0;padding:4px 0}
  .chapter-select select{width:100%}
}
@media (max-width:640px){
  :root{font-size:16px}
  .site-head{padding:8px 16px;min-height:56px;gap:12px}
  .identity img{width:36px;height:36px}
  .site-title h1{font-size:19px}
  .site-links{display:none}
  /* One tool row pinned to the top while the page scrolls: Map (which also lists every chapter), Undo, Redo, Reset.
     Whatever the shell or the browser scrolls into view lands below it. */
  html:has(#journey){scroll-padding-top:68px}
  .journey{padding:4px 16px;gap:8px;flex-wrap:nowrap;position:sticky;top:0;z-index:30}
  .chapter-select{display:none}
  .journey-tools{flex:1;gap:6px;padding:0}
  .journey-tools .btn-map{flex:1;justify-content:center}
  .journey-tools .btn-tool{display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px}
  .journey-tools .btn-tool .tool-text{display:none}
  .btn-tool{min-width:44px;padding:6px 8px;font-size:18px}
  .stage-actions-note{display:none}
  .btn-map{padding:6px 10px}
  .lab-return{margin:8px 16px;padding:6px 12px}
  .lab-return-note{display:none}
  main{padding:8px 16px 16px}
  .scene-head{padding:2px 0 8px;flex-direction:column;gap:2px}
  /* The head is short on a phone: a one-line eyebrow, a two-line lead with More, one row of exploration dots. */
  #scene-eyebrow{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-transform:none;letter-spacing:.2px;margin-bottom:4px}
  #scene-eyebrow .eb-long{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
  #scene-eyebrow .eb-short{display:inline}
  .scene-titles{position:relative}
  .lead.is-clamped{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden}
  .lead-more{display:inline-flex;align-items:center;min-height:44px;border:0;padding:0 2px;background:transparent;color:var(--wine);font:inherit;font-size:15px;line-height:1.42;text-decoration:underline;text-underline-offset:3px;cursor:pointer}
  .lead.is-clamped+.lead-more{position:absolute;right:0;bottom:0;min-height:0;padding:0 0 0 30px;background:linear-gradient(to right,rgb(247 246 244 / 0),var(--paper) 26px)}
  .lead.is-clamped+.lead-more::after{content:'';position:absolute;left:0;right:0;top:-24px;bottom:-4px}
  .scene-head,.scene-head.many-dots{align-items:stretch}
  .scene-head .step-dots,.scene-head.many-dots .step-dots{justify-content:flex-start;flex-wrap:nowrap;overflow-x:auto;max-width:none;min-width:0;gap:14px;padding:7px;margin:0 -7px;scrollbar-width:none}
  .step-dots::-webkit-scrollbar{display:none}
  .step-dots .dot{flex:none}
  .dots-label{display:none}
  .scene-head h2{font-size:24px}
  .lead{font-size:15px;line-height:1.42}
  .stage-goal{padding:9px 14px}
  .goal-text{font-size:16px}
  .action-cue{padding:7px 14px 2px}
  .completion-action{margin:10px 12px 0}
  .stage-controls{padding:10px 14px 4px}
  .stage-figure{padding:6px 6px 2px}
  .stage-feedback{margin:0 12px}
  .side{padding:14px}
  .scene-nav .btn{min-width:0;flex:1}
  .slider-row{grid-template-columns:1fr auto}
  .slider-row>span:first-child{grid-column:1/-1}
  .map-rows{grid-template-columns:1fr}
  .source-note{padding:14px 16px 22px}
}
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
@media (forced-colors:active){.btn[aria-pressed=true]{outline:2px solid CanvasText}.dot.solved,.dot.inspected{forced-color-adjust:none}}

/* ---------- Figure layouts ---------- */
.fig-grid{display:grid;gap:14px;align-items:start}
.fig-grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}
.fig-grid>svg,.fig-grid>div>svg{display:block;width:100%;height:auto}
.fig-grid.two>svg{max-height:min(44vh,370px)}
.inline-slider{display:inline-flex;align-items:center;gap:10px;flex:1;min-width:220px;max-width:420px}
.inline-slider span{white-space:nowrap;color:var(--muted)}
.inline-slider output{font-size:19px;min-width:2.5em;font-variant-numeric:tabular-nums}
.panel-title{font-size:14px;font-weight:700;letter-spacing:.5px;text-transform:uppercase;color:var(--muted);margin-bottom:6px}
.panel-empty{font-size:16px;color:var(--muted);padding:10px 0 14px}
.small-note{font-size:15px;color:var(--muted)}
.big-count{font-size:17px}.big-count strong{font-size:34px;font-weight:400;color:var(--teal);margin-right:6px}
details.context{margin:8px 4px 0;font-size:15px}
details.context summary{cursor:pointer;color:var(--wine);min-height:40px;display:flex;align-items:center}
.fig-context{max-width:460px;display:block;width:100%;height:auto}

/* 1 · patterns */
.rank-bridge{border:1px solid var(--soft-line);border-radius:8px;background:var(--panel);padding:7px 11px;min-height:120px}
.rank-bridge-head{font-size:14px;font-weight:700;color:var(--ink);margin:0 0 3px}
.rank-matrix{display:grid;grid-template-columns:minmax(86px,1.2fr) repeat(3,minmax(0,1fr));align-items:center;text-align:center;line-height:1.1}
.rank-axis{text-align:left;color:var(--muted);font-size:13px}
.rank-pos{font-size:14px;color:var(--muted)}
.rank-value{font-size:20px;font-weight:700;color:var(--wine)}
.rank-rank{font-size:21px;font-weight:700;color:var(--teal)}
.rank-arrow{font-size:14px;line-height:12px;color:var(--ink)}
.rank-bridge-result{display:flex;align-items:baseline;justify-content:space-between;gap:4px 12px;flex-wrap:wrap;margin:3px 0 0;font-size:14px}
.rank-bridge-result span{color:var(--muted)}
.rank-bridge-result strong{color:var(--ink)}
.rank-bridge.rank-target{border-color:var(--teal-line)}
.rank-bridge.rank-allowed{border-color:var(--ochre)}
.rank-empty{display:flex;flex-direction:column;justify-content:center;gap:5px}
.rank-empty b{font-size:15px}
.rank-empty span{font-size:14px;line-height:1.3;color:var(--muted);max-width:50ch}
.fig-avoid{grid-template-columns:minmax(0,1fr) 250px}
.fig-avoid .fig-main{max-height:min(42vh,370px)}
.tiles{display:flex;gap:8px;flex-wrap:nowrap}
.move-group{display:inline-flex;gap:8px}
.tile{width:58px;height:58px;font-size:26px;border:2px solid var(--control-line);border-radius:9px;background:#fff;cursor:grab;touch-action:none;font-family:var(--serif)}
.tile:disabled{cursor:default;opacity:.6;border-style:dashed}
.tile.is-sel{border-color:var(--wine);background:var(--wine-tint);box-shadow:0 0 0 2px var(--wine) inset}
.tile.dragging{z-index:2;position:relative;box-shadow:0 6px 16px rgb(0 0 0 / .18);cursor:grabbing}
.dot-plain{fill:var(--wine)}
.dot-picked{fill:var(--teal);stroke:#0f3f39;stroke-width:3}
.dot-label{fill:#fff;font-size:19px;font-weight:700;pointer-events:none}
.pick-line{fill:none;stroke:var(--teal);stroke-width:4;stroke-linejoin:round}
.witness-line{fill:none;stroke:var(--ochre);stroke-width:3;opacity:.85}
.witness-line.w132{stroke-dasharray:12 6}.witness-line.w213{stroke-dasharray:4 5}
.shape-panel{border-left:1px solid var(--soft-line);padding-left:14px;display:flex;flex-direction:column;gap:4px}
.shape-read{display:flex;gap:12px;align-items:center;margin-bottom:10px}
.shape-read p{font-size:16px;line-height:1.35}
.is-forbidden{color:var(--ochre);font-weight:700}.is-allowed{color:var(--muted)}
.shape-key{display:flex;flex-direction:column;gap:8px}
.shape-key>div{display:flex;gap:10px;align-items:center;font-size:15px;line-height:1.3;padding:4px;border-radius:6px}
.shape-key>div.found{background:var(--teal-tint)}
.shape-key .ok{color:var(--teal);font-weight:700}
.glyph{flex:none}.glyph-box{fill:#fff;stroke:var(--line)}.glyph-line{fill:none;stroke:var(--wine);stroke-width:2.5}.glyph-dot{fill:var(--wine)}
.triple{display:inline-block;font-family:var(--mono);font-size:14px;padding:1px 6px;border-radius:4px;background:#f1f2f3;margin:2px 0}
.triple.bad{background:var(--ochre-tint);color:var(--ochre);text-decoration:underline dotted}

/* 2 · cuts */
.cut-lesson{display:grid;gap:10px;width:100%;max-width:700px;align-self:center;padding:12px;border:1px solid var(--soft-line);border-radius:9px;background:#fff}
.cut-lesson-head{display:grid;gap:2px}
.cut-lesson-head small{font-size:12px;font-weight:700;letter-spacing:.7px;color:var(--wine)}
.cut-lesson-head h3{font-size:20px;line-height:1.2;margin:0}
.cut-lesson>p{font-size:16px;line-height:1.38;margin:0}
.cut-lesson-track{display:grid;grid-template-columns:minmax(0,1fr) 42px minmax(0,1fr) 42px minmax(0,1fr) 42px minmax(0,1fr);gap:2px;align-items:stretch;min-width:0}
.cut-lesson-place,.cut-lesson-gap{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;min-width:0;min-height:68px;border-radius:7px}
.cut-lesson-place{border:2px solid var(--line);background:#fff}
.cut-lesson-place.left-group{border-color:var(--wine);background:var(--wine-tint)}
.cut-lesson-place.right-group{border-color:var(--teal);background:var(--teal-tint)}
.cut-lesson-place small{font-size:11px;color:var(--muted);line-height:1.1}
.cut-lesson-place strong{font-size:27px;font-weight:400;line-height:1.1}
.cut-lesson-gap{color:var(--muted);font-size:12px;line-height:1.1}
.cut-lesson-gap small{font-size:10px;line-height:1.1}
.cut-lesson-gap b{font-size:14px;font-weight:700}
.cut-lesson-gap.is-cut{background:var(--wine);color:#fff}
.cut-lesson-note{padding:7px 9px;border-left:3px solid var(--teal);background:var(--teal-tint)}
.cut-lesson-next{justify-self:start}
.cut-challenge:focus-visible{outline:3px solid var(--focus);outline-offset:2px}
.cut-challenge .choice{border-top:1px solid var(--soft-line);padding-top:9px}
.cut-challenge .choice-prompt{font-weight:700}
@media (max-width:480px){.cut-lesson-track{grid-template-columns:minmax(0,1fr) 34px minmax(0,1fr) 34px minmax(0,1fr) 34px minmax(0,1fr)}.cut-lesson-place strong{font-size:25px}.cut-lesson-gap small{font-size:9px}}
.cut-workflow{max-width:690px;margin:0 auto;display:grid;gap:10px;padding:2px 2px 8px}
.cut-flow-heading{font-size:16px;line-height:1.35;margin:0}
.cut-flow-heading b{color:var(--wine)}
.cut-target{font-size:16px;margin:0}
.fixed-slots{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;width:100%;max-width:690px;margin:0 auto}
.fixed-slot{min-height:62px;border:2px solid var(--line);border-radius:8px;background:#fff;display:flex;align-items:center;justify-content:center;flex-direction:column;min-width:0}
.fixed-slot span{font-size:12px;color:var(--muted)}
.fixed-slot strong{font-size:25px;font-weight:400;line-height:1.2}
.fixed-switches{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;width:75%;max-width:518px;margin:0 auto}
.fixed-switch{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;min-width:0;min-height:50px;border:1.5px solid var(--control-line);border-radius:8px;background:#fff;text-align:center;font-family:var(--serif);line-height:1.1;padding:4px}
button.fixed-switch{cursor:pointer}
.fixed-switch small{font-size:12px;color:var(--muted)}
.fixed-switch b{font-size:14px;font-weight:700}
.fixed-switch.on{border-color:var(--wine);background:var(--wine-tint)}
.fixed-switch.on b{color:var(--wine)}
.value-bank{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:6px 9px;border:1px solid var(--soft-line);border-radius:7px;background:var(--panel);font-size:15px}
.value-bank small{color:var(--muted)}
.value-bank>div{display:flex;gap:7px}
.value-bank b{display:inline-flex;width:30px;height:30px;border:1px solid var(--line);border-radius:6px;align-items:center;justify-content:center;background:#fff;font-size:20px;font-weight:400}
.value-bank b.used{opacity:.45;text-decoration:line-through}
.cut-allocation{display:grid;gap:9px}
.allocation-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
.allocation-cards.two{grid-template-columns:repeat(2,minmax(0,1fr))}
.allocation-card{display:flex;flex-direction:column;gap:3px;border:1px solid var(--soft-line);border-top:3px solid var(--teal);border-radius:7px;background:#fff;padding:7px;min-width:0;text-align:center}
.allocation-card.incorrect{border-top-color:var(--ochre);background:var(--ochre-tint)}
.allocation-card small{font-size:12px;color:var(--muted)}
.allocation-card span{font-size:13px;line-height:1.2}
.allocation-card strong{font-size:23px;font-weight:400;line-height:1.1;letter-spacing:1px}
.allocation-card em{font-size:12px;color:var(--muted);font-style:normal}
.cut-result{margin:0;padding:7px 10px;border-left:3px solid var(--teal);background:var(--teal-tint);font-size:15px;line-height:1.35}
.cut-result.incorrect{border-color:var(--ochre);background:var(--ochre-tint)}
.cut-rule{margin:0;font-size:15px;line-height:1.35;color:var(--muted)}
.cut-worked{padding:7px 9px;border:1px solid var(--soft-line);border-radius:7px;background:var(--panel);font-size:15px;line-height:1.35}
.inverse-pairs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;text-align:center}
.inverse-pairs span{padding:6px 3px;border:1px solid var(--soft-line);border-radius:6px;font-size:14px;white-space:nowrap}
.cut-count-groups{display:grid;gap:7px}
.cut-count-group{display:grid;grid-template-columns:68px minmax(0,1fr) 68px;align-items:center;gap:6px;padding:6px 8px;border:1px solid var(--soft-line);border-radius:7px;background:#fff;font-size:13px}
.cut-count-group>b{color:var(--wine)}
.cut-count-group>span{display:flex;gap:5px;flex-wrap:wrap}
.cut-count-group i{font:13px var(--mono);font-style:normal;border:1px solid var(--line);border-radius:4px;padding:2px 5px;white-space:nowrap}
.cut-count-group>strong{text-align:right;font-size:12px}
.gallery{width:100%;margin-top:6px}
.gallery-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.gallery-grid.six{grid-template-columns:repeat(3,minmax(0,1fr))}
.g-card{flex-direction:column;align-items:flex-start;gap:0;padding:6px 10px;text-align:left}
.g-card.static{display:flex;border:1px solid var(--line);border-radius:8px;background:#fff;font-size:15px}
.g-perm{font-size:19px}.g-cuts{font-size:13px;color:var(--muted)}
.btn[aria-pressed=true] .g-cuts{color:#f0dfe3}
.sum-line{margin-top:8px;font-size:17px;text-align:center}

/* 3 · faces */
.fig-faces{grid-template-columns:minmax(0,1.5fr) minmax(170px,1fr);align-items:center}
.fig-cube{max-height:min(50vh,430px)}
.seg-stack{display:flex;flex-wrap:wrap;gap:10px 22px}
.cube-edge{stroke:#c8ced3;stroke-width:2;fill:none}
.cube-edge.k2{stroke-dasharray:9 6}.cube-edge.k3{stroke-dasharray:2 5 9 5}
.cube-edge.on{stroke:var(--teal);stroke-width:4}
.corner-on{fill:var(--teal)}
.corner-off{fill:#eef0f1;stroke:#a7afb5;stroke-width:1.5}
.ring-keep{fill:none;stroke:var(--teal);stroke-width:3}
.cross-remove{stroke:var(--ochre);stroke-width:4;stroke-linecap:round}
.cross-white{stroke:#fff;stroke-width:3;stroke-linecap:round}
.corner-perm{font-size:16px;font-weight:700}
.corner.off .corner-perm{font-weight:400}
.face-side{display:flex;flex-direction:column;gap:12px}
.mini-legend{display:flex;flex-direction:column;gap:4px;font-size:15px}
.mini-legend span{display:flex;align-items:center;gap:8px}

/* 4 · deficits */
.deficit-grid-task{margin:0;padding:6px 10px;border-left:3px solid var(--wine);background:var(--wine-tint);font-size:14px;line-height:1.35}
.meter-max{fill:#fff;stroke:#a7afb5;stroke-width:1.5;stroke-dasharray:4 3}
.meter-fill{fill:var(--wine)}
.meter-gap{fill:var(--ochre-tint);stroke:var(--ochre);stroke-width:1.5}
.grid-pt{fill:#9aa3aa}
.edge-label{font-size:14px;fill:var(--wine);font-style:italic}
.mk-ink{fill:var(--ink)}

/* 5 · shape vs connections */
.face-fill{fill:var(--wine-tint);stroke:#c4a9b0;stroke-width:2}
.edge-A{stroke:var(--wine);stroke-width:6;stroke-linecap:round}
.edge-B{stroke:var(--teal);stroke-width:6;stroke-linecap:round}
.edge-name{font-size:24px;font-weight:700}
.residual{stroke:var(--ochre);stroke-width:3;stroke-dasharray:6 5}
.drag-copy{cursor:grab}.drag-zone{fill:transparent;stroke:var(--teal);stroke-dasharray:4 4;stroke-width:1.5}
.slider-row output{font-size:20px}

/* 6 · volume */
.piece-card{border:1px solid var(--soft-line);border-radius:8px;padding:8px 10px;background:var(--panel)}
.piece-card svg{display:block;width:100%;height:auto}
.piece-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px;align-items:center}
.fig-path{max-height:200px}
.volume-live{display:none}
.piece-rule{grid-column:1/-1;margin:0 0 4px;color:var(--wine);font-weight:600}
.piece-context-edge{stroke:#cbd0d6;stroke-width:1.5;fill:none}
.piece-face{fill:var(--teal);fill-opacity:.13;stroke:none}
.piece-diagonal{stroke:var(--wine);stroke-width:2;stroke-dasharray:4 3;fill:none}
.chain-step{stroke:var(--teal);stroke-width:6;stroke-linecap:round}
.piece-corners{font-size:14px;color:var(--muted);text-align:center;font-variant-numeric:tabular-nums}
.piece-formula{text-align:center;font-size:18px;margin-top:2px}
.tetra-face{fill:var(--wine);fill-opacity:.08}
.split{fill:#ece4e6}.split.hl{fill:var(--teal)}
svg .lbl-strip{font-size:15px}
.mk-white{fill:#fff;stroke:#9aa3aa;stroke-width:1.5}
.copy-jump{display:none}
.affine-copy-panel{min-width:0;scroll-margin-top:16px}
.affine-copy-panel>svg{display:block;width:100%;height:auto;max-height:min(44vh,370px)}
.compare-context{margin:8px 0;padding:8px 11px;border-left:3px solid var(--ochre);background:var(--ochre-tint);font-size:14px;line-height:1.4}

@media (max-width:900px){.fig-avoid{grid-template-columns:minmax(0,1fr)}.shape-panel{border-left:none;padding-left:0;border-top:1px solid var(--soft-line);padding-top:10px}.shape-key{flex-direction:row;flex-wrap:wrap}}
@media (max-width:640px){
  .copy-jump{display:inline-flex}
  .fig-grid.two{grid-template-columns:minmax(0,1fr)}
  .fig-faces{grid-template-columns:minmax(0,1fr)}
  .tile{width:54px;height:54px}
  .cut-cell{width:56px}.cut-val{font-size:26px}.gap{width:44px;margin:0 2px}.gap-name{font-size:11px}
  .gallery-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.gallery-grid.six{grid-template-columns:repeat(2,minmax(0,1fr))}
  .seg-stack{flex-direction:column;gap:8px}
}

/* ---------- shared small pieces ---------- */
.ok{color:var(--teal);font-weight:700}.no{color:var(--ochre);font-weight:700}
.todo{color:var(--muted);font-style:italic}
.center{text-align:center}
.calc-card{border:1px solid var(--soft-line);background:var(--panel);border-radius:8px;padding:10px 12px;font-size:16px;margin-top:8px}
.calc-card p+p{margin-top:6px}
.badge{display:inline-block;font-size:13px;border-radius:999px;padding:1px 9px;border:1px solid var(--line);margin-left:6px;white-space:nowrap}
.badge.yes{background:var(--teal-tint);border-color:var(--teal-line);color:var(--teal)}
.badge.no{background:var(--ochre-tint);border-color:var(--ochre-line);color:var(--ochre)}
.ehr-table{border-collapse:collapse;width:100%;font-size:16px;font-variant-numeric:tabular-nums}
.ehr-table caption{text-align:left;font-size:15px;color:var(--muted);padding-bottom:6px}
.ehr-table th,.ehr-table td{border-bottom:1px solid var(--soft-line);padding:7px 8px;text-align:left;vertical-align:top}
.ehr-table thead th{font-size:14px;color:var(--muted);font-weight:700}
.ehr-table tr.cur{background:var(--wine-tint)}
.ehr-table tfoot th,.ehr-table tfoot td{border-bottom:none;padding-top:9px}
.bar-wine{fill:var(--wine)}.bar-teal{fill:var(--teal)}
.bar-neg{fill:var(--ochre-fill);stroke:var(--ochre);stroke-width:1.5;stroke-dasharray:4 2}
.bar-wine.sel,.bar-neg.sel{stroke:var(--ink);stroke-width:3;stroke-dasharray:none}
.chip-row{display:flex;flex-wrap:wrap;gap:6px}
.num-chip{display:inline-flex;flex-direction:column;align-items:center;border:1px solid var(--line);border-radius:6px;padding:4px 9px;background:#fff;font-variant-numeric:tabular-nums;min-width:56px}
.num-chip small{font-size:12px;color:var(--muted)}
.formula-note{font-size:15px;color:var(--muted);margin-top:10px}
.deeper{margin-top:6px}.deeper summary{cursor:pointer;color:var(--wine);min-height:36px;display:flex;align-items:center}
.flow{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:10px 0}
.flow-box{border:1px solid var(--line);border-radius:8px;padding:8px 12px;background:#fff;display:flex;flex-direction:column;gap:2px;min-width:0;max-width:100%;overflow-x:auto}
.flow-box small{font-size:13px;color:var(--muted)}
.flow-box.ok{border-color:var(--teal-line);background:var(--teal-tint)}
.flow-box.bad{border-color:var(--ochre);background:var(--ochre-tint)}
.flow-op{font-size:18px;color:var(--muted)}

/* 7 · three coordinates */
.fig-q3{max-height:min(46vh,380px)}
.ring-seen{fill:none;stroke:var(--teal);stroke-width:2;stroke-dasharray:3 3}
.coord-stack{display:flex;flex-direction:column;gap:4px;font-size:17px}
.coord-row{display:flex;align-items:baseline;flex-wrap:wrap;gap:8px;border:1px solid var(--soft-line);border-radius:8px;padding:8px 12px;background:#fff}
.coord-name{color:var(--muted);font-size:15px;min-width:9.5em}
.coord-val{font-size:22px;font-variant-numeric:tabular-nums}
.coord-map{font-size:15px;color:var(--muted);padding-left:14px;border-left:2px solid var(--line);margin-left:16px}

/* 8 · Ehrhart */
.pt-int{fill:var(--teal)}
.pt-bd{fill:#fff;stroke:var(--wine);stroke-width:2}
.ehr-panel{display:flex;flex-direction:column;gap:6px}
.stepper-group{display:inline-flex;gap:16px;flex-wrap:wrap}
.stepper{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);border-radius:8px;padding:2px 6px;background:#fff}
.stepper output{min-width:1.5em;text-align:center;font-size:20px;font-variant-numeric:tabular-nums}
.stepper .btn{min-width:40px;padding:4px 10px;font-size:18px}

/* 9 · tournaments */
.fig-tour{max-height:min(46vh,380px)}
.t-arrow{stroke:var(--wine);stroke-width:3.5}
.player{fill:#fff;stroke:var(--wine);stroke-width:3}
.landau{display:flex;flex-direction:column;gap:8px}

/* 10 · Burnside */
.fig-hex{max-height:min(48vh,400px)}
.hexagon{fill:none;stroke:#b8bfc5;stroke-width:1.5}
.chamber{fill:var(--wine-tint);stroke:var(--wine-line);stroke-width:1.5}
.mirror{stroke:var(--teal);stroke-width:2.5;stroke-dasharray:8 5}
.rot-arc{fill:none;stroke:var(--teal);stroke-width:3}
.ring-fixed{fill:none;stroke:var(--teal);stroke-width:3}
.group-btns{display:flex;flex-wrap:wrap;gap:6px}
.group-btns .btn{font-size:15px;padding:6px 10px}
.burn-table td,.burn-table th{font-size:15px}

/* 11 · basis */
.perm-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(205px,1fr));gap:8px;margin-bottom:10px}
.perm-card{border:1.5px solid var(--line);border-radius:9px;padding:6px 6px 4px;background:#fff;display:flex;flex-direction:column;align-items:center;gap:2px}
.perm-card.ok{border-color:var(--teal);background:var(--teal-tint)}
.perm-card.bad{border-color:var(--ochre)}
.perm-letters{display:flex;align-items:center}
.letter{font-size:24px;width:22px;text-align:center}
.desc-gap{min-width:30px;min-height:40px;padding:2px 4px;font-size:18px;border-style:dashed;margin:0 1px}
.desc-gap[aria-pressed=true]{background:var(--wine);color:#fff;border-style:solid}
.perm-state{font-size:13px;color:var(--muted);min-height:18px}
.perm-card.ok .perm-state{color:var(--teal);font-weight:700}
.fig-bars{max-width:340px;max-height:180px}
.basis-table tr.added{background:var(--teal-tint)}
.basis-table td .btn{min-height:36px;padding:4px 10px;font-size:15px}

/* 12 · obstruction */
.fig-coords{max-height:min(40vh,300px)}
.h-row{display:flex;flex-direction:column;gap:6px}

/* 13 · sharp */
.fig-line{max-height:min(36vh,260px)}
.sq-repair{fill:#fff;stroke:var(--teal);stroke-width:2.5}
.sq-moving{fill:#fff;stroke:var(--teal);stroke-width:3.5}
.sq-moving.hit-star{fill:var(--teal);stroke:#0f3f39}
.gap-line{stroke:var(--teal);stroke-width:5;stroke-linecap:round}
.gap-line.over{stroke:var(--ochre)}

/* 14 · tails */
.coef-row{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:6px;margin-bottom:10px}
.coef-cell{border:1.5px solid var(--line);border-radius:8px;padding:6px;background:#fff;display:flex;flex-direction:column;gap:3px;font-size:14px;min-width:0;overflow:hidden}
.coef-cell small{color:var(--muted);font-size:12px}
.coef-cell.endpoint{background:#f4f5f6;border-style:dashed}
.coef-cell.has{border-color:var(--teal-line)}
.coef-cell.active{border-color:var(--teal);box-shadow:0 0 0 2px var(--teal) inset}
.coef-a{font-size:14px;overflow-x:auto}
.register{border:1px solid var(--soft-line);border-radius:9px;padding:10px 12px;background:var(--panel)}
.reg-flow{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:6px 0}
.reg-box{border:1px solid var(--line);border-radius:8px;padding:6px 10px;background:#fff;display:flex;flex-direction:column;gap:2px;max-width:100%;overflow-x:auto}
.reg-box small{font-size:12px;color:var(--muted)}
.reg-box.hidden-val{border-style:dashed;color:var(--muted);font-size:20px;align-items:center}
.reg-op{font-size:15px;color:var(--muted)}
.sign-test{font-size:15px;display:flex;flex-direction:column;gap:4px}

/* ---------- verifier workbench ---------- */
.workbench{display:flex;flex-direction:column;gap:8px}
.wb-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:10px 14px}
.wb-field{display:flex;flex-direction:column;gap:3px;font-size:14px;color:var(--muted)}
.wb-field select{min-width:150px}
.wb-file input{font-size:14px;max-width:280px}
.wb-status{font-size:15px;color:var(--muted);align-self:center}
.wb-status.status-passed{color:var(--teal);font-weight:700}
.wb-status.status-failed{color:var(--red);font-weight:700}
.wb-status.status-running,.wb-status.status-paused{color:var(--wine);font-weight:700}
.pipeline{list-style:none;margin:0 0 8px;padding:0;display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:4px}
.pipeline-compact{display:none}
.pipe{width:100%;min-height:58px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;padding:4px 2px;border:1px solid var(--line);border-radius:7px;background:#fff;cursor:pointer;font-size:12px;line-height:1.15;text-align:center}
.pipe:hover{border-color:var(--wine)}
.pipe-n{font-size:12px;color:var(--muted)}
.pipe-name{font-size:12px}
.pipe-count{font-size:13px;font-variant-numeric:tabular-nums;color:var(--muted)}
.pipe.seen{background:var(--teal-tint);border-color:var(--teal-line)}
.pipe.seen .pipe-count{color:var(--teal);font-weight:700}
.pipe.failed{background:var(--red-tint);border-color:var(--red)}
.pipe.failed .pipe-count{color:var(--red);font-weight:700}
.pipe.here{border:2px solid var(--wine);box-shadow:0 0 0 1px var(--wine) inset}
.pipe.live{outline:2px dashed var(--wine);outline-offset:1px}
.live-banner{font-size:15px;background:var(--wine-tint);border-radius:6px;padding:4px 10px;margin-bottom:6px}
.browser{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-bottom:8px}
.browser .btn{min-width:44px;padding:4px 8px}
.browser-pos{font-size:15px;font-variant-numeric:tabular-nums;padding:0 6px}
.follow-tag{font-size:13px;color:var(--teal);border:1px solid var(--teal-line);border-radius:999px;padding:1px 8px}
.stage-panel{min-height:150px}
.empty-stage{border:1px dashed var(--control-line);border-radius:9px;padding:16px;display:flex;flex-direction:column;gap:10px;align-items:flex-start;background:var(--panel);font-size:16px}
.csv-view{border-collapse:collapse;width:100%;font-size:14px}
.csv-view th{color:var(--muted);font-weight:400;text-align:right;padding:2px 8px 2px 0;width:3em;font-variant-numeric:tabular-nums}
.csv-view td{padding:2px 6px;border-left:2px solid var(--soft-line)}
.csv-view tr.changed td{background:var(--ochre-tint);border-left-color:var(--ochre)}
.csv-view tr.bad td{background:var(--red-tint);border-left-color:var(--red)}
.change-note{font-size:15px;color:var(--ochre);margin-top:6px}
.reject-note{font-size:15px;color:var(--red);font-weight:700;margin-top:6px}
.rules{list-style:none;margin:0 0 8px;padding:0;display:flex;flex-direction:column;gap:3px;font-size:15px}
.rules li{display:flex;gap:8px}
.rules li.ok span{color:var(--teal);font-weight:700}
.rules li.bad{color:var(--red);font-weight:700}
.b-head{font-size:16px;margin:4px 0 8px;overflow-x:auto;overflow-y:hidden;padding:4px 0}
.b-question{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-bottom:8px}
.div-chips{display:flex;flex-wrap:wrap;gap:4px}
.div-chips .btn{min-width:44px;padding:4px 8px}
.tile-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:8px}
.div-tile{border:1px solid var(--soft-line);border-radius:8px;padding:8px 10px;background:var(--panel);font-size:15px;overflow-x:auto}
.delta-table td,.delta-table th{font-size:15px}
.delta-table{display:block;overflow-x:auto}
.terms{display:flex;flex-direction:column;gap:4px}
.term-row{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(60px,1fr) auto;gap:8px;align-items:center;font-size:14px}
.term-label{overflow-x:auto}
.term-bar{height:14px;border-radius:3px;display:block}
.term-bar.pos{background:var(--teal)}.term-bar.neg{background:repeating-linear-gradient(45deg,var(--ochre-fill) 0 4px,#f3dcc0 4px 8px);border:1px solid var(--ochre)}
.term-val{font-variant-numeric:tabular-nums;text-align:right}
.compare{margin-top:8px;font-size:16px}
.mismatch{margin-top:10px}
.base-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.base-grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}
.base-card{border:1px solid var(--line);border-radius:8px;padding:8px 10px;background:#fff;font-size:15px;overflow-x:auto}
.base-card.ok{border-color:var(--teal-line);background:var(--teal-tint)}
.sign-tree{display:flex;flex-direction:column;gap:8px}
.branches{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.branch{border:1px dashed var(--line);border-radius:8px;padding:6px 8px;font-size:14px;display:flex;flex-direction:column;color:var(--muted)}
.branch.on{border:2px solid var(--teal);color:var(--ink);background:var(--teal-tint)}
.sq-compare{font-size:15px}
.d-grid{display:flex;flex-wrap:wrap;gap:4px;margin:6px 0 10px}
.d-grid span{width:30px;height:30px;border:1px solid var(--line);border-radius:5px;display:inline-flex;align-items:center;justify-content:center;font-size:13px;color:var(--muted);background:#fff}
.d-grid span.done{background:var(--teal);border-color:var(--teal);color:#fff}
.receipt{border:2px solid var(--teal);border-radius:10px;padding:12px 16px;background:#fff;font-size:15px}
.receipt.stale{border-color:var(--control-line);border-style:dashed}
.receipt.rejected{border-color:var(--red);background:var(--red-tint)}
.receipt-head{font-size:18px;font-weight:700;color:var(--teal);margin-bottom:6px}
.receipt.rejected .receipt-head{color:var(--red)}.receipt.stale .receipt-head{color:var(--muted)}
.receipt dl{display:grid;grid-template-columns:auto minmax(0,1fr);gap:4px 14px;margin:0 0 8px}
.receipt dt{color:var(--muted)}.receipt dd{margin:0;overflow-wrap:anywhere}
.receipt-scope{border-top:1px solid var(--soft-line);padding-top:8px}
.stale-note{color:var(--ochre);margin-top:6px}
.alg{font-size:14px}.alg summary{cursor:pointer;color:var(--wine);min-height:36px;display:flex;align-items:center;font-size:15px}
.alg-lines{list-style:none;margin:4px 0;padding:0;font-family:var(--serif)}
.alg-lines li{display:grid;grid-template-columns:2em 1fr;gap:4px;padding:1px 4px;border-radius:4px;white-space:pre-wrap}
.alg-lines li.hl{background:var(--wine-tint);font-weight:700}
.alg-lines .ln{color:var(--muted);text-align:right}
.alg-lines .in1{padding-left:1.1em}.alg-lines .in2{padding-left:2.2em}.alg-lines .in3{padding-left:3.3em}
.alg-lines li{white-space:normal}

/* ---------- chapter 5 ---------- */
.fig-cov{max-height:min(34vh,260px)}
.cov-fwd{fill:var(--wine)}.cov-rev{fill:#fff;stroke:var(--teal);stroke-width:2}
.cov-pos{fill:var(--teal-tint);stroke:var(--teal);stroke-width:1.5}
.cov-unk{fill:#fff;stroke:#a7afb5;stroke-width:1.5;stroke-dasharray:3 3}
.cov-end{fill:#eceef0;stroke:#a7afb5;stroke-width:1.5}
.fig-cov .sel{stroke:var(--ink);stroke-width:3}
.fig-cov .used{stroke:var(--ochre);stroke-width:3}
.cutoff{stroke:var(--ochre);stroke-width:2.5;stroke-dasharray:6 4}
.use-bracket{fill:none;stroke:var(--ochre);stroke-width:3}
.cov-legend{display:flex;flex-wrap:wrap;gap:6px 18px;font-size:14px;color:var(--muted);margin-top:6px}
.cov-legend span{display:inline-flex;align-items:center;gap:6px}
.sw{display:inline-block;width:18px;height:14px;border-radius:3px}
.sw.cov-fwd{background:var(--wine)}.sw.cov-rev{background:#fff;border:2px solid var(--teal)}.sw.cov-pos{background:var(--teal-tint);border:1.5px solid var(--teal)}.sw.cov-unk{background:#fff;border:1.5px dashed #a7afb5}.sw.cov-end{background:#eceef0;border:1.5px solid #a7afb5}
.fig-waterfall{max-height:min(38vh,280px)}
.target-line{stroke:var(--teal);stroke-width:2;stroke-dasharray:7 4}
.term-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.term-card{border:1px solid var(--line);border-radius:8px;padding:8px 10px;background:#fff;font-size:15px;display:flex;flex-direction:column;gap:4px}
.term-card.added{background:var(--teal-tint);border-color:var(--teal-line)}
.term-card .btn{min-height:38px;padding:4px 10px;font-size:15px}
.fig-pmf{max-height:min(38vh,280px)}
.mean-line{stroke:var(--teal);stroke-width:2;stroke-dasharray:5 4}
.fig-budget{max-height:min(34vh,240px)}
.budget-ref{fill:var(--teal)}
.budget-err{fill:#e9c9cf;stroke:var(--wine);stroke-width:1.5}
.budget-over{fill:var(--ochre-tint);stroke:var(--ochre);stroke-width:2;stroke-dasharray:6 3}
.budget-per{fill:#f1e3cf;stroke:var(--ochre);stroke-width:1.5}
.budget-margin{fill:var(--teal-tint);stroke:var(--teal);stroke-width:2}
.budget-verdict{font-size:17px;text-align:center;margin-top:4px}
.err-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.err-card{display:flex;flex-direction:column;align-items:flex-start;gap:3px;text-align:left;border:1px solid var(--line);border-radius:8px;background:#fff;padding:8px 10px;cursor:pointer;font:inherit;font-size:15px;min-height:76px}
.err-card.opened{border-color:var(--teal-line);background:var(--teal-tint)}
.err-card.sel{box-shadow:0 0 0 2px var(--wine) inset}
.err-card .mono{font-size:13px;overflow-wrap:anywhere}
.scope-controls{display:flex;flex-direction:column;gap:8px}
.scope-row .seg-label{min-width:9.5em}
.scope-line-fig{display:grid;grid-template-columns:.6fr 1.3fr 1.6fr 1.3fr;gap:4px;margin:6px 0}
.scope-seg{border:2px dashed var(--line);border-radius:8px;padding:10px;display:flex;flex-direction:column;gap:3px;background:#fff;min-height:74px}
.scope-seg strong{font-size:16px}.scope-seg span{font-size:14px;color:var(--muted)}
.scope-seg.ok{border-style:solid}
.scope-seg.ok.trivial{background:#f1f2f3;border-color:var(--slate)}
.scope-seg.ok.certificate{background:var(--teal-tint);border-color:var(--teal)}
.scope-seg.ok.analytic{background:var(--blue-tint);border-color:var(--blue)}
.scope-seg.ok.open{background:var(--ochre-tint);border-color:var(--ochre)}
.scope-seg.bad{border-color:var(--red);background:var(--red-tint)}
.claims{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin-top:10px}
@media (max-width:1180px){.claims{grid-template-columns:minmax(0,1fr)}}
.claim{display:grid;grid-template-columns:minmax(0,1fr) auto 24px;gap:10px;align-items:center;border:1px solid var(--line);border-radius:8px;padding:6px 10px;background:#fff;font-size:15px}
.claim.ok{border-color:var(--teal-line);background:var(--teal-tint)}
.claim.bad{border-color:var(--ochre);background:var(--ochre-tint)}
.claim-mark{font-weight:700}
.claim.ok .claim-mark{color:var(--teal)}.claim.bad .claim-mark{color:var(--ochre)}
.claim select{min-width:150px}

@media (max-width:1180px){.pipeline{grid-template-columns:repeat(6,minmax(0,1fr))}}
@media (max-width:640px){
  .pipeline-wide{display:none}
  .pipeline-compact{display:block;margin:0 0 8px}
  .pipeline-compact summary{cursor:pointer;color:var(--wine);font-size:14px;font-weight:700;padding:8px 10px;border:1px solid var(--line);border-radius:7px;background:#fff}
  .pipeline-compact[open] summary{margin-bottom:8px}
  .pipeline-compact .pipeline{grid-template-columns:repeat(4,minmax(0,1fr))}
  .pipe{min-height:50px}
  .perm-grid{grid-template-columns:minmax(0,1fr)}
  .coef-row{grid-template-columns:repeat(4,minmax(0,1fr))}
  .base-grid,.branches{grid-template-columns:minmax(0,1fr)}
  .term-grid,.err-grid{grid-template-columns:minmax(0,1fr)}
  .scope-line-fig{grid-template-columns:repeat(2,minmax(0,1fr))}
  .claim{grid-template-columns:minmax(0,1fr) 24px}.claim label{grid-column:1/2}
  .coord-name{min-width:0}
  .wb-field select{min-width:0;width:100%}.wb-field{flex:1 1 140px}
}

.term-bar.w0{width:2%}.term-bar.w5{width:5%}.term-bar.w10{width:10%}.term-bar.w15{width:15%}.term-bar.w20{width:20%}.term-bar.w25{width:25%}.term-bar.w30{width:30%}.term-bar.w35{width:35%}.term-bar.w40{width:40%}.term-bar.w45{width:45%}.term-bar.w50{width:50%}.term-bar.w55{width:55%}.term-bar.w60{width:60%}.term-bar.w65{width:65%}.term-bar.w70{width:70%}.term-bar.w75{width:75%}.term-bar.w80{width:80%}.term-bar.w85{width:85%}.term-bar.w90{width:90%}.term-bar.w95{width:95%}.term-bar.w100{width:100%}
.exact-q{display:inline-block;font-size:13px;margin-left:4px}.exact-q summary{cursor:pointer;color:var(--wine)}.exact-q .big-int{display:block;font-size:12px;max-width:100%}
/* ---------- scientific notes page ---------- */
.scientific-notes{max-width:900px;margin:0 auto;padding:24px 20px 30px;font-size:18px;line-height:1.6}
.scientific-notes h2{font-size:30px;margin:4px 0 12px}
.scientific-notes h3{font-size:21px;margin:26px 0 8px}
.scientific-notes p+p{margin-top:10px}
.scientific-notes ul,.scientific-notes ol{padding-left:1.3em;margin:6px 0}
.scientific-notes li+li{margin-top:6px}
@media (max-width:640px){svg .lbl-small{font-size:16px}svg .lbl-strip{font-size:17px}.dot-label{font-size:21px}}
@media (max-width:640px){
  .piece-row{grid-template-columns:minmax(0,1fr)}
  .fig-path{max-height:240px}
  .volume-pieces .piece-card.own{order:-1}
  .volume-live{display:block;box-sizing:border-box;min-height:4.2em;margin:8px 0;padding:7px 10px;border-left:3px solid var(--teal);background:var(--teal-tint);font-weight:600}
}
