/* sim-kit v2: copied verbatim from simulations/kit/sim-kit.css. Edit it there, never here. */
/* One look for every sim (skills/lms-authoring-simulations/SKILL.md, "One visual style").
   Hues: primary = now / your action; violet = the model; teal = the runtime or a tool;
   green = pass, kept, allowed; red = fail, lost, denied; amber = a limit or a line not to
   cross; orange, rose, gold = extra categories a sim needs (use in that order). */
:root {
  --bg: #ffffff; --fg: #0f172a; --muted: #475569; --surface: #f1f5f9;
  --panel: #ffffff; --border: #cbd5e1; --inset: #f8fafc;
  --primary: #2563eb; --primary-contrast: #ffffff;
  --violet: #6d28d9; --teal: #0f766e; --green: #15803d; --red: #b91c1c;
  --amber: #b45309; --orange: #9a3412; --rose: #be123c; --gold: #854d0e;
  --r-sm: 4px; --r-md: 8px; --r-lg: 14px; --dur: .6s;
}
@media (prefers-color-scheme: dark) {
  :root {
  --bg: #0f172a; --fg: #f8fafc; --muted: #a5b1c2; --surface: #1e293b;
  --panel: #1e293b; --border: #475569; --inset: #0f172a;
  --primary: #60a5fa; --primary-contrast: #0b1220;
  --violet: #c4b5fd; --teal: #2dd4bf; --green: #4ade80; --red: #fca5a5;
  --amber: #fbbf24; --orange: #fb923c; --rose: #fda4af; --gold: #fde047;
  }
}
[data-theme="light"] {
  --bg: #ffffff; --fg: #0f172a; --muted: #475569; --surface: #f1f5f9;
  --panel: #ffffff; --border: #cbd5e1; --inset: #f8fafc;
  --primary: #2563eb; --primary-contrast: #ffffff;
  --violet: #6d28d9; --teal: #0f766e; --green: #15803d; --red: #b91c1c;
  --amber: #b45309; --orange: #9a3412; --rose: #be123c; --gold: #854d0e;
}
[data-theme="dark"] {
  --bg: #0f172a; --fg: #f8fafc; --muted: #a5b1c2; --surface: #1e293b;
  --panel: #1e293b; --border: #475569; --inset: #0f172a;
  --primary: #60a5fa; --primary-contrast: #0b1220;
  --violet: #c4b5fd; --teal: #2dd4bf; --green: #4ade80; --red: #fca5a5;
  --amber: #fbbf24; --orange: #fb923c; --rose: #fda4af; --gold: #fde047;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; }
#app { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
h2 { font-size: 13px; margin: 0 0 8px; color: var(--muted); font-weight: 600; }

/* Controls: pills for choices (aria-pressed), one primary button for the main action */
button { font: inherit; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--fg); cursor: pointer; }
button.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); font-weight: 600; }
.chip, .pill { padding: 6px 12px; font-size: 13px; }
.chip[aria-pressed="true"], .pill[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); font-weight: 600; }
input[type="range"] { width: 200px; max-width: 100%; accent-color: var(--primary); }
.controls { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-top: 12px; }
.chips, .seg, .buttons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.seglabel { font-size: 12px; color: var(--muted); margin-right: 4px; }

/* The frame: predict card, stage (drawing + caption + controls), result panels, legend */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px; }
.predict .q { margin: 0 0 10px; line-height: 1.45; }
.verdict { margin: 8px 0 0; font-weight: 600; }
.verdict:empty { display: none; }
.scroll { overflow-x: auto; }
.stage svg { width: 100%; height: auto; display: block; }
.caption { margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface); line-height: 1.5; min-height: 3em; }
.legend { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* Drawing: flat 2-D shapes, hue stroke over a light tint of the same hue */
.k-title { fill: var(--fg); font-size: 13px; font-weight: 700; }
.k-label { fill: var(--fg); font-size: 12px; font-weight: 600; }
.k-small { fill: var(--muted); font-size: 10.5px; }
.k-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.k-box { fill: var(--panel); stroke: var(--border); stroke-width: 1.5; }
.k-now { stroke: var(--primary); stroke-width: 3; }
.k-off { fill: var(--surface); stroke: var(--border); stroke-dasharray: 4 4; }

/* Fit the screen (SKILL.md "Fit the screen"): the whole sim fits in 600 px of height on a
   1280x720 laptop. From 900 px wide the stage is two columns: the drawing on the left, at
   most 380 px tall, and the caption and controls beside it, so changing a setting never
   scrolls the drawing out of view. A sim with more than a caption under its drawing wraps
   the left column in .view and the right in .side. The predict card is a <details open> the learner can fold,
   and a secondary panel is a <details class="panel more">. */
details.predict > summary, details.more > summary { cursor: pointer; list-style: none; }
details.predict > summary::-webkit-details-marker, details.more > summary::-webkit-details-marker { display: none; }
details.predict > summary::before, details.more > summary::before { content: "\25BE\00A0"; color: var(--muted); }
details.predict:not([open]) > summary::before, details.more:not([open]) > summary::before { content: "\25B8\00A0"; }
details.predict:not([open]) > summary { margin: 0; }
details.more > summary { font-size: 13px; font-weight: 600; color: var(--muted); }
details.more[open] > summary { margin-bottom: 8px; }
@media (min-width: 900px) {
  .stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 32%); grid-template-rows: repeat(11, min-content) 1fr; column-gap: 16px; align-items: start; }
  .stage > .scroll, .stage > .scene, .stage > .view { grid-column: 1; grid-row: 1 / -1; }
  .stage > :not(.scroll):not(.scene):not(.view) { grid-column: 2; margin-top: 0; margin-bottom: 10px; }
  .stage .side { display: flex; flex-direction: column; gap: 10px; }
  .stage svg { max-height: 380px; }
  .stage .caption { margin: 0; }
  .stage .controls { margin-top: 0; flex-direction: column; align-items: stretch; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
.reduced *, .reduced *::before, .reduced *::after { transition: none !important; animation: none !important; }
/* end sim-kit v2 */

/* context-budget-explorer: the backpack. Blocks are categories: instructions grey, tool
   declarations teal (tools), history violet (the model's conversation), memory gold,
   retrieved chunks orange; the evidence gems are rose; the budget line is amber. */
.seglabel { min-width: 52px; }
.controls { flex-direction: column; align-items: stretch; gap: 10px; }
.receipt .controls { flex-direction: row; flex-wrap: wrap; }


/* The backpack */
.h { fill: var(--fg); font-size: 13px; font-weight: 700; text-anchor: middle; }
.bag { fill: var(--surface); stroke: var(--border); stroke-width: 3; }
.strap { fill: none; stroke: var(--border); stroke-width: 8; stroke-linecap: round; }
.blk rect:first-child { fill-opacity: .2; stroke-width: 1.5; transition: y var(--dur) ease, height var(--dur) ease; }
.blk .hatch { transition: y var(--dur) ease, height var(--dur) ease; }
.hatchline { stroke: var(--fg); stroke-width: 1.5; stroke-opacity: .35; }
.c-ins rect:first-child { fill: var(--muted); stroke: var(--muted); }
.c-tools rect:first-child { fill: var(--teal); stroke: var(--teal); }
.c-hist rect:first-child { fill: var(--violet); stroke: var(--violet); }
.c-mem rect:first-child { fill: var(--gold); stroke: var(--gold); }
.c-ret rect:first-child { fill: var(--orange); stroke: var(--orange); }
.bl { fill: var(--fg); font-size: 12px; font-weight: 700; }
.bl.small { font-size: 9.5px; }
.bt { fill: var(--fg); font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.goal line { stroke: var(--amber); stroke-width: 2; stroke-dasharray: 6 4; }
.goal text { fill: var(--amber); font-size: 11px; font-weight: 700; text-anchor: end; }
.pocket rect { fill: var(--panel); stroke: var(--border); stroke-width: 2; }
.pocket text { fill: var(--muted); font-size: 11px; font-weight: 600; text-anchor: middle; }
.chunk rect { fill: var(--panel); stroke: var(--orange); stroke-width: 1.5; }
.chunk.out rect { fill: var(--surface); stroke: var(--border); stroke-dasharray: 3 3; }
.chunk.gemchunk.kept rect { stroke: var(--rose); stroke-width: 2.5; }
.cr { fill: var(--muted); font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.cn { fill: var(--fg); font-size: 11.5px; }
.chunk.out .cn { fill: var(--muted); text-decoration: line-through; }
.gemchunk .cn { font-weight: 700; }
.cut { stroke: var(--amber); stroke-width: 2; }
.cutl { fill: var(--amber); font-size: 11px; font-weight: 700; }
.tray { fill: var(--surface); stroke: var(--red); stroke-width: 2; stroke-dasharray: 6 4; }
.gem { transition: transform .6s cubic-bezier(.5,-0.3,.6,1.4); }
.gem path { fill: var(--rose); stroke: var(--panel); stroke-width: 1.5; }
.gem text { fill: var(--fg); font-size: 10.5px; font-weight: 700; text-anchor: middle; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.gem.bag text { display: none; }
.gem.pocket text { display: none; }
.gem.lost path { stroke: var(--red); stroke-width: 2; }
.reduced .gem, .reduced .blk rect { transition: none; }
@media (prefers-reduced-motion: reduce) { .gem, .blk rect { transition: none; } }

.evals ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.case { display: grid; grid-template-columns: minmax(0, 180px) 70px minmax(0, 1fr); gap: 4px 10px; align-items: baseline; padding: 8px 10px; border-radius: var(--r-md); border: 1.5px solid var(--border); }
.case.pass { border-color: var(--green); }
.case.fail { border-color: var(--red); }
.case .id { font-weight: 600; overflow-wrap: anywhere; }
.case.pass .verdict-tag { color: var(--green); font-weight: 700; }
.case.fail .verdict-tag { color: var(--red); font-weight: 700; }
.case .why { color: var(--muted); font-size: 13px; line-height: 1.4; }
@media (max-width: 520px) { .case { grid-template-columns: 1fr auto; } .case .why { grid-column: 1 / -1; } }
.rc { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.rc .mono { font-weight: 700; }

/* Fit the screen: drawing, caption and receipt on the left; controls and the evalset beside them. */
.view, .side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.side { margin-top: 12px; }
.receipt h2, .evals h2 { margin-bottom: 4px; }
.receipt .buttons { margin-top: 8px; }
@media (min-width: 900px) {
  .side { margin-top: 0; }
  .stage svg { max-height: 310px; }
  .case { grid-template-columns: minmax(0, 1fr) auto; padding: 5px 8px; }
  .case .why { grid-column: 1 / -1; font-size: 12px; }
  .case.pass .why { display: none; }
  .receipt { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
  .receipt h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .receipt .rc { border: 0; padding: 0; gap: 6px; font-size: 13px; }
  .receipt .buttons { margin-top: 0; margin-left: auto; }
}
@media (min-width: 900px) { .evals ul { gap: 4px; } .side .controls { gap: 8px; } }

/* Guided mode (props.mode "guided"): the figure's cuts as a ledger beside the backpack. The row on
   show is blue (now); rows already applied are solid; rows still to come are dashed (not applied yet). */
.gl-row rect { fill: var(--panel); stroke: var(--border); stroke-width: 1.5; }
.gl-row.todo rect { fill: var(--surface); stroke-dasharray: 4 4; }
.gl-row.now rect { stroke: var(--primary); stroke-width: 3; }
.gl-l { fill: var(--fg); font-size: 13px; font-weight: 700; }
.gl-d { fill: var(--muted); font-size: 11.5px; }
.gl-t { fill: var(--fg); font-size: 15px; font-weight: 700; text-anchor: end; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.gl-row.todo .gl-l { fill: var(--muted); }
.gl-row.todo .gl-t { display: none; } /* a total shows once its step is reached, so the last row never answers the predict card early */
.gl-note { fill: var(--muted); font-size: 11.5px; }
.cap-h { display: block; font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.cap-h:empty { display: none; }
.gsteps { display: flex; flex-wrap: wrap; gap: 6px; }
.gsteps .pill[aria-current="step"] { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); font-weight: 600; }
