:root {
  color-scheme: light;
  --ink: #16213c;
  --muted: #56627b;
  --line: #dce4f2;
  --soft: #f3f6fc;
  --white: #fff;
  --accent: #3156d3;
  --accent-dark: #2545b2;
  --signal: #168475;
  --false: #b64c29;
  --radius: 16px;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: #f2f5fb;
  font-synthesis: none;
  scroll-behavior: smooth;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
[hidden] { display: none !important; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: var(--accent-dark); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
.shell { width: min(1376px, calc(100% - 88px)); margin-inline: auto; }
.site-header { background: #111c37; border-bottom: 1px solid #2b3753; }
.topbar { height: 61px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: white; text-decoration: none; font-size: 15px; font-weight: 750; letter-spacing: -.015em; }
.brand-mark { width: 27px; height: 27px; display: inline-flex; align-items: center; justify-content: center; gap: 2px; background: #9eb3ff; border-radius: 7px; }
.brand-mark i { display: block; width: 3px; height: 6px; background: #172952; border-radius: 3px; }
.brand-mark i:nth-child(2) { height: 13px; }
.brand-mark i:nth-child(3) { height: 9px; }
nav { display: flex; gap: clamp(12px, 3vw, 33px); }
nav a { color: #d9e3fd; text-decoration: none; font-size: 14px; font-weight: 600; }
nav a:hover { color: #fff; text-decoration: underline; }
.site-header a:focus-visible { outline-color: #cad7ff; }
.hero {
  color: #f5f7ff;
  background: radial-gradient(ellipse at 100% 0%, #283d75 0%, transparent 62%), #151f3c;
}
.hero-inner { padding: 31px 0 35px; }
.eyebrow { color: #b6c6ff; font-size: 11px; font-weight: 750; letter-spacing: .15em; text-transform: uppercase; }
h1 { font-size: clamp(35px, 4.85vw, 66px); letter-spacing: -.062em; line-height: 1.04; margin-top: 7px; font-weight: 760; }
.intro { color: #dce4f8; font-size: clamp(14px, 1.35vw, 16px); line-height: 1.55; margin-top: 13px; max-width: 695px; }
main { padding: 25px 0 50px; }
.workspace { display: grid; grid-template-columns: minmax(275px, 310px) minmax(0, 1fr); align-items: start; gap: 22px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 14px #334c8210; }
.controls { padding: 21px 19px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
h2 { font-size: 21px; line-height: 1.2; font-weight: 750; letter-spacing: -.036em; }
.section-head p { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.text-button { padding: 4px 2px; background: transparent; border: 0; color: var(--accent-dark); font-size: 13px; font-weight: 650; }
.text-button:hover { text-decoration: underline; }
fieldset, .range-control { margin: 22px 0 0; padding: 0; border: 0; min-width: 0; }
legend, .range-title label, .seed-row label { font-weight: 680; font-size: 13px; padding: 0; }
.segments { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 8px; min-width: 0; }
.segments.types { gap: 6px; }
.segments label { position: relative; min-width: 0; }
.segments input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segments span { display: grid; place-items: center; min-height: 35px; padding: 5px 3px; text-align: center; color: #465570; border: 1px solid #dfe5ef; background: #f9fafc; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 650; }
.segments label:hover span { border-color: #a6b9ef; }
.segments input:checked + span { color: #243fa4; background: #eaf0ff; border-color: #8fa7fc; }
.segments input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.control-note { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.43; min-height: 34px; }
.range-control { margin-top: 17px; }
.range-title, .range-bounds { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.range-control output { color: var(--accent-dark); padding: 3px 7px; background: #edf2ff; border-radius: 5px; font: 600 11px ui-monospace, monospace; white-space: nowrap; }
input[type=range] { width: 100%; display: block; height: 25px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }
.range-bounds { color: var(--muted); font-size: 11px; }
.seed-row { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 9px; border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
.seed-value { display: grid; gap: 5px; }
.seed-value input { width: 116px; border: 1px solid #ccd7eb; border-radius: 7px; height: 34px; padding: 4px 8px; color: var(--ink); background: #fbfcff; font: 12px ui-monospace, monospace; }
.secondary-button { background: #edf2ff; border: 1px solid #d9e2fc; color: var(--accent-dark); border-radius: 7px; padding: 6px 9px; min-height: 34px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.secondary-button:hover { background: #e2eaff; }
.secondary-button span { margin-left: 3px; }
.results-stack { display: grid; gap: 17px; min-width: 0; }
.stream-card, .comparison { padding: 20px; min-width: 0; }
.scenario { border: 1px solid #dce6ff; background: #f0f4ff; color: #304d9e; border-radius: 6px; padding: 5px 8px; display: inline-block; font: 600 11px ui-monospace, monospace; text-align: right; }
.legend { display: flex; align-items: center; flex-wrap: wrap; color: #495673; gap: 9px 16px; font-size: 11px; margin: 16px 0 10px; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend i { display: inline-block; }
.legend-sample { height: 6px; width: 6px; border-radius: 50%; background: #7180a7; }
.legend-guide { width: 14px; border-top: 2px solid #1b394d; }
.legend-drift { height: 12px; border-left: 2px dashed var(--signal); }
.legend-transition { width: 12px; height: 10px; border: 1px solid #a4d9cc; background: #e8f5f1; }
.legend-hit { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.legend-false { color: var(--false); line-height: 8px; font-style: normal; font-weight: 800; font-size: 17px; }
.chart-wrap { background: #f9fbff; border: 1px solid #e6ecf6; border-radius: 9px; }
canvas { width: 100%; height: 354px; display: block; cursor: crosshair; border-radius: 9px; }
.chart-footer { min-height: 28px; margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 5px 12px; color: var(--muted); font-size: 11px; line-height: 1.45; }
#readout { font-variant-numeric: tabular-nums; font-weight: 650; color: #344567; }
.comparison .section-head a { font-size: 12px; font-weight: 650; white-space: nowrap; margin-top: 4px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; min-width: 100%; font-size: 13px; }
.comparison table { margin-top: 14px; }
th, td { padding: 10px 8px; vertical-align: middle; border-bottom: 1px solid #e8edf7; }
th { font-size: 11px; text-align: left; color: var(--muted); font-weight: 730; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
td:not(:first-child), th:not(:first-child) { text-align: right; white-space: nowrap; }
td { font-variant-numeric: tabular-nums; }
.detector-name { display: inline-block; font-weight: 750; min-width: 55px; white-space: nowrap; }
.detector-name::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 7px; background: var(--detector); vertical-align: 1px; }
.detector-signal { color: var(--muted); font-size: 11px; margin-left: 6px; }
.positive { color: #076c59; font-weight: 700; }
.false-text { color: #983e23; font-weight: 700; }
.alarm-log { margin-top: 12px; }
.alarm-log summary { cursor: pointer; display: list-item; color: var(--accent-dark); font-size: 12px; font-weight: 700; width: fit-content; }
.alarm-log summary span { color: var(--muted); margin-left: 5px; font-weight: 500; }
.alarm-log p { font-size: 12px; color: var(--muted); padding: 10px 0; }
.notes { padding-top: 32px; }
.notes-head p { color: var(--muted); margin-top: 6px; font-size: 14px; }
.method-grid, .notes-grid { display: grid; gap: 17px; margin-top: 15px; }
.method-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.notes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.method, .explanation { padding: 18px 20px; }
.method { border-top: 3px solid var(--method); }
.method[data-method=d3] { --method: #3156d3; }
.method[data-method=pudd] { --method: #7053b8; }
.method[data-method=bndm] { --method: #15806f; }
.method-type { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 9px; }
h3 { font-size: 17px; letter-spacing: -.022em; margin-bottom: 7px; }
.method p:not(.method-type), .explanation p { color: #46536e; font-size: 13px; line-height: 1.57; }
.method .implementation, .explanation p + p { margin-top: 9px; }
.method a { display: inline-block; margin-top: 11px; font-size: 12px; font-weight: 650; }
#scoring, #experiment, #methods { scroll-margin-top: 15px; }
@media (max-width: 1050px) {
  .shell { width: calc(100% - 48px); }
  .workspace { grid-template-columns: 263px minmax(0, 1fr); gap: 15px; }
  .controls, .stream-card, .comparison { padding: 16px; }
  .detector-signal { display: block; margin: 3px 0 0 14px; }
}
@media (max-width: 760px) {
  .shell { width: calc(100% - 34px); }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
  .controls .section-head, .seed-row { grid-column: 1 / -1; }
  fieldset, .range-control, .seed-row { margin-top: 0; }
  .method-grid, .notes-grid { grid-template-columns: 1fr; }
  .hero-inner { padding: 27px 0 29px; }
  main { padding-top: 17px; }
}
@media (max-width: 410px) {
  .shell { width: calc(100% - 24px); }
  .controls, .stream-card, .comparison { padding: 13px; }
  .legend { gap: 8px 10px; }
  h2 { font-size: 19px; }
  canvas { height: 320px; }
  th, td { padding-inline: 5px; font-size: 11px; }
  .detector-signal { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { :root { scroll-behavior: auto; } }

.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-size: 13px; font-weight: 680; }
.source-field { margin-top: 18px; }
.field input:not([type=file]), .field select, .field input[type=file] {
  min-width: 0;
  width: 100%;
  min-height: 35px;
  padding: 5px 8px;
  border: 1px solid #ccd7eb;
  border-radius: 7px;
  background: #fbfcff;
  color: var(--ink);
  font-size: 13px;
}
.source-field select { background: #edf2ff; border-color: #c4d3fa; color: #243fa4; font-weight: 700; }
.field input[type=file] { color: var(--muted); font-size: 11px; }
.field input[type=file]::file-selector-button {
  padding: 5px 8px;
  cursor: pointer;
  background: #edf2ff;
  color: var(--accent-dark);
  border: 1px solid #dae3fb;
  border-radius: 5px;
  font: inherit;
  font-weight: 700;
  margin-right: 6px;
}
.field .control-note { min-height: 0; margin: 0; overflow-wrap: anywhere; }
.upload-controls, .observed-controls { display: grid; gap: 14px; margin-top: 16px; }
.checkbox { display: flex; align-items: start; gap: 6px; font-size: 11px; color: var(--muted); cursor: pointer; }
.checkbox input { accent-color: var(--accent); margin: 0; }
.joined-field { display: flex; align-items: stretch; gap: 5px; }
.stream-error { margin-top: 12px; color: #983e23; background: #fff1eb; border: 1px solid #f3cdbd; border-radius: 6px; padding: 7px 9px; font-size: 12px; line-height: 1.45; }
.stream-status { min-height: 354px; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 18px; font-size: 14px; }
.legend-alarm { width: 8px; height: 8px; border-radius: 50%; border: 1.7px solid #56627b; }
.detector-detail { display: block; padding-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.4; }
#readout { overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .source-field, .upload-controls, .observed-controls, .stream-error { grid-column: 1 / -1; margin-top: 0; }
  #synthetic-controls { display: contents; }
}
@media (max-width: 410px) { .stream-status { min-height: 320px; } }
