:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --ink: #182025;
  --muted: #657178;
  --soft: #8f9aa0;
  --line: #dfe5e8;
  --line-strong: #cbd4d8;
  --coral: #e5644f;
  --coral-dark: #b94736;
  --coral-soft: #fff0ec;
  --teal: #218b83;
  --teal-soft: #e4f4f1;
  --orange: #e9a23b;
  --orange-soft: #fff4df;
  --danger: #c94a4a;
  --danger-soft: #fff0f0;
  --shadow: 0 10px 28px rgba(24, 32, 37, 0.07);
  --radius: 8px;
  --sidebar: 318px;
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }
html { min-width: 1180px; background: var(--bg); }
body { margin: 0; font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif; color: var(--ink); background: var(--bg); }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.2; font-weight: 730; }
h2 { font-size: 16px; line-height: 1.25; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: var(--sidebar) 1fr auto;
  align-items: center;
  min-height: 72px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(14px);
}

.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-lockup > div { display: grid; gap: 2px; }
.brand-lockup strong { font-size: 15px; }
.brand-lockup span:last-child { color: var(--muted); font-size: 11px; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 7px; color: white; background: var(--ink); }
.brand-mark svg { width: 20px; height: 20px; stroke-width: 1.8; }

.scenario-switch, .segmented-control { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
.scenario-switch { justify-self: center; }
.scenario-switch button, .segmented-control button { min-height: 34px; padding: 0 15px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 650; }
.scenario-switch button.active, .segmented-control button.active { color: var(--ink); background: var(--surface); box-shadow: 0 2px 8px rgba(24, 32, 37, 0.08); }

.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.dataset-status { max-width: 210px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.upload-button, .secondary-button, .primary-button, .icon-button, .play-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 6px; font-weight: 680; }
.upload-button { height: 38px; padding: 0 14px; border: 1px solid var(--line-strong); color: var(--ink); background: var(--surface); font-size: 12px; cursor: pointer; }
.upload-button svg, .secondary-button svg, .primary-button svg { width: 16px; height: 16px; }
.icon-button { width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
.icon-button svg, .play-button svg { width: 17px; height: 17px; }
.mobile-only { display: none; }

.app-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: calc(100vh - 72px); }
.sidebar { position: sticky; top: 72px; align-self: start; height: calc(100vh - 72px); overflow-y: auto; padding: 22px; border-right: 1px solid var(--line); background: var(--surface); }
.sidebar-mobile-head, .sidebar-backdrop { display: none; }
.sidebar-section { padding: 0 0 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.sidebar-section:last-of-type { margin-bottom: 10px; }
.section-title-row, .surface-head, .workspace-heading, .feature-heading, .inline-field { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.section-label { display: block; margin-bottom: 5px; color: var(--coral-dark); font-size: 10px; font-weight: 800; }
.data-kind { padding: 5px 8px; border-radius: 5px; color: var(--teal); background: var(--teal-soft); font-size: 11px; font-weight: 750; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.summary-grid div { min-height: 64px; padding: 12px; border-right: 1px solid var(--line); background: var(--surface-soft); }
.summary-grid div:last-child { border-right: 0; }
.summary-grid strong, .summary-grid span { display: block; }
.summary-grid strong { font-size: 19px; }
.summary-grid span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.scenario-description { margin-top: 13px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.dataset-select-label { margin-top: 16px; }

.field-label { display: block; margin-bottom: 7px; color: var(--ink); font-size: 12px; font-weight: 720; }
select, input[type="number"] { width: 100%; height: 40px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; outline: 0; color: var(--ink); background: var(--surface); }
select:focus, input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(33, 139, 131, 0.12); }
.feature-heading { align-items: center; margin-top: 18px; }
.feature-heading .field-label { margin: 0; }
.text-button { padding: 0; border: 0; color: var(--coral-dark); background: transparent; font-size: 11px; font-weight: 750; }
.feature-list { display: grid; gap: 4px; max-height: 258px; overflow-y: auto; margin-top: 8px; padding-right: 4px; }
.feature-option { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 8px; min-height: 34px; margin: 0; padding: 8px; border-radius: 5px; color: var(--muted); font-size: 11px; line-height: 1.35; cursor: pointer; }
.feature-option:hover { color: var(--ink); background: var(--surface-soft); }
.feature-option.blocked { cursor: not-allowed; opacity: 0.52; }
.feature-option input { accent-color: var(--teal); }
.leakage-note { display: flex; gap: 8px; margin-top: 10px; padding: 10px; border-left: 3px solid var(--orange); color: #76511c; background: var(--orange-soft); font-size: 11px; line-height: 1.5; }
.leakage-note svg { flex: none; width: 16px; height: 16px; }
.split-settings input[type="range"] { width: 100%; margin: 2px 0 16px; accent-color: var(--teal); }
.range-value { color: var(--teal); font-size: 11px; font-weight: 750; }
.primary-button { width: 100%; min-height: 43px; border: 0; color: white; background: var(--ink); font-size: 12px; }
.primary-button.compact { width: auto; min-width: 108px; padding: 0 18px; }
.primary-button:hover { background: #080c0e; }
.status-message { min-height: 20px; margin-top: 10px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.status-message.error { color: var(--danger); }
.status-message.success { color: var(--teal); }

.workspace { min-width: 0; padding: 0 26px 42px; }
.tabs { position: sticky; top: 72px; z-index: 35; display: flex; align-items: center; gap: 4px; min-height: 58px; border-bottom: 1px solid var(--line); background: rgba(244, 246, 248, 0.96); backdrop-filter: blur(12px); }
.tab-button { display: inline-flex; align-items: center; gap: 7px; height: 58px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 12px; font-weight: 680; }
.tab-button svg { width: 15px; height: 15px; }
.tab-button.active { color: var(--ink); border-bottom-color: var(--coral); }
.tab-panel { display: none; padding-top: 26px; }
.tab-panel.active { display: block; }
.workspace-heading { align-items: center; margin-bottom: 22px; }
.model-status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.model-status svg { width: 14px; height: 14px; }
.model-status.ready { color: var(--teal); }

.metrics-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.metric { min-height: 96px; padding: 18px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span, .metric small { display: block; }
.metric span { color: var(--muted); font-size: 10px; font-weight: 750; }
.metric strong { display: block; margin: 9px 0 5px; font-size: 24px; font-variant-numeric: tabular-nums; }
.metric small { color: var(--soft); font-size: 10px; }
.warning-stack { display: grid; gap: 8px; margin: 14px 0; }
.warning-item { display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-left-width: 3px; border-radius: 6px; background: var(--surface); }
.warning-item.info { border-left-color: var(--teal); }
.warning-item.warning { border-left-color: var(--orange); }
.warning-item.danger { border-left-color: var(--danger); }
.warning-item strong, .warning-item span { display: block; }
.warning-item strong { margin-bottom: 2px; font-size: 11px; }
.warning-item span { color: var(--muted); font-size: 11px; line-height: 1.5; }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 16px; }
.surface { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.chart-surface, .formula-surface, .prediction-surface, .table-surface, .fixed-panel { padding: 18px; }
.wide { grid-row: span 2; }
.surface-head { margin-bottom: 10px; }
.surface-head p { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.surface-head > span { color: var(--soft); font-size: 10px; }
.plot { width: 100%; height: 350px; }
.plot.tall { height: 430px; }
.plot.extra-tall { height: 530px; }
.formula { padding: 14px; overflow-x: auto; border-left: 3px solid var(--coral); color: var(--ink); background: var(--coral-soft); font-family: Consolas, monospace; font-size: 12px; line-height: 1.7; }
.coefficient-list { display: grid; gap: 7px; margin-top: 13px; max-height: 230px; overflow-y: auto; }
.coefficient-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px; gap: 10px; align-items: center; font-size: 10px; }
.coefficient-row span:first-child { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.coefficient-row span:last-child { text-align: right; font-family: Consolas, monospace; }
.coefficient-ai-button { display: inline-grid; width: 22px; height: 22px; margin-left: 4px; padding: 0; place-items: center; border: 0; border-radius: 4px; color: var(--teal); background: var(--teal-soft); vertical-align: middle; }
.coefficient-ai-button svg { width: 12px; height: 12px; }
.prediction-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-height: 214px; overflow-y: auto; }
.prediction-inputs label { color: var(--muted); font-size: 9px; font-weight: 700; }
.prediction-inputs input { margin-top: 5px; }
.secondary-button { min-height: 38px; padding: 0 13px; border: 1px solid var(--line-strong); color: var(--ink); background: var(--surface); font-size: 11px; }
.secondary-button:hover { border-color: var(--teal); color: var(--teal); }
.prediction-surface .secondary-button { margin-top: 13px; }
.prediction-result { margin-top: 12px; padding: 12px; border-radius: 6px; color: var(--muted); background: var(--surface-soft); font-size: 11px; }
.prediction-result strong { display: block; margin-top: 4px; color: var(--coral-dark); font-size: 22px; }
.ai-explain-button { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 12px; border: 1px solid rgba(33, 139, 131, .3); border-radius: 6px; color: var(--teal); background: var(--teal-soft); font-size: 11px; font-weight: 720; }
.ai-explain-button svg { width: 15px; height: 15px; }
.ai-explain-button:hover { border-color: var(--teal); background: #d9eeeb; }

.training-toolbar, .relationship-toolbar { display: grid; grid-template-columns: 1.2fr .75fr .75fr .85fr auto; gap: 12px; align-items: end; margin-bottom: 14px; padding: 14px; box-shadow: none; }
.training-toolbar label, .relationship-toolbar label { color: var(--muted); font-size: 10px; font-weight: 700; }
.training-toolbar select, .training-toolbar input, .relationship-toolbar select { margin-top: 6px; }
.training-status { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 1px; padding: 0; overflow: hidden; background: var(--line); box-shadow: none; }
.training-status > div:not(.progress-track) { padding: 13px 15px; background: var(--surface); }
.training-status span { display: block; color: var(--muted); font-size: 9px; }
.training-status strong { display: block; margin-top: 5px; font-size: 16px; font-variant-numeric: tabular-nums; }
.progress-track { grid-column: 1 / -1; height: 4px; background: #e6ebed; }
.progress-track span { width: 0; height: 100%; background: var(--teal); transition: width .2s ease; }
.training-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(350px, .75fr); gap: 16px; margin-top: 16px; }
.playback-bar { display: grid; grid-template-columns: auto auto auto auto minmax(160px, 1fr) auto; gap: 9px; align-items: center; margin-top: 16px; padding: 12px 14px; box-shadow: none; }
.play-button { width: 42px; height: 42px; border: 0; color: white; background: var(--coral); }
.playback-bar input { width: 100%; accent-color: var(--coral); }
.playback-bar > span { color: var(--muted); font-size: 10px; }

.relationship-toolbar { grid-template-columns: 1fr 1fr .7fr auto; }
.relationship-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; }
.fixed-controls { display: grid; gap: 18px; max-height: 475px; overflow-y: auto; padding-right: 5px; }
.fixed-control label { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.fixed-control label span:first-child { max-width: 180px; }
.fixed-control label span:last-child { color: var(--ink); font-family: Consolas, monospace; }
.fixed-control input { width: 100%; margin-top: 8px; accent-color: var(--teal); }

.diagnostic-conclusions { display: grid; gap: 8px; margin-bottom: 14px; }
.diagnostic-conclusion { padding: 11px 13px; border-left: 3px solid var(--teal); background: var(--surface); font-size: 11px; line-height: 1.5; }
.diagnostic-conclusion.warning { border-left-color: var(--orange); }
.diagnostic-conclusion.danger { border-left-color: var(--danger); }
.diagnostic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.diagnostic-tables { display: grid; grid-template-columns: minmax(300px, .65fr) minmax(0, 1.35fr); gap: 16px; margin-top: 16px; }
.table-scroll { max-height: 330px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 10px; white-space: nowrap; }
th { position: sticky; top: 0; color: var(--muted); background: var(--surface-soft); font-weight: 750; }
td:not(:first-child), th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.vif-status { display: inline-block; padding: 3px 6px; border-radius: 4px; color: var(--teal); background: var(--teal-soft); font-size: 9px; font-weight: 750; }
.vif-status.warning { color: #76511c; background: var(--orange-soft); }
.vif-status.severe { color: var(--danger); background: var(--danger-soft); }

.modal-backdrop { display: none; position: fixed; inset: 0; z-index: 90; background: rgba(24, 32, 37, .42); }
.modal-backdrop.open { display: block; }
.settings-modal { position: fixed; z-index: 100; top: 50%; left: 50%; width: min(500px, calc(100vw - 32px)); padding: 22px; transform: translate(-50%, -50%); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 24px 70px rgba(24, 32, 37, .24); }
.modal-head, .modal-actions, .model-field-row, .ai-panel-head, .ai-panel-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-description { margin: 12px 0 18px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.settings-modal > .field-label { margin-top: 14px; }
.secret-input { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.model-field-row { align-items: end; margin-top: 14px; }
.model-field-row > div { flex: 1; }
.remember-option { display: flex; align-items: center; gap: 8px; margin-top: 15px; color: var(--ink); font-size: 11px; font-weight: 650; }
.remember-option input { accent-color: var(--teal); }
.security-note { display: flex; gap: 8px; margin-top: 10px; padding: 10px; border-left: 3px solid var(--teal); color: var(--muted); background: var(--teal-soft); font-size: 10px; line-height: 1.5; }
.security-note svg { flex: none; width: 15px; height: 15px; color: var(--teal); }
.modal-actions { margin-top: 18px; }
.modal-actions > span { color: var(--muted); font-size: 10px; }
.modal-actions > span.error { color: var(--danger); }

.ai-panel { position: fixed; top: 0; right: 0; z-index: 85; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; width: min(420px, 94vw); height: 100vh; padding: 22px; transform: translateX(103%); border-left: 1px solid var(--line); background: var(--surface); box-shadow: -18px 0 50px rgba(24, 32, 37, .14); transition: transform .22s ease; }
.ai-panel.open { transform: translateX(0); }
.ai-context { margin-top: 16px; padding: 11px; border-left: 3px solid var(--coral); color: var(--muted); background: var(--coral-soft); font-size: 10px; line-height: 1.5; }
.ai-content { overflow-y: auto; padding: 18px 4px 18px 0; color: var(--ink); font-size: 12px; line-height: 1.75; }
.markdown-content > :first-child { margin-top: 0; }
.markdown-content > :last-child { margin-bottom: 0; }
.markdown-content h1, .markdown-content h2, .markdown-content h3 { margin: 20px 0 8px; color: var(--ink); font-size: 14px; line-height: 1.4; }
.markdown-content p { margin: 0 0 12px; }
.markdown-content ul, .markdown-content ol { margin: 0 0 14px; padding-left: 20px; }
.markdown-content li + li { margin-top: 5px; }
.markdown-content strong { color: var(--ink); font-weight: 750; }
.markdown-content code { padding: 2px 5px; border-radius: 4px; color: #38545b; background: var(--surface-soft); font-family: Consolas, monospace; font-size: .92em; }
.markdown-content pre { overflow-x: auto; margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
.markdown-content pre code { padding: 0; background: transparent; }
.markdown-content blockquote { margin: 12px 0; padding: 8px 12px; border-left: 3px solid var(--teal); color: var(--muted); background: var(--teal-soft); }
.markdown-content a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.loading { color: var(--muted); }
.loading::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; border: 2px solid var(--line); border-top-color: var(--teal); border-radius: 50%; vertical-align: -2px; animation: ai-spin .8s linear infinite; }
.ai-panel-foot { padding-top: 12px; border-top: 1px solid var(--line); }
.ai-panel-foot > span { color: var(--soft); font-size: 10px; }

.parameter-explanation-backdrop { display: none; position: fixed; inset: 0; z-index: 92; background: rgba(24, 32, 37, .34); }
.parameter-explanation-backdrop.open { display: block; }
.parameter-explanation-modal { position: fixed; z-index: 95; top: 50%; left: 50%; display: grid; grid-template-rows: auto auto minmax(72px, auto) auto; width: min(390px, calc(100vw - 28px)); max-height: min(520px, calc(100vh - 32px)); padding: 20px; transform: translate(-50%, -50%); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 24px 70px rgba(24, 32, 37, .22); }
.parameter-explanation-head, .parameter-explanation-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.parameter-explanation-head h2 { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parameter-explanation-context { margin: 14px 0 0; padding: 9px 11px; border-left: 3px solid var(--teal); color: var(--muted); background: var(--teal-soft); font-size: 10px; line-height: 1.5; }
.parameter-explanation-content { overflow-y: auto; padding: 16px 2px; color: var(--ink); font-size: 11px; line-height: 1.65; }
.parameter-explanation-content ul, .parameter-explanation-content ol { margin-bottom: 8px; }
.parameter-explanation-foot { padding-top: 12px; border-top: 1px solid var(--line); }
.parameter-explanation-foot > span { color: var(--soft); font-size: 10px; }
@keyframes ai-spin { to { transform: rotate(360deg); } }

.plotly .modebar { opacity: .2; transition: opacity .15s ease; }
.plotly:hover .modebar { opacity: .8; }

@media (max-width: 1220px) {
  html { min-width: 0; }
  .topbar { grid-template-columns: 250px 1fr auto; }
  .app-shell { grid-template-columns: 280px minmax(0, 1fr); }
  :root { --sidebar: 280px; }
  .overview-grid, .training-grid, .relationship-layout, .diagnostic-tables { grid-template-columns: 1fr; }
  .wide { grid-row: auto; }
  .fixed-panel { order: -1; }
  .fixed-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: none; }
}

@media (max-width: 760px) {
  html, body { min-width: 0; }
  .topbar { grid-template-columns: 1fr auto; min-height: 64px; padding: 0 14px; }
  .brand-lockup span:last-child, .dataset-status, .upload-button span, .scenario-switch { display: none; }
  .brand-mark { width: 34px; height: 34px; }
  .mobile-only { display: inline-flex; }
  .upload-button { width: 36px; height: 36px; padding: 0; }
  .app-shell { display: block; min-height: calc(100vh - 64px); }
  .sidebar { position: fixed; top: 0; left: 0; z-index: 80; width: min(88vw, 340px); height: 100vh; transform: translateX(-102%); transition: transform .22s ease; box-shadow: 14px 0 42px rgba(24, 32, 37, .2); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mobile-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(24, 32, 37, .42); }
  .sidebar-backdrop.open { display: block; }
  .workspace { padding: 0 14px 30px; }
  .tabs { top: 64px; min-height: 54px; overflow-x: auto; }
  .tab-button { flex: none; height: 54px; padding: 0 11px; }
  .tab-button svg { display: none; }
  .tab-panel { padding-top: 20px; }
  .workspace-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions { width: 100%; justify-content: space-between; }
  h1 { font-size: 23px; }
  .metrics-strip { grid-template-columns: repeat(2, 1fr); }
  .metric { border-bottom: 1px solid var(--line); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-last-child(-n+2) { border-bottom: 0; }
  .overview-grid, .training-grid, .relationship-layout, .diagnostic-grid, .diagnostic-tables { grid-template-columns: 1fr; }
  .prediction-inputs, .fixed-controls { grid-template-columns: 1fr; }
  .training-toolbar, .relationship-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .training-toolbar .secondary-button, .relationship-toolbar .secondary-button { grid-column: 1 / -1; }
  .training-status { grid-template-columns: repeat(2, 1fr); }
  .playback-bar { grid-template-columns: auto auto auto auto; }
  .playback-bar input, .playback-bar > span { grid-column: 1 / -1; }
  .plot { height: 310px; }
  .plot.tall, .plot.extra-tall { height: 380px; }
  .chart-surface, .formula-surface, .prediction-surface, .table-surface, .fixed-panel { padding: 14px; }
  .ai-explain-button span { display: none; }
  .ai-explain-button { width: 36px; padding: 0; justify-content: center; }
  .settings-modal { padding: 18px; }
  .parameter-explanation-modal { padding: 18px; }
  .parameter-explanation-head h2 { max-width: 230px; }
  .model-field-row { align-items: stretch; flex-direction: column; }
  .model-field-row .secondary-button { width: 100%; }
}

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