:root {
  --bg: #f6f1e7;
  --panel: #fffaf0;
  --card: #fffdf8;
  --ink: #1f2a30;
  --muted: #5f6c72;
  --line: #d3c4aa;
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.16);
  --highlight-soft: rgba(217, 119, 6, 0.16);
  --selected: #2f855a;
  --selected-soft: rgba(47, 133, 90, 0.2);
  --beige-stroke: #b89b74;
  --beige-fill: rgba(184, 155, 116, 0.18);
  --lower: #2563eb;
  --lower-soft: rgba(37, 99, 235, 0.14);
  --upper: #dc2626;
  --upper-soft: rgba(220, 38, 38, 0.14);
  --shadow: 0 18px 44px rgba(74, 59, 26, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.08), transparent 26%),
    radial-gradient(circle at left 20%, rgba(217, 119, 6, 0.08), transparent 22%),
    linear-gradient(180deg, #fcf8ef 0%, var(--bg) 70%);
  overflow: hidden;
}

code {
  font-family: "Iosevka", "SFMono-Regular", monospace;
}

.app-shell {
  width: 100vw;
  max-width: none;
  margin: 0;
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-columns: clamp(340px, 30vw, 460px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  padding: 8px 10px;
}

.hero {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.title-block {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, "Iowan Old Style", serif;
  font-weight: 700;
}

h1 {
  font-size: clamp(1.45rem, 3vw, 2.45rem);
  line-height: 1;
}

h2 {
  font-size: 1.8rem;
}

.picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: start;
}

.picker-row label,
.control-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.sample-count-label {
  text-transform: none;
}

.label-math {
  font-size: 0.88rem;
  color: var(--muted);
}

.distribution-select {
  width: min(220px, 100%);
}

.control-panel,
.chart-card {
  background: var(--panel);
  border: 1px solid rgba(211, 196, 170, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

select,
input[type="number"] {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 10px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: #fffefb;
}

input[type="range"] {
  width: 100%;
  min-height: 20px;
  margin: 0;
  accent-color: var(--accent);
}

.charts {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.chart-card {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 4px 6px;
  background: var(--card);
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 1px;
}

.title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.chart-mode-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(5.9rem, 1fr));
  align-items: stretch;
  border: 1px solid rgba(211, 196, 170, 0.9);
  border-radius: 12px;
  background: rgba(255, 254, 251, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  overflow: hidden;
}

.chart-mode-toggle[hidden] {
  display: none !important;
}

.chart-mode-option {
  position: relative;
  display: flex;
}

.chart-mode-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.chart-mode-option span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 2rem;
  padding: 0 0.8rem;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--muted);
  background: transparent;
  border-left: 1px solid rgba(211, 196, 170, 0.7);
  cursor: pointer;
  user-select: none;
  transition: background 140ms ease, color 140ms ease;
}

.chart-mode-option:first-child span {
  border-left: none;
}

.chart-mode-option input:checked + span {
  color: #fffdf7;
  background: linear-gradient(135deg, rgba(47, 133, 90, 0.92), rgba(28, 101, 72, 0.94));
}

.readout {
  font-size: 1rem;
  color: var(--muted);
}

.chart-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: min(26rem, calc(100vw - 20px));
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  background: rgba(33, 27, 18, 0.92);
  color: #fffdf7;
  font-size: 0.95rem;
  line-height: 1.25;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 120ms ease;
}

.chart-tooltip.is-visible {
  opacity: 1;
  visibility: visible;
}

.formula-label {
  font-size: 1.53rem;
  color: var(--muted);
}

.chart-host {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.chart-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.control-panel {
  grid-column: 1;
  grid-row: 2;
  padding: 4px 6px 6px;
  min-height: 0;
  overflow: auto;
}

.summary-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  padding: 4px 5px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(255, 255, 255, 0.75));
}

.summary-strip strong {
  display: block;
  font-size: 1.08rem;
  min-height: 1.45em;
}

.interval-text {
  white-space: nowrap;
}

.domain-inline {
  display: block;
  margin-top: 2px;
  font-size: 1.08rem;
  color: var(--muted);
}

.parameter-grid,
.bound-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin-top: 4px;
}

.simulation-panel {
  display: grid;
  gap: 6px;
  margin-top: 5px;
  padding: 5px;
  border-radius: 12px;
  border: 1px solid rgba(211, 196, 170, 0.75);
  background: rgba(255, 255, 255, 0.72);
}

.median-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin-top: 5px;
  padding: 5px;
  border-radius: 12px;
  border: 1px solid rgba(211, 196, 170, 0.75);
  background: rgba(255, 255, 255, 0.72);
}

.median-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}

.median-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink);
}

.median-toggle {
  margin-left: 0;
}

.median-note {
  grid-column: 1 / -1;
  min-height: 0.9rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.sigma-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 5px;
  padding: 5px;
  border-radius: 12px;
  border: 1px solid rgba(211, 196, 170, 0.75);
  background: rgba(255, 255, 255, 0.72);
}

.sigma-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.sigma-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink);
}

.sigma-formula {
  font-size: 1rem;
  color: var(--muted);
}

.sigma-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.sigma-button {
  min-height: 34px;
  border: 1px solid rgba(47, 133, 90, 0.42);
  border-radius: 10px;
  padding: 0 10px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink);
  background: linear-gradient(135deg, rgba(255, 252, 245, 0.95), rgba(232, 244, 235, 0.95));
  cursor: pointer;
}

.sigma-button:hover {
  border-color: rgba(47, 133, 90, 0.7);
  background: linear-gradient(135deg, rgba(255, 250, 240, 0.98), rgba(214, 236, 220, 0.98));
}

.simulation-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.simulation-head #sample-reset {
  margin-left: 0;
  flex: 0 0 auto;
}

.simulation-head #sample-new {
  flex: 0 0 auto;
}

.simulation-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink);
}

.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;
}

.simulation-mode-toggle {
  display: inline-flex;
  align-items: stretch;
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid rgba(47, 133, 90, 0.24);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255, 252, 245, 0.98), rgba(242, 248, 244, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
  overflow: hidden;
}

.simulation-mode-button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 34px;
  border: 0;
  border-left: 1px solid rgba(47, 133, 90, 0.2);
  padding: 0 10px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.simulation-mode-button:first-child {
  border-left: 0;
}

.simulation-mode-button:hover {
  background: rgba(47, 133, 90, 0.08);
  color: var(--ink);
}

.simulation-mode-button.is-active {
  color: #fffdf7;
  background: linear-gradient(135deg, rgba(47, 133, 90, 0.96), rgba(28, 101, 72, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.simulation-mode-button:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid rgba(37, 99, 235, 0.58);
  outline-offset: -2px;
}

.sample-button.is-reserved-hidden {
  visibility: hidden;
  pointer-events: none;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.toggle-slider {
  position: relative;
  width: 30px;
  height: 16px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.55);
  box-shadow: inset 0 0 0 1px rgba(100, 116, 139, 0.22);
  transition: background-color 120ms ease;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fffdf8;
  box-shadow: 0 1px 2px rgba(31, 42, 48, 0.24);
  transition: transform 120ms ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--selected);
}

.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(14px);
}

.simulation-actions {
  display: grid;
  grid-template-columns: auto 86px auto auto auto minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.simulation-pace {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.simulation-pace input[type="range"] {
  min-width: 0;
}

.simulation-pace[hidden] {
  display: none !important;
}

.simulation-pace-edge,
.simulation-pace-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.simulation-pace-label {
  text-align: right;
}

.simulation-latest {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.simulation-latest[hidden] {
  display: none !important;
}

.simulation-latest-value {
  min-width: 0;
  font-size: 0.92rem;
  color: var(--selected);
}

.simulation-mean {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
}

.simulation-chart-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.simulation-zoom {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.simulation-zoom input[type="range"] {
  min-width: 0;
}

.simulation-zoom-label {
  min-width: 2.4em;
  text-align: right;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.simulation-mean-value {
  min-width: 0;
  font-size: 0.92rem;
  color: var(--accent);
}

.simulation-total-inline {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--selected);
}

.simulation-mean-chart {
  min-height: 86px;
}

.simulation-mean-chart[hidden] {
  display: none !important;
}

.sample-mean-svg {
  width: 100%;
  height: 86px;
  display: block;
}

.sample-mean-frame {
  fill: rgba(255, 255, 255, 0.76);
  stroke: rgba(211, 196, 170, 0.7);
}

.sample-mean-axis,
.sample-mean-axis-tick {
  stroke: rgba(95, 108, 114, 0.5);
  stroke-width: 1.1;
}

.sample-mean-axis-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.sample-mean-axis-label.axis-title {
  font-style: italic;
}

.sample-mean-target {
  stroke: rgba(124, 63, 0, 0.6);
  stroke-width: 1.6;
  stroke-dasharray: 5 4;
}

.sample-mean-reference-label {
  fill: rgba(124, 63, 0, 0.92);
  font-size: 11px;
  font-weight: 700;
}

.sample-mean-line {
  fill: none;
  stroke: var(--selected);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sample-mean-point {
  fill: var(--selected);
  stroke: #fffdf8;
  stroke-width: 1.4;
}

.sample-mean-svg.panel {
  height: 100%;
}

.sample-mean-panel-frame {
  fill: rgba(255, 255, 255, 0.82);
  stroke: rgba(211, 196, 170, 0.85);
}

.sample-mean-grid {
  stroke: rgba(207, 190, 161, 0.48);
  stroke-width: 1.4;
  stroke-dasharray: 4 5;
}

.sample-mean-panel-axis {
  stroke: rgba(95, 108, 114, 0.62);
  stroke-width: 1.5;
}

.sample-mean-panel-tick {
  stroke: rgba(95, 108, 114, 0.62);
  stroke-width: 1.2;
}

.sample-mean-panel-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.sample-mean-panel-label.axis-title {
  font-style: italic;
}

.sample-button {
  min-height: 36px;
  border: 1px solid rgba(15, 118, 110, 0.4);
  border-radius: 12px;
  padding: 0 12px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  color: #f8fafc;
  background: linear-gradient(135deg, #0f766e, #2f855a);
  cursor: pointer;
}

.sample-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.sample-button-secondary {
  color: var(--ink);
  background: linear-gradient(135deg, #f4efe3, #e8ddc7);
  border-color: rgba(184, 155, 116, 0.55);
}

.slider-control {
  padding: 5px;
  border-radius: 12px;
  border: 1px solid rgba(211, 196, 170, 0.75);
  background: rgba(255, 255, 255, 0.72);
}

.slider-control.compact-pair {
  padding: 4px 5px 5px;
}

.slider-control.lower {
  background: linear-gradient(135deg, var(--lower-soft), rgba(255, 255, 255, 0.84));
}

.slider-control.upper {
  background: linear-gradient(135deg, var(--upper-soft), rgba(255, 255, 255, 0.84));
}

.slider-head {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  align-items: center;
  margin-bottom: 3px;
}

.slider-head .control-label {
  text-transform: none;
  letter-spacing: 0.02em;
}

.bound-head-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.slider-number {
  width: 80px;
  text-align: right;
}

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

.pair-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.compact-pair .control-label {
  text-transform: none;
  letter-spacing: 0.02em;
}

.bounds-pair {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(220, 38, 38, 0.08), rgba(255, 255, 255, 0.82));
}

.view-pair {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(255, 255, 255, 0.82));
}

.dual-range-slider {
  position: relative;
  height: 24px;
  margin-top: 3px;
}

.dual-range-track,
.dual-range-fill {
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  height: 4px;
  border-radius: 999px;
}

.dual-range-track {
  background: rgba(148, 163, 184, 0.28);
}

.dual-range-fill.view {
  background: rgba(15, 118, 110, 0.36);
}

.dual-range-fill.bounds {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.35), rgba(220, 38, 38, 0.35));
}

.dual-range-slider .dual-range-handle {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 24px;
  margin: 0;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.dual-range-slider .dual-range-handle::-webkit-slider-runnable-track {
  height: 24px;
  background: transparent;
}

.dual-range-slider .dual-range-handle::-moz-range-track {
  height: 24px;
  background: transparent;
  border: none;
}

.dual-range-slider .dual-range-handle::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
  width: 14px;
  height: 14px;
  margin-top: 5px;
  border-radius: 50%;
  border: 2px solid #fffdf8;
  background: #0f766e;
  box-shadow: 0 1px 3px rgba(31, 42, 48, 0.28);
  cursor: pointer;
}

.dual-range-slider .dual-range-handle::-moz-range-thumb {
  pointer-events: auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fffdf8;
  background: #0f766e;
  box-shadow: 0 1px 3px rgba(31, 42, 48, 0.28);
  cursor: pointer;
}

.dual-range-slider.bounds .dual-range-handle.lower::-webkit-slider-thumb,
.dual-range-slider.bounds .dual-range-handle.lower::-moz-range-thumb {
  background: var(--lower);
}

.dual-range-slider.bounds .dual-range-handle.upper::-webkit-slider-thumb,
.dual-range-slider.bounds .dual-range-handle.upper::-moz-range-thumb {
  background: var(--upper);
}

.bound-hide-toggle {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.slider-control.lower input[type="range"] {
  accent-color: var(--lower);
}

.slider-control.upper input[type="range"] {
  accent-color: var(--upper);
}

.lower-text {
  color: var(--lower);
}

.upper-text {
  color: var(--upper);
}

.axis-line,
.grid-line {
  stroke: #cfbea1;
  stroke-width: 4.6;
}

.grid-line {
  stroke-opacity: 0.4;
  stroke-dasharray: 4 4;
}

.curve {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
}

.cdf-curve {
  stroke: #1f2a30;
}

.stem-line {
  stroke: var(--beige-stroke);
  stroke-width: 7;
  stroke-linecap: round;
}

.stem-line.selected {
  stroke: var(--selected);
}

.stem-line.quartile-1 {
  stroke: rgba(184, 155, 116, 0.95);
}

.stem-line.quartile-2 {
  stroke: rgba(205, 174, 126, 0.95);
}

.stem-line.quartile-3 {
  stroke: rgba(121, 165, 111, 0.95);
}

.stem-line.quartile-4 {
  stroke: rgba(47, 133, 90, 0.98);
}

.stem-point {
  fill: #fffefb;
  stroke: var(--beige-stroke);
  stroke-width: 2.2;
}

.stem-point.selected {
  fill: rgba(47, 133, 90, 0.12);
  stroke: var(--selected);
}

.stem-point.quartile-1 {
  fill: rgba(184, 155, 116, 0.12);
  stroke: rgba(184, 155, 116, 0.95);
}

.stem-point.quartile-2 {
  fill: rgba(205, 174, 126, 0.12);
  stroke: rgba(205, 174, 126, 0.95);
}

.stem-point.quartile-3 {
  fill: rgba(121, 165, 111, 0.16);
  stroke: rgba(121, 165, 111, 0.95);
}

.stem-point.quartile-4 {
  fill: rgba(47, 133, 90, 0.18);
  stroke: rgba(47, 133, 90, 0.98);
}

.area-fill {
  fill: var(--beige-fill);
  stroke: none;
}

.range-fill {
  fill: var(--selected-soft);
  stroke: none;
}

.quartile-fill.quartile-fill-1,
.quartile-band.quartile-band-1 {
  fill: rgba(176, 142, 97, 0.3);
  stroke: none;
}

.quartile-fill.quartile-fill-2,
.quartile-band.quartile-band-2 {
  fill: rgba(223, 190, 130, 0.34);
  stroke: none;
}

.quartile-fill.quartile-fill-3,
.quartile-band.quartile-band-3 {
  fill: rgba(148, 186, 116, 0.3);
  stroke: none;
}

.quartile-fill.quartile-fill-4,
.quartile-band.quartile-band-4 {
  fill: rgba(61, 145, 102, 0.34);
  stroke: none;
}

.selection-band {
  fill: rgba(47, 133, 90, 0.14);
  stroke: none;
}

.empirical-bar {
  fill: rgba(47, 133, 90, 0.24);
  stroke: rgba(47, 133, 90, 0.6);
  stroke-width: 1.2;
}

.empirical-step {
  fill: none;
  stroke: var(--selected);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-opacity: 0.9;
}

.expectation-arrow {
  stroke: #7c3f00;
  stroke-width: 6;
  stroke-linecap: round;
}

.expectation-head {
  fill: #7c3f00;
  stroke: none;
}

.expectation-label {
  fill: #7c3f00;
  font-size: 28px;
  font-weight: 700;
}

.sample-values-footer {
  fill: rgba(95, 108, 114, 0.92);
  font-size: 12px;
  font-weight: 600;
}

.clt-normal-curve {
  fill: none;
  stroke: #b91c1c;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.clt-reference-cdf {
  stroke: #b91c1c;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mean-theoretical-cdf {
  stroke: #2563eb;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.clt-normal-formula {
  fill: rgba(124, 63, 0, 0.96);
  font-size: 12px;
  font-weight: 700;
}

.clt-normal-latex {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  width: 100%;
  height: 100%;
  padding: 4px 8px 12px 0;
  overflow: visible;
  line-height: 1;
  color: rgba(124, 63, 0, 0.98);
  font-size: 32px;
  font-weight: 700;
}

.clt-normal-latex .katex {
  font-size: 1em;
}

.clt-cdf-latex {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  width: 100%;
  height: 100%;
  overflow: visible;
  line-height: 1;
  color: #b91c1c;
  font-size: 24px;
  font-weight: 700;
}

.mean-cdf-latex {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  width: 100%;
  height: 100%;
  overflow: visible;
  line-height: 1;
  color: #2563eb;
  font-size: 22px;
  font-weight: 700;
}

.step-segment,
.step-jump {
  stroke: #1f2a30;
  stroke-width: 2.8;
}

.step-point {
  stroke: #1f2a30;
  stroke-width: 1.8;
}

.step-point.closed {
  fill: #1f2a30;
}

.step-point.open {
  fill: #fffdf8;
}

.bound-line {
  stroke-width: 2;
  stroke-dasharray: 7 5;
}

.bound-line.lower {
  stroke: var(--lower);
}

.bound-line.upper {
  stroke: var(--upper);
}

.bound-point {
  stroke-width: 1.8;
}

.bound-point.lower {
  fill: var(--lower);
  stroke: #fffdf8;
}

.bound-point.upper {
  fill: var(--upper);
  stroke: #fffdf8;
}

.bound-handle {
  stroke-width: 2;
  cursor: ew-resize;
}

.bound-handle.lower {
  fill: rgba(37, 99, 235, 0.18);
  stroke: var(--lower);
}

.bound-handle.upper {
  fill: rgba(220, 38, 38, 0.18);
  stroke: var(--upper);
}

.axis-interval {
  stroke: var(--selected);
  stroke-width: 10;
  stroke-linecap: round;
}

.axis-interval-point {
  stroke: var(--selected);
  stroke-width: 2.4;
}

.axis-interval-point.closed {
  fill: var(--selected);
}

.axis-interval-point.open {
  fill: #fffdf8;
}

.guide-line {
  stroke-width: 1.6;
  stroke-dasharray: 5 4;
}

.guide-line.lower {
  stroke: var(--lower);
}

.guide-line.upper {
  stroke: var(--upper);
}

.guide-label {
  font-size: 14px;
  font-weight: 700;
}

.quartile-guide-line {
  stroke: #2f855a;
  stroke-width: 3;
  stroke-dasharray: 6 3;
}

.quartile-guide-line.quartile-1,
.quartile-point.quartile-1,
.quartile-axis-marker.quartile-1 {
  stroke: #b89b74;
}

.quartile-guide-line.quartile-2,
.quartile-point.quartile-2,
.quartile-axis-marker.quartile-2 {
  stroke: #2f855a;
}

.quartile-guide-line.quartile-3,
.quartile-point.quartile-3,
.quartile-axis-marker.quartile-3 {
  stroke: #6c9f53;
}

.quartile-point {
  fill: #2f855a;
  stroke: #fffdf8;
  stroke-width: 1.8;
}

.quartile-point.quartile-1 {
  fill: #b89b74;
}

.quartile-point.quartile-2 {
  fill: #2f855a;
}

.quartile-point.quartile-3 {
  fill: #6c9f53;
}

.quartile-axis-marker {
  stroke: #2f855a;
  stroke-width: 4;
  stroke-linecap: round;
}

.quartile-density-label {
  fill: #2f855a;
  font-size: 20px;
  font-weight: 700;
}

.quartile-density-label.quartile-2 {
  font-size: 28px;
}

.quartile-density-label.quartile-1,
.quartile-cdf-label.quartile-1 {
  fill: #b89b74;
}

.quartile-density-label.quartile-2,
.quartile-cdf-label.quartile-2 {
  fill: #2f855a;
}

.quartile-density-label.quartile-3,
.quartile-cdf-label.quartile-3 {
  fill: #6c9f53;
}

.quartile-cdf-label {
  font-size: 16px;
  font-weight: 700;
}

.quartile-region-label {
  fill: #2f855a;
  font-size: 15px;
  font-weight: 700;
}

.inverse-guide-line {
  stroke: rgba(15, 118, 110, 0.42);
  stroke-width: 2.2;
  stroke-dasharray: 5 4;
}

.inverse-guide-line.latest {
  stroke: #0f766e;
  stroke-width: 3.6;
  stroke-dasharray: none;
}

.inverse-point {
  fill: rgba(15, 118, 110, 0.55);
  stroke: #fffdf8;
  stroke-width: 1.4;
}

.inverse-point.latest {
  fill: #0f766e;
  stroke-width: 1.8;
}

.inverse-axis-marker {
  stroke: rgba(15, 118, 110, 0.42);
  stroke-width: 3;
  stroke-linecap: round;
}

.inverse-axis-marker.latest {
  stroke: #0f766e;
  stroke-width: 4.6;
}

.inverse-cdf-label {
  fill: #0f766e;
  font-size: 15px;
  font-weight: 700;
}

.inverse-cdf-label.latest {
  font-size: 17px;
}

.inverse-rug-mark {
  stroke: rgba(15, 118, 110, 0.4);
  stroke-width: 1.4;
  stroke-linecap: round;
}

.inverse-rug-mark.discrete {
  stroke: rgba(15, 118, 110, 0.62);
  stroke-width: 4.2;
}

.inverse-u-rug-mark {
  stroke: rgba(15, 118, 110, 0.45);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.cursor-line {
  stroke: #334155;
  stroke-width: 1.2;
  stroke-dasharray: 5 4;
}

.cursor-point {
  fill: #334155;
}

.tick-label {
  fill: var(--muted);
  font-size: 16px;
}

.overlay {
  fill: transparent;
  cursor: crosshair;
  touch-action: none;
}

@media (max-width: 960px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    width: 100%;
    gap: 10px;
    padding: 10px;
  }

  .hero {
    grid-column: auto;
    grid-row: auto;
  }

  .picker-row {
    justify-content: start;
  }

  .charts,
  .control-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .charts {
    grid-template-rows: none;
    grid-auto-rows: auto;
    gap: 10px;
  }

  .chart-card {
    min-height: 320px;
    padding: 8px;
  }

  .card-head {
    align-items: flex-start;
    gap: 6px;
  }

  .title-row {
    gap: 6px;
  }

  .readout {
    font-size: 0.92rem;
  }

  .formula-label {
    font-size: 1.12rem;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .control-panel {
    overflow: visible;
  }

  .simulation-actions {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .pair-rows {
    grid-template-columns: 1fr;
  }

  .simulation-head {
    align-items: stretch;
    flex-wrap: wrap;
    gap: 8px;
  }

  .median-head {
    gap: 8px;
  }

  .median-panel {
    grid-template-columns: 1fr;
  }

  .chart-host {
    height: 260px;
    min-height: 260px;
  }
}

@media (max-width: 640px) {
  h1 {
    font-size: 1.35rem;
  }

  h2 {
    font-size: 1.35rem;
  }

  .picker-row {
    gap: 6px;
  }

  .distribution-select {
    width: 100%;
  }

  .summary-strip strong,
  .domain-inline {
    font-size: 0.96rem;
  }

  .simulation-mode-toggle {
    width: 100%;
    min-width: 0;
  }

  .chart-card {
    min-height: 280px;
  }

  .chart-host {
    height: 230px;
    min-height: 230px;
  }
}
