:root {
  color-scheme: light;
  --bg: #faf8f1; --surface: #fffefa; --text: #24211e;
  --muted: #696258; --border: #ded8cb; --control-border: #8b8277;
  --accent: #62518b; --accent-soft: #f1edf6; --success: #326957;
  --warning: #9b5417; --danger: #a33e31; --focus: #62518b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif; }
button, input, select { font: inherit; }
button, select, input[type=number] { min-height: 44px; padding: 8px 12px; border: 1px solid var(--control-border); border-radius: 9px; background: var(--surface); color: var(--text); }
button { cursor: pointer; }
button:hover { background: var(--accent-soft); border-color: var(--accent); }
button.primary { background: var(--accent); color: #fffefa; border-color: var(--accent); }
button.primary:hover { background: #504271; }
button:disabled { cursor: default; color: #847b6d; background: #f0ede5; border-color: #c8c0b1; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
p { margin-top: 6px; }
h1 { font-family: "Songti SC", "STSong", "SimSun", Georgia, serif; font-weight: 650; font-size: 33px; line-height: 1.24; letter-spacing: -.03em; }
h2 { font-size: 19px; font-weight: 650; }
h3 { font-size: 17px; font-weight: 600; }
.page-head, main { max-width: 1560px; margin: auto; }
.page-head { padding: 8px 28px 6px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.page-head .eyebrow { display: none; }
.page-head > div > p:last-child { font-size: 14px; color: var(--muted); margin-top: 3px; }
.nature { flex-shrink: 0; font-size: 12px; color: var(--muted); padding-left: 12px; border-left: 1px solid var(--border); }
main { padding: 0 28px 32px; }
.conditions { display: grid; grid-template-columns: 1.4fr 1.1fr 1.1fr 1fr; gap: 18px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.conditions > div { min-width: 0; }
.conditions label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; line-height: 1.35; font-weight: 650; }
.conditions label > span { float: right; font-weight: 400; }
.conditions select { width: 100%; font-size: 14px; background: #fffefa; }
.range-row { display: flex; gap: 12px; align-items: center; }
.range-row input[type=range] { flex: 1; min-width: 0; height: 44px; margin: 0; accent-color: var(--accent); }
.range-row input[type=number] { width: 80px; font-size: 14px; font-variant-numeric: tabular-nums; }
.configuration-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 0; font-size: 12px; position: relative; }
.configuration-row > label { color: var(--muted); }
.configuration-row > input { width: 86px; font-size: 13px; }
.configuration-row > button { font-size: 13px; background: transparent; }
.configuration-row details { margin: 0 0 0 4px; padding: 0; border: 0; background: transparent; position: relative; }
.configuration-row summary { font-size: 12px; min-height: 44px; display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; }
.configuration-row summary::before { content: '+'; font-size: 18px; line-height: 1; }
.configuration-row details[open] summary::before { content: '−'; }
.configuration-row .parameter-notes { margin-left: auto; }
.parameter-notes-body { position: absolute; z-index: 5; top: 44px; right: 0; width: 380px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 28px #24211e12; }
.parameter-notes-body h3 { font-size: 14px; margin-top: 14px; }
.parameter-notes-body h3:first-child { margin-top: 0; }
.parameter-notes-body p { font-size: 13px; line-height: 1.6; color: var(--muted); }
.configuration-row .presets[open] { z-index: 6; position: absolute; right: 0; top: 6px; max-width: 340px; padding: 0 14px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 28px #24211e12; }
.presets button { display: block; width: 100%; margin-top: 6px; font-size: 13px; }
.presets p { font-size: 12px; color: var(--muted); }
.workspace-tabs { display: flex; align-items: center; gap: 4px; min-height: 48px; }
.workspace-tabs button { background: transparent; border: 0; border-radius: 9px; padding: 8px 14px; min-height: 44px; font-size: 14px; color: var(--muted); }
.workspace-tabs button[aria-selected=true] { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.workspace-tabs > span { font-size: 12px; color: var(--muted); margin-left: auto; }
.explorer, .calculation { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px 16px; }
.explore-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.explore-toolbar > div:first-child { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.explore-toolbar button { font-size: 14px; }
.run-hint { color: var(--muted); font-size: 12px; margin-left: 4px; }
.live-metrics { display: flex; gap: 28px; flex-shrink: 0; }
.live-metrics > span { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); line-height: 1.35; }
.live-metrics strong { font-size: 23px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.4; }
.message { font-size: 12px; line-height: 1.5; color: var(--muted); margin: 7px 0 5px; min-height: 18px; }
.message.failed { color: var(--danger); }
.pipeline { display: grid; grid-template-columns: 194px minmax(0,1fr) 252px; gap: 18px; margin-top: 8px; align-items: start; }
.pipeline > section { min-width: 0; }
.pipeline h2 { font-size: 16px; line-height: 1.4; white-space: nowrap; }
.pipeline h2 > span { font-size: 11px; font-weight: 500; color: #847b6d; margin-right: 6px; }
.data-stage, .features-stage { border-right: 1px solid var(--border); padding-right: 18px; }
.dataset-previews { display: flex; gap: 5px; margin-top: 8px; }
.dataset-previews button { flex: 1; display: flex; align-items: center; flex-direction: column; min-width: 0; padding: 4px 2px; border-color: var(--border); border-radius: 8px; font-size: 11px; line-height: 1.45; }
.dataset-previews button.selected { border-color: var(--accent); background: var(--accent-soft); }
.dataset-previews canvas { display: block; width: 32px; height: 32px; border-radius: 3px; }
#dataMap { display: block; width: 100%; height: 244px; margin-top: 4px; }
#decision { display: block; width: 100%; height: 294px; margin-top: 8px; }
.stage-caption { font-size: 12px; color: var(--muted); line-height: 1.5; }
.output-stage #decisionText { font-size: 12px; color: var(--text); }
.stage-heading { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; }
.stage-heading p { font-size: 11px; color: var(--muted); margin: 0; }
.feature-scroll { overflow-x: auto; max-width: 100%; margin-top: 4px; background: #fbfaf6; border-radius: 10px; }
#featureNetwork { display: block; width: 100%; height: auto; overflow: visible; }
.layer-label { font: 13px system-ui; fill: var(--muted); font-weight: 500; }
.feature-edge { cursor: pointer; }
.edge-hit { stroke: transparent; stroke-width: 16; fill: none; cursor: pointer; }
.edge-ink { fill: none; opacity: .55; pointer-events: none; }
.feature-edge:hover .edge-ink, .feature-edge:focus-visible .edge-ink { opacity: 1; }
.feature-edge.active .edge-ink { stroke: #24211e !important; opacity: 1; }
.feature-frame { fill: var(--surface); stroke: #b1a999; stroke-width: 1.2; }
.feature-node { cursor: pointer; }
.feature-node.active .feature-frame, .feature-node:focus-visible .feature-frame { stroke: var(--accent); stroke-width: 3; }
.feature-node:hover .feature-frame { stroke: var(--accent); stroke-width: 2; }
.sample-halo { fill: none; stroke: #fff; stroke-width: 3; pointer-events: none; }
.sample-dot { fill: #24211e; pointer-events: none; }
.feature-name, .feature-value { font: 14px system-ui; fill: var(--text); pointer-events: none; font-variant-numeric: tabular-nums; }
.selected-edge-label { font: 13px system-ui; fill: var(--text); font-weight: 650; paint-order: stroke; stroke: #fffefa; stroke-width: 4px; pointer-events: none; }
.weight-legend { font-size: 11px; color: var(--muted); line-height: 1.5; margin-top: 4px; }
.line { display: inline-block; width: 24px; border-top: 3px solid #2457c5; vertical-align: middle; margin: 0 3px 3px 0; }
.line.negative { border-top-color: #7e22ce; border-top-style: dashed; margin-left: 10px; }
.feature-detail { display: grid; grid-template-columns: 144px minmax(0,1fr); gap: 20px; margin-top: 16px; padding-top: 18px; border-top: 1px solid var(--border); }
.selected-map canvas { display: block; width: 144px; height: 144px; border-radius: 8px; }
.selected-map p { font-size: 11px; color: var(--muted); line-height: 1.4; }
.feature-focus { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.feature-focus label { font-size: 12px; color: var(--muted); }
.feature-focus select { font-size: 13px; max-width: 270px; }
.feature-focus #exploreSample { max-width: 210px; }
.feature-focus button { font-size: 13px; margin-left: auto; }
.feature-readout h3 { font-size: 18px; }
.feature-readout > p { font-size: 14px; color: var(--muted); }
.selected-numbers { display: flex; flex-wrap: wrap; gap: 12px 28px; margin: 12px 0; }
.selected-numbers > div { display: flex; flex-direction: column; gap: 3px; }
.selected-numbers span { font-size: 12px; color: var(--muted); }
.selected-numbers strong { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.prob-legend { display: flex; gap: 8px; align-items: center; font-size: 12px; }
.prob-legend div { height: 10px; flex: 1; border: 1px solid #8b8277; border-radius: 2px; background: linear-gradient(to right,#fffcf8,#f9d097); }
.calculation-head, .mode-row, .step-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.calculation-head { justify-content: space-between; }
.mode-row label { font-size: 12px; color: var(--muted); }
.mode-row select, .step-controls button, .step-controls select { font-size: 13px; }
.mode-row #mode { max-width: 300px; }
.mode-row #sample { max-width: 180px; }
.calculation-stages { display: flex; align-items: center; gap: 4px; padding: 10px 0 6px; margin-top: 8px; border-top: 1px solid var(--border); }
.calculation-stages button { flex: 1; min-height: 44px; font-size: 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); text-align: left; }
.calculation-stages button[aria-current=step] { color: var(--accent); background: var(--accent-soft); font-weight: 650; }
.calculation-stages button.completed::after { content: ' · 已经过'; font-size: 10px; }
.calculation-stages button:disabled { opacity: .55; }
.phase-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
.phase-heading > span { font-size: 12px; color: var(--accent); }
.phase-heading h2 { font-size: 18px; }
.phase-heading p { flex-basis: 100%; font-size: 12px; color: var(--muted); margin-top: 0; }
.graph-row { display: grid; grid-template-columns: minmax(0,1.75fr) minmax(340px,1fr); gap: 20px; margin-top: 10px; align-items: start; }
.network-wrap { min-width: 0; overflow-x: auto; background: #fbfaf6; border-radius: 10px; padding: 8px; }
.network-wrap > svg { display: block; width: 100%; height: auto; aspect-ratio: 950/350; }
.legend, .small { font-size: 12px; color: var(--muted); line-height: 1.55; }
.network-wrap > .legend { font-size: 11px; margin-top: 4px; }
.error-panel { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }
.error-panel button { font-size: 12px; flex-shrink: 0; }
#errorMath { flex: 1; min-width: 0; font-size: 13px; }
.probability-row { display: flex; align-items: center; gap: 8px; }
.probability-bar { height: 14px; background: #eeebe4; border: 1px solid var(--control-border); border-radius: 3px; flex: 1; overflow: hidden; }
.probability-fill { height: 100%; background: #2457c5; }
.error-strip { font-size: 12px; margin-top: 5px; font-variant-numeric: tabular-nums; }
.math-pane { min-width: 0; border-left: 1px solid var(--border); padding-left: 20px; }
.focus-head { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 6px; }
.focus-head > span { font-size: 11px; color: var(--muted); }
.focus-head h3 { font-size: 17px; text-align: right; }
.focus-head label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.focus-head select { grid-column: 1/-1; width: 100%; font-size: 13px; }
.operation-formula { overflow-x: auto; font-size: 14px; padding: 10px 0; color: var(--accent); border-bottom: 1px solid var(--border); margin: 6px 0; }
.operation { margin-top: 10px; font-size: 14px; font-variant-numeric: tabular-nums; }
.operation-explanation { font-size: 12px; color: var(--muted); line-height: 1.6; margin-top: 10px; }
.math-label { font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.math-row { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.math-box { flex: 1; padding: 5px 7px; border: 1px solid #c8c0b2; border-radius: 6px; background: #fffefa; min-width: 60px; text-align: center; }
.math-box > small { display: block; font-size: 11px; line-height: 1.45; color: var(--muted); }
.math-box > strong { display: block; line-height: 1.5; font-size: 15px; font-weight: 600; }
.math-box.result { background: #edf3ed; border-color: #91aa99; }
.math-box.target { background: #fff5e6; border-color: #b97f3b; }
.operator { flex-shrink: 0; font-size: 20px; font-weight: 600; color: var(--text); }
.branch-list { position: relative; display: grid; gap: 5px; padding-right: 28px; }
.branch-list::after { content: 'Σ'; position: absolute; right: 0; top: 0; bottom: 0; border-left: 1px solid var(--control-border); display: flex; align-items: center; padding-left: 6px; font-size: 22px; }
.branch { display: flex; align-items: center; gap: 5px; font-size: 12px; min-width: 0; }
.branch > span:first-child { min-width: 36px; color: var(--muted); }
.branch .math-box { min-width: 0; padding: 4px 5px; }
.branch .math-box strong { font-size: 14px; }
.branch .operator { font-size: 17px; }
.big-equation { font-size: 17px; line-height: 1.5; background: var(--accent-soft); border-left: 2px solid var(--accent); padding: 9px 12px; margin-top: 8px; word-break: break-word; }
.signed-direction { display: flex; gap: 8px; align-items: center; margin-top: 8px; padding: 6px 8px; background: #fff6e9; border: 1px solid #dcc6a0; border-radius: 6px; font-size: 12px; }
.signed-direction .direction-arrow { display: inline-block; min-width: 25px; font-size: 24px; font-weight: 700; line-height: 1; color: #793b06; }
.parameter-change { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.parameter-change:first-child { border-top: 0; margin-top: 0; }
.change-label { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.change-equation { font-size: 13px; margin-top: 4px; }
.change-arrow { font-size: 18px; font-weight: 650; color: #793b06; }
.change-bars { height: 30px; position: relative; background: #f3f0e8; overflow: hidden; margin-top: 5px; }
.change-bars::before { content: ''; position: absolute; top: 0; bottom: 0; width: 1px; background: #8b8277; left: 50%; }
.old-bar, .new-bar { height: 8px; position: absolute; background: #2457c5; top: 5px; }
.new-bar { background: #b45309; top: 18px; }
.bar-key { font-size: 11px; color: var(--muted); margin-top: 3px; }
.mini-function { width: 100%; height: 70px; display: block; margin-top: 8px; }
.loss-terms { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.loss-term { border: 1px solid var(--border); border-radius: 6px; padding: 8px; text-align: center; font-size: 13px; }
.loss-term.inactive { background: #f1efe9; color: var(--muted); }
.loss-term.active { border-color: #b97f3b; background: #fff3de; }
.loss-term strong { display: block; font-size: 15px; font-weight: 600; }
.loss-curve { width: 100%; height: 120px; display: block; margin-top: 10px; }
.input-readings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.input-readings > div { padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: #fbfaf6; text-align: center; }
.input-readings strong { font-size: 26px; display: block; color: var(--text); }
.input-readings span { font-size: 13px; color: var(--muted); }
.training { margin-top: 28px; padding: 0 4px 22px; border-bottom: 1px solid var(--border); background: transparent; }
.training-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.training-head h2 { font-family: "Songti SC", "STSong", "SimSun", Georgia, serif; font-size: 23px; }
.training-head p { font-size: 13px; color: var(--muted); max-width: 850px; }
.training-head > div:last-child { display: flex; gap: 8px; flex-shrink: 0; }
.training-head button { font-size: 13px; }
.metrics { display: grid; grid-template-columns: 1fr 1fr 1.15fr 1.3fr; gap: 16px; margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.metrics span { display: block; font-size: 12px; color: var(--muted); }
.metrics strong { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.evidence-row { display: grid; grid-template-columns: 1fr; gap: 24px; margin-top: 20px; }
.evidence-row > section { min-width: 0; }
.evidence-row h3 { font-size: 16px; }
.evidence-row canvas { width: 100%; height: 210px; display: block; margin-top: 8px; }
.evidence-row p:not(.legend) { font-size: 12px; color: var(--muted); }
.activation-maps { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.activation-card { width: 150px; }
.activation-card h4 { font-size: 14px; margin: 0; }
.activation-card canvas { display: block; width: 150px; height: 150px; border: 1px solid var(--border); margin-top: 4px; border-radius: 6px; }
.activation-card p { font-size: 11px; color: var(--muted); }
details { background: transparent; border: 0; border-bottom: 1px solid var(--border); margin-top: 12px; padding: 12px 0; }
summary { cursor: pointer; font-weight: 500; min-height: 32px; font-size: 14px; }
details p, details li { font-size: 14px; }
.operation details { padding: 7px 0; margin-top: 8px; }
.operation details summary { font-size: 12px; min-height: 28px; }
.reference-folds { padding: 4px; }
footer { font-size: 11px; color: var(--muted); padding-top: 24px; }
.table-scroll { overflow-x: auto; margin-top: 12px; }
table { border-collapse: collapse; font-size: 13px; white-space: nowrap; min-width: 100%; font-variant-numeric: tabular-nums; }
caption { text-align: left; font-weight: 600; padding-bottom: 6px; }
td, th { border-bottom: 1px solid var(--border); padding: 8px 10px; text-align: left; }
th { background: #f1eee6; }
td button { font-size: 12px; padding: 4px 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.noscript { padding: 20px; background: #fff3de; color: #793b06; }
.svg-text { fill: var(--text); font-size: 20px; paint-order: stroke; stroke: #fffefa; stroke-width: 4px; stroke-linejoin: round; }
.svg-muted { fill: var(--muted); font-size: 18px; paint-order: stroke; stroke: #fffefa; stroke-width: 3px; }
.svg-label { font-size: 18px; font-weight: 500; fill: var(--muted); }
.node { cursor: pointer; }
.node:focus { outline: none; }
.node:focus circle { stroke: var(--accent); stroke-width: 4; }
.edge-hit:focus { stroke: #62518b55; outline: none; }
.edge-label { font-size: 16px; fill: var(--text); paint-order: stroke; stroke: #fffefa; stroke-width: 5px; stroke-linejoin: round; pointer-events: none; }
.edge-label.active { font-size: 18px; font-weight: 600; }
.focus-line { pointer-events: none; }
.svg-node-number { font-size: 19px; fill: var(--text); font-weight: 600; pointer-events: none; }
@media(min-width:1550px) {
  .pipeline { grid-template-columns: 216px minmax(0,1fr) 282px; gap: 24px; }
  #dataMap { height: 266px; } #decision { height: 316px; }
  .stage-caption, .weight-legend { font-size: 12px; }
  .graph-row { grid-template-columns: minmax(0,1.9fr) minmax(410px,1fr); }
}
@media(max-width:1180px) {
  .nature, .workspace-tabs > span, .run-hint { display: none; }
  .conditions { grid-template-columns: 1fr 1fr; }
  .pipeline { grid-template-columns: 180px minmax(0,1fr) 230px; gap: 12px; }
  .data-stage, .features-stage { padding-right: 12px; }
  .stage-heading { display: block; } .stage-heading p { margin-top: 3px; }
  .live-metrics { gap: 18px; }
}
@media(max-width:950px) {
  .page-head, main { padding-left: 16px; padding-right: 16px; }
  .page-head h1 { font-size: 30px; }
  .pipeline { grid-template-columns: 180px minmax(0,1fr); }
  .output-stage { grid-column: 1/-1; border-top: 1px solid var(--border); padding-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
  .output-stage > h2 { grid-column: 1/-1; }
  .output-stage > canvas { grid-column: 1; grid-row: 2/5; max-width: 350px; margin: 0; }
  .output-stage .prob-legend, .output-stage .stage-caption, .output-stage #decisionText { grid-column: 2; }
  .features-stage { border-right: 0; padding-right: 0; }
  .explore-toolbar { flex-wrap: wrap; }
  .feature-focus button { margin-left: 0; }
  .graph-row { grid-template-columns: 1fr; }
  .math-pane { border-left: 0; border-top: 1px solid var(--border); padding: 16px 0 0; }
  .operation { max-width: 660px; }
  .network-wrap > svg { max-height: 360px; }
  .metrics { grid-template-columns: 1fr 1fr; }
}
@media(max-width:600px) {
  .page-head h1 { font-size: 28px; }
  .page-head > div > p:last-child { font-size: 13px; }
  .conditions { grid-template-columns: 1fr; padding: 12px; gap: 12px; }
  .configuration-row > button { flex: 1; padding: 8px; }
  .configuration-row .parameter-notes { margin-left: 0; }
  .parameter-notes-body { right: auto; left: 0; width: min(340px,calc(100vw - 44px)); }
  .configuration-row .presets[open] { top: 52px; max-width: 320px; }
  .workspace-tabs button { font-size: 13px; padding: 8px 12px; }
  .explorer, .calculation { padding: 12px; }
  .explore-toolbar > div:first-child { width: 100%; }
  .explore-toolbar button { flex: 1; }
  .live-metrics { width: 100%; justify-content: space-between; }
  .pipeline { grid-template-columns: 1fr; gap: 18px; }
  .data-stage { border: 0; padding-right: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  .data-stage h2 { grid-column: 1/-1; }
  .dataset-previews { grid-column: 2; grid-row: 2; display: grid; grid-template-columns: 1fr 1fr; margin: 0; align-self: start; }
  .dataset-previews canvas { width: 44px; height: 44px; }
  #dataMap { grid-column: 1; grid-row: 2/4; height: 190px; margin: 0; }
  .data-stage .stage-caption { grid-column: 2; grid-row: 3; }
  .features-stage { border-top: 1px solid var(--border); padding-top: 12px; }
  .feature-scroll { max-height: 500px; }
  .output-stage { display: block; }
  .output-stage > canvas { max-width: none; }
  .feature-detail { grid-template-columns: 1fr; }
  .selected-map { display: flex; gap: 12px; align-items: center; }
  .selected-map canvas { width: 120px; height: 120px; }
  .selected-map p { max-width: 180px; }
  .feature-focus { display: grid; grid-template-columns: 1fr; }
  .feature-focus select, .feature-focus #exploreSample { width: 100%; max-width: none; }
  .feature-focus button { width: 100%; }
  .mode-row { width: 100%; display: grid; grid-template-columns: 42px minmax(0,1fr); }
  .mode-row #mode, .mode-row #sample { max-width: none; width: 100%; }
  .step-controls { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .step-controls select { grid-column: 1/-1; }
  .calculation-stages { flex-wrap: wrap; }
  .calculation-stages button { flex: 1 1 40%; }
  .phase-heading h2 { font-size: 17px; }
  .network-wrap > svg { width: 800px; max-width: none; height: 300px; aspect-ratio: auto; min-height: 0; }
  .error-panel { flex-wrap: wrap; }
  .error-panel button { width: 100%; }
  .probability-row { flex-wrap: wrap; }
  .probability-bar { min-width: 100px; }
  .focus-head { grid-template-columns: 1fr; }
  .focus-head h3 { text-align: left; }
  .focus-head select { grid-column: 1; }
  .training-head { display: block; }
  .training-head > div:last-child { margin-top: 12px; }
  .training-head button { flex: 1; }
  .metrics strong { font-size: 19px; }
  .activation-card { width: calc(50% - 8px); }
  .activation-card canvas { width: 100%; height: auto; aspect-ratio: 1; }
  .loss-terms { grid-template-columns: 1fr; }
}
@media(prefers-reduced-motion:reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
