/* 總經示波器 — 桌上型示波器前面板 */

:root {
  --chassis: #d8d5ce;
  --chassis-hi: #e6e3dc;
  --chassis-lo: #c7c3ba;
  --panel: #cfcbc3;
  --panel-edge: #b3aea4;
  --ink: #1a1c1f;
  --ink-2: #474a4f;
  --ink-3: #505256;
  --rule: rgba(26, 28, 31, 0.16);

  --key-top: #f3f1ec;
  --key-bot: #dcd9d1;
  --key-ink: #1a1c1f;
  --key-edge: rgba(0, 0, 0, 0.2);

  --bezel: #0b0d0f;
  --screen: #111416;
  --screen-hi: #171b1e;
  --screen-text: #c7d1d6;
  --screen-dim: #8a979e;
  --grid: rgba(170, 196, 208, 0.13);
  --grid-strong: rgba(170, 196, 208, 0.3);

  --ch1: #f2c230;
  --ch2: #3fc6d9;
  --ch3: #e2468f;
  --ch4: #72d38b;
  --ch0: #c7d1d6;
  --delta: #ff5a1f;
  --delta-ink: #a33208;
  --led-on: #5ee08f;
  --led-off: #6c6f68;

  --knob-skirt: #2c2f33;
  --knob-face: #3b3f44;
  --knob-pointer: #f4f1ea;

  --f-sans: "Archivo", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --f-zh: "Noto Sans TC", "Archivo", "Microsoft JhengHei", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "Noto Sans TC", monospace;

  --r-lg: 14px;
  --r-md: 8px;
  --r-sm: 4px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --chassis: #1f2124;
    --chassis-hi: #2a2d31;
    --chassis-lo: #18191c;
    --panel: #26292d;
    --panel-edge: #0f1012;
    --ink: #e8e5de;
    --ink-2: #b4b2ab;
    --ink-3: #8f8e89;
    --rule: rgba(232, 229, 222, 0.14);
    --key-top: #3a3d42;
    --key-bot: #2c2f33;
    --key-ink: #ece9e2;
    --key-edge: rgba(0, 0, 0, 0.55);
    --delta-ink: #ff7a45;
    --knob-skirt: #121315;
    --knob-face: #202226;
    --led-off: #4a4c48;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --chassis: #1f2124; --chassis-hi: #2a2d31; --chassis-lo: #18191c; --panel: #26292d; --panel-edge: #0f1012;
  --ink: #e8e5de; --ink-2: #b4b2ab; --ink-3: #8f8e89; --rule: rgba(232, 229, 222, 0.14);
  --key-top: #3a3d42; --key-bot: #2c2f33; --key-ink: #ece9e2; --key-edge: rgba(0, 0, 0, 0.55);
  --delta-ink: #ff7a45; --knob-skirt: #121315; --knob-face: #202226; --led-off: #4a4c48;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--chassis);
  /* 噴砂鋁：極淡的水平拉絲 */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, var(--chassis-hi), var(--chassis) 420px);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--ch1); color: #111; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

html { scrollbar-color: var(--ink-3) var(--chassis-lo); }
::-webkit-scrollbar { width: 12px; height: 10px; }
::-webkit-scrollbar-track { background: var(--chassis-lo); }
::-webkit-scrollbar-thumb { background: var(--ink-3); border-radius: 6px; border: 3px solid var(--chassis-lo); }

.skip { position: absolute; left: -9999px; top: 8px; background: var(--ink); color: var(--chassis); padding: 8px 14px; z-index: 10; border-radius: var(--r-sm); }
.skip:focus { left: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------ 頂部機殼條 */
.topbar {
  display: flex;
  align-items: center;
  gap: 32px;
  max-width: 1480px;
  margin: 0 auto;
  padding: 20px 28px 16px;
}
.brand { display: flex; align-items: center; gap: 14px; flex: none; }
.brand-mark { width: 46px; height: 32px; }
.brand-mark rect { fill: var(--screen); stroke: var(--bezel); stroke-width: 1.5; }
.brand-mark path { fill: none; stroke-width: 2.4; stroke-linecap: round; }
.brand-mark .bm1 { stroke: var(--ch1); }
.brand-mark .bm2 { stroke: var(--ch2); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-en {
  font-weight: 800;
  font-stretch: 125%;
  font-size: 19px;
  letter-spacing: 0.06em;
}
.brand-zh { font-family: var(--f-zh); font-size: 12.5px; color: var(--ink-2); letter-spacing: 0.02em; margin-top: 3px; }

.modes { flex: 1; min-width: 0; }
.mode-keys {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 2px 6px;
}
.mode-keys::-webkit-scrollbar { display: none; }

/* ------------------------------------------------------------ 硬體按鍵 */
.hwkey {
  appearance: none;
  position: relative;
  display: inline-grid;
  grid-template-columns: auto;
  justify-items: start;
  gap: 1px;
  min-height: 48px;
  padding: 8px 14px 8px 14px;
  border: 1px solid var(--key-edge);
  border-radius: 6px;
  background: linear-gradient(180deg, var(--key-top), var(--key-bot));
  color: var(--key-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 1px 0 rgba(0, 0, 0, 0.22),
    0 3px 6px -2px rgba(0, 0, 0, 0.28);
  transition: transform 90ms ease-out, box-shadow 90ms ease-out, background-color 150ms;
  white-space: nowrap;
}
.hwkey:hover { background: linear-gradient(180deg, var(--key-top), color-mix(in srgb, var(--key-bot) 85%, var(--ink) 6%)); }
.hwkey:active, .hwkey.on {
  transform: translateY(1px);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.22), 0 0 0 rgba(0, 0, 0, 0);
}
.hwkey-en {
  font-weight: 700;
  font-stretch: 112%;
  font-size: 11.5px;
  letter-spacing: 0.1em;
  line-height: 1.2;
}
.hwkey-zh { font-family: var(--f-zh); font-size: 12.5px; color: var(--ink-2); line-height: 1.35; letter-spacing: 0.02em; }

.led {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--led-off);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.45);
}
.on > .led, .hwkey.on .led {
  background: var(--led-on);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.7), inset 0 -1px 1px rgba(0, 0, 0, 0.25);
}

.hwkey.mode { padding-left: 30px; min-width: 116px; }
.hwkey.mode .led { position: absolute; left: 12px; top: 14px; }
.hwkey.mode.on { background: linear-gradient(180deg, var(--key-bot), var(--key-top)); }

/* ------------------------------------------------------------ 儀器本體 */
main { max-width: 1480px; margin: 0 auto; padding: 0 28px 80px; }

.instrument {
  position: relative;
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 70%, var(--chassis-hi)), var(--panel));
  border: 1px solid var(--panel-edge);
  border-radius: var(--r-lg);
  padding: 22px 30px 30px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 1px 0 rgba(0, 0, 0, 0.12),
    0 14px 24px -16px rgba(20, 18, 14, 0.4);
}
.inst-head {
  display: flex; align-items: baseline; gap: 20px; flex-wrap: wrap;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.inst-head h1 {
  margin: 0;
  font-size: clamp(24px, 2.4vw, 34px);
  font-weight: 800;
  font-stretch: 100%;
  line-height: 1.2;
}
.inst-tag { margin: 0; font-family: var(--f-zh); color: var(--ink-2); font-size: 16px; }

.inst-body {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(340px, 1fr);
  gap: 28px;
  align-items: start;
}

/* 顯示區 */
.bezel {
  background: var(--bezel);
  border-radius: 12px;
  padding: 10px 10px 12px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7), 0 1px 0 rgba(255, 255, 255, 0.35);
}
.status {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  min-height: 30px;
  padding: 2px 8px 8px;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--screen-dim);
  letter-spacing: 0.04em;
}
.st-model { color: var(--screen-text); font-weight: 700; background: #262b2f; padding: 1px 8px; border-radius: 3px; }
.st-ch { display: inline-flex; align-items: center; gap: 6px; color: var(--screen-text); }
.st-ch i { width: 16px; height: 3px; border-radius: 2px; background: currentColor; }
.st-ch.ch1 i { background: var(--ch1); } .st-ch.ch2 i { background: var(--ch2); }
.st-ch.ch3 i { background: var(--ch3); } .st-ch.ch4 i { background: var(--ch4); }
.st-sep { flex: 1; }
.st-persist { color: var(--screen-dim); }
.st-persist.on { color: var(--screen-text); }
.st-flag { display: inline-flex; align-items: center; gap: 6px; color: var(--ch1); font-family: var(--f-zh); }
.st-flag svg { width: 13px; height: 13px; fill: none; stroke: var(--ch1); stroke-width: 1.6; }
.st-flag svg path:last-child { fill: var(--ch1); }

.screen-box { position: relative; }
.screen {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 4;
  border-radius: 6px;
  background: radial-gradient(ellipse at 50% 45%, var(--screen-hi), var(--screen) 75%);
  --k: 1;
  touch-action: pan-y;
}
.screen.sub { aspect-ratio: 10 / 3; }

.screen .grid { stroke: var(--grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.screen .grid-tick { stroke: var(--grid-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.screen .grid-frame { fill: none; stroke: var(--grid-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.screen .zero-line { stroke: rgba(199, 209, 214, 0.35); stroke-width: 1; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
.screen .tick-label { fill: var(--screen-dim); font-family: var(--f-mono); font-size: calc(16px * var(--k)); font-variant-numeric: tabular-nums; }
.screen .axis-title { fill: var(--screen-text); font-family: var(--f-zh); font-size: calc(18px * var(--k)); font-weight: 500; }

.screen .trace { fill: none; stroke-width: 2.6px; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.screen .trace.thin { stroke-width: 1.3px; stroke-dasharray: 6 5; }
.screen .trace.ghost { stroke-width: 1.4px; stroke-dasharray: 3 5; opacity: 0.55; }
.ch0 { --c: var(--ch0); } .ch1 { --c: var(--ch1); } .ch2 { --c: var(--ch2); } .ch3 { --c: var(--ch3); } .ch4 { --c: var(--ch4); }
.screen .trace { stroke: var(--c); }

.screen .trace-label .leader { stroke: var(--c); stroke-width: 1; vector-effect: non-scaling-stroke; }
.screen .trace-label .tag { fill: #0d1012; stroke: var(--c); stroke-width: 1; vector-effect: non-scaling-stroke; }
.screen .trace-label .tag-text { fill: var(--c); font-family: var(--f-mono); font-weight: 700; font-size: calc(17px * var(--k)); }
.screen .trace-label.dim { opacity: 0.6; }
.screen .trace-label.dim .tag { stroke-dasharray: 3 3; }

.screen .cursor { stroke: rgba(230, 236, 239, 0.45); stroke-width: 1; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.screen .eq-ring { fill: none; stroke: #f4f1ea; stroke-width: 1.6px; vector-effect: non-scaling-stroke; }
.screen .eq-dot { fill: #f4f1ea; }
.screen .eq-text { fill: #f4f1ea; font-family: var(--f-mono); font-weight: 700; font-size: calc(18px * var(--k)); }
.screen .eq-ghost { fill: none; stroke: rgba(230, 236, 239, 0.55); stroke-width: 1.2px; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.screen .eq-ghost-text { fill: var(--screen-dim); font-family: var(--f-mono); font-size: calc(16px * var(--k)); }
.screen .delta-arrow { stroke: var(--delta); stroke-width: 2.4px; vector-effect: non-scaling-stroke; }
.screen .arrow-head { fill: var(--delta); }
.screen .axis-tag rect { fill: #e9e6df; }
.screen .axis-tag text { fill: #111416; font-family: var(--f-mono); font-weight: 700; font-size: calc(15px * var(--k)); font-variant-numeric: tabular-nums; }

.screen .mark-drop { stroke: rgba(199, 209, 214, 0.3); stroke-width: 1; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
.screen .mark-dot { fill: var(--ch4); }
.screen .mark-gold { fill: none; stroke: var(--ch3); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.screen .mark-lr { fill: none; stroke: var(--ch4); stroke-width: 2px; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.screen .mark-text { fill: var(--screen-text); font-family: var(--f-zh); font-size: calc(16px * var(--k)); }
.screen .trail { fill: none; stroke: var(--ch3); stroke-width: 1.4px; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.screen .trail-dot { fill: var(--ch3); }
.screen .trail-text { fill: var(--ch3); font-family: var(--f-mono); font-size: calc(14px * var(--k)); }

.offscreen {
  position: absolute; right: 14px; top: 14px;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--delta);
  border-radius: 4px;
  background: rgba(17, 20, 22, 0.92);
  color: #f4f1ea;
  font-family: var(--f-zh); font-size: 13px;
  cursor: pointer;
}
.offscreen b { font-family: var(--f-mono); color: var(--delta); letter-spacing: 0.08em; }
.offscreen[hidden] { display: none; }

.sub-wrap { margin-top: 10px; }
.sub-wrap[hidden] { display: none; }
.sub-title { font-family: var(--f-mono); font-size: 12px; color: var(--screen-dim); padding: 2px 8px 8px; letter-spacing: 0.04em; }

/* 量測列 */
.readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 1px;
  margin-top: 14px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
}
.meas { background: var(--panel); padding: 10px 14px 11px; }
.meas-head { display: flex; align-items: baseline; gap: 8px; }
.meas-sym { font-family: var(--f-mono); font-weight: 700; font-size: 13px; }
.meas-zh { font-family: var(--f-zh); font-size: 12px; color: var(--ink-2); }
.meas-val { font-family: var(--f-mono); font-size: 24px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.35; letter-spacing: 0; }
.meas-delta { font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.meas.changed .meas-delta { color: var(--delta-ink); font-weight: 700; }

/* ------------------------------------------------------------ 面板 */
.panel { display: flex; flex-direction: column; gap: 22px; }
.panel-sec { display: flex; flex-direction: column; gap: 12px; }
.silk {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}
.silk > span:first-child {
  font-weight: 700;
  font-stretch: 125%;
  font-size: 11.5px;
  letter-spacing: 0.16em;
}
.silk-zh { font-family: var(--f-zh); font-size: 13px; color: var(--ink-2); }
.silk-hint { font-family: var(--f-zh); font-size: 12px; color: var(--ink-3); margin-left: auto; }

.knob-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
  gap: 14px 10px;
}
.knob { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.knob-label { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; line-height: 1.25; text-align: center; height: 50px; }
.knob-sym { font-family: var(--f-mono); font-weight: 700; font-size: 15px; }
.knob-zh { font-family: var(--f-zh); font-size: 12px; color: var(--ink-2); letter-spacing: 0.02em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 100%; }
.knob-dial {
  width: 82px; height: 82px;
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.knob.turning .knob-dial { cursor: grabbing; }
.knob-dial:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.knob-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.knob-tick { stroke: var(--ink-3); stroke-width: 1; }
.knob-tick.major { stroke: var(--ink-2); stroke-width: 1.6; }
.knob-track { fill: none; stroke: var(--rule); stroke-width: 3; stroke-linecap: round; }
.knob-delta { fill: none; stroke: var(--delta); stroke-width: 4.5; stroke-linecap: round; }
.knob-ref { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; opacity: 0; }
.knob.changed .knob-ref { opacity: 0.8; }
.knob-cap { transition: transform 60ms linear; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.35)); }
.knob.turning .knob-cap { transition: none; }
.knob-skirt { fill: var(--knob-skirt); }
.knob-face { fill: var(--knob-face); stroke: rgba(255, 255, 255, 0.12); stroke-width: 1; }
.knob-pointer { stroke: var(--knob-pointer); stroke-width: 4; stroke-linecap: round; }
.knob-value {
  font-family: var(--f-mono); font-size: 14px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  padding: 1px 8px;
  border-radius: 3px;
  background: var(--screen);
  color: var(--screen-text);
  min-width: 64px; text-align: center;
  letter-spacing: 0;
}
.knob.changed .knob-value { color: #ffb08f; box-shadow: inset 0 -2px 0 var(--delta); }
.knob.changed .knob-sym { color: var(--delta-ink); }
.knob-lock { font-family: var(--f-zh); font-size: 11px; color: var(--ink-3); text-align: center; line-height: 1.4; max-width: 120px; }
.knob-lock:empty { display: none; }
.knob.locked .knob-dial { opacity: 0.35; cursor: not-allowed; }
.knob.locked .knob-value { opacity: 0.45; }
.knob:hover:not(.locked) .knob-face { fill: color-mix(in srgb, var(--knob-face) 88%, white); }

/* 制度切換開關 */
.knob.switch { grid-column: span 2; align-items: stretch; }
.knob.switch .knob-label { align-items: flex-start; height: auto; margin-bottom: 6px; flex-direction: row; gap: 8px; align-items: baseline; }
.sw-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-radius: 6px; overflow: hidden; border: 1px solid var(--key-edge); }
.sw-opt {
  appearance: none; border: 0; font: inherit; cursor: pointer;
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  padding: 9px 12px; text-align: left;
  background: linear-gradient(180deg, var(--key-top), var(--key-bot));
  color: var(--key-ink);
}
.sw-opt + .sw-opt { border-left: 1px solid var(--key-edge); }
.sw-opt .led { grid-row: span 2; }
.sw-opt.on { background: linear-gradient(180deg, var(--key-bot), var(--key-top)); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.18); }
.sw-en { font-weight: 700; font-stretch: 112%; font-size: 11.5px; letter-spacing: 0.1em; }
.sw-zh { font-family: var(--f-zh); font-size: 12.5px; color: var(--ink-2); }
.knob.switch.changed .sw-opt.on .sw-en { color: var(--delta-ink); }

.key-row { display: flex; flex-wrap: wrap; gap: 8px; }
.key-row[hidden] { display: none; }
#scenarioKeys { display: grid; grid-template-columns: repeat(2, 1fr); }
.hwkey.scenario { width: 100%; }
.hwkey.action { flex: 1 1 100%; }
.fn-row { display: grid; grid-template-columns: repeat(4, 1fr); }
.hwkey.fnkey { padding-left: 12px; padding-right: 8px; }
.hwkey.fnkey .led { position: absolute; right: 9px; top: 11px; }
.hwkey.warn .hwkey-en { color: var(--ink); }

/* ------------------------------------------------------------ 說明區 */
.notes {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 24px 56px;
  margin-top: 64px;
}
.notes h2 {
  margin: 0 0 14px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
}
.notes h2:not(:first-child) { margin-top: 48px; }
.notes h3 { margin: 32px 0 12px; font-size: 16px; font-weight: 700; }

.explain { font-family: var(--f-zh); font-size: 16.5px; line-height: 1.85; max-width: 72ch; }
.ex-empty { margin: 0 0 12px; color: var(--ink-2); }
.ex-q { margin: 0; padding: 14px 18px; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-md); }
.ex-chain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.ex-chain li {
  display: grid;
  grid-template-columns: 56px 1fr;
  column-gap: 16px;
  align-items: start;
}
.ex-sym {
  grid-row: span 2;
  display: grid; place-items: center;
  height: 44px;
  border-radius: 6px;
  background: var(--screen);
  color: #ffb08f;
  font-family: var(--f-mono); font-weight: 700; font-size: 17px;
  box-shadow: inset 0 -2px 0 var(--delta);
}
.ex-move { font-weight: 500; }
.ex-move b { font-family: var(--f-mono); color: var(--delta-ink); font-weight: 700; }
.ex-why { color: var(--ink-2); }
.ex-result {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 22px;
  margin: 22px 0 0; padding: 12px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  font-family: var(--f-mono); font-size: 15px; font-variant-numeric: tabular-nums;
}
.ex-result-h { font-family: var(--f-zh); font-size: 13px; color: var(--ink-3); letter-spacing: 0.02em; }
.ex-res i { font-style: normal; font-weight: 700; }
.ex-res b { font-weight: 700; }
.ex-res em { font-style: normal; color: var(--delta-ink); font-size: 12px; }
.ex-insight p { margin: 16px 0 0; }

.note-sub { margin: -6px 0 14px; font-family: var(--f-zh); font-size: 14px; color: var(--ink-2); }
.equations { display: flex; flex-direction: column; gap: 8px; }
.eqn {
  display: grid; grid-template-columns: 76px 1fr; align-items: stretch;
  border-radius: var(--r-md); overflow: hidden;
  background: var(--screen);
  color: var(--screen-text);
}
.eqn-name {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  font-family: var(--f-mono); font-weight: 700; font-size: 13px;
  color: var(--c, var(--screen-text));
  background: #1a1e21;
}
.eqn-name.ch0 { color: var(--screen-dim); }
.eqn-body {
  padding: 10px 14px;
  font-family: var(--f-mono); font-size: 14.5px; line-height: 1.7;
  white-space: normal; overflow-wrap: anywhere;
  letter-spacing: 0;
}
.eq-num { color: #f4f1ea; }
.eq-num.changed { color: #ffb08f; text-decoration: underline; text-decoration-color: var(--delta); text-underline-offset: 4px; text-decoration-thickness: 2px; }

.notes-side { font-family: var(--f-zh); }
.model-q { margin: 0 0 14px; font-size: 18px; font-weight: 500; line-height: 1.75; }
.model-intro { margin: 0; color: var(--ink-2); line-height: 1.9; }
.curves { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.curves li p { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; line-height: 1.8; }
.cl-name { display: inline-flex; align-items: center; gap: 10px; font-family: var(--f-mono); font-weight: 700; font-size: 15px; }
.cl-name i { width: 26px; height: 4px; border-radius: 2px; background: var(--c); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25); }

.notes-wide { grid-column: 1 / -1; }
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r-md); }
.ptable { width: 100%; border-collapse: collapse; font-family: var(--f-zh); font-size: 14.5px; line-height: 1.75; }
.ptable th, .ptable td { text-align: left; vertical-align: top; padding: 12px 16px; border-bottom: 1px solid var(--rule); }
.ptable thead th { font-family: var(--f-sans); font-size: 12px; font-weight: 700; font-stretch: 112%; letter-spacing: 0.1em; color: var(--ink-2); background: var(--panel); }
.ptable tbody tr:last-child > * { border-bottom: 0; }
.ptable tbody th { width: 190px; font-weight: 400; }
.pt-sym { display: block; font-family: var(--f-mono); font-weight: 700; font-size: 16px; }
.pt-zh { display: block; font-weight: 500; }
.pt-en { display: block; font-family: var(--f-sans); font-size: 12px; color: var(--ink-3); letter-spacing: 0.02em; }
.pt-curve { font-family: var(--f-mono); white-space: nowrap; font-size: 13.5px; }
.ptable td { color: var(--ink-2); }
.ptable tr.changed .pt-sym { color: var(--delta-ink); }
.ptable tr.changed .pt-sym::after { content: " ●"; font-size: 10px; vertical-align: middle; }

.foot {
  max-width: 1480px; margin: 0 auto; padding: 28px 28px 48px;
  border-top: 1px solid var(--rule);
  font-family: var(--f-zh); font-size: 13.5px; color: var(--ink-2);
  display: flex; flex-wrap: wrap; gap: 8px 40px; justify-content: space-between;
}
.foot p { margin: 0; }
kbd {
  display: inline-block; min-width: 22px; padding: 0 6px; margin: 0 2px;
  font-family: var(--f-mono); font-size: 12px; text-align: center;
  border: 1px solid var(--key-edge); border-radius: 4px;
  background: linear-gradient(180deg, var(--key-top), var(--key-bot));
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
  color: var(--key-ink);
}

/* ------------------------------------------------------------ 動作偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------------ 響應式 */
@media screen and (max-width: 1180px) {
  .inst-body { grid-template-columns: minmax(0, 1fr); }
  .knob-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .notes { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .notes-side { order: -1; }
  .notes-side h3 { margin-top: 24px; }
}
@media screen and (max-width: 900px) {
  .topbar { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px 16px 12px; }
  .mode-keys { justify-content: flex-start; margin: 0 -16px; padding: 4px 16px 8px; }
  .hwkey.mode { min-width: 108px; }
  main { padding: 0 16px 56px; }
}
@media screen and (max-width: 640px) {
  .instrument { padding: 14px 12px 18px; border-radius: 10px; }
  .inst-head { gap: 4px 12px; }
  .mode-keys { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; margin: 0; padding: 2px 0 4px; overflow: visible; }
  .hwkey.mode { min-width: 0; padding: 18px 4px 7px; justify-items: center; text-align: center; white-space: normal; }
  .hwkey.mode .led { left: 50%; top: 7px; margin-left: -3.5px; width: 6px; height: 6px; }
  .hwkey.mode .hwkey-en { font-size: 10px; letter-spacing: 0.04em; font-stretch: 100%; }
  .hwkey.mode .hwkey-zh { font-size: 11px; line-height: 1.3; }
  .inst-tag { font-size: 14px; }
  .bezel { padding: 6px 6px 8px; border-radius: 9px; }
  .status { font-size: 11px; gap: 10px; }
  .readout { grid-template-columns: repeat(2, 1fr); }
  .meas-val { font-size: 20px; }
  .knob-grid { grid-template-columns: repeat(3, 1fr); gap: 12px 6px; }
  .knob-dial { width: 70px; height: 70px; }
  .silk-hint { margin-left: 0; flex-basis: 100%; }
  .fn-row { grid-template-columns: repeat(2, 1fr); }
  .knob.switch { grid-column: 1 / -1; }
  .notes { margin-top: 44px; }
  .ex-chain li { grid-template-columns: 46px 1fr; column-gap: 12px; }
  .eqn { grid-template-columns: 1fr; }
  .eqn-name { padding: 6px 12px; }
  /* 手機：螢幕黏在上方，轉旋鈕時仍看得到曲線 */
  .display {
    position: sticky; top: 0; z-index: 5;
    margin: 0 -12px; padding: 8px 12px 10px;
    background: var(--panel);
    box-shadow: 0 10px 14px -12px rgba(0, 0, 0, 0.45);
  }
  .readout { display: flex; overflow-x: auto; margin-top: 8px; scrollbar-width: none; }
  .readout::-webkit-scrollbar { display: none; }
  .meas { flex: 0 0 auto; min-width: 112px; padding: 6px 10px 7px; }
  .meas-val { font-size: 18px; }
  /* 旋鈕說明表改為堆疊 */
  .ptable thead { display: none; }
  .ptable, .ptable tbody, .ptable tr, .ptable th, .ptable td { display: block; width: auto; }
  .ptable tbody tr { padding: 14px 14px; border-bottom: 1px solid var(--rule); }
  .ptable tbody tr:last-child { border-bottom: 0; }
  .ptable th, .ptable td { padding: 0; border: 0; }
  .ptable tbody th { width: auto; margin-bottom: 6px; }
  .ptable .pt-sym, .ptable .pt-zh { display: inline; margin-right: 8px; }
  .ptable td + td { margin-top: 4px; }
  .pt-curve::before { content: "移動 "; font-family: var(--f-zh); color: var(--ink-3); }
}
