/* ============================================================================
   200-in-One Live Project Lab — app chrome. Dark electronics-bench theme.
   ========================================================================== */
:root {
  --head: 'Orbitron', 'Segoe UI', system-ui, sans-serif;
  --mono: 'Share Tech Mono', 'Consolas', monospace;
  --script: 'Kalam', cursive;
  --bg: #0d1014;
  --bg2: #141920;
  --panel: #1a2028;
  --edge: #2a323c;
  --txt: #cfd6dd;
  --dim: #8a939c;
  --amber: #ffb428;
  --green: #35e065;
  --red: #ff3b3b;
  --cyan: #3fd2ff;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: radial-gradient(1200px 700px at 40% -10%, #1a2230 0%, var(--bg) 55%);
  color: var(--txt); font-family: var(--head); overflow: hidden;
}

/* ---------- top bar ---------- */
#topbar {
  display: flex; align-items: center; gap: 18px;
  height: 58px; padding: 0 16px;
  background: linear-gradient(180deg, #232b35, #161b22);
  border-bottom: 2px solid #000; box-shadow: 0 3px 14px rgba(0,0,0,.5);
  position: relative; z-index: 5;
}
#brand { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.brand-icon { color: var(--red); font-size: 20px; text-shadow: 0 0 12px var(--red); }
.brand-name { font-weight: 900; font-size: 22px; letter-spacing: 1px; color: #fff; }
.brand-in { color: var(--amber); font-size: 15px; font-style: italic; }
.brand-sub { font-size: 10px; letter-spacing: 3px; color: var(--dim); }

#transport { display: flex; gap: 6px; }
.tbtn {
  font-family: var(--head); font-weight: 700; font-size: 13px; letter-spacing: 1px;
  color: var(--txt); background: linear-gradient(180deg, #2d353f, #1c222a);
  border: 1px solid #39424d; border-bottom-color: #10151a;
  border-radius: 7px; padding: 9px 14px; cursor: pointer;
  transition: all .12s;
}
.tbtn:hover { filter: brightness(1.2); }
.tbtn:active { transform: translateY(1px); }
.tbtn.small { padding: 8px 10px; }
.tbtn.run.active {
  color: #04180a; background: linear-gradient(180deg, #47f37b, #1fae4c);
  box-shadow: 0 0 16px rgba(53, 224, 101, .55); border-color: #6cf79a;
}
.tbtn.paused.active { color: #221a04; background: linear-gradient(180deg, #ffd45e, #d9a418); box-shadow: 0 0 14px rgba(255, 200, 60, .5); }

#readouts { display: flex; gap: 8px; }
.chip {
  font-family: var(--mono); font-size: 13px; padding: 6px 10px;
  background: #0a0e12; border: 1px solid #2a323c; border-radius: 6px; color: var(--green);
  min-width: 110px; text-align: center;
}
#chip-state { color: var(--dim); min-width: 130px; }
#chip-state.running { color: var(--green); text-shadow: 0 0 8px rgba(53,224,101,.6); }
#chip-state.nopower { color: var(--amber); }

#tools { display: flex; align-items: center; gap: 14px; margin-left: auto; }
#tools-dyn { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.tool-item { display: flex; align-items: center; gap: 6px; font-size: 11px; letter-spacing: 1px; color: var(--dim); }
.tool-item select {
  font-family: var(--mono); background: #0a0e12; color: var(--cyan);
  border: 1px solid #2a323c; border-radius: 5px; padding: 4px 6px;
}
.tool-item input[type=range] { width: 90px; accent-color: var(--amber); }
#btn-sound.muted { opacity: 0.4; }

#status-line {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: 60px; font-family: var(--mono); font-size: 13px; color: var(--amber);
  background: rgba(20, 16, 4, 0.9); border: 1px solid #5a4410; border-radius: 0 0 8px 8px;
  padding: 5px 16px; z-index: 40; pointer-events: none;
  opacity: 0; transition: opacity .25s;
}
#status-line.show { opacity: 1; }

/* ---------- stage layout ---------- */
#stage { display: flex; height: calc(100% - 58px); }
#board-wrap {
  flex: 1 1 auto; min-width: 0; min-height: 0; display: flex;
  padding: 10px 6px 10px 12px; overflow: auto;          /* zoomed boards scroll */
  scrollbar-width: thin;
}
/* auto margins: centred while the board fits, top-left anchored once it is zoomed larger */
#board { display: block; margin: auto; flex: none; width: 100%; height: 100%; }

/* zoom control (topbar) */
#zoomctl { display: flex; align-items: center; gap: 3px; }
#zoomctl .tbtn.small { padding: 6px 9px; font-size: 13px; min-width: 32px; }
#zoomctl .tbtn.small.fit { font-size: 10.5px; letter-spacing: 1px; }
#zoom-pct { font-family: var(--mono); font-size: 12px; color: var(--dim); min-width: 44px; text-align: center; }

#dock {
  flex: 0 0 440px; display: flex; flex-direction: column;
  background: var(--bg2); border-left: 2px solid #000; min-width: 380px;
}
#dock-tabs { display: flex; gap: 2px; padding: 8px 8px 0; }
.dtab {
  flex: 1; font-family: var(--head); font-weight: 700; font-size: 12px; letter-spacing: 1px;
  padding: 10px 4px; cursor: pointer; color: var(--dim);
  background: #10151b; border: 1px solid #232b34; border-bottom: none;
  border-radius: 8px 8px 0 0;
}
.dtab.active { color: var(--amber); background: var(--panel); box-shadow: inset 0 2px 0 var(--amber); }
#dock-body {
  flex: 1 1 55%; min-height: 0; background: var(--panel);
  border: 1px solid #232b34; border-top: none; margin: 0 8px; border-radius: 0 0 8px 8px;
  overflow: hidden; display: flex;
}
.dpanel { display: none; flex: 1; overflow-y: auto; padding: 12px; }
.dpanel.active { display: block; }

/* ---------- schematic section ---------- */
#schem-section {
  flex: 0 0 42%; min-height: 220px; display: flex; flex-direction: column;
  margin: 8px; border: 1px solid #232b34; border-radius: 8px; overflow: hidden;
  background: #000;
}
#schem-section.expanded { position: fixed; inset: 70px 20px 20px 20px; z-index: 60; flex: none; }
#schem-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; letter-spacing: 1.5px; color: var(--cyan);
  background: #10151b; padding: 7px 10px; border-bottom: 1px solid #232b34;
}
#schem-head button { background: none; border: 1px solid #2a323c; color: var(--dim); border-radius: 4px; cursor: pointer; padding: 2px 8px; }
#engine-frame { flex: 1; border: 0; width: 100%; background: #000; }

/* ---------- board svg ---------- */
/* type scale. Base sizes suit the 1560-unit decks (150/200-in-One fit a 1080p window at ~0.94 px/unit);
   body.type-lg — set for the 1780-unit-and-wider decks that fit at ~0.7 px/unit — raises everything ~30 %
   so the on-screen text lands in the same legible range. Inline sizes in the symbol painters go through the
   --fs* variables for the same reason. */
:root { --fs8: 8px; --fs8h: 8.5px; --fs9: 9px; --fs10: 10px; --fs11: 11px; --fs11h: 11.5px; --fs13: 13px; }
body.type-lg { --fs8: 10px; --fs8h: 10.5px; --fs9: 11px; --fs10: 12.5px; --fs11: 13px; --fs11h: 13.5px; --fs13: 14.5px; }
.zone-label { font-family: var(--head); font-size: 11px; font-weight: 700; letter-spacing: 1.6px; fill: #0e1114; opacity: 0.85; }
.strip-label { font-family: var(--head); font-size: 10px; font-weight: 700; letter-spacing: 1px; fill: #0e1114; opacity: 0.9; }
.silk-value { font-family: var(--mono); font-size: 12.5px; fill: #10151a; }
.silk-pin { font-family: var(--mono); font-size: 12px; fill: #10151a; }
body.type-lg .zone-label { font-size: 14px; }
body.type-lg .strip-label { font-size: 12.5px; }
body.type-lg .silk-value { font-size: 15px; }
body.type-lg .silk-pin { font-size: 14px; }
.brand-mini { font-family: var(--head); font-weight: 900; font-size: 20px; fill: #e6ebef; letter-spacing: 1px; }
.brand-mini2 { font-family: var(--head); font-size: 11px; fill: #97a1ab; letter-spacing: 3px; }

.spring { cursor: pointer; }
.spring .spring-num {
  font-family: var(--mono); font-size: 14.5px; font-weight: 700; fill: #eef2f5;
  paint-order: stroke; stroke: rgba(0,0,0,0.75); stroke-width: 3px;
}
body.type-lg .spring .spring-num { font-size: 18px; stroke-width: 3.5px; }
.spring .spring-halo { stroke: transparent; stroke-width: 3; transition: all .12s; }
.spring:hover .spring-halo { stroke: var(--cyan); filter: drop-shadow(0 0 6px var(--cyan)); }
.spring.selected .spring-halo { stroke: var(--amber); filter: drop-shadow(0 0 8px var(--amber)); animation: pulse 0.8s infinite alternate; }
.spring.wired .spring-num { fill: #ffd77a; }
@keyframes pulse { from { stroke-width: 2.5; } to { stroke-width: 5; } }

.wire { cursor: pointer; }
.wire:hover .wire-core { filter: brightness(1.45) drop-shadow(0 0 4px #fff); }
.knob, .clickable { cursor: pointer; }
.panel-label { font-family: var(--head); font-size: 12px; font-weight: 700; letter-spacing: 2.5px; fill: #d9dee3; }
.panel-tiny { font-family: var(--head); font-size: 9.5px; letter-spacing: 1.6px; fill: #c3cad1; }
body.type-lg .panel-label { font-size: 14px; }
body.type-lg .panel-tiny { font-size: 11.5px; }
.logo-script { font-family: var(--script); font-size: 26px; fill: #e94d5f; }
.logo-big { font-family: var(--head); font-weight: 900; font-size: 40px; fill: #f2f5f7; letter-spacing: 1px; }
.logo-in { font-size: 24px; fill: var(--amber); font-style: italic; }
.logo-sub { font-family: var(--head); font-size: 11.5px; letter-spacing: 3.4px; fill: #aab3bb; }

/* ---------- manual panel ---------- */
.manual-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.manual-title { font-weight: 900; font-size: 16px; letter-spacing: 2px; color: var(--amber); }
.manual-sub { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.back-btn {
  font-family: var(--head); font-size: 11px; font-weight: 700; cursor: pointer;
  color: var(--cyan); background: none; border: 1px solid #2a3742; border-radius: 5px; padding: 4px 9px;
}
.pcard {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; margin-bottom: 7px;
  background: linear-gradient(180deg, #222a34, #1a212a); border: 1px solid #2c3540;
  border-radius: 8px; cursor: pointer; transition: all .12s;
}
.pcard:hover { border-color: var(--amber); transform: translateX(3px); box-shadow: -3px 0 0 var(--amber); }
.pcard-no {
  font-family: var(--mono); font-size: 17px; color: #08243a; background: var(--cyan);
  border-radius: 6px; padding: 5px 7px; font-weight: 700;
}
.pcard-title { font-weight: 700; font-size: 14px; color: #ecf0f3; }
.pcard-tag { font-family: var(--mono); font-size: 10.5px; color: var(--dim); letter-spacing: 1px; }
.pcard-go { margin-left: auto; color: var(--amber); font-size: 18px; }
.index-btn {
  width: 100%; margin-top: 10px; padding: 10px; cursor: pointer;
  font-family: var(--head); font-weight: 700; font-size: 12px; letter-spacing: 1.5px;
  color: var(--cyan); background: #10181f; border: 1px dashed #2c4656; border-radius: 8px;
}
.manual-foot { font-family: var(--mono); font-size: 10.5px; color: #5a646d; margin-top: 10px; line-height: 1.5; }

.idx-list { font-family: var(--mono); }
.idx-row {
  display: flex; gap: 8px; align-items: baseline; padding: 5px 6px; border-bottom: 1px solid #222a33;
  cursor: pointer; font-size: 12.5px;
}
.idx-row:hover { background: #232c37; }
.idx-row.noseq { opacity: 0.35; cursor: default; }
.idx-no { color: var(--cyan); }
.idx-title { color: #cdd4da; }
.idx-badge { margin-left: auto; font-size: 10px; color: #5f6a74; }
.idx-row.verified .idx-badge { color: var(--amber); }

/* project detail = book page */
.proj-no { font-family: var(--mono); font-size: 12px; letter-spacing: 2px; color: var(--cyan); }
.proj-page {
  background: #f4efdf; color: #22201a; border-radius: 8px; padding: 16px 16px 14px;
  box-shadow: inset 0 0 40px rgba(120, 90, 20, 0.12), 0 4px 14px rgba(0,0,0,.4);
  border-left: 6px solid #c8102e;
}
.proj-title { font-weight: 900; font-size: 19px; letter-spacing: 0.5px; color: #1c1a14; }
.proj-tagline { font-family: var(--mono); font-size: 10.5px; letter-spacing: 2px; color: #b03040; margin: 3px 0 8px; }
.proj-blurb { font-family: Georgia, 'Times New Roman', serif; font-size: 13.5px; line-height: 1.55; margin: 0 0 12px; }
.proj-seq-label { font-family: var(--head); font-weight: 700; font-size: 10.5px; letter-spacing: 1.5px; color: #6b6250; margin-bottom: 6px; }
.proj-seq { line-height: 2.1; }
.wchip {
  font-family: var(--mono); font-size: 12.5px; background: #fff; padding: 3px 7px;
  border: 1px solid #cfc5a8; border-radius: 5px; white-space: nowrap;
}
.proj-skip { font-family: var(--mono); font-size: 10.5px; color: #a05a10; margin-top: 8px; }
.proj-tips { font-family: Georgia, serif; font-size: 12.5px; line-height: 1.5; background: #ece4cc; border-radius: 6px; padding: 9px 11px; margin-top: 12px; }
.proj-actions { display: flex; gap: 10px; margin-top: 14px; }
.btn-build {
  flex: 1; font-family: var(--head); font-weight: 900; font-size: 14px; letter-spacing: 1px;
  padding: 12px; cursor: pointer; border-radius: 8px; border: none;
  color: #2a1e04; background: linear-gradient(180deg, #ffc94d, #e8a512);
  box-shadow: 0 3px 0 #9a6d08;
}
.btn-build.run { color: #06210f; background: linear-gradient(180deg, #52f584, #1fae4c); box-shadow: 0 3px 0 #0e6e2d; }
.btn-build:active { transform: translateY(2px); box-shadow: none; }

/* ---------- scope panel ---------- */
.scope-crt-wrap { position: relative; background: #0a0f0a; border-radius: 10px; padding: 8px; border: 2px solid #2c3540; }
#scope-crt { width: 100%; border-radius: 6px; background: #061006; display: block; }
.scope-badge { position: absolute; right: 16px; top: 14px; font-family: var(--head); font-size: 9px; letter-spacing: 2px; color: #3f7a4d; }
.scope-controls { margin-top: 10px; }
.probe-row { display: flex; gap: 6px; margin-bottom: 6px; }
.probe-btn {
  flex: 1; text-align: left; font-family: var(--mono); font-size: 12.5px; cursor: pointer;
  padding: 8px 10px; border-radius: 6px; border: 1px solid #2c3540; background: #171d25; color: var(--txt);
}
.probe-btn.ch1 { border-left: 4px solid #ffd24a; }
.probe-btn.ch2 { border-left: 4px solid #4ae2ff; }
.probe-btn.arming { border-color: var(--amber); animation: pulse 0.7s infinite alternate; }
.probe-clear { width: 34px; cursor: pointer; border-radius: 6px; border: 1px solid #2c3540; background: #10151b; color: var(--dim); }
.scope-knobs { display: flex; gap: 14px; margin-top: 8px; }
.scope-knobs label { display: flex; flex-direction: column; gap: 4px; font-size: 10px; letter-spacing: 1.5px; color: var(--dim); }
.scope-knobs select { font-family: var(--mono); background: #0a0e12; color: var(--green); border: 1px solid #2a323c; border-radius: 5px; padding: 5px 7px; }

/* ---------- wires panel ---------- */
.wl-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; letter-spacing: 1.5px; color: var(--dim); margin-bottom: 8px; }
.wl-clear { font-family: var(--head); font-size: 10px; font-weight: 700; color: var(--red); background: none; border: 1px solid #4b2228; border-radius: 5px; padding: 5px 9px; cursor: pointer; }
.wl-clear:disabled { opacity: 0.3; cursor: default; }
.wl-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px; border-bottom: 1px solid #222a33; font-family: var(--mono); font-size: 12.5px; }
.wl-dot { width: 11px; height: 11px; border-radius: 50%; border: 1px solid #000; flex: none; }
.wl-pair { color: #ecf0f3; min-width: 76px; }
.wl-parts { color: #7d8791; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-del { margin-left: auto; background: none; border: none; color: #77414b; cursor: pointer; font-size: 13px; }
.wl-del:hover { color: var(--red); }
.wl-empty { font-family: var(--mono); font-size: 12px; color: #5c666f; line-height: 1.7; padding: 18px 8px; text-align: center; }
.wl-seq-label { font-size: 10px; letter-spacing: 1.5px; color: var(--dim); margin: 12px 0 5px; }
.wl-seq { font-family: var(--mono); font-size: 12px; color: var(--cyan); background: #0a0e12; border: 1px solid #232b34; border-radius: 6px; padding: 8px 10px; line-height: 1.7; user-select: all; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #10151b; }
::-webkit-scrollbar-thumb { background: #2c3540; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #3a4552; }

@media (max-width: 1100px) {
  #dock { flex-basis: 380px; }
}

/* ============================================================================
   HOME — kit picker
   ========================================================================== */
#home {
  position: fixed; inset: 0; z-index: 100; overflow-y: auto;
  background:
    radial-gradient(900px 500px at 20% 0%, rgba(60, 90, 140, .35), transparent 60%),
    radial-gradient(700px 500px at 90% 100%, rgba(200, 16, 46, .22), transparent 60%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 1px, transparent 1px 42px),
    #0b0e12;
}
#home[hidden] { display: none; }
body.at-home #topbar, body.at-home #stage { visibility: hidden; }
.home-inner { max-width: 1240px; margin: 0 auto; padding: 48px 28px 40px; }
.home-head { text-align: center; margin-bottom: 34px; }
.home-eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 4px; color: var(--dim); }
.home-title {
  font-family: var(--head); font-weight: 900; font-size: 64px; letter-spacing: 6px; margin: 10px 0 6px;
  color: #f4f6f8; text-shadow: 0 0 30px rgba(63, 210, 255, .35);
}
.home-title span { color: var(--amber); text-shadow: 0 0 30px rgba(255, 180, 40, .5); }
.home-sub { font-family: var(--mono); font-size: 14px; color: #9aa4ad; }
.kit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 26px; }
.kit-card {
  display: flex; flex-direction: column; cursor: pointer; overflow: hidden;
  background: linear-gradient(180deg, #1b222b, #12171d); border: 1px solid #2a333e; border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5); transition: transform .18s, border-color .18s, box-shadow .18s;
}
.kit-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 16px 50px rgba(0,0,0,.6), 0 0 0 1px var(--accent); }
.kit-art { background: #0a0d10; padding: 16px 18px 6px; border-bottom: 1px solid #222a33; }
.kit-svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 6px 14px rgba(0,0,0,.6)); }
.kit-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 6px; }
.kit-maker { font-family: var(--mono); font-size: 11px; letter-spacing: 2px; color: var(--dim); }
.kit-name { font-family: var(--head); font-weight: 900; font-size: 34px; color: #fff; letter-spacing: 1px; line-height: 1.05; }
.kit-in { color: var(--accent); font-size: 22px; font-style: italic; }
.kit-title { font-family: var(--head); font-size: 13px; letter-spacing: 3px; color: #b8c0c8; }
.kit-blurb { font-family: Georgia, serif; font-size: 13.5px; line-height: 1.55; color: #c9d0d7; margin: 8px 0 4px; }
.kit-specs { display: flex; gap: 14px; font-family: var(--mono); font-size: 12px; color: var(--cyan); }
.kit-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.kit-tags span { font-family: var(--mono); font-size: 10.5px; padding: 3px 8px; border-radius: 12px; background: #0f1419; border: 1px solid #2a333e; color: #9aa4ad; }
.kit-go {
  margin-top: 12px; align-self: flex-start; font-family: var(--head); font-weight: 900; font-size: 13px; letter-spacing: 1.5px;
  padding: 11px 18px; cursor: pointer; border-radius: 8px; border: none; color: #1a1006;
  background: linear-gradient(180deg, #ffc94d, #e8a512); box-shadow: 0 3px 0 #9a6d08;
}
.kit-card:hover .kit-go { background: linear-gradient(180deg, #52f584, #1fae4c); color: #06210f; box-shadow: 0 3px 0 #0e6e2d; }

/* home button + accent */
.tbtn.home { color: var(--amber); border-color: #4a3a12; }
:root { --accent: #c8102e; }
.brand-name .brand-in { color: var(--amber); }

/* ---------- 150-in-1 board styling ---------- */
.silk-dark { fill: #111; }
.zone-label.paper { fill: #111; opacity: 0.9; letter-spacing: 1.2px; font-size: 10.5px; }
body.type-lg .zone-label.paper { font-size: 13.5px; }
.spring.dark .spring-num { fill: #111; paint-order: stroke; stroke: rgba(255,255,255,0.75); stroke-width: 3px; }
body.type-lg .spring.dark .spring-num { stroke-width: 3.5px; }
.spring.dark.wired .spring-num { fill: #8a3b00; }
.bench-label { font-family: var(--head); font-size: 11px; font-weight: 700; letter-spacing: 2px; fill: #c9cfd5; }
.bench-tiny { font-family: var(--mono); font-size: 11px; fill: #8d969e; }
body.type-lg .bench-label { font-size: 13px; }
body.type-lg .bench-tiny { font-size: 12.5px; }
.logo150-big { font-family: var(--head); font-weight: 900; font-size: 54px; fill: #111; letter-spacing: 1px; }
.logo150-in { font-size: 30px; font-style: italic; }
.logo150-sub { font-family: var(--head); font-weight: 700; font-size: 17px; letter-spacing: 3.5px; fill: #111; }
.logo150-script { font-family: var(--script); font-size: 19px; fill: #111; }
