/* JimuSim UI -- dark, dense, calm (zcode-style transcript; old-repo-grade
   shots). Fixed copy lives in i18n.js; event bodies stay unmodified. */
:root {
  --bg0: #070b14; --bg1: #0d1424; --bg2: #111a2e; --rail: #0c1322;
  --line: rgba(151, 173, 222, .14); --line2: rgba(151, 173, 222, .24);
  --tx0: #e8eefb; --tx1: #b7c3da; --tx2: #8494b0; --tx3: #6e7e9c;
  --acc: #4da3ff; --acc-soft: rgba(77, 163, 255, .13);
  --who: #b48cff;   /* S-173: the Designer label's dedicated hue */
  --term: #7fd4c0;  /* S-173: COMSOL-native token tone (single token) */
  --advisory: #ff9c9c;  /* S-173: warning copy tone (hints/disclaimer) */
  /* S-176: leftover-constant tokens (light-theme completion) */
  --halo-a: rgba(57, 210, 245, .06); --halo-b: rgba(77, 124, 255, .08);
  --top-glass: rgba(13, 20, 36, .82);   /* header banner */
  --panel-glass: rgba(12, 19, 34, .6);   /* rail/glass surfaces */
  --fold-glass: rgba(13, 20, 36, .5);
  --composer-glass: rgba(13, 20, 36, .72);
  --chrome-tint: rgba(151, 173, 222, .04);
  --chrome-tint2: rgba(151, 173, 222, .12);
  --dash-line: rgba(151, 173, 222, .1);
  --scroll-thumb: rgba(151, 173, 222, .18);
  --scroll-thumb-hi: rgba(151, 173, 222, .3);
  --shadow-1: 0 2px 14px rgba(0, 0, 0, .25);
  --shadow-2: 0 6px 22px rgba(0, 0, 0, .38);
  --shot-mat: #0a0f1c;                    /* frame behind COMSOL pngs */
  --ok: #3ddc97; --ok-soft: rgba(61, 220, 151, .12);
  --warn: #fcd34d; --warn-soft: rgba(252, 211, 77, .09);
  --err: #ff8080; --err-soft: rgba(255, 128, 128, .09);
  --mono: "Cascadia Mono", "Cascadia Code", "Noto Sans Mono CJK SC",
          Consolas, monospace;
  --font: "Cascadia Mono", "Cascadia Code", "Noto Sans Mono CJK SC",
          "Microsoft YaHei", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--tx0);
  /* S-197 J4: rides the --font token (this stack had drifted -- it was
     missing "Microsoft YaHei" vs the token definition). */
  font: 13.5px/1.6 var(--font);
  background:
    radial-gradient(1100px 520px at 78% -12%, var(--halo-a), transparent 60%),
    radial-gradient(900px 600px at -12% 30%, var(--halo-b), transparent 55%),
    var(--bg0);
  display: flex; flex-direction: column;
}
button, input, select, textarea { font-family: inherit; }
:root { color-scheme: dark; }   /* S-163: native dropdowns/pickers follow the dark theme */
:focus-visible { outline: 2px solid rgba(77, 163, 255, .55); outline-offset: 2px; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hi); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- top bar ---------- */
#top {
  display: flex; align-items: center; gap: 12px; padding: 9px 16px;
  background: var(--top-glass); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line); flex: none;
}
#brand {
  font-weight: 700; letter-spacing: .4px; color: var(--tx0);
  display: flex; align-items: center; gap: 8px;
}
#brand::before {
  content: ""; width: 10px; height: 10px; border-radius: 3px;
  background: linear-gradient(135deg, var(--acc), var(--term));
  box-shadow: 0 0 8px rgba(77, 163, 255, .55);
}
#runsel {
  /* 2026-10-23 user order (three rounds, ending here): the run id reads as
     PLAIN TEXT -- no box, no fill, no caret. The user only needs to see
     their own run number.
     Width follows the selected id, not the widest one: past runs carry odd
     long ids (20261018-S228-acceptance) that used to stretch a 19-char
     id's box (field-sizing: content, Chrome 123+; older engines fall back
     to the widest option, still readable). Measured on a 124.6px id:
     191 -> 174 -> 141 -> 125px (= the id's own width, 17px tall).
     The element stays a select: clicking the number still opens the list
     of past runs -- the only way into them from this page. */
  field-sizing: content;
  width: max-content; max-width: 44vw;
  margin: 0; padding: 0;
  border: 0; border-radius: 0; background: none;
  color: var(--tx1); font-size: 12.5px; cursor: pointer;
  appearance: none; -webkit-appearance: none;
}
#runmeta { color: var(--tx2); font-size: 12px; overflow: hidden;
           text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: .8px;
  padding: 2px 9px; border-radius: 9px; flex: none;
  background: var(--ok-soft); color: var(--ok); border: 1px solid rgba(61, 220, 151, .35);
  animation: pulse 1.6s ease-in-out infinite;
}
.badge.hidden { display: none; }
@keyframes pulse { 50% { opacity: .45; } }

/* S-301 (owner order 2026-10-25): pending-install is an ALERT now (the
   pre-run gate locks the composer until the agent app is installed)
   -- the old gray-muted style retired; rides the --err token (same
   family as .endbar.bad, no new semantic). */
#helperbtn.pending { color: var(--err); border-color: var(--err); }
#helperbtn.installed { color: var(--advisory); border-color: var(--line2); }
/* S-294 J26 verdict (leader order 2026-10-25): the S-270 localbanner /
   localcmd styles are removed with the retired local helper. Agent
   states = pending / online / paused on the shared helperbtn (online and
   paused ride the text semantics, no extra color). The
   #helperbtn.installed selector stays as replay-era fallback; no
   producer remains. */

/* ---------- layout ---------- */
#main { flex: 1; display: flex; min-height: 0; }
/* S-163 (ZCode form): the left column is a self-contained vertical stack --
   sticky zone / scrolling narrative / live status line / composer. It owns
   its own scroll region so nothing inside can ever spill under the rail. */
#left {
  flex: 1; min-width: 320px; display: flex; flex-direction: column;
  min-height: 0; padding: 10px 14px 10px;
}
#stream {
  /* S-209 J22 (10-17 user order, interpretation correction): content
     fills TOP-DOWN and the column only scrolls once it is full -- the
     bottom-hug flex form (S-207 carry-over) is retired; the original
     "Thinking closer to the composer" order is served by the statusline
     collapse and the tightened margins alone. Plain block layout also
     retires the flex-child squeeze class (J1b) structurally. */
  flex: 1; min-height: 0; overflow-y: auto; padding: 6px 4px 12px;
}
#right {
  width: 340px; flex: none; display: flex; flex-direction: column; gap: 10px;
  padding: 14px 12px; overflow-y: auto; overflow-x: hidden;
  border-left: 1px solid var(--line); background: var(--panel-glass);
  resize: horizontal; direction: rtl;
}
#right > .rail { direction: ltr; }

/* ---- S-232: gate action row (the modal retired; the stream card is the
     action face) ---- */
.pcard .gatebtns {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
}
.pcard .gateanswer {
  display: flex; align-items: stretch; gap: 8px; margin-top: 10px;
}
.pcard .gateanswer textarea {
  flex: 1; min-width: 120px; min-height: 58px; max-height: 140px;
  resize: vertical; overflow-y: auto; padding: 8px 10px;
  color: var(--tx0); background: var(--bg0); border: 1px solid var(--line2);
  font: 13px/1.45 var(--font);
}
.pcard .gateanswer textarea:focus { border-color: var(--acc); }
.pcard .gateanswer textarea:disabled { opacity: .55; }
.pcard .gateanswer .gatesend { flex: none; }
/* S-233: the preview-hold busy line (dim, phints-like) */
.pcard .gatewait { padding: 0 12px 2px 6px; font-size: 11.5px;
                   color: var(--tx2); }

/* folded narrative line (ZCode "Used N tools" form): one line, expandable */
details.foldline {
  border-left: 2px solid var(--line2); padding: 2px 0 2px 10px;
  margin: 4px 0; font-size: 12.5px; color: var(--tx2);
}
details.foldline > summary {
  cursor: pointer; list-style: none; color: var(--tx2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
details.foldline > summary::before { content: "\25B8 "; color: var(--tx2); }
details.foldline[open] > summary::before { content: "\25BE "; }
/* S-172 user orders 2+3: "N. Designer: <fixed phrase>" -- the who-label
   carries the accent, the action phrase a step lighter; the legacy
   digest-snippet form (old archives) keeps the plain tone. */
summary .fturn { color: var(--tx3); }
summary .fwho { color: var(--who); font-weight: 600; margin-right: 4px; }
summary .fact { color: var(--tx1); }
/* S-172 user order 2: COMSOL-native tokens in markdown bodies (color
   only -- the S-154 mono whitelist stays code-semantics-only) */
.term { color: var(--term); }
/* S-173 user order 2: advisory copy pops red -- hints channel lines and
   taught-disclaimer fragments in markdown bodies */
.warn { color: var(--advisory); }
/* S-173: confirm ROW items carry the native list bullet (engine emits
   "- " rows -> md-ul/li disc). No ::before marker here -- an earlier
   face-scoped glyph decorated the head/digest .md-p lines instead of
   the rows (joint-verify ②, removed). */
/* S-181: mechanical operation-detail line (dim, top of a turn body) */
.foldline .opsline { color: var(--tx2); font-size: 11.5px;
                     margin: 0 0 4px; }
/* S-180 (user order 1 / B2): unified markdown typography -- 1.6 line
   height + justified paragraphs with exactly half a line after each
   (0.8em at 1.6). Entries and indented continuation lines stay left. */
.md { line-height: 1.6; }
.md .md-p { text-align: justify; margin: 0 0 .8em; }
.md li, .md .md-p.md-ind1, .md .md-p.md-ind2 { text-align: left; }
details.foldline > .foldbody {
  margin-top: 4px; padding: 6px 8px; border-radius: 7px;
  background: var(--fold-glass); border: 1px solid var(--line);
  /* S-179 user order 4: no inner scrollbar -- full height; the stream
     column (#stream) carries the one scroll */
  color: var(--tx1); font-size: 12.5px;
}

/* ---- Composer: modes left, input center, run controls right ---- */
#composer { flex: none; }
#composer .crow {
  display: flex; align-items: stretch; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--composer-glass); padding: 8px;
  --crow-h: 68px;
  --ctl-h: 30px;
}
.cstack { display: flex; flex-direction: column; gap: 8px;
          justify-content: space-between; flex: none; }
.cstack button { height: var(--ctl-h); }
.mode-stack { min-width: 96px; }
.modebtn { width: 96px; text-align: left !important; }
.modebtn.current { color: var(--tx0); border-color: var(--line);
                   background: var(--bg0); }
.modebtn:disabled { opacity: .45; cursor: not-allowed; }
.modebtn:focus-visible { outline: 2px solid rgba(77, 163, 255, .55);
                         outline-offset: 1px; }
#composer #cin { flex: 1; min-width: 60px; }
#composer #send { flex: none; }

/* ---------- right rail ---------- */
.rail {
  background: var(--rail); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; flex: none;
  box-shadow: var(--shadow-1);
}
.rail-title {
  font-size: 11px; font-weight: 600; letter-spacing: .8px;
  text-transform: uppercase; color: var(--tx2); margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.rail-title::before {
  content: ""; width: 5px; height: 5px; border-radius: 2px; background: var(--acc);
}
.rail-body { font-size: 12.5px; color: var(--tx1); }
.rail-body .empty { color: var(--tx3); font-size: 12px; padding: 2px 0 4px; }
.shots { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.shot img {
  width: 100%; display: block; border: 1px solid var(--line2);
  border-radius: 8px; background: var(--shot-mat);
}
/* S-264 J2: the sizing contract belongs to the RAIL, not to one wrapper.
   The "keep the last picture" branch of the geometry handler re-parents
   nodes, and a bare img/canvas outside `.shot` matched no rule at all --
   it rendered at its intrinsic 640x480 inside a ~316px rail and got clipped
   (live specimen 20261021-222742-327: "the picture suddenly got huge, then
   went back to normal about twenty seconds later"). */
.rail-body img, .rail-body canvas { max-width: 100%; }
.shot .cap { color: var(--tx3); font-size: 11px; margin-top: 3px;
             font-family: var(--font); overflow: hidden; text-overflow: ellipsis; }
.stage { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.stage .mark { width: 13px; text-align: center; color: var(--ok); flex: none; }
.stage .mark.wait { color: var(--warn); animation: pulse 1.4s infinite; }
.stage .txt { flex: 1; font-family: var(--font); font-size: 12px; }
.stage .used { color: var(--tx3); font-size: 11.5px; font-family: var(--font); }

/* markdown surfaces (S-145 transcript; S-150 panel bodies too) */
.md { color: var(--tx0); font-size: 13px; }
/* S-180 verify(P1①): margin moved to the S-180 rule above (a later
   same-specificity margin here would silently override it) */
.md .md-p { white-space: pre-wrap; word-break: break-word; }
.md .md-h { font-weight: 600; margin: 8px 0 3px; color: var(--tx0); }
.md .md-h1 { font-size: 15px; }
.md .md-h2 { font-size: 14px; }
.md .md-h3, .md .md-h4 { font-size: 13px; color: var(--tx1); }
.md .md-ul, .md .md-ol {
  margin: 3px 0 3px 18px; padding: 0; color: var(--tx1);
}
.md .md-ul { list-style: disc; }
.md .md-ol { list-style: decimal; }
.md li { margin: 1px 0; white-space: pre-wrap; }
.md code {
  font-family: var(--mono); font-size: 12px; color: var(--acc);
  background: var(--bg1); border: 1px solid var(--line);
  border-radius: 4px; padding: 0 4px;
}
.md .md-code {
  margin: 4px 0; padding: 7px 10px; border-radius: 7px;
  background: var(--bg1); border: 1px solid var(--line);
  color: var(--tx1); font-family: var(--mono); font-size: 12px;
  white-space: pre-wrap; word-break: break-all; overflow-x: auto;
}
.md strong { color: var(--tx0); font-weight: 650; }
/* S-209 J4 (10-17 user order 4): the *italics* notation renders as an
   upright solid underline -- oblique at 13px in a dimmed tone was not
   legible (S-206's italic form overruled by the user; the notation's
   semantics live in the prompts, the FORM lives here). */
.md em { font-style: normal; text-decoration: underline;
         text-underline-offset: 3px; color: var(--tx0); }
.md a { color: var(--acc); text-decoration: none; }
.md a:hover { text-decoration: underline; }

/* ---------- transcript (zcode-style: flat, dense, no bubbles) ---------- */
/* S-197 J4: the old transcript row rules (.tr*) were removed -- dead
   since S-163 (zero DOM refs; the pin clause retired with them). */
.pcard {
  margin: 6px 0 10px 12px; border: 1px solid var(--line);
  border-left: 3px solid var(--tx3); border-radius: 9px;
  background: var(--bg2); overflow: hidden;
}
.pcard .phead {
  display: flex; align-items: center; gap: 8px; padding: 5px 12px;
  font-size: 10.5px; letter-spacing: .8px;
  color: var(--tx3); font-family: var(--font);
  border-bottom: 1px solid var(--line); background: var(--chrome-tint);
}
.pcard .phead .pface {
  padding: 1px 8px; border-radius: 6px; font-size: 11px;
  letter-spacing: .5px; background: var(--chrome-tint2);
}
.pcard .phead .ptime { margin-left: auto; text-transform: none; letter-spacing: 0; }
/* S-201 J7: card TEXT edges share one x -- left paddings 6/6/8 with
   borders 3/1/1 put pcard/endbar text where foldline text sits
   (equation 6+3 == 8+1 == foldline composite 21). .phead keeps 12px on
   purpose (the chip box is its own shape). Pinned by equation in
   test_ui_js, not by measured pixels. */
/* S-206 D4 (user order: left-column text boxes fully expand, no inner
   scroll): the S-150 22em cap is GONE for every card body; long cards
   ride the #stream column scroll. Kept: #stream (column-level) and the
   composer input box. */
.pcard .pbody { padding: 8px 12px 8px 6px; font-size: 13px; }
/* S-209 J24 (user order A8): symmetric card padding -- the .8em md-p
   tail margin on the LAST block doubled the bottom gap (18.4px vs 8px).
   Section rhythm inside the card is untouched. */
.pcard .pbody .md > :last-child { margin-bottom: 0; }
.pcard .pbody pre {
  font-family: var(--font);
  margin: 0; white-space: pre-wrap; word-break: break-word; color: var(--tx0);
  font-size: 12.8px;
}
.pcard .phints { white-space: pre-wrap; padding: 0 12px 8px 6px; color: var(--advisory); font-size: 11.5px; }
/* S-186 J4 + S-189: every non-designer stream panel is ONE card anatomy
   (chip + time + always-visible body) with the semantics in the LEFT
   BORDER only, in three tiers -- blue = decision faces (confirm/
   question/gap/summary), red = advisory (warning), gray = informational
   (panel default); error keeps its own tone. The label chip stays
   single-tone (tx3 by .phead inheritance). S-186 deleted the gate rules
   as DEAD (gates were foldlines); S-189 made gate faces cards, so the
   rules are LIVE again -- border-left-color only. */
.pcard.face-warning { border-left-color: var(--advisory); }
.pcard.face-summary { border-left-color: var(--acc); }
.pcard.face-confirm, .pcard.face-question, .pcard.face-gap {
  border-left-color: var(--acc); }
.pcard.face-error { border-left-color: var(--err); }
.pcard.face-error .phead { color: var(--err); background: var(--err-soft); }
.endbar {
  border-radius: 9px; padding: 8px 13px 8px 8px; margin: 10px 0 14px 12px;
  font-weight: 600; font-size: 12.5px; font-family: var(--font);
}
.endbar.ok { background: var(--ok-soft); color: var(--ok);
             border: 1px solid rgba(61, 220, 151, .3); }
.endbar.bad { background: var(--err-soft); color: var(--err);
              border: 1px solid rgba(255, 128, 128, .3); }
@media (max-width: 940px) { #right { display: none; } }

/* render fallback (S-149 safeRender) */
.render-fallback {
  margin: 3px 0; padding: 6px 9px; font-family: var(--font);
  font-size: 11.5px; color: var(--warn); background: var(--bg1);
  border: 1px dashed var(--line); border-radius: 6px;
  white-space: pre-wrap; word-break: break-word;
}

/* ---------- S-150: layering, language, panel scroll ---------- */
#langsel {
  font: inherit; font-size: 11px; color: var(--tx2);
  background: var(--bg1); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 4px;
}

/* ---- S-153 P2a uplink chrome ------------------------------------------- */
/* S-163 (verify M3): #scen rule removed with the picker */
/* S-163: composer now lives inside #left (see layout block above) -- the
   old full-width footer styles are gone; keep only the gate-wait accent. */
#composer.gate-wait #cin { border-color: var(--acc); }
#cin {
  font-family: var(--font); font-size: 13px;
  line-height: 1.45;
  flex: 1; resize: none; height: var(--crow-h); min-height: var(--crow-h);
  max-height: 140px; overflow-y: auto;
   color: var(--tx0);
  background: var(--bg0); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px;
}
#send { font-size: 12px; }
#send:disabled { opacity: .45; cursor: default; }

/* ---- S-154: GFM tables + panel hint wrapping --------------------------- */
.md-table { border-collapse: collapse; margin: 6px 0; width: 100%;
            font-size: 12px; }
.md-table .md-th, .md-table .md-td {
  border: 1px solid var(--line2); padding: 4px 8px; text-align: left;
  vertical-align: top;
}
.md-table .md-th { background: var(--bg2); color: var(--tx0); }

/* S-154 (user order 2): leading-space hierarchy of panel lines becomes a
   real indent level (the literal spaces are stripped in markdown.js). */
.md .md-p.md-ind1 { padding-left: 12px; }
.md .md-p.md-ind2 { padding-left: 24px; }

/* ---- S-156 P2c: gate buttons (S-232: row rides the gate card) ----- */
.gbtn { font: inherit; font-size: 11.5px; color: var(--tx1);
        background: var(--bg2); border: 1px solid var(--line2);
        border-radius: 7px; padding: 5px 10px; cursor: pointer; }
.gbtn:hover { color: var(--tx0); border-color: var(--acc); }
.gbtn.primary { color: var(--ok); border-color: var(--ok); }

/* ---- S-159: post-run feedback bar --------------------------------------- */
.fbbar { display: flex; gap: 8px; align-items: center; margin: 6px 0;
         padding: 8px 12px; border: 1px dashed var(--line2);
         border-radius: 8px; color: var(--tx2); font-size: 12.5px; }
.fbbar .fbq { color: var(--tx1); }

.fbbar .fbin { flex: 1; min-width: 80px; font: 12px/1.4 var(--font);
               color: var(--tx1); background: var(--bg0);
               border: 1px solid var(--line); border-radius: 7px;
               padding: 5px 9px; }
#cin:disabled { opacity: .55; cursor: not-allowed; }

/* Live operation/thinking lane directly above the composer. Agent work uses
   the wrench glyph; LLM reasoning uses the brain glyph. */
#deltabox { display: none; min-height: 0; flex: none;
            margin: 0 2px 2px; padding: 4px 10px;
            border-left: 2px solid var(--acc);
            color: var(--tx2); font: 11.5px/1.45 var(--font);
            white-space: nowrap; overflow: hidden;
            opacity: .9; }
/* S-187: label + pin lane share one flex row (baseline-aligned) */
#deltabox.on { display: flex; align-items: baseline; }
/* S-172 user order 5: the thinking shim breathes (turn.start -> first
   delta/phase) so the line never looks dead on pure-protocol turns */
#deltabox.think { animation: thinkpulse 1.7s ease-in-out infinite; }
@keyframes thinkpulse { 50% { opacity: .45; } }
#deltabox.operation .dcur::after { content: ""; display: inline-block;
                                  width: 2.2em; text-align: left;
                                  animation: opdots 5s steps(1, end) infinite; }
@keyframes opdots {
  0% { content: ""; } 20% { content: "."; } 40% { content: ".."; }
  60% { content: "..."; } 80% { content: "...."; } 100% { content: "....."; }
}

/* ---- S-175 user order 2: Light theme (default) + Dark (kept) ---------- */
html[data-theme="light"] {
  --bg0: #f7f9fc; --bg1: #ffffff; --bg2: #eef2f8; --rail: #f2f5fa;
  --line: rgba(23, 42, 74, .14); --line2: rgba(23, 42, 74, .24);
  --tx0: #16233c; --tx1: #33445f; --tx2: #5a6b88; --tx3: #8494ad;
  --acc: #1668d6; --acc-soft: rgba(22, 104, 214, .10);
  --who: #7c4dcc; --term: #0e8d74; --advisory: #d63b3b;
  --ok: #0e9f6e; --ok-soft: rgba(14, 159, 110, .10);
  --warn: #b45309; --warn-soft: rgba(180, 83, 9, .10);
  --err: #d63b3b; --err-soft: rgba(214, 59, 59, .08);
  color-scheme: light;
}
html[data-theme="light"] {
  --halo-a: rgba(23, 108, 220, .05); --halo-b: rgba(124, 77, 220, .05);
  --top-glass: rgba(255, 255, 255, .88);
  --panel-glass: rgba(255, 255, 255, .72);
  --fold-glass: #f4f7fb;
  --composer-glass: rgba(255, 255, 255, .85);
  --chrome-tint: rgba(23, 42, 74, .04);
  --chrome-tint2: rgba(23, 42, 74, .12);
  --dash-line: rgba(23, 42, 74, .12);
  --scroll-thumb: rgba(23, 42, 74, .22);
  --scroll-thumb-hi: rgba(23, 42, 74, .38);
  --shadow-1: 0 2px 10px rgba(23, 42, 74, .10);
  --shadow-2: 0 6px 18px rgba(23, 42, 74, .12);
  --shot-mat: #ffffff;
}
html[data-theme="light"] body { background: var(--bg0); color: var(--tx1); }
/* S-175 verify(qwen extras): light-mode touches for leftovers */
html[data-theme="light"] .pcard .phead { background: rgba(23, 42, 74, .04); }
html[data-theme="light"] .shot img { background: #ffffff; }
/* S-175 (r1 both): a GENERIC .hidden (the plan card was retired by
   S-209 J25, the gate modal by S-232 -- the class stays for the
   live badge) */
.hidden { display: none !important; }

/* Brain/wrench glyphs share one 12px label and inherit the dim text color. */
#deltabox .dlabel { flex: none; color: var(--tx2); margin-right: 6px; }
#deltabox .dlabel svg { width: 12px; height: 12px; fill: none;
                        stroke: currentColor; stroke-width: 2;
                        stroke-linecap: round; stroke-linejoin: round; }
#deltabox .dlane { position: relative; flex: 1; min-width: 0;
                   overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  /* Keep every animated selector inside this exemption block. */
  #deltabox.think, #send.live::before,
  .badge, .stage .mark.wait, #deltabox.operation .dcur::after,
  .console-command::after { animation: none; }
  #stream > *, #stream .foldbody { animation: none; }
  #stream > *, #stream .foldbody { transition: none; }
  #deltabox.operation .dcur::after { content: "…"; }
  /* S-301+: the download-progress indeterminate slide joins the family
     (a static 40% strip reads fine without motion). */
  .dlprog-fill.indeterminate { animation: none; }
  #top #brand::before, #top #brand .brand-mark,
  #console-head .brick-chain i,
  #right .rail,
  #aboutmodal .aboutcard,
  #weblogin, #websetup,
  #webturn { animation: none; }
  #console-head .brick-chain i,
  .hbtns button, .cstack button, .gbtn, .rail, .shot img,
  #webturn, #weblogin, #websetup { transition: none; }
}
/* status line under the thinking line (phase/slot notices) */
#statusline { min-height: 15px; margin: 0 2px 2px; padding: 0 10px;
              color: var(--tx3); font-size: 11px; white-space: nowrap;
              overflow: hidden; text-overflow: ellipsis; }
/* S-209 J1 (user order 1): an empty status line takes no vertical space
   (its 19px dead band kept the fold line far from the composer); any
   notice -- slot.wait, reconnect -- restores the band unchanged. */
#statusline:empty { display: none; }
/* placeholder fold (turn.start) + flat folds (placeholder-only bodies) */
.foldline.livefold > summary { color: var(--tx3); }
.foldline.flat > summary::before { content: ""; }
.foldline.flat > .foldbody { display: none; }
/* S-175: the warning head tint stays; the face chip tone itself is
   unified tx3 (S-186) -- semantics live in the card's left border */
.pcard.face-warning > .phead { background: var(--err-soft); }
/* header buttons + About dialog */
.hbtns { margin-left: auto; display: flex; gap: 6px; }
/* Compact composer controls; the run button keeps one fixed glyph column. */
.cstack button { background: var(--bg0); color: var(--tx1);
                 border: 1px solid var(--line); border-radius: 8px;
                 font: 12px var(--font); cursor: pointer;
                 padding: 0 8px 0 18px; white-space: nowrap; text-align: right; }
#newbtn { text-align: left; }
#newbtn::before { display: inline-block; width: 10px; margin-right: 5px;
                  text-align: center; content: "+"; font-size: 18px;
                  font-weight: 600; line-height: 1; color: var(--ok); }
#send { min-width: 88px; font-weight: 600; text-align: left; color: var(--tx0); }
#send::before { display: inline-block; width: 10px; margin-right: 5px;
                text-align: center; content: "▶"; font-size: 10px; color: var(--ok); }
#send.live { color: var(--err); border-color: var(--err);
             background: var(--err-soft); }
#send.live::before { content: "●"; font-size: 9px; color: var(--err);
                     animation: thinkpulse 1.4s infinite; }
.hbtns button { background: var(--bg2); color: var(--tx1);
                border: 1px solid var(--line2); border-radius: 6px;
                padding: 3px 10px; font: 11.5px var(--font); cursor: pointer; }
#aboutmodal { position: fixed; inset: 0; background: rgba(4, 8, 16, .55);
              display: flex; align-items: center; justify-content: center;
              z-index: 60; }
#aboutmodal .aboutcard { max-width: 560px; width: 92%; background: var(--bg1);
              border: 1px solid var(--line2); border-radius: 12px;
              padding: 18px 22px; }
#aboutmodal h2 { margin: 0 0 10px; color: var(--tx0); font-size: 16px; }
/* S-176 user order: sections per LINE -- bold head, justified body,
   module entries as list rows (NOT columns) */
#aboutmodal .ahead { color: var(--tx0); font-weight: 700; font-size: 13px;
                     margin: 12px 0 4px; }
#aboutmodal .ahead:first-child { margin-top: 0; }
#aboutmodal .atext { color: var(--tx1); font-size: 12.5px; line-height: 1.6;
                     margin: 0 0 4px; text-align: justify; }
#aboutmodal .alist { color: var(--tx1); font-size: 12.5px; line-height: 1.55;
                     margin: 0 0 2px; padding-left: 14px; position: relative; }
#aboutmodal .alist::before { content: "▪"; position: absolute;
                     left: 2px; color: var(--acc); font-size: 10px; }
#aboutmodal button { background: var(--acc); color: #fff; border: 0;
              border-radius: 7px; padding: 6px 18px; font: 12.5px var(--font);
              cursor: pointer; }
#aboutmodal.hidden { display: none; }


/* ---- S-296 web face shell (public only; these nodes never exist on the
   local face, so these rules are inert there) -------------------------- */

#webqueue {
  display: block;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--tx2, #888);
  background: var(--bg1, #f6f6f6);
}
#webqueue:empty { display: none; }

#webturn {
  position: fixed; top: 56px; right: 16px; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  max-width: calc(100vw - 32px); padding: 12px 14px;
  color: var(--tx0); background: var(--bg1);
  border: 1px solid var(--acc); border-radius: 10px;
  box-shadow: var(--shadow-2); font-size: 13px;
}
#webturn button {
  flex: none; padding: 4px 9px; color: var(--tx1);
  background: var(--chrome-tint2); border: 1px solid var(--line2);
  border-radius: 6px; cursor: pointer; font-size: 12px;
}

#weblogin {
  max-width: 360px;
  margin: 48px auto;
  padding: 20px 24px;
  border: 1px solid var(--bd, #ddd);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#weblogin label { display: flex; flex-direction: column; gap: 4px;
  font-size: 13px; }
#weblogin input { padding: 6px 8px; border: 1px solid var(--bd, #ccc);
  border-radius: 4px; }
#weblogin button { padding: 8px; cursor: pointer; }
#weblogin .msg { min-height: 1em; font-size: 13px; color: var(--warn, #b00); }

.autobadge {
  display: inline-block;
  margin-left: 8px;
  padding: 0 6px;
  font-size: 11px;
  border: 1px solid var(--bd, #ccc);
  border-radius: 8px;
  color: var(--tx2, #888);
}

/* S-301 (owner order 2026-10-25): failure reason line under the outcome
   bar -- plain-language category text (never raw error strings); rides
   the same --err/-soft family so a failed session says WHERE it failed. */
.errline {
  color: var(--err); background: var(--err-soft);
  border-left: 3px solid var(--err);
  border-radius: 7px; padding: 7px 12px; margin: 0 0 12px 12px;
  font-size: 12.5px; line-height: 1.5; max-width: 60em;
}

/* S-301+ (owner order 2026-10-26): setup download progress rides NEXT TO
   the helper button (the top banner was easy to miss); online state goes
   green (--ok family, mirroring the pending alert's --err). */
.dlprog { display: inline-flex; align-items: center; gap: 8px;
          vertical-align: middle; margin-left: 10px; }
.dlprog-bar { width: 130px; height: 6px; border-radius: 3px;
              background: var(--line); overflow: hidden; }
.dlprog-fill { height: 100%; background: var(--acc);
               border-radius: 3px; transition: width .3s ease; }
.dlprog-fill.indeterminate {
  animation: dlslide 1.2s ease-in-out infinite alternate;
  width: 40% !important; }
@keyframes dlslide { from { transform: translateX(-60%); }
                     to { transform: translateX(220%); } }
.dlprog-txt { font-size: 11px; color: var(--tx2); white-space: nowrap; }
#helperbtn.online { color: var(--ok); border-color: var(--ok); }

/* S-302 gate countdown: shrinking bar + seconds readout on the live gate
   card. Deliberately NO css animation -- width updates are JS-driven, so
   the S-203 reduced-motion exemption family is untouched. */
.gatecd { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; }
.gatecd-track { flex: 1; height: 6px; border-radius: 3px;
                background: var(--line); overflow: hidden; }
.gatecd-fill { height: 100%; background: var(--acc); border-radius: 3px; }
.gatecd-txt { font-size: 11px; color: var(--tx2); white-space: nowrap; }

/* S-303 agent update states: amber = newer build published,
   muted-blue pulse-free = mid-swap (JS text only, no css animation). */
#helperbtn.update { color: #a06a00; border-color: #d9a521; }
#helperbtn.updating { color: var(--tx2); border-color: var(--tx2); }

/* ---- display craft pass (display-only; no behavior change) ----
   Upgrades on top of the established language: crisper card chrome,
   living affordances (hover/focus), a primary Send hierarchy, tabular
   numerals for machine timestamps, and quieter depth tokens. Every color
   rides existing theme tokens; geometry pins (text-edge equation, card
   margins) are untouched. */

:root {
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .22);
  --shot-shadow: 0 2px 6px rgba(0, 0, 0, .30);
}
html[data-theme="light"] {
  --shadow-card: 0 1px 3px rgba(23, 42, 74, .08);
  --shot-shadow: 0 1px 4px rgba(23, 42, 74, .12);
}

/* stream cards: a shade more presence + legible chrome row */
.pcard { box-shadow: var(--shadow-card); }
.pcard .phead { padding: 6px 12px; }
.pcard .phead .pface { font-weight: 600; }
.pcard .phead .ptime { font-variant-numeric: tabular-nums; }

/* fold lines: the header answers hover/open with one tone step */
details.foldline > summary { transition: color .15s ease; }
details.foldline > summary:hover,
details.foldline[open] > summary { color: var(--tx1); }

/* end bars: a status glyph ahead of the words (padding equation intact) */
.endbar.ok::before { content: "\2713\00A0\00A0"; }
.endbar.bad::before { content: "\2715\00A0\00A0"; }
.endbar { font-size: 13px; }

/* feedback bar: a settled surface instead of a draft dashed box */
.fbbar { border: 1px solid var(--line2); background: var(--bg2); }

/* composer: the input lifts off the glass; focus reads as one field */
#composer .crow { transition: border-color .15s ease, box-shadow .15s ease; }
#composer .crow:focus-within {
  border-color: var(--line2);
  box-shadow: 0 0 0 3px var(--acc-soft);
}
#composer #cin { background: var(--bg1); }
#cin:focus { border-color: var(--acc); }

/* send: the only filled primary on the page; stop keeps the outline
   danger language shared with the other destructive states */
#send { background: var(--acc); border-color: var(--acc); color: var(--bg1); }
#send::before { color: inherit; }
#send:disabled {
  background: var(--bg2); border-color: var(--line);
  color: var(--tx3); opacity: 1;
}
#send.live {
  background: var(--err-soft); border-color: var(--err); color: var(--err);
}

/* buttons answer the pointer (state colors on IDs keep precedence) */
.cstack button, .hbtns button, #langsel {
  transition: color .15s ease, border-color .15s ease;
}
.cstack button:hover:not(:disabled) { color: var(--tx0); border-color: var(--line2); }
.hbtns button:hover { color: var(--tx0); border-color: var(--tx3); }
#langsel:hover { color: var(--tx1); }
#runsel:hover { color: var(--tx0); }
.modebtn.current { box-shadow: inset 2px 0 0 var(--acc); }

/* right rail: quieter float + framed pictures + tabular durations */
.rail { box-shadow: var(--shadow-card); }
.shot img { box-shadow: var(--shot-shadow); }
.shot .cap { margin-top: 6px; }
.stage { margin: 4px 0; }
.stage .used, #runmeta { font-variant-numeric: tabular-nums; }

/* about dialog: settle the sheet on glass + shadow */
#aboutmodal { backdrop-filter: blur(3px); }
#aboutmodal .aboutcard { box-shadow: var(--shadow-2); }

/* ---- zh type hierarchy pass (html[lang="zh"] scoped; EN untouched) ----
   Owner order 2026-11-02: the in-turn text tiers read as one dense
   mass in Chinese. A three-step scale (chapter head / prose / block
   intro+list) separated by size, weight and color; CJK gets half-step
   sizes and taller leading because dense hanzi needs more air than
   latin at the same nominal size. Geometry pins (left edges, paddings)
   stay untouched; EN rendering is byte-identical. */

/* tier 1 -- turn chapter head: one clear step up, action phrase bolded */
html[lang="zh"] details.foldline { margin: 9px 0 4px; font-size: 13.5px;
                                   line-height: 1.5; }
html[lang="zh"] summary .fact { font-weight: 600; }
html[lang="zh"] summary .fturn { font-variant-numeric: tabular-nums; }

/* tier 3 -- prose: the dominant tier (+1px, taller leading, deeper sink) */
html[lang="zh"] .md { font-size: 14px; line-height: 1.75; }
html[lang="zh"] .md .md-p { margin: 0 0 .9em; }
html[lang="zh"] .md .md-h1 { font-size: 16px; }
html[lang="zh"] .md .md-h2 { font-size: 15px; }
html[lang="zh"] .md .md-h3, html[lang="zh"] .md .md-h4 { font-size: 14px; }
html[lang="zh"] .foldbody { font-size: 13px; line-height: 1.7; }
html[lang="zh"] .pcard .pbody { font-size: 14px; }

/* tier 4 -- block intro reads as a sub-head; list is one lighter step */
html[lang="zh"] .md .md-p:has(+ .md-ul),
html[lang="zh"] .md .md-p:has(+ .md-ol) {
  font-weight: 600; color: var(--tx0);
  margin: .2em 0 .5em;
}
html[lang="zh"] .md .md-ul, html[lang="zh"] .md .md-ol {
  margin: 4px 0 10px 20px; }
html[lang="zh"] .md li { font-size: 13.5px; line-height: 1.7;
                         margin: 2.5px 0; }
html[lang="zh"] .md li::marker { color: var(--tx3); }

/* small chrome: lift the tiny zh lines off the awkward floor */
html[lang="zh"] .pcard .phead { font-size: 11px; }
html[lang="zh"] .rail-title { font-size: 11.5px; }
html[lang="zh"] .stage .txt { font-size: 12.5px; }
html[lang="zh"] .stage .used { font-size: 12px; }
html[lang="zh"] .pcard .phints { font-size: 12px; }
html[lang="zh"] .shot .cap { font-size: 11.5px; }

/* ---- stage labels retired (owner order 2026-11-02, zh+en alike) ----
   The in-turn operation-detail line (S-181 opsline) no longer renders.
   A turn whose body carried ONLY that line collapses to its chapter
   head alone -- body box hidden and the caret dropped, matching the
   established flat-fold idiom. Events, the audit trail and the CLI
   panel keep the full detail: this is a display-side removal only.
   Exception (same-day owner order): the absorption turn's line (the
   lessons writeback phrase, zh and en variants) reads as the turn's
   body prose, not a stage label. */
.foldline .opsline { display: none; }
.foldline.act-read_more .opsline {
  display: block; font-size: 13px; line-height: 1.6;
  color: var(--tx1); font-weight: 400; }
html[lang="zh"] .foldline.act-read_more .opsline {
  font-size: 14px; line-height: 1.75; }
details.foldline:has(.foldbody > .opsline:only-child):not(.act-read_more) {
  cursor: default; }
details.foldline:has(.foldbody > .opsline:only-child):not(.act-read_more)
  > summary { cursor: default; }
details.foldline:has(.foldbody > .opsline:only-child):not(.act-read_more)
  > summary::before { content: ""; }
details.foldline:has(.foldbody > .opsline:only-child):not(.act-read_more)
  > .foldbody { display: none; }

/* ---- Block Console: the final left-face visual layer ----
   The earlier card geometry remains as the legacy base; this layer replaces
   it with one continuous writing surface. Light is a white board, dark is a
   black board. Event names, DOM structure and gate behavior stay unchanged. */
:root {
  --console-bg: #0b0e0c;
  --console-bg2: #111612;
  --console-input: #0e120f;
  --console-text: #dce6de;
  --console-muted: #95a49a;
  --console-dim: #738178;
  --console-line: rgba(177, 204, 185, .18);
  --console-strong: rgba(177, 204, 185, .42);
  --console-accent: #8fc7a7;
  --who: #a9d6b8;
}
html[data-theme="light"] {
  --console-bg: #ffffff;
  --console-bg2: #f4f7f4;
  --console-input: #ffffff;
  --console-text: #26332a;
  --console-muted: #56645a;
  --console-dim: #66736a;
  --console-line: rgba(35, 65, 45, .18);
  --console-strong: rgba(35, 65, 45, .42);
  --console-accent: #1f6d4b;
  --who: #276549;
}
#left {
  padding: 16px 20px 12px;
  color: var(--console-text);
  background: var(--console-bg);
  font-family: var(--mono);
}
#stream {
  padding: 10px 2px 24px;
  color: var(--console-text);
  font-family: var(--mono);
}
#stream > * { animation: consoleReveal .34s cubic-bezier(.2,.7,.2,1) both; }
#stream .foldbody {
  animation: consoleReveal .28s .05s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes consoleReveal {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes consoleCursor { 50% { opacity: 0; } }

#left details.foldline {
  margin: 10px 0 4px; padding: 2px 0 2px 20px;
  border-left: 0; color: var(--console-muted);
  font-family: var(--mono); font-size: 12.5px;
}
#left details.foldline > summary { color: var(--console-muted); }
#left details.foldline > summary::before,
#left details.foldline[open] > summary::before {
  content: ""; display: inline-block; width: 7px; height: 7px;
  margin: 0 9px 0 -16px; vertical-align: 1px;
  border-radius: 0; background: var(--console-accent);
  box-shadow: 3px 3px 0 var(--console-line);
}
#left details.foldline.flat > summary::before { opacity: .55; }
#left summary .fturn { color: var(--console-dim); }
#left summary .fact { color: var(--console-text); font-weight: 500; }
html[lang="zh"] #left summary .fact { font-weight: 500; }
#left details.foldline > .foldbody {
  margin: 6px 0 14px 3px; padding: 2px 0 2px 20px;
  color: var(--console-muted); background: transparent;
  border: 0; border-radius: 0; font-family: var(--mono);
}
#left .foldline .opsline,
#left .foldline.act-read_more .opsline { color: var(--console-muted); }
#left .md { color: var(--console-text); font-family: var(--mono); }
#left .md .md-p { margin-bottom: .75em; text-align: left; }
#left .md .md-h,
#left .md .md-h3,
#left .md .md-h4 { color: var(--console-text); }
#left .md .md-ul { list-style: square; }
#left .md li::marker { color: var(--console-accent); }
#left .md strong,
#left .md em { color: var(--console-text); }
#left .md a,
#left .md code { color: var(--console-accent); }
#left .md code {
  background: var(--console-bg2); border-color: var(--console-line);
  border-radius: 2px;
}
#left .md .md-code {
  color: var(--console-muted); background: var(--console-bg2);
  border-color: var(--console-line); border-radius: 2px;
}
#left .md-table .md-th,
#left .md-table .md-td { border-color: var(--console-line); }
#left .md-table .md-th { background: var(--console-bg2); }

#left .pcard {
  margin: 18px 0; overflow: visible;
  color: var(--console-text); background: transparent;
  border: 0; border-radius: 0; box-shadow: none;
}
#left .pcard .phead {
  gap: 8px; padding: 0 0 7px;
  color: var(--console-dim); background: transparent;
  border: 0; font-family: var(--mono); font-size: 11px;
}
#left .pcard .phead .pface {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 1px 6px; color: var(--console-muted);
  background: var(--console-bg2); border: 1px solid var(--console-line);
  border-radius: 2px; font-family: var(--mono); font-weight: 500;
}
#left .pcard .phead .pface::before {
  content: ""; width: 4px; height: 4px; background: currentColor;
}
#left .pcard .phead .ptime { margin-left: 2px; color: var(--console-dim); }
#left .pcard .pbody { padding: 0 0 0 20px; font-family: var(--mono); }
#left .pcard .pbody pre {
  color: var(--console-text); font-family: var(--mono);
}
#left .pcard .phints,
#left .pcard .gatewait {
  padding: 0 0 0 20px; color: var(--console-muted);
  font-family: var(--mono);
}
#left .pcard .phints { color: var(--advisory); }
#left .pcard .gatebtns { padding-left: 20px; }
#left .pcard.face-warning .pface { color: var(--advisory); }
#left .pcard.face-summary .pface,
#left .pcard.face-confirm .pface,
#left .pcard.face-question .pface,
#left .pcard.face-gap .pface { color: var(--console-accent); }
#left .pcard.face-error .pface,
#left .pcard.face-error .phead { color: var(--err); background: transparent; }
#left .autobadge {
  margin: 0 0 12px 20px; color: var(--console-muted);
  background: var(--console-bg2); border-color: var(--console-line);
  border-radius: 2px; font-family: var(--mono);
}

#left .endbar {
  margin: 16px 0; padding: 5px 0;
  border: 0; border-radius: 0; background: transparent;
  font-family: var(--mono); font-weight: 500;
}
#left .endbar.ok,
#left .endbar.bad { background: transparent; border: 0; }
#left .endbar.ok { color: var(--ok); }
#left .endbar.bad { color: var(--err); }
#left .endbar.ok::before,
#left .endbar.bad::before {
  content: ""; display: inline-block; width: 7px; height: 7px;
  margin-right: 10px; background: currentColor;
}
#left .errline {
  margin: 0 0 14px; padding: 4px 0;
  color: var(--err); background: transparent;
  border: 0; border-radius: 0; font-family: var(--mono);
}
#left .fbbar {
  flex-wrap: wrap; margin: 18px 0 8px; padding: 14px 0 4px;
  color: var(--console-muted); background: transparent;
  border: 0; border-top: 1px solid var(--console-line); border-radius: 0;
  font-family: var(--mono);
}
#left .fbbar .fbq { color: var(--console-text); }
#left .fbbar .fbin {
  color: var(--console-text); background: var(--console-input);
  border-color: var(--console-strong); border-radius: 2px;
  font-family: var(--mono);
}
#left .render-fallback {
  color: var(--warn); background: transparent;
  border-color: var(--console-line); border-radius: 2px;
  font-family: var(--mono);
}

#left .gbtn {
  color: var(--console-muted); background: transparent;
  border-color: var(--console-strong); border-radius: 2px;
  font-family: var(--mono);
}
#left .gbtn:hover { color: var(--console-text); border-color: var(--console-accent); }
#left .gbtn.primary { color: var(--console-accent); border-color: var(--console-accent); }
#left .gatecd-track,
#left .gatecd-fill { border-radius: 0; }
#left .gatecd-track { background: var(--console-line); }
#left .gatecd-fill { background: var(--console-accent); }
#left .gatecd-txt { color: var(--console-dim); font-family: var(--mono); }

#deltabox {
  margin: 0 0 2px; padding: 4px 0;
  color: var(--console-muted); border-left: 0;
  font-family: var(--mono);
}
#deltabox .dlabel { color: var(--console-dim); }
#statusline {
  position: relative; padding: 0 0 0 16px;
  color: var(--console-dim); font-family: var(--mono);
}
#statusline:not(:empty)::before {
  content: ">"; position: absolute; left: 1px; color: var(--console-accent);
}
#composer .crow {
  border-color: var(--console-strong); border-radius: 3px;
  color: var(--console-text); background: var(--console-input);
  box-shadow: none; font-family: var(--mono);
}
#composer .crow::before {
  content: ">"; align-self: center; flex: none;
  color: var(--console-accent); font: 14px var(--mono);
}
#composer .crow:focus-within {
  border-color: var(--console-accent); box-shadow: none;
}
#composer #cin {
  padding: 8px 6px; color: var(--console-text); background: transparent;
  border: 0; border-radius: 0; font-family: var(--mono);
}
#composer #cin:focus { border-color: transparent; }
#composer #cin:focus-visible { outline: none; }
#composer .cstack button {
  color: var(--console-muted); background: transparent;
  border-color: var(--console-strong); border-radius: 2px;
  font-family: var(--mono);
}
#composer .cstack button:hover:not(:disabled) {
  color: var(--console-text); border-color: var(--console-accent);
}
#composer .modebtn.current {
  color: var(--console-text); background: var(--console-bg2);
  border-color: var(--console-line); box-shadow: inset 3px 0 0 var(--console-accent);
}
#composer #send {
  color: var(--console-bg); background: var(--console-accent);
  border-color: var(--console-accent); border-radius: 2px;
}
#composer #send:disabled {
  color: var(--console-dim); background: var(--console-bg2);
  border-color: var(--console-line);
}
#composer #send.live {
  color: var(--err); background: transparent; border-color: var(--err);
}
#composer.gate-wait #cin { border-color: transparent; }

/* ---- CMD x Block Console: phosphor terminal + snap-together modules ---- */
:root {
  --console-bg: #050806;
  --console-bg2: #0b110c;
  --console-input: #070b08;
  --console-text: #d8e5d8;
  --console-muted: #96a897;
  --console-dim: #6d7e70;
  --console-line: rgba(166, 255, 112, .18);
  --console-strong: rgba(166, 255, 112, .46);
  --console-accent: #a6ff70;
  --console-chrome: #090d0a;
  --console-block: #0d140e;
  --console-grid: rgba(166, 255, 112, .045);
  --block-green: #a6ff70;
  --block-amber: #ffbf47;
  --block-cyan: #61d9d4;
  --block-red: #ff7168;
  --block-shadow: #010201;
  --block-highlight: #e4ffd2;
  --acc: #a6ff70;
  --acc-soft: rgba(166, 255, 112, .10);
  --who: #61d9d4;
  --term: #ffcc66;
  --advisory: #ff8178;
  --ok: #a6ff70;
  --ok-soft: rgba(166, 255, 112, .10);
  --warn: #ffbf47;
  --warn-soft: rgba(255, 191, 71, .10);
  --err: #ff7168;
  --err-soft: rgba(255, 113, 104, .10);
  --shot-mat: #080c09;
}
html[data-theme="light"] {
  --console-bg: #f2f0e8;
  --console-bg2: #e7e7dc;
  --console-input: #faf9f3;
  --console-text: #1b251d;
  --console-muted: #49594c;
  --console-dim: #657367;
  --console-line: rgba(39, 75, 44, .19);
  --console-strong: rgba(39, 75, 44, .45);
  --console-accent: #347a3c;
  --console-chrome: #e4e4d9;
  --console-block: #faf9f3;
  --console-grid: rgba(39, 75, 44, .055);
  --block-green: #80bd61;
  --block-amber: #d99a2b;
  --block-cyan: #3b9d9a;
  --block-red: #c8554d;
  --block-shadow: #b4b5a8;
  --block-highlight: #f4ffe9;
  --acc: #347a3c;
  --acc-soft: rgba(52, 122, 60, .09);
  --who: #167078;
  --term: #8a6100;
  --advisory: #b83b34;
  --ok: #347a3c;
  --ok-soft: rgba(52, 122, 60, .09);
  --warn: #986000;
  --warn-soft: rgba(152, 96, 0, .09);
  --err: #bd443d;
  --err-soft: rgba(189, 68, 61, .08);
  --shot-mat: #ffffff;
}
body {
  color: var(--console-text);
  background: var(--console-bg);
  letter-spacing: .01em;
}
button, input, select, textarea { border-radius: 0; }
button { -webkit-tap-highlight-color: transparent; }
::selection { color: var(--console-bg); background: var(--console-accent); }
:focus-visible { outline: 2px solid var(--block-amber); outline-offset: 3px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--console-strong); border: 2px solid var(--console-bg);
  border-radius: 0;
}
::-webkit-scrollbar-thumb:hover { background: var(--console-accent); }
::-webkit-scrollbar-track { background: var(--console-bg2); }
.screen-noise {
  position: fixed; inset: 0; z-index: 200; pointer-events: none;
  background: repeating-linear-gradient(to bottom,
    transparent 0, transparent 2px, rgba(150, 255, 115, .035) 2px,
    rgba(150, 255, 115, .035) 3px);
}
html[data-theme="light"] .screen-noise {
  background: repeating-linear-gradient(to bottom,
    transparent 0, transparent 3px, rgba(30, 55, 35, .025) 3px,
    rgba(30, 55, 35, .025) 4px);
}

/* title bar */
#top {
  position: relative; z-index: 20; min-height: 56px; gap: 10px;
  padding: 9px 14px 8px; color: var(--console-text);
  background: var(--console-chrome); backdrop-filter: none;
  border-bottom: 2px solid var(--console-accent);
  box-shadow: 0 4px 0 var(--block-shadow);
}
#top::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 3px;
  background: repeating-linear-gradient(90deg,
    var(--console-accent) 0 24px, transparent 24px 28px);
  opacity: .45;
}
#brand {
  flex: none; gap: 10px; color: var(--console-text);
  font-size: 15px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; text-shadow: 2px 2px 0 var(--block-shadow);
}
#top #brand::before {
  content: ""; display: block; width: 30px; height: 23px; flex: none;
  border: 1px solid var(--block-highlight); border-radius: 0;
  background:
    radial-gradient(circle at 25% 24%, var(--block-highlight) 0 1px,
      var(--block-green) 1.5px 3px, transparent 3.5px),
    radial-gradient(circle at 75% 24%, var(--block-highlight) 0 1px,
      var(--block-green) 1.5px 3px, transparent 3.5px),
    radial-gradient(circle at 25% 72%, var(--block-highlight) 0 1px,
      var(--block-green) 1.5px 3px, transparent 3.5px),
    radial-gradient(circle at 75% 72%, var(--block-highlight) 0 1px,
      var(--block-green) 1.5px 3px, transparent 3.5px),
    var(--console-accent);
  box-shadow: 3px 3px 0 var(--block-shadow);
  animation: brickSnap .48s cubic-bezier(.2,.8,.2,1) both;
}
#brand::after {
  content: "BLOCK\A CONSOLE"; white-space: pre; margin-left: 1px;
  padding-left: 10px; border-left: 1px solid var(--console-strong);
  color: var(--console-dim); font-size: 8px; font-weight: 600;
  line-height: 1.25; letter-spacing: .18em; text-shadow: none;
}
#runsel {
  color: var(--block-amber); font-size: 11.5px; font-weight: 600;
  min-height: 26px; padding: 0 3px;
}
#runsel:hover { color: var(--console-text); }
#runsel option, #langsel option {
  color: var(--console-text); background: var(--console-block);
}
#runmeta { color: var(--console-dim); font-size: 11px; }
.badge {
  padding: 2px 7px; color: var(--console-bg); background: var(--console-accent);
  border: 1px solid var(--console-accent); border-radius: 0;
  box-shadow: 2px 2px 0 var(--block-shadow); font-size: 9px;
}
.hbtns { gap: 7px; }
.hbtns button, .settings button, #langsel {
  min-height: 28px; padding: 3px 9px; color: var(--console-muted);
  background: var(--console-block); border: 1px solid var(--console-strong);
  border-radius: 0; box-shadow: 2px 2px 0 var(--block-shadow);
  font-size: 10.5px; transition: transform .12s ease, box-shadow .12s ease,
    color .12s ease, border-color .12s ease;
}
.hbtns button:hover, .settings button:hover, #langsel:hover {
  color: var(--console-accent); border-color: var(--console-accent);
  transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--block-shadow);
}
.hbtns button:active, .settings button:active { transform: translate(1px, 1px); box-shadow: none; }
#helperbtn.pending { color: var(--block-red); border-color: var(--block-red); }
#helperbtn.online { color: var(--console-accent); border-color: var(--console-accent); }
#helperbtn.update { color: var(--block-amber); border-color: var(--block-amber); }
.settings { position: relative; flex: none; }
.settings #settingsbtn {
  display: grid; place-items: center; width: 32px; height: 30px; padding: 0;
}
.settings #settingsbtn svg { width: 17px; height: 17px; }
.settings #settingsmenu {
  position: absolute; top: calc(100% + 5px); right: 0; z-index: 60;
  min-width: 168px; padding: 6px; background: var(--console-block);
  border: 1px solid var(--console-strong); box-shadow: 4px 4px 0 var(--block-shadow);
}
.settings #settingsmenu[hidden] { display: none !important; }
.settings #revokeagent { width: 100%; }

/* static boot header */
#main { background: var(--console-bg); }
#left { position: relative; padding: 0 20px 14px; }
#console-head {
  position: relative; flex: none; min-height: 68px; padding: 13px 172px 11px 4px;
  border-bottom: 1px solid var(--console-line);
}
.console-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.console-command {
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
  color: var(--console-text); font-size: 12px; white-space: nowrap;
}
.console-subline {
  display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 7px;
  color: var(--console-dim); font-size: 9px; letter-spacing: .09em;
}
.console-subline span::before { content: "["; margin-right: 3px; }
.console-subline span::after { content: "]"; margin-left: 3px; }
.brick-chain {
  position: absolute; right: 5px; bottom: 15px; display: flex;
  align-items: flex-end; gap: 5px; padding: 0 3px 4px;
  border-bottom: 3px solid var(--console-strong);
}
#console-head .brick-chain i {
  position: relative; display: block; width: 29px; height: 16px;
  color: var(--block-green); background: currentColor;
  border: 1px solid currentColor; box-shadow: 3px 3px 0 var(--block-shadow);
  animation: brickSnap .46s cubic-bezier(.2,.8,.2,1) both;
}
#console-head .brick-chain i::before {
  content: ""; position: absolute; left: 3px; right: 3px; top: -5px; height: 5px;
  background: radial-gradient(ellipse at 5px 5px, currentColor 0 3px,
    transparent 3.5px) 0 0 / 14px 5px repeat-x;
}
#console-head .brick-chain i::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.25),
    transparent 48%, rgba(0,0,0,.16));
}
#console-head .brick-chain i:nth-child(2) {
  width: 37px; height: 20px; color: var(--block-amber); animation-delay: .07s;
}
#console-head .brick-chain i:nth-child(3) {
  width: 31px; height: 16px; color: var(--block-cyan); animation-delay: .14s;
}
#console-head .brick-chain i:nth-child(4) {
  width: 23px; height: 23px; color: var(--block-red); animation-delay: .21s;
}
#stream {
  padding: 18px 5px 30px 4px;
  scrollbar-gutter: stable;
}
#stream:focus-visible { outline: 1px solid var(--console-line); outline-offset: -2px; }

/* transcript commands and inline block plates */
#left details.foldline { margin-top: 14px; }
#left details.foldline > summary {
  transition: color .15s ease, transform .15s ease;
}
#left details.foldline > summary:hover { transform: translateX(3px); }
#left details.foldline > summary::before,
#left details.foldline[open] > summary::before {
  box-shadow: 2px 2px 0 var(--block-shadow), 0 -2px 0 var(--console-strong);
}
#left details.foldline[open] > summary::before { background: var(--block-amber); }
#left summary .fwho { color: var(--who); font-weight: 700; }
#left summary .fturn { color: var(--console-dim); }
#left details.foldline > .foldbody { position: relative; }
#left details.foldline > .foldbody::before {
  content: "└─"; position: absolute; left: 0; top: 1px;
  color: var(--console-dim); font-size: 11px;
}
#left .md .md-h { letter-spacing: .02em; }
#left .md .md-ul { list-style: square; }
#left .md code { border-radius: 0; box-shadow: 2px 2px 0 var(--block-shadow); }
#left .md .md-code { border-left: 3px solid var(--block-cyan); border-radius: 0; }
#left .md a { color: var(--block-cyan); text-decoration: underline; }
#left .md-table .md-th { color: var(--console-accent); }

#left .pcard {
  --face: var(--console-accent);
  position: relative; margin: 24px 0; padding-right: 7px;
}
#left .pcard.face-warning { --face: var(--advisory); }
#left .pcard.face-summary,
#left .pcard.face-confirm,
#left .pcard.face-question,
#left .pcard.face-gap { --face: var(--console-accent); }
#left .pcard.face-error { --face: var(--err); }
#left .pcard .phead {
  position: relative; z-index: 1; min-height: 27px; padding: 0;
  align-items: flex-end;
}
#left .pcard .phead .pface {
  position: relative; gap: 8px; padding: 4px 10px;
  color: var(--console-bg); background: var(--face); border: 1px solid var(--face);
  border-radius: 0; box-shadow: 3px 3px 0 var(--block-shadow);
  font-size: 10px; font-weight: 800; letter-spacing: .08em;
}
#left .pcard .phead .pface::before {
  content: ""; width: 16px; height: 5px; border-radius: 0;
  background: radial-gradient(ellipse at 4px 4px, var(--console-bg) 0 2px,
    transparent 2.5px) 0 0 / 9px 5px repeat-x;
  opacity: .55;
}
#left .pcard .phead .ptime { margin-left: auto; padding-bottom: 3px; }
#left .pcard .pbody {
  margin-top: 6px; padding: 12px 15px 12px 20px;
  color: var(--console-text); border: 1px solid var(--console-strong);
  border-left: 3px solid var(--face); border-radius: 0;
  background:
    radial-gradient(circle at calc(100% - 25px) 8px, var(--console-strong) 0 2px,
      transparent 2.5px),
    radial-gradient(circle at calc(100% - 13px) 8px, var(--console-strong) 0 2px,
      transparent 2.5px),
    var(--console-block);
  box-shadow: 4px 4px 0 var(--block-shadow);
}
#left .pcard::after {
  content: ""; position: absolute; right: 0; top: 54px; width: 7px; height: 15px;
  background: var(--face); clip-path: polygon(0 0, 100% 25%, 100% 75%, 0 100%);
}
#left .pcard .phints,
#left .pcard .gatewait {
  margin-top: 5px; padding: 7px 12px 7px 20px;
  background: var(--console-block); border-left: 3px solid var(--face);
}
#left .pcard .gatebtns,
#left .pcard .gateanswer { padding: 4px 0 0 20px; }
#left .pcard .gateanswer textarea {
  color: var(--console-text); background: var(--console-input);
  border-color: var(--console-strong); font-family: var(--mono);
}
#left .autobadge { border-radius: 0; box-shadow: 2px 2px 0 var(--block-shadow); }
#left .gbtn, .fbbar .gbtn {
  position: relative; padding: 6px 11px; color: var(--console-muted);
  background: var(--console-block); border: 1px solid var(--console-strong);
  border-radius: 0; box-shadow: 3px 3px 0 var(--block-shadow);
  transition: transform .12s ease, box-shadow .12s ease, color .12s ease;
}
#left .gbtn::before, .fbbar .gbtn::before {
  content: "■"; margin-right: 6px; color: var(--console-accent); font-size: 7px;
}
#left .gbtn.primary, .fbbar .gbtn.primary {
  color: var(--console-bg); background: var(--console-accent);
  border-color: var(--console-accent); font-weight: 700;
}
#left .gbtn.primary::before, .fbbar .gbtn.primary::before { color: var(--console-bg); }
#left .gbtn:hover, .fbbar .gbtn:hover {
  color: var(--console-accent); border-color: var(--console-accent);
  transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--block-shadow);
}
#left .gbtn.primary:hover, .fbbar .gbtn.primary:hover { color: var(--console-bg); }
#left .gbtn:active, .fbbar .gbtn:active { transform: translate(2px, 2px); box-shadow: none; }
#left .gatecd-track { height: 8px; border: 1px solid var(--console-line); }
#left .gatecd-fill {
  background: repeating-linear-gradient(90deg, var(--console-accent) 0 10px,
    transparent 10px 13px);
}
#left .endbar {
  padding: 8px 12px; border: 1px solid var(--console-line) !important;
  border-left: 3px solid currentColor !important; border-radius: 0;
  background: var(--console-block) !important;
  box-shadow: 3px 3px 0 var(--block-shadow);
}
#left .errline {
  padding: 8px 12px; background: var(--err-soft);
  border-left: 3px solid var(--err); box-shadow: 3px 3px 0 var(--block-shadow);
}
#left .fbbar {
  padding: 12px; border: 1px dashed var(--console-strong);
  background: var(--console-block); box-shadow: 3px 3px 0 var(--block-shadow);
}
#left .fbbar .fbin { border-radius: 0; }
#left .render-fallback { border-radius: 0; box-shadow: 3px 3px 0 var(--block-shadow); }

/* command input buffer */
#deltabox {
  margin: 4px 2px; padding: 6px 9px; color: var(--console-muted);
  background: var(--console-block); border: 1px dashed var(--console-line);
}
#deltabox .dlabel { color: var(--block-cyan); }
#statusline { color: var(--block-amber); }
.composer-lane {
  display: grid; grid-template-areas: "lane"; align-items: center;
  min-height: 36px;
}
.composer-lane > * { grid-area: lane; min-width: 0; }
.composer-lane:has(#deltabox.on) .composer-caption { visibility: hidden; }
.composer-caption {
  display: flex; justify-content: space-between; gap: 12px; margin: 8px 2px 5px;
  color: var(--console-dim); font-size: 9px; letter-spacing: .12em;
}
.composer-caption span:first-child::before {
  content: "■"; margin-right: 6px; color: var(--console-accent); font-size: 7px;
}
#composer .crow {
  --crow-h: 64px; --ctl-h: 30px;
  position: relative; gap: 9px; padding: 9px;
  border: 1px solid var(--console-strong); border-radius: 0;
  background: var(--console-input); box-shadow: 4px 4px 0 var(--block-shadow);
}
#composer .crow::before {
  content: "C:\\>"; align-self: flex-start; margin: 9px 0 0 2px;
  color: var(--console-accent); font: 700 12px var(--mono);
}
#composer .crow:focus-within {
  border-color: var(--console-accent);
  box-shadow: 4px 4px 0 var(--block-shadow), 0 0 0 1px var(--console-accent);
}
#composer #cin {
  padding: 7px 6px; color: var(--console-text); caret-color: var(--console-accent);
  background: transparent; font-size: 13px;
}
#composer #cin::placeholder { color: var(--console-dim); opacity: .85; }
#composer .cstack button {
  color: var(--console-muted); background: var(--console-block);
  border: 1px solid var(--console-strong); border-radius: 0;
  box-shadow: 2px 2px 0 var(--block-shadow);
  transition: transform .12s ease, box-shadow .12s ease, color .12s ease;
}
#composer .cstack button:hover:not(:disabled) {
  color: var(--console-accent); border-color: var(--console-accent);
  transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--block-shadow);
}
#composer .cstack button:active:not(:disabled) { transform: translate(1px, 1px); box-shadow: none; }
#composer .modebtn.current {
  color: var(--console-accent); background: var(--console-bg2);
  border-color: var(--console-accent); box-shadow: inset 4px 0 0 var(--console-accent);
}
#composer #send {
  color: var(--console-bg); background: var(--console-accent);
  border-color: var(--console-accent); box-shadow: 3px 3px 0 var(--block-shadow);
}
#composer #send:hover:not(:disabled) { color: var(--console-bg); }
#composer #send:disabled {
  color: var(--console-dim); background: var(--console-bg2);
  border-color: var(--console-line); box-shadow: none;
}
#composer #send.live {
  color: var(--block-red); background: var(--err-soft); border-color: var(--block-red);
}
#cin:disabled { opacity: .5; }

/* numbered output modules */
#right {
  counter-reset: rail; width: 356px; gap: 15px; padding: 17px 15px;
  color: var(--console-text); border-left: 2px solid var(--console-accent);
  background-color: var(--console-bg2);
  background-image: linear-gradient(var(--console-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--console-grid) 1px, transparent 1px);
  background-size: 22px 22px;
}
#right .rail {
  --rail-accent: var(--block-cyan);
  counter-increment: rail; position: relative; padding: 13px 12px 12px;
  color: var(--console-text); background: var(--console-block);
  border: 1px solid var(--console-strong); border-radius: 0;
  box-shadow: 4px 4px 0 var(--block-shadow);
  animation: railDock .38s cubic-bezier(.2,.75,.25,1) both;
  transition: transform .15s ease, border-color .15s ease;
}
#right .rail::before {
  content: ""; position: absolute; top: -5px; left: 15px; width: 39px; height: 5px;
  background: radial-gradient(ellipse at 6px 5px, var(--rail-accent) 0 4px,
    transparent 4.5px) 0 0 / 20px 5px repeat-x;
}
#right .rail:hover { border-color: var(--rail-accent); transform: translateY(-2px); }
#right #rail-progress { --rail-accent: var(--block-green); }
#right #rail-results { --rail-accent: var(--block-amber); }
#right .rail:nth-child(2) { animation-delay: .07s; }
#right .rail:nth-child(3) { animation-delay: .14s; }
.rail-title {
  gap: 8px; margin-bottom: 11px; color: var(--rail-accent);
  font-size: 10px; font-weight: 800; letter-spacing: .09em;
}
.rail-title::before {
  content: ""; width: 17px; height: 11px; flex: none; border-radius: 0;
  background: radial-gradient(circle at 30% 20%, var(--block-highlight) 0 1px,
    transparent 1.5px), var(--rail-accent);
  box-shadow: 2px 2px 0 var(--block-shadow);
}
.rail-title::after {
  content: "[0" counter(rail) "]"; margin-left: auto;
  color: var(--console-dim); font-size: 9px; font-weight: 400;
}
.rail-body { color: var(--console-muted); }
.rail-body .empty {
  padding: 8px; color: var(--console-dim); background: var(--console-bg2);
  border-left: 2px solid var(--rail-accent); font-size: 11px;
}
.rail-body .empty::before { content: "> "; color: var(--rail-accent); }
.shots { gap: 13px; }
.shot img {
  border: 1px solid var(--console-strong); border-radius: 0;
  background: var(--shot-mat); box-shadow: 3px 3px 0 var(--block-shadow);
  transition: border-color .15s ease, transform .15s ease;
}
.shot img:hover { border-color: var(--rail-accent); transform: translateY(-1px); }
.shot canvas {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--console-strong); background: var(--shot-mat);
  box-shadow: 3px 3px 0 var(--block-shadow);
}
.shot .cap { color: var(--console-dim); }
.shot .cap::before { content: "// "; color: var(--rail-accent); }
.stage {
  gap: 8px; margin: 0; padding: 7px 0;
  border-bottom: 1px dashed var(--console-line);
}
.stage:last-child { border-bottom: 0; }
.stage .mark {
  display: inline-grid; place-items: center; width: 17px; height: 17px;
  color: var(--console-bg); background: var(--ok); border: 1px solid var(--ok);
  font-size: 10px;
}
.stage .mark.wait { color: var(--console-bg); background: var(--warn); border-color: var(--warn); }
.stage .txt { color: var(--console-text); }
.stage .used {
  padding: 0 4px; color: var(--console-dim); border: 0;
  font-size: 10px;
}

/* dialogs, authentication, setup and shell notices */
#aboutmodal {
  background: rgba(1, 4, 2, .82); backdrop-filter: blur(2px);
}
#aboutmodal .aboutcard {
  position: relative; width: min(640px, 92vw); max-width: 640px;
  max-height: 86vh; padding: 0; overflow-y: auto;
  color: var(--console-text); background: var(--console-bg);
  border: 1px solid var(--console-accent); border-radius: 0;
  box-shadow: 8px 8px 0 var(--console-strong);
  animation: dialogSnap .26s steps(4, end) both;
}
#aboutmodal .aboutcard::before {
  content: "C:\\JIMUSIM\\ABOUT.TXT"; display: block; padding: 8px 22px;
  color: var(--console-bg); background: var(--console-accent);
  font-size: 10px; font-weight: 800; letter-spacing: .1em;
}
#aboutmodal .abody { padding: 20px 24px 24px; }
#aboutmodal h2 { color: var(--console-accent); font-size: 19px; letter-spacing: .06em; }
#aboutmodal h2::before { content: "■ "; color: var(--block-amber); font-size: 12px; }
#aboutmodal .ahead {
  margin-top: 17px; padding-left: 9px; color: var(--console-text);
  border-left: 4px solid var(--block-amber); font-size: 12px;
}
#aboutmodal .atext, #aboutmodal .alist { color: var(--console-muted); text-align: left; }
#aboutmodal .alist::before { color: var(--console-accent); }
#aboutmodal button {
  margin-top: 12px; padding: 7px 18px; color: var(--console-bg);
  background: var(--console-accent); border: 1px solid var(--console-accent);
  border-radius: 0; box-shadow: 3px 3px 0 var(--block-shadow); font-weight: 700;
}
#weblogin, #websetup {
  position: relative; z-index: 70; width: min(440px, calc(100% - 32px));
  margin: auto; padding: 26px; color: var(--console-text);
  background: var(--console-bg); border: 1px solid var(--console-accent);
  border-radius: 0; box-shadow: 8px 8px 0 var(--block-shadow);
  animation: dialogSnap .26s steps(4, end) both;
}
#websetup {
  position: fixed; top: 76px; left: 16px; right: 16px;
  width: min(600px, calc(100% - 32px)); max-height: calc(100vh - 100px);
  margin: 0 auto; overflow-y: auto;
}
#weblogin::before, #websetup::before {
  display: block; margin: -26px -26px 22px; padding: 8px 12px;
  color: var(--console-bg); background: var(--console-accent);
  font-size: 10px; font-weight: 800; letter-spacing: .09em;
}
#weblogin::before { content: "C:\\JIMUSIM\\AUTH.CMD"; }
#websetup::before { content: "C:\\JIMUSIM\\SETUP.CMD"; }
#weblogin h2, #websetup h2 { margin: 0 0 12px; color: var(--console-accent); }
#weblogin h2::before, #websetup h2::before { content: "■ "; color: var(--block-amber); }
#weblogin p, #websetup p { color: var(--console-muted); line-height: 1.7; }
#weblogin label { gap: 6px; color: var(--console-muted); }
#weblogin input {
  padding: 9px 10px; color: var(--console-text); background: var(--console-input);
  border: 1px solid var(--console-strong); caret-color: var(--console-accent);
}
#weblogin input:focus { border-color: var(--console-accent); }
#weblogin button, #websetup button, #webqueue button, #webturn button {
  padding: 8px 12px; color: var(--console-bg); background: var(--console-accent);
  border: 1px solid var(--console-accent); border-radius: 0;
  box-shadow: 3px 3px 0 var(--block-shadow); font-weight: 700;
}
#weblogin .msg, #websetup .msg { color: var(--block-amber); }
#websetup a { color: var(--block-cyan); }
#webqueue {
  position: relative; z-index: 30; padding: 8px 14px;
  color: var(--block-amber); background: var(--console-block);
  border-bottom: 1px solid var(--block-amber);
}
#webqueue::before { content: "QUEUE> "; color: var(--console-accent); font-weight: 700; }
#webturn {
  top: 72px; right: 18px; padding: 13px 14px;
  color: var(--console-text); background: var(--console-block);
  border: 1px solid var(--console-accent); border-radius: 0;
  box-shadow: 5px 5px 0 var(--block-shadow);
  animation: toastSnap .25s steps(4, end) both;
}
.autobadge { border-radius: 0; background: var(--console-block); }
.dlprog-bar {
  width: 130px; height: 8px; border: 1px solid var(--console-line); border-radius: 0;
}
.dlprog-fill {
  background: repeating-linear-gradient(90deg, var(--console-accent) 0 10px,
    transparent 10px 13px); border-radius: 0;
}
.dlprog-txt { color: var(--console-muted); }

@keyframes brickSnap {
  0% { opacity: 0; transform: translateY(-18px) rotate(-4deg); }
  70% { opacity: 1; transform: translateY(2px) rotate(0); }
  100% { opacity: 1; transform: translateY(0) rotate(0); }
}
@keyframes railDock {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes dialogSnap {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastSnap {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Designer narrative: sans-serif prose stays readable while command labels,
   metadata and code keep the CMD voice. Square markers and flat section rules
   carry the Block vocabulary without nesting prose cards. */
:root {
  --designer-font: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", sans-serif;
  --designer-mono: var(--font);
  --designer-text: #d2ded3;
  --designer-link: var(--block-cyan);
  --designer-xs: 12px;
  --designer-sm: 12px;
  --designer-body: 12px;
  --designer-lg: 12px;
  --designer-xl: 12px;
}
html[data-theme="light"] { --designer-text: #29382d; --designer-link: #167078; }

#left details.foldline > summary {
  min-height: 32px; font-family: var(--designer-mono);
  font-size: var(--designer-sm); line-height: 20px;
}
#left summary .fturn {
  font-size: var(--designer-xs); font-variant-numeric: tabular-nums;
}
#left summary .fwho { letter-spacing: .025em; }
#left summary .fact,
html[lang="zh"] #left summary .fact { font-weight: 600; letter-spacing: .01em; }
#left details.act-ask > summary::before,
#left details.act-ask[open] > summary::before { background: var(--block-cyan); }
#left details.act-ask > .foldbody::before { color: var(--block-cyan); }
#left details.foldline > .foldbody {
  margin: 10px 0 24px 3px; padding: 8px 20px 12px 20px;
}
#left .foldline .opsline,
#left .foldline.act-read_more .opsline {
  margin: 0 0 12px; color: var(--console-dim);
  font-family: var(--designer-mono); font-size: var(--designer-xs);
  line-height: 20px; letter-spacing: .015em;
}

#left .foldbody .md,
#left .pcard .pbody .md {
  color: var(--designer-text); font-family: var(--designer-font);
  font-size: var(--designer-body); font-weight: 400;
  line-height: 1.5; letter-spacing: .012em;
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
html[lang="zh"] #left .foldbody .md,
html[lang="zh"] #left .pcard .pbody .md { line-height: 1.5; letter-spacing: .02em; }
#left .foldbody .md .md-p,
#left .pcard .pbody .md .md-p {
  margin: 0 0 16px; text-align: justify; text-justify: inter-ideograph;
  white-space: normal; word-break: normal; overflow-wrap: break-word;
  line-break: strict; font-variant-numeric: tabular-nums;
}
#left .foldbody .md > :last-child,
#left .pcard .pbody .md > :last-child { margin-bottom: 0; }
#left .foldbody .md .md-h,
#left .pcard .pbody .md .md-h {
  margin: 24px 0 12px; padding: 4px 0 4px 12px;
  color: var(--console-text); border-left: 4px solid var(--block-amber);
  font-family: var(--designer-mono); font-size: var(--designer-lg);
  font-weight: 700; line-height: 28px; letter-spacing: .025em;
  text-align: left;
}
#left .foldbody .md .md-h1,
#left .pcard .pbody .md .md-h1 { font-size: var(--designer-xl); }
#left .foldbody .md .md-h3,
#left .foldbody .md .md-h4,
#left .pcard .pbody .md .md-h3,
#left .pcard .pbody .md .md-h4 {
  font-size: var(--designer-body); line-height: 24px;
}
#left .foldbody .md .md-h::before,
#left .pcard .pbody .md .md-h::before {
  content: "■"; margin-right: 9px; color: var(--block-amber); font-size: 9px;
  vertical-align: 2px;
}

#left .foldbody .md-p.md-lead,
#left .pcard .pbody .md-p.md-lead {
  margin: 20px 0 14px; padding: 4px 0 4px 14px;
  color: var(--console-text); background: transparent;
  border-left: 2px solid var(--block-cyan); box-shadow: none;
  font-weight: 500; line-height: 1.75;
}
#left .foldbody .md-p.md-lead > strong:first-of-type,
#left .pcard .pbody .md-p.md-lead > strong:first-of-type {
  color: var(--console-text); font-weight: 700;
}
#left .foldbody .md-p.md-lead > strong:first-of-type::before,
#left .pcard .pbody .md-p.md-lead > strong:first-of-type::before {
  content: "■"; margin-right: 9px; color: var(--block-amber);
  font-size: 8px; vertical-align: 2px;
}

#left .foldbody .md-ul,
#left .pcard .pbody .md-ul {
  margin: 8px 0 18px; padding: 0; list-style: none;
  color: var(--designer-text); background: transparent;
  border-top: 0; border-bottom: 0;
}
#left .foldbody .md-ul li,
#left .pcard .pbody .md-ul li {
  position: relative; margin: 0; padding: 8px 0 8px 24px;
  color: inherit; font-size: inherit; line-height: 1.7; text-align: left;
}
#left .foldbody .md-ul li + li,
#left .pcard .pbody .md-ul li + li { border-top: 1px dashed var(--console-line); }
#left .foldbody .md-ul li::before,
#left .pcard .pbody .md-ul li::before {
  content: ""; position: absolute; left: 2px; top: 1.15em;
  width: 8px; height: 8px; transform: translateY(-50%);
  background: var(--console-block); border: 1px solid var(--block-cyan);
  box-shadow: 1px 1px 0 var(--block-shadow);
}
#left .foldbody .md-ol,
#left .pcard .pbody .md-ol { margin: 8px 0 18px 30px; padding: 0; }
#left .foldbody .md-ol li,
#left .pcard .pbody .md-ol li {
  margin: 0; padding: 7px 0 7px 6px; line-height: 1.7; text-align: left;
}
#left .foldbody .md-ol li::marker,
#left .pcard .pbody .md-ol li::marker {
  color: var(--block-cyan); font-family: var(--designer-mono);
  font-size: var(--designer-sm); font-weight: 700;
}
#left .foldbody .md strong,
#left .pcard .pbody .md strong { color: var(--console-text); font-weight: 700; }
#left .foldbody .md em,
#left .pcard .pbody .md em { text-underline-offset: 4px; }
#left .foldbody .md a,
#left .pcard .pbody .md a { color: var(--designer-link); }
#left .foldbody .md code,
#left .pcard .pbody .md code {
  padding: 2px 6px; font-family: var(--designer-mono);
  font-size: var(--designer-sm); line-height: 20px;
}
#left .foldbody .md .md-code,
#left .pcard .pbody .md .md-code {
  margin: 12px 0 18px; padding: 12px 14px;
  font-family: var(--designer-mono); font-size: var(--designer-sm);
  line-height: 1.7; tab-size: 4;
}
#left .foldbody .md-table,
#left .pcard .pbody .md-table {
  margin: 12px 0 18px; font-size: var(--designer-sm); line-height: 1.6;
}
#left .foldbody .md-table .md-th,
#left .foldbody .md-table .md-td,
#left .pcard .pbody .md-table .md-th,
#left .pcard .pbody .md-table .md-td { padding: 8px 10px; }
#left .foldbody .md-table .md-th,
#left .pcard .pbody .md-table .md-th {
  font-family: var(--designer-mono); font-size: var(--designer-xs);
  letter-spacing: .025em;
}

#left .pcard .phead { font-family: var(--designer-mono); font-size: var(--designer-xs); line-height: 16px; }
#left .pcard .phead .pface {
  padding: 5px 10px; font-size: var(--designer-xs); line-height: 16px;
  letter-spacing: .06em;
}
#left .pcard .phead .ptime { font-size: var(--designer-xs); line-height: 16px; }
#left .pcard .pbody {
  color: var(--designer-text); font-family: var(--designer-font);
  font-size: var(--designer-body); line-height: 1.75;
}
#left .pcard .pbody > pre {
  font-family: var(--designer-mono); font-size: var(--designer-sm); line-height: 1.7;
}
#left .pcard .phints,
#left .pcard .gatewait {
  margin-top: 8px; padding: 10px 14px 10px 20px;
  font-family: var(--designer-font); font-size: var(--designer-sm);
  line-height: 1.65; letter-spacing: .01em;
}
#left .pcard .phints { color: var(--advisory); }
#left .pcard .gatewait { color: var(--console-muted); }
#left .autobadge { font-family: var(--designer-mono); font-size: var(--designer-xs); line-height: 20px; }

/* Decision controls use one indexed action stack. Option labels stay
   left-aligned for fast scanning; long answers wrap without shrinking controls. */
#left .pcard .gatebtns {
  counter-reset: gate-option; display: grid; grid-template-columns: 1fr;
  gap: 9px; margin: 16px 15px 0 0; padding: 16px 0 0 20px;
  border-top: 1px dashed var(--console-line);
}
#left .gatebtns .gbtn {
  counter-increment: gate-option; display: flex; align-items: flex-start;
  width: 100%; min-height: 44px; padding: 11px 14px;
  color: var(--console-text); background: transparent;
  border: 1px solid var(--console-line);
  border-left: 3px solid var(--console-strong); border-radius: 0;
  box-shadow: 2px 2px 0 var(--block-shadow);
  font-family: var(--designer-font); font-size: var(--designer-sm);
  font-weight: 400; line-height: 1.6; text-align: left; white-space: normal;
  transition: transform .18s ease, box-shadow .18s ease,
    color .18s ease, border-color .18s ease, background-color .18s ease;
}
#left .gatebtns .gbtn::before {
  content: "0" counter(gate-option); flex: none; width: 26px; margin-right: 10px;
  color: var(--console-dim); font-family: var(--designer-mono);
  font-size: var(--designer-xs); font-weight: 600; line-height: 22px;
  font-variant-numeric: tabular-nums;
}
#left .gatebtns .gbtn::after {
  content: "↵"; flex: none; margin-left: auto; padding-left: 14px;
  color: var(--console-dim); font-family: var(--designer-mono);
  font-size: 16px; line-height: 22px;
}
#left .gatebtns .gbtn.primary {
  color: var(--console-accent); background: var(--acc-soft);
  border-color: var(--console-accent); box-shadow: 2px 2px 0 var(--block-shadow);
  font-weight: 700;
}
#left .gatebtns .gbtn.primary::before,
#left .gatebtns .gbtn.primary::after { color: var(--console-accent); }
#left .gatebtns .gbtn:hover:not(:disabled) {
  color: var(--console-accent); background: var(--console-bg2);
  border-color: var(--console-accent); transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--block-shadow);
}
#left .gatebtns .gbtn:hover:not(:disabled)::after { color: var(--console-accent); }
#left .gatebtns .gbtn:active:not(:disabled) {
  transform: translate(1px, 1px); box-shadow: none;
}
#left .gatebtns .gbtn:focus-visible {
  outline: 2px solid var(--block-amber); outline-offset: 3px;
}
#left .gatebtns .gbtn:disabled { opacity: .5; cursor: wait; box-shadow: none; }

#left .pcard .gateanswer {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch; gap: 10px; margin: 14px 15px 0 0; padding: 0 0 0 20px;
}
#left .pcard .gateanswer textarea {
  min-width: 0; min-height: 64px; max-height: 180px; padding: 12px 14px;
  color: var(--console-text); background: var(--console-input);
  border: 1px solid var(--console-strong);
  border-left: 3px solid var(--block-amber); border-radius: 0;
  font-family: var(--designer-font); font-size: var(--designer-sm);
  line-height: 1.7; resize: vertical; caret-color: var(--console-accent);
}
#left .pcard .gateanswer textarea::placeholder { color: var(--console-dim); opacity: 1; }
#left .pcard .gateanswer textarea:focus {
  border-color: var(--console-accent); outline: none;
}
#left .pcard .gateanswer textarea:focus-visible {
  outline: 2px solid var(--block-amber); outline-offset: 3px;
}
#left .pcard .gateanswer .gatesend {
  align-self: stretch; min-width: 96px; min-height: 44px; margin: 0;
  font-family: var(--designer-mono); font-size: var(--designer-sm); line-height: 20px;
}
#left .pcard .gateanswer .gatesend::before { content: ">"; margin-right: 7px; }
#left .pcard .gatecd-txt { font-family: var(--designer-mono); font-size: var(--designer-xs); line-height: 16px; }

@media (max-width: 700px) {
  #left details.foldline > .foldbody { padding: 8px 8px 12px 20px; }
  #left .foldbody .md .md-h,
  #left .pcard .pbody .md .md-h { margin-top: 20px; padding-left: 10px; }
  #left .foldbody .md-p.md-lead,
  #left .pcard .pbody .md-p.md-lead { padding-left: 10px; }
  #left .pcard .gatebtns, #left .pcard .gateanswer { margin-right: 4px; }
  #left .pcard .gateanswer { grid-template-columns: 1fr; }
  #left .pcard .gateanswer .gatesend { min-height: 44px; }
}
@media (max-width: 480px) {
  #left details.foldline > summary { font-size: 13px; }
  #left .foldbody .md-ul li,
  #left .pcard .pbody .md-ul li { padding-left: 20px; }
  #left .gatebtns .gbtn { padding: 10px; }
  #left .gatebtns .gbtn::before { width: 22px; margin-right: 6px; }
  #left .gatebtns .gbtn::after { padding-left: 8px; }
}

@media (max-width: 1180px) {
  #right { width: 320px; }
  #console-head { padding-right: 150px; }
  .console-subline span:last-child { display: none; }
}
@media (max-width: 940px) {
  #left { min-width: 0; }
  #console-head { padding-right: 160px; }
}
@media (max-width: 700px) {
  #top { flex-wrap: wrap; gap: 7px; padding: 8px 10px; }
  #brand { font-size: 13px; }
  #brand::after, #runmeta { display: none; }
  .hbtns { margin-left: auto; }
  #runsel { max-width: 42vw; }
  #left { padding: 0 10px 11px; }
  #console-head { padding-right: 105px; }
  .console-subline span:nth-child(2) { display: none; }
  #console-head .brick-chain { transform: scale(.78); transform-origin: right bottom; }
  #composer .crow::before { display: none; }
  .composer-caption span:last-child { display: none; }
  #left .pcard { padding-right: 4px; }
  #left .pcard .pbody { padding-right: 10px; }
}
@media (max-width: 480px) {
  #top #brand::before { width: 25px; height: 20px; }
  #runsel { order: 2; flex: 1 0 100%; max-width: none; min-height: 22px; }
  .hbtns { gap: 4px; }
  .hbtns button, #langsel { padding: 3px 6px; font-size: 9px; }
  #console-head { min-height: 58px; padding-right: 4px; }
  #console-head .brick-chain { display: none; }
  .console-command { font-size: 10px; }
  #stream { padding-top: 12px; }
  #left .pcard .phead .ptime { display: none; }
  #composer .crow { gap: 6px; padding: 7px; }
  .mode-stack { min-width: 72px; }
  .modebtn { width: 72px; }
  #composer #send { min-width: 76px; }
  #left .pcard .gatebtns { padding-left: 8px; }
  #weblogin, #websetup { padding: 20px; }
  #weblogin::before, #websetup::before { margin: -20px -20px 18px; }
}

/* Designer command stream: open chapters, semantic rule colors and one
   reading rhythm. No stream entry owns a plate, shadow or side connector. */
:root {
  --designer-measure: 1080px;
  --designer-list: 12px;
  --stream-gutter: clamp(16px, 2vw, 32px);
  --gate-question: var(--block-cyan);
  --gate-confirm: var(--block-green);
  --gate-gap: var(--block-amber);
}
html[data-theme="light"] {
  color-scheme: light;
  --gate-question: #167078;
  --gate-confirm: #347a3c;
  --gate-gap: #986000;
}
#stream {
  padding-right: var(--stream-gutter);
  padding-left: var(--stream-gutter);
}
#stream > details.foldline,
#stream > .pcard,
#stream > .endbar,
#stream > .errline,
#stream > .fbbar,
#stream > .render-fallback {
  width: 86%; max-width: var(--designer-measure);
  margin-left: 4%; margin-right: 10%;
}

/* Designer: command head, quiet prose, compact parameter rows. */
#left details.foldline {
  margin: 0 0 20px; padding: 8px 0 0 2px;
  border-top: 1px solid var(--console-strong);
}
#left details.foldline > summary {
  display: flex; align-items: baseline; min-height: 48px;
  font-size: var(--designer-sm);
}
#left summary .fwho { color: var(--console-text); font-weight: 700; }
#left summary .fact {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
#left summary .ftime {
  flex: none; margin-left: auto; padding-left: 16px;
  color: var(--console-dim); font-size: 12px;
  font-variant-numeric: tabular-nums;
}
#left details.foldline > summary::before,
#left details.foldline[open] > summary::before {
  content: ">"; display: inline-block; width: auto; height: auto;
  margin: 0 9px 0 0; vertical-align: 0; color: var(--console-dim);
  background: transparent; box-shadow: none;
  font-family: var(--designer-mono); font-size: 12px; font-weight: 400;
  line-height: 16px;
}
#left details.foldline > .foldbody { margin: 0; padding: 0 0 12px 18px; }
#left details.foldline > .foldbody::before { display: none; }
#left .foldbody .md .md-p,
#left .pcard .pbody .md .md-p {
  margin: 0 0 10px; text-align: justify; text-justify: inter-ideograph;
  line-break: strict; overflow-wrap: break-word;
}
#left .foldbody .md strong,
#left .pcard .pbody .md strong { font-weight: 600; }
#left .foldbody .md .md-h,
#left .pcard .pbody .md .md-h {
  margin: 18px 0 10px; padding: 2px 0 2px 12px;
  border-left: 2px solid var(--block-amber);
}
#left .foldbody .md-p.md-lead,
#left .pcard .pbody .md-p.md-lead {
  margin: 14px 0 10px; padding: 3px 0 3px 12px;
  border-left: 2px solid var(--block-cyan);
  font-weight: 500; line-height: 1.5;
}
#left .foldbody .md-p.md-lead > strong:first-of-type::before,
#left .pcard .pbody .md-p.md-lead > strong:first-of-type::before {
  margin-right: 8px; font-size: 7px;
}
#left .foldbody .md-ul,
#left .pcard .pbody .md-ul { margin: 6px 0 12px; }
#left .foldbody .md-ul li,
#left .pcard .pbody .md-ul li {
  padding: 5px 0 5px 23px; font-size: var(--designer-list); line-height: 1.5;
  text-align: justify; text-justify: inter-ideograph;
}
#left .foldbody .md-ul li + li,
#left .pcard .pbody .md-ul li + li { border-top: 1px dashed var(--console-line); }
#left .foldbody .md-ol li,
#left .pcard .pbody .md-ol li { text-align: justify; text-justify: inter-ideograph; }
#left .foldbody .md-ul li::before,
#left .pcard .pbody .md-ul li::before {
  width: 7px; height: 7px; box-shadow: none;
}
#left .foldbody .md-ol,
#left .pcard .pbody .md-ol { margin: 6px 0 12px 29px; }

/* Panels are log sections, not cards. Cyan asks, green confirms, amber
   flags a trade-off; body copy keeps the same neutral color throughout. */
#left .pcard {
  --face: var(--console-accent);
  position: relative; margin: 0 0 20px; padding: 20px 0 0 18px;
  border: 0; border-top: 1px solid var(--console-strong);
}
#left .pcard:last-child { border-bottom: 0; }
#left .pcard::after { display: none; }
#left .pcard.face-question { --face: var(--gate-question); }
#left .pcard.face-confirm { --face: var(--gate-confirm); }
#left .pcard.face-gap { --face: var(--gate-gap); }
#left .pcard.face-summary { --face: var(--gate-question); }
#left .pcard.face-warning { --face: var(--advisory); }
#left .pcard.face-error { --face: var(--err); }
#left .pcard .phead {
  display: block; position: absolute; top: 23px; right: 0;
  min-height: 0; padding: 0;
}
#left .pcard .phead .pface { display: none; }
#left .pcard .phead .ptime {
  display: block; margin: 0; color: var(--console-dim);
  text-align: right; font-variant-numeric: tabular-nums;
  line-height: 18px;
}
#left .pcard .pbody .md > :first-child {
  margin-top: 0; padding-top: 3px; padding-right: 88px;
  max-width: calc(100% - 88px); overflow-wrap: anywhere;
}
#left .pcard .ptool {
  color: var(--face); font-family: var(--designer-mono);
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
  white-space: nowrap;
}
#left .pcard .pbody {
  margin: 0; padding: 0; color: var(--designer-text);
  background: transparent; border: 0; box-shadow: none;
}
#left .pcard .pbody .md-p { margin-bottom: 10px; }
#left .pcard .pbody .md-p.md-lead {
  margin-top: 0; border-left-color: var(--face);
}
#left .pcard .pbody .md-p.md-lead > strong:first-of-type::before {
  content: none; color: var(--face);
}
#left .pcard .pbody .md-ul { margin-top: 6px; margin-bottom: 0; }
#left .pcard .pbody .md-ul li { padding-top: 5px; padding-bottom: 5px; }
#left .pcard .pbody .md-ul li::before { border-color: var(--face); }

/* One 12px scale covers transcript, decision faces, rail and live lanes. */
#left summary .fturn,
#left .pcard .phead .ptime,
#left .gatebtns .gbtn::before,
#left .gatebtns .gbtn::after,
#brand, #runsel, #runmeta, .badge, .hbtns button, .settings button, #langsel,
.rail-title, .rail-body, .rail-body .empty, .stage .txt, .stage .used,
.shot .cap, .console-command, .console-subline, .composer-caption,
#composer .cstack button, #composer #cin, #statusline, #deltabox { font-size: 12px; }

#left .pcard .phints,
#left .pcard .gatewait {
  margin: 12px 0 0; padding: 0 0 0 12px; background: transparent;
  border: 0; border-left: 1px solid var(--face); box-shadow: none;
}
#left .autobadge {
  margin: 12px 0 0; padding: 0; color: var(--console-dim);
  background: transparent; border: 0; box-shadow: none;
}

/* Decision options are indexed command rows. The open rule and semantic
   color identify the recommended action without creating nested cards. */
#left .pcard .gatebtns {
  gap: 0; margin: 12px 0 0; padding: 3px 0 0; border-top: 0;
}
#left .gatebtns .gbtn {
  min-height: 44px; padding: 9px 10px 9px 0; color: var(--console-muted);
  background: transparent; border: 0;
  border-bottom: 1px dashed var(--console-line); box-shadow: none;
  font-weight: 400;
}
#left .gatebtns .gbtn::before {
  content: "[0" counter(gate-option) "]";
  width: 36px; margin-right: 5px; font-weight: 400;
}
#left .gatebtns .gbtn::after { font-size: 12px; }
#left .gatebtns .gbtn.primary {
  color: var(--face); background: transparent; border: 0;
  border-bottom: 1px dashed var(--console-strong);
  box-shadow: none; font-weight: 600;
}
#left .gatebtns .gbtn.primary::before,
#left .gatebtns .gbtn.primary::after { color: var(--face); }
#left .gatebtns .gbtn:hover:not(:disabled) {
  color: var(--face); background: transparent;
  border-bottom-color: var(--face); box-shadow: none;
  transform: translateX(3px);
}
#left .gatebtns .gbtn:active:not(:disabled) {
  box-shadow: none; transform: translateX(1px);
}
#left .pcard .gateanswer {
  grid-template-columns: minmax(0, 1fr) auto; gap: 12px;
  margin: 12px 0 0; padding: 0;
}
#left .pcard .gateanswer textarea {
  min-height: 64px; padding: 10px 12px; background: transparent;
  border: 0; border-left: 1px solid var(--face);
  border-bottom: 1px solid var(--console-line); box-shadow: none;
}
#left .pcard .gateanswer .gatesend {
  align-self: end; min-width: 72px; min-height: 44px; padding: 8px 0;
  color: var(--face); background: transparent; border: 0;
  border-bottom: 1px solid var(--face); box-shadow: none; font-weight: 600;
}
#left .pcard .gateanswer .gatesend:hover:not(:disabled) {
  color: var(--face); background: transparent;
  border-bottom-color: var(--face); box-shadow: none;
  transform: translateY(-1px);
}
#left .pcard .gatecd { margin: 12px 0 0; }
#left .pcard .gatecd-track { height: 4px; border: 0; }

/* Terminal, error and feedback entries follow the same open-log anatomy. */
#left .endbar {
  margin-top: 0; margin-bottom: 0; padding: 18px 0 18px 18px;
  color: var(--console-muted); background: transparent !important;
  border: 0 !important; border-top: 1px solid var(--console-line) !important;
  box-shadow: none; font-size: var(--designer-sm); font-weight: 500;
}
#left .endbar.ok::before,
#left .endbar.bad::before { width: 6px; height: 6px; margin-right: 12px; }
#left .errline {
  margin-top: 0; margin-bottom: 0; padding: 0 0 18px 18px;
  color: var(--err); background: transparent; border: 0; box-shadow: none;
  font-size: var(--designer-sm); line-height: 1.7;
}
#left .fbbar {
  margin-top: 0; margin-bottom: 0; padding: 20px 0 22px 18px;
  color: var(--console-muted); background: transparent;
  border: 0; border-top: 1px solid var(--console-line); box-shadow: none;
}
#left .fbbar .fbin {
  padding: 7px 4px; color: var(--console-text); background: transparent;
  border: 0; border-bottom: 1px solid var(--console-line); border-radius: 0;
  box-shadow: none;
}
#left .fbbar .gbtn,
#left .fbbar .gbtn.primary {
  padding: 7px 4px; color: var(--console-muted); background: transparent;
  border: 0; border-bottom: 1px solid var(--console-line);
  box-shadow: none; font-weight: 500;
}
#left .fbbar .gbtn::before,
#left .fbbar .gbtn.primary::before { content: ">"; margin-right: 6px; font-size: inherit; }
#left .fbbar .gbtn.primary { color: var(--console-accent); }
#left .fbbar .gbtn:hover,
#left .fbbar .gbtn.primary:hover {
  color: var(--console-accent); background: transparent;
  border-bottom-color: var(--console-accent); box-shadow: none;
  transform: translateY(-1px);
}
#left .render-fallback {
  padding: 12px 0 12px 18px; color: var(--warn); background: transparent;
  border: 0; border-left: 1px solid var(--warn); box-shadow: none;
}

@media (max-width: 700px) {
  :root { --stream-gutter: 18px; }
  #stream > details.foldline,
  #stream > .pcard,
  #stream > .endbar,
  #stream > .errline,
  #stream > .fbbar,
  #stream > .render-fallback { width: 100%; }
  #left .pcard { padding-right: 0; }
  #left .pcard .gateanswer { grid-template-columns: 1fr; }
  #left .pcard .gateanswer .gatesend { justify-self: end; }
}
@media (max-width: 480px) {
  :root { --stream-gutter: 12px; }
  #left .pcard { padding-left: 12px; }
  #left .pcard .gatebtns { padding-left: 0; }
  #left .pcard .phead .pface::after { letter-spacing: .04em; }
}

/* Information flow: one composer slot, with scrollable thoughts while the
   model is active, a tool task while work runs, and the input caption at rest. */
.composer-lane { grid-template-areas: "lane"; align-items: start; }
.composer-lane > * { grid-area: lane; }
.composer-lane:has(#operationbox.on) .composer-caption { visibility: hidden; }
#deltabox, #operationbox {
  min-width: 0; max-width: 100%; margin: 4px 2px; padding: 6px 9px;
  color: var(--console-muted); background: var(--console-block);
  border: 1px dashed var(--console-line); font-size: 12px;
}
#deltabox.on, #operationbox.on { display: flex; align-items: baseline; }
#operationbox { display: none; align-items: baseline; }
#operationbox .dlabel { flex: none; margin-right: 6px; color: var(--block-cyan); }
#operationbox .dlabel svg {
  width: 12px; height: 12px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
#deltabox.think { animation: none; }
#deltabox .dlane { position: relative; flex: 1; min-width: 0; overflow: hidden; }
#deltabox .dlane > span {
  white-space: nowrap;
  transition: transform .35s cubic-bezier(.4,0,.2,1),
              opacity .35s cubic-bezier(.4,0,.2,1);
}
#deltabox .dcur { display: inline-block; }
#deltabox .dout { position: absolute; left: 0; top: 0; }
#deltabox .dlane > span.djump { transition: none; }
#deltabox .dlane[data-ovf="1"] {
  -webkit-mask-image: linear-gradient(to right, transparent 0,
    black 16px, black calc(100% - 16px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0,
    black 16px, black calc(100% - 16px), transparent 100%);
}
@media (prefers-reduced-motion: reduce) {
  #deltabox .dlane > span { transition: none; }
}

/* Decision tools and the final summary use the whole reading measure. */
#left .pcard.face-confirm .phead,
#left .pcard.face-gap .phead,
#left .pcard.face-question .phead,
#left .pcard.face-summary .phead { display: none; }
#left .pcard.face-confirm .pbody .md > :first-child,
#left .pcard.face-gap .pbody .md > :first-child,
#left .pcard.face-question .pbody .md > :first-child,
#left .pcard.face-summary .pbody .md > :first-child {
  padding-right: 0; max-width: none;
}

@font-face {
  font-family: "JimuPixel";
  src: url("/ui/JimuPixel-Regular.ttf") format("truetype");
  font-style: normal; font-weight: 400; font-display: swap;
}

/* Turn number, Builder and action share pixel type; only Builder is bold. */
#left summary .fturn,
#left summary .fwho,
#left summary .fact {
  color: var(--console-text); background: transparent; border: 0; box-shadow: none;
  font-family: "JimuPixel", var(--designer-mono); font-size: 12px !important;
  line-height: 16px; letter-spacing: .04em !important; text-transform: uppercase;
  -webkit-font-smoothing: none; font-smooth: never;
  white-space: nowrap;
}
#left summary .fturn { font-weight: 400; }
#left summary .fwho { font-weight: 700; }
#left summary .fact {
  flex: 0 1 auto; display: inline-block; max-width: 100%; padding: 0;
  font-weight: 400 !important;
}

/* Decorative console captions stay below the functional 12px text scale. */
.console-subline, .composer-caption {
  font-size: 8px; letter-spacing: .08em; opacity: .78;
}
.composer-caption { margin: 11px 2px 2px; }

/* Terminal text shares panel copy's indent; feedback stays at the stream edge. */
#left .endbar { margin-left: 4%; margin-right: 10%; }
#left .fbbar { margin-left: 0; margin-right: 0; }
#left .endbar { padding-left: 18px; }
#stream > .fbbar { width: 100%; max-width: none; }
#left .fbbar { padding-left: 0; font-family: var(--designer-font); }
#left .endbar.ok::before, #left .endbar.bad::before { display: none; }
#left .fbbar .fbq {
  color: var(--console-text); font-size: 15px; font-weight: 650;
  line-height: 1.5; letter-spacing: .01em;
}
#left .fbbar .fbin,
#left .fbbar .gbtn,
#left .fbbar .gbtn.primary {
  font-family: var(--designer-font); font-size: 15px; line-height: 1.5;
}
#left .fbbar .gbtn::before { content: none; }
#left .fbbar .gbtn.primary { padding-right: calc(4px + 1em); }
#left .fbbar .gbtn:last-child { margin-right: 0; }

/* Transcript color semantics: neutral prose, cyan information, green success,
   amber attention, red warnings/errors, and dim secondary metadata. */
:root {
  --text-info: var(--gate-question);
  --text-success: var(--gate-confirm);
  --text-caution: var(--gate-gap);
  --text-warning: var(--advisory);
  --text-error: var(--err);
}
#left .pcard { --face: var(--text-info); }
#left .pcard.face-question,
#left .pcard.face-summary { --face: var(--text-info); }
#left .pcard.face-confirm { --face: var(--text-success); }
#left .pcard.face-gap { --face: var(--text-caution); }
#left .pcard.face-warning { --face: var(--text-warning); }
#left .pcard.face-error { --face: var(--text-error); }
#stream > details.foldline,
#stream > .pcard,
#stream > .endbar,
#stream > .errline,
#stream > .render-fallback {
  margin-left: 4%; margin-right: 10%;
}
#stream > .session-command {
  width: 86%; max-width: var(--designer-measure); margin: 0 10% 20px 4%;
  padding: 12px 0;
  color: var(--console-accent); font: 700 13.5px/1.6 var(--font);
  letter-spacing: .03em; overflow-wrap: anywhere;
}
#stream > .session-command .session-input { color: var(--console-text); }
@media (max-width: 700px) {
  #stream > .session-command { width: 100%; }
}
#left .pcard .phints { color: var(--text-warning); }
#left .endbar.ok { color: var(--text-success); }
#left .endbar.bad, #left .errline { color: var(--text-error); }
#left .fbbar .gbtn.primary { color: var(--text-success); }
#left .fbbar .gbtn:hover {
  color: var(--console-text); border-bottom-color: var(--console-text);
}
#left .fbbar .gbtn.primary:hover {
  color: var(--text-success); border-bottom-color: var(--text-success);
}
#left .render-fallback {
  color: var(--text-warning); border-left-color: var(--text-warning);
}

.console-command::after {
  content: "■"; display: inline-block; margin-left: 8px;
  color: var(--console-text); font-size: 10px;
  animation: consoleCursorBlink 1.1s steps(1, end) infinite;
}
@keyframes consoleCursorBlink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .console-command::after { animation: none; }
}

#brand { text-shadow: none; }
#top #brand::before, #brand::after { content: none; }
#brand .brand-mark {
  width: 30px; height: 25px; flex: none; color: var(--console-accent);
  filter: drop-shadow(2px 2px 0 var(--block-shadow));
  animation: brickSnap .48s cubic-bezier(.2,.8,.2,1) both;
}
#brand .brand-cn {
  flex: none; color: var(--console-text);
  font-family: "SimHei", "Noto Sans CJK SC", sans-serif;
  font-size: 18px; font-weight: 400; letter-spacing: .06em; line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}
#brand .brand-en {
  position: relative; top: 1px; align-self: center;
  padding-left: 10px; border-left: 1px solid var(--console-strong);
  color: var(--console-text); font-family: "JimuPixel", var(--font);
  font-size: 15px; font-weight: 400; letter-spacing: .12em; line-height: 1;
}
.site-legal {
  position: relative; z-index: 80; flex: none; display: flex;
  align-items: center; justify-content: center; min-height: 30px;
  padding: 5px 16px; color: var(--console-dim);
  background: var(--console-chrome); border-top: 1px solid var(--console-line);
  font: 10px/1.5 var(--font); letter-spacing: .04em; text-align: center;
}
.site-legal a { color: inherit; text-decoration: none; opacity: .45; }
.site-legal a:hover, .site-legal a:focus-visible {
  color: var(--console-accent); opacity: 1;
}
@media (max-width: 700px) {
  #brand .brand-cn { font-size: 16px; }
  #brand .brand-en { padding-left: 7px; font-size: 12px; }
  .site-legal { padding: 5px 10px; font-size: 9px; }
}

@media (min-width: 701px) {
  #top { padding-left: 24px; }
}
#console-head {
  min-height: 88px; margin-top: 8px; padding-top: 20px; padding-bottom: 17px;
}
.console-line { min-height: 22px; }
.console-command { line-height: 1.6; letter-spacing: .035em; }
.console-subline {
  gap: 8px 22px; margin-top: 9px; font-size: 9px;
  line-height: 1.7; letter-spacing: .1em;
}
#console-head .brick-chain { bottom: 19px; }
@media (max-width: 700px) {
  #top { padding-left: 14px; }
  #console-head {
    min-height: 82px; margin-top: 6px; padding-top: 16px; padding-bottom: 14px;
  }
  .console-subline { gap: 7px 14px; }
}
