:root {
  --bg: #0f1419;
  --panel: #1a212b;
  --panel-border: #2a3441;
  --text: #e6edf3;
  --muted: #9aa7b4;
  --accent: #4cc2ff;
  --accent-press: #2aa3e0;
  --good: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --p50: #4cc2ff;
  --p85: #3fb950;
  --p95: #d29922;
  --p99: #f85149;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header, main, footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

header { padding-top: 32px; }

h1 { margin: 0 0 8px; font-size: 1.9rem; }

.subtitle { color: var(--muted); max-width: 70ch; }
.subtitle a { color: var(--accent); }

.repo-link { margin: 6px 0 0; font-size: 0.85rem; }
.repo-link a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; }
.repo-link a:hover { color: var(--accent); }
.repo-link svg { display: block; }

.status {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.status--loading { background: #3a2f12; color: var(--warn); }
.status--ready   { background: #12331c; color: var(--good); }
.status--busy    { background: #12283a; color: var(--accent); }
.status--error   { background: #3a1414; color: var(--bad); }

main {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  margin-top: 24px;
}
@media (max-width: 820px) { main { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 20px;
}
.panel h2 { margin-top: 0; font-size: 1.1rem; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
.muted { color: var(--muted); font-weight: 400; }

.field input[type="number"],
.field input[type="range"] {
  width: 100%;
}
.field input[type="number"] {
  background: #0f1620;
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.95rem;
}
.field input[type="range"] { accent-color: var(--accent); }
#variability-out { display: inline-block; margin-top: 4px; font-variant-numeric: tabular-nums; color: var(--muted); }

.seed-row { display: flex; gap: 8px; }
.seed-row input { flex: 1; }

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, opacity .15s;
}
.btn--primary { background: var(--accent); color: #04121c; width: 100%; }
.btn--primary:hover:not(:disabled) { background: var(--accent-press); }
.btn--primary:disabled { opacity: .5; cursor: not-allowed; }
.btn--ghost { background: transparent; border-color: var(--panel-border); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); }

.hint { color: var(--muted); font-style: italic; }

.summary { margin-bottom: 16px; }
.summary table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.summary th, .summary td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--panel-border); }
.summary th:first-child, .summary td:first-child { text-align: left; }
.summary thead th { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: .03em; }

.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: middle; }
.swatch--p50 { background: var(--p50); }
.swatch--p85 { background: var(--p85); }
.swatch--p95 { background: var(--p95); }
.swatch--p99 { background: var(--p99); }

.takeaway {
  margin-top: 14px;
  padding: 12px 14px;
  background: #0f1620;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 0.92rem;
}

.chart-wrap { width: 100%; overflow-x: auto; }
#chart { width: 100%; height: auto; border-radius: 8px; background: #fff; }

footer { padding: 24px 20px 40px; color: var(--muted); font-size: 0.85rem; }
footer code { color: var(--accent); }
