/* Sequence Detective: the Sequence Desk inside the practice shell's stage (about 1066 × 628 at 1366 × 768). */
.sd { position: absolute; inset: 0; overflow: auto; scrollbar-gutter: stable; display: flex; flex-direction: column; gap: 10px; padding: 10px 12px; font-size: 16px; line-height: 1.3;
  container-type: inline-size; color: #1d2b25; background: linear-gradient(#e7efeb, #d6e3dc);
  --sd-card: #ffffff; --sd-line: #a9bdb4; --sd-soft: #46564f; --sd-accent: #2f5d50; --sd-accent-soft: #dcebe4; --sd-text: #1b1f2a; --sd-branch: #2c3e50;
  --sd-same: #e3f1ea; --sd-same-ink: #2f6e52; --sd-diff: #fde6da; --sd-diff-stripe: #f2b79b; --sd-diff-ink: #a63c14; --sd-mark: #fff1b8;
  --sd-ok: #1f7a44; --sd-ok-bg: #e3f6e8; --sd-bad: #b42318; --sd-bad-bg: #fde7e4; --sd-in: #ffffff; --sd-diag: #eef1ef; --sd-tile: #f4f1ea; --sd-tile-line: #d5cfc2; }
html[data-theme="dark"] .sd { color: #eef3f0; background: linear-gradient(#18221e, #121a17);
  --sd-card: #20302a; --sd-line: #557065; --sd-soft: #c6d6ce; --sd-accent: #8fd3b6; --sd-accent-soft: #24443a; --sd-text: #eef3f0; --sd-branch: #cfe3da;
  --sd-same: #1f3b30; --sd-same-ink: #9fe0c0; --sd-diff: #4a2618; --sd-diff-stripe: #6e3a22; --sd-diff-ink: #ffb999; --sd-mark: #4d4215;
  --sd-ok: #7fdca0; --sd-ok-bg: #173d27; --sd-bad: #ffb4a8; --sd-bad-bg: #4a1e1a; --sd-in: #121a17; --sd-diag: #2a3631; }
.sd *, .sd *::before, .sd *::after { box-sizing: border-box; }
.sd p { margin: 0; }
.sd-card { background: var(--sd-card); border: 1.5px solid var(--sd-line); border-radius: 12px; padding: 10px 12px; }
.sd-k { font-weight: 800; color: var(--sd-accent); margin-bottom: 6px !important; }
.sd-soft { color: var(--sd-soft); font-weight: 400; }
.sd-src { font-size: 16px; color: var(--sd-soft); margin-top: 6px !important; }
.sd-legend { margin-top: 6px !important; font-weight: 600; white-space: pre-wrap; }
.sd-msg:empty { display: none; }
.sd-msg { font-weight: 700; color: var(--sd-bad); }
.sd-ico { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 34px; flex: none; border-radius: 7px; background: var(--sd-tile); border: 1px solid var(--sd-tile-line); }
.sd-ico svg { display: block; }
.sd-frag { display: inline-grid; place-items: center; width: 40px; height: 34px; flex: none; border-radius: 6px; border: 2px solid var(--sd-soft); color: var(--sd-text); font-weight: 800; }

/* ── alignment viewer ── */
.sd-blocks { display: flex; flex-direction: column; gap: 10px; }
.sd-rowkey { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.sd-rowkey-i { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.sd-block { display: flex; align-items: flex-start; gap: 6px; }
.sd-labs { flex: none; width: 166px; display: flex; flex-direction: column; padding: 2px 0; }
.sd-labs > * { display: flex; align-items: center; }
.sd-rulerlab { height: 22px; font-size: 16px; color: var(--sd-soft); justify-content: flex-end; padding-right: 4px; }
.sd-rowlab { height: 36px; gap: 6px; font-weight: 700; line-height: 1.1; }
.sd-rowlab.is-compact { justify-content: center; }
.sd-matchlab { height: 26px; }
.sd-block:has(.sd-rowlab.is-compact) .sd-labs { width: 48px; }
.sd--gap .sd-labs > :last-child { height: 46px; }
.sd-rowname { min-width: 0; }
.sd-cols { display: flex; flex-wrap: nowrap; gap: 2px; }
.sd-pos, .sd-res, .sd-glyph { display: flex; align-items: center; justify-content: center; width: 100%; }
.sd-pos { height: 22px; font-size: 16px; color: var(--sd-soft); font-variant-numeric: tabular-nums; }
.sd-pos.is-tick { color: var(--sd-line); }
.sd-res { height: 36px; font: 700 23px/1 ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; color: var(--sd-text); }
.sd-glyph { height: 26px; font: 800 19px/1 ui-monospace, Menlo, Consolas, monospace; }
.sd-col { width: 44px; padding: 0; margin: 0; display: flex; flex-direction: column; align-items: stretch; border: 2px solid transparent; border-radius: 8px; background: var(--sd-card);
  box-shadow: inset 0 0 0 1px var(--sd-line); cursor: pointer; font: inherit; color: inherit; }
.sd-col:hover:not(:disabled) { background: var(--sd-accent-soft); }
.sd-col:focus-visible, .sd-slot:focus-visible, .sd-mx-cell:focus-visible, .sd-opt:focus-visible { outline: 3px solid var(--sd-accent); outline-offset: 2px; }
.sd-col.is-marked { border: 3px solid var(--sd-accent); background: var(--sd-mark); box-shadow: none; }
.sd-col.is-marked .sd-glyph { color: var(--sd-accent); }
.sd-col.is-same, .sd-gcol.is-same .sd-res--fixed, .sd-ex-col.is-same { background: var(--sd-same); }
.sd-col.is-same .sd-glyph, .sd-gcol.is-same .sd-glyph, .sd-gcol.is-match .sd-glyph, .sd-ex-col.is-same .sd-glyph { color: var(--sd-same-ink); }
.sd-col.is-diff, .sd-ex-col.is-diff { background: repeating-linear-gradient(45deg, var(--sd-diff) 0 6px, var(--sd-diff-stripe) 6px 8px); }
.sd-col.is-diff .sd-res, .sd-col.is-diff .sd-glyph, .sd-gcol.is-diff .sd-glyph, .sd-ex-col.is-diff .sd-res, .sd-ex-col.is-diff .sd-glyph { color: var(--sd-diff-ink); }
.sd-col.is-diff .sd-res { text-decoration: underline 3px; text-underline-offset: 3px; }
.sd-col.is-wrongmark { border: 3px dashed var(--sd-bad); }
.sd-col:disabled { cursor: default; opacity: 1; }
/* gap rows: top letters fixed, bottom row one button per column */
.sd-gcol { width: 44px; display: flex; flex-direction: column; align-items: stretch; }
.sd-res--fixed { border-radius: 8px 8px 0 0; background: var(--sd-card); box-shadow: inset 0 0 0 1px var(--sd-line); }
.sd-gcol.is-diff .sd-res--fixed { background: repeating-linear-gradient(45deg, var(--sd-diff) 0 6px, var(--sd-diff-stripe) 6px 8px); }
.sd-slot { width: 44px; height: 46px; padding: 0; margin: 0; border: 2px solid var(--sd-line); border-radius: 0 0 8px 8px; background: var(--sd-card); cursor: pointer; font: inherit; color: inherit; display: flex; }
.sd-slot:hover:not(:disabled) { background: var(--sd-accent-soft); }
.sd-slot .sd-res { height: 100%; }
.sd-slot.is-empty { border-style: dashed; background: transparent; }
.sd-slot.is-gap { background: repeating-linear-gradient(-45deg, var(--sd-diag) 0 5px, var(--sd-card) 5px 9px); border-color: var(--sd-accent); border-width: 3px; }
.sd-slot.is-gap .sd-res { color: var(--sd-accent); }
.sd-slot.is-wrongmark { outline: 3px dashed var(--sd-bad); outline-offset: -3px; }
.sd-slot:disabled { cursor: default; }

/* ── worksheet ── */
.sd-sheet { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; }
@container (max-width: 720px) { .sd-sheet { grid-template-columns: minmax(0, 1fr); } }
.sd-part { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sd-step { display: flex; align-items: flex-start; gap: 8px; line-height: 1.3; }
.sd-num { flex: none; width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--sd-accent); color: var(--sd-card); font-weight: 800; }
.sd-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding-left: 36px; }
.sd-out { min-width: 44px; height: 44px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 8px; background: var(--sd-diag); font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }
.sd-out--text { font-size: 16px; }
.sd-cell { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sd-in { width: 104px; height: 44px; padding: 0 10px; border: 2px solid var(--sd-line); border-radius: 8px; background: var(--sd-in); color: inherit; font-family: inherit; font-size: 20px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; text-align: right; }
.sd-in:focus-visible { outline: 3px solid var(--sd-accent); outline-offset: 1px; }
.sd-in.is-ok { border-color: var(--sd-ok); background: var(--sd-ok-bg); }
.sd-in.is-bad { border-color: var(--sd-bad); background: var(--sd-bad-bg); }
.sd-unit { font-weight: 800; font-size: 20px; }
.sd-mark { font-weight: 800; }
.sd-mark.is-ok { color: var(--sd-ok); }
.sd-mark.is-bad { color: var(--sd-bad); }
.sd-mark--line:empty { display: none; }
.sd-mark--line { margin-top: 6px !important; }

/* ── tree: difference table + cladograms ── */
.sd-tree { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; }
@container (max-width: 820px) { .sd-tree { grid-template-columns: minmax(0, 1fr); } }
.sd-matrixcard, .sd-optscard { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sd-matrixcard { width: max-content; max-width: 100%; }
.sd-matrixcard .sd-src, .sd-matrixcard .sd-mark--line { width: 0; min-width: 100%; }
.sd-mxwrap { overflow-x: auto; }
.sd-matrix { border-collapse: separate; border-spacing: 3px; font-variant-numeric: tabular-nums; }
.sd-matrix caption { text-align: left; font-weight: 700; padding-bottom: 4px; caption-side: top; }
.sd-mx-colh { padding: 0; vertical-align: bottom; }
.sd-mx-colh { width: 52px; }
.sd-mx-colh .sd-ico { width: 50px; }
.sd-mx-colh, .sd-mx-colh * { text-align: center; }
.sd-mx-colh .sd-letter { display: block; font-weight: 800; }
.sd-mx-rowh { text-align: left; padding-right: 6px; white-space: nowrap; }
.sd-mx-rowh > span { vertical-align: middle; }
.sd-mx-rowh .sd-letter { display: inline-block; width: 18px; font-weight: 800; }
.sd-mx-rowh .sd-ico { margin-right: 6px; }
.sd-mx-diag { width: 52px; height: 46px; text-align: center; color: var(--sd-soft); border-radius: 8px; background: repeating-linear-gradient(-45deg, var(--sd-diag) 0 5px, transparent 5px 10px); }
.sd-matrix td { padding: 0; }
.sd-mx-cell { width: 52px; height: 46px; border: 2px solid var(--sd-line); border-radius: 8px; background: var(--sd-card); color: inherit; font-family: inherit; font-size: 20px; font-weight: 800; line-height: 1; cursor: pointer; position: relative; }
.sd-mx-cell:hover:not(:disabled) { background: var(--sd-accent-soft); }
.sd-mx-cell.is-on { background: var(--sd-accent); color: var(--sd-card); border-color: var(--sd-accent); box-shadow: 0 0 0 2px var(--sd-card), 0 0 0 4px var(--sd-accent); }
.sd-mx-cell.is-answer { border: 3px solid var(--sd-ok); background: var(--sd-ok-bg); color: var(--sd-text); box-shadow: none; }
.sd-mx-cell.is-answer.is-on { background: var(--sd-ok-bg); }
.sd-mx-cell.is-wrong { border: 3px dashed var(--sd-bad); background: var(--sd-bad-bg); color: var(--sd-text); box-shadow: none; }
.sd-mx-cell:disabled { cursor: default; opacity: 1; }
.sd-opts { display: grid; gap: 10px; }
.sd-opt { display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 6px 8px 4px; border: 2px solid var(--sd-line); border-radius: 12px; background: var(--sd-card); color: inherit; font: inherit; cursor: pointer; text-align: left; min-width: 0; }
.sd-opt:hover:not(:disabled) { background: var(--sd-accent-soft); }
.sd-opt-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 800; }
.sd-opt-h > :first-child::before { content: ''; display: inline-block; width: 16px; height: 16px; margin-right: 8px; vertical-align: -2px; border-radius: 50%; border: 2px solid var(--sd-soft); }
.sd-opt[aria-checked="true"] { border: 3px solid var(--sd-accent); background: var(--sd-accent-soft); }
.sd-opt[aria-checked="true"] .sd-opt-h > :first-child::before { border-color: var(--sd-accent); background: radial-gradient(var(--sd-accent) 0 4px, transparent 5px); }
.sd-opt.is-right { border: 3px solid var(--sd-ok); background: var(--sd-ok-bg); }
.sd-opt.is-wrong { border: 3px dashed var(--sd-bad); background: var(--sd-bad-bg); }
.sd-opt.is-right .sd-opt-m { color: var(--sd-ok); }
.sd-opt.is-wrong .sd-opt-m { color: var(--sd-bad); }
.sd-opt:disabled { cursor: default; opacity: 1; }
.sd-opt-pic { display: block; overflow: hidden; }
.sd-opt-pic svg { display: block; max-width: none; }

/* ── Briefing example (static) ── */
.sd.sd-example { position: static; display: flex; flex-direction: column; gap: 8px; padding: 0; background: none; overflow: visible; container-type: normal; }
.sd-ex-align { display: flex; gap: 6px; overflow-x: auto; }
.sd-ex-labs { display: flex; flex-direction: column; flex: none; }
.sd-ex-labs > * { height: 26px; display: flex; align-items: center; gap: 6px; font-weight: 700; }
.sd-ex-labs > .sd-ex-lab { height: 36px; }
.sd-ex-labs svg { width: 42px; height: 28px; }
.sd-ex-cols { display: flex; gap: 2px; }
.sd-ex-col { width: 30px; display: flex; flex-direction: column; border-radius: 6px; }
.sd-ex-col .sd-pos { height: 26px; }
.sd-ex-col .sd-res { height: 36px; font-size: 20px; }
.sd-ex-col .sd-glyph { height: 26px; }
.sd-ex-tree { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.sd-matrix--ex th, .sd-matrix--ex td { padding: 4px 8px; text-align: center; }
.sd-matrix--ex td { background: var(--sd-card); border: 1px solid var(--sd-line); border-radius: 6px; min-width: 44px; }
.sd-matrix--ex .sd-ex-min { font-weight: 800; outline: 3px solid var(--sd-accent); }
.ps-brief .sd-example { color: inherit; }

/* page-level placement of shell pop-ups on wide screens: the calculator and the folded assignment card open over the
   customer column, not over the worksheet */
@media (min-width: 901px) { html.ps-locked .lga-card { right: auto !important; left: 12px; max-width: 276px; } }
@media (min-width: 901px) { .ps .ps-calc, .ps-calc { right: auto; left: 30px; bottom: 76px; } }

/* the shell stretches Briefing drawings to the column; the cladogram keeps its drawn size (16 px labels) */
.ps-brief .sd-example svg.sd-clado, .sd-example svg.sd-clado { width: auto !important; height: auto !important; max-width: 100%; max-height: none !important; flex: none; }
.ps-brief .sd-example .sd-ex-labs svg { width: 42px !important; height: 28px !important; }
.sd-matrix--ex td.sd-ex-corner { background: none; border: 0; }
