:root {
  --ink: #172554;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --orange: #f97316;
  --cyan: #0891b2;
  --paper: #f5f7ff;
  --card: #ffffff;
  --line: #dce3f4;
  --shadow: 0 18px 50px rgba(43, 55, 112, .10);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; min-width: 320px; }
button { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #f59e0b; outline-offset: 3px; }
.topbar { height: 76px; padding: 0 clamp(18px, 4vw, 56px); display: flex; align-items: center; gap: 36px; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); }
.brand { color: var(--ink); display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 210px; }
.brand-mark { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; color: white; font: 700 25px Georgia; background: var(--primary); box-shadow: 5px 6px 0 #c7d2fe; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: .08em; }
.brand small { color: var(--muted); font-size: 12px; margin-top: 2px; }
.main-nav { display: flex; align-self: stretch; gap: 26px; }
.nav-button { border: 0; background: transparent; color: var(--muted); font-weight: 650; padding: 0 2px; cursor: pointer; position: relative; }
.nav-button.active { color: var(--primary); }
.nav-button.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }
.mode-pill { margin-left: auto; padding: 9px 14px; border-radius: 999px; background: #ecfdf5; color: #047857; font-size: 13px; font-weight: 700; }
.mode-pill span, .live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #10b981; margin-right: 6px; box-shadow: 0 0 0 4px #d1fae5; }
.app-shell { display: grid; grid-template-columns: 270px 1fr; min-height: calc(100vh - 76px); }
.experiment-list { padding: 28px 18px; background: #eef2ff; border-right: 1px solid var(--line); max-height: calc(100vh - 76px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #c7d2fe transparent; position: sticky; top: 76px; align-self: start; }
.side-heading { display: flex; justify-content: space-between; align-items: center; padding: 0 8px 14px; }
.side-heading p { margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .08em; }
.side-heading span { background: #dde4ff; color: var(--primary); padding: 3px 8px; border-radius: 99px; font-size: 12px; }
.experiment-card { width: 100%; min-height: 76px; margin-bottom: 10px; padding: 12px; border: 1px solid transparent; border-radius: 17px; display: grid; grid-template-columns: 43px 1fr auto; align-items: center; gap: 11px; text-align: left; color: var(--ink); background: transparent; cursor: pointer; transition: .2s ease; }
.experiment-card:hover { background: rgba(255,255,255,.64); transform: translateY(-1px); }
.experiment-card.active { background: white; border-color: #c7d2fe; box-shadow: 0 10px 25px rgba(67, 56, 202, .10); }
.experiment-card strong, .experiment-card small { display: block; }
.experiment-card strong { font-size: 14px; margin-bottom: 6px; }
.experiment-card small { font-size: 12px; color: var(--muted); }
.experiment-card i { color: #a5b4fc; font-size: 11px; font-style: normal; font-weight: 800; }
.subject-icon { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 13px; font-weight: 850; font-size: 19px; }
.subject-icon.mechanics { background: #ffedd5; color: #c2410c; }
.subject-icon.optics { background: #e0f2fe; color: #0369a1; }
.subject-icon.electric { background: #fef3c7; color: #b45309; }
.coming-soon { margin: 28px 8px 0; border-top: 1px solid #d8def3; padding-top: 20px; }
.coming-soon strong { font-size: 13px; }
.coming-soon p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.workspace { padding: clamp(24px, 3.4vw, 48px); max-width: 1420px; width: 100%; margin: 0 auto; }
.workspace-head { display: flex; justify-content: space-between; gap: 28px; margin-bottom: 25px; }
.eyebrow, .section-kicker { color: var(--primary); text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 800; }
h1 { font-size: clamp(25px, 3vw, 38px); line-height: 1.15; margin: 9px 0 8px; letter-spacing: -.03em; }
.workspace-head p, .map-intro p { margin: 0; color: var(--muted); line-height: 1.7; }
.workspace-actions { display: flex; gap: 10px; align-items: flex-start; }
.icon-button, .reset-button, .inquiry-card button { height: 42px; border-radius: 12px; cursor: pointer; border: 1px solid var(--line); background: white; color: var(--ink); font-weight: 700; }
.icon-button { width: 42px; font-size: 17px; }
.reset-button { padding: 0 16px; }
.experiment-grid { display: grid; grid-template-columns: minmax(460px, 1fr) 310px; gap: 18px; }
.stage-card, .control-card, .observation-card, .inquiry-card { background: var(--card); border: 1px solid var(--line); border-radius: 23px; box-shadow: var(--shadow); }
.stage-card { min-height: 440px; display: flex; flex-direction: column; overflow: hidden; }
.stage-label { padding: 16px 20px; font-size: 12px; font-weight: 700; color: var(--muted); border-bottom: 1px solid #edf0f8; }
.stage { flex: 1; min-height: 340px; display: grid; place-items: center; padding: 12px; background-color: #fbfcff; background-image: radial-gradient(#d9def2 1px, transparent 1px); background-size: 20px 20px; overflow: hidden; }
.stage svg { width: 100%; height: 100%; max-height: 350px; overflow: visible; }
.lever-equation { padding: 16px 12px; text-align: center; background: #eef2ff; color: var(--primary-dark); font-size: 16px; line-height: 1.6; font-variant-numeric: tabular-nums; }
.lever-equation[hidden] { display: none; }
.lever-values { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; margin: 6px 0; font-size: 18px; font-weight: 500; }
.lever-values span { white-space: nowrap; }
.experiment-reading { padding: 16px 20px; background: #eef2ff; font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
.reading-formula { color: var(--primary-dark); font-weight: 600; margin-bottom: 10px; }
.reading-values { display: grid; gap: 6px; font-variant-numeric: tabular-nums; }
.reading-row { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: space-between; border-bottom: 1px solid #dce3f4; padding: 5px 0; }
.reading-row > span { color: #475569; }
.reading-row strong { font-weight: 500; color: #172554; }
.reading-meaning { margin: 12px 0 6px; color: #3730a3; }
.reading-legend { margin: 0; color: #475569; font-size: 14px; }
.reading-rounding { display: block; margin-top: 8px; font-size: 12px; color: #475569; }
.stage-hint { padding: 12px 18px; text-align: center; color: var(--muted); font-size: 13px; background: #f8faff; border-top: 1px solid #edf0f8; }
.control-card { padding: 20px; }
.panel-title { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 1px solid #edf0f8; padding-bottom: 15px; margin-bottom: 4px; }
.panel-title span { font-weight: 800; }
.panel-title small { color: var(--muted); font-size: 11px; }
.control-group { padding: 16px 0 12px; border-bottom: 1px solid #edf0f8; }
.control-label { display: flex; justify-content: space-between; gap: 15px; font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.precision-input { display: flex; align-items: center; gap: 5px; padding: 4px 7px; color: var(--primary); background: #eef2ff; border: 1px solid #dbe3ff; border-radius: 9px; font-variant-numeric: tabular-nums; }
.precision-input input { width: 54px; border: 0; outline: 0; padding: 0; color: var(--primary); background: transparent; text-align: right; font-family: inherit; font-size: 13px; font-weight: 700; line-height: 1.2; }
.precision-input input::-webkit-inner-spin-button { opacity: .55; }
.precision-input span { font-size: 11px; }
input[type="range"] { appearance: none; width: 100%; height: 7px; border-radius: 99px; background: linear-gradient(to right, var(--primary) 0 var(--progress), #dbe2f3 var(--progress) 100%); cursor: grab; touch-action: none; }
input[type="range"]:active { cursor: grabbing; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 22px; height: 22px; border-radius: 50%; background: white; border: 5px solid var(--primary); box-shadow: 0 3px 10px rgba(42, 45, 110, .24); transition: transform .12s ease, box-shadow .12s ease; }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.08); box-shadow: 0 4px 14px rgba(42, 45, 110, .3); }
.range-scale { display: flex; justify-content: space-between; margin-top: 8px; color: #94a3b8; font-size: 10px; font-variant-numeric: tabular-nums; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; background: #eef2ff; padding: 5px; border-radius: 13px; }
.segmented button { border: 0; background: transparent; padding: 9px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 700; }
.segmented button.active { background: white; color: var(--primary); box-shadow: 0 3px 10px rgba(48,46,112,.12); }
.preset-block { margin-top: 19px; }
.preset-block label { display: block; font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 9px; }
.preset-row { display: flex; flex-wrap: wrap; gap: 7px; }
.preset-row button { border: 1px solid #d7ddf0; background: #f8faff; color: #475569; border-radius: 9px; padding: 7px 9px; font-size: 12px; cursor: pointer; }
.observation-card { margin-top: 18px; padding: 22px 24px; display: flex; justify-content: space-between; align-items: center; gap: 25px; box-shadow: none; border-left: 5px solid var(--orange); }
.observation-main { display: flex; align-items: center; gap: 18px; }
.result-badge { min-width: 74px; height: 74px; padding: 10px; border-radius: 20px; display: grid; place-items: center; text-align: center; background: #fff7ed; color: #c2410c; font-size: 12px; font-weight: 800; }
.observation-card h2, .inquiry-card h2 { margin: 6px 0; font-size: 18px; }
.observation-card p { margin: 0; color: var(--muted); font-size: 13px; }
.metrics { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.metric { min-width: 104px; padding: 12px 14px; background: #f5f7ff; border-radius: 14px; }
.metric small, .metric strong { display: block; }
.metric small { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.metric strong { font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inquiry-card { margin-top: 18px; padding: 22px 24px; box-shadow: none; display: grid; grid-template-columns: 1fr auto; align-items: center; }
.inquiry-card button { padding: 0 16px; color: var(--primary); }
.inquiry-card > p { grid-column: 1 / -1; margin: 12px 0 0; padding: 14px 16px; border-radius: 12px; color: #334155; background: #eef2ff; line-height: 1.6; }
.map-view { padding: clamp(40px, 7vw, 92px) clamp(20px, 6vw, 90px); max-width: 1500px; margin: auto; }
.map-intro { max-width: 700px; }
.map-intro h1 { font-size: clamp(28px, 4vw, 42px); }
.map-tools { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-top: 24px; }
.map-tools label { display: grid; gap: 6px; font-size: 14px; }
.map-search-label { flex: 1 1 280px; }
.map-tools input, .map-tools select, .map-tools button, .map-experiment { min-height: 44px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); font: inherit; max-width: 100%; }
.map-tools button, .map-experiment { cursor: pointer; }
#map-count { color: #475569; font-size: 14px; }
.chapter-card { margin: 12px 0; border: 1px solid var(--line); border-radius: 16px; background: white; overflow: hidden; }
.chapter-card summary { display: flex; gap: 16px; padding: 18px; align-items: center; cursor: pointer; }
.chapter-card summary::after { content: '展开 ＋'; margin-left: auto; flex-shrink: 0; font-size: 14px; color: var(--primary-dark); }
.chapter-card[open] summary::after { content: '收起 −'; }
.chapter-number { font-size: 24px; color: var(--primary); font-variant-numeric: tabular-nums; }
.chapter-card summary strong { display: block; font-size: 18px; }
.chapter-card summary small { display: block; margin-top: 6px; color: #475569; font-size: 13px; }
.chapter-sections { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,300px),1fr)); gap: 16px; padding: 0 18px 18px; }
.chapter-sections section { background: #f8faff; border-radius: 12px; padding: 16px; min-width: 0; }
.chapter-sections h3 { font-size: 17px; margin: 0 0 10px; }
.chapter-sections ul { padding-left: 22px; margin: 0 0 12px; line-height: 1.8; font-size: 16px; overflow-wrap: anywhere; }
.map-experiment { color: var(--primary-dark); border-color: #c7d2fe; text-align: left; }
.knowledge-only { font-size: 13px; color: #64748b; }
.map-sources { margin-top: 24px; color: #475569; font-size: 14px; line-height: 1.8; }
.map-sources summary { cursor: pointer; padding: 10px 0; }
.map-sources a { color: var(--primary-dark); }
#experiment-title { scroll-margin-top: 90px; }
.knowledge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 50px; }
.knowledge-column { min-height: 260px; padding: 26px; border-radius: 25px; background: white; border: 1px solid var(--line); box-shadow: var(--shadow); }
.knowledge-column > span { font: 800 50px/1 Georgia; color: #e4e8f5; }
.knowledge-column h2 { margin: 35px 0 10px; font-size: 24px; }
.knowledge-column p { color: var(--muted); font-size: 13px; min-height: 46px; line-height: 1.6; }
.progress { height: 7px; background: #edf0f7; border-radius: 99px; overflow: hidden; margin: 20px 0 10px; }
.progress i { display: block; height: 100%; background: #cbd5e1; border-radius: inherit; }
.knowledge-column.ready .progress i { background: var(--primary); }
.knowledge-column small { color: var(--muted); }
.map-path { margin-top: 34px; padding: 24px; background: #18204f; color: white; border-radius: 25px; display: flex; align-items: center; justify-content: space-around; gap: 16px; }
.map-path div { display: flex; flex-direction: column; gap: 5px; }
.map-path span { color: #a5b4fc; font-size: 12px; }
.map-path b { color: #f59e0b; }
dialog { width: min(430px, calc(100% - 34px)); border: 0; border-radius: 24px; padding: 30px; color: var(--ink); box-shadow: 0 30px 100px rgba(20,25,60,.3); }
dialog::backdrop { background: rgba(15,23,42,.52); backdrop-filter: blur(3px); }
.dialog-close { position: absolute; right: 16px; top: 14px; border: 0; background: transparent; font-size: 24px; cursor: pointer; }
dialog h2 { font-size: 25px; }
dialog li { margin: 12px 0; color: #475569; }
@media (max-width: 1050px) {
  .experiment-grid { grid-template-columns: 1fr; }
  .control-card { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .control-card .panel-title, .preset-block { grid-column: 1 / -1; }
  .knowledge-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .topbar { height: auto; min-height: 68px; padding: 10px 16px; gap: 12px; flex-wrap: wrap; }
  .brand { min-width: 0; margin-right: auto; }
  .brand strong { font-size: 14px; }
  .brand small { display: none; }
  .brand-mark { width: 38px; height: 38px; }
  .mode-pill { display: none; }
  .main-nav { order: 3; width: 100%; height: 42px; justify-content: center; }
  .app-shell { display: block; }
  .experiment-list { padding: 12px 14px; display: flex; overflow-x: auto; overflow-y: hidden; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line); max-height: none; position: static; }
  .side-heading, .coming-soon { display: none; }
  .experiment-card { flex: 0 0 205px; margin: 0; min-height: 64px; grid-template-columns: 38px 1fr; }
  .experiment-card i { display: none; }
  .subject-icon { width: 38px; height: 38px; }
  .workspace { padding: 22px 14px 40px; }
  .workspace-head { align-items: flex-start; }
  .workspace-actions .icon-button { display: none; }
  .reset-button { font-size: 0; padding: 0; width: 42px; }
  .reset-button::first-letter { font-size: 19px; }
  .stage-card { min-height: 390px; }
  .stage { min-height: 290px; }
  .control-card { grid-template-columns: 1fr; }
  .control-card .panel-title, .preset-block { grid-column: auto; }
  .observation-card { align-items: flex-start; flex-direction: column; }
  .metrics { width: 100%; overflow-x: auto; }
  .metric { flex: 1; }
  .knowledge-grid { grid-template-columns: 1fr; }
  .map-path { align-items: stretch; flex-direction: column; }
  .map-path b { transform: rotate(90deg); align-self: center; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
