/* OpenWorldEngineer: Artifacts › Long context (artifacts-long-context.html, assets/art/long-context.js). Builds on
   styles.css (tokens, .card, .seg, .select, .note); adds only lc- classes. The accuracy grid uses one blue ramp,
   light to dark for more correct (flipped in dark mode); the document strip marks answer records in the accent
   colour and everything else in greys. */

.lc {
  --lc-q1: #cde2fb; --lc-q2: #9ec5f4; --lc-q3: #6da7ec; --lc-q4: #3987e5; --lc-q5: #256abf; --lc-q6: #0d366b;
  --lc-t1: #15171A; --lc-t2: #15171A; --lc-t3: #15171A; --lc-t4: #15171A; --lc-t5: #FFFFFF; --lc-t6: #FFFFFF;
  --lc-near: #8A9099; --lc-other: #C9CDD3; --lc-ans: var(--accent);
  container-type: inline-size; display: grid; gap: 16px; min-width: 0; color: var(--ink); font-size: var(--fs-ui);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lc {
    --lc-q1: #0d366b; --lc-q2: #184f95; --lc-q3: #256abf; --lc-q4: #3987e5; --lc-q5: #6da7ec; --lc-q6: #cde2fb;
    --lc-t1: #F2F3F5; --lc-t2: #F2F3F5; --lc-t3: #F2F3F5; --lc-t4: #0F1012; --lc-t5: #0F1012; --lc-t6: #0F1012;
    --lc-near: #7D838C; --lc-other: #44484E;
  }
}
:root[data-theme="dark"] .lc {
  --lc-q1: #0d366b; --lc-q2: #184f95; --lc-q3: #256abf; --lc-q4: #3987e5; --lc-q5: #6da7ec; --lc-q6: #cde2fb;
  --lc-t1: #F2F3F5; --lc-t2: #F2F3F5; --lc-t3: #F2F3F5; --lc-t4: #0F1012; --lc-t5: #0F1012; --lc-t6: #0F1012;
  --lc-near: #7D838C; --lc-other: #44484E;
}
.lc-head p { max-width: 80ch; }
.lc-load { padding: 28px 18px; }
.lc-k { font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.lc-ic { display: contents; }
.lc-ic svg { width: 11px; height: 11px; flex: none; }

/* the set switch: hidden test questions | public dev questions */
.lc-setbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; min-width: 0; }
.lc-setbar .seg { flex: none; max-width: 100%; }
.lc-setnote { flex: 1 1 360px; max-width: 92ch; }

/* ---------------------------------------------------------------- graded grid */
.lc-gridcard { display: grid; gap: 10px; padding: 14px 18px 16px; min-width: 0; }
.lc-card-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 18px; }
.lc-card-h h2, .lc-list h2 { font-size: 0.9375rem; font-weight: 660; }
.lc-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 0.75rem; color: var(--muted); }
.lc-legend .k { font-weight: 600; }
.lc-abbr { display: none; }
@container (max-width: 900px) { .lc-abbr { display: inline; } }
.lc-legend i { display: inline-block; width: 14px; height: 12px; margin-right: 5px; vertical-align: -1px; border-radius: 0; }
.lc-legend i.lc-q0 { background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.lc-gridwrap { min-width: 0; }
.lc-grid { width: 100%; border-collapse: separate; border-spacing: 2px; table-layout: fixed; font-size: 0.8125rem; }
.lc-grid col.c-name { width: 220px; }
.lc-grid col.c-rew { width: 150px; }
.lc-grid .c-gap { border-left: 8px solid transparent; background-clip: padding-box; }
.lc-grid th { font-weight: 600; color: var(--muted); }
.lc-grid thead th { padding: 2px 0 4px; font-size: 0.75rem; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-grid thead tr.len th { color: var(--ink-2); box-shadow: inset 0 -1px 0 var(--rule); }
.lc-grid thead tr.len th.c-rew, .lc-grid thead tr.len th.c-name { box-shadow: none; }
.lc-grid thead th.c-rew { text-align: left; padding-left: 10px; vertical-align: bottom; }
.lc-grid .sm { display: none; }
.lc-grid tbody th { text-align: left; padding: 3px 8px 3px 0; vertical-align: middle; line-height: 1.25; }
.lc-grid tbody tr.first th, .lc-grid tbody tr.first td { border-top: 6px solid transparent; }
.lc-grid tbody tr.first:first-child th, .lc-grid tbody tr.first:first-child td { border-top: 0; }
.lc-grid .n-short, .lc-grid .n-tiny, .lc-grid .s-tiny { display: none; }
.lc-grid .nm { display: block; color: var(--ink); font-weight: 640; font-size: 0.8125rem; }
.lc-grid .sub { display: block; font-size: 0.6875rem; font-weight: 500; color: var(--muted); text-decoration: none; }
.lc-grid a.sub:hover { color: var(--link-hover); text-decoration: underline; }
.lc-grid .rew-sm { display: none; }
.lc-cell { height: 34px; padding: 0; border-radius: 0; text-align: center; vertical-align: middle; font-family: var(--font-mono); font-size: 0.75rem; font-variant-numeric: tabular-nums; font-weight: 560; cursor: default; }
.lc-q0 { background: transparent; box-shadow: inset 0 0 0 1px var(--rule); color: var(--muted); }
.lc-q1 { background: var(--lc-q1); color: var(--lc-t1); }
.lc-q2 { background: var(--lc-q2); color: var(--lc-t2); }
.lc-q3 { background: var(--lc-q3); color: var(--lc-t3); }
.lc-q4 { background: var(--lc-q4); color: var(--lc-t4); }
.lc-q5 { background: var(--lc-q5); color: var(--lc-t5); }
.lc-q6 { background: var(--lc-q6); color: var(--lc-t6); }
.lc-grid td.c-rew { padding-left: 10px; white-space: nowrap; }
.lc-grid td.c-rew b { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); margin-left: 8px; }
.lc-grid .rew { display: inline-block; width: calc(100% - 52px); height: 8px; vertical-align: 0; background: var(--hover); border-radius: 0; }
.lc-grid .rew i { display: block; height: 100%; background: var(--mark-soft); border-radius: 0; }
.lc-grid tr.base .nm { color: var(--ink-2); }
.lc-grid tbody tr.is-focus th { background: var(--accent-wash); box-shadow: inset 3px 0 0 var(--accent); padding-left: 8px; }
.lc-gridcard .note { max-width: 100ch; }

/* ---------------------------------------------------------------- question viewer + overview */
/* the overview sits under the viewer at every width: 13 models' 27 columns do not fit a side panel */
.lc-layout { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "viewer" "list"; gap: 16px; align-items: start; min-width: 0; }
.lc-viewer { grid-area: viewer; display: grid; gap: 14px; padding: 16px 18px 18px; min-width: 0; }
.lc-viewer:focus:not(:focus-visible) { outline: none; }
.lc-list { grid-area: list; min-width: 0; padding: 12px 10px 10px; }
.lc-list h2 { padding: 2px 6px 8px; }

.lc-nav { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lc-nav .select { flex: 1 1 auto; min-width: 0; max-width: 100%; }
.lc-iconbtn { flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--sheet); color: var(--ink); cursor: pointer; }
.lc-iconbtn:hover:not(:disabled) { border-color: var(--accent); }
.lc-iconbtn:disabled { opacity: 0.4; cursor: default; }
.lc-iconbtn svg { width: 16px; height: 16px; }
.lc-step .lc-iconbtn { width: 34px; height: 34px; }

.lc-title { display: grid; gap: 4px; }
.lc-title h2 { font-size: 1.25rem; line-height: 1.25; font-weight: 660; }
.lc-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: var(--fs-small); color: var(--muted); }

.lc-prompt { display: grid; gap: 4px; }
.lc-q { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--code-bg); border: 1px solid var(--rule); font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.55; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.lc-q .stem { color: var(--muted); }
.lc-truth { display: grid; gap: 6px; }

.lc-chips { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.lc-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 0; border: 1px solid var(--rule); background: var(--sheet); font-family: var(--font-mono); font-size: 0.75rem; font-weight: 560; color: var(--ink-2); white-space: nowrap; }
.lc-chip.is-gold { border-color: var(--rule-strong); color: var(--ink); }
.lc-chip.is-ok { border-color: var(--rule-strong); color: var(--ink); }
.lc-chip.is-bad { border-style: dashed; color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.lc-chip.is-none { color: var(--muted); font-family: var(--font-sans); border-style: dashed; }
.lc-miss { align-self: center; font-size: 0.75rem; color: var(--muted); }

/* document strip: every record's position in the prompt, answer records in the accent colour */
.lc-doc { display: grid; gap: 6px; border-top: 1px solid var(--rule); padding-top: 12px; min-width: 0; }
.lc-doc-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.lc-legend-doc i { width: 3px; height: 12px; border-radius: 0; margin-right: 6px; }
.lc-legend-doc i.st-ans { background: var(--lc-ans); }
.lc-legend-doc i.st-near, .lc-legend-doc i.st-memo { background: var(--lc-near); height: 9px; }
.lc-legend-doc i.st-memo { background: repeating-linear-gradient(var(--lc-near) 0 2px, transparent 2px 3px); }
.lc-legend-doc i.st-other { background: var(--lc-other); height: 6px; }
.lc-strip { position: relative; height: 34px; cursor: crosshair; }
.lc-strip-svg { position: absolute; inset: 0 0 auto 0; width: 100%; height: 30px; display: block; overflow: visible; }
.lc-strip-svg path { fill: none; stroke-width: 1; }
.lc-strip-svg .st-other { stroke: var(--lc-other); }
.lc-strip-svg .st-near { stroke: var(--lc-near); }
.lc-strip-svg .st-memo { stroke: var(--lc-near); stroke-dasharray: 2 1; }
.lc-strip-svg .st-ans { stroke: var(--lc-ans); stroke-width: 1.5; }
.lc-strip-svg .st-base { stroke: var(--rule-strong); }
.lc-marker { position: absolute; top: -2px; bottom: 0; width: 0; border-left: 2px solid var(--ink); transform: translateX(-1px); pointer-events: none; }
.lc-marker::before { content: ""; position: absolute; top: -5px; left: -6px; border: 5px solid transparent; border-top: 6px solid var(--ink); }
.lc-axis { position: relative; height: 16px; font-family: var(--font-mono); font-size: 0.6875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.lc-axis span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.lc-axis span:first-child { transform: none; }
.lc-axis span:last-child:not(:first-child) { transform: translateX(-100%); }
.lc-tipline { font-family: var(--font-mono); overflow-wrap: anywhere; }

.lc-step { display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: 4px; }
.lc-step-l { font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); min-width: 0; }
.lc-step-l .in { font-weight: 500; color: var(--muted); }
.lc-excerpt { display: grid; gap: 2px; padding: 8px 12px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--code-bg); font-size: 0.8125rem; line-height: 1.5; min-width: 0; }
.lc-excerpt .ln { min-width: 0; overflow-wrap: anywhere; }
.lc-excerpt .txt { color: var(--muted); font-size: 0.8125rem; }
.lc-excerpt .rec code { font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-2); background: none; padding: 0; }
.lc-excerpt .rec.m-ans code, .lc-excerpt .rec.m-near code, .lc-excerpt .rec.m-memo code { color: var(--ink); }
.lc-excerpt .rec.is-cur { margin-left: -12px; padding-left: 9px; border-left: 3px solid var(--lc-ans); }
.lc-excerpt .rec.is-cur code { font-weight: 640; color: var(--ink); }

.lc-freqwrap { display: grid; gap: 2px; margin-top: 6px; }
.lc-freq { border-collapse: collapse; font-size: 0.8125rem; width: auto; min-width: 280px; max-width: 100%; }
.lc-freq caption { text-align: left; padding-bottom: 4px; }
.lc-freq th, .lc-freq td { padding: 3px 14px 3px 0; text-align: right; font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--rule); }
.lc-freq th:first-child { text-align: left; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 560; color: var(--ink-2); }
.lc-freq thead th { font-family: var(--font-sans); font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.lc-freq td { font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-2); }
.lc-freq tr.is-win th, .lc-freq tr.is-win td:nth-child(2) { color: var(--ink); font-weight: 680; }

/* answers: one row per policy */
.lc-answers { display: grid; gap: 6px; border-top: 1px solid var(--rule); padding-top: 12px; }
.lc-who { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.lc-who-row { display: grid; grid-template-columns: minmax(130px, 190px) minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 4px 6px; border-radius: 0; }
.lc-who-row:hover { background: var(--hover); }
.lc-who-row.is-focus { background: var(--accent-wash); box-shadow: inset 3px 0 0 var(--accent); }
.lc-who-row.is-first:not(:first-child) { margin-top: 4px; border-top: 1px solid var(--rule); padding-top: 8px; border-radius: 0; }
.lc-who-name { display: grid; min-width: 0; font-size: 0.8125rem; }
.lc-who-name b { font-weight: 640; }
.lc-who-name small { font-size: 0.6875rem; color: var(--muted); }
.lc-who-ans { display: grid; gap: 3px; min-width: 0; }
.lc-raw { min-width: 0; font-family: var(--font-mono); font-size: 0.6875rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8125rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.lc-badge.is-ok { color: var(--ink); }
.lc-badge svg { width: 12px; height: 12px; }

/* overview: every question against every policy */
.lc-mxwrap { min-width: 0; overflow-x: auto; }
.lc-mx { width: 100%; min-width: 600px; border-collapse: separate; border-spacing: 0; font-size: 0.75rem; table-layout: fixed; }
.lc-mx col.c-q { width: 120px; }
.lc-mx col.c-base { width: 34px; }
/* narrow screens scroll the marks sideways under a fixed question column */
.lc-mx thead tr:first-child th:first-child, .lc-mx tbody tr:not(.grp) th { position: sticky; left: 0; z-index: 1; background: var(--sheet); }
.lc-mx th, .lc-mx td { padding: 0; text-align: center; font-weight: 500; }
.lc-mx thead th { background: var(--sheet); padding: 4px 0; font-size: 0.6875rem; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-mx thead th[colspan], .lc-mx thead th[rowspan]:not(:first-child) { box-shadow: inset 1px 0 0 var(--rule); }
.lc-mx thead .roles th { padding: 0 0 4px; font-size: 0.625rem; font-weight: 500; }
.lc-mx .sm { display: none; }
.lc-mx thead .roles th:nth-of-type(odd) { box-shadow: inset 1px 0 0 var(--rule); }
.lc-mx thead th:first-child, .lc-mx tbody th { text-align: left; }
.lc-mx .sum td, .lc-mx .sum th { padding: 5px 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; font-size: 0.6875rem; border-bottom: 1px solid var(--rule); }
.lc-mx .sum th { font-family: var(--font-sans); color: var(--muted); padding-left: 6px; }
.lc-mx .sum td:nth-of-type(odd) { box-shadow: inset 1px 0 0 var(--rule); }
.lc-rr { font-weight: 500; }
.lc-mx .grp th { padding: 10px 6px 3px; font-size: 0.6875rem; font-weight: 600; color: var(--muted); }
.lc-mx .grp th > span { position: sticky; left: 6px; }
.lc-mx tbody tr.q { cursor: pointer; }
.lc-mx tbody tr.q:hover > * { background: var(--hover); }
.lc-mx tbody tr.q.is-cur > * { background: var(--hover); }
.lc-mx tbody tr.q.is-cur > th { box-shadow: inset 3px 0 0 var(--accent); }
.lc-mx tbody tr.q > :first-child { border-radius: 0; }
.lc-mx tbody tr.q > :last-child { border-radius: 0; }
.lc-mx tbody tr.q td:nth-of-type(odd) { box-shadow: inset 1px 0 0 var(--rule); }
.lc-mx-b { display: block; width: 100%; min-height: 30px; padding: 4px 6px; border: 0; background: none; color: var(--ink); font: inherit; font-size: 0.75rem; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-mx-c { height: 30px; color: var(--muted); vertical-align: middle; }
.lc-mx-c .g { display: grid; place-items: center; width: 18px; height: 18px; margin: auto; border-radius: 0; }
.lc-mx-c .g svg { width: 11px; height: 11px; }
.lc-mx-c.is-ok { color: var(--ink); }
.lc-mx-c.is-ok .g { background: var(--mark-off-fill); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.lc-mx-c.is-na .g { font-family: var(--font-mono); }
.lc-list .note { padding: 10px 6px 2px; }

.lc button:focus-visible, .lc a:focus-visible, .lc select:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

@container (max-width: 760px) {
  .lc-grid col.c-name { width: 150px; }
  .lc-grid col.c-rew { width: 60px; }
  .lc-grid .rew { display: none; }
  .lc-grid td.c-rew b { margin-left: 0; }
  .lc-grid .n-full { display: none; }
  .lc-grid .n-short { display: inline; }
}
@container (max-width: 900px) {
  .lc-grid .lg { display: none; }
  .lc-grid .sm { display: inline; }
}
@container (max-width: 560px) {
  .lc-gridcard { padding: 12px 10px 14px; }
  .lc-viewer { padding: 14px; }
  .lc-grid { border-spacing: 1px; }
  .lc-grid .c-gap { border-left-width: 0; }
  .lc-cell { letter-spacing: -0.04em; }
  .lc-grid col.c-name { width: 76px; }
  .lc-grid col.c-rew { width: 0; }
  .lc-grid .c-rew { display: none; }
  .lc-grid .rew-sm { display: block; font-family: var(--font-mono); font-size: 0.6875rem; color: var(--ink-2); }
  .lc-grid .sub { font-size: 0.625rem; }
  .lc-grid .n-full, .lc-grid .n-short, .lc-grid .s-wide { display: none; }
  .lc-grid .n-tiny, .lc-grid .s-tiny { display: inline; }
  .lc-grid thead th { font-size: 0.6875rem; }
  .lc-cell { height: 30px; font-size: 0.6875rem; letter-spacing: -0.02em; }
  .lc-who-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name badge" "ans ans"; padding: 4px 4px 8px; }
  .lc-who-name { grid-area: name; }
  .lc-who-ans { grid-area: ans; }
  .lc-badge { grid-area: badge; }
  .lc-mx { min-width: 660px; }
  .lc-mx col.c-q { width: 64px; }
  .lc-mx col.c-base { width: 30px; }
  .lc-mx-c .g { width: 16px; height: 16px; }
  .lc-mx .lc-rr { display: none; }
  .lc-mx .lg { display: none; }
  .lc-mx .sm { display: inline; }
  .lc-mx-b { padding-inline: 4px; font-size: 0.6875rem; }
  .lc-list { padding-inline: 4px; }
}

/* a task page's frame (html.embed, see app.js initEmbed): one attempt's grid, types down and lengths across */
.embed .lc-viewer { grid-area: auto; }
.embed .lc-one { max-width: 560px; }
.embed .lc-one tbody th { font-size: 0.75rem; }
