/* Sample-run pages (build_traces.py). Loaded after site.css and uses its tokens.
   Unit activity uses the brand's categorical colours; plate progress uses a separate neutral lightness ramp
   (monotone in both themes) so the two never compete; faults carry a glyph and a dashed outline, not colour alone. */

:root {
  --op-move: #8a8278; --op-proc: #e0621a; --op-meas: #4f7f9c; --op-svc: #8a8278;
  --pl-0: #e4ddd1; --pl-1: #bcb3a6; --pl-2: #857c70; --pl-3: #3d3833; --pl-text-hi: #fbfaf7;
  --on-band: #ece7de; --code-bg: #f0ece4; --focus-ring: #b9490f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --op-move: #9a9184; --op-proc: #ff833f; --op-meas: #8fb3c9; --op-svc: #9a9184;
    --pl-0: #4a443e; --pl-1: #7a7268; --pl-2: #b0a79a; --pl-3: #ece6dc; --pl-text-hi: #1b1815;
    --on-band: #2d2824; --code-bg: #262220; --focus-ring: #ff833f;
  }
}
:root[data-theme="dark"] {
  --op-move: #9a9184; --op-proc: #ff833f; --op-meas: #8fb3c9; --op-svc: #9a9184;
  --pl-0: #4a443e; --pl-1: #7a7268; --pl-2: #b0a79a; --pl-3: #ece6dc; --pl-text-hi: #1b1815;
  --on-band: #2d2824; --code-bg: #262220; --focus-ring: #ff833f;
}

main { min-width: 0; }

/* ------------------------------------------------------------ task page (after FrontierBioML's task pages) */
.tk-id { font: 500 .62em var(--mono); letter-spacing: .02em; color: var(--muted); vertical-align: .12em; margin-right: .2em; }
.tk-hero h1 { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.06; letter-spacing: -.02em; margin-top: 16px; max-width: 860px; }
.tk-local { margin-top: 10px; font: 12.5px/1.5 var(--mono); color: var(--accent); }
.tk-block { margin-top: 40px; }
.tk-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px 24px; margin-bottom: 14px; }
.tk-title { font-size: 20px; line-height: 1.25; }
.tk-table-wrap { overflow-x: auto; }
.tk-lb { font-variant-numeric: tabular-nums; }
.tk-lb .c-rank { width: 30px; font: 13px var(--mono); color: var(--muted); }
.tk-lb .model-cell .tag { margin-left: 4px; }
.tk-lb .harness-cell { font: 12.5px/1.4 var(--mono); color: var(--muted); white-space: nowrap; }
.tk-lb .tk-h-sub { display: none; }
.tk-lb .tk-mean { font: 500 14px var(--mono); }
.tk-lb .tk-mean small { font: 400 10.5px var(--mono); color: var(--muted); }
.tk-att { display: inline-block; min-width: 50px; text-align: center; font: 13px var(--mono); text-decoration: none; padding: 3px 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--ground); white-space: nowrap; }
a.tk-att:hover, a.tk-att:focus-visible { border-color: var(--accent); color: var(--accent); }
.tk-att--none { color: var(--faint); border-style: dashed; }
.tk-prose { display: grid; gap: 14px; max-width: 72ch; }
.tk-prose p { margin: 0; font-size: 16.5px; line-height: 1.65; }
.tk-prose a { text-decoration-color: var(--link-line); text-underline-offset: 3px; }
.tk-prose a:hover { text-decoration-color: currentColor; }
.tk-notes { margin-top: 12px; font-size: 13px; color: var(--muted); display: grid; gap: 2px; max-width: 760px; }
.tk-facts { margin: 0; border-top: 1px solid var(--line); }
.tk-facts > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); column-gap: 28px; align-items: baseline; padding: 13px 0 14px; border-bottom: 1px solid var(--line); }
.tk-facts dt { font: 400 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.tk-facts dd { margin: 0; font-size: 16px; line-height: 1.6; max-width: 72ch; }
.tk-pn { display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); margin-top: 48px; padding-top: 20px; }
.tk-pn a { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; text-decoration: none; }
.tk-pn a:hover { text-decoration: underline; }
.tk-pn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
@media (max-width: 640px) {
  .tk-lb .tk-c-h { display: none; }
  .tk-lb .tk-h-sub { display: block; }
  .tk-lb th, .tk-lb td { padding-right: 6px; }
  .tk-lb thead th.r { font-size: 0; }
  .tk-lb thead th.r::after { font-size: 10px; letter-spacing: .06em; }
  .tk-lb thead th:nth-child(4)::after { content: "1"; } .tk-lb thead th:nth-child(5)::after { content: "2"; }
  .tk-lb thead th:nth-child(6)::after { content: "3"; } .tk-lb thead th:nth-child(7)::after { content: "Mean"; }
  .tk-att { min-width: 0; padding: 3px 5px; font-size: 12px; }
  .tk-facts > div { grid-template-columns: minmax(0, 1fr); row-gap: 6px; }
  .tk-pn a { font-size: 15px; }
}

/* ============================================================ trace page (one attempt): header, result, replay, report, log
   Hierarchy: task -> run -> score -> replay (one timeline drives the 3D view, the top view and the log) -> final report -> log. */
/* the trace page runs wider than the text pages so the two replay views sit side by side; header and footer follow */
body[data-page="trace"] .wrap, .wrap--wide { max-width: calc(980px + 2 * var(--gutter)); }

/* ------------------------------------------------------------ header */
.tr-back { display: inline-flex; align-items: center; gap: 6px; margin-top: 24px; font: 13px var(--mono); color: var(--muted); text-decoration: none; }
.tr-back svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tr-back:hover { color: var(--accent); }
.tr-hero { margin-top: 22px; }
.tr-kicker { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font: 12px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tr-kicker__ic { display: inline-flex; color: var(--fc, var(--accent)); }
.tr-kicker__ic svg { width: 18px; height: 18px; }
.tr-kicker__id { color: var(--ink); font-weight: 500; }
.tr-kicker__set::before { content: ""; display: inline-block; width: 1px; height: 11px; background: var(--line); margin-right: 10px; vertical-align: -1px; }
body[data-page="trace"] .tr-kicker { --fc: var(--accent); }
.tr-hero h1 { font-size: clamp(28px, 3.8vw, 42px); line-height: 1.08; letter-spacing: -.02em; margin: 10px 0 16px; max-width: 900px; }
.tr-lede { margin: -4px 0 18px; max-width: 760px; font-size: 18px; line-height: 1.5; color: var(--ink); }
.tr-meta { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 28px; }
.tr-meta li { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.tr-meta .ico { width: 17px; height: 17px; flex: none; color: var(--muted); }
.tr-meta .logo { fill: var(--pc, var(--ink)); color: var(--pc, var(--ink)); width: 16px; height: 16px; }
.tr-meta__k { font: 11px/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.tr-meta__v { font: 500 14px/1.2 var(--mono); color: var(--ink); }
.tr-meta li.is-model .tr-meta__v { font: 500 17px/1.2 var(--serif); }
.tr-runnote { margin-top: 10px; font-size: 13.5px; color: var(--muted); max-width: 760px; }

/* ------------------------------------------------------------ result: the score alone, then the times */
.tr-result { display: flex; flex-wrap: wrap; align-items: stretch; gap: 18px 0; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.tr-score { display: flex; flex-direction: column; justify-content: flex-end; padding-right: 36px; margin-right: 32px; border-right: 1px solid var(--line); min-width: 120px; }
.tr-score__l { font: 11px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tr-score__v { font: 500 54px/1 var(--mono); letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--ink); margin-top: 6px; }
.tr-stats { display: flex; flex-wrap: wrap; gap: 16px 40px; margin: 0; align-items: flex-end; }
.tr-stats > div { min-width: 0; position: relative; }
.tr-stats dt { display: flex; align-items: center; gap: 4px; font: 11px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tr-stats dd { margin: 6px 0 0; }
.tr-stats .v { font: 500 24px/1.1 var(--mono); font-variant-numeric: tabular-nums; }
.tr-stats .u { font: 13px var(--mono); color: var(--muted); margin-left: 5px; }
.tr-stats small { display: block; margin-top: 3px; font: 12px/1.3 var(--mono); color: var(--muted); }
.tr-info { display: inline-flex; }
.tr-info__b { display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; background: none; color: var(--faint); border-radius: 50%; }
.tr-info__b .ico { width: 14px; height: 14px; }
.tr-info__b:hover, .tr-info__b:focus-visible { color: var(--accent); }
.tr-info__t { position: absolute; z-index: 60; left: 0; top: 22px; width: min(300px, calc(100vw - 32px)); padding: 10px 12px; background: var(--raised); border: 1px solid var(--line); box-shadow: var(--tip-shadow); border-radius: 6px;
  font: 13.5px/1.45 var(--serif); letter-spacing: 0; text-transform: none; color: var(--ink); display: none; pointer-events: none; }
.tr-info:hover .tr-info__t, .tr-info__b:focus-visible + .tr-info__t, .tr-info__b:focus + .tr-info__t { display: block; }
.tr-flags { margin-top: 14px; font-size: 14px; color: var(--muted); max-width: 820px; }
.tr-brief { margin: -8px 0 18px; max-width: 760px; }
.tr-brief[open] { border-bottom: 1px solid var(--line-soft); }
.tr-brief summary { cursor: pointer; display: inline-block; padding: 4px 0; font: 12.5px var(--mono); color: var(--accent); list-style: none; }
.tr-brief summary::-webkit-details-marker { display: none; }
.tr-brief summary::before { content: "+"; display: inline-block; width: 16px; color: var(--faint); }
.tr-brief[open] summary::before { content: "–"; }
.tr-brief summary:hover { color: var(--ink); }
.tr-brief__body { padding: 0 0 14px; font-size: 15.5px; }
.tr-brief__body p + p { margin-top: 8px; }
.tr-brief__body .label { display: block; margin-top: 12px; }

/* ------------------------------------------------------------ replay: heading, the one timeline (sticky), views */
.tr-body { margin-top: 44px; }
.tr-sec-head { display: grid; gap: 6px; }
.tr-sec-head h2 { font-size: clamp(24px, 2.6vw, 30px); }
.tr-sec-sub { font-size: 15px; color: var(--muted); max-width: 760px; }
.tr-before { max-width: 760px; font: 12.5px/1.5 var(--mono); color: var(--muted); }
.tr-before summary { cursor: pointer; display: inline-block; padding: 4px 10px; border: 1px dashed var(--line); border-radius: 999px; list-style: none; }
.tr-before summary::-webkit-details-marker { display: none; }
.tr-before summary:hover { color: var(--ink); border-color: var(--link-line); }
.tr-before__list { list-style: none; margin: 8px 0 0; padding: 0; border-left: 2px solid var(--line); }
.tr-before__list li { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 8px; padding: 3px 0 3px 12px; }
.tr-before__list .c-t { color: var(--faint); }
.tr-before__list .c-s { color: var(--ink); overflow-wrap: anywhere; }

.tr-player { position: sticky; top: 0; z-index: 20; margin-top: 14px; padding: 10px 0 6px; background: color-mix(in srgb, var(--ground) 94%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.tr-controls { display: flex; align-items: center; gap: 14px; }
.tr-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--raised); color: var(--ink); display: grid; place-items: center; flex-shrink: 0; cursor: pointer; padding: 0; }
.tr-btn:hover { border-color: var(--accent); color: var(--accent); }
.tr-btn svg { width: 16px; height: 16px; fill: currentColor; }
.tr-play { width: 42px; height: 42px; background: var(--ink); color: var(--ground); border-color: var(--ink); }
.tr-play:hover { background: var(--accent); border-color: var(--accent); color: var(--ground); }
.tr-next { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--raised); color: var(--ink); font: 12.5px var(--mono); white-space: nowrap; flex-shrink: 0; }
.tr-next:hover { border-color: var(--accent); color: var(--accent); }
.tr-next svg { width: 13px; height: 13px; fill: currentColor; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tr-speed { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tr-speed__l { font: 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tr-btn .i-pause { display: none; }
.tr-btn.is-playing .i-play { display: none; }
.tr-btn.is-playing .i-pause { display: inline; }
.tr-clock { display: grid; line-height: 1.1; min-width: 92px; }
.tr-clock__t { font: 500 18px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tr-clock__l { font: 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; margin-top: 3px; }
/* the timeline: event marks above the track, the track, then its ends and the key */
.tr-tl { flex: 1; min-width: 120px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "track track track" "a key b"; }
.tr-tl.has-pre { grid-template-columns: 118px auto minmax(0, 1fr) auto; grid-template-areas: "pre track track track" "prel a key b"; column-gap: 0; }
.tr-tl__pre { grid-area: pre; position: relative; align-self: center; height: 22px; margin: 0 6px 0 0; padding: 0; border: 0; border-radius: 3px 0 0 3px; cursor: pointer;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--faint) 22%, transparent) 0 3px, transparent 3px 6px); }
.tr-tl__pre::after { content: ""; position: absolute; right: -6px; top: 3px; bottom: 3px; width: 2px; background: var(--ink); border-radius: 1px; }
.tr-tl__pre:hover { background-color: var(--subtle); }
.tr-tl__dots { position: absolute; inset: 0; }
.pre-dot { position: absolute; top: 50%; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%; background: var(--faint); font-style: normal; }
.pre-dot.is-bad { background: var(--oc-fail); opacity: .75; }
.tr-tl__prel { grid-area: prel; font: 10px/1.3 var(--mono); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; }
.tr-tl__marks { grid-area: track; position: relative; height: 12px; margin: 0 8px; align-self: center; pointer-events: none; z-index: 1; }
.tr-tl__ends { display: contents; }
.tr-tl__ends span { font: 10.5px var(--mono); color: var(--muted); white-space: nowrap; margin-top: 6px; }
#tr-tl-a { grid-area: a; } #tr-tl-b { grid-area: b; text-align: right; }
.tr-tl__key { grid-area: key; display: flex; justify-content: center; flex-wrap: wrap; gap: 2px 20px; font: 10.5px var(--mono); color: var(--muted); padding: 0 16px; min-width: 0; }
.tr-tl__key span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.mk { position: absolute; top: 2px; height: 8px; font-style: normal; }
.mk-script { background: color-mix(in srgb, var(--op-meas) 70%, transparent); border-radius: 3px; height: 6px; top: 3px; }
.mk-alarm { width: 3px; margin-left: -1.5px; background: var(--oc-fail); border-radius: 1px; height: 12px; top: 0; }
.mk-report { width: 9px; height: 9px; margin-left: -4.5px; top: 1.5px; background: var(--accent); transform: rotate(45deg); border-radius: 1px; box-shadow: 0 0 0 1.5px var(--ground); }
/* marks that would touch step off the track (assets/js/trace.js stagger()): above it, then below it */
.mk-alarm.is-up, .mk-alarm.is-down { height: 8px; }
.mk-alarm.is-up { top: -10px; } .mk-alarm.is-down { top: 14px; }
.mk-report.is-up { top: -11px; } .mk-report.is-down { top: 14px; }
.mk-key { display: inline-block; font-style: normal; }
.mk-key.mk-script { width: 14px; height: 5px; background: color-mix(in srgb, var(--op-meas) 70%, transparent); border-radius: 2px; }
.mk-key.mk-alarm { width: 3px; height: 10px; background: var(--oc-fail); border-radius: 1px; }
.mk-key.mk-report { width: 7px; height: 7px; background: var(--accent); transform: rotate(45deg); }
.tr-scrub { grid-area: track; width: 100%; height: 22px; margin: 0; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; touch-action: pan-y; }
.tr-scrub::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 45%, transparent) var(--p, 0%), color-mix(in srgb, var(--faint) 35%, transparent) var(--p, 0%)); }
.tr-scrub::-webkit-slider-thumb { position: relative; z-index: 2; -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin-top: -5px; border-radius: 50%; background: var(--accent); border: 3px solid var(--ground); box-shadow: 0 0 0 1px var(--accent); }
.tr-scrub::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
.tr-scrub::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
.tr-scrub::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 3px solid var(--ground); box-shadow: 0 0 0 1px var(--accent); }
.tr-speed select { font: 12px var(--mono); color: var(--ink); background: var(--raised); border: 1px solid var(--line); border-radius: 6px; padding: 7px 4px; }
.tr-caption-row { display: flex; align-items: baseline; gap: 4px 14px; margin-top: 8px; min-height: 26px; }
.tr-caption { font-size: 18px; line-height: 1.3; min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-caption.k-alarm { color: var(--oc-fail); }
.tr-caption.k-alarm::before { content: "⚠ "; }
.tr-caption.k-report::before { content: "◆ "; color: var(--accent); }
.tr-caption.k-idle { color: var(--muted); }
.tr-caption-t { font: 12.5px var(--mono); font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.tr-skip { font: 11.5px var(--mono); color: var(--accent); white-space: nowrap; margin-left: auto; }

.tr-replay { margin-top: 14px; }
.tr-viewtabs { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-bottom: 10px; background: var(--raised); }
.tr-viewtabs button { border: 0; background: none; font: 12.5px var(--mono); color: var(--muted); padding: 7px 16px; border-radius: 999px; }
.tr-viewtabs button[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.tr-views { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.tr-views[data-show="both"] { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); align-items: stretch; }
.tr-views[data-show="top"] .tr-view--3d, .tr-views[data-show="3d"] .tr-view--top { display: none; }
.tr-view { margin: 0; display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); overflow: hidden; }
.tr-view figcaption { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; padding: 9px 14px 8px; border-bottom: 1px solid var(--line-soft); font: 12px/1.3 var(--mono); color: var(--muted); }
.tr-view figcaption b { font-weight: 500; color: var(--ink); }
.tr-view__hint { color: var(--muted); }
.tr-map { width: 100%; padding: 4px; flex: 1; display: flex; align-items: center; }
.tr-schem { display: block; width: 100%; height: auto; }
.tr-3d { position: relative; flex: 1; min-height: 380px; overflow: hidden; touch-action: pan-y; }
.tr-views[data-show="3d"] .tr-3d { min-height: 0; aspect-ratio: 4 / 3.4; }
.tr-3d__c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.tr-3d__c:active { cursor: grabbing; }
.tr-3d__msg { position: absolute; inset: 0; display: grid; place-items: center; font: 12px var(--mono); color: var(--muted); }
.tr-3d__labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.l3 { position: absolute; left: 0; top: 0; display: inline-flex; align-items: center; gap: 5px; max-width: 230px; padding: 3px 7px; border-radius: 5px; white-space: nowrap;
  background: color-mix(in srgb, var(--raised) 86%, transparent); border: 1px solid var(--line); font: 10.5px/1.2 var(--mono); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); will-change: transform; }
.l3__ic { display: inline-flex; color: var(--muted); }
.l3__ic svg { width: 12px; height: 12px; }
.l3__ic:empty { display: none; }
.l3__n { font-weight: 500; flex: none; }
.l3__s { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.l3__s:empty { display: none; }
.l3.is-busy { border-color: var(--op-proc); } .l3.is-busy.k-meas { border-color: var(--op-meas); } .l3.is-busy.k-svc, .l3.is-busy.k-move { border-color: var(--op-svc); }
.l3.is-busy .l3__s { color: var(--ink); }
.l3.is-fault { border-color: var(--oc-fail); } .l3.is-fault .l3__s { color: var(--oc-fail); }
.l3.is-focus { box-shadow: 0 0 0 1.5px var(--ink); }
.l3.is-off { opacity: .7; }
.l3.is-quiet, .is-narrow .l3--store { display: none; }
.l3--store { background: color-mix(in srgb, var(--raised) 70%, transparent); border-color: transparent; box-shadow: none; color: var(--muted); }

/* the top view (SVG) */
.tr-schem text { font-family: var(--mono); fill: var(--ink); }
.sc-ic { color: var(--muted); }
.sc-block { fill: var(--ground); stroke: var(--line); stroke-width: 1; }
.sc-store { fill: none; stroke: var(--line); stroke-dasharray: 2 3; }
.sc-name { font-size: 11.5px; font-weight: 500; }
.sc-sname { font-size: 10.5px; fill: var(--muted) !important; }
.sc-count { font-size: 10px; fill: var(--faint) !important; }
.sc-state { font-size: 10px; fill: var(--muted) !important; }
.sc-slot { fill: none; stroke: var(--line); stroke-width: .8; }
.sc-prog { fill: var(--muted); }
.sc-unit.is-busy .sc-block { stroke-width: 2; }
.sc-unit.is-busy .sc-state { fill: var(--ink) !important; }
.sc-unit.k-proc .sc-block { stroke: var(--op-proc); } .sc-unit.k-proc .sc-prog { fill: var(--op-proc); }
.sc-unit.k-meas .sc-block { stroke: var(--op-meas); } .sc-unit.k-meas .sc-prog { fill: var(--op-meas); }
.sc-unit.k-move .sc-block { stroke: var(--op-move); } .sc-unit.k-move .sc-prog { fill: var(--op-move); }
.sc-unit.k-svc .sc-block { stroke: var(--op-svc); stroke-dasharray: 4 2; } .sc-unit.k-svc .sc-prog { fill: var(--op-svc); }
.sc-unit.is-off .sc-block { stroke-dasharray: 3 3; fill: transparent; }
.sc-unit.is-off .sc-name { fill: var(--muted) !important; }
.sc-unit.is-warming .sc-block { stroke-dasharray: 5 2; stroke: var(--op-svc); }
.sc-unit.is-fault .sc-block { stroke: var(--oc-fail); stroke-width: 2.2; stroke-dasharray: 5 2; }
.sc-unit.is-fault .sc-state { fill: var(--oc-fail) !important; font-weight: 500; }
.sc-unit.is-focus .sc-block { fill: var(--subtle); }
.sc-unit.is-focus:not(.is-busy):not(.is-fault) .sc-block { stroke: var(--ink); stroke-width: 2; }
.sc-unit.is-focus .sc-name { font-weight: 600; }
.sc-sink .sc-block { stroke-dasharray: none; fill: var(--subtle); }
.sc-rail { stroke: var(--faint); stroke-width: 3; stroke-linecap: round; opacity: .6; }
.sc-tick { stroke: var(--faint); stroke-width: 1.5; }
.sc-arm rect.sc-arm-body { fill: var(--ink); }
.sc-arm text { fill: var(--ground) !important; font-size: 10.5px; font-weight: 500; }
.sc-arm.is-focus rect.sc-arm-body { stroke: var(--muted); stroke-width: 3; paint-order: stroke; }
.sc-plate rect { stroke: var(--ink); stroke-opacity: .45; stroke-width: .7; }
.sc-plate text { font-size: 8px; fill: var(--ink) !important; pointer-events: none; }
.sc-plate.pl-0 rect { fill: var(--pl-0); } .sc-plate.pl-1 rect { fill: var(--pl-1); }
.sc-plate.pl-2 rect { fill: var(--pl-2); } .sc-plate.pl-3 rect { fill: var(--pl-3); }
.sc-plate.pl-2 text, .sc-plate.pl-3 text { fill: var(--pl-text-hi) !important; }
.sc-plate.is-hl rect { stroke: var(--ink); stroke-width: 2.2; stroke-opacity: 1; }
/* one legend under both views */
.tr-legend { display: flex; flex-wrap: wrap; gap: 6px 28px; margin-top: 10px; font: 12px/1.4 var(--mono); color: var(--muted); }
.tr-legend .lg-g { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.tr-legend .lg-g > span { display: inline-flex; align-items: center; gap: 5px; }
.tr-legend .lg-h { color: var(--ink); }
.tr-legend .lg { display: inline-block; width: 12px; height: 9px; border-radius: 2px; font-style: normal; }
.lg.k-proc { background: var(--op-proc); } .lg.k-meas { background: var(--op-meas); }
.lg.k-svc { border: 1.5px dashed var(--op-svc); }
.lg.k-fault { border: 1.5px dashed var(--oc-fail); }
.lg.lg-focus { border: 2px solid var(--ink); background: var(--subtle); }
.lg.pl-0 { background: var(--pl-0); } .lg.pl-1 { background: var(--pl-1); } .lg.pl-2 { background: var(--pl-2); } .lg.pl-3 { background: var(--pl-3); }
.tr-agentline { display: flex; align-items: baseline; gap: 8px; max-width: 100%; margin-top: 2px; padding: 2px 0; border: 0; background: none; text-align: left; font: 12.5px/1.45 var(--mono); color: var(--muted); }
.tr-agentline .label { color: var(--ink); white-space: nowrap; }
.tr-agentline .tx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tr-agentline .go { color: var(--accent); white-space: nowrap; margin-left: 4px; }
.tr-agentline:hover .go { text-decoration: underline; text-underline-offset: 3px; }
.tr-agentline:disabled .go { display: none; }
.tr-agentline:empty { display: none; }
.s-script { display: inline-block; font: 500 9.5px/1.5 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ground); background: var(--ink); border-radius: 3px; padding: 0 5px; margin-right: 6px; vertical-align: 1px; }

/* ------------------------------------------------------------ the final report (or hand-in): the agent's own hand-off */
.tr-report { margin-top: 48px; padding: 24px 26px 26px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); }
.tr-report__head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.tr-report__icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--subtle); color: var(--accent); flex: none; }
.tr-report__icon .ico { width: 18px; height: 18px; }
.tr-report__head h2 { font-size: 26px; }
.tr-report__when { font: 12px var(--mono); color: var(--muted); }
.tr-report__lede { margin-top: 10px; font-size: 15px; color: var(--muted); max-width: 70ch; }
.tr-report__counts { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.tr-report__counts li { display: grid; min-width: 104px; padding: 10px 16px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--ground); }
.tr-report__counts b { font: 500 26px/1.1 var(--mono); font-variant-numeric: tabular-nums; }
.tr-report__counts span { font: 11px/1.3 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.tr-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; padding: 4px 0; border: 0; background: none; font: 12.5px var(--mono); color: var(--accent); }
.tr-link .ico { width: 15px; height: 15px; }
.tr-link:hover span { text-decoration: underline; text-underline-offset: 3px; }
.tr-report__msg { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.tr-report__msg .md { margin: 10px 0 0; padding-left: 16px; border-left: 2px solid var(--line); font-size: 16.5px; line-height: 1.6; max-width: 74ch; }
.tr-report__k { display: block; margin-top: 14px; }
.tr-report__counts li.is-diag { background: transparent; border-style: dashed; }
.tr-report__diag { margin-top: 10px; font-size: 15px; }
.tr-report__diag b { font: 500 15px var(--mono); }
.tr-report__note { margin-top: 10px; font-size: 14px; color: var(--muted); max-width: 70ch; }
.tr-pre--file.is-short { max-height: 300px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 75%, transparent); mask-image: linear-gradient(#000 75%, transparent); }
.tr-more { margin: 4px 12px 10px; }
.tr-report__msg .md p + p, .tr-report__msg .md ul + p, .tr-report__msg .md p + ul { margin-top: 10px; }
.tr-report__msg .md ul { margin: 0; padding-left: 20px; }
.tr-report__msg .md code { overflow-wrap: anywhere; }
.tr-report__msg .md strong { font-weight: 600; }
.tr-file { margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--ground); }
.tr-file summary { cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 9px 12px; font: 12.5px var(--mono); background: var(--subtle); }
.tr-file summary .ico { width: 15px; height: 15px; color: var(--muted); }
.tr-file summary .ln { margin-left: auto; color: var(--muted); }
.tr-file .tr-pre { max-height: 440px; }

/* ------------------------------------------------------------ log: agent steps | cell calls */
.tr-log { margin-top: 48px; }
.tr-log__head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; border-bottom: 1px solid var(--line); }
.tr-log__head h2 { font-size: 26px; padding-bottom: 8px; }
.tr-tabs { display: flex; gap: 22px; }
.tr-tabs button { border: 0; background: none; padding: 8px 0 9px; font: 13px var(--mono); color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tr-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tr-tabs button:hover { color: var(--accent); }
.tr-tabs .n { color: var(--faint); margin-left: 4px; }
.tr-pane__sub { margin: 10px 0 8px; font: 12px/1.5 var(--mono); color: var(--muted); }
.tr-check { font: 12px var(--mono); color: var(--muted); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.tr-check input { accent-color: var(--accent); }
.tr-calls, .tr-steps { position: relative; list-style: none; margin: 0; padding: 0; max-height: 620px; overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid var(--line-soft); }
.tr-calls li { display: grid; grid-template-columns: 70px 74px minmax(0, 1fr); gap: 8px; padding: 4px 8px; font: 11.5px/1.45 var(--mono); border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.tr-calls li:hover { background: var(--subtle); }
.tr-calls li.is-cur { background: var(--subtle); box-shadow: inset 2px 0 0 var(--accent); }
.tr-calls .c-t { color: var(--muted); }
.tr-calls .c-v { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.tr-calls .c-s { overflow-wrap: anywhere; }
.tr-calls li.c-bad .c-s, .tr-calls li.c-bad .c-v { color: var(--oc-fail); }
.tr-calls .c-polls { color: var(--faint); }
.tr-calls li.c-evt, .tr-calls li.c-evt .c-v { color: var(--muted); font-weight: 400; }
.tr-calls li.c-err .c-s, .tr-calls li.c-err .c-v { color: var(--oc-fail); }
.tr-steps .st { border-bottom: 1px solid var(--line-soft); }
.st__row { display: grid; grid-template-columns: 36px minmax(0, 1fr) 68px; gap: 10px; width: 100%; padding: 6px 8px; border: 0; background: none; text-align: left; font-size: 14.5px; align-items: baseline; }
.st__row:hover { background: var(--subtle); }
.st.is-cur > .st__row { background: var(--subtle); box-shadow: inset 2px 0 0 var(--accent); }
.st.is-open > .st__row { background: var(--subtle); }
.st .s-n { font: 11px var(--mono); color: var(--faint); }
.st .s-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-tool { font: 12px var(--mono); color: var(--muted); }
.st .s-t, .st .s-c { font: 11px var(--mono); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.st.has-c > .st__row { grid-template-columns: 36px minmax(0, 1fr) 84px 68px; }
.st .s-c { color: var(--ink); }
.tr-steps-head { display: grid; grid-template-columns: 36px minmax(0, 1fr) 84px 68px; gap: 10px; padding: 0 8px 4px; font: 10.5px var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.tr-steps-head .c { text-align: right; white-space: nowrap; }
.tr-steps-head.no-c { grid-template-columns: 36px minmax(0, 1fr) 68px; }
.tr-steps-head.no-c #tr-steps-hc { display: none; }
.st--user .s-txt { font-style: italic; }
.st__detail { padding: 6px 12px 16px 54px; }
.st__meta { font: 11.5px var(--mono); color: var(--muted); }
.st__script { font: 12px/1.45 var(--mono); background: var(--subtle); border-left: 2px solid var(--ink); padding: 6px 8px; margin: 8px 0; }
.st__msg { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15.5px; margin-top: 6px; }
.st__rsn { white-space: pre-wrap; overflow-wrap: anywhere; font-style: italic; color: var(--muted); border-left: 2px solid var(--line); padding-left: 12px; margin: 6px 0; font-size: 14.5px; }
.st__detail .label { display: block; margin-top: 10px; }
.tr-call { margin-top: 10px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.tr-call summary { cursor: pointer; padding: 6px 10px; font: 12px var(--mono); background: var(--subtle); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-call summary b { font-weight: 500; color: var(--muted); margin-right: 8px; }
.tr-call .label { padding: 6px 10px 2px; margin: 0; }
.tr-pre { margin: 0; padding: 8px 10px; font: 11.5px/1.5 var(--mono); background: var(--code-bg); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow-y: auto; }
.tr-empty { color: var(--muted); font-size: 14px; margin-top: 12px; }

/* ------------------------------------------------------------ narrow screens */
@media (max-width: 899px) {
  .tr-3d { min-height: 0; }
  .tr-score { border-right: 0; margin-right: 0; padding-right: 0; flex-basis: 100%; }
}
@media (max-width: 700px) {
  .tr-player { position: static; }
  .tr-result { padding-top: 16px; }
  .tr-score { border-right: 0; margin-right: 0; padding-right: 0; flex-basis: 100%; }
  .tr-score__v { font-size: 46px; }
  .tr-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; width: 100%; }
  .tr-stats .v { font-size: 20px; }
  .tr-next span { display: none; }
  .tr-stats > div:nth-child(2n) .tr-info__t { left: auto; right: 0; }
  .tr-next { width: 40px; padding: 0; justify-content: center; }
  .tr-speed__l { display: none; }
  .st.has-c > .st__row, .tr-steps-head { grid-template-columns: 26px minmax(0, 1fr) 56px 44px; gap: 6px; }
  .tr-steps-head.no-c { grid-template-columns: 26px minmax(0, 1fr) 44px; }
  .tr-steps-head .c { white-space: normal; }
  .tr-meta { gap: 8px 20px; }
  .tr-controls { flex-wrap: wrap; gap: 8px 12px; }
  .tr-tl { order: 5; flex-basis: 100%; }
  .tr-next { margin-left: auto; }
  .tr-caption-row { flex-wrap: wrap; min-height: 52px; align-content: flex-start; row-gap: 2px; }
  .tr-caption { font-size: 16px; white-space: normal; flex-basis: 100%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .tr-skip { margin-left: 0; }
  .tr-report { padding: 18px 16px 20px; }
  .tr-report__counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .tr-report__counts li { min-width: 0; padding: 8px 10px; }
  .tr-report__counts b { font-size: 22px; }
  .tr-calls li { grid-template-columns: 60px 62px minmax(0, 1fr); gap: 6px; font-size: 11px; }
  .st__row { grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; font-size: 14px; }
  .st__detail { padding-left: 12px; }
  .tr-calls, .tr-steps { max-height: 64vh; }
  .tr-tl { grid-template-areas: "track track track" "a . b" "key key key"; }
  .tr-tl.has-pre { grid-template-areas: "pre track track track" "prel a . b" "key key key key"; grid-template-columns: 70px auto minmax(0, 1fr) auto; }
  .tr-tl__key { justify-content: flex-start; padding: 2px 0 0; }
  .tr-clock { min-width: 0; }
  .tr-clock__l { white-space: normal; max-width: 9em; }
  .tr-before__list li { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (pointer: coarse) {
  .tr-btn { width: 44px; height: 44px; }
  .tr-play { width: 46px; height: 46px; }
  .tr-speed select { min-height: 40px; padding: 8px 6px; }
  .tr-scrub { height: 40px; }
  .tr-scrub::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -9px; }
  .st__row, .tr-calls li { padding-top: 9px; padding-bottom: 9px; }
  .tr-calls, .tr-steps { overscroll-behavior-y: auto; }
  .tr-brief summary { padding: 13px 0; }
  .tr-check { padding: 10px 0; }
  .tr-back { padding: 10px 0; margin-top: 14px; }
  /* task pages */
  .tk-att { min-height: 34px; display: inline-grid; place-items: center; position: relative; }
  .tk-att::after { content: ""; position: absolute; inset: -5px -2px; }
  .tk-pn a { padding: 8px 0; }
}
@media (max-width: 640px) {
  .tk-lb .c-rank { width: 18px; }
  .tk-lb .tk-h-sub { display: inline; }
  .tk-lb .tk-h-sub::before { content: "\00B7"; margin: 0 4px 0 3px; opacity: .5; }
}

/* task pages: scores without a replay, refusal/block tags, the lede */
.tk-att--plain { color: var(--ink); border-color: transparent; background: none; }
.tk-st { display: block; font: 10.5px/1.2 var(--mono); color: var(--muted); letter-spacing: .02em; }
.tk-lede { margin-top: 12px; font-size: 18px; line-height: 1.55; max-width: 68ch; color: var(--ink); }

/* task pages: setting and unit pictograms (assets/js/lab_icons.js), always beside their text label */
.tk-facts .tk-ico-label { display: inline-flex; align-items: center; gap: 9px; }
.tk-facts .tk-ico { display: inline-flex; flex: none; width: 20px; height: 20px; color: var(--muted); }
.tk-facts .tk-ico svg { display: block; width: 20px; height: 20px; }
.tk-facts [data-setting="a"] { --fc: var(--f-a); } .tk-facts [data-setting="b"] { --fc: var(--f-b); } .tk-facts [data-setting="c"] { --fc: var(--f-c); }
.tk-facts [data-setting] .tk-ico { color: var(--fc, var(--muted)); }
.tk-units { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.tk-units li { display: inline-flex; align-items: center; gap: 7px; font-size: 15px; line-height: 1.4; }

/* task pages: cost, output tokens and agent time per attempt (one row per model, one dot per attempt) */
.tk-spend-head { flex-wrap: wrap; align-items: flex-end; }
.tk-spend { margin-top: 4px; }
.tk-spend .tk-sp-name { font: 14px var(--serif); }
.tk-spend .tk-sp-val { fill: var(--ink); font: 11.5px var(--mono); }
.tk-spend .tk-sp-none { fill: var(--faint); font: 11px var(--mono); }
.tk-spend .tk-sp-mean { stroke-width: 2; stroke-linecap: round; }
.tk-spend .tk-sp-pt { outline: none; }
.tk-spend .tk-sp-pt .dot { stroke: var(--ground); stroke-width: 1.5; fill-opacity: .9; transition: r .12s ease; }
.tk-spend .tk-sp-pt:hover .dot, .tk-spend .tk-sp-pt:focus-visible .dot { stroke: var(--ink); }
.tk-spend .tk-sp-pt:focus-visible .hit { stroke: var(--focus); stroke-width: 1.5; }
.tk-spend .tk-sp-row { outline: none; }
.tk-spend .tk-sp-row:focus-visible .tk-sp-name { text-decoration: underline; text-decoration-color: var(--focus); }


.tr-sec-sub:empty { display: none; }
/* the site header and footer keep the same 980px frame on every page, also on the wide replay pages */
body[data-page="trace"] .site-header .wrap, body[data-page="trace"] .site-footer .wrap { max-width: calc(980px + 2 * var(--gutter)); }

/* 3D labels: a thin leader from the label down to its instrument */
.l3::after { content: ""; position: absolute; left: var(--lx, 50%); top: 100%; width: 1px; height: var(--lead, 0); background: currentColor; opacity: .35; pointer-events: none; }

/* the pages are 980px wide now: the timeline gets its own full-width row under the controls at every width, with the
   start/end labels on one line and the key on the next, so nothing overlaps (also in the method page's embedded replay) */
.tr-controls { flex-wrap: wrap; row-gap: 12px; }
.tr-tl { order: 5; flex-basis: 100%; grid-template-areas: "track track track" "a . b" "key key key"; }
.tr-tl.has-pre { grid-template-areas: "pre track track track" "prel a . b" "key key key key"; }
.tr-tl__key { justify-content: flex-start; padding: 4px 0 0; }
.tr-next { margin-left: auto; }
