/* LinkShift interface: visual system.
   Layers: page (--bg) < panel (--surface) < raised control (--raised) < selected (--selected).
   Identity: restrained violet from the logo (--brand); data colours stay semantic (ok / late / lost) and the two
   tunnels differ by colour AND shape/line (LinkShift: filled circle / solid; upstream: open diamond / dashed).
   Contrast of every text token is measured against every surface it can sit on (demo/tools/contrast.py). */
:root {
  color-scheme: dark;
  /* surfaces */
  --bg: #0a0a0f; --surface: #121219; --surface-hi: #16161f; --raised: #1b1b26; --hover: #222230; --selected: #251f3d;
  --border: #262634; --border-strong: #363649; --edge: rgba(255, 255, 255, .05);
  /* text */
  --text: #eeeef5; --muted: #b6b6c8; --subtle: #9d9db2;
  /* identity */
  --brand: #7c4dff; --brand-deep: #6233ea; --brand-soft: rgba(124, 77, 255, .16); --brand-line: rgba(150, 118, 255, .55);
  --accent: #c0b0ff; --link: #c0b0ff; --focus: #e0d6ff;
  /* data */
  --ls: #b49cff; --up: #9fb1c6; --ok: #3fd0a0; --late: #f2b84b; --lost: #ff7b72;
  --fault: rgba(255, 123, 114, .13);
  /* shape */
  --r-lg: 16px; --r: 11px; --r-sm: 8px; --r-pill: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --fs-body: 16px; --fs-label: 14px; --fs-meta: 13px; --fs-h3: 16px; --fs-section: 19px; --fs-page: 24px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  /* depth */
  --panel-bg: linear-gradient(180deg, var(--surface-hi) 0%, var(--surface) 140px);
  --shadow-1: inset 0 1px 0 var(--edge), 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-2: inset 0 1px 0 rgba(255, 255, 255, .07), 0 2px 4px rgba(0, 0, 0, .45), 0 12px 28px -14px rgba(0, 0, 0, .7);
  --glow-brand: 0 0 0 1px var(--brand-line), 0 6px 22px -8px rgba(124, 77, 255, .55);
  /* motion */
  --t: 180ms cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-reduced-motion: reduce) { :root { --t: 0ms linear; } * { scroll-behavior: auto !important; } }

* { box-sizing: border-box; }
html { background: var(--bg); scroll-padding-top: 96px; }
body { margin: 0; color: var(--text); font: var(--fs-body)/1.55 var(--font); background:
  radial-gradient(900px 340px at 8% -120px, rgba(124, 77, 255, .13), transparent 70%), var(--bg); background-repeat: no-repeat; min-height: 100vh; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; transition: color var(--t); }
a:hover { color: #fff; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); box-shadow: 0 0 0 5px rgba(124, 77, 255, .35); }
code, .mono { font-family: var(--mono); font-size: var(--fs-meta); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; background: var(--raised); color: var(--text); padding: 8px 14px; border-radius: var(--r-sm); }
.skip:focus { left: 16px; }

/* ---------- header ---------- */
.app-header { display: flex; align-items: center; gap: var(--s5); padding: 14px var(--s6); position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, rgba(18, 17, 27, .97), rgba(12, 12, 18, .97)); border-bottom: 1px solid var(--border);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .02), 0 8px 24px -16px rgba(0, 0, 0, .8); backdrop-filter: blur(6px); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: var(--s4); min-width: 0; }
.brand-mark { margin: 0; line-height: 0; position: relative; }
.brand-mark::before { content: ""; position: absolute; inset: -14px -24px; background: radial-gradient(closest-side, rgba(124, 77, 255, .16), transparent); pointer-events: none; }
.brand-mark img { display: block; height: 34px; width: auto; position: relative; }
.tagline { margin: 0; padding-left: var(--s4); border-left: 1px solid var(--border-strong); color: var(--muted); font-size: var(--fs-label); line-height: 1.3; max-width: 260px; }
.tabs { display: flex; gap: 2px; margin-left: auto; background: var(--surface); padding: 4px; border-radius: var(--r); border: 1px solid var(--border); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .4); }
.tabs [role=tab] { position: relative; background: transparent; border: 0; color: var(--muted); padding: 8px 16px; border-radius: var(--r-sm); font: inherit; font-size: 15px; font-weight: 500; cursor: pointer;
  transition: background-color var(--t), color var(--t), box-shadow var(--t); }
.tabs [role=tab]:hover { background: var(--hover); color: var(--text); }
.tabs [role=tab]:active { background: var(--raised); }
.tabs [role=tab][aria-selected=true] { color: #fff; background: linear-gradient(180deg, #2c2547, var(--selected)); box-shadow: inset 0 1px 0 rgba(192, 176, 255, .22), 0 0 0 1px rgba(124, 77, 255, .45); }
.context { display: flex; gap: var(--s3); align-items: center; padding: 10px var(--s6); border-bottom: 1px solid var(--border); color: var(--muted); font-size: var(--fs-label); flex-wrap: wrap; background: rgba(10, 10, 15, .6); }
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px; border-radius: var(--r-pill); font-size: var(--fs-meta); font-weight: 600; border: 1px solid var(--border-strong); color: var(--text); background: var(--raised); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--up); }
.badge.live::before { border-radius: 50%; background: var(--late); }
.badge.reference::before { background: var(--accent); }
.badge.emu { color: var(--muted); font-weight: 500; } .badge.emu::before { display: none; }
.banner { margin: var(--s4) var(--s6) 0; padding: var(--s3) var(--s4); border-radius: var(--r); background: rgba(255, 123, 114, .1); border: 1px solid rgba(255, 123, 114, .5); font-size: var(--fs-label); }

/* ---------- layout and type ---------- */
main { padding: var(--s6) var(--s6) var(--s7); max-width: 1640px; margin: 0 auto; }
[role=tabpanel] { display: none; } [role=tabpanel].on { display: block; }
.page-head { margin-bottom: var(--s5); }
.page-head h2 { font-size: var(--fs-page); letter-spacing: -.3px; font-weight: 650; }
.section { margin-top: var(--s7); }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s4); margin-bottom: var(--s4); flex-wrap: wrap; }
h2 { font-size: var(--fs-section); margin: 0; line-height: 1.3; font-weight: 650; letter-spacing: -.15px; }
.h-section { font-size: var(--fs-section); }
h3, .h-panel { font-size: var(--fs-h3); margin: 0 0 var(--s3); line-height: 1.35; font-weight: 650; color: var(--text); }
.lede { color: var(--muted); margin: 6px 0 0; max-width: 74ch; }
.card { background: var(--panel-bg); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s5); min-width: 0; box-shadow: var(--shadow-1); }
.card.flush { padding: var(--s2) var(--s4) var(--s3); }
.grid { display: grid; gap: var(--s4); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.muted { color: var(--muted); } .subtle { color: var(--subtle); } .small { font-size: var(--fs-label); } .meta { font-size: var(--fs-meta); color: var(--subtle); margin: var(--s2) 0 0; }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--s5); align-items: start; }

/* ---------- findings ----------
   Hover / focus-within: lift 2 px, brighter edge, deeper shadow. The card is not a link (no pointer cursor, no click
   action); focus-within mirrors hover when keyboard focus reaches its disclosure. Reduced motion: no lift, same edge. */
.finding { display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden;
  transition: transform 200ms cubic-bezier(.2, .7, .2, 1), border-color 200ms ease, box-shadow 200ms ease; }
.finding:hover, .finding:focus-within { transform: translateY(-2px); border-color: rgba(160, 132, 255, .55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 2px 4px rgba(0, 0, 0, .45), 0 16px 32px -14px rgba(124, 77, 255, .45); }
.finding.adverse:hover, .finding.adverse:focus-within { border-color: rgba(242, 184, 75, .85);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 2px 4px rgba(0, 0, 0, .45), 0 16px 32px -14px rgba(242, 184, 75, .35); }
@media (prefers-reduced-motion: reduce) { .finding, .finding:hover, .finding:focus-within { transform: none; transition: border-color 0s, box-shadow 0s; } }
.finding::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, var(--brand), transparent 70%); opacity: .8; }
.finding .claim { font-size: var(--fs-label); color: var(--muted); font-weight: 600; letter-spacing: .1px; }
.finding .value { font-size: 36px; font-weight: 700; line-height: 1.05; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.finding .value small { font-size: 16px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.finding .meaning { margin: 0; }
.finding .compare { margin: 0; color: var(--muted); font-size: var(--fs-label); }
.finding .qual { margin: 2px 0 0; padding-top: 10px; border-top: 1px solid var(--border); font-size: var(--fs-label); color: var(--muted); }
.finding .qual b { color: var(--text); font-weight: 600; }
.finding.adverse { border-color: rgba(242, 184, 75, .45); }
.finding.adverse::before { background: linear-gradient(90deg, var(--late), transparent 70%); }
.finding.adverse .value { color: var(--late); }
.finding .flag { display: inline-flex; align-self: flex-start; font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--late); border: 1px solid rgba(242, 184, 75, .5); border-radius: var(--r-pill); padding: 1px 9px; }

/* ---------- disclosures ---------- */
details { margin-top: auto; }
summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--link); font-size: var(--fs-label); font-weight: 600; padding: 6px 10px 6px 6px; margin-left: -6px; list-style: none; border-radius: var(--r-sm);
  transition: background-color var(--t), color var(--t); }
summary::-webkit-details-marker { display: none; }
summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform var(--t); margin-left: 2px; }
details[open] > summary::before { transform: rotate(45deg) translate(-2px, -1px); }
summary:hover { background: var(--hover); color: #fff; }
details .body { font-size: var(--fs-label); color: var(--muted); padding: var(--s2) 0 0; }
details .body p { margin: 0 0 var(--s2); max-width: 80ch; }

/* ---------- condition table ---------- */
.legend { display: flex; flex-wrap: wrap; gap: var(--s4); font-size: var(--fs-label); color: var(--muted); align-items: center; }
.key { display: inline-flex; align-items: center; gap: 8px; }
.ctable { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ctable th { text-align: left; font-size: var(--fs-meta); color: var(--subtle); font-weight: 600; padding: var(--s3) var(--s3) var(--s2); border-bottom: 1px solid var(--border-strong); white-space: normal; vertical-align: bottom; }
.ctable tbody th { font-weight: normal; text-align: left; vertical-align: middle; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); }
.ctable td { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); vertical-align: middle; font-size: var(--fs-label); }
.ctable tbody tr:not(.group) { transition: background-color var(--t); }
.ctable tbody tr:not(.group):hover { background: rgba(255, 255, 255, .025); }   /* reading aid only; rows are not actionable */
.ctable tr.group td { padding-top: var(--s4); font-weight: 650; color: var(--accent); border-bottom: 0; font-size: 12px; letter-spacing: .6px; text-transform: uppercase; }
.ctable .name { font-size: 15px; color: var(--text); }
.ctable .id { font-size: var(--fs-meta); color: var(--subtle); margin-left: 6px; }
.ctable .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ctable td.strip { padding-top: 2px; padding-bottom: 2px; }
.ctable svg { display: block; width: 100%; height: auto; }
.verdict { display: inline-block; padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--fs-meta); font-weight: 600; white-space: nowrap; border: 1px solid var(--border-strong); background: var(--raised); }
.verdict.better { color: var(--ok); border-color: rgba(63, 208, 160, .45); }
.verdict.worse { color: var(--late); border-color: rgba(242, 184, 75, .55); }
.verdict.tie { color: var(--muted); }
.axisnote { font-size: var(--fs-meta); color: var(--subtle); margin: var(--s3) var(--s1) var(--s1); max-width: 120ch; }
@media (max-width: 1000px) { .ctable .verdict { white-space: normal; text-align: center; } }

/* ---------- charts ---------- */
.chart { width: 100%; height: 320px; }
.chart.h220 { height: 220px; } .chart.h260 { height: 260px; } .chart.h340 { height: 340px; } .chart.h380 { height: 380px; }
.chart-stack { display: grid; gap: var(--s2); }
.cost-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: var(--s5); }

/* ---------- scope ---------- */
.scope-list { margin: 0; padding-left: 18px; } .scope-list li { margin: 0 0 var(--s2); } .scope-list li::marker { color: var(--subtle); }
#scope .card { font-size: 15px; }

/* ---------- controls ---------- */
.controls { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: var(--fs-meta); color: var(--muted); font-weight: 600; letter-spacing: .2px; }
.select { position: relative; }
.select::after { content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
select { appearance: none; font: inherit; font-size: 15px; width: 100%; background: linear-gradient(180deg, #20202c, var(--raised)); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--r);
  padding: 10px 44px 10px 14px; cursor: pointer; box-shadow: var(--shadow-2); transition: border-color var(--t), background-color var(--t); }
select:hover { border-color: #4a4a63; }
select:focus-visible { border-color: var(--brand-line); }
select option, select optgroup { background: #1b1b26; color: var(--text); }
select optgroup { color: var(--accent); font-style: normal; font-weight: 650; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 18px; border-radius: var(--r); font: inherit; font-size: 15px; font-weight: 650; cursor: pointer;
  color: #fff; border: 1px solid #8f68ff; background: linear-gradient(180deg, #7a4bff, var(--brand-deep)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 4px 14px -6px rgba(124, 77, 255, .7);
  transition: filter var(--t), box-shadow var(--t), background-color var(--t), border-color var(--t), opacity var(--t); }
.btn:hover:not(:disabled) { filter: brightness(1.1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 6px 18px -6px rgba(124, 77, 255, .85); }
.btn:active:not(:disabled) { filter: brightness(.92); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .35); }
.btn.secondary { color: var(--text); border-color: var(--border-strong); background: linear-gradient(180deg, #232331, var(--raised)); box-shadow: var(--shadow-2); }
.btn.secondary:hover:not(:disabled) { filter: none; background: var(--hover); border-color: #4a4a63; }
.btn.danger { color: var(--lost); border-color: rgba(255, 123, 114, .55); background: rgba(255, 123, 114, .06); box-shadow: none; }
.btn.danger:hover:not(:disabled) { filter: none; background: rgba(255, 123, 114, .14); }
.btn:disabled, .btn[aria-busy=true] { cursor: not-allowed; }
.btn:disabled { opacity: 1; color: #8e8ea3; border-color: var(--border); background: var(--raised); box-shadow: none; filter: none; }
.btn[aria-busy=true] { cursor: progress; }
.player { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; padding: var(--s3) var(--s4); background: var(--panel-bg); border: 1px solid var(--border); border-radius: var(--r-lg); margin: var(--s4) 0; box-shadow: var(--shadow-1);
  position: sticky; top: 74px; z-index: 5; }
.player input[type=range] { flex: 1; min-width: 200px; accent-color: var(--brand); cursor: pointer; }
.clock { font-variant-numeric: tabular-nums; font-size: 15px; min-width: 200px; color: var(--text); }
.phase { font-size: var(--fs-meta); font-weight: 600; padding: 3px 11px; border-radius: var(--r-pill); background: var(--raised); border: 1px solid var(--border-strong); color: var(--muted); }
.phase.in-fault { color: var(--lost); border-color: rgba(255, 123, 114, .6); background: rgba(255, 123, 114, .08); }

/* ---------- replay ---------- */
.replay-top { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: var(--s4); align-items: start; }
.brief h3 { display: flex; align-items: baseline; gap: 8px; }
.brief .what { margin: 0 0 var(--s3); }
.brief dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--s4); margin: 0; font-size: var(--fs-label); }
.brief dt { color: var(--subtle); font-weight: 600; } .brief dd { margin: 0; color: var(--text); }
.timeline-strip { margin-top: var(--s2); }
.timeline-strip svg { width: 100%; height: auto; display: block; }
.strip-label { font-size: var(--fs-meta); color: var(--subtle); margin-top: var(--s4); }

/* ---------- key/value tables ---------- */
.kv { width: 100%; border-collapse: collapse; font-size: var(--fs-label); }
.kv th, .kv td { padding: 9px var(--s3); border-bottom: 1px solid var(--border); text-align: left; }
.kv th { color: var(--subtle); font-weight: 600; font-size: var(--fs-meta); background: rgba(255, 255, 255, .015); }
.kv td.num, .kv th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-meta); font-weight: 600; padding: 1px 10px; border-radius: var(--r-pill); border: 1px solid var(--border-strong); color: var(--muted); white-space: nowrap; }
.tag.ok { color: var(--ok); border-color: rgba(63, 208, 160, .4); }
.tag.warn { color: var(--late); border-color: rgba(242, 184, 75, .55); background: rgba(242, 184, 75, .06); }
.tag.none { color: var(--subtle); }

/* ---------- live ---------- */
.live-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(340px, 1fr); grid-template-areas: "scen arm run"; gap: var(--s4); align-items: start; }
.live-grid > :nth-child(1) { grid-area: scen; } .live-grid > :nth-child(2) { grid-area: arm; } .live-grid > :nth-child(3) { grid-area: run; }
fieldset.card { margin: 0; min-inline-size: 0; }
legend.h-panel { padding: 0; float: left; width: 100%; }
legend.h-panel + * { clear: both; }
.choice { display: grid; gap: 10px; }
.choice label { position: relative; display: flex; gap: var(--s3); align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r); cursor: pointer;
  background: linear-gradient(180deg, #1d1d28, var(--raised)); box-shadow: inset 0 1px 0 var(--edge); transition: border-color var(--t), background-color var(--t), box-shadow var(--t); }
.choice label:hover { border-color: #4a4a63; background: var(--hover); }
.choice label:has(input:checked) { border-color: var(--brand-line); background: linear-gradient(180deg, #2a2346, var(--selected)); box-shadow: inset 0 1px 0 rgba(192, 176, 255, .16), 0 0 0 1px rgba(124, 77, 255, .35); }
.choice label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.choice label:has(input:disabled) { cursor: not-allowed; }
.choice label:has(input:disabled:not(:checked)) { opacity: .55; }
.choice input { margin-top: 4px; accent-color: var(--brand); flex: none; width: 16px; height: 16px; }
.choice input:focus-visible { outline: none; box-shadow: none; }
.choice .t { font-weight: 650; display: block; } .choice .d { font-size: var(--fs-label); color: var(--muted); display: block; margin-top: 2px; }
.choice .id { font-size: var(--fs-meta); color: var(--subtle); font-weight: 500; margin-left: 6px; }
.run-card { display: flex; flex-direction: column; gap: var(--s3); }
.run-card .h-panel { margin-bottom: 0; }
.run-card .meta { margin: 0; }
.selected-config { margin: 0; font-size: var(--fs-label); color: var(--muted); }
.selected-config b { color: var(--text); font-weight: 600; }
.stepper { display: flex; gap: 0; list-style: none; margin: var(--s1) 0 0; padding: 10px 0 0; flex-wrap: wrap; border-top: 1px solid var(--border); }
.stepper li { display: flex; align-items: center; gap: 7px; padding: 4px 12px 4px 0; color: var(--subtle); font-size: var(--fs-label); }
.stepper li::before { content: ""; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--border-strong); flex: none; transition: background-color var(--t), border-color var(--t); }
.stepper li.done { color: var(--muted); } .stepper li.done::before { background: var(--muted); border-color: var(--muted); }
.stepper li.current { color: var(--text); font-weight: 650; } .stepper li.current::before { border-color: var(--brand); background: var(--brand); box-shadow: 0 0 0 4px rgba(124, 77, 255, .25); }
.stepper li.bad { color: var(--lost); font-weight: 650; } .stepper li.bad::before { border-color: var(--lost); background: var(--lost); }
.stepper li.warn { color: var(--late); font-weight: 650; } .stepper li.warn::before { border-color: var(--late); background: var(--late); }
.status-line { margin: 0; font-size: 15px; }
.status-list { display: grid; grid-template-columns: max-content 1fr; gap: 4px var(--s3); margin: 0; font-size: var(--fs-label); padding: 10px 12px; border-radius: var(--r); background: rgba(0, 0, 0, .22); border: 1px solid var(--border); }
.status-list dt { color: var(--subtle); } .status-list dd { margin: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; background: var(--subtle); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--late); } .dot.bad { background: var(--lost); } .dot.brand { background: var(--accent); }
.notice { padding: var(--s3) var(--s4); border-radius: var(--r); background: var(--raised); border: 1px solid var(--border); border-left: 3px solid var(--border-strong); font-size: var(--fs-label); }
.notice.warn { border-left-color: var(--late); } .notice.bad { border-left-color: var(--lost); } .notice.info { border-left-color: var(--accent); }
.notice details { margin-top: 2px; }
.empty { color: var(--muted); padding: var(--s6); text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--r); font-size: var(--fs-label); }
.loading { color: var(--muted); padding: var(--s5); font-size: var(--fs-label); }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.result-head h3 { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.result-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: var(--s4); align-items: start; margin-top: var(--s3); }

/* previous runs (rules use child selectors: the result panel nests other tables inside this one) */
.runlist { width: 100%; border-collapse: collapse; font-size: var(--fs-label); table-layout: fixed; }   /* fixed: opening a result must not reflow rows above */
.runlist > thead > tr > th, .runlist > tbody > tr > td { padding: 10px var(--s3); border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.runlist > thead > tr > th { font-size: var(--fs-meta); color: var(--subtle); font-weight: 600; }
.runlist > thead > tr > th:nth-child(1) { width: 12%; } .runlist > thead > tr > th:nth-child(2) { width: 23%; } .runlist > thead > tr > th:nth-child(3) { width: 14%; }
.runlist > thead > tr > th:nth-child(4) { width: 17%; } .runlist > thead > tr > th:nth-child(5) { width: 14%; } .runlist > thead > tr > th:nth-child(6) { width: 9%; } .runlist > thead > tr > th:nth-child(7) { width: 11%; }
.runlist > tbody > tr.run-row > td { overflow-wrap: anywhere; }
.runlist > thead > tr > th.num, .runlist > tbody > tr > td.num { text-align: right; font-variant-numeric: tabular-nums; }
.runlist tr.run-row { transition: background-color var(--t); }
.runlist tr.run-row.open { background: rgba(124, 77, 255, .07); }
.runlist tr.run-row.open > td { border-bottom-color: transparent; }
.runlist > tbody > tr.detail-row > td { padding: 0 var(--s3) var(--s4); background: rgba(124, 77, 255, .04); }
.runlist > tbody > tr > td.act, .runlist > thead > tr > th.act { text-align: right; white-space: nowrap; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: var(--fs-label); font-weight: 600; color: var(--accent); background: transparent; border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); padding: 5px 12px; cursor: pointer; transition: background-color var(--t), border-color var(--t), color var(--t); }
.toggle::before { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-1px, -1px); transition: transform var(--t); }
.toggle[aria-expanded=true]::before { transform: rotate(-135deg) translate(-1px, -1px); }
.toggle:hover { background: var(--hover); border-color: #4a4a63; color: #fff; }
.toggle:active { background: var(--raised); }
.toggle[aria-expanded=true] { background: var(--selected); border-color: var(--brand-line); color: #fff; }
.toggle[aria-busy=true] { cursor: progress; }
.panel { border: 1px solid var(--border-strong); border-radius: var(--r-lg); background: var(--panel-bg); padding: var(--s4); box-shadow: var(--shadow-1); }
.btn-close { font: inherit; font-size: var(--fs-label); font-weight: 600; color: var(--muted); background: var(--raised); border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 5px 12px; cursor: pointer; transition: background-color var(--t), color var(--t); }
.btn-close:hover { background: var(--hover); color: #fff; }

/* ---------- method ---------- */
.method-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s6); align-items: start; }
.toc { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 2px; padding: var(--s2); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--panel-bg); box-shadow: var(--shadow-1); }
.toc a { color: var(--muted); text-decoration: none; font-size: var(--fs-label); padding: 7px 12px; border-radius: var(--r-sm); border-left: 2px solid transparent; transition: background-color var(--t), color var(--t), border-color var(--t); }
.toc a:hover { background: var(--hover); color: var(--text); }
.toc a.active { color: #fff; background: var(--selected); border-left-color: var(--brand); }
#method { display: grid; gap: var(--s5); max-width: 1120px; }
#method .card > p, #method .card > ul { max-width: 82ch; }
.ref { width: 100%; border-collapse: collapse; font-size: var(--fs-label); }
.ref th, .ref td { padding: 10px var(--s3); border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.ref th { font-size: var(--fs-meta); color: var(--subtle); font-weight: 600; background: rgba(255, 255, 255, .015); }
.ref td:first-child { color: var(--text); font-weight: 600; width: 26%; }
.ref .meta { margin: 0; }
pre.cfg { background: #0c0c12; border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--s3); overflow-x: auto; font-size: var(--fs-meta); color: var(--muted); }

/* ---------- footer ---------- */
.app-footer { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--s6); color: var(--subtle); font-size: var(--fs-meta); border-top: 1px solid var(--border); flex-wrap: wrap; }
.app-footer img { opacity: .9; }
.foot-link { margin-left: auto; }

/* ---------- responsive ---------- */
@media (max-width: 1500px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .live-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); grid-template-areas: "scen arm" "scen run"; } }
@media (max-width: 1200px) { .result-grid, .split { grid-template-columns: 1fr; } .tagline { display: none; } }
@media (max-width: 1000px) {
  .g4, .g3, .g2, .live-grid, .cost-grid, .replay-top { grid-template-columns: 1fr; }
  .live-grid { grid-template-areas: "scen" "arm" "run"; }
  .method-layout { grid-template-columns: 1fr; } .toc { position: static; flex-direction: row; flex-wrap: wrap; }
  .app-header, .context, main, .app-footer { padding-left: var(--s4); padding-right: var(--s4); } .tabs { margin-left: 0; }
  .player { top: 0; position: static; }
}
@media (max-width: 720px) { .brand-mark img { height: 32px; width: 32px; } .tabs [role=tab] { padding: 8px 10px; font-size: 14px; } }
@media (max-width: 1000px) {
  .runlist > thead > tr > th:nth-child(1) { width: 13%; } .runlist > thead > tr > th:nth-child(2) { width: 19%; } .runlist > thead > tr > th:nth-child(3) { width: 13%; }
  .runlist > thead > tr > th:nth-child(4) { width: 14%; } .runlist > thead > tr > th:nth-child(5) { width: 15%; } .runlist > thead > tr > th:nth-child(6) { width: 10%; } .runlist > thead > tr > th:nth-child(7) { width: 16%; }
  .runlist > thead > tr > th, .runlist > tbody > tr > td { padding-left: 8px; padding-right: 8px; }
  .toggle { padding: 5px 9px; }
}
/* expanded saved result: the panel is the one frame tied to its row; the two areas inside it are flat */
.panel .result-grid > .card { background: transparent; box-shadow: none; padding: var(--s4); }
