/* =============================================================================
   3D 主板互动课件 · 样式
   设计系统：仪器面板 / 技术蓝图 · 8pt 网格 · 单一强调色 · 发丝线分层
   3D 画布 + 屏幕空间标注层（标注字号固定像素，与 3D 缩放解耦）
   ========================================================================== */

:root {
  --bg: #0B1119;
  --surface: #101A24;
  --surface-2: #16232E;
  --stage: #0A1017;
  --line: rgba(150, 180, 196, .15);
  --line-strong: rgba(150, 180, 196, .3);
  --text: #EDF3F5;
  --text-2: #A9BCC6;
  --text-3: #718A95;
  --accent: #FFB454;
  --accent-ink: #17110A;
  --accent-soft: rgba(255, 180, 84, .12);
  --accent-2: #67D7C4;
  --pin: #FFB454;
  --pin-ink: #141009;
  --panel: rgba(16, 26, 36, .95);
  --label-bg: rgba(10, 17, 24, .93);

  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px;
  --r: 8px;
  --r-sm: 5px;

  --type-scale: 1;
  --fs-micro: calc(clamp(10px, .62vw, 12px) * var(--type-scale));
  --fs-small: calc(clamp(12px, .74vw, 14px) * var(--type-scale));
  --fs-body: calc(clamp(15px, .95vw, 18px) * var(--type-scale));
  --fs-label: calc(clamp(11.5px, .76vw, 13.5px) * var(--type-scale));
  --fs-name: calc(clamp(25px, 1.8vw, 33px) * var(--type-scale));
  --fs-h1: calc(clamp(20px, 1.35vw, 26px) * var(--type-scale));

  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", sans-serif;
}

[data-theme="light"] {
  --bg: #EFF2F0;
  --surface: #FFFFFF;
  --surface-2: #E9EFEB;
  --stage: #DDE6E2;
  --line: rgba(22, 44, 54, .14);
  --line-strong: rgba(22, 44, 54, .3);
  --text: #16262E;
  --text-2: #465D66;
  --text-3: #728891;
  --accent: #A85A0C;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(168, 90, 12, .09);
  --accent-2: #0E7C70;
  --panel: rgba(255, 255, 255, .96);
  --label-bg: rgba(255, 255, 255, .96);
}

[data-scale="lg"] { --type-scale: 1.13; }
[data-scale="xl"] { --type-scale: 1.28; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--fs-body);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font-family: inherit; color: inherit; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.app { height: 100dvh; min-height: 520px; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }

/* ── 顶栏 ───────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: var(--s2);
  padding: 11px clamp(14px, 1.6vw, 28px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 12;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand__mark {
  flex: 0 0 auto; width: 32px; height: 32px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 4px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
}
.brand__mark i { border: 1px solid var(--line-strong); border-radius: 2px; }
.brand__mark i:nth-child(2) { background: var(--accent); border-color: var(--accent); }
.brand__kicker { display: block; font-size: var(--fs-micro); letter-spacing: .16em; color: var(--text-3); white-space: nowrap; }
.brand__title { margin: 2px 0 0; font-size: var(--fs-h1); font-weight: 700; letter-spacing: -.015em; white-space: nowrap; }
.spec {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font-family: var(--mono); font-size: var(--fs-micro); color: var(--text-3);
  white-space: nowrap;
}
.spec b { color: var(--accent); font-weight: 700; }
.spec em { font-style: normal; border: 1px solid var(--accent); color: var(--accent); border-radius: 3px; padding: 1px 5px; }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.topbar__divider { width: 1px; height: 24px; background: var(--line-strong); margin: 0 3px; }

.seg { display: flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.seg button {
  border: 0; border-right: 1px solid var(--line);
  background: transparent; color: var(--text-2);
  padding: 7px 10px; font-size: var(--fs-micro); font-weight: 700;
  cursor: pointer; white-space: nowrap; transition: background .18s, color .18s;
}
.seg button:last-child { border-right: 0; }
.seg button:hover:not(.is-active) { background: var(--surface-2); color: var(--text); }
.seg button.is-active { background: var(--accent); color: var(--accent-ink); }
.tbtn {
  border: 1px solid var(--line); background: transparent; color: var(--text-2);
  border-radius: var(--r-sm); padding: 7px 10px;
  font-size: var(--fs-micro); font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: background .18s, border-color .18s, color .18s;
}
.tbtn:hover, .tbtn[aria-expanded="true"] { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); }
.tbtn--icon { font-size: 17px; line-height: 1; padding: 6px 10px; }

/* ── 3D 舞台 ────────────────────────────────────────────── */
.stage {
  position: relative; min-height: 0; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(38, 66, 74, .34), transparent 66%),
    var(--stage);
}
.stage::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: .55;
}
[data-theme="light"] .stage { background: radial-gradient(ellipse at 50% 42%, rgba(255,255,255,.8), transparent 68%), var(--stage); }
[data-theme="light"] .label { color: #8A4B00; border-color: rgba(168, 90, 12, .6); }
[data-theme="light"] .label:hover, [data-theme="light"] .label.is-active { background: var(--pin); color: #fff; border-color: var(--pin); }
[data-theme="light"] .label.is-expanded .label__no { color: var(--accent); }
[data-theme="light"] .leaders polyline { stroke: rgba(168, 90, 12, .55); }
[data-theme="light"] .leaders circle { fill: var(--accent); }
/* 中央画布 + 四周标注带：3D 结构永远不会被讲解卡遮挡 */
.stage__gl { position: absolute; inset: 66px 208px 66px 208px; }
/* 详情浮层打开时画布左收，板面整体避开浮层 */
@media (min-width: 1001px) {
  .app.has-panel .stage__gl { right: 400px; }
}
.stage__gl canvas { display: block; width: 100%; height: 100%; outline: none; cursor: grab; }
.stage__gl canvas:active { cursor: grabbing; }

.leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.leaders polyline { fill: none; stroke: rgba(255, 180, 84, .5); stroke-width: 1.2; stroke-linejoin: round; }
.leaders polyline.is-dim { stroke: rgba(255, 180, 84, .22); }
.leaders polyline.is-active { stroke: var(--accent-2); stroke-width: 2; }
.leaders circle { fill: var(--pin); }
.leaders circle.is-active { fill: var(--accent-2); }
[data-leaders="off"] .leaders { display: none; }

.labels { position: absolute; inset: 0; pointer-events: none; z-index: 4; }

/* 部件标注：紧凑态是编号点，展开态是紧贴的讲解卡 */
.label {
  position: absolute; top: 0; left: 0;
  width: 32px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 180, 84, .66);
  border-radius: 5px;
  background: var(--label-bg);
  color: #FFD79A;
  font: 700 calc(10.5px * var(--type-scale)) / 1 var(--mono);
  letter-spacing: -.02em;
  cursor: pointer;
  pointer-events: auto;
  white-space: nowrap;
  will-change: transform;
  transition: background .16s, border-color .16s, box-shadow .16s, opacity .16s;
  backdrop-filter: blur(5px);
}
.label:hover, .label.is-active { background: var(--pin); color: var(--pin-ink); border-color: var(--pin); z-index: 6; }
.label.is-active { box-shadow: 0 0 0 4px rgba(255, 180, 84, .24); }
.label.is-dim { opacity: .32; }
.label__name, .label__brief { display: none; }

.label.is-expanded {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 7px; row-gap: 2px;
  align-content: center;
  width: 200px; height: 44px;
  padding: 5px 9px 5px 8px;
  border-left: 2px solid var(--pin);
  text-align: left;
}
.label.is-expanded .label__no {
  display: block; grid-row: 1; grid-column: 1; align-self: center;
  font: 700 calc(9px * var(--type-scale)) / 1 var(--mono);
  color: var(--pin); letter-spacing: .06em;
}
.label.is-expanded .label__name {
  display: block; grid-row: 1; grid-column: 2;
  font-size: calc(14px * var(--type-scale)); font-weight: 700;
  line-height: 1.15; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.label.is-expanded .label__brief {
  display: block; grid-row: 2; grid-column: 1 / -1;
  font-size: calc(11.5px * var(--type-scale));
  line-height: 1.15; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.label.is-expanded:hover, .label.is-expanded.is-active { background: var(--label-bg); color: var(--text); }
.label.is-expanded.is-active { border-color: var(--accent-2); border-left-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(103, 215, 196, .18); }
.label.is-expanded .label__no { color: var(--pin); }
.label.is-hovered { z-index: 7; }

/* 功能区标签 */
.zonelabel {
  position: absolute; top: 0; left: 0;
  width: 152px; height: 30px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 9px;
  border: 1px solid rgba(255, 180, 84, .55);
  border-radius: 5px;
  background: var(--label-bg);
  color: var(--text);
  cursor: pointer; pointer-events: auto;
  will-change: transform;
  backdrop-filter: blur(6px);
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.zonelabel:hover, .zonelabel.is-active { border-color: var(--pin); box-shadow: 0 0 0 3px rgba(255, 180, 84, .18); }
.zonelabel__letter {
  flex: 0 0 auto; width: 19px; height: 19px;
  display: grid; place-items: center;
  background: var(--pin); color: var(--pin-ink);
  border-radius: 3px; font: 700 calc(11px * var(--type-scale)) / 1 var(--mono);
}
.zonelabel__head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.zonelabel__name { font-size: calc(12px * var(--type-scale)); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zonelabel__brief { display: none; }
.zonelabel.is-large {
  width: 236px; height: 62px;
  flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px;
  padding: 7px 11px;
  border-left: 3px solid var(--pin);
}
.zonelabel.is-large .zonelabel__head { display: flex; align-items: center; gap: 8px; }
.zonelabel.is-large .zonelabel__name { font-size: calc(14px * var(--type-scale)); }
.zonelabel.is-large .zonelabel__brief {
  display: block; font-size: calc(10.5px * var(--type-scale));
  color: var(--text-3); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; max-width: 100%; white-space: nowrap;
}
.zonelabel.is-large .zonelabel__letter { width: 22px; height: 22px; }

/* 舞台上的辅助信息 */
.stage__guide {
  position: absolute; left: 18px; top: 16px; z-index: 5;
  display: flex; align-items: center; gap: 9px;
  padding: 7px 11px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel); color: var(--text-2);
  font-size: var(--fs-micro); pointer-events: none;
  backdrop-filter: blur(8px);
}
.stage__guide-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 4px rgba(103, 215, 196, .16); }
.scalebar {
  position: absolute; left: 18px; bottom: 16px; z-index: 5;
  display: flex; flex-direction: column; gap: 5px;
  font: 600 var(--fs-micro) / 1 var(--mono); color: var(--text-2); pointer-events: none;
}
.scalebar__line { width: 72px; height: 7px; border: 1px solid var(--text-2); border-top: 0; }
.viewtag {
  position: absolute; right: 18px; top: 16px; z-index: 5;
  padding: 7px 11px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--panel); color: var(--accent);
  font: 700 var(--fs-micro) / 1 var(--mono); letter-spacing: .12em;
  pointer-events: none; backdrop-filter: blur(8px);
}
.glfallback {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: var(--s4); text-align: center;
  background: var(--stage); color: var(--text-2);
}
.glfallback b { font-size: var(--fs-name); color: var(--accent); }
.glfallback p { max-width: 46ch; line-height: 1.8; font-size: var(--fs-body); }

/* ── 底栏 ───────────────────────────────────────────────── */
.statusbar {
  display: flex; align-items: center; gap: var(--s2);
  padding: 8px clamp(14px, 1.6vw, 28px);
  background: var(--surface); border-top: 1px solid var(--line);
  z-index: 12;
}
.statusbar__left, .statusbar__right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.statusbar__right { margin-left: auto; }
.zoom, .levelinfo { display: flex; flex-direction: column; gap: 2px; }
.zoom b, .levelinfo b { font: 700 var(--fs-small) / 1.1 var(--mono); color: var(--accent); }
.zoom small, .levelinfo small { font-size: var(--fs-micro); color: var(--text-3); }
.status-sep { width: 1px; height: 26px; background: var(--line-strong); }
.zonebar { display: flex; align-items: center; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.zonebar::-webkit-scrollbar { display: none; }
.zonebtn {
  flex: 0 0 auto; display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: transparent; color: var(--text-2);
  padding: 6px 10px; font-size: var(--fs-micro); font-weight: 700;
  cursor: pointer; white-space: nowrap; transition: border-color .18s, background .18s, color .18s;
}
.zonebtn:hover { border-color: var(--line-strong); color: var(--text); }
.zonebtn.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.zonebtn__letter { font-family: var(--mono); color: var(--accent); }
kbd {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px;
  background: var(--surface-2); color: var(--text-2);
  font: 600 calc(10px * var(--type-scale)) / 1 var(--mono);
}
.keys { font-size: var(--fs-micro); color: var(--text-3); white-space: nowrap; }
.tourbtn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--text-2);
  border-radius: var(--r-sm); padding: 6px 10px;
  font-size: var(--fs-micro); font-weight: 700; cursor: pointer; white-space: nowrap;
}
.tourbtn:hover { border-color: var(--accent); color: var(--text); }
.tourbtn.is-running { border-color: var(--accent); color: var(--accent); }
.tourbtn__icon { width: 0; height: 0; border-left: 7px solid currentColor; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.tourbtn.is-running .tourbtn__icon { width: 8px; height: 10px; border: 0; background: currentColor; }

/* ── 详细讲解浮层 ───────────────────────────────────────── */
.inspector {
  position: fixed; right: 16px; top: 82px; bottom: 70px;
  width: min(370px, calc(100vw - 32px));
  z-index: 30;
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  backdrop-filter: blur(16px);
  animation: panel-in .26s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes panel-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.inspector__head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px var(--s3); border-bottom: 1px solid var(--line);
}
.inspector__zone {
  border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 4px 10px; font-size: var(--fs-micro); font-weight: 700; color: var(--text-2);
}
.inspector__no { margin-left: auto; font: 700 calc(26px * var(--type-scale)) / 1 var(--mono); color: var(--accent); letter-spacing: -.04em; }
.inspector__close { border: 0; background: transparent; color: var(--text-3); font-size: 24px; line-height: 1; cursor: pointer; padding: 0 3px; }
.inspector__close:hover { color: var(--text); }
.inspector__body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--s3); scrollbar-width: thin; }
.inspector__name { margin: 0; font-size: var(--fs-name); font-weight: 700; letter-spacing: -.02em; line-height: 1.2; text-wrap: pretty; }
.inspector__en { margin: 6px 0 0; font: 500 var(--fs-micro) / 1.4 var(--mono); letter-spacing: .09em; color: var(--text-3); text-transform: uppercase; }
.inspector__brief { margin: var(--s2) 0 0; font-size: var(--fs-body); font-weight: 600; line-height: 1.5; color: var(--accent); text-wrap: pretty; }
.hairline { height: 1px; background: var(--line-strong); margin: var(--s3) 0; }
.block { margin-bottom: var(--s3); }
.block__title { display: flex; align-items: center; gap: 9px; margin: 0 0 10px; font-size: var(--fs-micro); font-weight: 700; letter-spacing: .16em; color: var(--text-3); }
.block__idx { font-family: var(--mono); color: var(--accent); letter-spacing: 0; }
.inspector__desc { margin: 0; font-size: var(--fs-body); line-height: 1.8; color: var(--text-2); text-wrap: pretty; }
.points { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.points li { position: relative; padding-left: 18px; font-size: var(--fs-body); line-height: 1.7; color: var(--text-2); text-wrap: pretty; }
.points li::before { content: ""; position: absolute; left: 1px; top: .62em; width: 6px; height: 6px; background: var(--accent); border-radius: 1px; }
.block--tip { border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface-2); padding: var(--s2); }
.block--tip .block__title { margin-bottom: 8px; }
.inspector__tip { margin: 0; font-size: var(--fs-body); line-height: 1.75; color: var(--text); text-wrap: pretty; }
.inspector__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px var(--s3); border-top: 1px solid var(--line); }
.focusbtn {
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
  border-radius: var(--r-sm); padding: 8px 12px; font-size: var(--fs-micro); font-weight: 700; cursor: pointer;
}
.focusbtn:hover { background: var(--accent-soft); }
.inspector__nav { display: flex; align-items: center; gap: 9px; }
.navbtn { border: 1px solid var(--line); background: transparent; color: var(--text-2); border-radius: var(--r-sm); width: 32px; height: 30px; cursor: pointer; }
.navbtn:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.navbtn:disabled { opacity: .3; cursor: not-allowed; }
.navcount { font: 600 var(--fs-micro) / 1 var(--mono); color: var(--text-3); }

/* ── 使用说明 / Tweaks / toast ───────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(4, 9, 13, .74); backdrop-filter: blur(6px); }
.modal__box {
  position: relative; width: min(760px, calc(100vw - 40px)); max-height: min(84vh, 820px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 34px 90px rgba(0, 0, 0, .55);
}
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s2); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.modal__kicker { font: 600 var(--fs-micro) / 1 var(--mono); letter-spacing: .2em; color: var(--accent); }
.modal__head h2 { margin: 9px 0 0; font-size: calc(var(--fs-name) * .8); }
.modal__close { border: 0; background: transparent; color: var(--text-3); font-size: 28px; line-height: 1; cursor: pointer; }
.modal__close:hover { color: var(--text); }
.modal__body { padding: var(--s3) var(--s4) var(--s4); }
.guide { margin-bottom: var(--s4); }
.guide:last-child { margin-bottom: 0; }
.guide h3 { margin: 0 0 var(--s2); font-size: var(--fs-body); }
.guide ul { margin: 0; padding-left: 20px; display: grid; gap: 9px; }
.guide li, .guide p, .guide b { font-size: var(--fs-small); line-height: 1.8; color: var(--text-2); }
.guide b { color: var(--text); }
.guide code { font-family: var(--mono); font-size: .92em; padding: 2px 5px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); color: var(--accent); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.steps li { display: flex; gap: var(--s2); align-items: flex-start; }
.steps li p { margin: 4px 0 0; }
.step__no { flex: 0 0 auto; width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--accent); border-radius: 50%; color: var(--accent); font: 700 var(--fs-small) / 1 var(--mono); }
.guide__note { margin: var(--s3) 0 0; padding: var(--s2); border: 1px dashed var(--line-strong); border-radius: var(--r-sm); }

.tweaks {
  position: fixed; right: 16px; bottom: 66px; z-index: 50; width: 310px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .48); padding: 14px;
}
.tweaks__head { display: flex; align-items: center; justify-content: space-between; font: 700 var(--fs-micro) / 1 var(--mono); letter-spacing: .12em; color: var(--text-3); padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.tweaks__head button { border: 0; background: transparent; color: var(--text-3); font-size: 20px; line-height: 1; cursor: pointer; }
.tweaks__row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.tweaks__row:last-child { border-bottom: 0; padding-bottom: 2px; }
.tweaks__row label { display: block; font-size: var(--fs-small); font-weight: 700; margin-bottom: 8px; }
.tweaks__row label span { display: block; font-size: var(--fs-micro); font-weight: 400; color: var(--text-3); margin-top: 3px; }
.tweaks__row .seg button { padding: 7px 4px; }

.toast {
  position: fixed; left: 50%; bottom: 68px; transform: translate(-50%, 12px); z-index: 70;
  padding: 10px 18px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font-size: var(--fs-small);
  box-shadow: 0 14px 36px rgba(0,0,0,.4); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ── 响应式 ─────────────────────────────────────────────── */
@media (max-width: 1400px) {
  .spec { display: none; }
  .keys { display: none; }
}
@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; }
  .topbar__actions { width: 100%; margin-left: 0; }
  .topbar__divider { display: none; }
  .zonebar { flex: 1; }
  .inspector { width: 330px; }
}
@media (max-width: 1000px) {
  /* 窄屏没有足够的环绕标注带，画布铺开、标注回到紧凑编号模式 */
  .stage__gl { inset: 46px 12px 46px 12px; }
}
@media (max-width: 820px) {
  .statusbar { flex-wrap: wrap; gap: 8px; }
  .zonebar { order: 3; width: 100%; flex: 1 0 100%; }
  .statusbar__right { margin-left: 0; }
  .inspector {
    top: auto; right: 0; left: 0; bottom: 0; width: 100%;
    height: 52vh; border-radius: 14px 14px 0 0;
    animation-name: panel-up;
  }
  @keyframes panel-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
  .label.is-expanded { width: 168px; height: 38px; }
  .zonelabel.is-large { width: 200px; height: 56px; }
  .scalebar { bottom: 12px; }
}
/* 固定的五五分栏：切换讲解时画布尺寸不变，避免重排闪烁。 */
body { -webkit-user-select: none; user-select: none; }
.workspace { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.workspace .stage { position: absolute; inset: 0; right: 0; transition: right .45s cubic-bezier(.22,.7,.2,1); }
.app.has-panel .workspace .stage { right: 50%; }
.reading { position: absolute; top: 0; right: 0; bottom: 0; width: 50%; min-width: 0; overflow: hidden; background: var(--surface); border-left: 1px solid var(--line-strong); transform: translateX(100%); visibility: hidden; pointer-events: none; transition: transform .45s cubic-bezier(.22,.7,.2,1), visibility 0s linear .45s; }
.app.has-panel .reading { transform: translateX(0); visibility: visible; pointer-events: auto; transition-delay: 0s; }
.reading__empty { max-width: 620px; padding: clamp(28px, 5vw, 80px); }
.reading__empty span { font: 700 var(--fs-micro) / 1.4 var(--mono); letter-spacing: .14em; color: var(--accent); }
.reading__empty h2 { margin: 28px 0 18px; font-size: clamp(28px, 3vw, 48px); line-height: 1.2; }
.reading__empty p { color: var(--text-2); line-height: 1.9; max-width: 34em; }
.inspector { position: static; width: 100%; height: 100%; border: 0; border-radius: 0; box-shadow: none; animation: none; backdrop-filter: none; }
.inspector__body { padding: clamp(24px, 3vw, 48px); }
.inspector__head, .inspector__foot { padding-left: clamp(24px, 3vw, 48px); padding-right: clamp(24px, 3vw, 48px); }
.stage__gl, .app.has-panel .stage__gl { inset: 65px 12px; }
@media (max-width: 820px) {
  .app.has-panel .workspace .stage { right: 0; bottom: 50%; }
  .workspace .stage { transition-property: bottom; }
  .reading { top: 50%; bottom: 0; width: 100%; border-left: 0; border-top: 1px solid var(--line-strong); transform: translateY(100%); }
  .app.has-panel .reading { transform: translateY(0); }
  .reading__empty { padding: 24px; }
  .reading__empty h2 { margin: 12px 0; font-size: 26px; }
  .reading__empty p { margin: 8px 0; }
  .inspector { position: static; width: 100%; height: 100%; border-radius: 0; animation: none; }
  .stage__guide { display: none; }
}
@media (max-width: 560px) {
  .brand__title { font-size: 17px; white-space: normal; }
  .seg button { padding: 6px 7px; font-size: 10px; }
  .tbtn { padding: 6px 7px; font-size: 10px; }
  .stage__guide { display: none; }
  .viewtag { top: 10px; right: 10px; }
  .tweaks { right: 8px; left: 8px; width: auto; }
}
