/* Computology, Flaptown Design v5 (2026-11-08). Loads after /v5/flaptown-v5.css (tokens, materials, keys, lamps, cells).
   Each experiment is a machined panel; controls are keys, fields and sliders in pockets; canvases and the node graph are
   windows behind glass (the glass never takes the pointer); numbers sit on character cells. One light, top left.
   app.js builds: #path > p.chapter + button[data-module][aria-current] > span; .metric > span + strong.cells;
   .parameter-grid label > input|select (+ span.slide-row > input.slide + input); .wire-row; article.save-card; table. */

[hidden] { display: none !important; }
.comp { padding-top: 30px; }
.comp h2 { font-size: 24px; line-height: 32px; margin: 0 0 5px; }
.comp h3 { font-size: 18px; line-height: 26px; margin: 0 0 15px; }
.comp h4 { margin: 25px 0 10px; font-size: 12px; line-height: 16px; letter-spacing: .08em; text-transform: uppercase; color: var(--rose); }
.comp label { display: grid; gap: 5px; font-size: 12px; line-height: 16px; letter-spacing: .08em; text-transform: uppercase; color: var(--dusty); }
.comp input, .comp select, .comp textarea, #discard-dialog input { width: 100%; min-width: 0; text-transform: none; letter-spacing: 0; font-size: 13px; line-height: 20px; }
.comp select { cursor: pointer; }
.comp textarea { font-size: 12px; line-height: 18px; }
.hint { margin: 10px 0 0; font-size: 11px; line-height: 16px; letter-spacing: .04em; color: var(--dusty); }

/* ---------- keys ---------- */
.comp button, .comp .file-button, #discard-dialog button {
  --c: var(--rose); --f: #b7958c26; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 0 18px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 12px; line-height: 16px; letter-spacing: .08em;
  text-transform: uppercase; text-decoration: none; white-space: nowrap; color: var(--oak); text-shadow: var(--carve);
  background: var(--f); border: 1.5px solid color-mix(in srgb, var(--c) 70%, transparent);
  box-shadow: 0 3px 0 #000, 0 6px 14px #00000099, inset 0 1px 0 #c9bab00f;
  transition: background-color .14s ease, border-color .14s ease, transform .08s ease, box-shadow .08s ease, opacity .2s; }
.comp button:hover, .comp .file-button:hover, #discard-dialog button:hover { border-color: var(--c); background: color-mix(in srgb, var(--f) 100%, #c9bab0 6%); }
.comp button:active, .comp .file-button:active, #discard-dialog button:active { transform: translateY(2px); box-shadow: 0 1px 0 #000, inset 0 1px 0 #c9bab00a; }
.comp button:disabled, #discard-dialog button:disabled { opacity: .38; cursor: progress; transform: none; }
.comp .secondary, #discard-dialog .secondary { --c: var(--dim); --f: #3e415833; }
.comp .quiet, .comp .file-button, #discard-dialog .quiet { --c: var(--indigo); --f: #3e415866; }
.button-group { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 15px; }
.file-button input { position: absolute; opacity: 0; width: 1px; height: 1px; padding: 0; min-height: 0; }
.file-button:focus-within { outline: 2px solid var(--oak); outline-offset: 2px; }

/* ---------- head: the startup board ---------- */
.cp-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 20px 40px; margin: 0 0 40px; padding: 30px; border-radius: 12px;
  background: radial-gradient(120% 80% at 50% 0%, #121414 0%, #0a0b0b 60%, #060707 100%);
  box-shadow: inset 0 10px 24px -8px #000000f2, inset 0 2px 0 #000, inset 0 -1px 0 var(--mocha); }
.cp-id { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; }
.cp-mark { padding: 6px; border-radius: 14px; }
.cp-mark .window { display: grid; place-items: center; width: 92px; height: 92px; }
.cp-mark .cells { font-size: 32px; line-height: 40px; color: var(--rose); }
.cp-head .status { display: flex; align-items: center; gap: 10px; margin: 0 0 5px; color: var(--done); }
.cp-head h1 { margin: 0 0 5px; }
.cp-head h1 em { color: var(--rose); }
.cp-head .lede { color: var(--rose); max-width: 560px; }
.cp-note { display: grid; gap: 15px; justify-items: start; max-width: 260px; font-size: 13px; line-height: 20px; color: var(--rose); }
.cp-note p { margin: 0; }
.cp-note .cells { color: var(--oak); }

/* ---------- headings inside panels ---------- */
.module-heading { display: flex; justify-content: space-between; align-items: start; gap: 15px; }
.module-heading p { margin: 0 0 5px; }
#subtitle { color: var(--rose); font-size: 13px; line-height: 20px; }
.badge { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 28px; padding: 0 10px; border-radius: 6px; font-size: 11px; line-height: 16px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--rose); background: var(--pocket); box-shadow: inset 0 2px 4px -1px #000000e6, inset 0 -1px 0 var(--mocha); }
.question { margin: 15px 0 20px; font-size: 18px; line-height: 26px; color: var(--oak); max-width: var(--measure); }

/* ---------- windows behind glass: graph and canvases ---------- */
.screen { padding: 6px; }
.screen > .window { background: var(--onyx); }
.screen canvas { display: block; width: 100%; height: auto; touch-action: pan-y; }
#visual { cursor: crosshair; }
.graph-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: var(--mocha) transparent; }
.graph-scroll:focus-visible { outline: 2px solid var(--oak); outline-offset: -4px; }
#node-graph { display: block; width: 100%; max-height: 620px; }
.graph-node, circle[role=button] { cursor: pointer; }
.graph-node:focus, circle[role=button]:focus { outline: 0; }
.graph-node:focus-visible rect, circle[role=button]:focus-visible { stroke: var(--oak); stroke-width: 2.5; }
.graph-node:hover rect { fill: #1f2222; }

/* ---------- the workbench: a machined panel ---------- */
.workbench { margin: 0 0 40px; }
.graph-intro { max-width: var(--measure); margin: 10px 0 0; font-size: 13px; line-height: 20px; color: var(--rose); }
.workbench .screen { margin-top: 20px; }
.inline-fields { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.inline-fields label { flex: 1 1 180px; max-width: 280px; min-width: 120px; }
#graph-status, #status { display: flex; align-items: center; gap: 10px; margin: 15px 0 0; min-height: 24px; font-size: 13px; line-height: 20px; color: var(--rose); }
#graph-status::before, #status:not(:empty)::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 999px;
  background: radial-gradient(circle at 35% 35%, #e3e6f6 0%, #9ea3c8 55%, #3e4158 100%); box-shadow: 0 0 0 1.5px #050606, 0 0 6px 1px #9ea3c899; }
#graph-status.error, #status.error { color: var(--oak); }
#graph-status.error::before, #status.error::before { background: radial-gradient(circle at 35% 35%, #f6c9b8 0%, #e07a62 55%, #a46f67 100%); box-shadow: 0 0 0 1.5px #050606, 0 0 6px 1px #e07a6299; }
#wire-list:not(:empty) { margin-top: 15px; padding: 6px; border-radius: 8px; background: var(--pocket); box-shadow: inset 0 3px 8px -3px #000000e6, inset 0 1px 0 #000, inset 0 -1px 0 var(--mocha); }
.wire-row { display: flex; gap: 15px; justify-content: space-between; align-items: center; padding: 6px 6px 6px 12px; font-size: 13px; line-height: 20px; border-radius: 3px;
  background: var(--plate); box-shadow: 0 1px 0 #000, 0 2px 4px #000000b3, inset 0 1px 0 #c9bab012; }
.wire-row + .wire-row { margin-top: 6px; }

/* ---------- lab: the path (a list pocket of tiles) and the experiment panel ---------- */
.lab-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 30px; align-items: start; }
.path-panel { position: sticky; top: 16px; padding: 20px; }
.path-panel > .lbl { margin: 0 0 12px; }
.path-pocket { border-radius: 8px; }
.path-pocket > .sc { max-height: calc(100vh - 260px); min-height: 200px; gap: 6px; }
#path .chapter { margin: 8px 4px 0; font-size: 11px; line-height: 16px; letter-spacing: .08em; text-transform: uppercase; color: var(--dusty); }
#path .chapter:first-child { margin-top: 2px; }
.comp #path button { --f: var(--plate); justify-content: flex-start; flex: none; width: 100%; min-height: 44px; padding: 8px 12px; gap: 10px; border: 0; border-radius: 3px;
  white-space: normal; text-align: left; text-transform: none; letter-spacing: 0; font-size: 13px; line-height: 20px; color: var(--rose);
  background: var(--plate); box-shadow: 0 1px 0 #000, 0 2px 4px #000000b3, inset 0 1px 0 #c9bab012; }
.comp #path button:hover { background: var(--plate-hi); color: var(--oak); }
.comp #path button:active { transform: translateY(1px); box-shadow: 0 0 0 #000, inset 0 1px 0 #c9bab00a; }
#path button span { flex: none; font-size: 11px; letter-spacing: 0; color: var(--dusty); }
.comp #path button[aria-current=true] { color: var(--oak); background: var(--plate-hi); box-shadow: 0 1px 0 #000, 0 2px 4px #000000b3, inset 0 1px 0 #c9bab01f, inset 2px 0 0 var(--clay); }
.comp #path button[aria-current=true]::after { content: ""; margin-left: auto; flex: none; width: 7px; height: 7px; border-radius: 999px;
  background: radial-gradient(circle at 35% 35%, #f6c9b8 0%, #e07a62 55%, #a46f67 100%); box-shadow: 0 0 0 1.5px #050606, 0 0 6px 1px #e07a6299; animation: led-on .28s var(--ease); }
.path-note { margin: 15px 0; font-size: 11px; line-height: 16px; letter-spacing: .04em; color: var(--dusty); }
.path-panel > button { width: 100%; }

#experiment { min-width: 0; }
#experiment:focus { outline: 0; }
#experiment:focus-visible { outline: 2px solid var(--oak); outline-offset: 2px; }

/* the instrument: keys on the plate, the display in a pocket, readouts on cells */
.instrument { display: grid; gap: 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; }
.toolbar .button-group { margin: 0; }
.speed { display: flex !important; grid-template-columns: none; align-items: center; gap: 10px; }
.speed select { width: 76px; }
#run-state { display: inline-flex; align-items: center; gap: 10px; font-size: 11px; line-height: 16px; letter-spacing: .08em; text-transform: uppercase; color: var(--dusty); }
#run-state::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: #0a0b0b; box-shadow: 0 0 0 1.5px #050606, 0 1px 0 2px #c9bab012, inset 0 1px 2px #000; }
#run-state.on { color: var(--working); }
#run-state.on::before { background: radial-gradient(circle at 35% 35%, #f6e3c4 0%, #d4b07a 55%, #937f6d 100%); box-shadow: 0 0 0 1.5px #050606, 0 0 6px 1px #d4b07a99; animation: breathe 1.2s ease-in-out infinite; }
.readout { padding: 6px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.metrics:empty { min-height: 60px; }
.metric { min-width: 0; padding: 10px 16px; border-left: 1px solid var(--mocha); }
.metric:first-child { border-left: 0; }
.metric span { display: block; font-size: 11px; line-height: 16px; letter-spacing: .08em; color: var(--dusty); overflow-wrap: anywhere; }
.metric strong { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: clip; font-size: 18px; line-height: 26px; color: var(--oak); }
.inspect { display: block; margin: 0; padding: 0 4px; font-size: 11px; line-height: 16px; letter-spacing: .04em; color: var(--dusty); }
output.inspect:empty { display: none; }
#history-panel { display: grid; gap: 8px; }

/* drawers: a row that opens with no script */
.comp details { margin-top: 20px; border-top: 1px solid var(--mocha); box-shadow: inset 0 1px 0 #000; }
.comp summary { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 0 0; cursor: pointer; list-style: none; font-size: 12px; line-height: 16px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--rose); }
.comp summary::-webkit-details-marker { display: none; }
.comp summary::before { content: "+"; display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 6px; font-size: 13px; color: var(--oak);
  background: var(--pocket); box-shadow: inset 0 2px 4px -1px #000000e6, inset 0 -1px 0 var(--mocha); }
.comp details[open] > summary::before { content: "−"; }
.comp summary:hover { color: var(--oak); }
.comp details > :not(summary) { margin-top: 12px; }
.comp details p { font-size: 13px; line-height: 20px; color: var(--rose); max-width: var(--measure); }
.table-scroll { overflow: auto; max-height: 340px; border-radius: 8px; padding: 6px; background: var(--pocket); box-shadow: inset 0 3px 8px -3px #000000e6, inset 0 1px 0 #000, inset 0 -1px 0 var(--mocha); }
.table-scroll table { font-size: 13px; }
.table-scroll td { font-variant-numeric: tabular-nums; letter-spacing: 0; }
.table-scroll caption { text-align: left; padding: 6px 10px; font-size: 11px; line-height: 16px; color: var(--dusty); }
#connections { font-size: 13px; line-height: 20px; color: var(--rose); }

/* conditions and exposition */
.work-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 30px; margin-top: 30px; }
.controls { padding: 20px; border-radius: 12px; background: var(--pocket);
  box-shadow: inset 0 4px 10px -3px #000000e6, inset 0 2px 0 #000, inset 4px 0 8px -5px #000000b3, inset -4px 0 8px -5px #000000b3, inset 0 -1px 0 var(--mocha); }
.parameter-grid { display: grid; grid-template-columns: 1fr; gap: 15px; margin: 15px 0 0; }
.slide-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 12px; align-items: center; }
/* the slider: a groove cut in the floor, a key for a thumb */
.comp input.slide { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 0; padding: 0; background: transparent; border: 0; box-shadow: none; cursor: pointer; }
.comp input.slide::-webkit-slider-runnable-track { height: 8px; border-radius: 6px; background: #050606; box-shadow: inset 0 2px 3px #000, 0 1px 0 #c9bab00f, inset 0 -1px 0 var(--mocha); }
.comp input.slide::-moz-range-track { height: 8px; border-radius: 6px; background: #050606; box-shadow: inset 0 2px 3px #000, 0 1px 0 #c9bab00f; }
.comp input.slide::-moz-range-progress { height: 8px; border-radius: 6px; background: var(--rose2); }
.comp input.slide::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 26px; margin-top: -9px; border-radius: 4px; background: #1f2222;
  border: 1.5px solid #b7958cb3; box-shadow: 0 3px 0 #000, 0 4px 8px #000000b3, inset 0 1px 0 #c9bab026; }
.comp input.slide::-moz-range-thumb { width: 16px; height: 26px; border-radius: 4px; background: #1f2222; border: 1.5px solid #b7958cb3; box-shadow: 0 3px 0 #000, inset 0 1px 0 #c9bab026; }
.comp input.slide:active::-webkit-slider-thumb { transform: translateY(1px); box-shadow: 0 1px 0 #000; }
.controls > label { margin-top: 5px; }
.exposition p, .exposition li { font-size: 13px; line-height: 20px; color: var(--rose); }
.exposition ul { padding-left: 20px; margin: 0; }
.exposition li { margin: 8px 0; }
.exposition li::marker { color: var(--clay); }
/* the equation glows on a display, one glyph per cell */
#equation { margin: 15px 0 0; padding: 15px 18px; white-space: pre-wrap; overflow-wrap: anywhere; letter-spacing: 0; font-size: 13px; line-height: 22px; color: var(--oak);
  background: var(--onyx) linear-gradient(180deg, #c9bab012 0%, #c9bab005 40%, transparent 41%); border: 1px solid var(--mocha); border-radius: 8px;
  box-shadow: inset 0 1px 0 #c9bab01f, inset 0 -2px 6px #00000099, 0 0 0 6px var(--pocket); text-shadow: 0 0 1px currentColor, 0 0 6px #c9bab060; }
#equation:empty { display: none; }

/* save: a raised plate with fields milled in */
.save-panel { display: grid; grid-template-columns: 1fr 1.4fr; gap: 30px; margin-top: 30px; padding: 20px; border-radius: 12px;
  background: var(--plate-hi) repeating-linear-gradient(0deg, #c9bab003 0 1px, transparent 1px 3px);
  box-shadow: inset 0 1px 0 #c9bab01a, inset 0 -1px 0 #000, 0 2px 0 #000, 0 14px 30px #000000d9; }
.save-panel p { font-size: 13px; line-height: 20px; color: var(--rose); }
.save-panel label { margin-bottom: 12px; }
.save-panel label.file-button { display: inline-flex; margin: 0; color: var(--oak); }
#account-status a { color: var(--rose); }

/* library: saved setups as tiles in a pocket */
#library { margin-top: 30px; padding: 20px; border-radius: 12px; background: var(--pocket);
  box-shadow: inset 0 4px 10px -3px #000000e6, inset 0 2px 0 #000, inset 0 -1px 0 var(--mocha); }
#library-status { font-size: 13px; line-height: 20px; color: var(--rose); }
#saves { display: grid; gap: 8px; }
.save-card { padding: 15px; border-radius: 3px; background: var(--plate); box-shadow: 0 1px 0 #000, 0 2px 4px #000000b3, inset 0 1px 0 #c9bab012; }
.save-card h4 { margin: 0 0 5px; font-size: 15px; line-height: 22px; letter-spacing: 0; text-transform: none; color: var(--oak); }
.save-card p { margin: 0; font-size: 11px; line-height: 16px; color: var(--dusty); }
.save-card .button-group a { font-size: 12px; }

/* ---------- dialog: a raised plate ---------- */
#discard-dialog { width: min(560px, calc(100vw - 32px)); padding: 25px; border: 0; border-radius: 12px; color: var(--oak);
  background: var(--plate) repeating-linear-gradient(0deg, #c9bab003 0 1px, transparent 1px 3px);
  box-shadow: inset 0 1px 0 #c9bab01a, inset 0 -1px 0 #000, 0 2px 0 #000, 0 24px 60px #000000f2; }
#discard-dialog::backdrop { background: #060707d9; }
#discard-dialog h2 { font-size: 24px; line-height: 32px; margin: 0 0 10px; }
#discard-dialog p { color: var(--rose); }
.noscript { width: min(var(--page), calc(100% - 2 * var(--gutter))); margin: 0 auto 40px; }

/* ---------- narrow ---------- */
@media (max-width: 1100px) {
  .work-columns { grid-template-columns: 1fr; }
  .save-panel { grid-template-columns: 1fr; gap: 10px; }
  .lab-layout { grid-template-columns: 230px minmax(0, 1fr); gap: 20px; }
}
@media (max-width: 900px) {
  .comp { padding-top: 20px; }
  .cp-head { grid-template-columns: 1fr; padding: 20px 15px; }
  .cp-id { grid-template-columns: 1fr; gap: 15px; }
  .cp-mark { justify-self: start; }
  .cp-mark .window { width: 76px; height: 76px; }
  .cp-note { max-width: none; }
  .lab-layout { grid-template-columns: 1fr; }
  .path-panel { position: static; }
  .path-pocket > .sc { max-height: 320px; }
  .path-note { display: none; }
  .path-panel > button { margin-top: 15px; }
  #experiment.panel, .workbench.panel { padding: 20px 12px; }
  .module-heading { flex-wrap: wrap; }
  #node-graph { min-width: 900px; max-height: none; }
  .inline-fields label { max-width: none; flex-basis: 100%; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { border-left: 0; border-top: 1px solid var(--mocha); }
  .metric:nth-child(even) { border-left: 1px solid var(--mocha); }
  .metric:nth-child(-n+2) { border-top: 0; }
  .metric strong { font-size: 15px; line-height: 22px; }
  .controls { padding: 15px 12px; }
  .toolbar .button-group { width: 100%; }
  .toolbar .button-group button { flex: 1; padding: 0 10px; }
  .question { font-size: 15px; line-height: 25px; }
}
