/* Kagu — planche de dessin. Tokens : voir MASTER.md */
:root {
  --paper: #EFEBDD;
  --paper-2: #E6E1CE;
  --paper-3: #D9D3BC;
  --ink: #14181B;
  --ink-2: #2C3338;
  --ink-3: #566067;
  --tape: #F5C400;
  --tape-wash: #FBEFB0;
  --tape-deep: #8A6A00;
  --trace: #BA2B12;
  --wall-b: #DAD4BC;
  --wall-l: #CBC4A8;
  --floor: #BFB799;

  --f-disp: 'Big Shoulders Display', 'Arial Narrow', 'Liberation Sans Narrow', 'Roboto Condensed', sans-serif;
  --f-text: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-mono: 'Martian Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r: 2px;
  --hit: 44px;

  --ease-out: cubic-bezier(.2, 0, 0, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --t-fast: 120ms; --t-mid: 200ms; --t-slow: 320ms;

  --tape-h: 64px;
  --top-h: 52px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; color-scheme: light; }
body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--paper);
  /* papier millimétré : 1 trait par « cm » (8 px), trait fort tous les 5 */
  background-image:
    linear-gradient(rgba(20,24,27,.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20,24,27,.09) 1px, transparent 1px),
    linear-gradient(rgba(20,24,27,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20,24,27,.045) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px, 8px 8px, 8px 8px;
  color: var(--ink);
  font: 400 16px/1.45 var(--f-text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 6px var(--tape); }

.mono { font-family: var(--f-mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ───────── bandeau ───────── */
.top {
  height: var(--top-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--s4); position: relative; z-index: 6;
}
.wm { display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); }
.wm b { font: 800 26px/1 var(--f-disp); letter-spacing: .14em; }
.wm i { display: block; width: 26px; height: 12px; background: linear-gradient(var(--ink), var(--ink)) center / 100% 2px no-repeat; }
.wm i:first-child { border-left: 2px solid var(--ink); }
.wm i:last-child { border-right: 2px solid var(--ink); }
.unit-tag { font: 500 11px/1 var(--f-mono); letter-spacing: .08em; color: var(--ink-3); text-transform: uppercase; }

/* ───────── ruban de navigation ───────── */
.tape {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tape-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background:
    linear-gradient(90deg, var(--ink) 1.5px, transparent 1.5px) 0 0 / 40px 16px repeat-x,
    linear-gradient(90deg, var(--ink) 1px, transparent 1px) 0 0 / 8px 8px repeat-x,
    var(--tape);
  border-top: 2px solid var(--ink);
}
.tape button {
  flex: 1; min-height: var(--hit); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0; padding-top: 14px; color: var(--ink); position: relative;
  transition: background-color var(--t-fast) var(--ease-out);
}
.tape button + button { border-left: 2px solid var(--ink); }
.tape .n { font: 800 22px/1 var(--f-disp); letter-spacing: .04em; }
.tape .l { font: 500 11px/1.2 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; }
.tape button[aria-current="step"] { background: var(--ink); color: var(--tape); }
.tape .badge { position: absolute; top: 18px; right: 12px; font: 600 11px/1 var(--f-mono); }
@media (hover: hover) and (pointer: fine) {
  .tape button:not([aria-current="step"]):hover { background: var(--tape-wash); }
}

/* ───────── mise en page ───────── */
.layout { padding-bottom: calc(var(--tape-h) + env(safe-area-inset-bottom) + var(--s4)); }
.stage { position: relative; display: flex; flex-direction: column; }
.st-svg { position: relative; flex: 1; min-height: 0; }
.st-svg svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
[data-screen="cotes"] .st-svg svg { touch-action: none; }

[data-screen="cotes"] .stage { height: clamp(360px, 52dvh, 560px); }
[data-screen="pieces"] .stage {
  position: sticky; top: 0; z-index: 8; height: 276px;
  background: var(--paper-2); border-bottom: 2px solid var(--ink);
}

.st-head { display: grid; grid-template-columns: 1fr auto; gap: var(--s3); align-items: end; padding: var(--s2) var(--s4) 0; }
.st-head h1 { font: 800 30px/.95 var(--f-disp); text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; }
.st-sub { margin-top: 5px; font-size: 13px; line-height: 1.3; color: var(--ink-2); max-width: 30ch; }
.count { display: flex; align-items: center; gap: 8px; }
.count b { display: block; font: 800 60px/.8 var(--f-disp); font-variant-numeric: tabular-nums; letter-spacing: -.01em; min-width: 26px; text-align: right; }
.count span { display: block; width: 64px; font: 500 11px/1.25 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; }
.count b.tick { animation: tick var(--t-mid) var(--ease-out); }
@keyframes tick { from { transform: translateY(-8px); opacity: .25; } to { transform: none; opacity: 1; } }

.st-legend { display: flex; gap: var(--s3); padding: 0 var(--s4) var(--s2); font: 500 11px/1.3 var(--f-mono); letter-spacing: .05em; color: var(--ink-2); text-transform: uppercase; flex-wrap: wrap; }
.st-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); display: inline-block; }
.lg-dia { width: 10px; height: 10px; background: var(--tape); border: 2px solid var(--ink); transform: rotate(45deg); display: inline-block; }
.lg-box { width: 14px; height: 10px; border: 1.5px dashed var(--tape-deep); background: rgba(245,196,0,.4); display: inline-block; }

[data-screen="pieces"] .st-head, [data-screen="pieces"] .st-legend { display: none; }
[data-screen="cotes"] .st-strip { display: none; }

.st-strip { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s2) var(--s4); border-top: 1px solid var(--ink); background: var(--paper); min-height: 52px; }
.st-strip .nm { font: 800 22px/1 var(--f-disp); text-transform: uppercase; letter-spacing: .02em; }
.st-strip .sub { font: 500 11px/1.3 var(--f-mono); letter-spacing: .05em; color: var(--ink-2); text-transform: uppercase; }
.st-strip .pr { font: 800 28px/1 var(--f-disp); white-space: nowrap; }
.st-strip .empty { font-size: 14px; color: var(--ink-2); }

/* ───────── panneau ───────── */
.panel { position: relative; }
.screen { animation: enter var(--t-mid) var(--ease-out) both; }
.screen.out { opacity: 0; transition: opacity 100ms var(--ease-in); }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.sec-label { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--s4) var(--s2); font: 500 11px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.sec-label::after { content: ""; flex: 1; height: 8px; background: linear-gradient(90deg, var(--ink) 1px, transparent 1px) 0 0 / 8px 8px repeat-x, linear-gradient(var(--ink), var(--ink)) 0 7px / 100% 1px no-repeat; opacity: .5; }

/* lignes de cote (saisie) */
.cote { display: grid; grid-template-columns: 52px 1fr auto; column-gap: var(--s2); align-items: end; padding: var(--s2) var(--s4) var(--s3); border-top: 2px solid var(--ink); }
.cote:last-of-type { border-bottom: 2px solid var(--ink); }
.c-axis b { display: block; font: 800 46px/.85 var(--f-disp); }
.c-axis span { font: 500 11px/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.c-cap { display: block; font: 500 11px/1.2 var(--f-mono); letter-spacing: .04em; color: var(--ink-2); text-transform: uppercase; margin-bottom: 4px; min-height: 14px; white-space: nowrap; }
.c-dim, .c-tol { display: flex; flex-direction: column; }
.ctl { display: flex; align-items: center; }
.step {
  width: var(--hit); height: var(--hit); display: grid; place-items: center;
  border: 2px solid var(--ink); background: var(--paper); font: 800 26px/1 var(--f-disp); user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: background-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.step:active { background: var(--tape); transform: translateY(1px); }
.step[disabled] { opacity: .35; cursor: default; }
.ctl .step:first-child { border-right-width: 1px; }
.ctl .step:last-child { border-left-width: 1px; }
.num {
  width: 64px; height: var(--hit); text-align: center; border: 2px solid var(--ink); border-left: 0; border-right: 0; border-radius: 0;
  background: #fff9; font: 800 34px/1 var(--f-disp); font-variant-numeric: tabular-nums; padding: 0; -moz-appearance: textfield; appearance: textfield; min-width: 0;
}
.num::-webkit-outer-spin-button, .num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num:focus { background: var(--tape-wash); }
.tval { width: 34px; height: var(--hit); display: grid; place-items: center; border: 2px solid var(--ink); border-left: 0; border-right: 0; background: var(--tape); font: 800 26px/1 var(--f-disp); font-variant-numeric: tabular-nums; }
.c-tol .ctl .step { background: var(--tape-wash); }
.c-tol .ctl .step:active { background: var(--tape); }
.u-sfx { font: 500 11px/1 var(--f-mono); color: var(--ink-2); margin-left: 6px; }

.presets { padding: 0 0 var(--s2); }
.presets ul { display: flex; gap: var(--s2); overflow-x: auto; padding: 0 var(--s4) var(--s2); scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.chip {
  flex: none; min-height: var(--hit); padding: 4px 12px; border: 2px solid var(--ink); background: var(--paper);
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; text-align: left;
  transition: background-color var(--t-fast) var(--ease-out);
}
.chip { white-space: nowrap; }
.chip .a { font: 800 17px/1 var(--f-disp); text-transform: uppercase; letter-spacing: .04em; }
.chip .b { font: 500 11px/1.2 var(--f-mono); color: var(--ink-2); letter-spacing: .04em; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--tape); }
.chip[aria-pressed="true"] .b { color: var(--tape); }
@media (hover: hover) and (pointer: fine) { .chip:not([aria-pressed="true"]):hover { background: var(--tape-wash); } }

.photo-link { padding: var(--s2) var(--s4) var(--s5); }
.cta-bar { position: sticky; bottom: calc(var(--tape-h) + env(safe-area-inset-bottom)); z-index: 4; padding: var(--s3) var(--s4); background: var(--paper); border-top: 2px solid var(--ink); display: flex; flex-direction: column; gap: var(--s2); }
.cta {
  position: relative; min-height: 56px; width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 0 var(--s4);
  background: var(--ink); color: var(--tape); border: 0; font: 800 24px/1 var(--f-disp); text-transform: uppercase; letter-spacing: .06em;
  transition: transform var(--t-fast) var(--ease-out);
}
.cta::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 7px; background: linear-gradient(90deg, var(--tape) 1.5px, transparent 1.5px) 0 0 / 8px 7px repeat-x; opacity: .85; }
.cta:active { transform: translateY(1px); }
.cta[disabled] { background: var(--paper-3); color: var(--ink-3); cursor: default; }
.cta[disabled]::before { display: none; }
.cta .arr { font-size: 28px; }
.link { min-height: var(--hit); display: flex; align-items: center; justify-content: center; gap: 8px; font: 500 12px/1.2 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; color: var(--ink); }
.cta-alt { background: var(--tape); color: var(--ink); }
.cta-alt::before { background: linear-gradient(90deg, var(--ink) 1.5px, transparent 1.5px) 0 0 / 8px 7px repeat-x; }

.hint-box { margin: var(--s2) var(--s4) var(--s3); padding: var(--s3); border: 2px dashed var(--ink); background: var(--tape-wash); font-size: 14px; line-height: 1.4; display: flex; gap: var(--s3); align-items: center; justify-content: space-between; }
.hint-box button { flex: none; min-height: var(--hit); padding: 0 12px; border: 2px solid var(--ink); background: var(--tape); font: 800 17px/1 var(--f-disp); text-transform: uppercase; letter-spacing: .04em; }

/* ───────── écran pièces ───────── */
.p-head { padding: var(--s4) var(--s4) var(--s2); }
.p-head h2 { font: 800 34px/.95 var(--f-disp); text-transform: uppercase; letter-spacing: .02em; }
.p-head p { margin-top: 6px; font: 500 12px/1.4 var(--f-mono); letter-spacing: .04em; color: var(--ink-2); }
.p-head p button { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; font: inherit; min-height: 24px; }
.toolbar { display: flex; flex-direction: column; gap: var(--s2); padding: 0 0 var(--s2); }
.seg { display: flex; margin: 0 var(--s4); border: 2px solid var(--ink); }
.seg button { flex: 1; min-height: var(--hit); font: 500 12px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; transition: background-color var(--t-fast) var(--ease-out); }
.seg button + button { border-left: 2px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--tape); }
@media (hover: hover) and (pointer: fine) { .seg button[aria-pressed="false"]:hover { background: var(--tape-wash); } }
.types ul { display: flex; gap: 6px; overflow-x: auto; padding: 0 var(--s4) 4px; scrollbar-width: thin; }
.types button { flex: none; min-height: 36px; padding: 0 12px; border: 1.5px solid var(--ink); font: 500 12px/1 var(--f-mono); letter-spacing: .04em; text-transform: uppercase; background: var(--paper); transition: background-color var(--t-fast) var(--ease-out); }
.types button[aria-pressed="true"] { background: var(--ink); color: var(--tape); }
.types button { position: relative; }
.types button::after { content: ""; position: absolute; inset: -4px 0; } /* cible 44 px */
@media (hover: hover) and (pointer: fine) { .types button[aria-pressed="false"]:hover { background: var(--tape-wash); } }

.ledger { border-top: 2px solid var(--ink); }
.fiche { border-bottom: 1px solid var(--ink); animation: enter var(--t-mid) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 28ms); }
.fiche-btn {
  width: 100%; text-align: left; padding: var(--s3) var(--s4); min-height: 100px;
  display: grid; grid-template-columns: 92px minmax(0,1fr) auto; grid-template-areas: "mini main price" "mini gaps gaps"; gap: 6px 12px; align-items: start;
  position: relative; transition: background-color var(--t-fast) var(--ease-out);
}
.fiche-btn[aria-pressed="true"] { background: var(--tape-wash); box-shadow: inset 6px 0 0 var(--ink); }
@media (hover: hover) and (pointer: fine) { .fiche-btn[aria-pressed="false"]:hover { background: rgba(251,239,176,.55); } }
.f-fig { grid-area: mini; position: relative; width: 92px; height: 80px; align-self: start; }
.f-mini { width: 92px; height: 80px; display: block; }
.f-main { grid-area: main; min-width: 0; }
.f-name { display: block; font: 800 22px/1 var(--f-disp); text-transform: uppercase; letter-spacing: .02em; }
.f-sub { display: block; margin-top: 3px; font-size: 13px; line-height: 1.3; color: var(--ink-2); }
.f-dims { display: block; margin-top: 3px; font: 600 12px/1.2 var(--f-mono); letter-spacing: .02em; }
.f-price { grid-area: price; font: 800 24px/1 var(--f-disp); white-space: nowrap; text-align: right; }
.f-gaps { grid-area: gaps; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.gap { display: inline-flex; align-items: center; gap: 4px; }
.gap b { font: 600 11px/1 var(--f-mono); color: var(--ink-2); }
.gap i { display: block; width: 26px; height: 8px; border: 1.5px solid var(--ink); position: relative; background: linear-gradient(90deg, var(--ink) 1px, transparent 1px) 0 0 / 6px 3px repeat-x, var(--paper); }
.gap i::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--r, 0) * 100%); background: var(--ink); }
.gap em { font: 800 17px/1 var(--f-disp); font-style: normal; min-width: 14px; font-variant-numeric: tabular-nums; }
.gap.neg b, .gap.neg em { color: var(--trace); }
.gap.neg i { border-color: var(--trace); }
.gap.neg i::after { background: var(--trace); width: 100%; }
.stamp { position: absolute; left: 4px; bottom: -4px; background: var(--paper); border: 2px solid var(--ink); padding: 3px 6px 2px; font: 600 11px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; transform: rotate(-4deg); white-space: nowrap; }
.stamp.pile { background: var(--ink); color: var(--tape); }
.fiche-btn[aria-pressed="true"] .stamp:not(.pile) { background: var(--tape-wash); }
.stamp.serre { border-width: 2px; }
.stamp.juste, .stamp.aise { border-style: dashed; color: var(--ink-2); }
.stamp.neg { border-color: var(--trace); color: var(--trace); }

.near-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: var(--s5) var(--s4) var(--s2); }
.near-title h3 { font: 800 22px/1 var(--f-disp); text-transform: uppercase; letter-spacing: .03em; }
.near-title p { font-size: 13px; color: var(--ink-2); max-width: 28ch; text-align: right; line-height: 1.3; }
.near .fiche-btn { min-height: 88px; }

.empty-state { margin: var(--s5) var(--s4); padding: var(--s5) var(--s4); border: 2px dashed var(--ink); text-align: left; }
.empty-state h3 { font: 800 30px/.95 var(--f-disp); text-transform: uppercase; }
.empty-state p { margin-top: 8px; font-size: 15px; color: var(--ink-2); }
.empty-state .cta { margin-top: var(--s3); }

/* ───────── photo ───────── */
.photo-wrap { display: none; align-content: start; justify-items: stretch; }
[data-screen="photo"] .photo-wrap { display: grid; }
[data-screen="photo"] .stage { display: none; }
[data-screen="photo"][data-phase="done"] .photo-wrap { position: sticky; top: 0; z-index: 8; background: var(--paper-2); border-bottom: 2px solid var(--ink); }
[data-screen="photo"][data-phase="done"] .photostage { aspect-ratio: auto; height: 232px; border-bottom: 0; }
[data-screen="photo"][data-phase="done"] .photo-caption { padding: 6px var(--s4); }
.photostage { position: relative; width: 100%; aspect-ratio: 6 / 5; background: var(--ink); overflow: hidden; border-bottom: 2px solid var(--ink); }
.photostage svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.photostage.live .scene { filter: grayscale(.85) brightness(.6) contrast(1.05); }
.scene { transition: filter var(--t-slow) var(--ease-out); }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash 260ms var(--ease-out); }
@keyframes flash { 0% { opacity: .95; } 100% { opacity: 0; } }
.vf-hint { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: center; }
.vf-hint span { background: var(--ink); color: var(--tape); padding: 6px 10px; font: 500 11px/1.3 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; text-align: center; }
.shutter { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); width: 72px; height: 72px; border-radius: 50%; border: 4px solid var(--paper); background: transparent; display: grid; place-items: center; }
.shutter::after { content: ""; width: 54px; height: 54px; border-radius: 50%; background: var(--tape); border: 2px solid var(--ink); transition: transform var(--t-fast) var(--ease-out); }
.shutter:active::after { transform: scale(.92); }
.scan { transform: translateY(-40px); animation: scan 2.6s linear forwards; }
@keyframes scan { to { transform: translateY(330px); } }
.draw { stroke-dasharray: 800; stroke-dashoffset: 800; animation: draw 700ms var(--ease-out) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.fade-in { opacity: 0; animation: fadeIn var(--t-slow) var(--ease-out) forwards; animation-delay: var(--d, 0ms); }
@keyframes fadeIn { to { opacity: 1; } }

.steps { padding: var(--s2) var(--s4) var(--s4); }
.steps li { display: flex; align-items: center; gap: var(--s3); min-height: 40px; border-bottom: 1px solid rgba(20,24,27,.3); font-size: 15px; color: var(--ink-3); transition: color var(--t-fast) var(--ease-out); }
.steps li .mk { width: 22px; height: 22px; border: 2px solid var(--ink-3); display: grid; place-items: center; font: 600 11px/1 var(--f-mono); flex: none; }
.steps li.on { color: var(--ink); font-weight: 700; }
.steps li.on .mk { border-color: var(--ink); background: var(--tape); }
.steps li.done { color: var(--ink); }
.steps li.done .mk { background: var(--ink); border-color: var(--ink); color: var(--tape); }

.est-note { margin: 0 var(--s4) var(--s2); font-size: 13px; line-height: 1.35; color: var(--ink-2); display: flex; gap: 8px; align-items: flex-start; }
.est-note i { flex: none; margin-top: 5px; width: 28px; height: 8px; background: repeating-linear-gradient(135deg, var(--tape-deep) 0 2px, transparent 2px 5px); border: 1px solid var(--tape-deep); }
.pm { font: 600 12px/1 var(--f-mono); color: var(--ink-2); }
.pm.ok { color: var(--ink); }

.reading { padding: 0 var(--s4); display: grid; gap: var(--s3); }
.swatches { display: flex; gap: var(--s2); flex-wrap: wrap; }
.sw { display: flex; align-items: center; gap: 8px; min-height: 36px; padding-right: 10px; border: 1.5px solid var(--ink); background: var(--paper); font-size: 13px; line-height: 1.2; }
.sw i { width: 32px; align-self: stretch; border-right: 1.5px solid var(--ink); display: block; }
.read-line { font-size: 15px; line-height: 1.4; }
.read-line b { font: 600 11px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; display: block; color: var(--ink-2); margin-bottom: 2px; }
.obs { display: grid; gap: 6px; }
.obs li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start; font-size: 14px; line-height: 1.35; }
.obs li i { width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--tape); display: grid; place-items: center; font: 600 12px/1 var(--f-mono); font-style: normal; }

.args { grid-column: 1 / -1; margin-top: 4px; display: grid; gap: 6px; }
.args b { font-weight: 700; }
.args .arg { display: grid; grid-template-columns: 22px 1fr; gap: 8px; font-size: 14px; line-height: 1.35; align-items: start; }
.args .arg i { width: 20px; height: 20px; display: grid; place-items: center; font: 800 14px/1 var(--f-disp); font-style: normal; border: 2px solid var(--ink); margin-top: 1px; }
.args .arg.ok i { background: var(--ink); color: var(--tape); }
.args .arg.warn i { background: var(--tape); color: var(--ink); }
.fiche-btn.has-args { grid-template-areas: "mini main price" "mini gaps gaps" "args args args"; }
.args-wrap { grid-area: args; }
.rejected { margin: var(--s4); padding: var(--s3); border: 2px dashed var(--trace); font-size: 14px; line-height: 1.4; }
.rejected b { font: 600 11px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--trace); display: block; margin-bottom: 4px; }
.photo-actions { padding: var(--s4); display: grid; gap: var(--s2); }
.photo-caption { padding: var(--s2) var(--s4) 0; font: 500 11px/1.3 var(--f-mono); letter-spacing: .05em; color: var(--ink-2); text-transform: uppercase; }

/* ───────── SVG du dessin ───────── */
.wb { fill: var(--wall-b); }
.wl { fill: var(--wall-l); }
.fl { fill: var(--floor); }
.gr { stroke: var(--ink); stroke-opacity: .13; stroke-width: 1; fill: none; }
.edge { stroke: var(--ink); stroke-width: 1.5; fill: none; }
.hid { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 4 4; fill: none; }
.frame { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: miter; }
.minf { fill: url(#hatch); stroke: var(--tape-deep); stroke-width: 1.25; stroke-dasharray: 5 3; }
.minb { fill: var(--tape); fill-opacity: .2; stroke: none; }
.dim { stroke: var(--ink); stroke-width: 1.5; fill: none; }
.ext { stroke: var(--ink); stroke-opacity: .55; stroke-width: 1; fill: none; }
.cl { font: 800 28px var(--f-disp); fill: var(--ink); paint-order: stroke; stroke: var(--paper); stroke-width: 8px; stroke-linejoin: round; text-anchor: middle; dominant-baseline: central; letter-spacing: .01em; }
.cl.sm { font-size: 17px; stroke-width: 6px; }
.cl tspan.ck { font: 600 11px var(--f-mono); letter-spacing: .05em; fill: var(--ink-2); }
.cl.sm tspan.ck { font-size: 10px; }
.ghost { opacity: .24; }
.pill rect { fill: var(--ink); }
.pill text { font: 600 11px var(--f-mono); fill: var(--tape); text-anchor: middle; dominant-baseline: central; }
.pill.neg rect { fill: var(--trace); }
.pill.neg text { fill: #fff; }
.gapln { stroke: var(--tape); stroke-width: 4; stroke-linecap: butt; }
.gapln.neg { stroke: var(--trace); }
.gapln-o { stroke: var(--ink); stroke-width: 7; stroke-linecap: butt; }
.pface { stroke: var(--ink); stroke-width: 1.25; stroke-linejoin: round; }
.pdet { stroke: rgba(20,24,27,.55); stroke-width: 1; fill: none; }
.pdot { fill: rgba(20,24,27,.7); }
.leg { fill: #2a2a2a; }
.hd { cursor: grab; touch-action: none; }
.hd:active { cursor: grabbing; }
.hd .ring { fill: var(--ink); stroke: var(--paper); stroke-width: 2.5; }
.hd .arr { stroke: var(--tape); stroke-width: 2.25; fill: none; stroke-linecap: square; stroke-linejoin: miter; }
.td { cursor: grab; touch-action: none; }
.td .dia { fill: var(--tape); stroke: var(--ink); stroke-width: 2.25; }
.tlab { font: 600 11px var(--f-mono); fill: var(--ink); paint-order: stroke; stroke: var(--paper); stroke-width: 4px; letter-spacing: .04em; dominant-baseline: central; }
.minilbl { font: 600 10px var(--f-mono); fill: var(--tape-deep); }
.mini .wb, .mini .wl, .mini .fl { stroke: var(--ink); stroke-width: .75; }
.mini .edge { stroke-width: 1; }
.mini .frame { stroke-width: 1.5; }

/* photo — cotes de l'IA */
.ai-box { fill: none; stroke: var(--tape); stroke-width: 2.5; }
.ai-dim { stroke: var(--tape); stroke-width: 1.5; fill: none; }
.ai-lab rect { fill: var(--ink); }
.ai-lab text { font: 800 17px var(--f-disp); fill: var(--tape); dominant-baseline: central; text-anchor: middle; letter-spacing: .02em; }
.ai-lab text.sm { font: 600 11px var(--f-mono); }
.ai-band { fill: var(--tape); fill-opacity: .55; }
.ai-mark circle { fill: var(--tape); stroke: var(--ink); stroke-width: 1.5; }
.ai-mark text { font: 600 12px var(--f-mono); fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.ai-lead { stroke: var(--tape); stroke-width: 1.25; stroke-dasharray: 3 3; }
.ai-ref { fill: none; stroke: var(--tape); stroke-width: 1.5; }

/* ───────── desktop ───────── */
@media (min-width: 960px) {
  :root { --tape-w: 88px; }
  body { padding-left: var(--tape-w); }
  .tape {
    top: 0; right: auto; bottom: 0; width: var(--tape-w); height: auto; flex-direction: column; padding: 0;
    border-top: 0; border-right: 2px solid var(--ink);
    background:
      linear-gradient(180deg, var(--ink) 1.5px, transparent 1.5px) right 0 top 0 / 16px 40px repeat-y,
      linear-gradient(180deg, var(--ink) 1px, transparent 1px) right 0 top 0 / 8px 8px repeat-y,
      var(--tape);
  }
  .tape button { padding: 0 14px 0 0; flex: none; height: 96px; }
  .tape button + button { border-left: 0; border-top: 2px solid var(--ink); }
  .tape .badge { top: 14px; right: 22px; }
  .layout { display: grid; grid-template-columns: minmax(0, 1fr) 500px; height: calc(100dvh - var(--top-h)); padding-bottom: 0; }
  .stage, [data-screen="cotes"] .stage, [data-screen="pieces"] .stage { position: relative; top: auto; height: 100%; border-bottom: 0; background: transparent; }
  [data-screen="pieces"] .stage { background: transparent; }
  [data-screen="photo"] .photo-wrap { height: 100%; padding: var(--s5); display: flex; flex-direction: column; align-items: center; justify-content: center; }
  [data-screen="photo"][data-phase="done"] .photo-wrap { position: relative; background: transparent; border-bottom: 0; }
  [data-screen="photo"][data-phase="done"] .photostage, .photostage { aspect-ratio: 6 / 5; height: auto; width: min(100%, calc((100dvh - var(--top-h) - 120px) * 1.2)); border: 2px solid var(--ink); }
  [data-screen="photo"][data-phase="done"] .photo-caption { padding: var(--s3) 0 0; }
  .photo-caption { padding: var(--s3) 0 0; }
  .panel { overflow-y: auto; border-left: 2px solid var(--ink); background: var(--paper); }
  .cta-bar { bottom: 0; }
  .st-head { padding: var(--s5) var(--s6) 0; }
  .st-head h1 { font-size: 44px; }
  .st-legend { padding: 0 var(--s6) var(--s4); }
  .st-strip { padding: var(--s3) var(--s6); }
  .p-head, .sec-label, .cote, .hint-box, .photo-caption { }
}
@media (max-width: 380px) {
  .num { width: 54px; }
  .cote { grid-template-columns: 44px 1fr auto; column-gap: 6px; padding-left: 12px; padding-right: 12px; }
  .c-axis b { font-size: 40px; }
  .fiche-btn { grid-template-columns: 78px minmax(0,1fr) auto; padding-left: 12px; padding-right: 12px; }
  .f-fig, .f-mini { width: 78px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .scan { display: none; }
  .draw { stroke-dashoffset: 0; }
  .fade-in { opacity: 1; }
}
