:root {
  color-scheme: light;
  --canvas: #f1f4f7;
  --paper: #fff;
  --wash: #edf3f8;
  --ink: #162333;
  --deep: #0b2945;
  --muted: #35475a;
  --line: #cdd7e2;
  --blue: #245985;
  --blue-dark: #1d476c;
  --selected: #dbe8f4;
  --orange: #974725;
  --green: #2b634f;
  --scene: #f5f8fc;
  --plot-grid: #dae1e8;
  --curve: #245985;
  --curve-2: #29828e;
  --curve-3: #71649b;
  --base-curve: #ba6340;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --body: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 84px; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 17px/1.7 var(--body); }
a { color: var(--blue-dark); text-decoration: none; }
button, select, input { font: inherit; color: inherit; }
button, select, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
button, input, select { border: 1px solid var(--line); border-radius: 5px; }
button { min-height: 37px; padding: 5px 12px; }
input[type=range], input[type=checkbox] { accent-color: var(--blue); }
h1, h2, h3, h4, p, figure { margin: 0; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid #4892a3; outline-offset: 3px; }
.sr-only, .skip-link { position: absolute; width: 1px; height: 1px; clip-path: inset(100%); overflow: hidden; white-space: nowrap; }
.skip-link:focus { width: auto; height: auto; clip-path: none; z-index: 10; top: 6px; left: 12px; padding: 8px 12px; background: var(--paper); }
body:not(.desktop) .desktop-only { display: none !important; }

.shell { width: min(1224px, calc(100% - 92px)); margin-inline: auto; min-width: 0; }
.site-header { position: sticky; top: 0; z-index: 5; color: var(--deep); background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 66px; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: inherit; font-weight: 680; white-space: nowrap; }
.brand img { display: block; }
#navigation { display: flex; align-items: stretch; gap: 8px; }
#navigation > a, .nav-group > summary { display: flex; align-items: center; gap: 9px; min-height: 66px; padding: 0 9px; color: inherit; border-bottom: 3px solid transparent; font-size: 15px; font-weight: 620; white-space: nowrap; list-style: none; }
#navigation > a:is(:hover,[aria-current]), .nav-group:is([open],.active) > summary, .nav-group > summary:hover { color: var(--blue-dark); border-bottom-color: var(--blue); }
.nav-group { position: relative; }
summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); }
.nav-group[open] > summary::after { transform: translateY(2px) rotate(225deg); }
.nav-menu { position: absolute; top: 100%; right: 0; width: min(390px, 85vw); padding: 7px; border: 1px solid var(--line); background: var(--paper); box-shadow: 0 9px 24px #122b3724; }
.nav-menu a { display: grid; grid-template-columns: 2ch 1fr; align-items: baseline; gap: 11px; padding: 8px 10px; font-size: 15px; }
.nav-menu a:is(:hover,[aria-current]) { background: var(--selected); color: var(--blue); }
.nav-menu span, .experiment-links span { font: 14px var(--mono); color: var(--blue); }
.nav-toggle { display: none; }

.intro { margin-top: clamp(22px, 4vw, 46px); padding-bottom: 19px; border-bottom: 1px solid var(--line); }
.experiment-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px 18px; }
h1 { color: var(--deep); font-size: clamp(28px, 3.8vw, 45px); font-weight: 700; line-height: 1.23; letter-spacing: -.036em; }
.intro .actions { flex: 0 0 auto; }
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 9px; color: var(--blue); font-size: 15px; font-weight: 650; }
.breadcrumb span + span { border-left: 1px solid #9aaead; padding-left: 12px; color: var(--muted); }
.section { margin-top: clamp(26px, 3.5vw, 44px); min-width: 0; }
.report-part { border-bottom: 1px solid var(--line); padding-bottom: clamp(22px, 3vw, 36px); }
.section-header, .panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; }
.section-header { margin-bottom: 14px; }
h2 { color: var(--deep); font-size: clamp(22px, 2.3vw, 29px); font-weight: 720; line-height: 1.3; }
h3 { color: var(--deep); font-size: 18px; font-weight: 680; line-height: 1.45; }
.problem-copy p, .goals-copy > p { text-indent: 2em; }
.problem-copy p + p { margin-top: 10px; }
.model-figure { padding: 12px 16px; margin: 14px auto 0; border: 1px solid var(--line); background: #fff; border-radius: 6px; text-align: center; }
.model-figure img { display: block; width: min(100%, 620px); max-height: 350px; object-fit: contain; height: auto; margin: 0 auto; }
figcaption { color: var(--muted); font-size: 14px; }
.control-objectives { list-style: none; padding: 0; margin: 10px 0 0; }
.control-objectives li::marker, .section ol li::marker { color: var(--blue); font-weight: 650; }
.control-objectives p { margin: 4px 0 12px; }
.numbered { list-style: none; margin: 7px 0 0; padding: 0; }
.section li + li { margin-top: 3px; }
.resources a:hover { text-decoration: underline; }
.theory-details > summary { display: flex; align-items: center; justify-content: space-between; min-height: 45px; gap: 12px; list-style: none; }
.theory-details > summary::after { content: "+"; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; color: var(--blue); font: 25px/1 var(--mono); }
.theory-details[open] > summary::after { content: "−"; }
.theory { margin-top: 10px; }
.theory p, .theory figure { margin-top: 9px; }
.formula { overflow-x: auto; padding-inline: 4px; }
.diagram { text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
.diagram img { display: block; width: min(100%, 720px); max-height: 218px; object-fit: contain; margin: 2px auto 8px; }
.diagram figcaption { color: #35475a; }
.simulation { margin-top: 18px; }
.sim-subtitle { margin-bottom: 12px; }
.workbench, .work-column { display: grid; gap: 16px; min-width: 0; }

.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.primary { color: white; background: var(--blue); border-color: var(--blue); font-weight: 680; }
.primary:not(:disabled):hover { background: var(--blue-dark); }
.secondary { color: var(--blue-dark); background: var(--paper); border-color: var(--line); font-weight: 620; }
.secondary:not(:disabled):hover { background: var(--selected); }
.text-button { padding-inline: 3px; background: transparent; border-color: transparent; color: var(--blue-dark); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.settings { min-width: 0; padding: 14px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--wash); }
.settings-core { display: grid; gap: 10px; margin-top: 10px; }
#model-fields { margin: 11px 0 9px; }
.settings .actions { margin-top: 9px; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(188px,100%),1fr)); gap: 8px; }
.field { display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 4px; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); font-size: 14px; font-weight: 600; }
.field-input { display: flex; align-items: center; gap: 5px; }
.field-input small { flex: 0 0 auto; font-size: 12px; font-weight: 500; color: var(--muted); }
.field input, .field select, .playback select { width: 100%; min-width: 0; height: 34px; padding: 4px 6px; background: var(--paper); }
.field input[type=number] { font-family: var(--mono); }
.condition-note, .run-note, #model-note { font-size: 14px; color: var(--muted); }
.stage { min-width: 0; padding: 13px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.stage-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 9px; }
.status { padding: 1px 7px; border-radius: 4px; background: var(--selected); color: var(--blue-dark); font-size: 12px; font-weight: 660; }
.status[data-warning] { color: var(--orange); background: var(--paper); box-shadow: inset 0 0 0 1px currentColor; }
.scene { margin-top: 10px; background: var(--scene); border: 1px solid var(--line); border-radius: 5px; }
.scene canvas { display: block; width: 100%; height: clamp(206px, 27vw, 321px); }
.readouts { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-top: 9px; }
.readouts > div { display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 1px 5px; padding: 6px; text-align: center; border: 1px solid var(--line); border-radius: 5px; background: var(--wash); }
.readouts span { color: var(--muted); font-size: 13px; }
.readouts strong, .readouts small, #clock { font-family: var(--mono); }
.readouts small { color: var(--muted); font-size: 11px; }
.playback { display: grid; grid-template-columns: auto minmax(45px,1fr) auto auto; align-items: center; gap: 8px; margin-top: 9px; }
.playback button { width: 62px; padding-inline: 4px; }
.playback input { width: 100%; min-width: 0; }
.playback output { color: var(--muted); font-size: 13px; white-space: nowrap; }
.playback select { max-width: 72px; }
.run-note { margin-top: 7px; }
.evidence { min-width: 0; }
.evidence .section-header { margin-bottom: 8px; }
.compare-label { display: flex; align-items: center; gap: 5px; font-size: 14px; color: var(--muted); }
.chart-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.chart-tabs button, .view-tabs button { color: var(--muted); background: var(--paper); border-color: var(--line); }
.chart-tabs button[aria-pressed=true], .view-tabs button[aria-current] { color: var(--blue-dark); background: var(--selected); border-color: #9eb7cf; font-weight: 650; }
.chart-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.chart-grid.count-3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
.chart-grid.count-1 { grid-template-columns: minmax(0,1fr); }
.chart { min-width: 0; padding: 8px 10px 3px; margin: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 7px; }
.chart-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 8px; }
.chart-header h4 { color: var(--deep); font-size: 14px; }
.chart-button { min-height: 26px; padding: 2px 4px; font-size: 12px; }
.chart canvas { display: block; width: 100%; height: 173px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 0 9px; min-height: 20px; margin-top: 1px; font-size: 11px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend-line { display: inline-block; width: 15px; border-top: 2px solid var(--legend-color); }
.legend-line.dashed { border-top-style: dashed; }
.chart-tip { min-height: 18px; color: var(--muted); font: 11px/1.4 var(--mono); }
#quick-metrics { margin-top: 10px; }
.quick-metrics { display: flex; flex-wrap: wrap; gap: 5px 13px; color: var(--muted); font-size: 13px; }
.quick-metrics b { color: var(--blue-dark); font: 650 13px var(--mono); }

.table-wrap { margin-block: 9px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 7px 9px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child :is(td,th) { border-bottom: 0; }
thead { background: var(--wash); }
td.numeric { font: 13px/1.55 var(--mono); white-space: nowrap; }
.record-section, .discussion, .resources, .matrix-details { margin-top: 16px; }
.resources { padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.resources > summary, .matrix-details > summary { color: var(--blue-dark); font-weight: 650; }
.resources-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 9px 0; }
.resource-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-block: 8px; }
.resource-grid .secondary { text-align: left; }
.resource-list { display: flex; gap: 4px 12px; flex-wrap: wrap; }
.reader { padding: 12px 0; font-size: 15px; overflow-wrap: anywhere; }
.reader h2, .reader h3 { margin-top: 16px; }
.reader .katex-display { overflow-x: auto; padding-block: 5px; }
.reader img { max-height: 350px; }
.reader pre { padding: 9px; overflow: auto; background: var(--wash); }
.site-footer { margin: 25px 0 0; padding: 16px 0 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.site-footer span { margin-inline: 4px; }

#report { display: none; }
dialog { max-width: min(90vw,900px); width: 790px; max-height: 90vh; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }
dialog::backdrop { background: #1629317d; }
#figure-content img { display: block; margin: 10px auto; max-height: 75vh; background: #fff; object-fit: contain; }
#figure-content .chart canvas { height: min(51vh,420px); }
#toast { position: fixed; right: 16px; bottom: 14px; z-index: 8; max-width: min(450px,88vw); padding: 8px 13px; border-radius: 5px; color: #fff; background: #1d476c; font-size: 14px; box-shadow: 0 4px 16px #0c263524; }

.experiment-intro { margin-top: clamp(14px, 2.2vw, 30px); }
body:not(.desktop) .section-header h2, body:not(.desktop) .theory-details h2 { font-size: clamp(22px, 2.4vw, 30px); }
#experiment-principle h3 { font-size: 19px; margin: 16px 0 4px; }
.theory .formula, .diagram-scroll { max-width: 100%; overflow: auto; }
.theory .katex-display { min-width: 100%; width: max-content; padding-inline: 5px; }
.theory .diagram { margin: 10px 0; background: #fff; }
.diagram img { display: block; width: min(100%, 790px); max-height: 280px; margin: 0 auto; }
.numbered li { display: grid; grid-template-columns: 2.65em minmax(0,1fr); gap: .1em; margin: 5px 0; }
.list-number { color: var(--blue-dark); font-weight: 630; }
figcaption { text-align: center; line-height: 1.4; }
.common-group { min-width: 0; margin: 10px 0 0; padding: 7px 9px 9px; border: 1px solid var(--line); border-radius: 6px; }
.common-group legend { padding-inline: 5px; color: var(--deep); font-weight: 650; font-size: 15px; }
.slider-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; }
.slider-field { min-width: 0; padding: 6px 9px; border-radius: 5px; border: 1px solid var(--line); background: var(--paper); display: grid; font-size: 14px; }
.slider-field > span:first-child, .slider-bounds { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.slider-field output { color: var(--blue-dark); font: 600 13px var(--mono); white-space: nowrap; }
.slider-field input { width: 100%; margin: 4px 0; accent-color: var(--blue); }
.slider-bounds { color: var(--muted); font: 12px var(--mono); }
.common-group .condition-note { margin-top: 5px; }
#preset { width: 100%; }
.preset-field { max-width: 420px; }
.field-grid.single .field { display: grid; grid-template-columns: minmax(0,1fr) minmax(95px,205px); align-items: center; }
.param-group { border: 1px solid var(--line); border-radius: 5px; background: var(--paper); }
.param-group + .param-group { margin-top: 7px; }
.param-group summary { display: grid; grid-template-columns: auto minmax(0,1fr) 14px; align-items: center; gap: 9px; padding: 5px 9px; list-style: none; color: var(--blue-dark); font-size: 14px; font-weight: 600; }
.param-group summary::after { content: "+"; text-align: center; }
.param-group[open] summary::after { content: "−"; }
.param-group .field-grid { padding: 0 6px 6px; }
.param-summary { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: 12px; font-weight: 400; }
.scene canvas { height: clamp(200px, 20vw, 282px); }
.stage { padding: 10px 13px; }
.readouts { gap: 5px; }
.readouts > div { padding: 3px 5px; }
.status[data-complete] { color: var(--green); background: var(--wash); }
.chart-header { justify-content: center; font-weight: 550; padding: 2px 0 4px; }
.chart figcaption h4 { font-weight: 550; font-size: 14px; }
.chart canvas { height: 210px; }
.chart-grid.count-1 canvas { height: min(320px,50vh); }
.chart-tip { min-height: 0; }
.chart-tip:empty, .chart-legend:empty { display: none; }
.chart-legend { font-size: 12px; }
.evaluation h4, .record-section h3 { font-size: 16px; color: var(--deep); }
.evaluation .table-wrap { margin-top: 5px; }
.evaluation .table-wrap td { padding-block: 4px; }
.chart-notice { min-height: 70px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--muted); }
.chart-notice .table-wrap { margin: 4px 0; }
.table-wrap caption { padding: 5px; color: var(--deep); font-weight: 650; }
td.numeric { font-variant-numeric: tabular-nums; }
#verification-note, #result-discussion p { margin-top: 8px; }
#metrics h3, #result-discussion h3 { margin-top: 12px; }
#result-discussion:empty { display: none; }
.nav-menu a { min-height: 44px; }

@media (min-width: 721px) and (max-width: 980px) {
  .chart-grid.count-3 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .chart-grid.count-3 > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 1000px) {
  .shell { width: calc(100% - 48px); }
}
@media (max-width: 900px) {
  .header-inner { min-height: 58px; }
  .nav-toggle.web-only { display: inline-block; min-height: 44px; background: var(--wash); color: var(--deep); }
  #navigation { display: none; position: absolute; top: 100%; right: 0; left: 0; max-height: 76vh; overflow: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 6px; box-shadow: 0 8px 24px #172a4022; }
  #navigation.open { display: block; }
  #navigation > a, .nav-group > summary { min-height: 44px; justify-content: space-between; }
  .nav-menu { position: static; width: auto; border: 0; box-shadow: none; }
}
@media (max-width: 860px) {
  .slider-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .shell { width: calc(100% - 28px); }
  .intro { margin-top: 19px; }
  .chart-grid, .chart-grid.count-3 { grid-template-columns: minmax(0,1fr); }
  .field-grid { grid-template-columns: repeat(auto-fit,minmax(min(144px,100%),1fr)); }
  .stage, .settings { padding: 10px; }
  .scene canvas { height: 210px; }
  .resource-grid { grid-template-columns: 1fr; }
  :is(.primary,.secondary), .playback select, .param-group summary { min-height: 44px; }
  .diagram-scroll img { min-width: 500px; }
}
@media (max-width: 520px) {
  .experiment-heading { align-items: flex-start; flex-direction: column; }
  .slider-grid { grid-template-columns: 1fr; }
  .stage-header { align-items: flex-start; }
  .brand { gap: 7px; font-size: 15px; }
}
@media (max-width: 350px) {
  .shell { width: calc(100% - 20px); }
  .field-grid { grid-template-columns: 1fr; }
  .readouts { gap: 4px; }
}

.compare-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.compare-controls select { max-width: 220px; min-width: 0; padding: 3px; background: var(--paper); font-size: 13px; }
.diagram-scroll img { height: 182px; }
@media (min-width: 721px) { .diagram-scroll img { height: 220px; } }
