/* Incision design language: dark navy void, one precision-blue accent,
   1px borders, near-sharp corners, mono for data values.  Fonts fall back
   to system faces — the viewer makes no network fetches. */
/* BEGIN GENERATED: generated by `python -m codegen` from design_tokens.CSS_ROOT; do not edit by hand */
:root {
  --color-base: #080B18;
  --color-surface-0: #0C1020;
  --color-surface-1: #11162A;
  --color-panel: rgba(12, 16, 32, 0.92);
  --color-border: #1E2540;
  --color-border-strong: #283050;
  --color-fg-1: #EDF0FA;
  --color-fg-2: #818FB8;
  --color-accent: #4B7CF3;
  --color-accent-subtle: rgba(75, 124, 243, 0.08);
  --color-loss: #E05050;
  --color-amber: #D4934A;
  --color-live: #00CCA8;
  --radius-xs: 2px;
  --radius-sm: 3px;
  --ease-precision: cubic-bezier(0.16, 1, 0.3, 1);
}
/* END GENERATED */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--color-base);
  color: var(--color-fg-1);
  font: 13px/1.45 "DM Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.mono { font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.dim { color: var(--color-fg-2); }

/* touch-action: none is load-bearing, not defensive. Without it the browser
   interprets a drag on the canvas as a page scroll or zoom, swallows the
   gesture and stops delivering pointermove — so orbiting simply does not work
   on a phone, with no error to explain why. */
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block;
  touch-action: none; }

#hud-top, #runs-panel, #info-panel, #reading-panel, #hud-bottom {
  position: fixed; background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs); padding: 12px 14px;
}
#hud-top { top: 12px; left: 12px; max-width: 380px; }
#title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
#meta { margin: 3px 0 8px; font-size: 12px; white-space: pre-line; }
#loadrow { display: flex; align-items: center; gap: 8px; }
.hint { font-size: 11px; }

button, select {
  background: var(--color-surface-1); color: var(--color-fg-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); padding: 4px 10px; font: inherit; cursor: pointer;
  transition: border-color 100ms var(--ease-precision),
              background-color 100ms var(--ease-precision);
}
button:hover, select:hover { border-color: var(--color-accent); }
button:active { transform: translateY(1px); }

#capture-row { margin-top: 10px; border-top: 1px solid var(--color-border);
  padding-top: 8px; }
#capture-row textarea { width: 100%; resize: vertical; background: var(--color-surface-1);
  color: var(--color-fg-1); border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); padding: 5px 8px; font: inherit; }
#capture-row textarea:focus { outline: none; border-color: var(--color-accent); }
/* ---- run a model in the page ---------------------------------------- */
#live { margin-top: 10px; border-top: 1px solid var(--color-border);
        padding-top: 10px; }
.linkish { background: none; border: 0; color: var(--color-accent);
           padding: 0; font: inherit; font-size: 12px; cursor: pointer; }
.linkish:hover { text-decoration: underline; }
#live-panel { margin-top: 8px; }
.live-head { display: flex; justify-content: space-between; align-items: center;
             font-size: 11px; color: var(--color-fg-2);
             text-transform: lowercase; letter-spacing: .04em;
             margin: 10px 0 5px; }
.badge { font-size: 10px; padding: 1px 6px; border: 1px solid var(--color-border);
         color: var(--color-fg-2); font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace; }
.badge.gpu { color: var(--color-accent); border-color: var(--color-accent); }

/* model cards. Named -card because the viewer already uses `.model` for the
   per-run model label in the runs panel; sharing the name would style those. */
.model-card { display: block; width: 100%; text-align: left; cursor: pointer;
         background: var(--color-surface-1); color: var(--color-fg-1);
         border: 1px solid var(--color-border); padding: 7px 9px;
         margin-bottom: 5px; font: inherit; font-size: 12px; }
.model-card:hover:not(:disabled) { border-color: var(--color-accent); }
.model-card:disabled { opacity: .5; cursor: default; }
.model-card.active { border-color: var(--color-accent); }
.model-card .row1 { display: flex; justify-content: space-between; gap: 8px; }
.model-card .nm { font-weight: 500; }
.model-card .sz { font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 11px;
             color: var(--color-fg-2); white-space: nowrap; }
.model-card .row2 { font-size: 11px; color: var(--color-fg-2); margin-top: 2px; }
.model-card .ready { color: var(--color-accent); }

#model-custom { margin-top: 6px; font-size: 11px; color: var(--color-fg-2); }
#model-custom summary { cursor: pointer; }
#model-custom input { width: 100%; margin-top: 5px; background: var(--color-surface-1);
                      color: var(--color-fg-1); border: 1px solid var(--color-border);
                      padding: 5px 7px; font: inherit; font-size: 12px; }
#model-custom input:focus { outline: none; border-color: var(--color-accent); }
#model-custom button { margin-top: 5px; }

#model-progress { margin-top: 8px; }
.bar { height: 3px; background: var(--color-surface-0); overflow: hidden; }
#model-bar { height: 100%; width: 0; background: var(--color-accent);
             transition: width .2s linear; }
#modelStatus { margin-top: 5px; overflow: hidden; text-overflow: ellipsis;
               white-space: nowrap; }
#modelStatus.err { color: var(--color-loss); white-space: normal; }

#examples { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.example { background: none; border: 1px solid var(--color-border);
           color: var(--color-fg-2); padding: 2px 7px; font: inherit;
           font-size: 11px; cursor: pointer; }
.example:hover { border-color: var(--color-accent); color: var(--color-fg-1); }
#capture-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
#captureHint { flex: 1; }

#runs-panel { top: 12px; right: 12px; min-width: 220px; max-width: 320px; }
.panel-head { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--color-fg-2); margin-bottom: 6px; }
#runs-list label { display: block; margin: 3px 0; cursor: pointer; }
#runs-list input { accent-color: var(--color-accent); }
#runs-list .swatch { display: inline-block; width: 9px; height: 9px;
  border-radius: var(--radius-xs); margin: 0 6px 0 4px; vertical-align: baseline; }
#runs-list .prompt { color: var(--color-fg-2); font-size: 11px; margin-left: 26px;
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 270px; }
#runs-list .gen-summary { color: var(--color-fg-2); font-size: 11px; margin-left: 26px;
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 270px; }
#runs-list .gen-summary .mono { color: var(--color-fg-1); }
#runs-list .feat-summary { color: var(--color-fg-2); font-size: 11px; margin-left: 26px;
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 270px; }
#comparisons { margin-top: 8px; font-size: 11px; color: var(--color-fg-2); }
#comparisons table { border-collapse: collapse; width: 100%;
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace; }
#comparisons td, #comparisons th { padding: 1px 6px 1px 0; text-align: left;
  font-weight: normal; }
#comparisons th { color: var(--color-fg-2); font-family: "DM Sans", -apple-system,
  sans-serif; text-transform: uppercase; letter-spacing: 0.06em; font-size: 10px; }
/* per-layer curves: hidden-space divergence and readout, no projection */
#curves { margin-top: 8px; border-top: 1px solid var(--color-border); padding-top: 8px;
  font-size: 11px; }
#curve-token-row { display: block; margin-bottom: 4px; }
#curve-token-row[hidden] { display: none; }  /* the block above would override hidden */
#curvePlot { display: block; width: 100%; height: auto; }
#curvePlot text { fill: var(--color-fg-2); font-size: 9px; }
#curvePlot path { fill: none; stroke-width: 1.4; }
#curvePlot .axis { stroke: var(--color-border-strong); }
#curvePlot .ceiling { stroke-width: 1; opacity: 0.6; }
#curvePlot .marker { stroke: var(--color-fg-2); stroke-dasharray: 2 2; }
#curveValues { margin-top: 2px; }
#curveNote { margin-top: 4px; line-height: 1.35; }
#attn-row { display: block; margin-top: 10px; border-top: 1px solid var(--color-border);
  padding-top: 8px; cursor: pointer; }
#attn-row input { accent-color: var(--color-accent); }

#info-panel { left: 12px; bottom: 64px; min-width: 200px; max-width: 300px;
  font-size: 12px; pointer-events: none; }
#info-panel .ip-title { font-weight: 600; margin-bottom: 3px; }
#info-panel .topk { margin-top: 5px; font-family: "JetBrains Mono", ui-monospace,
  Menlo, Consolas, monospace; font-size: 11px; }
#info-panel .topk .bar { display: inline-block; height: 7px;
  background: var(--color-accent); border-radius: var(--radius-xs);
  margin-right: 6px; vertical-align: middle; }
/* nearest vocabulary tokens: same rows as the top-k readout, but the bars
   carry a cosine, not a probability — a muted accent keeps the two readings
   apart, and `pre` preserves the leading space a BPE piece may quote with */
#info-panel .nbrs .bar { background: rgba(75, 124, 243, 0.5); }
#info-panel .nbrs .mono { white-space: pre; }
/* attn/MLP split of a block's residual write: one proportional two-part bar
   (accent = attention, live teal = MLP) over the two percentages */
#info-panel .resid { margin-top: 5px; font-size: 11px; }
#info-panel .resid .mono { font-size: 11px; }
#info-panel .resid-bar { display: flex; height: 7px; margin: 3px 0 2px;
  border-radius: var(--radius-xs); overflow: hidden;
  background: var(--color-surface-1); }
#info-panel .resid-bar .attn { background: var(--color-accent); }
#info-panel .resid-bar .mlp { background: var(--color-live); }
/* a clicked reading is pinned: the panel holds until Escape or a click on
   empty space, and says so in the accent that marks live state */
#info-panel.pinned { border-color: var(--color-accent); }
#info-panel .ip-pin { margin-top: 6px; padding-top: 5px;
  border-top: 1px solid var(--color-border); color: var(--color-accent);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace; }

#hud-bottom { left: 50%; bottom: 12px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; width: min(640px, 90vw); }
#layerSlider { flex: 1; accent-color: var(--color-accent); }
#layerLabel { white-space: nowrap; min-width: 74px; }
#playBtn { width: 34px; }

.center-msg { position: fixed; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: 16px; color: var(--color-fg-2);
  text-align: center; padding: 0 20vw; }
#overlay { pointer-events: none; }
#overlay.error #overlay-msg { color: var(--color-loss); }
#drop-shade { position: fixed; inset: 0; background: var(--color-accent-subtle);
  border: 1px dashed var(--color-accent); z-index: 10; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  button, select { transition: none; }
}

/* ---- small screens ---------------------------------------------------
   The desktop layout parks four fixed panels in the corners of a large
   viewport. On a phone they overlap each other and bury the scene they are
   meant to describe, so the arrangement changes rather than merely shrinking:
   the top panel spans the width and caps its height (scrolling internally,
   since the model list plus prompt box is taller than a phone), the runs
   panel moves to the bottom above the scrubber, and the hover inspector is
   dropped — it tracks a cursor, and a finger is its own cursor. */
@media (max-width: 720px) {
  #hud-top {
    top: 8px; left: 8px; right: 8px; max-width: none;
    max-height: 46vh; overflow-y: auto; padding: 10px;
    -webkit-overflow-scrolling: touch;
  }
  #title { font-size: 13px; }

  #runs-panel {
    top: auto; bottom: 56px; left: 8px; right: 8px;
    min-width: 0; max-width: none; max-height: 28vh; overflow-y: auto;
    padding: 10px;
  }
  #runs-list .prompt, #runs-list .gen-summary,
  #runs-list .feat-summary { max-width: none; }

  /* Hover has no meaning on touch: there is no pointer position until a
     finger is down, and by then it is a drag. Tapping still pins, and the
     pinned readout uses this same panel. */
  #info-panel { display: none; }

  #hud-bottom {
    left: 8px; right: 8px; bottom: 8px; padding: 8px 10px;
    display: flex; align-items: center; gap: 8px;
  }
  #layerSlider { flex: 1; min-width: 0; }

  /* Touch targets. 4px of padding is a comfortable mouse target and a
     frustrating thumb one; 44px is the smallest both Apple and Google call
     reliable, so it is a floor rather than a suggestion. */
  button, select { padding: 8px 12px; min-height: 44px; }
  .example { padding: 6px 10px; min-height: 36px; }
  .model-card { padding: 10px; min-height: 44px; }
  /* The entry point into the whole live panel: a bare text link on desktop,
     but it has to be thumb-sized here. */
  .linkish { padding: 10px 0; min-height: 44px; display: inline-block; }
  #model-custom summary { padding: 8px 0; }
  #capture-row textarea { font-size: 16px; }  /* < 16px makes iOS zoom on focus */
  #model-custom input { font-size: 16px; }
  #layerSlider { height: 28px; }
}

/* Very narrow: the scene is the point, so give it more room by letting the
   top panel collapse to just its controls. */
@media (max-width: 420px) {
  #hud-top { max-height: 40vh; }
  #runs-panel { max-height: 22vh; }
  #meta { font-size: 11px; }
}

/* which model produced a run — the scene-level meta describes run 0 only,
   so a cross-model scene needs this per run */
#runs-list .model { display: block; font-size: 10px; color: var(--color-accent);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* "Reading this scene": the caveats the explorer shows beside its figure,
   on the surface a scene is actually shared on. Bottom-right so it never
   covers the pick panel (bottom-left) or the loader (top-left). */
#reading-panel {
  right: 12px; bottom: 64px; max-width: 320px; max-height: 52vh;
  overflow-y: auto; font-size: 11px; line-height: 1.5;
  color: var(--color-fg-2);
}
#reading-panel > summary {
  cursor: pointer; color: var(--color-fg-1); font-size: 12px;
  font-weight: 600; letter-spacing: -0.01em;
}
#reading-panel[open] > summary { margin-bottom: 8px; }
#reading-body p { margin: 0 0 8px; }
#reading-body p:last-child { margin-bottom: 0; }
#reading-body b { color: var(--color-fg-1); font-weight: 600; }
.reading-fidelity { color: var(--color-fg-1); }
.reading-fidelity.warn { color: var(--color-amber); }
.reading-prov { border-top: 1px solid var(--color-border); padding-top: 8px; }

/* ---- blast scenes: one pellet per prompt ------------------------------
   The pellet panel takes the runs list's place. Layouts are a segmented
   toggle because switching between them is the comparison a blast is read
   by; pellets are drawn as discs, so the legend's swatches are discs too.
   Every colour here is an existing token: the pellet colours themselves are
   MTJ.BLAST_COLOURS, which viewer/tests/blast.test.js holds to this file. */
/* 340px fits three layout names on one row ("monitor · false_claim" is the
   longest the samples have) */
#runs-panel.blast { max-width: 340px; max-height: calc(100vh - 150px); overflow-y: auto; }
/* opened, the reading panel rises over the pellet panel; at the same width
   their edges line up instead of the caption showing down one side */
#runs-panel.blast ~ #reading-panel { max-width: 340px; }
#blast-panel { font-size: 12px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.seg-btn { padding: 3px 8px; font-size: 12px; color: var(--color-fg-2); }
.seg-btn[aria-pressed="true"] { color: var(--color-fg-1);
  border-color: var(--color-accent); background: var(--color-accent-subtle); }
.blast-colour { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.blast-colour[hidden] { display: none; }   /* the flex above would override hidden */
.blast-colour select { padding: 2px 6px; }
#blastLegend { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 11px;
  margin-bottom: 8px; }
#blastLegend .lg { white-space: nowrap; }
.blast-swatch { display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 5px; vertical-align: baseline; }
.blast-swatch.ring { background: none; width: 11px; height: 11px;
  border: 2px solid var(--color-fg-1); vertical-align: -1px; }
#blastReadout { font-size: 11px; line-height: 1.5; padding-top: 6px;
  border-top: 1px solid var(--color-border); }
#blastReadout .part { white-space: nowrap; }
/* blast scenes carry no attention, and #attn-row's display: block outranks
   the hidden attribute buildUI sets, so the empty toggle is hidden here */
#runs-panel.blast #attn-row { display: none; }
/* a readout that does not clear its shuffle null warns in the same amber
   the scene panel flags low fidelity with */
.blast-flag { color: var(--color-amber); margin-top: 2px;
  font-family: "DM Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
#blastCaption { margin-top: 8px; font-size: 11px; line-height: 1.5;
  color: var(--color-fg-2); }
#blastCaption > summary { cursor: pointer; color: var(--color-fg-1); }
#blastCaption[open] > summary { margin-bottom: 4px; }
#blastCaptionBody p { margin: 0 0 5px; }
.cap-kind { color: var(--color-fg-1); text-transform: uppercase;
  letter-spacing: 0.06em; font-size: 9.5px; margin-right: 3px; }
#info-panel .ip-text { color: var(--color-fg-2); margin: 2px 0; }

@media (max-width: 720px) {
  /* Bottom of the screen like the runs panel, but taller, so the readout
     line shows without scrolling (the caption starts collapsed), and a fixed
     height so "Reading this scene" can sit on its header row instead of over
     its controls. */
  /* bottom clears the scrubber, which its 44px touch targets make 62px tall */
  #runs-panel.blast { max-width: none; height: 38vh; max-height: none; bottom: 74px; }
  #runs-panel.blast ~ #reading-panel { bottom: calc(74px + 38vh - 40px); right: 14px;
    padding: 6px 10px; }
  /* The shared #hud-bottom rule's translateX(-50%) survives into the phone
     layout and pushes the scrubber half off-screen. Scoped to blast scenes
     so other scenes stay exactly as they were; the general fix is this line
     in the phone #hud-bottom rule above. */
  #runs-panel.blast ~ #hud-bottom { transform: none; width: auto; }
  .seg-btn { padding: 6px 9px; }        /* the 44px floor still applies */
  #blastCaption > summary { padding: 8px 0; }
}
