/* ============================================================
   概率论与数理统计 · 可视化学习
   清爽护眼主题（柔和绿 + 暖白纸感）· 桌面 + 移动端响应式
   ============================================================ */

:root {
  color-scheme: light;
  /* 配色 */
  --bg: #f3f6f2;
  --surface: #ffffff;
  --surface-2: #f7faf6;
  --ink: #26302c;
  --ink-soft: #44524c;
  --muted: #6f7a73;
  --line: #e4eae3;
  --line-soft: #eef2ec;
  --brand: #2f9e7f;
  --brand-dark: #1f6e57;
  --brand-soft: #e7f4ee;
  --accent: #d99a44;
  --accent-soft: #fbf2df;
  --info: #4a90d9;
  --info-soft: #e8f1fb;
  --danger: #e0786a;
  --ok: #44a974;
  /* 形状 */
  --radius: 16px;
  --radius-sm: 11px;
  --radius-xs: 8px;
  --shadow: 0 8px 28px rgba(34, 62, 50, 0.08);
  --shadow-soft: 0 2px 12px rgba(34, 62, 50, 0.05);
  --maxw: 1060px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.3; color: var(--ink); font-weight: 800; }
p { margin: 0; }
a { color: var(--brand-dark); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.muted { color: var(--muted); }

/* KaTeX 公式尺寸微调，贴合正文 */
.katex { font-size: 1.04em; }
.math-display {
  margin: 14px 0;
  padding: 12px 14px;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}
.math-display .katex-display { margin: 0; }
.math-display-sm { margin: 4px 0 10px; overflow-x: auto; }
.math-error { color: var(--danger); }

/* ============================ 顶栏 / 抽屉遮罩 ============================ */
.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 40;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-weight: 800; font-size: 16px; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}
.scrim {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(20, 35, 28, 0.42);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
}
.scrim.is-on { opacity: 1; visibility: visible; }

/* ============================ 布局骨架 ============================ */
.app-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
}

/* ============================ 侧边栏 ============================ */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  padding: 22px 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-badge {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: none;
  border-radius: 16px;
  color: #fff;
  font-weight: 900;
  font-size: 15px;
  background: linear-gradient(150deg, var(--brand), var(--brand-dark));
  box-shadow: 0 6px 16px rgba(31, 110, 87, 0.28);
}
.brand-kicker { margin: 0 0 2px; color: var(--muted); font-size: 12px; font-weight: 700; }
.brand-title { font-size: 20px; line-height: 1.2; }

.chapter-switcher {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.chapter-tab {
  min-height: 40px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 14px;
  transition: all 0.15s ease;
}
.chapter-tab:hover { border-color: var(--brand); color: var(--brand-dark); }
.chapter-tab.is-active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(150deg, var(--brand), var(--brand-dark));
  box-shadow: 0 4px 12px rgba(31, 110, 87, 0.25);
}

.section-nav { display: grid; gap: 7px; }
.section-nav a {
  display: block;
  padding: 9px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  background: var(--surface-2);
  transition: all 0.15s ease;
}
.section-nav a:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.section-nav .nav-drill {
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-color: transparent;
  font-weight: 800;
}
.sidebar-foot { margin-top: auto; color: var(--muted); font-size: 11.5px; line-height: 1.5; }

/* ============================ 主工作区 ============================ */
.workspace {
  min-width: 0;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px clamp(16px, 3vw, 36px) 64px;
  display: grid;
  gap: 22px;
  align-content: start;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(47, 158, 127, 0.1), transparent 55%),
    var(--surface);
  box-shadow: var(--shadow);
}
.hero-text h2 { font-size: clamp(22px, 3vw, 30px); line-height: 1.25; }
.hero-copy { margin-top: 12px; color: var(--ink-soft); font-size: 15.5px; line-height: 1.7; }
.hero-metrics { display: grid; grid-template-columns: repeat(3, 84px); gap: 10px; }
.hero-metrics div {
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 14px 6px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  border: 1px solid #d3ebe1;
}
.hero-metrics strong { font-size: 24px; color: var(--brand-dark); line-height: 1; }
.hero-metrics span { font-size: 12px; color: var(--muted); font-weight: 700; }

/* ============================ 章节 / 小节 ============================ */
.chapter-panel { display: grid; gap: 30px; }
.lesson-section { display: grid; gap: 16px; scroll-margin-top: 76px; }
.section-title { padding: 4px 0; }
.section-title h2 { font-size: clamp(20px, 2.4vw, 26px); }

.col-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* ============================ 卡片 / Markdown 排版 ============================ */
.panel {
  min-width: 0;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.card-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-bottom: 12px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
}
.plain-card {
  border-color: #d3ebe1;
  background: linear-gradient(180deg, #ffffff, #f8fcfa);
}
.plain-tag {
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid #cfe9df;
}
.example-card {
  border-color: #f0dcb4;
  background: linear-gradient(180deg, #ffffff, #fffaf0);
}
.example-tag {
  color: #9a6b15;
  background: var(--accent-soft);
  border: 1px solid #efd8aa;
}

.md-body > *:first-child { margin-top: 0; }
.md-body > *:last-child { margin-bottom: 0; }
.md-body h3 {
  font-size: 18px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--brand-soft);
}
.md-body h4 { font-size: 15.5px; margin: 14px 0 6px; color: var(--brand-dark); }
.md-body p { margin: 10px 0; color: var(--ink-soft); }
.md-body strong { color: var(--ink); font-weight: 800; }
.md-body ul, .md-body ol { margin: 10px 0; padding-left: 22px; color: var(--ink-soft); }
.md-body li { margin: 6px 0; }
.md-body li::marker { color: var(--brand); font-weight: 700; }
.md-body code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
  color: var(--brand-dark);
}

/* 提示框 / 易错点 callout */
.md-body blockquote {
  margin: 14px 0;
  padding: 12px 16px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-soft);
  color: var(--ink-soft);
}
.md-body blockquote p { margin: 4px 0; }
.md-body blockquote strong { color: #9a6b15; }

/* Markdown 表格 → 公式卡片表 */
.md-body table {
  width: 100%;
  margin: 12px 0;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 14.5px;
}
.md-body thead th {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 800;
  text-align: left;
}
.md-body th, .md-body td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.md-body tbody tr:last-child td { border-bottom: none; }
.md-body tbody tr:nth-child(even) { background: var(--surface-2); }
.md-body td:first-child { color: var(--ink); font-weight: 700; white-space: nowrap; }
.md-body td .katex { font-size: 1.02em; }

/* ============================ 通用控件 ============================ */
.seg {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.seg.wrap { flex-wrap: wrap; }
.seg-btn {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 14px;
  transition: all 0.15s ease;
}
.seg-btn:hover { color: var(--brand-dark); }
.seg-btn.is-active {
  background: var(--surface);
  color: var(--brand-dark);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

.btn {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 800;
  font-size: 14.5px;
  color: #fff;
  background: linear-gradient(150deg, var(--brand), var(--brand-dark));
  box-shadow: 0 4px 12px rgba(31, 110, 87, 0.22);
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.ghost {
  color: var(--brand-dark);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: none;
}
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid #cfe9df;
  font-weight: 800;
  font-size: 13.5px;
  white-space: nowrap;
}

.widget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.widget h3 { font-size: 18px; }

.range-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 132px;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  font-weight: 700;
  font-size: 14px;
}
.range-row output { text-align: right; color: var(--brand-dark); font-weight: 800; }
input[type="range"] { accent-color: var(--brand); width: 100%; }

.result-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid #f0dcb4;
  font-weight: 700;
  color: var(--ink-soft);
}
.formula-box {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  border: 1px solid #cfe9df;
}
.formula-box span { color: var(--brand-dark); font-size: 12px; font-weight: 800; }
.formula-box strong { font-family: Georgia, "Times New Roman", serif; font-size: 22px; }

/* ============================ 组件①：事件关系 / Venn ============================ */
.er-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
  gap: 18px;
}
.venn-board { display: block; width: 100%; max-width: 620px; height: auto; margin: 8px auto 0; }
.universe { fill: var(--surface-2); stroke: #9fb0a7; stroke-width: 2; }
.omega-label { font-family: Georgia, serif; font-size: 28px; font-weight: 800; fill: var(--muted); }
.set-label { font-size: 26px; font-weight: 900; text-anchor: middle; fill: var(--ink); }
.operation-label { font-size: 21px; font-weight: 800; text-anchor: middle; fill: var(--brand-dark); }
.set-fill { opacity: 0.7; }
.set-a-fill { fill: var(--brand); }
.set-b-fill { fill: var(--info); }
.set-line { fill: transparent; stroke: #2b3a44; stroke-width: 3; }
.overlap-fill { fill: var(--accent); opacity: 0; }
.event-relations.mode-intersection .set-a-fill,
.event-relations.mode-intersection .set-b-fill { opacity: 0.22; }
.event-relations.mode-intersection .overlap-fill,
.event-relations.mode-difference .overlap-fill { opacity: 0.85; }
.event-relations.mode-difference .overlap-fill { fill: var(--surface); }
.event-relations.mode-union .set-a-fill,
.event-relations.mode-union .set-b-fill { opacity: 0.72; }

.explain-list { display: grid; gap: 10px; margin: 0 0 14px; }
.explain-list div {
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
}
.explain-list dt { margin-bottom: 4px; color: var(--muted); font-size: 12px; font-weight: 800; }
.explain-list dd { margin: 0; font-size: 16px; font-weight: 700; }

.er-sample { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.er-sample-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.7fr);
  gap: 18px;
}
.sample-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; }
.sample-point {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 52px;
  border: 2px solid var(--line);
  border-radius: var(--radius-xs);
  font-weight: 800;
  background: var(--surface);
}
.sample-point::after {
  content: attr(data-tags);
  position: absolute;
  right: 5px;
  bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}
.sample-point.in-a { border-color: rgba(47, 158, 127, 0.6); background: rgba(47, 158, 127, 0.1); }
.sample-point.in-b { box-shadow: inset 0 0 0 999px rgba(74, 144, 217, 0.1); }
.sample-point.is-result { border-color: var(--brand); background: var(--brand-soft); }

.prob-bars { display: grid; align-content: start; gap: 10px; min-width: 0; }
.prob-bars p { margin: 0; padding: 9px 12px; border-radius: var(--radius-xs); background: var(--surface-2); border: 1px solid var(--line-soft); font-size: 13.5px; font-weight: 600; }
.prob-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) 56px; gap: 10px; align-items: center; font-weight: 800; }
.prob-row i { height: 14px; overflow: hidden; border-radius: 999px; background: var(--line-soft); }
.prob-row b { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--brand); transition: width 0.18s ease; }
.prob-row .bar-b { background: var(--info); }
.prob-row .bar-r { background: var(--accent); }

/* ============================ 组件②：掷硬币 ============================ */
.sim-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: center; }
.coin-visual { display: grid; gap: 14px; place-items: center; }
.coin-face {
  display: grid;
  place-items: center;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  color: #fff;
  font-size: 46px;
  font-weight: 900;
  background: radial-gradient(circle at 30% 26%, #6fd0b3, var(--brand-dark));
  box-shadow: 0 12px 26px rgba(31, 110, 87, 0.28);
}
.sim-stats { display: grid; gap: 7px; width: 100%; }
.sim-stats span { display: flex; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: var(--radius-xs); font-weight: 700; font-size: 13.5px; background: var(--surface-2); }
.line-chart { width: 100%; min-height: 200px; }
.axis { stroke: #aab8b0; stroke-width: 2; }
.target-line { stroke: var(--danger); stroke-dasharray: 8 8; stroke-width: 2; }
.freq-line { fill: none; stroke: var(--brand); stroke-width: 3.5; stroke-linejoin: round; }
.chart-note { fill: var(--danger); font-weight: 800; font-size: 13px; }

/* ============================ 组件③④：古典 / 几何 ============================ */
.dot-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 9px; margin: 14px 0; }
.dot { display: grid; place-items: center; aspect-ratio: 1; border-radius: 50%; color: var(--muted); font-weight: 800; background: var(--surface-2); border: 1px solid var(--line-soft); }
.dot.is-success { color: #fff; background: var(--brand); border-color: transparent; }
.geo-board {
  position: relative;
  height: 190px;
  margin: 14px 0;
  border: 2px solid #a9b8af;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(47, 158, 127, 0.08) 0 1px, transparent 1px 100%),
    linear-gradient(0deg, rgba(47, 158, 127, 0.08) 0 1px, transparent 1px 100%),
    var(--surface-2);
  background-size: 22px 22px;
}
.geo-region { height: 100%; width: 35%; background: rgba(47, 158, 127, 0.5); }

/* ============================ 组件⑤：贝叶斯 ============================ */
.bayes-table { display: grid; gap: 10px; }
.bayes-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr) 108px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  font-weight: 600;
  font-size: 13.5px;
}
.bayes-row output { color: var(--brand-dark); text-align: right; font-weight: 800; }

/* ============================ 组件⑦：伯努利 ============================ */
.bern-bars {
  display: flex;
  align-items: end;
  gap: 4px;
  height: 168px;
  margin-top: 22px;
  padding: 10px 8px 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.bern-bar { position: relative; flex: 1; min-width: 4px; border-radius: 4px 4px 0 0; background: #a9d8c8; }
.bern-bar.is-target { background: var(--brand); }
.bern-bar span { position: absolute; left: 50%; bottom: -19px; transform: translateX(-50%); color: var(--muted); font-size: 10.5px; font-weight: 800; }

/* ============================ 刷题区 ============================ */
.quiz-card { display: grid; gap: 14px; }
.quiz-filters { width: 100%; }
.quiz-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.quiz-question { font-size: 18px; line-height: 1.4; }
.quiz-progress { display: flex; gap: 8px; flex-wrap: wrap; }
.quiz-progress span { padding: 7px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; font-size: 13px; }
.quiz-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quiz-option {
  min-height: 56px;
  padding: 11px 14px;
  text-align: left;
  line-height: 1.45;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 600;
  font-size: 14.5px;
  transition: all 0.13s ease;
}
.quiz-option:hover { border-color: var(--brand); background: var(--brand-soft); }
.quiz-option.is-correct { border-color: var(--ok); background: #e3f6ec; }
.quiz-option.is-wrong { border-color: var(--danger); background: #fdeeeb; }
.quiz-feedback {
  min-height: 54px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-weight: 600;
  line-height: 1.6;
}
.quiz-actions { display: flex; gap: 10px; }

.typed-answer { grid-column: 1 / -1; display: grid; gap: 12px; }
.typed-hint { margin: 0; font-weight: 600; }
.typed-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 600;
  line-height: 1.55;
  resize: vertical;
}
.typed-input:focus { outline: 3px solid rgba(47, 158, 127, 0.18); border-color: var(--brand); }
.typed-submit { justify-self: start; }

.page-foot { margin-top: 8px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* ============================ 响应式 ============================ */
@media (max-width: 1080px) {
  .topbar { display: flex; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    width: 280px;
    max-width: 84vw;
    height: 100vh;
    transform: translateX(-102%);
    transition: transform 0.24s ease;
    box-shadow: 0 0 40px rgba(20, 35, 28, 0.18);
  }
  .sidebar.is-open { transform: translateX(0); }
  .er-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body { font-size: 15.5px; }
  .workspace { padding: 18px 14px 52px; gap: 18px; }
  .hero { grid-template-columns: 1fr; padding: 20px; }
  .hero-metrics { grid-template-columns: repeat(3, 1fr); }
  .col-grid { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
  .er-sample-layout { grid-template-columns: 1fr; }
  .sim-layout { grid-template-columns: 1fr; }
  .sample-grid { grid-template-columns: repeat(4, 1fr); }
  .range-row { grid-template-columns: 1fr; gap: 6px; }
  .range-row output { text-align: left; }
  .quiz-options { grid-template-columns: 1fr; }
  .bayes-row { grid-template-columns: 1fr; gap: 6px; }
  .bayes-row output { text-align: left; }
  .quiz-toolbar { flex-direction: column; }
}

@media (max-width: 420px) {
  .sample-grid { grid-template-columns: repeat(3, 1fr); }
  .hero-metrics div { padding: 10px 4px; }
  .hero-metrics strong { font-size: 20px; }
}
