/* ============================================================
   电学实验台 · 样式
   基调：浅色实验台面、细线分隔、教材排版感
   ============================================================ */

:root {
  --desk:      #d9d6ce;
  --panel:     #f4f2ec;
  --panel-2:   #faf9f5;
  --board:     #fcfbf7;
  --ink:       #23272b;
  --ink-2:     #4d545a;
  --ink-3:     #8a8f94;
  --line:      #cbc5b8;
  --line-soft: #e2ded4;
  --hover:     #eae7de;
  --active:    #e0dcd0;
  --blue:      #2f5d8a;
  --red:       #a8342a;
  --green:     #3d6b4f;
  --amber:     #96631c;
}

* , *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--desk);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

/* ---------- 骨架 ---------- */
.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-left: 1px solid #bcb6a8;
  border-right: 1px solid #bcb6a8;
  background: var(--panel-2);
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 52px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: none;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-family: "Songti SC", "SimSun", "Source Han Serif SC", serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink);
}

.brand-sub {
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  padding-left: 12px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

/* ---------- 按钮 ---------- */
.btn {
  font-size: 12px;
  padding: 5px 11px;
  border: 1px solid #b6b0a2;
  border-radius: 2px;
  background: var(--panel-2);
  color: var(--ink);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  white-space: nowrap;
}

.btn:hover { background: var(--hover); border-color: #9d968a; }
.btn:active { background: var(--active); }
.btn:disabled { opacity: .38; cursor: default; background: var(--panel-2); border-color: #c9c3b6; }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: transparent; }
.btn-ghost:hover { background: var(--hover); border-color: #b6b0a2; }
.btn-sm { font-size: 11.5px; padding: 4px 9px; }
.btn-block { display: block; width: 100%; margin-top: 8px; }
.btn-danger { color: var(--red); border-color: #c8a49f; }
.btn-danger:hover { background: #f3e6e3; }

/* 开关式按钮的"已开启"状态 */
.btn-toggle { position: relative; padding-left: 20px; }
.btn-toggle::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  border: 1px solid var(--ink-3);
  background: transparent;
}
.btn-toggle.is-on {
  color: var(--blue);
  border-color: var(--blue);
  background: #eef3f8;
}
.btn-toggle.is-on::before { background: var(--blue); border-color: var(--blue); }

/* 悬停提示 */
.tip {
  position: absolute;
  z-index: 40;
  min-width: 128px;
  padding: 6px 9px 7px;
  background: #fffdf6;
  border: 1px solid #b6b0a2;
  border-radius: 2px;
  box-shadow: 0 5px 16px rgba(35, 39, 43, .14);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink);
  pointer-events: none;
}
.tip[hidden] { display: none; }
.tip-head {
  color: var(--ink-2);
  font-size: 11px;
  padding-bottom: 3px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.tip-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  white-space: nowrap;
}
.tip-row .k { color: var(--ink-3); }
.tip-row b {
  font-weight: 600;
  font-family: "Consolas", "SF Mono", "Courier New", monospace;
  font-variant-numeric: tabular-nums;
}
.tip-note { margin-top: 3px; color: var(--amber); font-size: 10.5px; }

/* ---------- 主工作区 ---------- */
.workbench {
  flex: 1;
  display: grid;
  grid-template-columns: 198px minmax(0, 1fr) 300px;
  min-height: 0;
}

.rail {
  background: var(--panel);
  overflow-y: auto;
  overflow-x: hidden;
}

.rail-left { border-right: 1px solid var(--line); }
.rail-right { border-left: 1px solid var(--line); }

.panel { border-bottom: 1px solid var(--line); }
.panel:last-child { border-bottom: none; }

.panel-title {
  margin: 0;
  padding: 11px 12px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line-soft);
  background: #eeece4;
}

/* ---------- 器材箱 ---------- */
.device-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px dashed var(--line-soft);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.device-item:hover { background: var(--hover); }
.device-item:active { cursor: grabbing; }

.device-icon {
  width: 60px;
  height: 44px;
  flex: none;
  pointer-events: none;
}

/* 图标缩到 44px 高，轮廓需单独加粗，文字在大图上才有意义 */
.device-icon .lead,
.device-icon .shell,
.device-icon .base,
.device-icon .ceramic,
.device-icon .glass { stroke-width: 3.2; }

.device-icon .post { stroke-width: 1.8; }
.device-icon .seam,
.device-icon .winding,
.device-icon .mtick,
.device-icon .marc { stroke-width: 2; }
.device-icon .needle,
.device-icon .blade { stroke-width: 3.6; }
.device-icon text { display: none; }

.device-item span {
  font-size: 12px;
  color: var(--ink-2);
  pointer-events: none;
}

/* ---------- 模板 ---------- */
.tpl {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: none;
  border-bottom: 1px dashed var(--line-soft);
  background: transparent;
  cursor: pointer;
}

.tpl:hover { background: var(--hover); }

.tpl-name {
  display: block;
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 600;
}

.tpl-desc {
  display: block;
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 1px;
}

/* ---------- 画布 ---------- */
.board {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--board);
}

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 30px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel-2);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
  flex: none;
}

.board-hint {
  letter-spacing: 0.02em;
  font-size: 11px;
  color: #a49d90;
}

.canvas-wrap {
  position: relative;
  flex: 1;
  overflow: hidden;
  background-color: var(--board);
  background-image:
    linear-gradient(to right, rgba(47, 93, 138, .07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(47, 93, 138, .07) 1px, transparent 1px),
    linear-gradient(to right, rgba(47, 93, 138, .13) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(47, 93, 138, .13) 1px, transparent 1px);
  background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
}

#board {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ---------- 画布内图元：实物外形 ---------- */
.lead { stroke: #2b3036; stroke-width: 1.8; stroke-linecap: round; fill: none; }

.shell {
  fill: #ded9cf;
  stroke: #2b3036;
  stroke-width: 1.7;
}

.base {
  fill: #cfc9bc;
  stroke: #2b3036;
  stroke-width: 1.5;
}

.ceramic {
  fill: #efe8d8;
  stroke: #4a4640;
  stroke-width: 1.4;
}

.seam { stroke: #8b857a; stroke-width: 1; fill: none; }

.glass {
  fill: #f6f4ea;
  stroke: #2b3036;
  stroke-width: 1.7;
}

.filament {
  fill: none;
  stroke: #6b4a10;
  stroke-width: 1.2;
  stroke-linejoin: round;
}

.band { fill: #6b5a3a; }
.band-b { fill: #2f3338; }
.band-c { fill: #2f3338; }
.band-d { fill: #b08a3a; }

.rod { stroke: #8e8a80; stroke-width: 3; stroke-linecap: round; }
.slider { fill: #b6b0a3; stroke: #3f3b34; stroke-width: 1.2; }
.winding { stroke: #a89e88; stroke-width: 1; }

.blade { stroke: #6b665c; stroke-width: 4; stroke-linecap: round; }
.pivot { fill: #4a4640; }

.post { fill: #c9a862; stroke: #6b5326; stroke-width: 1.1; }
.post-core { fill: #8a6f36; }
.post.is-pos { fill: #b8392c; stroke: #6d211a; }
.post.is-neg { fill: #3a3f44; stroke: #1a1d20; }

/* 表头 */
.face { fill: #fbfaf5; stroke: #6b6558; stroke-width: 1.1; }
.marc { fill: none; stroke: #a9a294; stroke-width: 1; }
.mtick { stroke: #7d776c; stroke-width: .9; }
.mtick.is-major { stroke: #3b4147; stroke-width: 1.4; }
.mneedle { stroke: #a8342a; stroke-width: 1.4; stroke-linecap: round; }
.mneedle.is-rev { stroke: #9a6a1e; }
.mpivot { fill: #3b4147; }

.dev-text {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 10.5px;
  fill: #3a3d41;
  user-select: none;
}

.dev-text-sm {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 9px;
  fill: #6b7075;
  user-select: none;
}

.dev-text-tiny {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 7px;
  fill: #7b7f84;
  user-select: none;
}

.dev-text-letter {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  fill: #2b3036;
  user-select: none;
}

.pin-hit { fill: transparent; cursor: crosshair; }
.pin { fill: none; stroke: transparent; stroke-width: 2; }
.pin-group:hover .pin { stroke: var(--red); stroke-width: 2.4; }

.element { cursor: grab; }
.element:active { cursor: grabbing; }

.sel-box {
  fill: none;
  stroke: var(--blue);
  stroke-width: 1.1;
  stroke-dasharray: 4 3;
}

.wire-line {
  fill: none;
  stroke: #2b3036;
  stroke-width: 3.1;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.wire-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  cursor: pointer;
}

.wire-g:hover .wire-line { stroke-width: 4.4; }
.wire-g.is-selected .wire-line { stroke-width: 4.4; stroke-dasharray: 7 4; }

.wire-preview {
  fill: none;
  stroke: var(--red);
  stroke-width: 2.6;
  stroke-dasharray: 6 5;
  opacity: .85;
}

.ghost { opacity: .45; pointer-events: none; }

/* 元件旁读数 */
.readout rect {
  fill: #f7f5ee;
  stroke: #b9b2a4;
  stroke-width: 1;
}

.readout text {
  font-family: Consolas, "SF Mono", monospace;
  font-size: 11px;
  fill: #2b3036;
  user-select: none;
}

.readout.is-over rect { fill: #f6e7e4; stroke: var(--red); }
.readout.is-over text { fill: var(--red); }
.readout.is-rev rect { fill: #f7efe4; stroke: #a8762c; }
.readout.is-rev text { fill: #8a5d18; }

/* ---------- 右侧面板 ---------- */
.empty {
  margin: 0;
  padding: 12px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-3);
}

.insp-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 12px 4px;
}

.insp-head b { font-size: 13px; font-weight: 600; }
.insp-head span {
  font-family: Consolas, monospace;
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: .06em;
}

.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 12px;
}

.field-label {
  font-size: 12px;
  color: var(--ink-2);
  flex: none;
}

.ctl {
  font-size: 12px;
  font-family: inherit;
  padding: 3px 5px;
  border: 1px solid #b6b0a2;
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  min-width: 84px;
  cursor: pointer;
}

.ctl-toggle {
  min-width: 68px;
  background: #f3ece9;
  color: var(--red);
  border-color: #c8a49f;
}

.ctl-toggle.is-on {
  background: #e8efe9;
  color: var(--green);
  border-color: #a9bfae;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
}

.ctl-range {
  width: 96px;
  accent-color: var(--blue);
  cursor: pointer;
}

.range-val {
  font-family: Consolas, monospace;
  font-size: 11.5px;
  color: var(--ink-2);
  min-width: 46px;
  text-align: right;
}

.field-read {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 6px 12px;
  padding: 6px 9px;
  background: #eeece4;
  border-left: 2px solid var(--blue);
  font-size: 11.5px;
  color: var(--ink-2);
}

.field-read b {
  font-family: Consolas, monospace;
  font-size: 13px;
  color: var(--ink);
}

.insp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 12px;
}

.insp-actions .btn { flex: 1 1 auto; white-space: nowrap; }

/* ---------- 仪表 ---------- */
.meter {
  padding: 8px 12px 10px;
  border-bottom: 1px dashed var(--line-soft);
}

.meter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-3);
}

.meter-head span:first-child { color: var(--ink-2); font-weight: 600; }

.dial { display: block; width: 100%; height: auto; margin: 1px 0 0; }

.dial-arc { fill: none; stroke: #a9a294; stroke-width: 1.2; }
.dial-tick { stroke: #7d776c; stroke-width: 1; }
.dial-tick.is-major { stroke: #3b4147; stroke-width: 1.6; }
.dial-needle { stroke: var(--red); stroke-width: 1.7; stroke-linecap: round; }
.dial-needle.is-over { stroke: #7d1f18; stroke-width: 2; }
.dial-needle.is-neg { stroke: #a8762c; }
.dial-hub { fill: #3b4147; }

.meter-value {
  text-align: right;
  font-family: Consolas, "SF Mono", monospace;
  font-size: 21px;
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: .01em;
}

.meter-value .u {
  font-size: 12px;
  color: var(--ink-3);
  margin-left: 3px;
}

.meter-value.is-over { color: var(--red); font-size: 17px; }
.meter-value.is-neg { color: #8a5d18; }
.meter.is-neg .meter-warn { color: #8a5d18; }

.meter-warn {
  font-size: 10.5px;
  color: var(--red);
  text-align: right;
}

/* ---------- 数据表 ---------- */
.rec {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.rec th {
  text-align: left;
  font-weight: 500;
  color: var(--ink-3);
  padding: 6px 10px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 10.5px;
  letter-spacing: .04em;
}

.rec td {
  padding: 4px 10px;
  border-bottom: 1px solid var(--line-soft);
  font-family: Consolas, monospace;
  color: var(--ink-2);
}

#records { padding-bottom: 12px; }
#records .btn-block { width: calc(100% - 24px); margin: 8px 12px 0; }

/* ---------- 状态栏 ---------- */
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 32px;
  padding: 0 14px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  flex: none;
}

.status-msg {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.status-msg .ind {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: currentColor;
}

.status-msg.lv-ok { color: var(--green); }
.status-msg.lv-warn { color: var(--amber); }
.status-msg.lv-danger { color: var(--red); }
.status-msg.lv-idle { color: var(--ink-3); }

.status-msg .more {
  color: var(--ink-3);
  margin-left: 8px;
  font-size: 10.5px;
}

.status-meta {
  color: var(--ink-3);
  font-family: Consolas, "SF Mono", monospace;
  font-size: 11px;
  flex: none;
}

/* ---------- 滚动条 ---------- */
.rail::-webkit-scrollbar { width: 9px; }
.rail::-webkit-scrollbar-track { background: #eae7de; }
.rail::-webkit-scrollbar-thumb {
  background: #c3bdb0;
  border: 2px solid #eae7de;
  border-radius: 4px;
}
.rail::-webkit-scrollbar-thumb:hover { background: #aaa396; }

@media (max-width: 1180px) {
  .workbench { grid-template-columns: 176px minmax(0, 1fr) 268px; }
  .brand-sub { display: none; }
}

/* ---------- 参数控件补充 ---------- */
.num-row { display: flex; align-items: center; gap: 5px; }

.ctl-num {
  width: 74px;
  font-family: Consolas, "SF Mono", monospace;
  font-size: 12px;
  padding: 3px 5px;
  border: 1px solid #b6b0a2;
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  text-align: right;
}

.num-row .unit { font-size: 11.5px; color: var(--ink-3); }

.port-state {
  font-family: Consolas, "SF Mono", monospace;
  font-size: 12px;
  color: var(--blue);
}

.hint-sm {
  margin: 2px 12px 8px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--ink-3);
}

.hint-sm.is-warn { color: var(--amber); }

/* ---------- 右键菜单 ---------- */
.ctx-menu {
  position: fixed;
  z-index: 60;
  min-width: 132px;
  padding: 3px;
  background: var(--panel-2);
  border: 1px solid #b6b0a2;
  border-radius: 2px;
  box-shadow: 0 3px 10px rgba(40, 36, 28, .16);
}

.ctx-menu[hidden] { display: none; }

.ctx-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  border-radius: 1px;
}

.ctx-item:hover { background: var(--hover); }
.ctx-item.is-danger { color: var(--red); }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(38, 34, 26, .34);
}

.modal[hidden] { display: none; }

.modal-box {
  display: flex;
  flex-direction: column;
  width: min(880px, 88vw);
  max-height: 84vh;
  background: var(--panel-2);
  border: 1px solid #a8a192;
  box-shadow: 0 8px 30px rgba(30, 26, 20, .22);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.modal-head h3 {
  margin: 0;
  font-family: "Songti SC", "SimSun", serif;
  font-size: 14px;
  letter-spacing: .12em;
  font-weight: 700;
}

.modal-close {
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid #b6b0a2;
  background: var(--panel-2);
  border-radius: 2px;
  cursor: pointer;
  color: var(--ink-2);
}

.modal-close:hover { background: var(--hover); }

.modal-body {
  padding: 14px 16px 18px;
  overflow: auto;
}

/* ---------- 电路图 ---------- */
.diagram-block { margin-bottom: 18px; }
.diagram-block:last-child { margin-bottom: 0; }

.diagram-cap {
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: .06em;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 6px;
}

.diagram-cap span { color: #a8a294; }

.diagram-svg {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 340px;
  background: #fdfdfa;
  border: 1px solid var(--line-soft);
}

/* 弹窗里按宽度放大一些，符号和标注才看得清 */
.modal-body .diagram-svg {
  width: 100%;
  height: auto;
  max-height: 360px;
}

.dg { stroke: #2b3036; stroke-width: 1.7; fill: none; stroke-linecap: round; }
.dg-thick { stroke: #2b3036; stroke-width: 2.8; fill: none; stroke-linecap: round; }
.dg-fill { fill: #fdfdfa; stroke: #2b3036; stroke-width: 1.7; }
.dg-dot { fill: #2b3036; }
.dg-node { fill: #fdfdfa; stroke: #2b3036; stroke-width: 1.2; }

.dg-letter {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  fill: #2b3036;
}

.dg-label {
  font-family: Consolas, "SF Mono", monospace;
  font-size: 13px;
  fill: #5d6369;
}

/* ---------- 平移 ---------- */
#board.is-panning { cursor: grabbing; }

/* ---------- LED / 电动机 ---------- */
.led-leg { stroke: #b7bcc2; stroke-width: 1.3; stroke-linecap: round; }
.led-dome { stroke-width: 1.5; stroke-linejoin: round; }
.led-gloss { fill: none; stroke: rgba(255, 255, 255, .78); stroke-width: 1.6; stroke-linecap: round; }

.rotor-blade { stroke: #6b665c; stroke-width: 3.2; stroke-linecap: round; }
.rotor-hub { fill: #4a4640; }

.motor-rotor {
  transform-box: fill-box;
  transform-origin: center;
  animation-name: motor-spin;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes motor-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.slider-grip { cursor: ew-resize; }
.slider-hit { fill: transparent; }

/* ---------- 实时电路图 ---------- */
.live-panel {
  flex: none;
  height: 296px;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
}

.live-panel[hidden] { display: none; }

.live-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  font-size: 10px;
  letter-spacing: .2em;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line-soft);
  background: #eeece4;
}

.live-tools { display: flex; gap: 4px; letter-spacing: 0; }

.live-tools button {
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0;
  padding: 2px 8px;
  border: 1px solid #b6b0a2;
  background: var(--panel-2);
  color: var(--ink-2);
  border-radius: 2px;
  cursor: pointer;
}

.live-tools button:hover { background: var(--hover); }

.live-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 10px;
  display: flex;
  gap: 14px;
  align-items: stretch;
}

.live-body .diagram-block {
  margin: 0;
  min-width: 260px;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
}

.live-body .diagram-svg {
  flex: 1 1 0;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  border: none;
  background: transparent;
}

.live-body .diagram-cap { margin-bottom: 2px; }

.live-body > .empty { padding: 6px 0; }


