/* sd.allahabadi.dev design board (sd-board.js): the diagram editor and the read-only diagram.
   Reads the sd.css token contract (--sd-<hue>-*, [data-hue] -> --sd-h-*, --paper, --text, --focus, --ease,
   --float-shadow). Moved out of sd.css on 2026-11-20 when the board became a direct-manipulation editor.
   Colours: blocks are paper cards with their kind's hue only on the icon tile and the kind line; the
   selection, the arrow dots and a live arrow use --focus (the focus colour); alignment guides are rose. */

.sdb { display: flex; flex-direction: column; gap: 12px; margin: 0 0 8px; min-width: 0; }

/* ---------- palette ---------- */
.sdb-palette { display: flex; flex-wrap: wrap; gap: 8px; }
.sdb-add {
  display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 5px 14px 5px 5px; border-radius: 8px;
  font: 700 1rem/1.15 var(--font-body); background: var(--paper); color: var(--text); border: 1.5px solid var(--rule);
  cursor: grab; user-select: none; -webkit-user-select: none; touch-action: pan-x;
  transition: border-color .15s var(--ease), transform .12s var(--ease), box-shadow .15s var(--ease);
}
@media (hover: hover) { .sdb-add:hover { border-color: var(--sd-h-ink); box-shadow: 0 6px 16px -10px rgb(16 18 24 / .45); } }
.sdb-add:active { transform: scale(.96); cursor: grabbing; }
.sdb-add.is-dragging { border-style: dashed; border-color: var(--sd-h-ink); color: var(--text-muted); }
.sdb-add-tile { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; background: var(--sd-h-fill); color: var(--sd-h-on); }
.sdb-add-tile .sdb-ic { width: 20px; height: 20px; }
/* the free box's chip: an outline square on a plain tile, so it reads as "a box with nothing in it yet" */
.sdb-add.is-free .sdb-add-tile { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--rule); }
.sdb-ic { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- the stage: a sheet on a grey ground, drawn with a camera ---------- */
.sdb-stage {
  position: relative; overflow: hidden; border-radius: 10px; border: 1px solid var(--rule); background: var(--paper-2);
  aspect-ratio: 16 / 10; min-height: 440px; max-height: 76vh; width: 100%;
  touch-action: none; user-select: none; -webkit-user-select: none; outline: none; cursor: default;
  -webkit-tap-highlight-color: transparent;
  /* no overscroll-behavior: contain here. The stage is a scroll container (overflow: hidden), and contain stopped a
     wheel over a board not yet clicked into from scrolling the page; the board's own handlers prevent what they use */
}
.sdb-stage:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sdb-stage.is-space, .sdb-stage.is-space * { cursor: grab !important; }
.sdb-stage.is-panning, .sdb-stage.is-panning * { cursor: grabbing !important; }
.sdb-stage.is-moving, .sdb-stage.is-moving * { cursor: grabbing !important; }
.sdb-stage.is-connecting, .sdb-stage.is-connecting * { cursor: crosshair !important; }
.sdb-stage .sdb-svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.sdb-sheet { stroke: none; }
.sdb-stage .sdb-sheet { fill: var(--paper); }
.sdb-sheet-edge { fill: none; stroke: var(--rule); stroke-width: 1; vector-effect: non-scaling-stroke; }
.sdb-dot { fill: color-mix(in srgb, var(--text-muted) 42%, transparent); }

/* ---------- blocks ---------- */
.sdb-block { outline: none; }
.is-edit .sdb-block { cursor: grab; }
.sdb-box { fill: var(--sd-card); stroke: var(--sd-card-bd); stroke-width: 1.5; transition: stroke .12s var(--ease), fill .12s var(--ease); }
.sdb-tile { fill: var(--sd-h-fill); }
.sdb-glyph { fill: none; stroke: var(--sd-h-on); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sdb-name { fill: var(--sd-card-tx); font: 800 21px var(--font-display); }
.sdb-kind { fill: var(--sd-h-ink); font: 700 15px var(--font-body); }
/* a free box: no tile, no kind line; its own text, centred, in the body face */
.sdb-box-t { fill: var(--sd-card-tx); font: 600 19px var(--font-body); }
/* while its text is typed, the field covers the box; the box itself steps out of sight (ring included) */
.sdb-block.is-editing { visibility: hidden; }
.sdb-ring { fill: none; stroke: transparent; stroke-width: 3; }
.is-edit .sdb-block:hover .sdb-box { stroke: var(--sd-h-ink); }
.sdb-block.is-sel .sdb-box { stroke: var(--focus); stroke-width: 2.5; }
.sdb-block.is-sel .sdb-ring { stroke: color-mix(in srgb, var(--focus) 32%, transparent); stroke-width: 5; }
.sdb-block:focus-visible .sdb-ring { stroke: var(--focus); stroke-width: 3; stroke-dasharray: none; }
.sdb-block.is-target .sdb-box { stroke: var(--focus); stroke-width: 3; fill: var(--sd-blue-bg); }
.sdb-block.is-target .sdb-ring { stroke: color-mix(in srgb, var(--focus) 40%, transparent); stroke-width: 6; }
.sdb-block.is-src .sdb-box { stroke: var(--focus); stroke-dasharray: 6 5; }
/* lifted while it moves: the only thing on the sheet with a shadow, because it is the only thing in the air */
.sdb-block.is-drag { filter: drop-shadow(0 10px 14px rgb(16 18 24 / var(--sd-shadow-a))); }
.sdb-block.is-drag .sdb-box { stroke: var(--focus); }
.sdb-block.is-preview { opacity: .72; pointer-events: none; }
.sdb-block.is-preview .sdb-box { stroke: var(--focus); stroke-dasharray: 7 5; stroke-width: 2; }

/* ---------- arrows (drawn above the blocks, so none is ever hidden under one) ---------- */
.sdb-line { fill: none; stroke: var(--sd-card-muted); stroke-width: 2.25; stroke-linecap: round; }
.sdb-head { fill: var(--sd-card-muted); }
.sdb-head.is-sel, .sdb-head.is-live { fill: var(--focus); }
.sdb-hit { fill: none; stroke: transparent; stroke-width: 18; pointer-events: stroke; cursor: pointer; }
.is-edit .sdb-link:hover .sdb-line { stroke: var(--text); }
.sdb-link.is-sel .sdb-line { stroke: var(--focus); stroke-width: 3; }
.sdb-live { fill: none; stroke: var(--focus); stroke-width: 2.5; stroke-dasharray: 8 6; stroke-linecap: round; pointer-events: none; }
.sdb-lbl rect { fill: var(--paper); stroke: var(--sd-card-bd); stroke-width: 1; }
.sdb-lbl text { fill: var(--sd-card-tx); font: 700 17px var(--font-body); }
.sdb-link.is-sel .sdb-lbl rect { stroke: var(--focus); stroke-width: 1.5; }
.is-edit .sdb-lbl { cursor: pointer; }

/* ---------- arrow dots, guides, marquee ---------- */
.sdb-handle { cursor: crosshair; }
.sdb-handle-hit { fill: transparent; }
.sdb-handle-dot { fill: var(--paper); stroke: var(--focus); stroke-width: 2.5; transition: r .12s var(--ease), fill .12s var(--ease); }
.sdb-handle:hover .sdb-handle-dot { fill: var(--focus); r: 8.5; }
.sdb-guides line { stroke: var(--sd-rose-fill); stroke-width: 1.25; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.sdb-marquee { fill: color-mix(in srgb, var(--focus) 10%, transparent); stroke: var(--focus); stroke-width: 1.25; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }

/* ---------- the empty board ---------- */
.sdb-empty {
  position: absolute; inset: 0 0 56px; margin: 0 !important; display: grid; place-items: center; pointer-events: none;
  font: 800 clamp(1.25rem, 2.2vw, 1.6rem)/1.2 var(--font-display); color: var(--text-muted);
}
.sdb-empty[hidden] { display: none; }

/* ---------- floating material: the selection toolbar, the view bar, the connect menu ---------- */
.sdb-tools, .sdb-view, .sdb-menu {
  position: absolute; z-index: 3; background: color-mix(in srgb, var(--paper) 92%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--float-shadow);
}
.sdb-tools { left: 0; top: 0; display: flex; gap: 2px; padding: 4px; animation: sdb-pop .16s var(--ease); }
.sdb-tools[hidden], .sdb-menu[hidden], .sdb-edit[hidden], .sdb-drag-ghost[hidden] { display: none; }
@keyframes sdb-pop { from { opacity: 0; } }
.sdb-tbtn, .sdb-vbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 38px; min-height: 38px; padding: 0 10px;
  border: 0; border-radius: 7px; background: transparent; color: var(--text); font: 700 .95rem/1 var(--font-body); cursor: pointer;
  transition: background-color .12s var(--ease), transform .1s var(--ease);
}
@media (hover: hover) { .sdb-tbtn:hover, .sdb-vbtn:hover:not(:disabled) { background: var(--paper-2); } }
.sdb-tbtn:active, .sdb-vbtn:active:not(:disabled) { transform: scale(.94); }
.sdb-tbtn:focus-visible, .sdb-vbtn:focus-visible { outline: 2.5px solid var(--focus); outline-offset: -2px; }
.sdb-tbtn.is-danger { color: var(--sd-rose-ink); }
.sdb-vbtn:disabled { color: var(--text-muted); cursor: default; }
.sdb-view { right: 10px; bottom: 10px; display: flex; gap: 4px; padding: 3px; }
.sdb-vgroup { display: flex; gap: 1px; }
.sdb-vgroup + .sdb-vgroup { border-left: 1px solid var(--border); padding-left: 4px; }
/* "Bring drawing to centre": a bordered button with its words, so it is found when the drawing is lost; filled
   in the focus colour while no block is in view */
.sdb-vbtn.sdb-fit { border: 1.5px solid var(--rule); padding: 0 12px; white-space: nowrap; }
.sdb-fit-s { display: none; }
.sdb-vbtn.sdb-fit.is-lost { background: var(--focus); border-color: var(--focus); color: var(--paper); }
@media (hover: hover) { .sdb-vbtn.sdb-fit.is-lost:hover { background: var(--focus); filter: brightness(1.08); } }
.sdb-pct { min-width: 56px; font: 700 .9rem/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.sdb-menu { z-index: 5; left: 0; top: 0; width: min(300px, calc(100% - 16px)); max-height: min(320px, calc(100% - 16px)); overflow: auto; padding: 6px; }
.sdb-menu-h { margin: 4px 8px 6px !important; font: 700 .95rem/1.3 var(--font-body); color: var(--text-muted); }
.sdb-menu-list { display: flex; flex-direction: column; gap: 2px; }
.sdb-menu-item { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 10px 4px 4px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font: 700 1rem/1.2 var(--font-body); text-align: left; cursor: pointer; }
.sdb-menu-item:hover, .sdb-menu-item:focus-visible { background: var(--paper-2); }
.sdb-menu-item:focus-visible { outline: 2.5px solid var(--focus); outline-offset: -2px; }
/* The two text fields are the board's own, styled here in full: a page's rules for its own fields reach them
   otherwise (round-6 QA N1: `.sd-step textarea` (0,1,1: min-height 8.5em, 1.15em font, 14px 16px padding) beat
   `.sdb-edit-box` (0,1,0), so the box field was 196px tall over a 120px box; `.sd-dialog input` did the same to the
   name field in the board dialog). Three classes (0,3,0) outrank any page rule written as class + element, with
   :hover / :focus-visible too, and every property a page sets on a field is set again here. */
.sdb .sdb-stage .sdb-edit {
  position: absolute; left: 0; top: 0; z-index: 4; display: block; margin: 0; box-sizing: border-box;
  width: auto; min-width: 0; max-width: none; height: 44px; min-height: 0; max-height: none; padding: 0 12px; border-radius: 8px;
  border: 2px solid var(--focus); background: var(--paper); color: var(--text); font: 800 18px var(--font-display);
  letter-spacing: normal; word-spacing: normal; text-transform: none; text-indent: 0; text-align: start;
  box-shadow: var(--float-shadow); outline: none; appearance: none; -webkit-appearance: none; transition: none; resize: none;
  caret-color: var(--sd-blue-ink); user-select: text; -webkit-user-select: text;
}
.sdb .sdb-stage .sdb-edit-box {
  /* the box itself at 100% (sd-board.js sets width, height and the top/bottom padding from the box's own layout,
     then scales it by the zoom): 2px edge + 13px = the box's 15px text inset, the box's font and 25px lines.
     The drawn box is wrapped by the browser with these same rules (sd-board.js wrapAll), so both break lines at
     the same places, punctuation and long words included */
  height: auto; padding: 0 13px; border-radius: 6px; transform-origin: 0 0;
  overflow: hidden; text-align: center; box-shadow: none;
  font: 600 19px/25px var(--font-body); white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal;
}
.sdb .sdb-stage .sdb-edit[hidden] { display: none; }
.sdb .sdb-stage .sdb-edit::placeholder { color: var(--text-muted); font-weight: 400; opacity: 1; }
/* how many characters a free box has left, shown from 40 left (sd-board.js growBox) */
.sdb-count { position: absolute; left: 0; top: 0; z-index: 4; margin: 0; padding: 3px 10px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--paper); color: var(--text-muted); font: 700 .85rem/1.3 var(--font-body); white-space: nowrap; pointer-events: none; }
.sdb-count.is-full { border-color: var(--focus); color: var(--text); }
/* a key press the limit refused: the message flashes once, so typing visibly stops */
.sdb-count.is-refused { animation: sdb-refuse .32s var(--ease); }
@keyframes sdb-refuse { 30% { translate: -4px 0; } 60% { translate: 4px 0; } }

/* the block that follows the pointer out of the palette (over the board, the snapped preview takes over) */
.sdb-drag-ghost { position: fixed; left: 0; top: 0; z-index: 2147483000; pointer-events: none; }
.sdb-drag-ghost svg { display: block; transform: translate(-50%, -50%) rotate(-1.5deg) scale(1.04); overflow: visible;
  filter: drop-shadow(0 12px 18px rgb(16 18 24 / .28)); transition: opacity .1s linear; }
.sdb-drag-ghost.is-over svg { opacity: 0; }

@media (pointer: coarse) {
  .sdb-tbtn, .sdb-vbtn { min-width: 44px; min-height: 44px; }
  .sdb-tbtn-t { display: none; }
}
@media (max-width: 760px) {
  .sdb-palette { flex-wrap: nowrap; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px; scroll-snap-type: x proximity; scrollbar-width: thin; }
  .sdb-add { flex: none; scroll-snap-align: start; }
  .sdb-stage { min-height: min(460px, 66svh); max-height: 72svh; }
  .sdb-tbtn-t { display: none; }
  .sdb-pct { display: none; }
  .sdb-fit-t { display: none; }
  .sdb-fit-s { display: inline; }
}

/* ---------- the board dialog (sd.js openBoard): the board fills the screen below its title bar, so the view bar
   and every edge of the stage are always on screen and the dialog itself never scrolls ---------- */
.sd-dialog.sd-board-dlg[open] { display: flex; flex-direction: column; height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); overflow: hidden; }
.sd-board-dlg .sd-board-dlg-in { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.sd-board-dlg .sdb { flex: 1 1 auto; min-height: 0; margin: 0; }
.sd-board-dlg .sdb-stage { flex: 1 1 auto; aspect-ratio: auto; min-height: 260px; max-height: none; }

/* The block strip shows a fade at the edge it can still scroll towards (sd-board.js sets is-more-x / is-more-y from
   the scroll position, and takes it off at the end), so a phone shows there are more blocks past the edge. */
.sdb-palette.is-more-x { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent); }
.sdb-palette.is-more-y { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent); }

/* Phones (under 600px wide, or under 500px high: a phone on its side): the board dialog is the whole screen, with no
   outer margin or corner, a one-line title bar, and the stage takes every pixel left. Padding follows the safe
   area (notch, home bar) where the page allows content under it. */
@media (max-width: 600px), (max-height: 500px) {
  .sd-dialog.sd-board-dlg { width: 100%; max-width: none; margin: 0; inset: 0; border-radius: 0; }
  .sd-dialog.sd-board-dlg[open] { height: 100dvh; max-height: none; }
  .sd-board-dlg .sd-board-dlg-top { padding: max(6px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left)); }
  .sd-board-dlg .sd-board-dlg-top h2 { font-size: 1.2rem; line-height: 1.2; }
  .sd-board-dlg .sd-board-dlg-top .sd-btn { min-height: 44px; padding: 6px 18px; }
  .sd-board-dlg .sd-board-dlg-in { padding: 8px max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
  .sd-board-dlg .sdb { gap: 6px; }
  .sd-board-dlg .sdb-palette { padding-bottom: 4px; }
  .sd-board-dlg .sdb-stage { min-height: 160px; border-radius: 8px; }
}
/* A phone on its side: the block strip becomes a narrow column on the left, so the stage keeps the screen's height.
   Names wrap to two lines inside the column; a vertical swipe scrolls it, a sideways drag lifts a block out. */
@media (max-height: 500px) and (orientation: landscape) {
  .sd-board-dlg .sdb { flex-direction: row; gap: 8px; }
  .sd-board-dlg .sdb-palette { flex: none; width: 148px; flex-direction: column; flex-wrap: nowrap; gap: 6px; overflow: hidden auto; margin: 0;
    padding: 2px 4px 2px 2px; scroll-snap-type: y proximity; scrollbar-width: thin; overscroll-behavior: contain; }
  .sd-board-dlg .sdb-add { flex: none; width: 100%; min-height: 44px; gap: 7px; padding: 4px 8px 4px 4px; font-size: .94rem; line-height: 1.15;
    scroll-snap-align: start; touch-action: pan-y; }
  .sd-board-dlg .sdb-add-tile { width: 28px; height: 28px; }
  .sd-board-dlg .sdb-stage { flex: 1 1 auto; min-width: 0; min-height: 0; }
}

/* ---------- read-only: the reference design and other people's boards ---------- */
.sdb-scroll {
  overflow: auto; border-radius: 10px; border: 1px solid var(--rule); background-color: var(--paper);
  /* edge shadows show there is more diagram to the side; they cover only when there is more to scroll */
  background-image:
    linear-gradient(to right, var(--paper), var(--paper)), linear-gradient(to right, var(--paper), var(--paper)),
    linear-gradient(to right, rgb(0 0 0 / .22), transparent), linear-gradient(to left, rgb(0 0 0 / .22), transparent),
    radial-gradient(color-mix(in srgb, var(--text-muted) 34%, transparent) 1.1px, transparent 1.4px);
  background-position: left center, right center, left center, right center, 0 0;
  background-size: 18px 100%, 18px 100%, 18px 100%, 18px 100%, 24px 24px;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat;
  background-attachment: local, local, scroll, scroll, local;
  overscroll-behavior-x: contain;
}
.sdb-scroll .sdb-svg { display: block; width: calc(var(--z, 1) * 100%); height: auto; aspect-ratio: 1200 / 700; }
.sdb-zoombar { display: none; }
.sdb.is-narrow .sdb-zoombar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sdb-zbtn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 6px 14px; border-radius: 6px;
  border: 1.5px solid var(--rule); background: var(--paper); color: var(--text); font: 700 1.05rem/1 var(--font-body); cursor: pointer;
}
.sdb-zbtn:disabled { color: var(--text-muted); border-style: dashed; cursor: default; }
.sdb-legend { list-style: none; margin: 0; padding: 0; }
.sdb-legend li { padding: 10px 0; border-top: 1px solid var(--border); line-height: 1.5; overflow-wrap: anywhere; }
.sdb-legend-path, .sdb-legend-what { display: block; }
.sdb-legend-what { color: var(--text-muted); }

/* ---------- the interviewer's marked copy of a pictured diagram (IMAGE-REVIEW-SPEC 7.1) ----------
   The word on each change (a tag on the block, a prefix on the arrow's label, the list below) says what changed, so
   colour is never the only signal and no legend is needed. Tags are hue fills with their -on ink (same in both themes,
   4.9:1 and up); outlines and arrows use the -ink tokens, which have a dark-theme value. Removed is a dashed outline
   and a struck-through name, never faded with opacity. */
.has-marks .is-added .sdb-box { stroke: var(--sd-green-ink); stroke-width: 3; }
.has-marks .is-changed .sdb-box { stroke: var(--sd-amber-ink); stroke-width: 3; }
.has-marks .is-removed .sdb-box { stroke: var(--sd-rose-ink); stroke-width: 2.5; stroke-dasharray: 9 6; }
.has-marks .is-removed .sdb-name, .has-marks .is-removed .sdb-box-t { text-decoration: line-through; text-decoration-thickness: 2px; }
.sdb-tag rect { fill: var(--sd-slate-fill); }
.sdb-tag text { fill: var(--sd-slate-on); font: 800 16px var(--font-body); }
.is-added > .sdb-tag rect { fill: var(--sd-green-fill); } .is-added > .sdb-tag text { fill: var(--sd-green-on); }
.is-changed > .sdb-tag rect { fill: var(--sd-amber-fill); } .is-changed > .sdb-tag text { fill: var(--sd-amber-on); }
.is-removed > .sdb-tag rect { fill: var(--sd-rose-fill); } .is-removed > .sdb-tag text { fill: var(--sd-rose-on); }
.sdb-link.is-added .sdb-line { stroke: var(--sd-green-ink); stroke-width: 3.5; }
.sdb-link.is-changed .sdb-line { stroke: var(--sd-amber-ink); stroke-width: 3.5; }
.sdb-link.is-removed .sdb-line { stroke: var(--sd-rose-ink); stroke-dasharray: 8 7; }
.sdb-head.is-added { fill: var(--sd-green-ink); } .sdb-head.is-changed { fill: var(--sd-amber-ink); } .sdb-head.is-removed { fill: var(--sd-rose-ink); }
.sdb-link.is-added .sdb-lbl rect { stroke: var(--sd-green-ink); stroke-width: 2; }
.sdb-link.is-changed .sdb-lbl rect { stroke: var(--sd-amber-ink); stroke-width: 2; }
.sdb-link.is-removed .sdb-lbl rect { stroke: var(--sd-rose-ink); stroke-width: 2; stroke-dasharray: 5 4; }
.sdb-fixes { display: grid; gap: 6px; }
.sdb-fix-notes { margin: 0; color: var(--text-muted); }
.sdb-fix-list { margin: 0; padding-left: 1.6em; display: grid; gap: 6px; line-height: 1.5; }
.sdb-fix-list li { overflow-wrap: anywhere; }
.sdb-fix-list li::marker { font-weight: 800; }
.sdb-fix-list [data-mark="added"] strong { color: var(--sd-green-ink); }
.sdb-fix-list [data-mark="changed"] strong { color: var(--sd-amber-ink); }
.sdb-fix-list [data-mark="removed"] strong { color: var(--sd-rose-ink); }

/* ---------- staged: the results view's diagram (RESULTS-REDESIGN-SPEC 3) ----------
   Always fitted to its frame: no scrollbar, no zoom bar. The frame is as tall as the drawing needs at its width
   (--rx-ar, set by the board); a page may cap the height, and the camera then frames the part. State is the edge
   colour plus a word (a tag, or the list beside the diagram), never colour alone; "not reached" is dashed, never faded. */
.sdb.is-staged { position: relative; overflow: hidden; width: 100%; aspect-ratio: var(--rx-ar, 1200 / 700);
  border-radius: 10px; border: 1px solid var(--rule); background-color: var(--paper);
  background-image: radial-gradient(color-mix(in srgb, var(--text-muted) 34%, transparent) 1.1px, transparent 1.4px); background-size: 24px 24px; }
.sdb.is-staged .sdb-svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.sdb-st-hide { display: none; }
.sdb-block.sdb-st-new { animation: sdb-st-pop .45s var(--ease) both; }
@keyframes sdb-st-pop { from { opacity: 0; } }
.sdb-block.sdb-st-new .sdb-box { stroke: var(--sd-green-ink); stroke-width: 4; }
.sdb-link.sdb-st-new .sdb-line { stroke: var(--sd-green-ink); stroke-width: 3.5; }
.sdb-block.sdb-st-focus .sdb-box { stroke: var(--text); stroke-width: 4; }
.sdb-block.sdb-st-good .sdb-box { stroke: var(--sd-green-ink); stroke-width: 3.5; fill: var(--sd-green-bg); }
.sdb-block.sdb-st-partial .sdb-box { stroke: var(--sd-amber-ink); stroke-width: 3.5; fill: var(--sd-amber-bg); }
.sdb-block.sdb-st-not-reached .sdb-box { stroke: var(--sd-slate-ink); stroke-width: 2.5; stroke-dasharray: 9 6; }
.sdb-block.sdb-st-ok .sdb-box { stroke: var(--sd-green-ink); stroke-width: 3.5; }
.sdb-block.sdb-st-near .sdb-box { stroke: var(--sd-amber-ink); stroke-width: 4; fill: var(--sd-amber-bg); }
.sdb-block.sdb-st-over .sdb-box { stroke: var(--sd-rose-ink); stroke-width: 4.5; fill: var(--sd-rose-bg); }
.sdb-st-tag rect { fill: var(--sd-green-fill); }
.sdb-st-tag text { fill: var(--sd-green-on); font: 800 21px var(--font-body); }
.sdb-st-tag.sdb-st-near rect { fill: var(--sd-amber-fill); } .sdb-st-tag.sdb-st-near text { fill: var(--sd-amber-on); }
.sdb-st-tag.sdb-st-over rect { fill: var(--sd-rose-fill); } .sdb-st-tag.sdb-st-over text { fill: var(--sd-rose-on); }
.sdb-st-tag.sdb-st-idle rect { fill: var(--sd-slate-fill); } .sdb-st-tag.sdb-st-idle text { fill: var(--sd-slate-on); }
@media (prefers-reduced-motion: reduce) { .sdb-block.sdb-st-new { animation: sdb-st-fade .2s linear both; } @keyframes sdb-st-fade { from { opacity: 0; } } }

@media (prefers-reduced-motion: reduce) {
  .sdb-add, .sdb-box, .sdb-tbtn, .sdb-vbtn, .sdb-handle-dot { transition: none; }
  .sdb-add:active, .sdb-tbtn:active, .sdb-vbtn:active:not(:disabled) { transform: none; }
  .sdb-tools, .sdb-count.is-refused { animation: none; }
  .sdb-drag-ghost svg { transform: translate(-50%, -50%); }
}
@media (prefers-reduced-transparency: reduce) {
  .sdb-tools, .sdb-view, .sdb-menu { background: var(--paper); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (forced-colors: active) {
  .sdb-box, .sdb-line { stroke: CanvasText; }
  .sdb-block.is-sel .sdb-box { stroke: Highlight; }
}
