/* © 2026 William C. Chesher. All Rights Reserved.
   studio.css - the workbench surface. Reads only the tokens; reuses the landing's block / code /
   mirror / pill components (bench.css) and adds the studio layout, the step list, the emergency
   stop, and the player-two panel. */

/* ---- THE LOOP (design/ux-model.md): the four steps in order, and stop beside them, always in reach ---- */
.loop-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px 22px; flex-wrap: wrap; margin: 0 0 22px; }
/* the loop is the work moving through its steps: blue, so it reads apart from the orange places and device above */
.loop { --blue-ink: #04121f; display: flex; gap: 4px; padding: 4px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.loop-step { font-family: var(--mono); font-size: 13px; letter-spacing: .03em; color: var(--ink-dim); background: transparent; border: 0; border-radius: 10px;
  padding: 8px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: color var(--fast) var(--ease), background var(--fast) var(--ease); }
.loop-step:hover { color: var(--ink); background: rgba(255, 255, 255, .04); }
.loop-step .n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 11px; border: 1px solid var(--line); color: var(--ink-faint); }
.loop-step[aria-selected="true"] { color: var(--blue-ink); font-weight: 600; background: var(--blue); box-shadow: 0 0 22px -8px var(--blue); }
.loop-step[aria-selected="true"] .n { border-color: color-mix(in srgb, var(--blue-ink) 35%, transparent); color: var(--blue-ink); }
.loop-step:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.loop-count { font-size: 11px; color: var(--mint); }
.loop-count:empty { display: none; }
.loop-step[aria-selected="true"] .loop-count { color: var(--blue-ink); }
.loop-panel { display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 560px) {
  .loop { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .loop-step { justify-content: center; padding: 8px 4px; font-size: 12px; gap: 5px; white-space: nowrap; }
  .loop-step .n { display: none; }
}

/* ---- the workbench: the blocks and the code side by side, the same height, one split between them ----
   The studio takes the width of the screen (the other pages keep --maxw): the blocks need room for their palette AND
   the program, and the code needs room to be read. The split is a column the student can drag (studio.js split);
   --split is the blocks' share. Under 880px the two stack, blocks first. */
.studio-wrap { max-width: 1680px; }
.studio { --split: 52%; display: flex; flex-direction: column; gap: 16px; padding-bottom: 40px; }
.device-row { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.device-row .field { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0; }
.device-row .flabel { margin: 0; }
.device-row .mirror { margin: 0; padding: 6px 14px; gap: 12px; min-height: 40px; }
.device-row .mirror .note { font-size: 12.5px; color: var(--ink-faint); }
.device-row .mirror .px { width: 16px; height: 16px; }
.device-row .mirror .screen { font-size: 13px; padding: 4px 10px; }

/* THE DEVICE PICKER: automate's grouped context picker (ContextPicker.svelte) in bench's skin. A button that names the
   device; under it a filterable list in two groups, each with its hue dot and a live count; the active row carries the
   orange edge. */
.ctx { position: relative; display: inline-block; }
.ctx-btn { display: inline-flex; align-items: baseline; gap: 10px; min-width: 200px; max-width: 300px; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); cursor: pointer; font: 600 12.5px var(--mono); text-transform: lowercase; transition: border-color var(--fast, .15s) var(--ease); }
.ctx-btn:hover, .ctx-btn[aria-expanded="true"] { border-color: var(--orange); }
.ctx-btn-label { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-btn-sub { flex: 0 0 auto; font-weight: 400; font-size: 11px; color: var(--ink-faint); }
.ctx-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 80; width: 320px; max-width: calc(100vw - 32px); border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); box-shadow: 0 14px 36px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 138, 30, .08); overflow: hidden; }
.ctx-filter { padding: 10px; border-bottom: 1px solid var(--line); }
.ctx-filter-input { width: 100%; padding: 7px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--void); color: var(--ink); font: 12px var(--mono); }
.ctx-filter-input:focus { outline: none; border-color: var(--orange); }
.ctx-scroll { max-height: 340px; overflow-y: auto; padding: 4px 0 6px; }
.ctx-empty { margin: 0; padding: 16px; text-align: center; font: 11px var(--mono); color: var(--ink-faint); }
.ctx-group-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px 5px; }
.ctx-group-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.ctx-group-title { flex: 1; font: 600 10px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-dim); }
.ctx-group-count { font: 10px var(--mono); color: var(--ink-faint); }
.ctx-row { display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 8px 12px; background: transparent; border: 0; border-left: 2px solid transparent; cursor: pointer; text-align: left; color: var(--ink); }
.ctx-row:hover { background: rgba(255, 138, 30, .06); }
.ctx-row.on { background: rgba(255, 138, 30, .12); border-left-color: var(--orange); }
.ctx-row-label { flex: 1; font: 12.5px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-row-sub { flex: 0 0 auto; font: 10.5px var(--mono); color: var(--ink-faint); }
.ctx-btn:focus-visible, .ctx-row:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
/* a phone: the list hangs from the whole device row's field, not the button, so it never runs off the right edge */
@media (max-width: 560px) { .ctx-btn { min-width: 0; max-width: 100%; } .device-row .field { position: relative; flex: 1 1 100%; } .ctx { position: static; } .ctx-pop { width: 100%; max-width: 100%; } }

.split { display: grid; grid-template-columns: minmax(0, var(--split)) 14px minmax(0, 1fr);
  height: clamp(520px, calc(100vh - 210px), 980px); }
.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.pane > .program:not([hidden]), .pane > .code { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.split-handle { position: relative; cursor: col-resize; touch-action: none; border-radius: 6px; }
.split-handle::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; border-radius: 2px;
  background: var(--line); transition: background var(--fast) var(--ease); }
.split-handle::after { content: ""; position: absolute; top: 50%; left: 50%; width: 6px; height: 44px; margin: -22px 0 0 -3px; border-radius: 3px;
  background: var(--ink-faint); opacity: .6; transition: background var(--fast) var(--ease), opacity var(--fast) var(--ease); }
.split-handle:hover::before, .split-handle:focus-visible::before, .split.dragging .split-handle::before { background: var(--orange); }
.split-handle:hover::after, .split-handle:focus-visible::after, .split.dragging .split-handle::after { background: var(--orange); opacity: 1; }
.split-handle:focus-visible { outline: none; }
.split.dragging { cursor: col-resize; user-select: none; }
.split.dragging .blocks-host { pointer-events: none; }
@media (max-width: 880px) {
  .split { display: flex; flex-direction: column; gap: 16px; height: auto; }
  .split-handle { display: none; }
  .pane.build-col { height: 480px; }
  .pane.code-col { min-height: 360px; }
}

/* under the workbench: the open loop step under the blocks, player two under the code, on the same split */
.below { display: grid; grid-template-columns: minmax(0, var(--split)) 14px minmax(0, 1fr); align-items: start; }
.below > .p2 { grid-column: 3; }
.below-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 880px) { .below { grid-template-columns: 1fr; gap: 16px; } .below > .p2 { grid-column: 1; } }

/* ---- the program: the block editor (Blockly, blocks.js) in bench's skin ----
   The landing's block look, carried onto Blockly: each block a clear tint of its colour under a bright
   edge, its words lit, amber for a `when`, orange for a `do`. The colour rides in as --neon (blocks.js,
   the glow), as spawn's code room and automate do it, since CSS cannot read a block's own colour. */
.program { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--panel); }
.blocks-host { position: relative; flex: 1 1 auto; min-height: 0; }
.blocks-note { margin: 0; padding: 9px 14px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 12.5px; letter-spacing: .02em; color: var(--caution); background: var(--panel-2); }
.blocks-note:empty { display: none; }

.blocks-host .blocklyMainBackground { stroke: none !important; }
.blocks-host .blocklyPath { fill: color-mix(in srgb, var(--neon, var(--orange)) 16%, var(--panel)) !important; fill-opacity: 1 !important; stroke: var(--neon, var(--orange)) !important; stroke-width: 2px !important; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--neon, var(--orange)) 45%, transparent)); }
.blocks-host .blocklyPathLight, .blocks-host .blocklyPathDark { display: none !important; }
.blocks-host .blocklyDraggable:hover > .blocklyPath { fill: color-mix(in srgb, var(--neon, var(--orange)) 24%, var(--panel)) !important; }
.blocks-host .blocklySelected > .blocklyPath { stroke-width: 2.8px !important; filter: drop-shadow(0 0 10px var(--neon, var(--orange))); }
.blocks-host .blocklyText { fill: color-mix(in srgb, var(--neon, var(--ink)) 55%, white) !important; font-family: var(--disp) !important; font-weight: 600 !important; font-size: 13px !important; }
.blocks-host .blocklyEditableField > rect:not(.bench-swatch), .blocks-host .blocklyEditableText > rect { fill: rgba(255, 255, 255, .08) !important; stroke: var(--line) !important; fill-opacity: 1 !important; }
.blocks-host .blocklyEditableField > .blocklyText, .blocks-host .blocklyEditableText > .blocklyText { fill: var(--ink) !important; font-family: var(--mono) !important; font-weight: 500 !important; }
.blocks-host .blocklyEditableField:hover > rect:not(.bench-swatch) { fill: rgba(255, 255, 255, .14) !important; }
/* greyed (left out of the code): it has to READ as off -- no glow, a dashed grey edge, grey words, see-through. The words
   sit inside field groups, so the text rule is a descendant one. */
.blocks-host .blocklyDisabledPattern > .blocklyPath, .blocks-host .blocklyDisabled > .blocklyPath { fill: var(--panel-2) !important; stroke: var(--ink-faint) !important; stroke-dasharray: 5 4; filter: none !important; }
.blocks-host .blocklyDisabled .blocklyText, .blocks-host .blocklyDisabledPattern .blocklyText { fill: var(--ink-faint) !important; }
.blocks-host .blocklyDisabled { opacity: .6; }
.blocks-host .blocklyFlyoutBackground { fill: var(--void) !important; fill-opacity: 1 !important; }
.blocks-host .blocklyFlyoutLabelText { fill: var(--ink-faint) !important; font-family: var(--mono) !important; font-size: 11px !important; letter-spacing: .14em; text-transform: uppercase; }
.blocks-host .bench-label-when .blocklyFlyoutLabelText { fill: var(--amber) !important; }
.blocks-host .bench-label-do .blocklyFlyoutLabelText { fill: var(--orange) !important; }
.blocks-host .blocklyScrollbarHandle { fill: var(--ink-faint) !important; fill-opacity: .5; }
.blocks-host .blocklyInsertionMarker > .blocklyPath { fill: var(--orange-lt) !important; fill-opacity: .25 !important; stroke: none !important; filter: none; }
.blocklyHtmlInput { font-family: var(--mono) !important; font-size: 13px !important; background: var(--panel-2) !important; color: var(--ink) !important; caret-color: var(--orange); border-radius: 6px; }
.blocklyTooltipDiv { background: var(--panel-2) !important; color: var(--ink-2) !important; border: 1px solid var(--line) !important; border-radius: 8px; padding: 7px 10px !important; font-family: var(--disp) !important; font-size: 12.5px !important; box-shadow: 0 8px 24px rgba(0, 0, 0, .4) !important; }
.blocklyDropDownDiv { border-radius: 12px !important; border-color: color-mix(in srgb, var(--orange) 55%, transparent) !important; }
.blocklyDropDownArrow { border-color: color-mix(in srgb, var(--orange) 55%, transparent) !important; }

/* compact (phone): the palette folds into two tabs, when and do (blocks.js toolbox) */
.blocks-host .blocklyToolboxDiv { background: var(--void) !important; padding: 8px 0 !important; border-right: 1px solid var(--line); }
.blocks-host .bench-cat { margin: 3px 6px; padding: 8px 12px !important; border-radius: 8px; cursor: pointer; height: auto !important; }
.blocks-host .bench-cat .blocklyTreeIcon { display: none; }
.blocks-host .bench-cat .blocklyToolboxCategoryLabel, .blocks-host .bench-cat .blocklyTreeLabel { font: 600 12px var(--mono) !important; letter-spacing: .12em; text-transform: uppercase; }
.blocks-host .bench-cat-when .blocklyToolboxCategoryLabel, .blocks-host .bench-cat-when .blocklyTreeLabel { color: var(--amber) !important; }
.blocks-host .bench-cat-do .blocklyToolboxCategoryLabel, .blocks-host .bench-cat-do .blocklyTreeLabel { color: var(--orange) !important; }
.blocks-host .bench-cat.blocklyToolboxSelected { background: rgba(255, 255, 255, .06) !important; }
.blocklyWidgetDiv .blocklyMenu, .blocklyDropDownDiv .blocklyMenu { background: var(--panel-2) !important; color: var(--ink) !important; font-family: var(--disp) !important; }
.blocklyMenuItem { color: var(--ink-2) !important; }
.blocklyMenuItemHighlight { background: color-mix(in srgb, var(--orange) 18%, transparent) !important; }
.blocklyMenuItemDisabled { color: var(--ink-faint) !important; }

/* the colour picker a colour swatch opens (blocks.js FieldBenchColour) */
.bench-colour { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.bench-colour-row { display: grid; grid-template-columns: repeat(4, 28px); gap: 8px; }
.bench-colour-chip { width: 28px; height: 28px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .25); cursor: pointer; padding: 0; }
.bench-colour-chip:hover, .bench-colour-chip:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.bench-colour-chip.on { outline: 2px solid var(--orange); outline-offset: 2px; }
.bench-colour-any { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--ink-dim); cursor: pointer; }
.bench-colour-any input { width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: transparent; cursor: pointer; }

/* ---- emergency stop: first-class, armed by default. One quiet button the height of the steps; the red is the mark
   and the word, not a glowing card. Halted, it turns mint and says arm. The note line shows only when there is news. ---- */
.estop { display: flex; align-items: center; gap: 12px; min-width: 0; }
.estop-btn { display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto; height: 44px; padding: 0 18px 0 14px; border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--line)); background: var(--panel); color: var(--bad); cursor: pointer;
  font-family: var(--mono); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: lowercase;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), transform .1s var(--ease); }
.estop-mark { width: 12px; height: 12px; border-radius: 3px; background: var(--bad); }
.estop-btn:hover { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--panel)); }
.estop-btn:active { transform: scale(.97); }
.estop-btn:focus-visible { outline: 2px solid var(--bad); outline-offset: 2px; }
.estop[data-armed="0"] .estop-btn { color: var(--mint); border-color: color-mix(in srgb, var(--mint) 40%, var(--line)); }
.estop[data-armed="0"] .estop-btn:hover { border-color: var(--mint); background: color-mix(in srgb, var(--mint) 10%, var(--panel)); }
.estop[data-armed="0"] .estop-btn:focus-visible { outline-color: var(--mint); }
.estop[data-armed="0"] .estop-mark { width: 10px; height: 10px; border-radius: 50%; background: transparent; border: 2px solid var(--mint); }
.estop-sub { font-size: 12.5px; color: var(--ink-dim); max-width: 34ch; line-height: 1.35; }
/* in the top bar (studio.js moves it there): the bar's height, between the places and who you are; the news line
   drops under the button as a small card so the bar never grows */
.bar .estop { position: relative; }
.bar .estop-btn { height: 36px; padding: 0 14px 0 12px; border-radius: 12px; gap: 8px; font-size: 12.5px; }
.bar .estop-mark { width: 10px; height: 10px; border-radius: 2px; }
.bar .estop[data-armed="0"] .estop-mark { width: 8px; height: 8px; border-radius: 50%; }
.bar .estop[data-note="1"] .estop-sub { position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; width: max-content; max-width: min(34ch, 80vw);
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .6); }
@media (max-width: 560px) {
  /* the places and stop share one row: stop at its right end, where the thumb finds it */
  .studio-wrap .bar-nav { width: auto; flex: 1 1 60%; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 2px; }
  .studio-wrap .bar-nav a { font-size: 12px; padding-left: 6px; padding-right: 6px; }
  .bar .estop { order: 4; }
  .bar .estop-btn { height: 34px; padding: 0 12px 0 10px; }
}
.estop[data-note="0"] .estop-sub { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- the code (reuse bench.css .code): as tall as the blocks, big enough to read from the back of the room ----
   The code scrolls inside its pane; a line the last block change wrote lights up for a moment (studio.js renderCode). */
.code-col .code { font-size: 14.5px; }
.code-col .code pre { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 16px 0; }
.code-col .code .c { line-height: 1.75; }
.code-col .code .g { min-width: 3ch; }
.code .ln.fresh { animation: fresh 1.6s var(--ease); }
@keyframes fresh { from { background: color-mix(in srgb, var(--orange) 26%, transparent); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .code .ln.fresh { animation: none; } }
.code-col .taken { flex: 1 1 auto; min-height: 0; }
.code-col .taken textarea { flex: 1 1 auto; min-height: 200px; font-size: 14.5px; resize: none; }
.code-col .take-ask { flex: none; }

/* ---- player two ---- */
.p2 { border-radius: 14px; padding: 18px; border: 1px solid color-mix(in srgb, var(--blue) 36%, transparent); background: radial-gradient(closest-side circle at 100% 0%, rgba(46, 155, 255, .12), transparent), var(--panel); }
.p2-head { display: inline-flex; align-items: center; gap: 9px; font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--blue-lt); margin-bottom: 10px; }
.p2-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 10px var(--blue); animation: pulse 1.8s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .p2-dot { animation: none; } }
.p2-body p { margin: 0 0 10px; color: var(--ink-2); font-size: 14.5px; line-height: 1.6; }
.p2-body .why { color: var(--ink-dim); font-size: 13.5px; }
.p2-body b { color: var(--ink); font-weight: 600; }
.p2-body code { font-family: var(--mono); font-size: 12.5px; color: var(--orange-lt); background: rgba(255, 138, 30, .1); padding: 1px 5px; border-radius: 5px; }
.p2-note { margin: 4px 0 0; font-size: 12px; color: var(--ink-faint); line-height: 1.5; }

/* ---- halted: the program and code read as stopped ---- */
.studio.halted .program, .studio.halted .code, .studio.halted .mirror { opacity: .5; transition: opacity var(--fast) var(--ease); }
.studio.halted .code { filter: grayscale(.4); }

/* ---- asking player two (Claude): the conversation, the sign-in, the ask box ---- */
.p2-who { margin-left: auto; text-transform: none; letter-spacing: 0; color: var(--ink-dim); font-size: 12px; }
.p2-head { display: flex; }
.p2-thread { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 12px; max-height: 420px; overflow-y: auto; }
.p2-thread:empty { display: none; }
.p2-turn { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.p2-turn.you { align-self: flex-end; max-width: 88%; color: var(--ink); background: color-mix(in srgb, var(--orange) 12%, transparent); border: 1px solid color-mix(in srgb, var(--orange) 30%, transparent); }
.p2-turn.p2 { color: var(--ink-2); background: var(--panel-2); border: 1px solid color-mix(in srgb, var(--blue) 30%, transparent); }
.p2-turn.p2.wait { color: var(--ink-faint); font-style: italic; }
.p2-turn pre { margin: 8px 0 0; padding: 10px; border-radius: 8px; background: rgba(0, 0, 0, .3); font-family: var(--mono); font-size: 12.5px; color: var(--ink); white-space: pre; overflow-x: auto; }
.p2-turn .p2-label { display: block; margin-top: 8px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--blue-lt); }
.p2-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.p2-signin input, .p2-ask textarea { flex: 1 1 120px; min-width: 0; font: inherit; font-size: 14px; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; }
.p2-ask textarea { display: block; width: 100%; box-sizing: border-box; margin-bottom: 8px; resize: vertical; }
.p2-signin input:focus-visible, .p2-ask textarea:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.btn.p2-quiet { color: var(--ink-dim); background: transparent; border-color: var(--line); font-weight: 500; }
.btn.p2-quiet:hover { color: var(--ink); }
.btn[disabled] { opacity: .5; cursor: progress; }
.p2-err { margin: 6px 0 0; font-size: 13px; color: var(--bad); }
.p2-err:empty { display: none; }

/* ---- player two's answer: the concept it names, its words, and the changes to keep or drop ---- */
.p2-turn.p2 { white-space: normal; }
.p2-said { margin: 0 0 8px; white-space: pre-wrap; }
.p2-said:last-child { margin-bottom: 0; }
.p2-concept { margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--blue) 10%, transparent); border: 1px solid color-mix(in srgb, var(--blue) 30%, transparent); color: var(--ink-2); }
.p2-concept .p2-label { display: inline; margin: 0 8px 0 0; }
.p2-concept b { color: var(--ink); font-weight: 600; }
.hunks { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.change-lead { margin: 0; font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; color: var(--blue-lt); }
.hunk { border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .22); overflow: hidden; transition: opacity var(--fast) var(--ease); }
.hunk.dropped { opacity: .55; }
.hunk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em; color: var(--ink-dim); border-bottom: 1px solid var(--line); }
.hunk .keep { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); cursor: pointer; }
.hunk .keep input { width: 16px; height: 16px; accent-color: var(--orange); }
.hunk .keep-said { color: var(--ink-faint); }
.hunk-lines { padding: 6px 10px; font-size: 13.5px; line-height: 1.7; }
.hunk-lines .add { color: var(--ink); }
.hunk-lines .del { color: var(--ink-faint); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 60%, transparent); }
.hunk-lines .mark { font-family: var(--mono); color: var(--ink-faint); user-select: none; }
.hunk-lines .add .mark { color: var(--mint); }
.hunk-lines code { font-family: var(--mono); font-size: 12px; color: var(--orange-lt); }
.hunk-lines .sw { display: inline-block; width: 11px; height: 11px; margin: 0 4px 0 2px; border-radius: 3px; vertical-align: -1px; border: 1px solid rgba(255, 255, 255, .25); }
.hunk-label { margin: 4px 0 0; font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
.p2-turn pre.hunk-code { margin: 0; }
.hunk-code .add { display: inline-block; width: 100%; background: color-mix(in srgb, var(--mint) 14%, transparent); }
.gate-note { margin: 0; font-size: 13px; color: var(--caution); }
.change-result { margin: 0; font-size: 13px; color: var(--ink-dim); }
.change-actions { margin-top: 2px; }
.btn.small { padding: 4px 10px; font-size: 12px; }

/* shipping to a device (studio.js ship*) */
.ship-panel { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--orange) 35%, var(--line)); background: var(--panel); }
.ship-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ship-state { font-size: 12.5px; color: var(--ink-dim); }
.ship-form { display: flex; flex-direction: column; gap: 8px; }
.ship-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--ink-dim); }
.ship-row > span:first-child { flex: 0 0 72px; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.ship-row input, .ship-row select { flex: 1 1 140px; min-width: 0; font: inherit; font-size: 14px; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 10px; }
.ship-row input[type="number"] { flex: 0 1 90px; }
.ship-row input:focus-visible, .ship-row select:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
.ship-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ship-list { display: flex; flex-direction: column; gap: 6px; }
.ship-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--panel-2); font-size: 13px; }
.ship-item .ship-label { flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; color: var(--ink); }
.ship-item .chip { font-family: var(--mono); font-size: 10.5px; text-transform: lowercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-dim); }
.ship-item .chip.on { color: var(--mint); border-color: color-mix(in srgb, var(--mint) 50%, var(--line)); }
.ship-item .btn { padding: 4px 10px; font-size: 12.5px; }

/* ---- take the code (rung 3): the code the blocks wrote, now the student's own to edit ---- */
.code .bar { flex-wrap: wrap; }
.code .bar .code-btn { padding: 4px 10px; font-size: 12px; text-transform: none; letter-spacing: .02em; }
.take-ask, .taken { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); }
.taken textarea { width: 100%; min-height: 280px; resize: vertical; box-sizing: border-box; padding: 12px 14px; font-family: var(--mono); font-size: 13px; line-height: 1.55; tab-size: 4; color: var(--ink); background: #070a12; border: 1px solid var(--line); border-radius: var(--radius-sm); outline: none; white-space: pre; overflow: auto; }
.taken textarea:focus { border-color: color-mix(in srgb, var(--orange) 60%, var(--line)); }
.taken-row { flex-wrap: wrap; }
.taken-row input { flex: 1 1 120px; min-width: 0; font-family: var(--mono); font-size: 13px; padding: 6px 10px; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.code-say-bad { color: var(--bad); }
.code-list { display: flex; flex-direction: column; gap: 6px; padding: 0 14px 12px; }
.code-list:empty { display: none; }
.code-list .ship-item { font-family: inherit; }

/* ---- the simulator (bench-sim.js): footprints, breakpoints, a device face ---- */
.sim { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); }
.sim-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sim-head .flabel { margin: 0; }
.sim-state { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); }
.sim-controls .btn { padding: 6px 12px; font-size: 13px; }
.sim-speed select { font-family: var(--mono); font-size: 12px; padding: 6px 8px; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); max-width: 100%; }
.sim-inputs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sim-inputs .btn { padding: 6px 12px; font-size: 13px; touch-action: none; user-select: none; }
.sim-inputs .btn.held { border-color: var(--orange); color: var(--orange); }
.sim-row { display: flex; align-items: center; gap: 8px; flex: 1 1 220px; min-width: 0; font-size: 13px; color: var(--ink-dim); }
.sim-row input[type="range"] { flex: 1 1 auto; min-width: 0; accent-color: var(--orange); }
.sim-row output { font-family: var(--mono); color: var(--ink); min-width: 2.5ch; text-align: right; }
.sim-face { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 44px; padding: 10px 12px; border-radius: var(--radius-sm); background: #070a12; border: 1px solid var(--line); font-family: var(--mono); font-size: 12.5px; color: var(--ink-dim); }
.sim-face .px { width: 22px; height: 22px; border-radius: 50%; background: #1a1f2b; }
.sim-face .dot { width: 14px; height: 14px; border-radius: 3px; background: #1a1f2b; }
.sim-face .big { width: 40px; height: 40px; border-radius: 50%; background: #1a1f2b; }
.sim-face .ink { padding: 6px 12px; border-radius: 4px; background: #e8e6df; color: #1b1b1b; min-width: 8ch; }
.sim-face .tune { color: var(--blue-lt); }
.sim-trace { margin: 0; padding: 0 0 0 4px; list-style: none; max-height: 168px; overflow-y: auto; font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--ink-dim); }
.sim-trace li { display: grid; grid-template-columns: 5ch 1fr; gap: 6px; }
.sim-trace li .at { color: var(--ink-faint); }
.sim-trace li:last-child { color: var(--ink); }
.code .ln.here { background: color-mix(in srgb, var(--orange) 16%, transparent); box-shadow: inset 3px 0 0 var(--orange); }
.code .g { cursor: pointer; }
.code .ln.bp .g { color: var(--bad); font-weight: 700; }
.code .ln.bp .g::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--bad); vertical-align: middle; }

/* ---- sharing with a classmate ---- */
.share-open { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px 12px; border-top: 1px solid var(--line); }
.share-open input { flex: 1 1 140px; min-width: 0; font-family: var(--mono); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; padding: 6px 10px; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.share-open .btn { padding: 6px 12px; font-size: 13px; }
.share-open .p2-note { flex: 1 1 100%; margin: 0; }
.share-open .p2-note:empty { display: none; }
.share-code { font-family: var(--mono); letter-spacing: .12em; color: var(--orange); }

/* ---- your code, drawn as blocks (code-blocks.js): the same glow as the when/do blocks, read off --neon ----
   Paused (the text holds something the blocks cannot draw exactly), the drawing dims so the text reads as the truth. */
.code-program .blocklyText { font-family: var(--mono) !important; font-weight: 500 !important; }
.code-program.stale .blocks-host { opacity: .45; filter: grayscale(.5); pointer-events: none; transition: opacity var(--fast) var(--ease); }
.code-program.stale .blocks-note { color: var(--caution); }
.back-ask { border-top: 0; padding: 0 0 4px; }
.back-ask .p2-note { color: var(--caution); }

/* saved code and share codes, under the workbench (their home is /programs) */
.code-open { border-radius: 14px; border: 1px solid var(--line); background: var(--panel); }
.code-open .code-list { padding: 12px 14px 0; }
.code-open .share-open { border-top: 0; padding: 12px 14px; }
.code-open .code-list:not(:empty) + .share-open { border-top: 1px solid var(--line); margin-top: 12px; }

/* ---- the console: the simulator's footprints as a terminal prints them, coloured by ANSI code (studio.js ansiFor).
   33 amber = a reading, 32 green = a step that does something, 34 blue = an if that runs its steps, 90 grey = the rest. ---- */
.sim-console { border-radius: var(--radius-sm); background: #05070d; border: 1px solid var(--line); padding: 8px 10px 10px; }
.sim-console-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.sim-console-bar .btn { margin-left: auto; padding: 3px 10px; font-size: 12px; }
.sim-console-bar .btn[aria-pressed="true"] { border-color: var(--orange); color: var(--orange); }
.sim-console .sim-trace li { color: var(--ink-dim); }
.sim-console .sim-trace li:last-child { font-weight: 600; }
.sim-trace li.a33 { color: var(--amber); }
.sim-trace li.a32 { color: var(--mint); }
.sim-trace li.a34 { color: var(--blue-lt); }
.sim-trace li.a90 { color: var(--ink-faint); }
.sim-trace li.a90:last-child { color: var(--ink-dim); }
.sim-trace .esc { color: var(--orange-lt); }
.sim-console .p2-note { margin: 8px 0 0; }
.sim-console code { font-family: var(--mono); color: var(--orange-lt); }

/* ---- teenyink's page on the board's grid (studio.js inkPage): the paper, its right edge, and the letters past it ---- */
.ink-page { display: inline-flex; flex-direction: column; gap: 4px; min-width: 0; max-width: 100%; }
.ink-page svg { display: block; width: 100%; max-width: 280px; height: auto; overflow: visible; }
.device-row .mirror .ink-page svg { max-width: 180px; }
.ink-page .paper { fill: var(--paper); }
.ink-page .edge { stroke: var(--bad); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: 0; }
.ink-page text { fill: var(--paper-ink); font-family: var(--mono); font-weight: 600; white-space: pre; }
.ink-page .lost { fill: var(--bad); opacity: .55; text-decoration: line-through; }
.ink-page svg:has(.lost) .edge { opacity: .8; }
.ink-say { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }
.ink-say.over { color: var(--bad); }

/* ---- the code box's screens: bench, green phosphor, amber phosphor (studio.js setScreen). Only the code box. ---- */
.code .screens { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; border: 1px solid var(--line); }
.code .screens button { font-family: var(--mono); font-size: 11px; letter-spacing: .02em; text-transform: none; color: var(--ink-faint);
  background: transparent; border: 0; border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.code .screens button[aria-pressed="true"] { color: var(--ink); background: var(--panel-2); }
.code .screens button:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
.code[data-screen="green"] { --phos: var(--phosphor-green); background: var(--phosphor-green-ground); }
.code[data-screen="amber"] { --phos: var(--phosphor-amber); background: var(--phosphor-amber-ground); }
.code[data-screen="green"] pre, .code[data-screen="amber"] pre,
.code[data-screen="green"] textarea, .code[data-screen="amber"] textarea { color: var(--phos); text-shadow: 0 0 6px color-mix(in srgb, var(--phos) 55%, transparent); }
.code[data-screen="green"] textarea, .code[data-screen="amber"] textarea { background: transparent; caret-color: var(--phos); }
.code[data-screen="green"] pre *, .code[data-screen="amber"] pre * { color: inherit; }
.code[data-screen="green"] .g, .code[data-screen="amber"] .g { opacity: .5; }
.code[data-screen="green"] .screens button[aria-pressed="true"] { color: var(--phosphor-green); }
.code[data-screen="amber"] .screens button[aria-pressed="true"] { color: var(--phosphor-amber); }
