/* ================= Design tokens (shared language with the 6502 sim) ================= */
:root {
  --bench-bg: #18160f;
  --bench-bg-2: #1f1c15;
  --breadboard: #131210;
  --breadboard-edge: #3a352c;
  --rail-red: #b8362a;
  --rail-blue: #2b5a86;

  --chip-body: #24221c;
  --chip-body-2: #302c23;
  --chip-pin: #cac4b0;
  --chip-text: #cfc9b8;

  --led-red-off: #4a2018;
  --led-red-on: #ff4a37;
  --led-amber-off: #463318;
  --led-amber-on: #ffb23e;
  --led-green-off: #1c4028;
  --led-green-on: #5fe083;
  --led-blue-off: #16283a;
  --led-blue-on: #4ab8ff;

  --panel-bg: #211e17;
  --panel-bg-2: #17150f;
  --panel-border: #3a352a;

  --accent: #cd8a3e;
  --accent-bright: #eaa957;
  --accent-dim: #8a6636;

  --text-light: #f1ece0;
  --text-mid: #c9c2ae;
  --text-dim: #8f8874;

  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'Roboto Mono', Consolas, Menlo, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(ellipse at 50% -10%, #262218 0%, var(--bench-bg) 55%, #100f0b 100%);
  color: var(--text-light); font-family: var(--font-sans); min-height: 100vh;
}
.bench { max-width: 1220px; margin: 0 auto; padding: 20px 20px 60px; }

/* ================= Header ================= */
.topbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding: 4px 4px 20px; }
.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.brand-chip { font-family: var(--font-mono); font-weight: 700; font-size: 12px; letter-spacing: 0.08em; color: var(--bench-bg); background: var(--accent-bright); padding: 3px 8px; border-radius: 4px; }
.brand h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; margin: 0; color: var(--text-light); }
.brand-sub { display: block; font-size: 12.5px; font-weight: 400; color: var(--text-dim); letter-spacing: 0; margin-top: 3px; }

.transport { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  font-family: var(--font-sans); font-size: 13.5px; font-weight: 600; color: var(--text-light);
  background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 7px;
  padding: 9px 14px; cursor: pointer; transition: all .12s ease; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--accent-dim); background: #282419; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #201804; }
.btn-primary:hover { background: var(--accent-bright); border-color: var(--accent-bright); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
select:focus-visible, .tab-btn:focus-visible, input[type="range"]:focus-visible, input[type="text"]:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) { * { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; } }

/* ================= Power supply strip ================= */
.power-strip {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 10px;
  padding: 12px 18px; margin-bottom: 14px;
}
.barrel-jack { width: 34px; height: 28px; border-radius: 4px; flex: none; position: relative; background: linear-gradient(180deg, #4a4a4a, #232323); box-shadow: 0 2px 4px rgba(0,0,0,.4); }
.barrel-jack::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 14px; height: 14px; border-radius: 50%; background: #111; box-shadow: inset 0 0 3px rgba(0,0,0,.8); }
.power-switch { width: 26px; height: 16px; border-radius: 3px; flex: none; position: relative; background: #2a2a2a; box-shadow: inset 0 1px 2px rgba(0,0,0,.5); }
.power-switch-toggle { position: absolute; top: 2px; left: 2px; width: 10px; height: 12px; border-radius: 2px; background: linear-gradient(180deg, #777, #3a3a3a); }
.chip-reg {
  flex: none; width: 46px; height: 52px; padding-top: 6px; position: relative;
  background: linear-gradient(180deg, #3a3833, #201e1a); border-radius: 4px 4px 2px 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  box-shadow: 0 4px 8px rgba(0,0,0,.35);
}
.reg-tab { width: 30px; height: 8px; border-radius: 2px 2px 0 0; margin-bottom: 6px; background: linear-gradient(180deg, #bfc2c4, #8b8e90); }
.chip-reg::after {
  content: ''; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); width: 26px; height: 8px;
  background-image: repeating-linear-gradient(to right, var(--chip-pin) 0 2px, transparent 2px 8px);
}
.chip-reg .chip-label { font-size: 10px; }
.cap-can { width: 15px; height: 24px; border-radius: 3px 3px 2px 2px; flex: none; position: relative; background: linear-gradient(180deg, #2b6cb0, #1a4373); box-shadow: 0 2px 4px rgba(0,0,0,.4); }
.cap-row { display: flex; gap: 6px; }
.cap-can::before { content: ''; position: absolute; top: 3px; left: 50%; transform: translateX(-50%); width: 9px; height: 2px; background: rgba(255,255,255,.35); border-radius: 1px; }
.power-strip-label { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); letter-spacing: 0.03em; max-width: 380px; line-height: 1.4; }

/* ================= Passive components (resistors/caps distributed at their real locations) ================= */
.passives-row { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; padding: 6px 4px 2px; }
.passive-item { display: flex; align-items: center; gap: 8px; }
.passive-item label { font-family: var(--font-mono); font-size: 9px; color: var(--text-dim); line-height: 1.3; max-width: 140px; }
.resistor { display: flex; align-items: center; flex: none; }
.resistor-bank { display: flex; gap: 4px; }
.resistor .r-lead { width: 10px; height: 2px; background: #8a8368; }
.resistor .r-body {
  width: 28px; height: 11px; border-radius: 3px; background: linear-gradient(180deg, #e0c088, #c9a565);
  display: flex; align-items: center; justify-content: space-evenly;
  box-shadow: 0 1px 3px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.3);
}
.resistor .band { width: 2.5px; height: 80%; border-radius: 1px; }
.resistor.small .r-body { width: 22px; height: 9px; }
.resistor.small .r-lead { width: 8px; }
.resistor.tiny .r-body { width: 16px; height: 7px; }
.resistor.tiny .r-lead { width: 5px; }
.resistor.tiny .band { width: 1.8px; }
.band-red { background: #c0392b; } .band-brown { background: #6b4226; } .band-black { background: #1a1a1a; }
.band-gold { background: #c9a227; } .band-yellow { background: #d4b83c; } .band-violet { background: #7a4fa3; }
.cap-disc {
  width: 14px; height: 18px; border-radius: 50% / 40%; position: relative;
  background: linear-gradient(180deg, #e3c86b, #b89438);
  box-shadow: 0 2px 4px rgba(0,0,0,.35), inset 0 1px 1px rgba(255,255,255,.35);
}
.cap-disc.small { width: 11px; height: 14px; }
.cap-disc::before, .cap-disc::after { content: ''; position: absolute; bottom: -5px; width: 2px; height: 5px; background: #8a8368; }
.cap-disc::before { left: 32%; } .cap-disc::after { left: 58%; }
.dip-switch { display: inline-flex; background: #2a2a2a; border-radius: 3px; padding: 3px 4px; gap: 3px; box-shadow: inset 0 1px 2px rgba(0,0,0,.5); }
.dip-toggle { width: 6px; height: 14px; border-radius: 1px; background: linear-gradient(180deg, #8a8368, #5f5a48); }
.dip-toggle:nth-child(odd) { align-self: flex-end; background: linear-gradient(180deg, #6b6550, #423e30); }

.mode-switch { display: inline-flex; align-items: center; gap: 6px; cursor: default; pointer-events: none; flex: none; }
.mode-switch input { display: none; }
.mode-switch-track { width: 34px; height: 16px; border-radius: 8px; background: #2a2a2a; position: relative; box-shadow: inset 0 1px 3px rgba(0,0,0,.5); }
.mode-switch-thumb {
  position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(180deg, #8a8368, #5f5a48); transition: transform .15s ease, background .15s ease;
}
.mode-switch input:checked + .mode-switch-track .mode-switch-thumb {
  transform: translateX(18px); background: linear-gradient(180deg, #eaa957, #cd8a3e);
}
.mode-switch-labels { display: flex; flex-direction: column; font-family: var(--font-mono); font-size: 7px; color: var(--text-dim); line-height: 1.3; letter-spacing: 0.03em; }

.run-switch { display: inline-flex; align-items: center; gap: 8px; }
.run-switch-body { width: 18px; height: 30px; background: #2a2a2a; border-radius: 4px; position: relative; box-shadow: inset 0 1px 3px rgba(0,0,0,.5); flex: none; }
.run-switch-lever { position: absolute; left: 3px; top: 3px; width: 12px; height: 14px; border-radius: 3px; background: linear-gradient(180deg, #eaa957, #cd8a3e); }
.run-switch-labels { display: flex; flex-direction: column; font-family: var(--font-mono); font-size: 8px; color: var(--text-dim); line-height: 1.5; letter-spacing: 0.04em; }

/* ================= Rails ================= */
.rail { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 4px 14px; font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); letter-spacing: 0.05em; }
.rail-line { height: 3px; border-radius: 2px; }
.rail-line.red { background: var(--rail-red); } .rail-line.blue { background: var(--rail-blue); }

/* ================= Board ================= */
.board-wrap { margin-bottom: 22px; }
.board {
  background-color: var(--breadboard);
  background-image: radial-gradient(circle, rgba(255,255,255,0.07) 1px, transparent 1.5px);
  background-size: 15px 15px; border-radius: 10px; border: 1px solid var(--breadboard-edge);
  box-shadow: 0 20px 45px rgba(0,0,0,0.45), inset 0 0 0 1px rgba(255,255,255,0.35);
  padding: 22px 22px 26px; color: var(--text-light); position: relative;
}
.wire-overlay {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0; overflow: visible;
}
.wire-overlay path { fill: none; stroke-linecap: round; }
.wire-overlay circle { opacity: 0.9; }
.board > *:not(.wire-overlay) { position: relative; z-index: 1; }

.bus-label, .module-title { font-family: var(--font-mono); font-weight: 700; letter-spacing: 0.1em; color: var(--text-dim); }
.bus-row { display: flex; align-items: center; gap: 14px; padding: 8px 10px; margin-bottom: 8px; background: rgba(255,255,255,0.04); border-radius: 8px; }
.bus-label { font-size: 10.5px; width: 60px; flex: none; }
.led-row { display: flex; gap: 7px; flex-wrap: wrap; }
.led-row.small { gap: 5px; }
.bus-readout { font-family: var(--font-mono); font-weight: 700; font-size: 15px; color: var(--text-light); background: rgba(255,255,255,0.06); padding: 4px 10px; border-radius: 5px; min-width: 56px; text-align: center; }

.led { width: 13px; height: 13px; border-radius: 50%; display: inline-block; transition: background-color .08s linear, box-shadow .08s linear; box-shadow: inset 0 1px 2px rgba(0,0,0,0.5); }
.led-row.small .led { width: 10px; height: 10px; }
.led-red { background: var(--led-red-off); } .led-red.on { background: var(--led-red-on); box-shadow: 0 0 9px 3px rgba(255,74,55,.85), inset 0 0 2px rgba(255,255,255,.5); }
.led-amber { background: var(--led-amber-off); } .led-amber.on { background: var(--led-amber-on); box-shadow: 0 0 9px 3px rgba(255,178,62,.85), inset 0 0 2px rgba(255,255,255,.5); }
.led-green { background: var(--led-green-off); } .led-green.on { background: var(--led-green-on); box-shadow: 0 0 9px 3px rgba(95,224,131,.85), inset 0 0 2px rgba(255,255,255,.5); }
.led-blue { background: var(--led-blue-off); } .led-blue.on { background: var(--led-blue-on); box-shadow: 0 0 9px 3px rgba(74,184,255,.85), inset 0 0 2px rgba(255,255,255,.5); }

/* ================= Chips (shared with the 6502 sim) ================= */
.chip { position: relative; background: linear-gradient(180deg, var(--chip-body-2), var(--chip-body)); border: 1px solid rgba(255,255,255,0.07); border-radius: 5px; box-shadow: 0 8px 16px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.05); display: flex; align-items: center; justify-content: center; text-align: center; }
.chip-pins.left, .chip-pins.right { position: absolute; left: 12px; right: 12px; height: 7px; background-image: repeating-linear-gradient(to right, var(--chip-pin) 0 3px, transparent 3px 11px); opacity: 0.9; }
.chip-pins.left { top: -7px; } .chip-pins.right { bottom: -7px; }
.chip-label { font-family: var(--font-mono); font-weight: 700; font-size: 13px; color: var(--chip-text); letter-spacing: 0.03em; line-height: 1.5; }
.chip-label span, .chip-label i { display: block; font-weight: 500; font-size: 10px; color: #7a7460; letter-spacing: 0.08em; margin-top: 2px; font-style: normal; }
.chip-mini { width: 42px; height: 28px; flex: none; padding: 0; }
.chip-mini .chip-label { font-size: 10px; }
.chip-mini .chip-label i { font-size: 6.5px; }
.chip-mini .chip-pins.left, .chip-mini .chip-pins.right { height: 4px; background-image: repeating-linear-gradient(to right, var(--chip-pin) 0 2px, transparent 2px 6px); }
.chip-mini .chip-pins.left { top: -4px; } .chip-mini .chip-pins.right { bottom: -4px; }
.chip-mini.on { box-shadow: 0 0 10px 3px rgba(255,178,62,.65), 0 8px 16px rgba(0,0,0,.35); }

/* ================= Module cards ================= */
.modules-row { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 4px; align-items: stretch; }
.modules-row-control { align-items: stretch; }
.module {
  background: rgba(255,255,255,0.035); border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
  padding: 12px 14px 14px; flex: 1 1 200px; display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.module-title { font-size: 10.5px; text-transform: uppercase; margin-bottom: 2px; }
.module-title span { display: block; font-weight: 500; font-size: 9px; color: var(--text-dim); letter-spacing: 0.04em; margin-top: 2px; }
.module-chips-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 2px; }
.module-chips-row .chip-mini { width: 34px; height: 24px; }
.module-chips-row .chip-mini .chip-label { font-size: 9px; }
.module-readout { font-family: var(--font-mono); font-weight: 700; font-size: 20px; color: var(--text-light); }
.module-readout.small { font-size: 15px; }

.ctl-mini-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.ctl-mini {
  font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: 0.03em;
  color: var(--text-dim); background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px; padding: 2px 6px; transition: all .1s ease;
}
.ctl-mini.on { color: #201804; background: var(--accent-bright); border-color: var(--accent-bright); box-shadow: 0 0 6px 1px rgba(234,169,87,.6); }

/* Memory controller */
.mem-inner { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.mem-mar label { font-family: var(--font-mono); font-size: 9px; color: var(--text-dim); display: block; margin-bottom: 3px; }
.mem-contents label { font-family: var(--font-mono); font-size: 9px; color: var(--text-dim); display: block; margin-bottom: 3px; }
.mem-ram { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; flex: 1 1 160px; }
.mem-cell {
  font-family: var(--font-mono); font-size: 9px; text-align: center; padding: 3px 1px; border-radius: 3px;
  background: rgba(255,255,255,0.05); color: var(--text-mid); border: 1px solid rgba(255,255,255,0.08);
}
.mem-cell.active { border-color: var(--accent-bright); color: #201804; background: rgba(234,169,87,0.35); }

/* Instruction register */
.ir-split { display: flex; gap: 14px; }
.ir-half { flex: 1 1 0; display: flex; flex-direction: column; gap: 4px; }
.ir-half label { font-family: var(--font-mono); font-size: 9px; color: var(--text-dim); }

/* Flags */
.flags-row { display: flex; gap: 10px; }
.flag-mini { flex: 1 1 0; text-align: center; padding: 5px 0; border-radius: 5px; background: rgba(255,255,255,0.04); }
.flag-mini label { font-family: var(--font-mono); font-size: 9px; color: var(--text-dim); }
.flag-mini.on { background: rgba(234,169,87,0.3); }
.flag-mini.on label { color: #201804; }

/* Control word */
.control-word-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px 10px; }
.cw-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cw-item label { font-family: var(--font-mono); font-size: 9px; color: var(--text-mid); }

/* Microcode EEPROMs (decorative) */
.module-microcode { flex: 0 1 170px; align-items: center; }
.microcode-chips { display: flex; gap: 8px; }
.microcode-addr { font-family: var(--font-mono); font-size: 10px; color: var(--text-mid); }

/* Ring counter (T-state) */
.module-step { flex: 0 1 150px; }
.step-leds { display: flex; gap: 8px; }
.step-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.step-item label { font-family: var(--font-mono); font-size: 9px; color: var(--text-mid); }

/* Halt */
.module-halt { flex: 0 1 90px; align-items: center; }

/* ================= Clock module (shared with the 6502 sim) ================= */
.clock-module { flex: 2 1 420px; display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.clock-label { font-family: var(--font-mono); font-size: 9.5px; color: var(--text-dim); letter-spacing: 0.07em; }
.clock-label span { display: block; font-weight: 400; font-size: 8.5px; color: var(--text-dim); letter-spacing: 0.03em; margin-top: 1px; }
.clock-555-row { display: flex; gap: 8px; flex-wrap: wrap; }
.clock-controls-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pot-wrap { width: 32px; height: 32px; flex: none; }
.pot-knob { width: 100%; height: 100%; border-radius: 50%; position: relative; transition: transform .15s ease; background: radial-gradient(circle at 35% 30%, #4a4638, #201d16); box-shadow: 0 2px 5px rgba(0,0,0,.5), inset 0 1px 1px rgba(255,255,255,.12); }
.pot-knob-mark { position: absolute; top: 3px; left: 50%; width: 2px; height: 11px; background: var(--accent-bright); transform: translateX(-50%); border-radius: 1px; }
#speed-slider { width: 150px; accent-color: var(--accent); }
.clock-readout { font-family: var(--font-mono); font-weight: 700; font-size: 12px; color: var(--text-light); min-width: 56px; }
.mini-pushbutton {
  width: 56px; height: 26px; border-radius: 6px; padding: 0; cursor: pointer; flex: none;
  font-family: var(--font-mono); font-size: 8px; font-weight: 700; letter-spacing: 0.05em; color: #cfc9b8;
  background: linear-gradient(180deg, #3a3632, #221f1a); border: 2px solid #171410;
  box-shadow: 0 3px 6px rgba(0,0,0,.4), inset 0 1px 1px rgba(255,255,255,.08);
}
.mini-pushbutton:hover { filter: brightness(1.12); } .mini-pushbutton:active { transform: translateY(1px); }
.mini-pushbutton:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.mini-pushbutton:disabled { opacity: .5; cursor: not-allowed; }

.reset-button {
  width: 44px; height: 44px; border-radius: 50%; flex: none; padding: 0; cursor: pointer;
  background: linear-gradient(180deg, #3a3632, #221f1a); border: 2px solid #171410;
  box-shadow: 0 4px 8px rgba(0,0,0,.4), inset 0 1px 1px rgba(255,255,255,.08); display: flex; align-items: center; justify-content: center;
  align-self: center;
}
.reset-button:hover .reset-button-cap { filter: brightness(1.15); }
.reset-button:active .reset-button-cap { transform: translateY(1px); }
.reset-button:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 3px; }
.reset-button-cap { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #c0392b, #7a2015); box-shadow: 0 2px 3px rgba(0,0,0,.5), inset 0 1px 1px rgba(255,255,255,.2); }

/* ================= Output register: 7-segment display ================= */
.module-output { flex: 1 1 260px; align-items: center; }
.sevenseg-panel {
  display: flex; gap: 10px; background: linear-gradient(180deg, var(--chip-body-2), var(--chip-body));
  border-radius: 8px; padding: 14px 18px; box-shadow: inset 0 3px 8px rgba(0,0,0,.4);
}
.sevenseg-digit { position: relative; width: 34px; height: 58px; }
.seg { position: absolute; background: var(--led-red-off); transition: background-color .1s, box-shadow .1s; border-radius: 2px; }
.seg.on { background: var(--led-red-on); box-shadow: 0 0 8px 2px rgba(255,74,55,.8); }
.seg-a { top: 0; left: 5px; width: 24px; height: 5px; }
.seg-g { top: 26.5px; left: 5px; width: 24px; height: 5px; }
.seg-d { top: 53px; left: 5px; width: 24px; height: 5px; }
.seg-f { top: 4px; left: 0; width: 5px; height: 24px; }
.seg-b { top: 4px; left: 29px; width: 5px; height: 24px; }
.seg-e { top: 30px; left: 0; width: 5px; height: 24px; }
.seg-c { top: 30px; left: 29px; width: 5px; height: 24px; }
.sevenseg-sign { width: 14px; height: 5px; margin: auto 4px auto 0; align-self: center; border-radius: 2px; background: var(--led-red-off); transition: background-color .1s, box-shadow .1s; }
.sevenseg-sign.on { background: var(--led-red-on); box-shadow: 0 0 8px 2px rgba(255,74,55,.8); }
.sign-mode-switch { pointer-events: auto; cursor: pointer; }
.sign-mode-switch:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

/* ================= Lower panels (shared pattern) ================= */
.panels { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; margin-top: 24px; }
.panel { background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 12px; padding: 18px 20px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.panel-head-tight { margin-top: 18px; }
.panel h2 { font-size: 15px; margin: 0; letter-spacing: 0.01em; }
.panel-desc { color: var(--text-dim); font-size: 12.5px; margin: 4px 0 14px; line-height: 1.5; }
select { background: var(--panel-bg-2); color: var(--text-light); border: 1px solid var(--panel-border); border-radius: 6px; padding: 6px 10px; font-family: var(--font-sans); font-size: 12.5px; }

.editor-wrap { display: flex; background: var(--panel-bg-2); border: 1px solid var(--panel-border); border-radius: 8px; overflow: hidden; }
.editor-gutter { padding: 12px 10px; text-align: right; color: #524c3c; background: #131109; font: 12.5px/1.55 var(--font-mono); white-space: pre; user-select: none; overflow: hidden; }
#asm-source { flex: 1; padding: 12px 14px; background: transparent; color: #eadfc4; border: 0; outline: 0; resize: vertical; min-height: 260px; font: 12.5px/1.55 var(--font-mono); tab-size: 8; white-space: pre; }
#asm-source:focus-visible { box-shadow: inset 0 0 0 2px var(--accent-dim); }

.editor-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.editor-output { margin-top: 14px; }
.output-tabs { display: flex; gap: 2px; }
.tab-btn { font-family: var(--font-sans); font-size: 12px; font-weight: 600; color: var(--text-dim); background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 7px 12px; cursor: pointer; }
.tab-btn.active { color: var(--accent-bright); border-bottom-color: var(--accent-bright); }
.tab-panel { display: none; margin: 0; font: 12px/1.6 var(--font-mono); background: var(--panel-bg-2); border: 1px solid var(--panel-border); border-top: 0; border-radius: 0 0 8px 8px; padding: 12px 14px; max-height: 260px; overflow: auto; white-space: pre-wrap; color: var(--text-mid); }
.tab-panel.active { display: block; }
.tab-panel .err-line { color: #ff8a75; } .tab-panel .ok-line { color: var(--led-green-on); }

.bus-log { font: 11.5px/1.65 var(--font-mono); background: var(--panel-bg-2); border: 1px solid var(--panel-border); border-radius: 8px; padding: 10px 12px; height: 230px; overflow-y: auto; color: var(--text-mid); }
.bus-log .lg-ctrl { color: var(--accent-bright); } .bus-log .lg-bus { color: #85b6e8; }

.hex-view { font: 11.5px/1.65 var(--font-mono); background: var(--panel-bg-2); border: 1px solid var(--panel-border); border-radius: 8px; padding: 10px 12px; margin: 10px 0 0; overflow: auto; color: var(--text-mid); max-height: 200px; }
.hex-view .hv-addr { color: var(--accent-bright); }

/* ================= Footer ================= */
.notes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--panel-border); }
.notes h3 { font-size: 12px; letter-spacing: 0.08em; color: var(--text-dim); margin: 0 0 8px; text-transform: uppercase; }
.notes p { font-size: 12.5px; line-height: 1.6; color: var(--text-mid); margin: 0; }

/* ================= Responsive ================= */
@media (max-width: 900px) {
  .modules-row { flex-direction: column; }
  .panels { grid-template-columns: 1fr; }
  .board { padding: 16px; }
  .mem-ram { grid-template-columns: repeat(4, 1fr); }
  .control-word-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 560px) {
  .brand h1 { font-size: 18px; }
  .led { width: 11px; height: 11px; }
  .transport { justify-content: center; }
}
