/* ==========================================================================
   格物 · 物理虚拟实验室
   蓝白视觉系统 / 响应式布局 / 无第三方依赖
   ========================================================================== */

:root {
  --bg: #f3f7fd;
  --bg-deep: #eaf3ff;
  --surface: #ffffff;
  --surface-soft: #f7fbff;
  --ink: #172a43;
  --ink-strong: #0f2340;
  --muted: #687c96;
  --muted-2: #8798ad;
  --line: #e0eaf7;
  --line-strong: #cfdff2;
  --accent: #2f6bff;
  --accent-strong: #1b53db;
  --accent-soft: #ebf2ff;
  --accent-ink: #1747bd;
  --teal: #0e8fa8;
  --success: #0f9f6e;
  --danger: #dc5564;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 10px 34px rgba(31, 69, 122, 0.055), 0 2px 7px rgba(31, 69, 122, 0.025);
  --shadow-float: 0 18px 50px rgba(21, 54, 103, 0.14);
  --font-sans: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Source Han Sans SC", "Segoe UI", sans-serif;
  --font-serif: "Cambria Math", "STIX Two Math", "Times New Roman", Georgia, serif;
  --sidebar-width: 272px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(1100px 500px at 88% -8%, rgba(79, 142, 255, 0.10), transparent 62%),
    radial-gradient(800px 420px at 30% 100%, rgba(128, 190, 255, 0.08), transparent 65%),
    var(--bg);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3, h4, p {
  margin: 0;
}

svg {
  display: block;
}

::selection {
  color: #fff;
  background: rgba(47, 107, 255, 0.78);
}

:focus-visible {
  outline: 2px solid rgba(47, 107, 255, 0.55);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.icon {
  flex: none;
}

/* --------------------------------------------------------------------------
   Boot
   -------------------------------------------------------------------------- */
.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  color: #6b83a4;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.boot-mark {
  display: flex;
  gap: 7px;
  align-items: center;
  height: 34px;
}

.boot-mark span {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2f6bff;
  animation: boot-bounce 1.1s infinite ease-in-out;
}

.boot-mark span:nth-child(2) {
  animation-delay: 0.13s;
  opacity: 0.72;
}

.boot-mark span:nth-child(3) {
  animation-delay: 0.26s;
  opacity: 0.44;
}

@keyframes boot-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-9px); }
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #fff;
  color: #172a43;
  font-size: 16px;
  z-index: 9000;
}

/* --------------------------------------------------------------------------
   Shell & sidebar
   -------------------------------------------------------------------------- */
.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(340px 260px at 20% 0%, rgba(107, 166, 255, 0.16), transparent 70%),
    linear-gradient(180deg, #f7fbff 0%, #eef6ff 54%, #f8fbff 100%);
  border-right: 1px solid #dbe8f8;
  box-shadow: 8px 0 32px rgba(54, 97, 154, 0.035);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 22px 16px;
}

.brand__mark {
  width: 42px;
  height: 42px;
  flex: none;
  filter: drop-shadow(0 8px 16px rgba(47, 107, 255, 0.23));
}

.brand__mark svg {
  width: 100%;
  height: 100%;
}

.brand__copy {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand__copy strong {
  font-size: 21px;
  letter-spacing: 0.13em;
  color: #10294b;
  font-weight: 800;
}

.brand__copy span {
  margin-top: 3px;
  font-size: 10.5px;
  letter-spacing: 0.17em;
  color: #748aab;
}

.sidebar__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 14px 14px;
  scrollbar-width: thin;
  scrollbar-color: #c8dbf3 transparent;
}

.sidebar__label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 9px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #8195b1;
  text-transform: uppercase;
}

.sidebar__count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: #e3efff;
  color: #3c6eb6;
  font-size: 10px;
  letter-spacing: 0;
}

.experiment-nav {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav-group__label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 3px;
  font-size: 10.5px;
  font-weight: 700;
  color: #8b9eb8;
  letter-spacing: 0.1em;
}

.nav-group__line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, #dbe8f7, transparent);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: #3f5573;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(197, 219, 244, 0.8);
}

.nav-item.is-active {
  background: #ffffff;
  border-color: #d5e5f9;
  box-shadow: 0 8px 22px rgba(54, 99, 160, 0.09);
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -3px;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 99px;
  background: var(--item-accent, var(--accent));
}

.nav-item__icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 10px;
  background: var(--item-soft, var(--accent-soft));
  color: var(--item-accent, var(--accent));
  transition: transform 0.18s ease;
}

.nav-item:hover .nav-item__icon,
.nav-item.is-active .nav-item__icon {
  transform: translateY(-1px);
}

.nav-item__copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.35;
}

.nav-item__copy strong {
  font-size: 13px;
  font-weight: 650;
  color: #243b59;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item__copy small {
  font-size: 9.5px;
  color: #8c9db3;
  letter-spacing: 0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item__arrow {
  flex: none;
  color: #b7c8dd;
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity 0.18s, transform 0.18s;
}

.nav-item:hover .nav-item__arrow,
.nav-item.is-active .nav-item__arrow {
  opacity: 1;
  transform: translateX(0);
  color: var(--item-accent, var(--accent));
}

.catalog-note {
  position: relative;
  margin: 24px 4px 0;
  padding: 15px 14px 13px;
  border: 1px solid #d9e8f9;
  border-radius: 15px;
  background:
    radial-gradient(200px 100px at 100% 0, rgba(84, 148, 255, 0.11), transparent 70%),
    rgba(255, 255, 255, 0.7);
  overflow: hidden;
}

.catalog-note__icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 8px;
  border-radius: 9px;
  background: #e9f3ff;
  color: #3f78d3;
}

.catalog-note strong {
  display: block;
  font-size: 12px;
  color: #2a4568;
}

.catalog-note p {
  margin: 4px 0 11px;
  font-size: 10.5px;
  line-height: 1.65;
  color: #7b8fa9;
}

.catalog-note .btn {
  width: 100%;
  justify-content: center;
}

.sidebar__foot {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 22px calc(13px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(211, 227, 245, 0.8);
  color: #8a9db5;
  font-size: 10px;
  white-space: nowrap;
}

.status-dot,
.local-pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1bbf8a;
  box-shadow: 0 0 0 3px rgba(27, 191, 138, 0.12);
  flex: none;
}

.sidebar__foot .version {
  margin-left: auto;
  color: #a4b4c8;
  letter-spacing: 0.06em;
}

.sidebar-scrim {
  display: none;
}

/* --------------------------------------------------------------------------
   Main & topbar
   -------------------------------------------------------------------------- */
.main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 62px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(247, 251, 255, 0.82);
  border-bottom: 1px solid rgba(216, 230, 246, 0.82);
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
}

.topbar__left,
.topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-size: 11.5px;
  color: #7b8fa8;
  white-space: nowrap;
}

.breadcrumb__root {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #4d6687;
  font-weight: 600;
}

.breadcrumb__sep {
  color: #c5d4e6;
}

.breadcrumb__category {
  color: #7086a3;
}

.breadcrumb__current {
  color: #263f60;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.local-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 11px;
  border: 1px solid #dce8f6;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.7);
  color: #6b829f;
  font-size: 10px;
  white-space: nowrap;
}

.help-btn {
  display: inline-flex;
  align-items: center;
  width: auto !important;
  padding: 0 11px;
  gap: 6px;
  font-size: 11px;
  color: #586f8e;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #617895;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.icon-btn:hover {
  background: #eef6ff;
  border-color: #dce9f8;
  color: #2f5fa7;
}

.icon-btn--quiet {
  color: #8498b1;
}

.icon-btn--tiny {
  width: 27px;
  height: 27px;
  border-radius: 8px;
}

.icon-btn:disabled {
  opacity: 0.3;
}

.menu-btn {
  display: none;
}

.view {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 26px 32px 52px;
  flex: 1;
}

/* --------------------------------------------------------------------------
   Buttons / chips / shared
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.48;
  transform: none;
}

.btn--primary {
  color: #fff;
  background: linear-gradient(180deg, #4a82ff 0%, var(--accent) 45%, #225ce8 100%);
  border-color: rgba(36, 84, 195, 0.35);
  box-shadow: 0 7px 16px rgba(47, 107, 255, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn--primary:hover {
  box-shadow: 0 9px 21px rgba(47, 107, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn--ghost {
  color: #536b8a;
  background: #fff;
  border-color: #dce8f6;
}

.btn--ghost:hover {
  background: #f7fbff;
  border-color: #c7dcf4;
  color: #345a8e;
}

.btn--soft {
  color: #3164ae;
  background: #edf5ff;
  border-color: #dceafb;
}

.btn--soft:hover {
  background: #e4f0ff;
  border-color: #c8dff7;
}

.btn--mini {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 10.5px;
  gap: 5px;
}

.btn--compact {
  padding: 0 11px;
}

.btn--text-danger {
  color: #b75b65;
  background: transparent;
  border-color: transparent;
}

.btn--text-danger:hover {
  color: #a83c48;
  background: #fff5f6;
  border-color: #f7dce0;
}

.btn--danger {
  color: #fff;
  background: #d95b67;
  border-color: #c84b58;
  box-shadow: 0 7px 15px rgba(207, 75, 88, 0.18);
}

.btn--play {
  min-width: 124px;
}

.btn--play.is-running {
  background: linear-gradient(180deg, #376fef 0%, #2b60df 100%);
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border: 1px solid #e0eaf7;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.66);
  color: #6b809d;
  font-size: 10px;
  white-space: nowrap;
}

.chip--fit {
  gap: 5px;
  color: #2b64bd;
  border-color: #d6e7fc;
  background: #f0f7ff;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8fa8c5;
  display: inline-block;
  flex: none;
}

.stage-live.is-running .live-dot,
.live-label .live-dot,
.stage-live.is-running {
  color: #2f6bff;
}

.stage-live.is-running .live-dot,
.live-label .live-dot {
  background: #2f6bff;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.12);
  animation: live-pulse 1.8s infinite;
}

.live-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #7b8fa8;
  font-size: 9px;
  letter-spacing: 0.11em;
  font-weight: 700;
}

@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.10); }
  50% { box-shadow: 0 0 0 6px rgba(47, 107, 255, 0.03); }
}

.mini-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   Experiment header
   -------------------------------------------------------------------------- */
.experiment {
  animation: fade-up 0.42s cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.exp-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  padding: 25px 28px 24px;
  border: 1px solid rgba(216, 230, 247, 0.9);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(560px 210px at 96% -6%, rgba(78, 143, 255, 0.13), transparent 66%),
    linear-gradient(115deg, #ffffff 0%, #fbfdff 48%, #f3f9ff 100%);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.exp-head::before {
  content: "";
  position: absolute;
  right: -52px;
  top: -92px;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(97, 153, 241, 0.13);
  border-radius: 50%;
  box-shadow: 0 0 0 46px rgba(97, 153, 241, 0.035), 0 0 0 92px rgba(97, 153, 241, 0.022);
  pointer-events: none;
}

.exp-head::after {
  content: "";
  position: absolute;
  left: 0;
  top: 30px;
  bottom: 30px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--accent), rgba(47, 107, 255, 0.1));
  opacity: 0.8;
}

.exp-head__main {
  position: relative;
  z-index: 1;
  min-width: 0;
  max-width: 950px;
}

.exp-eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 9px;
  color: #7f94b0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.exp-index {
  color: var(--accent);
  font-weight: 750;
  letter-spacing: 0.12em;
}

.eyebrow-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #b6c7da;
}

.difficulty-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  margin-left: 2px;
  padding: 0 8px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.exp-title-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
}

.exp-title {
  font-size: clamp(28px, 3vw, 39px);
  line-height: 1.18;
  letter-spacing: -0.035em;
  font-weight: 750;
  color: #112844;
}

.exp-en {
  color: #94a6bc;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.exp-desc {
  max-width: 820px;
  margin-top: 10px;
  color: #607692;
  font-size: 12.5px;
  line-height: 1.78;
}

.exp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.exp-actions {
  position: relative;
  z-index: 2;
  flex: none;
  padding-top: 2px;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 338px;
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

.side-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.07fr) minmax(0, 0.93fr);
  gap: 20px;
  margin-top: 20px;
  align-items: stretch;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(218, 231, 247, 0.95);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  min-width: 0;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid #eef4fb;
}

.card-head--compact {
  padding: 14px 18px;
}

.card-head--stage {
  padding: 13px 16px 13px 20px;
}

.card-title-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.card-kicker {
  font-size: 8.5px;
  line-height: 1.4;
  font-weight: 750;
  letter-spacing: 0.17em;
  color: #97a9bf;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  line-height: 1.45;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #1e3655;
  white-space: nowrap;
}

.count-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: #edf5ff;
  color: #3e74c0;
  font-size: 9.5px;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Stage
   -------------------------------------------------------------------------- */
.stage-card {
  display: flex;
  flex-direction: column;
}

.stage-wrap {
  position: relative;
  flex: none;
  min-height: 400px;
  height: clamp(410px, 50vh, 500px);
  background: #f4f9ff;
  overflow: hidden;
  border-bottom: 1px solid #edf4fc;
}

.stage-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.stage-hud {
  position: absolute;
  top: 15px;
  right: 15px;
  min-width: 174px;
  max-width: 280px;
  padding: 10px 13px 11px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.77);
  box-shadow: 0 8px 24px rgba(52, 95, 152, 0.09);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  pointer-events: none;
}

.hud__top {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #6d84a1;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.hud__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #2f6bff;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.10);
}

.hud__value {
  margin-top: 6px;
  color: #1c3b61;
  font-family: var(--font-serif);
  font-size: 23px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.hud__value small {
  font-family: var(--font-sans);
  font-size: 10px;
  color: #7e94ad;
  font-weight: 500;
  margin-left: 2px;
}

.hud__sub {
  margin-top: 4px;
  color: #7a8fa9;
  font-size: 9.5px;
  line-height: 1.5;
}

.stage-live {
  display: none;
}

.stage-tip {
  position: relative;
  padding: 7px 18px 7px 34px;
  border-bottom: 1px solid #edf4fc;
  background: #f9fcff;
  color: #7a90aa;
  font-size: 9.5px;
  line-height: 1.5;
  pointer-events: none;
}

.stage-tip::before {
  content: "i";
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 11px;
  height: 11px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e3efff;
  color: #3d72bd;
  font-family: var(--font-serif);
  font-size: 8px;
  font-style: italic;
  font-weight: 700;
}

/* 预览图下方的运动参数：速度、加速度、振幅、周期等 */
.stage-controls {
  padding: 12px 16px 14px;
  border-bottom: 1px solid #edf4fc;
  background:
    radial-gradient(460px 110px at 6% 0%, rgba(78, 143, 255, 0.07), transparent 72%),
    linear-gradient(180deg, #fbfdff, #f7fbff);
}

.stage-controls__head {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 9px;
}

.stage-controls__kicker {
  color: #9bacc1;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.16em;
}

.stage-controls__title {
  color: #36557a;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.stage-controls__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
  align-items: stretch;
}

.stage-controls .param {
  padding: 10px 12px 9px;
  border: 1px solid #e6effa;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 2px 8px rgba(47, 88, 143, 0.035);
}

.stage-controls .param[hidden] {
  display: none;
}

.stage-controls .param-head {
  gap: 8px;
  min-height: 28px;
}

.stage-controls .param-label {
  gap: 5px;
  font-size: 12px;
}

.stage-controls .param-symbol {
  height: 17px;
  padding: 0 5px;
  font-size: 10px;
}

.stage-controls .param-value {
  height: 28px;
  padding: 0 6px;
  border-radius: 7px;
}

.stage-controls .param-number {
  width: 46px;
  font-size: 12.5px;
}

.stage-controls .param-unit {
  font-size: 9px;
}

.stage-controls .range {
  height: 4px;
  margin: 8px 0 0;
}

.stage-controls .range::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  border-width: 2px;
}

.stage-controls .range::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border-width: 2px;
}

.stage-controls .param-scale,
.stage-controls .param-hint {
  display: none;
}

.view-toggles {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid #e5eef9;
  border-radius: 10px;
  background: #f8fbff;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 27px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #8b9eb6;
  font-size: 9.5px;
  font-weight: 550;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.view-toggle:hover {
  color: #4d6f99;
  background: #fff;
}

.view-toggle.is-active {
  color: var(--accent-ink);
  background: #fff;
  border-color: #dce8f7;
  box-shadow: 0 2px 7px rgba(49, 88, 143, 0.06);
}

.transport-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 58px;
  padding: 10px 15px;
  background: linear-gradient(180deg, #fff, #fcfeff);
}

.transport-divider {
  width: 1px;
  height: 20px;
  margin: 0 2px;
  background: #e7eff9;
}

.transport-spacer {
  flex: 1;
}

.select-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #8498b1;
  font-size: 9.5px;
  white-space: nowrap;
}

.mini-select {
  height: 29px;
  padding: 0 22px 0 9px;
  border: 1px solid #dee9f6;
  border-radius: 8px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='m1 1 4 4 4-4' fill='none' stroke='%236e86a4' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  color: #4d6788;
  font-size: 10px;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #7187a2;
  font-size: 9.5px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 33px;
  height: 19px;
  flex: none;
}

.switch input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch__track {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: #dbe6f3;
  transition: background 0.18s ease;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(28, 57, 95, 0.23);
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.switch input:checked + .switch__track {
  background: var(--accent);
}

.switch input:checked + .switch__track::after {
  transform: translateX(14px);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid rgba(47, 107, 255, 0.4);
  outline-offset: 2px;
}

/* Fullscreen stage */
.stage-card:fullscreen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  border: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.stage-card:fullscreen .stage-wrap {
  flex: 1;
  height: auto;
  min-height: 0;
}

.stage-card:fullscreen .stage-card__head,
.stage-card:fullscreen .card-head {
  background: #fff;
}

.stage-card:fullscreen .stage-controls {
  display: none;
}

/* --------------------------------------------------------------------------
   Parameters & readings
   -------------------------------------------------------------------------- */
.params-card {
  display: flex;
  flex-direction: column;
}

.params-body {
  padding: 2px 18px 4px;
}

.param {
  padding: 11px 0 9px;
  border-bottom: 1px solid #f0f5fb;
}

.param:last-child {
  border-bottom: 0;
}

.param-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
}

.param-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #526987;
  font-size: 11px;
  font-weight: 550;
  white-space: nowrap;
}

.param-symbol {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 5px;
  border-radius: 4px;
  background: #f0f6ff;
  color: #4776b4;
  font-family: var(--font-serif);
  font-size: 9.5px;
  font-style: italic;
}

.param-value {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 7px;
  border: 1px solid #e1ebf7;
  border-radius: 7px;
  background: #f9fcff;
  transition: border-color 0.15s, background 0.15s;
}

.param-value:focus-within {
  border-color: #b8d3f4;
  background: #fff;
}

.param-number {
  width: 47px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #244463;
  font-size: 11.5px;
  font-weight: 650;
  text-align: right;
  font-variant-numeric: tabular-nums;
  appearance: textfield;
  -moz-appearance: textfield;
}

.param-number::-webkit-outer-spin-button,
.param-number::-webkit-inner-spin-button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}

.param-unit {
  color: #8da1b9;
  font-size: 8.5px;
  white-space: nowrap;
}

.range {
  display: block;
  width: 100%;
  height: 4px;
  margin: 9px 0 1px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) var(--fill, 50%), #e3ecf7 var(--fill, 50%), #e3ecf7 100%);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.range::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  border: 2.5px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 7px rgba(47, 107, 255, 0.32);
  appearance: none;
  -webkit-appearance: none;
  transition: transform 0.14s;
}

.range::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 2.5px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 7px rgba(47, 107, 255, 0.32);
}

.range:hover::-webkit-slider-thumb {
  transform: scale(1.12);
}

.param-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  color: #a2b1c4;
  font-size: 7.5px;
  font-variant-numeric: tabular-nums;
}

.param-hint {
  margin-top: 6px;
  color: #9aacbf;
  font-size: 8.5px;
  line-height: 1.55;
}

/* 运动电荷：没有实时读数卡，窄屏时参数卡占满整行，避免双列参数溢出 */
@media (max-width: 1180px) {
  .movingcharge-experiment .side-stack {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* 参数旁的快捷反解按钮（磁聚焦 / 磁发散：令 r = R） */
.param-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 7px;
  padding: 3px 9px 3px 7px;
  border: 1px solid #d7e3f4;
  border-radius: 99px;
  background: #f4f9ff;
  color: #4a6c9b;
  font-family: inherit;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}

.param-shortcut .icon {
  width: 11px;
  height: 11px;
}

.param-shortcut:hover {
  border-color: #b6d1f2;
  background: #e9f3ff;
  color: #2f5f9e;
}

.param-shortcut:active {
  transform: translateY(1px);
}

.param-shortcut:focus-visible {
  outline: 2px solid rgba(47, 107, 255, 0.4);
  outline-offset: 1px;
}

/* 开关下方的操作按钮（运动演示：暂停/继续、重置） */
.param-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.param-actions .btn {
  min-height: 28px;
  padding: 0 12px;
  font-size: 10.5px;
}

.param-actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.param--segment .segmented {
  margin-top: 10px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  border: 1px solid #e3edf8;
  border-radius: 9px;
  background: #f7fbff;
}

.segment {
  height: 30px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #788da6;
  font-size: 10.5px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.segment:hover {
  color: #42658f;
}

.segment.is-active {
  border-color: #d8e5f5;
  background: #fff;
  color: var(--accent-ink);
  box-shadow: 0 2px 7px rgba(46, 84, 141, 0.07);
}

.params-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding: 9px 18px 12px;
  color: #9bacc0;
  font-size: 8.5px;
}

.autosave-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #85a8d5;
}

.readings-card {
  flex: 1;
}

.readings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 11px 13px 12px;
}

.reading {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 58px;
  padding: 8px 9px;
  border: 1px solid #edf3fb;
  border-radius: 10px;
  background: linear-gradient(145deg, #fbfdff, #f7fbff);
  overflow: hidden;
}

.reading::after {
  content: "";
  position: absolute;
  right: -13px;
  bottom: -18px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(92, 143, 213, 0.08);
  border-radius: 50%;
}

.reading--accent {
  border-color: #dbe9fb;
  background: linear-gradient(145deg, #f3f9ff, #edf5ff);
}

.reading__label {
  color: #8a9db4;
  font-size: 8.5px;
  line-height: 1.4;
  white-space: nowrap;
}

.reading__value {
  display: flex;
  align-items: baseline;
  gap: 3px;
  color: #263f5e;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.reading--accent .reading__value {
  color: var(--accent-ink);
}

.reading__unit {
  color: #8da0b8;
  font-family: var(--font-sans);
  font-size: 7.5px;
  font-weight: 500;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Chart
   -------------------------------------------------------------------------- */
.chart-card {
  display: flex;
  flex-direction: column;
}

.chart-actions,
.data-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.btn--mini.is-active {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-color: #cfe0f7;
}

.point-style-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #879ab1;
  font-size: 10px;
  white-space: nowrap;
}
.point-style-select {
  height: 30px;
  padding: 0 22px 0 7px;
  border: 1px solid #e0eaf6;
  border-radius: 7px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='m1 1 4 4 4-4' fill='none' stroke='%236e86a4' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  color: #536e8d;
  font-size: 10.5px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.chart-wrap {
  position: relative;
  height: 300px;
  padding: 0;
  background: #fbfdff;
}

.chart-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.fit-box {
  flex: 1;
  margin: 0 14px 14px;
  padding: 13px 15px 12px;
  border: 1px solid #e5eef9;
  border-radius: 12px;
  background:
    radial-gradient(220px 90px at 100% 0%, rgba(82, 146, 255, 0.07), transparent 70%),
    linear-gradient(180deg, #fbfdff, #f8fbff);
  min-height: 137px;
}

.fit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.fit-label {
  color: #8397b1;
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.13em;
}

.fit-header__right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 99px;
  background: #edf6ff;
  color: #4378be;
  font-size: 8px;
}

.source-pill--external {
  background: #fff5e9;
  color: #a96922;
}

.source-pill--history {
  background: #fff7ed;
  color: #9a4b18;
}

.source-pill__dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.fit-box.is-history {
  border-color: rgba(194, 65, 12, 0.24);
  box-shadow: inset 0 0 0 1px rgba(194, 65, 12, 0.04);
}

.fit-kind {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 7px;
  border: 1px solid #e2ebf6;
  border-radius: 5px;
  color: #8a9db4;
  font-size: 8px;
  background: #fff;
}

.equation {
  margin-top: 8px;
  color: #173f70;
  font-family: var(--font-serif);
  font-size: clamp(17px, 1.6vw, 21px);
  line-height: 1.45;
  letter-spacing: 0.005em;
  overflow-wrap: anywhere;
}

.equation sup {
  font-size: 0.65em;
  line-height: 0;
}

.fit-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.fit-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  color: #8a9db4;
  font-size: 8.5px;
}

.fit-stat strong {
  color: #3f5f85;
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  margin-left: auto;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #91a3b9;
  font-size: 8.5px;
  transition: all 0.15s;
}

.copy-btn:hover {
  color: #3e6eae;
  background: #fff;
  border-color: #e0eaf7;
}

.fit-hint {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px dashed #e6eef8;
  color: #7e91a9;
  font-size: 9px;
  line-height: 1.65;
}

.fit-hint strong {
  color: #345b89;
  font-weight: 650;
}

.fit-empty {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 106px;
  color: #7e91a9;
}

.fit-empty__icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 10px;
  background: #edf5ff;
  color: #6a94c8;
}

.fit-empty strong {
  display: block;
  color: #455f7f;
  font-size: 11px;
}

.fit-empty p {
  margin-top: 3px;
  font-size: 9px;
  line-height: 1.6;
}

.fit-error {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 9px 10px;
  border: 1px solid #f6e0e2;
  border-radius: 8px;
  background: #fff8f8;
  color: #b35a64;
  font-size: 9.5px;
}

/* --------------------------------------------------------------------------
   Data table
   -------------------------------------------------------------------------- */
.data-card {
  display: flex;
  flex-direction: column;
}

.table-scroll {
  flex: 1;
  min-height: 330px;
  max-height: 470px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbdced transparent;
  overscroll-behavior: contain;
}

.table-scroll::-webkit-scrollbar,
.sidebar__body::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.table-scroll::-webkit-scrollbar-thumb,
.sidebar__body::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 99px;
  background: #cadcef;
  background-clip: content-box;
}

.data-table-host {
  width: 100%;
}

.data-table {
  width: 100%;
  min-width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 36px;
  padding: 0 7px;
  border-bottom: 1px solid #e4eef9;
  background: #f7fbff;
  color: #7a8fa9;
  font-size: 8.5px;
  font-weight: 650;
  text-align: right;
  white-space: nowrap;
}

.data-table th:first-child {
  text-align: center;
}

.data-table th .th-unit {
  display: block;
  margin-top: -1px;
  color: #a1b2c6;
  font-size: 7px;
  font-weight: 500;
}

.data-table td {
  height: 31px;
  padding: 0 7px;
  border-bottom: 1px solid #f1f6fc;
  color: #4d6582;
  text-align: right;
  white-space: nowrap;
}

.data-table td.idx-col,
.data-table th.idx-col {
  width: 30px;
  padding: 0 4px;
  text-align: center;
  color: #a3b3c6;
  font-size: 8px;
}

.data-table tbody tr:hover td {
  background: #fbfdff;
}

.data-table tr.is-latest td {
  background: #f0f7ff;
  color: #245391;
}

.data-table tr.is-latest td:first-child {
  box-shadow: inset 2px 0 0 var(--accent);
}

.table-empty {
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  color: #8b9eb5;
}

.table-empty__icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #f0f7ff;
  color: #7199c9;
}

.table-empty strong {
  display: block;
  color: #546e8e;
  font-size: 11px;
}

.table-empty p {
  margin-top: 3px;
  font-size: 9px;
}

.data-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 16px;
  border-top: 1px solid #eef4fb;
  color: #97a8bd;
  font-size: 8.5px;
}

.data-foot__meta {
  letter-spacing: 0.05em;
  color: #b0bfd0;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Theory
   -------------------------------------------------------------------------- */
.theory-card {
  margin-top: 20px;
}

.theory-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 30px;
  padding: 21px 24px 23px;
}

.theory-text p {
  margin-bottom: 12px;
  color: #5f7693;
  font-size: 11.5px;
  line-height: 1.92;
}

.theory-text p:last-child {
  margin-bottom: 0;
}

.theory-text p:first-child::first-letter {
  color: var(--accent-ink);
  font-size: 1.12em;
  font-weight: 700;
}

.theory-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.formula-board {
  padding: 15px 17px;
  border: 1px solid #dce9f8;
  border-radius: 13px;
  background:
    radial-gradient(220px 100px at 100% 0%, rgba(76, 140, 255, 0.09), transparent 72%),
    linear-gradient(160deg, #f8fbff, #f1f7ff);
}

.formula-board__label {
  color: #8ba0b9;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.16em;
}

.formula-board__formula {
  margin-top: 8px;
  color: #1f4e86;
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.5;
}

.formula-line {
  margin: 3px 0;
  overflow-wrap: anywhere;
}

.formula-line--small {
  color: #617a98;
  font-size: 11px;
}

.formula-line sub,
.formula-line sup {
  font-size: 0.6em;
  line-height: 0;
}

.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  margin: 0 2px;
  line-height: 1.12;
  font-size: 0.86em;
  transform: translateY(-0.08em);
}

.frac > span:first-child {
  padding: 0 4px 2px;
  border-bottom: 1px solid currentColor;
}

.frac > span:last-child {
  padding-top: 1px;
}

.formula-board__note {
  margin-top: 8px;
  color: #7c90aa;
  font-size: 9px;
  line-height: 1.6;
}

.theory-steps {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.theory-steps li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: #7187a1;
  font-size: 9.5px;
  line-height: 1.68;
}

.step-index {
  flex: none;
  color: #7ba2d2;
  font-family: var(--font-serif);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.6;
}

.page-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 4px 0;
  color: #9cadc1;
  font-size: 9px;
}

.page-foot span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* --------------------------------------------------------------------------
   Empty / error
   -------------------------------------------------------------------------- */
.empty-library,
.app-error {
  max-width: 560px;
  margin: 9vh auto 0;
  padding: 38px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow-card);
}

.empty-library__mark,
.app-error__icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 17px;
  background: var(--accent-soft);
  color: var(--accent);
}

.empty-library h1,
.app-error h2 {
  font-size: 22px;
  letter-spacing: -0.02em;
  color: #1a3659;
}

.empty-library p,
.app-error p {
  margin: 8px auto 20px;
  max-width: 420px;
  color: #758aa4;
  font-size: 12px;
  line-height: 1.8;
}

.app-error .btn {
  margin-top: 3px;
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(22, 48, 84, 0.30);
  backdrop-filter: blur(7px) saturate(1.08);
  -webkit-backdrop-filter: blur(7px) saturate(1.08);
  opacity: 0;
  transition: opacity 0.19s ease;
}

.modal-overlay.is-open {
  opacity: 1;
}

.modal {
  width: min(700px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-float);
  transform: translateY(9px) scale(0.985);
  opacity: 0;
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.3, 1), opacity 0.18s ease;
  overflow: hidden;
}

.modal-overlay.is-open .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal--sm { width: min(455px, 100%); }
.modal--md { width: min(670px, 100%); }
.modal--lg { width: min(840px, 100%); }

.modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 21px 24px 16px;
  border-bottom: 1px solid #edf3fa;
  background:
    radial-gradient(260px 100px at 92% 0%, rgba(83, 145, 255, 0.08), transparent 68%),
    #fbfdff;
}

.modal__eyebrow {
  margin-bottom: 4px;
  color: #8fa1b8;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.17em;
}

.modal__title {
  color: #162f4e;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.35;
}

.modal__subtitle {
  margin-top: 4px;
  color: #7d91a9;
  font-size: 10.5px;
  line-height: 1.6;
}

.modal__head .icon-btn {
  flex: none;
  margin-top: -2px;
}

.modal__body {
  padding: 20px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #cadcef transparent;
}

.modal__foot {
  padding: 13px 24px 16px;
  border-top: 1px solid #edf3fa;
  background: #fbfdff;
}

.modal__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.modal__actions-spacer {
  flex: 1;
}

.confirm-body p {
  color: #607690;
  font-size: 12px;
  line-height: 1.8;
}

/* --------------------------------------------------------------------------
   Manager
   -------------------------------------------------------------------------- */
.manager__note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  padding: 11px 13px;
  border: 1px solid #e0ecfa;
  border-radius: 10px;
  background: #f6faff;
}

.manager__note-icon {
  flex: none;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #e8f2ff;
  color: #4278bd;
}

.manager__note p {
  color: #758ba4;
  font-size: 9.5px;
  line-height: 1.7;
}

.manager__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.manager-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 61px;
  padding: 8px 10px;
  border: 1px solid #e9f1fa;
  border-radius: 11px;
  background: #fff;
  transition: border-color 0.15s, background 0.15s;
}

.manager-row:hover {
  border-color: #d8e6f6;
  background: #fdfeff;
}

.manager-row.is-hidden {
  opacity: 0.64;
  background: #fbfcfe;
}

.manager-row__index {
  width: 24px;
  flex: none;
  color: #a8b7c8;
  font-family: var(--font-serif);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.manager-row__icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 8px;
  background: var(--item-soft, var(--accent-soft));
  color: var(--item-accent, var(--accent));
}

.manager-row__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.manager-row__main strong {
  color: #2c4767;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.manager-row__main span {
  color: #93a4b9;
  font-size: 8.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.manager-row__badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.tiny-badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 4px;
  background: #ebf5ff;
  color: #4880c7;
  font-size: 7.5px;
  white-space: nowrap;
}

.tiny-badge--muted {
  background: #f0f3f7;
  color: #8b9caf;
}

.manager-row__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

.manager__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #e5edf7;
}

/* --------------------------------------------------------------------------
   Editor
   -------------------------------------------------------------------------- */
.editor__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field--wide {
  grid-column: 1 / -1;
}

.field__label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #536b89;
  font-size: 10px;
  font-weight: 600;
}

.field__label em {
  color: #d25c67;
  font-style: normal;
}

.field__label small {
  color: #a0b0c3;
  font-size: 8px;
  font-weight: 400;
}

.field__input {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #dde8f5;
  border-radius: 8px;
  outline: 0;
  background: #fbfdff;
  color: #2b4566;
  font-size: 11px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.field__input:focus {
  border-color: #aecdF2;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.07);
}

.field__textarea {
  min-height: 78px;
  resize: vertical;
  line-height: 1.7;
}

.field__textarea--tall {
  min-height: 154px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid #e7eff9;
  border-radius: 10px;
  background: #fafdff;
  cursor: pointer;
}

.check-row > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.check-row strong {
  color: #4a6484;
  font-size: 10px;
  font-weight: 600;
}

.check-row small {
  color: #96a7bb;
  font-size: 8.5px;
}

.editor__meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: #a2b1c3;
  font-size: 8.5px;
}

.editor__meta code {
  padding: 1px 4px;
  border-radius: 3px;
  background: #f2f7fd;
  color: #7390b3;
  font-size: 8px;
}

.editor__footer .btn--text-danger {
  margin-right: auto;
}

/* --------------------------------------------------------------------------
   Help
   -------------------------------------------------------------------------- */
.help {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.help__section {
  padding-bottom: 16px;
  border-bottom: 1px solid #eff4fb;
}

.help__section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.help__heading {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 6px;
}

.help__heading > span {
  color: #7ca2d2;
  font-family: var(--font-serif);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.help__heading h3 {
  color: #294667;
  font-size: 12px;
  font-weight: 650;
}

.help__section p {
  color: #6f849e;
  font-size: 10px;
  line-height: 1.8;
}

.help__section p + p {
  margin-top: 7px;
}

.help__section strong {
  color: #41648e;
  font-weight: 650;
}

.help__hint {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
  color: #8b9db4;
  font-size: 9px;
}

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 25px;
  height: 21px;
  padding: 0 6px;
  border: 1px solid #dce7f4;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #f8fbff;
  color: #5d7899;
  font-size: 8px;
  font-weight: 600;
}

.help__code {
  margin: 9px 0 0;
  padding: 10px 12px;
  border: 1px solid #e5eef9;
  border-radius: 8px;
  background: #f8fbff;
  color: #547699;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 9px;
  line-height: 1.65;
  overflow-x: auto;
}

.help__small {
  margin-top: 7px !important;
  color: #93a5ba !important;
  font-size: 9px !important;
}

.help__small code {
  padding: 1px 4px;
  border-radius: 3px;
  background: #f0f6fd;
  color: #6c8eb5;
}

.help__section--soft {
  padding: 12px 14px;
  border: 1px solid #e4eef9;
  border-radius: 10px;
  background: #f8fbff;
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
.toast-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: 380px;
  padding: 10px 14px 10px 11px;
  border: 1px solid #e0eaf6;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 32px rgba(28, 61, 105, 0.13);
  color: #536b88;
  font-size: 10.5px;
  line-height: 1.6;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: auto;
  backdrop-filter: blur(12px);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast__icon {
  width: 21px;
  height: 21px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #eef5ff;
  color: #4079c4;
}

.toast--success .toast__icon {
  background: #e9f9f3;
  color: #12956b;
}

.toast--error .toast__icon {
  background: #fff0f2;
  color: #c55260;
}

.toast--info .toast__icon {
  background: #eff6ff;
  color: #477cc2;
}

.toast__text {
  padding-top: 1px;
}

/* --------------------------------------------------------------------------
   Presentation typography — 面向课堂演示的整体字号提升
   -------------------------------------------------------------------------- */
body {
  font-size: 17px;
  line-height: 1.66;
}

.brand__copy strong { font-size: 23px; }
.brand__copy span { font-size: 11.5px; }
.sidebar__label,
.nav-group__label { font-size: 11.5px; }
.nav-item { min-height: 64px; padding: 10px 11px; }
.nav-item__icon { width: 37px; height: 37px; }
.nav-item__copy strong {
  font-size: 15px;
  line-height: 1.35;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.nav-item__copy small { font-size: 11px; }
.catalog-note strong { font-size: 14px; }
.catalog-note p { font-size: 12px; line-height: 1.7; }
.catalog-note .btn { font-size: 12.5px; min-height: 34px; }
.sidebar__foot { font-size: 11px; }

.breadcrumb { font-size: 13px; }
.help-btn { font-size: 12.5px; }
.btn { font-size: 13.5px; min-height: 40px; }
.btn--mini { font-size: 12px; min-height: 32px; }
.btn--compact { font-size: 12.5px; }
.chip { font-size: 12px; height: 27px; }
.card-kicker { font-size: 10px; }
.card-title { font-size: 16.5px; }
.count-badge { font-size: 10.5px; min-width: 22px; height: 22px; }

.exp-eyebrow { font-size: 11.5px; }
.difficulty-pill { font-size: 10px; height: 22px; }
.exp-title { font-size: clamp(32px, 3.2vw, 44px); }
.exp-en { font-size: 11px; }
.exp-desc { font-size: 16px; line-height: 1.82; }
.exp-chips { gap: 8px; }

.stage-hud { min-width: 204px; padding: 12px 15px 13px; }
.hud__top { font-size: 10.5px; }
.hud__value { font-size: 27px; }
.hud__value small { font-size: 11.5px; }
.hud__sub { font-size: 11px; }
.stage-tip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 18px 8px 37px;
  font-size: 11px;
}
.stage-tip::before { left: 18px; width: 13px; height: 13px; font-size: 9px; }
.stage-tip__text { min-width: 0; }
.history-inspect {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 18px;
  border-bottom: 1px solid #eaf2fc;
  background: #f5faff;
  color: #5f7895;
  font-size: 10.5px;
}
.history-inspect[hidden] { display: none; }
.history-inspect__dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: #2f6bff;
  box-shadow: 0 0 0 2px rgba(47, 107, 255, 0.12);
}
.history-inspect strong {
  flex: none;
  color: #345b88;
  font-size: 10.5px;
  font-weight: 650;
}
.history-inspect__params {
  min-width: 0;
  overflow: hidden;
  color: #7d93ab;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-inspect__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: auto;
  flex: none;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #8ba0b7;
  cursor: pointer;
}
.history-inspect__close:hover {
  background: #e8f2fe;
  color: #2f6bff;
}
.shortcut-hint {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
  color: #91a3b8;
  font-size: 10.5px;
  white-space: nowrap;
}
.shortcut-hint kbd {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 5px;
  border: 1px solid #dce8f6;
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fff;
  color: #5e7a9c;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 650;
}
.shortcut-hint > span { color: #c1d0e1; }

.view-toggle { height: 30px; font-size: 11.5px; }
.select-label,
.switch-label { font-size: 11px; }
.mini-select { height: 32px; font-size: 12px; }

.param-label { font-size: 13.5px; }
.param-symbol { height: 19px; font-size: 11px; }
.param-value { height: 31px; }
.param-number { width: 54px; font-size: 13.5px; }
.param-unit { font-size: 10.5px; }
.param-scale { font-size: 9px; }
.param-hint { font-size: 10.5px; }
.params-foot { font-size: 10px; }
.segment { height: 33px; font-size: 12px; }

.reading { min-height: 66px; padding: 9px 11px; }
.reading__label { font-size: 11px; }
.reading__value { font-size: 21px; }
.reading__unit { font-size: 9.5px; }
.live-label { font-size: 10px; }

.fit-label { font-size: 10px; }
.source-pill { height: 23px; font-size: 9.5px; }
.fit-kind { height: 22px; font-size: 9.5px; }
.equation { font-size: clamp(22px, 1.8vw, 27px); }
.fit-stat { font-size: 10.5px; }
.fit-stat strong { font-size: 14px; }
.copy-btn { height: 26px; font-size: 10px; }
.fit-hint { font-size: 12px; line-height: 1.72; }
.fit-empty strong { font-size: 13px; }
.fit-empty p { font-size: 11px; }
.fit-error { font-size: 11px; }

.data-table { font-size: 12.5px; }
.data-table th { height: 43px; font-size: 10.5px; }
.data-table th .th-unit { font-size: 8px; }
.data-table td { height: 36px; }
.data-table td.idx-col,
.data-table th.idx-col { font-size: 9.5px; }
.table-empty strong { font-size: 13px; }
.table-empty p { font-size: 11px; }
.data-foot { font-size: 10px; }

.theory-text p { font-size: 15px; line-height: 1.95; }
.formula-board__label { font-size: 9px; }
.formula-board__formula { font-size: 22px; }
.formula-line--small { font-size: 13px; }
.formula-board__note { font-size: 11.5px; }
.theory-steps li { font-size: 12px; }
.step-index { font-size: 10.5px; }
.page-foot { font-size: 11px; }

.modal__eyebrow { font-size: 9.5px; }
.modal__title { font-size: 24px; }
.modal__subtitle { font-size: 12.5px; }
.manager__note p { font-size: 11px; }
.manager-row { min-height: 68px; }
.manager-row__main strong { font-size: 13px; }
.manager-row__main span { font-size: 10px; }
.tiny-badge { font-size: 9px; height: 20px; }
.field__label { font-size: 12px; }
.field__label small { font-size: 9.5px; }
.field__input { font-size: 13px; min-height: 39px; }
.check-row strong { font-size: 12px; }
.check-row small { font-size: 10px; }
.editor__meta { font-size: 10px; }
.help__heading h3 { font-size: 14px; }
.help__section p { font-size: 12.5px; }
.help__hint { font-size: 11px; }
.help__code { font-size: 11px; }
.help__small { font-size: 11px !important; }
.kbd { font-size: 10px; min-width: 28px; height: 23px; }
.toast { font-size: 12px; }

/* 轨迹颜色与历史 */
.viewport-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}
.probe-tools .probe-measure-btn {
  border-color: #b9dfe2;
  background: #f0fbfb;
  color: #0e7c80;
}
.probe-tools .probe-measure-btn:hover {
  border-color: #8bcbd0;
  background: #e5f8f9;
  color: #08676b;
}
.probe-settings__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.probe-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: #607892;
  font-size: 11px;
}
.probe-field select,
.probe-field__input {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  border: 1px solid #dfeaf7;
  border-radius: 8px;
  background: #fff;
  padding: 0 8px;
}
.probe-field select {
  width: 100%;
  color: #3c5878;
  font-size: 12px;
}
.probe-field__input input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  color: #355a82;
  font-size: 12px;
  background: transparent;
}
.probe-field__input small {
  flex: none;
  color: #91a5ba;
  font-size: 9px;
}
.probe-settings__note {
  margin-top: 12px;
  padding: 9px 11px;
  border-radius: 8px;
  background: #f5f9ff;
  color: #7d92aa;
  font-size: 10px;
  line-height: 1.6;
}
.viewport-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #e2ebf6;
  border-radius: 8px;
  background: #fff;
  color: #7187a2;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.viewport-btn:hover {
  border-color: #c8def5;
  background: #f7fbff;
  color: #355f94;
}
.card-head--stage {
  flex-wrap: wrap;
}

.trace-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #e2ebf6;
  border-radius: 9px;
  background: #fff;
  color: #617a99;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.trace-btn:hover {
  border-color: #c9def5;
  background: #f7fbff;
  color: #345f94;
}
.trace-swatch {
  width: 13px;
  height: 13px;
  flex: none;
  border-radius: 50%;
  background: #2F6BFF;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #c7d9ee;
}
.trace-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: #f0f6fd;
  color: #6f8bac;
  font-size: 9px;
}
.history-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 7px;
  border-radius: 99px;
  background: #f3f7fd;
  color: #748aa4;
  font-size: 9.5px;
  white-space: nowrap;
}
.trace-settings__note {
  margin-bottom: 12px;
  color: #7b8fa8;
  font-size: 11.5px;
  line-height: 1.7;
}
.trace-settings__list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.trace-settings__empty {
  padding: 20px 14px;
  border: 1px dashed #dbe7f5;
  border-radius: 10px;
  color: #93a6bb;
  font-size: 11px;
  text-align: center;
}
.trace-history-title {
  margin: 10px 0 1px;
  color: #91a3b8;
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.11em;
}
.trace-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border: 1px solid #e7eff9;
  border-radius: 10px;
  background: #fbfdff;
}
.trace-row--current {
  border-color: #cfe2f7;
  background: #f7fbff;
}
.trace-row.is-selected {
  border-color: #9fc4ef;
  background: #f2f8ff;
  box-shadow: 0 0 0 2px rgba(47, 107, 255, 0.08);
}
.trace-inspect-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 30px;
  padding: 0 7px;
  border: 1px solid #dce8f6;
  border-radius: 7px;
  background: #fff;
  color: #5f7d9f;
  font-size: 10px;
  white-space: nowrap;
}
.trace-inspect-btn:hover {
  border-color: #b9d5f2;
  color: #2f6bff;
}
.trace-param-panel {
  margin: -1px 0 4px 32px;
  padding: 11px 13px 12px;
  border: 1px solid #d9e8f8;
  border-radius: 0 0 10px 10px;
  background: #f8fbff;
}
.trace-param-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.trace-param-head strong {
  color: #3d5a7b;
  font-size: 11.5px;
}
.trace-param-close {
  border: 0;
  background: none;
  color: #7c93ad;
  font-size: 10px;
  cursor: pointer;
}
.trace-param-close:hover { color: #2f6bff; }
.trace-param-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 7px;
}
.trace-param-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border: 1px solid #e5eef9;
  border-radius: 7px;
  background: #fff;
}
.trace-param-item span {
  color: #93a6bc;
  font-size: 9.5px;
}
.trace-param-item strong {
  color: #3f5d7e;
  font-size: 12px;
  font-weight: 650;
}
.trace-param-item small {
  margin-left: 2px;
  color: #8298b0;
  font-size: 9px;
  font-weight: 500;
}
.trace-param-note,
.trace-param-empty {
  margin-top: 8px;
  color: #90a3b9;
  font-size: 9.5px;
}
.trace-row__identity {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.trace-row__identity > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.trace-row__identity strong {
  color: #3a5574;
  font-size: 12px;
  font-weight: 650;
}
.trace-row__identity small {
  color: #91a3b8;
  font-size: 9.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trace-row__swatch {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px #d5e3f2;
}
.trace-row__controls {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
}
.trace-color-control {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 31px;
  padding: 0 7px;
  border: 1px solid #e0eaf6;
  border-radius: 7px;
  background: #fff;
  color: #7890ab;
  font-size: 9px;
  cursor: pointer;
}
.trace-color-control input[type="color"] {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: none;
  cursor: pointer;
}
.trace-color-control input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
.trace-color-control input[type="color"]::-webkit-color-swatch {
  border: 1px solid #d7e4f2;
  border-radius: 5px;
}
.trace-style-select {
  height: 31px;
  padding: 0 7px;
  border: 1px solid #e0eaf6;
  border-radius: 7px;
  background: #fff;
  color: #567190;
  font-size: 10px;
}
.trace-delete {
  color: #a4b2c3;
}
.trace-settings .btn--text-danger {
  margin-top: 12px;
}

/* 顶部手动保存 */
.save-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.save-btn,
.restore-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 33px;
  padding: 0 12px;
  border: 1px solid #d7e6f7;
  border-radius: 9px;
  background: #fff;
  color: #39639a;
  font-size: 12px;
  font-weight: 650;
  transition: background 0.16s, border-color 0.16s, color 0.16s;
}
.save-btn:hover,
.restore-btn:hover {
  background: #f4f9ff;
  border-color: #bed8f4;
  color: #1f5090;
}
.save-btn:disabled {
  opacity: 0.45;
}
.restore-btn {
  height: 30px;
  padding: 0 9px;
  color: #7187a2;
  font-size: 11px;
  border-color: #e2ebf6;
  background: transparent;
}
.save-state {
  max-width: 145px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #92a4b9;
  font-size: 10px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1380px) {
  :root { --sidebar-width: 252px; }
  .view { padding-left: 26px; padding-right: 26px; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 318px; }
  .readings-grid { gap: 6px; }
  .reading { padding: 8px; }
}

@media (max-width: 1180px) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .side-stack {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
  }
  .params-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 18px;
  }
  .param {
    border-bottom: 1px solid #f0f5fb;
  }
  .param:nth-last-child(-n+2) {
    border-bottom: 0;
  }
  .stage-wrap {
    height: clamp(390px, 46vh, 510px);
  }
  .analysis-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .chart-wrap { height: 320px; }
  .table-scroll { max-height: 430px; }
}

@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-102%);
    transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.3, 1);
    box-shadow: 18px 0 46px rgba(29, 65, 111, 0.16);
  }
  .sidebar.is-open {
    transform: translateX(0);
  }
  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(18, 43, 77, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s;
    backdrop-filter: blur(2px);
  }
  .sidebar-scrim.is-open {
    opacity: 1;
    pointer-events: auto;
  }
  .main {
    margin-left: 0;
  }
  .menu-btn {
    display: inline-grid;
  }
  .topbar {
    padding: 0 20px;
  }
  .view {
    padding: 20px 20px 42px;
  }
  .breadcrumb__category,
  .breadcrumb__sep:nth-of-type(2) {
    display: none;
  }
  .exp-head {
    padding: 22px 24px;
  }
  .theory-grid {
    gap: 22px;
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 58px;
    padding: 0 14px;
  }
  .local-pill {
    display: none;
  }
  .help-btn span {
    display: none;
  }
  .help-btn {
    width: 34px !important;
    padding: 0;
  }
  .view {
    padding: 14px 14px 38px;
  }
  .exp-head {
    padding: 20px 19px;
    border-radius: 16px;
  }
  .exp-head::after {
    top: 22px;
    bottom: 22px;
  }
  .exp-title {
    font-size: 27px;
  }
  .exp-title-row {
    flex-direction: column;
    gap: 3px;
  }
  .exp-en {
    font-size: 8.5px;
  }
  .exp-desc {
    font-size: 11.5px;
  }
  .exp-actions {
    display: none;
  }
  .workspace-grid,
  .analysis-grid {
    gap: 14px;
    margin-top: 14px;
  }
  .side-stack {
    display: flex;
  }
  .params-body {
    display: block;
  }
  .stage-wrap {
    min-height: 360px;
    height: 390px;
  }
  .stage-hud {
    top: 11px;
    right: 11px;
    left: auto;
    min-width: 150px;
    padding: 8px 10px;
  }
  .hud__value {
    font-size: 20px;
  }
  .stage-tip {
    padding-left: 31px;
    font-size: 10.5px;
  }
  .stage-tip::before {
    left: 16px;
  }
  .shortcut-hint {
    display: none;
  }
  .save-state {
    display: none;
  }
  .save-btn,
  .restore-btn {
    width: 34px;
    height: 33px;
    padding: 0;
    justify-content: center;
  }
  .save-btn span,
  .restore-btn span {
    display: none;
  }
  .trace-btn {
    padding: 0 8px;
  }
  .trace-btn > span:not(.trace-swatch):not(.trace-count) {
    display: none;
  }
  .viewport-tools {
    gap: 2px;
  }
  .viewport-btn {
    width: 30px;
    padding: 0;
    justify-content: center;
  }
  .viewport-btn span {
    display: none;
  }
  .trace-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .trace-row__controls {
    width: 100%;
    justify-content: flex-end;
  }
  .point-style-control > span {
    display: none;
  }
  .point-style-select {
    max-width: 92px;
  }
  .card-head {
    padding: 13px 14px;
  }
  .card-head--compact {
    padding: 13px 14px;
  }
  .card-title {
    font-size: 13.5px;
  }
  .card-kicker {
    font-size: 7.5px;
  }
  .view-toggle span {
    display: none;
  }
  .view-toggle {
    width: 28px;
    padding: 0;
    justify-content: center;
  }
  .transport-bar {
    gap: 6px;
    padding: 9px 11px;
  }
  .btn--play {
    min-width: 110px;
  }
  .transport-divider {
    display: none;
  }
  .transport-spacer {
    display: none;
  }
  .switch-label {
    margin-left: auto;
  }
  .chart-wrap {
    height: 280px;
  }
  .chart-actions {
    justify-content: flex-end;
  }
  .fit-box {
    margin: 0 10px 10px;
    padding: 11px 12px;
  }
  .equation {
    font-size: 17px;
  }
  .table-scroll {
    min-height: 300px;
  }
  .data-table {
    min-width: 560px;
  }
  .theory-grid {
    grid-template-columns: 1fr;
    padding: 18px;
  }
  .page-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  .modal-overlay {
    padding: 12px;
    align-items: flex-end;
  }
  .modal {
    max-height: 91vh;
    border-radius: 18px;
  }
  .modal__head {
    padding: 17px 18px 13px;
  }
  .modal__body {
    padding: 16px 18px;
  }
  .modal__foot {
    padding: 11px 18px 14px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .manager-row {
    flex-wrap: wrap;
  }
  .manager-row__actions {
    width: 100%;
    justify-content: flex-end;
    padding-left: 66px;
  }
  .manager-row__badges {
    margin-left: auto;
  }
  .toast-root {
    left: 14px;
    right: 14px;
    bottom: 14px;
    align-items: stretch;
  }
  .toast {
    max-width: none;
  }
}

@media (max-width: 540px) {
  .breadcrumb__root svg,
  .breadcrumb__root {
    font-size: 10px;
  }
  .breadcrumb__current {
    max-width: 140px;
  }
  .exp-chips .chip:not(.chip--fit) {
    display: none;
  }
  .difficulty-pill {
    display: none;
  }
  .stage-wrap {
    height: 350px;
    min-height: 340px;
  }
  .stage-hud {
    max-width: 200px;
  }
  .hud__sub {
    font-size: 8.5px;
  }
  .stage-live {
    display: none;
  }
  .transport-bar .btn--compact span {
    display: none;
  }
  .transport-bar .btn--compact {
    width: 34px;
    padding: 0;
  }
  .switch-label > span:last-child {
    display: none;
  }
  .chart-actions .btn span,
  .data-actions .btn span {
    display: none;
  }
  .chart-actions .btn,
  .data-actions .btn {
    width: 30px;
    padding: 0;
  }
  .fit-stats {
    gap: 10px;
  }
  .copy-btn {
    margin-left: 0;
  }
  .readings-grid {
    grid-template-columns: 1fr 1fr;
  }
  .reading {
    min-height: 60px;
  }
  .theory-steps {
    gap: 6px;
  }
  .modal__actions .btn {
    flex: 1;
  }
  .editor__footer .btn--text-danger {
    flex: 0 0 100%;
    margin-bottom: 2px;
  }
  .manager-row__index {
    display: none;
  }
  .manager-row__actions {
    padding-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}


/* --------------------------------------------------------------------------
   试探电荷实验：预览比例、场强对比
   -------------------------------------------------------------------------- */
.probe-experiment .workspace-grid {
  align-items: start;
}
.probe-experiment .stage-card {
  height: auto;
}
.probe-experiment .stage-wrap {
  flex: none;
  width: 100%;
  height: auto;
  aspect-ratio: 1.618 / 1;
  min-height: 340px;
}
.probe-experiment .reading__label {
  white-space: normal;
  line-height: 1.35;
}
.probe-compare {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 9px 16px 10px;
  border-top: 1px solid #edf4fc;
  border-bottom: 1px solid #edf4fc;
  background: linear-gradient(180deg, #fbfdff, #f6faff);
}
.probe-compare__item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding-right: 14px;
  border-right: 1px dashed #e4edf8;
}
.probe-compare__item span {
  color: #8a9db4;
  font-size: 10px;
  white-space: nowrap;
}
.probe-compare__item strong {
  color: #2f6bff;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.probe-compare__item small {
  color: #91a5ba;
  font-size: 9px;
}
.probe-compare__item--theory strong {
  color: #b45309;
}
.probe-compare__delta {
  display: flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}
.probe-compare__delta span {
  color: #8a9db4;
  font-size: 10px;
}
.probe-compare__delta strong {
  color: #5b7594;
  font-size: 13px;
  font-weight: 650;
}
.probe-compare__delta strong[data-state="positive"] { color: #0e8f7e; }
.probe-compare__delta strong[data-state="negative"] { color: #c2410c; }
.probe-compare__delta small {
  color: #91a5ba;
  font-size: 9px;
}
@media (max-width: 1180px) {
  .probe-experiment .stage-wrap {
    aspect-ratio: 1.618 / 1;
    min-height: 320px;
  }
  .probe-compare {
    grid-template-columns: 1fr 1fr;
  }
  .probe-compare__delta {
    grid-column: 1 / -1;
    padding-top: 2px;
    border-top: 1px dashed #e4edf8;
  }
}

/* --------------------------------------------------------------------------
   两点电荷电场：预览比例、测量读数条、开关参数
   -------------------------------------------------------------------------- */
.fieldmap-experiment .workspace-grid {
  align-items: start;
}
.fieldmap-experiment .stage-card {
  height: auto;
}
.fieldmap-experiment .stage-wrap {
  flex: none;
  height: clamp(420px, 54vh, 620px);
  min-height: 400px;
}
.fieldmap-experiment .stage-canvas {
  cursor: grab;
}
.fieldmap-readout {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 16px 12px;
  border-top: 1px solid #edf4fc;
  border-bottom: 1px solid #edf4fc;
  background: linear-gradient(180deg, #fbfdff, #f5f9ff);
}
.fieldmap-readout__hint {
  color: #8a9db4;
  font-size: 10px;
  line-height: 1.5;
}
.fieldmap-readout__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}
.fieldmap-readout__item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid #e9f1fa;
  border-radius: 9px;
  background: #fff;
  overflow: hidden;
}
.fieldmap-readout__item span {
  flex: none;
  color: #8a9db4;
  font-size: 9.5px;
  white-space: nowrap;
}
.fieldmap-readout__item strong {
  min-width: 0;
  color: #27456b;
  font-family: var(--font-serif);
  font-size: 14.5px;
  font-weight: 650;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fieldmap-readout__item small {
  flex: none;
  color: #91a5ba;
  font-size: 8.5px;
}
.fieldmap-readout__item--potential {
  border-style: dashed;
  background: #fbfaff;
}
.fieldmap-readout__item--potential.is-active {
  border-color: #cdbef8;
  background: linear-gradient(145deg, #faf7ff, #f1ebff);
  box-shadow: 0 3px 10px rgba(109, 75, 224, 0.08);
}
.fieldmap-readout__item--potential.is-active strong {
  color: #6d4be0;
}
.fieldmap-readout__item--potential.is-active span {
  color: #7f68c4;
}
.param--toggle .param-head {
  min-height: 24px;
}
.param-switch {
  color: #7187a2;
  font-size: 10px;
}
.param--toggle .param-hint {
  margin-top: 5px;
}
@media (max-width: 1180px) {
  .fieldmap-experiment .stage-wrap {
    height: clamp(380px, 54vh, 520px);
    min-height: 340px;
  }
  .fieldmap-experiment .side-stack {
    display: flex;
  }
  .fieldmap-readout__grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 760px) {
  .fieldmap-readout__grid {
    grid-template-columns: 1fr;
  }
  .fieldmap-readout__item strong {
    font-size: 13.5px;
  }
}

/* --------------------------------------------------------------------------
   Polarization experiment
   -------------------------------------------------------------------------- */
.polarization-experiment .stage-wrap {
  height: clamp(430px, 56vh, 560px);
  min-height: 430px;
  background: #070d17;
}
.polarization-experiment .stage-canvas {
  background: #070d17;
  cursor: grab;
}
.polarization-experiment .stage-hud {
  border-color: rgba(134, 178, 232, 0.28);
  background: rgba(8, 19, 34, 0.72);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
}
.polarization-experiment .stage-hud .hud__top {
  color: rgba(176, 207, 242, 0.9);
}
.polarization-experiment .stage-hud .hud__value {
  color: #FFC06C;
}
.polarization-experiment .stage-hud .hud__sub {
  color: rgba(166, 195, 228, 0.82);
}
.polarization-experiment .stage-tip {
  background: #0d1a2b;
  border-top-color: rgba(86, 132, 190, 0.22);
  color: rgba(166, 196, 232, 0.82);
}
.polarization-experiment .stage-tip kbd {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.12);
  color: #dcecff;
}
.polarization-experiment .transport-bar {
  background: #0d1a2b;
  border-top-color: rgba(86, 132, 190, 0.2);
}
.polarization-experiment .transport-bar .btn--soft,
.polarization-experiment .transport-bar .btn--ghost {
  color: #cfe3fb;
  border-color: rgba(126, 170, 224, 0.28);
  background: rgba(255, 255, 255, 0.05);
}
.polarization-experiment .transport-bar .select-label,
.polarization-experiment .transport-bar .switch-label {
  color: rgba(176, 205, 238, 0.88);
}
@media (max-width: 1180px) {
  .polarization-experiment .stage-wrap {
    height: clamp(400px, 52vh, 540px);
    min-height: 400px;
  }
}
