/* ==========================================================================
   PIXELATE PHOTO — pill-cornered wall panel
   Flat colour on pure black. No gradients, no glow, no shadows.
   Gold is reserved for the active segment and the primary commit, nowhere else.
   ========================================================================== */

:root {
  --lilac: #c5b3ff;
  --peach: #ffb48a;
  --gold: #ffc33a;
  --periwinkle: #7da1ff;
  --black: #000;

  --lilac-dim: #6a5c9c;
  --peach-dim: #8a6250;
  --periwinkle-dim: #4f6296;
  --gold-dim: #8c6a24;
  --danger: #ff7a6b;

  --ink: #c5b3ff;
  --ink-quiet: #8b7fb8;
  --prose: #ded9f2;

  --gap: 10px;
  --rail-w: 132px;
  --ctrl-w: 404px;
  --topbar-h: 98px;
  --foot-h: 74px;
  --arm-h: 34px;
  --arm-h-b: 26px;
  --elbow-outer: 48px;
  --elbow-inner: 20px;

  --r-seg: 4px;
  --r-cap: 14px;
  --r-panel: 10px;

  /* Three registers, each doing one job: condensed caps for panel lettering,
     mono for codes and numeric clusters, and a plain grotesque for running
     prose. Mono set as body copy is a costume, not a voice. */
  --display: 'Antonio', 'Oswald', 'Arial Narrow', system-ui, sans-serif;
  --mono: 'Azeret Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --text: system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--black);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

/* Instant colour swaps only. There is no motion here to reduce. */
* { transition: none !important; }

/* Several panels below set display, which would otherwise beat [hidden]. */
[hidden] { display: none !important; }

img { max-width: 100%; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 60;
  background: var(--gold); color: #000; padding: 10px 16px;
  font-family: var(--display); font-size: 15px; letter-spacing: .06em;
  border-radius: 0 0 var(--r-cap) 0;
}
.skip:focus { left: 0; }

:where(button, input, [tabindex]):focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- shell ---------------------------------------------------- */

.shell {
  display: grid;
  grid-template-rows: var(--topbar-h) minmax(0, 1fr) var(--foot-h);
  gap: var(--gap);
  padding: var(--gap);
  height: 100dvh;
}

/* ---------- elbow ----------------------------------------------------
   One element sweeps the whole bar: the vertical arm is exactly the rail
   column width so the frame and the status rail below it line up, and the
   notch carves the working area out of it. */

.elbow {
  position: absolute;
  inset: 0;
  background: var(--lilac);
}
.elbow--tl { border-radius: var(--elbow-outer) var(--r-cap) 0 0; }
.elbow--bl { border-radius: 0 0 var(--r-cap) var(--elbow-outer); }

.elbow-notch {
  position: absolute;
  left: var(--rail-w);
  right: 0;
  background: var(--black);
}
.elbow--tl .elbow-notch { top: var(--arm-h); bottom: 0; border-radius: var(--elbow-inner) 0 0 0; }
.elbow--bl .elbow-notch { top: 0; bottom: var(--arm-h-b); border-radius: 0 0 0 var(--elbow-inner); }

.elbow-chip {
  position: absolute;
  left: 20px; top: 52px;
  width: 42px; height: 32px;
  background: var(--peach);
  border-radius: 4px 4px 4px 12px;
}

/* ---------- top bar --------------------------------------------------- */

.topbar { position: relative; }

.topbar-content {
  position: absolute;
  left: calc(var(--rail-w) + 20px);
  right: 10px;
  top: var(--arm-h);
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  color: var(--lilac);
  flex: none;
}
.wordmark-mark {
  background: var(--gold);
  color: #000;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 10px 3px;
  border-radius: var(--r-seg) var(--r-cap) var(--r-cap) var(--r-seg);
}
.wordmark-full {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: .17em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.navpill {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 16px 0 8px;
  border: 1px solid var(--lilac-dim);
  border-radius: var(--r-seg) var(--r-cap) var(--r-cap) var(--r-seg);
  background: var(--black);
  color: var(--lilac);
  cursor: pointer;
  font-family: var(--display);
}
.navpill-code {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  background: var(--lilac-dim);
  color: #000;
  padding: 3px 6px;
  border-radius: 3px;
}
.navpill-label { font-size: 16px; font-weight: 600; letter-spacing: .07em; }
.navpill:hover { border-color: var(--lilac); }
.navpill.is-active { background: var(--gold); border-color: var(--gold); color: #000; }
.navpill.is-active .navpill-code { background: #000; color: var(--gold); }

.bar-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.codepill {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .06em;
  color: var(--lilac);
  border: 1px solid var(--lilac-dim);
  border-radius: 3px;
  padding: 4px 7px;
  white-space: nowrap;
}

.iconbtn {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  background: var(--black);
  color: var(--lilac);
  border: 1px solid var(--lilac-dim);
  border-radius: var(--r-seg);
  cursor: pointer;
}
.iconbtn:hover { border-color: var(--lilac); }
.iconbtn .ico-off { display: none; }
.iconbtn[aria-pressed="false"] { color: var(--ink-quiet); }
.iconbtn[aria-pressed="false"] .ico-on { display: none; }
.iconbtn[aria-pressed="false"] .ico-off { display: block; }

/* ---------- console layout -------------------------------------------- */

.console {
  display: grid;
  grid-template-columns: var(--rail-w) var(--ctrl-w) minmax(0, 1fr) 14px;
  gap: var(--gap);
  min-height: 0;
}

/* Right-hand frame member. Closes the sweep the elbows start. */
.framerail { display: flex; flex-direction: column; gap: 8px; }
.framerail span { display: block; background: var(--lilac); border-radius: 7px; }
.framerail span:first-child { flex: 2; }
.framerail span:last-child { flex: 1; background: var(--periwinkle); }

/* ---------- left rail -------------------------------------------------- */

.rail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}

.rail-id {
  background: var(--lilac);
  color: #000;
  border-radius: var(--r-seg) var(--r-seg) var(--r-seg) var(--r-cap);
  padding: 8px 10px 6px;
  font-family: var(--display);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.rail-id-k { font-size: 14px; font-weight: 600; letter-spacing: .1em; }
.rail-id-v { font-size: 26px; font-weight: 700; line-height: .9; }

/* The tone reads through a solid label cap, the way this panel labels a
   segment, rather than through an accent stripe down one edge. */
.railcell {
  --tone: var(--lilac);
  border: 1px solid var(--tone);
  border-radius: var(--r-seg);
  padding: 6px 8px 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}
.railcell[data-tone="gold"] { --tone: var(--gold); }
.railcell[data-tone="peach"] { --tone: var(--peach); }
.railcell[data-tone="periwinkle"] { --tone: var(--periwinkle); }
.railcell[data-tone="lilac"] { --tone: var(--lilac); }

.railcell-k {
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .14em;
  background: var(--tone);
  color: #000;
  padding: 2px 5px 1px;
  border-radius: 2px;
}
.railcell-v {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .02em;
  color: var(--tone);
  overflow-wrap: anywhere;
}
.railcell-sub {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .04em;
  color: var(--ink-quiet);
  line-height: 1.3;
}

.rail-hatch {
  flex: 1;
  min-height: 40px;
  border-radius: var(--r-seg);
  background: repeating-linear-gradient(
    -45deg, var(--lilac-dim) 0 5px, transparent 5px 11px
  );
}

.rail-foot {
  background: var(--periwinkle);
  color: #000;
  border-radius: var(--r-cap) var(--r-seg) var(--r-seg) var(--r-seg);
  text-align: center;
  padding: 7px 0 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
}

/* ---------- banks and panels ------------------------------------------- */

.bank {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.bank--controls { overflow: hidden; }

.controls-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding-right: 6px;
}
.controls-scroll::-webkit-scrollbar { width: 8px; }
.controls-scroll::-webkit-scrollbar-track { background: #0b0912; }
.controls-scroll::-webkit-scrollbar-thumb { background: var(--lilac-dim); border-radius: 4px; }
.bank--archive { min-width: 0; }

.bank::-webkit-scrollbar { width: 8px; }
.bank::-webkit-scrollbar-track { background: #0b0912; }
.bank::-webkit-scrollbar-thumb { background: var(--lilac-dim); border-radius: 4px; }

.panel {
  border: 1px solid var(--lilac-dim);
  border-radius: var(--r-panel);
  padding: 12px;
}
.panel--flush {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 9px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--lilac-dim);
}
.panel-head-sp { flex: 1; }
.panel-title {
  margin: 0;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--lilac);
}

/* ---------- source intake ---------------------------------------------- */

.intake.is-dragging { outline: 2px dashed var(--gold); outline-offset: 6px; }

.intake-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 26px 14px 20px;
  border: 1px solid var(--periwinkle-dim);
  border-radius: var(--r-seg);
  text-align: center;
}
.intake-ico { width: 30px; height: 30px; fill: none; stroke: var(--periwinkle); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.intake-copy { margin: 0; font-size: 12px; line-height: 1.6; color: var(--prose); max-width: 30ch; }
.intake-meta {
  margin: 2px 0 0;
  font-size: 9.5px;
  letter-spacing: .12em;
  color: var(--ink-quiet);
}

.intake-loaded { display: flex; flex-direction: column; gap: 10px; }

.well {
  background: var(--black);
  border: 1px solid var(--lilac-dim);
  border-radius: var(--r-seg);
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: 0;
}
.well img { display: block; width: 100%; height: auto; }
.well--source img { max-height: 142px; width: auto; }
.is-pixel { image-rendering: pixelated; }

.factrow {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.factrow > div {
  border: 1px solid var(--lilac-dim);
  border-radius: 3px;
  padding: 5px 7px;
  min-width: 0;
}
.factrow dt { font-size: 8.5px; letter-spacing: .14em; color: var(--ink-quiet); }
.factrow dd {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--lilac);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- profile bank ------------------------------------------------ */

.profilebank { display: flex; flex-direction: column; gap: 5px; }

.pill {
  --tone: var(--lilac);
  display: grid;
  grid-template-columns: 8px 1fr 74px;
  gap: 4px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-family: var(--display);
}
.pill[data-tone="peach"] { --tone: var(--peach); }
.pill[data-tone="periwinkle"] { --tone: var(--periwinkle); }
.pill[data-tone="lilac"] { --tone: var(--lilac); }

.pill-chip { background: var(--tone); border-radius: 3px 0 0 3px; }
.pill-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-height: 40px;
  padding: 5px 12px;
  border: 1px solid var(--tone);
  border-radius: var(--r-seg) var(--r-cap) var(--r-cap) var(--r-seg);
  min-width: 0;
}
.pill-label {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .06em;
  line-height: 1;
  color: var(--tone);
}
.pill-note {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .02em;
  color: var(--ink-quiet);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pill-code {
  display: grid;
  place-items: center;
  border: 1px solid var(--tone);
  border-radius: var(--r-seg);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--tone);
}

.pill:hover .pill-body, .pill:hover .pill-code { border-color: #fff; }
.pill:hover .pill-label { color: #fff; }

.pill[aria-checked="true"] { --tone: var(--gold); }
.pill[aria-checked="true"] .pill-body { background: var(--gold); border-color: var(--gold); }
.pill[aria-checked="true"] .pill-label { color: #000; }
.pill[aria-checked="true"] .pill-note { color: #4a3a08; }
.pill[aria-checked="true"] .pill-code { background: #000; color: var(--gold); }
.pill.is-blink .pill-body { background: #fff; border-color: #fff; }
.pill.is-blink .pill-label, .pill.is-blink .pill-note { color: #000; }

/* ---------- small segment banks ----------------------------------------- */

.param { margin-bottom: 14px; }
.param:last-child { margin-bottom: 0; }

.param-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.param-title {
  margin: 0;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--lilac);
}
.param-hint { font-size: 9px; letter-spacing: .08em; color: var(--ink-quiet); }

.segbank { display: flex; flex-wrap: wrap; gap: 4px; }

.seg {
  flex: 1 1 auto;
  min-width: 54px;
  min-height: 34px;
  padding: 5px 10px;
  background: var(--black);
  border: 1px solid var(--periwinkle-dim);
  border-radius: var(--r-seg) var(--r-cap) var(--r-cap) var(--r-seg);
  color: var(--periwinkle);
  cursor: pointer;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .06em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  line-height: 1;
}
.seg-sub { font-family: var(--mono); font-size: 8.5px; font-weight: 400; letter-spacing: .04em; color: var(--ink-quiet); }
.seg:hover { border-color: #fff; color: #fff; }
.seg[aria-checked="true"] { background: var(--gold); border-color: var(--gold); color: #000; }
.seg[aria-checked="true"] .seg-sub { color: #4a3a08; }
.seg.is-blink { background: #fff; border-color: #fff; color: #000; }

.field {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  background: var(--black);
  border: 1px solid var(--periwinkle-dim);
  border-radius: var(--r-seg) var(--r-cap) var(--r-cap) var(--r-seg);
  color: var(--prose);
  font-family: var(--mono);
  font-size: 12px;
}
.field::placeholder { color: #5c5480; }
.field:focus { border-color: var(--periwinkle); outline: none; }
.field:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- commit ------------------------------------------------------ */

/* The primary action never scrolls out of reach: the profile bank is long,
   and a commit segment you have to hunt for is a commit segment you mis-press. */
/* The commit dock is pinned below the scrolling banks; the rule keeps the
   clipped edge of the profile list from reading as part of the button. */
.commit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: none;
  border-top: 1px solid var(--lilac-dim);
  padding-top: 10px;
}

.renderbtn {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 0 14px 0 20px;
  background: var(--gold);
  border: 1px solid var(--gold);
  border-radius: var(--r-seg) 28px 28px var(--r-seg);
  color: #000;
  cursor: pointer;
  font-family: var(--display);
}
.renderbtn-label { font-size: 30px; font-weight: 700; letter-spacing: .1em; line-height: 1; }
.renderbtn-code {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  background: #000;
  color: var(--gold);
  padding: 5px 8px;
  border-radius: 3px;
}
.renderbtn:hover:not(:disabled) { background: #fff; border-color: #fff; }
.renderbtn:hover:not(:disabled) .renderbtn-code { background: #000; color: #fff; }
.renderbtn:disabled {
  background: var(--black);
  border-color: var(--gold-dim);
  color: var(--gold-dim);
  cursor: not-allowed;
}
.renderbtn:disabled .renderbtn-code { background: var(--black); color: var(--gold-dim); border: 1px solid var(--gold-dim); }
.renderbtn.is-busy { background: var(--peach); border-color: var(--peach); color: #000; cursor: progress; }

.commit-note {
  margin: 0;
  font-size: 10.5px;
  line-height: 1.5;
  letter-spacing: .02em;
  color: var(--ink-quiet);
}

/* ---------- job ticket ---------------------------------------------------- */

.panel--ticket { flex: none; }

.ticket { display: flex; flex-direction: column; gap: 9px; }

.ticket-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 300px);
  gap: 16px;
  align-items: start;
}

.ticket-facts {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(106px, 1fr));
  gap: 4px;
}
.ticket-facts > div {
  border: 1px solid var(--periwinkle-dim);
  border-radius: 3px 10px 10px 3px;
  padding: 4px 8px 5px;
  min-width: 0;
}
.ticket-facts dt { font-size: 8px; letter-spacing: .14em; color: var(--periwinkle); }
.ticket-facts dd {
  margin: 1px 0 0;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--lilac);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.ticket-subtitle {
  margin: 0;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--peach);
}
.ticket-caveat { font-size: 9px; letter-spacing: .04em; color: var(--ink-quiet); }

.swatches { display: flex; flex-wrap: wrap; gap: 3px; }
.swatches i {
  display: block;
  width: 21px;
  height: 21px;
  border-radius: 2px;
  outline: 1px solid rgba(197, 179, 255, .28);
  outline-offset: -1px;
}
.swatches .swatch-none {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: .04em;
  color: var(--ink-quiet);
  max-width: 42ch;
}

.promptdetails { border-top: 1px solid var(--lilac-dim); padding-top: 9px; }
.promptdetails summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}
.promptdetails summary::-webkit-details-marker { display: none; }
.promptdetails-titlewrap { display: flex; align-items: center; gap: 7px; }
.promptdetails-title {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--peach);
}
.promptdetails-marker {
  position: relative;
  width: 9px;
  height: 9px;
  flex: none;
}
.promptdetails-marker::before,
.promptdetails-marker::after {
  content: '';
  position: absolute;
  background: var(--peach);
}
.promptdetails-marker::before { inset: 4px 0; }
.promptdetails-marker::after { inset: 0 4px; }
.promptdetails[open] .promptdetails-marker::after { display: none; }
.promptdetails summary:hover .promptdetails-marker::before,
.promptdetails summary:hover .promptdetails-marker::after { background: #fff; }
.promptdetails-hint { font-size: 9px; letter-spacing: .04em; color: var(--ink-quiet); }
.promptdetails summary:hover .promptdetails-title { color: #fff; }

.promptbox {
  margin: 8px 0 0;
  max-height: 128px;
  overflow-y: auto;
  padding: 9px 11px;
  border: 1px solid var(--lilac-dim);
  border-radius: 3px;
  font-size: 10.5px;
  line-height: 1.65;
  color: var(--prose);
}
.promptbox::-webkit-scrollbar { width: 6px; }
.promptbox::-webkit-scrollbar-track { background: #0b0912; }
.promptbox::-webkit-scrollbar-thumb { background: var(--lilac-dim); border-radius: 3px; }

/* ---------- frame archive ------------------------------------------------ */

.emptysheet-lede {
  grid-column: 1 / -1;
  margin: 0 0 2px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--ink-quiet);
  max-width: 74ch;
}

.framegrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: var(--gap);
  align-content: start;
  grid-auto-rows: min-content;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  padding-right: 4px;
}
.framegrid::-webkit-scrollbar { width: 8px; }
.framegrid::-webkit-scrollbar-track { background: #0b0912; }
.framegrid::-webkit-scrollbar-thumb { background: var(--lilac-dim); border-radius: 4px; }

.frame {
  --tone: var(--lilac);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--tone);
  border-radius: var(--r-seg) var(--r-panel) var(--r-panel) var(--r-seg);
  overflow: hidden;
  background: var(--black);
  padding: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.frame:hover { border-color: #fff; }
.frame[data-tone="peach"] { --tone: var(--peach); }
.frame[data-tone="periwinkle"] { --tone: var(--periwinkle); }
.frame[data-tone="gold"] { --tone: var(--gold); }

.frame-well {
  aspect-ratio: 1;
  flex: none;
  background: var(--black);
  border-bottom: 1px solid var(--tone);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.frame-well img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }

.frame-cap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  padding: 7px 9px 8px;
}
.frame-name {
  display: block;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--tone);
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.frame-meta {
  display: block;
  font-size: 8.5px;
  letter-spacing: .04em;
  color: var(--ink-quiet);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.frame-code {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  background: var(--tone);
  color: #000;
  padding: 3px 5px;
  border-radius: 3px;
}

/* pending + failed frames */
.frame--pending, .frame--failed { cursor: default; }
.frame--pending { --tone: var(--peach); }
.frame--failed { --tone: var(--danger); }

.frame-pendingbody {
  aspect-ratio: 1;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--tone);
  text-align: center;
}
.frame-stage {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--tone);
}
.frame-timer { font-size: 11px; letter-spacing: .1em; color: var(--ink-quiet); }
.frame-err { font-size: 10.5px; line-height: 1.5; color: var(--danger); overflow-wrap: anywhere; }

.segmeter { display: flex; gap: 3px; }
.segmeter i {
  display: block;
  width: 9px; height: 12px;
  border: 1px solid var(--lilac-dim);
  border-radius: 1px;
}
.segmeter i.is-lit { background: var(--peach); border-color: var(--peach); }

.emptysheet {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: var(--gap);
  align-content: start;
  grid-auto-rows: min-content;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  padding-right: 4px;
}
.emptysheet::-webkit-scrollbar { width: 8px; }
.emptysheet::-webkit-scrollbar-track { background: #0b0912; }
.emptysheet::-webkit-scrollbar-thumb { background: var(--lilac-dim); border-radius: 4px; }
.emptyframe {
  aspect-ratio: 1;
  border: 1px solid var(--lilac-dim);
  border-radius: var(--r-seg) var(--r-panel) var(--r-panel) var(--r-seg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #4a4270;
}
.emptyframe-code { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; }
.emptyframe-label { font-family: var(--display); font-size: 15px; letter-spacing: .14em; }
.emptyframe-grid {
  display: grid;
  grid-template-columns: repeat(4, 9px);
  grid-auto-rows: 9px;
  gap: 3px;
}
.emptyframe-grid i { display: block; background: #241f3d; }

/* ---------- status bar --------------------------------------------------- */

.statusbar { position: relative; }

.statusbar-content {
  position: absolute;
  left: calc(var(--rail-w) + 20px);
  right: 10px;
  top: 0;
  bottom: var(--arm-h-b);
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, .7fr) minmax(0, 1fr);
  gap: 6px;
  align-items: stretch;
}

.statuscell {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--lilac-dim);
  border-radius: var(--r-seg);
  min-width: 0;
}
.statuscell--lead { border-radius: var(--r-seg) var(--r-cap) var(--r-cap) var(--r-seg); }
.statuscell--end { border-radius: var(--r-seg) 26px 26px var(--r-seg); justify-content: space-between; }
.statuscell-k {
  font-size: 9px;
  letter-spacing: .16em;
  color: var(--ink-quiet);
  white-space: nowrap;
}
.statuscell-v {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .07em;
  color: var(--lilac);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.statuscell-v[data-state="bad"] { color: var(--danger); }
.statuscell-v[data-state="good"] { color: var(--gold); }

.statusbar .segmeter i { width: 7px; height: 16px; }
.statusbar .segmeter i.is-lit { background: var(--periwinkle); border-color: var(--periwinkle); }

/* ---------- overlays ------------------------------------------------------ */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, .93);
  display: grid;
  place-items: center;
  padding: var(--gap);
}
.overlay[hidden] { display: none; }

.overlay-panel {
  width: min(1180px, 100%);
  max-height: calc(100dvh - 2 * var(--gap));
  overflow-y: auto;
  background: var(--black);
  border: 1px solid var(--lilac);
  border-radius: var(--elbow-inner) var(--elbow-outer) var(--elbow-outer) var(--elbow-inner);
  padding: 16px;
}
.overlay-panel--narrow { width: min(680px, 100%); }

.overlay-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--lilac-dim);
}
.overlay-title {
  margin: 0;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--lilac);
}

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.compare-side { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.compare-cap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--lilac);
}
/* Both sides get the identical box so the comparison is about the render,
   not about how large each file happens to be. A 48px art image and a 4000px
   photograph must meet at the same scale or the panel is lying. */
.compare .well { height: min(56dvh, 480px); }
.compare .well img { width: 100%; height: 100%; object-fit: contain; }

.overlay-facts {
  margin: 14px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px;
}
.overlay-facts > div {
  border: 1px solid var(--lilac-dim);
  border-radius: 3px;
  padding: 6px 9px;
  min-width: 0;
}
.overlay-facts dt { font-size: 8.5px; letter-spacing: .14em; color: var(--ink-quiet); }
.overlay-facts dd { margin: 3px 0 0; font-size: 11px; color: var(--lilac); overflow-wrap: anywhere; }

.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--lilac-dim);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--r-seg) var(--r-cap) var(--r-cap) var(--r-seg);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .07em;
}
.btn--gold { background: var(--gold); color: #000; border-color: var(--gold); }
.btn--periwinkle { background: var(--periwinkle); color: #000; border-color: var(--periwinkle); }
.btn--ghost { background: var(--black); color: var(--lilac); border-color: var(--lilac-dim); }
.btn--ghost:hover { border-color: #fff; color: #fff; }
.btn--gold:hover, .btn--periwinkle:hover { background: #fff; border-color: #fff; }
.btn--danger { color: var(--danger); border-color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: #000; border-color: var(--danger); }
.btn[aria-pressed="true"] { background: var(--gold); color: #000; border-color: var(--gold); }

.prose { font-size: 12.5px; line-height: 1.75; color: var(--prose); }
.prose h3 {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--gold);
  margin: 20px 0 6px;
}
.prose h3:first-child { margin-top: 0; }
.prose p { margin: 0 0 10px; }
.prose code { color: var(--peach); }
.prose strong { color: var(--lilac); }

/* ---------- toast --------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 60;
  max-width: min(560px, calc(100vw - 24px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--black);
  border: 2px solid var(--danger);
  border-radius: var(--r-seg) var(--r-cap) var(--r-cap) var(--r-seg);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}
.toast[hidden] { display: none; }
.toast[data-tone="ok"] { border-color: var(--gold); color: var(--gold); }

/* ---------- responsive ----------------------------------------------------- */

@media (max-width: 1400px) {
  :root { --ctrl-w: 366px; }
}

@media (max-width: 1180px) {
  .shell { height: auto; min-height: 100dvh; grid-template-rows: var(--topbar-h) auto var(--foot-h); }
  .console {
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    grid-template-rows: auto minmax(380px, 1fr);
  }
  .rail { grid-row: 1 / span 2; }
  .bank--controls { grid-column: 2; grid-row: 1; overflow: visible; }
  .controls-scroll { overflow-y: visible; padding-right: 0; }
  .bank--archive { grid-column: 2; grid-row: 2; min-height: 0; }
  .framerail { display: none; }
  .framegrid { overflow-y: visible; }
}

/* Below 900px the bars stop being absolute overlays and lay out in flow, so
   wrapping nav and status cells grow their bar instead of escaping it. The
   elbow keeps its arm along the top edge and its pills stack beneath. */
@media (max-width: 900px) {
  :root {
    --rail-w: 92px;
    --arm-h: 28px;
    --arm-h-b: 22px;
    --elbow-outer: 34px;
    --elbow-inner: 16px;
  }

  .shell { height: auto; min-height: 100dvh; grid-template-rows: auto auto auto; }

  .topbar, .statusbar { display: flex; flex-direction: column; }

  .elbow {
    position: relative;
    inset: auto;
    width: 100%;
    flex: none;
  }
  .elbow--tl { height: 54px; }
  .elbow--bl { height: 44px; order: 2; }
  .elbow-chip { left: 16px; top: 6px; width: 30px; height: 22px; }

  .topbar-content, .statusbar-content {
    position: static;
    inset: auto;
    padding: 10px 4px 0;
  }
  .topbar-content { flex-wrap: wrap; gap: 10px; }

  .statusbar-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
    padding: 0 4px 10px;
  }
  .statuscell { min-height: 42px; padding: 0 12px; }

  .console {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
  }
  .rail {
    grid-row: auto;
    grid-column: 1;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .rail-id { flex: 0 0 auto; align-items: center; gap: 10px; padding: 6px 14px; }
  .railcell { flex: 1 1 132px; }
  .rail-hatch { display: none; }
  .rail-foot { flex: 0 0 auto; padding: 8px 16px; display: grid; place-items: center; }
  .bank--controls, .bank--archive { grid-column: 1; grid-row: auto; }
  .bank--controls { overflow: visible; }
  .controls-scroll { overflow-y: visible; padding-right: 0; }
  .framerail { display: none; }
  .framegrid, .emptysheet { overflow-y: visible; }

  .ticket-strip { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

@media (max-width: 720px) {
  :root { --gap: 8px; --rail-w: 76px; }

  .wordmark-mark { font-size: 28px; padding: 5px 8px 2px; }
  .wordmark-full { font-size: 11px; letter-spacing: .14em; }

  .nav { flex: 1 1 100%; }
  .navpill { flex: 1 1 auto; justify-content: center; padding: 0 12px 0 7px; }
  .navpill-label { font-size: 15px; }
  .bar-tools { margin-left: 0; flex: 1 1 100%; justify-content: flex-end; }

  .statusbar-content { grid-template-columns: minmax(0, 1fr); }
  .statuscell-v { font-size: 15px; }
  .statuscell-k { font-size: 8px; letter-spacing: .12em; }

  .compare { grid-template-columns: 1fr; }
  .compare .well { height: min(34dvh, 300px); }
  .overlay-panel { padding: 12px; }
  .overlay-actions .btn { flex: 1 1 auto; justify-content: center; }

  .framegrid, .emptysheet { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .renderbtn { min-height: 54px; }
  .renderbtn-label { font-size: 26px; }
}

/* ---------- prose register ---------------------------------------------
   Running sentences read in the grotesque; codes, numbers and panel
   lettering keep their own faces. */

.prose,
.intake-copy,
.emptysheet-lede,
.commit-note,
.swatch-none,
.promptbox,
.frame-err,
.toast,
.railcell-sub { font-family: var(--text); letter-spacing: 0; }

.prose { font-size: 13.5px; line-height: 1.7; }
.intake-copy { font-size: 12.5px; }
.emptysheet-lede { font-size: 12px; }
.commit-note { font-size: 11.5px; }
.promptbox { font-size: 11.5px; line-height: 1.6; }
.swatch-none { font-size: 11px; }
.toast { font-size: 12.5px; }
.railcell-sub { font-size: 9px; }
.prose code { font-family: var(--mono); font-size: .92em; }

/* Rows snap so a scrolled sheet never orphans a frame's caption. */
.framegrid { scroll-snap-type: y proximity; }
.frame { scroll-snap-align: start; }

/* A visible edge on the scrolling banks, so a clipped row reads as "more
   below" rather than as a broken component. */
.controls-scroll, .framegrid, .emptysheet { scrollbar-color: var(--lilac-dim) #0b0912; scrollbar-width: thin; }

/* One display-scale readout, the way this panel states a count. */
.bigcount { display: flex; align-items: center; gap: 9px; }
.bigcount b {
  font-family: var(--display);
  font-size: 36px;
  font-weight: 700;
  line-height: .82;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.bigcount i {
  font-family: var(--mono);
  font-style: normal;
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: .15em;
  line-height: 1.45;
  color: var(--ink-quiet);
}

/* Facts occupy one full row; the plate hugs its image instead of floating
   in a letterboxed well. */
.ticket-strip { grid-template-columns: minmax(0, 1fr) 262px; }
.ticket-facts { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.well--source { width: fit-content; max-width: 100%; margin-inline: auto; }

@media (max-width: 1180px) {
  .ticket-facts { grid-template-columns: repeat(auto-fit, minmax(106px, 1fr)); }
}
@media (max-width: 900px) {
  .ticket-strip { grid-template-columns: minmax(0, 1fr); }
  .bigcount b { font-size: 30px; }
}

/* The footer meter is decorative texture: it may shed blocks rather than
   push the status bar wider than the viewport. */
.statuscell--end { min-width: 0; }
.statusbar .segmeter { min-width: 0; overflow: hidden; flex: 0 1 auto; }

@media (max-width: 1180px) {
  .statusbar .segmeter i:nth-child(n+7) { display: none; }
}

/* The nav code chip carries 10px black lettering on a filled ground, so it
   needs text contrast, not just boundary contrast: #8b7fb8 clears 5.8:1. */
.navpill-code { background: var(--ink-quiet); }

/* PROFILE is the ticket's load-bearing fact and must not truncate to fit the
   other four; give it a wider basis instead of an equal share. */
.ticket-facts { grid-template-columns: 1.6fr 1fr 1fr 1.25fr 1fr; }
@media (max-width: 1180px) {
  .ticket-facts { grid-template-columns: repeat(auto-fit, minmax(106px, 1fr)); }
}

/* Relative cost, drawn as bordered blocks like every other meter in the panel,
   rather than a repeated text glyph standing in for a graphic. */
.costmeter { display: flex; gap: 2px; margin-top: 2px; }
.costmeter i {
  display: block;
  width: 6px;
  height: 8px;
  border: 1px solid var(--periwinkle-dim);
  border-radius: 1px;
}
.costmeter i.is-lit { background: var(--periwinkle); border-color: var(--periwinkle); }
.seg[aria-checked="true"] .costmeter i { border-color: #4a3a08; }
.seg[aria-checked="true"] .costmeter i.is-lit { background: #4a3a08; }
.seg:hover .costmeter i { border-color: #fff; }
.seg:hover .costmeter i.is-lit { background: #fff; }

/* ---------- access gate --------------------------------------------------- */

.gate-copy {
  margin: 0 0 16px;
  font-family: var(--text);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--prose);
}
.gate-form { display: flex; flex-direction: column; gap: 8px; }
.gate-form .param-title { margin-bottom: 2px; }
.gate-form .btn { align-self: flex-start; margin-top: 4px; }
.gate-error {
  margin: 0;
  font-family: var(--text);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--danger);
}
.railcell[data-tone="locked"] { --tone: var(--danger); }
