:root {
  color-scheme: dark;
  --bg: #0f0f14;
  --panel: #15151c;
  --line: #26262e;
  --axis: #52525b;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --green: #10b981;
  --lime: #84cc16;
  --pale: #d4d4d8;
  --focus: #a3e635;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
}

a { color: var(--lime); }
a:hover { color: #bef264; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

header.top {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 28px 0 8px;
}
header.top img { width: 56px; height: 56px; border-radius: 12px; flex: none; }
header.top h1 { font-size: 24px; line-height: 1.2; margin: 0; }
header.top p { margin: 4px 0 0; color: var(--muted); }

.meta { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.meta a { white-space: nowrap; }

.load {
  margin: 20px 0 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
}
.load label.file { font-weight: 600; }
.load input[type="file"] { color: var(--muted); max-width: 100%; }
.load .note { color: var(--muted); font-size: 13px; flex-basis: 100%; margin: 0; }
.status { font-size: 13px; color: var(--lime); flex-basis: 100%; margin: 0; min-height: 1em; }
.status.error { color: #fca5a5; }

button, select, input[type="search"] {
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: #1d1d26;
  border: 1px solid #34343f;
  border-radius: 8px;
  padding: 6px 10px;
}
button { cursor: pointer; }
button:hover { border-color: var(--green); }
button[hidden] { display: none; }

section.chart {
  margin: 28px 0;
  padding: 18px 16px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
section.chart h2 { font-size: 18px; margin: 0; }
section.chart .sub { color: var(--muted); margin: 2px 0 12px; font-size: 14px; }
section.chart .ours { display: inline-block; font-size: 12px; color: var(--bg); background: var(--pale);
  border-radius: 4px; padding: 0 6px; margin-left: 6px; vertical-align: 2px; }
section.chart .ours[hidden] { display: none; }

.controls { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 0 0 12px; }
.controls fieldset { border: 0; padding: 0; margin: 0; display: flex; gap: 4px; align-items: center; }
.controls legend { float: left; margin-right: 6px; color: var(--muted); font-size: 13px; }
.controls label { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: inline-block; padding: 5px 10px; border: 1px solid #34343f; border-radius: 8px;
  color: var(--text); font-size: 13px; cursor: pointer; }
.seg input:checked + span { background: var(--green); border-color: var(--green); color: #04130d; font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.legend i { display: inline-block; width: 14px; height: 10px; margin-right: 6px; vertical-align: -1px; }
.legend .sw-one { background: linear-gradient(90deg, var(--green), var(--lime)); }
.legend .sw-two { background: repeating-linear-gradient(45deg, rgba(15,15,20,.75) 0 2px, transparent 2px 5px),
  linear-gradient(90deg, var(--green), var(--lime)); }
.legend .sw-pale { background: var(--pale); }
.legend .sw-tick { width: 2px; height: 14px; background: var(--text); vertical-align: -3px; }
.legend .sw-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--lime); }
.legend .sw-sq { width: 10px; height: 10px; border: 2px solid var(--text); }
.legend .sw-whisk { width: 16px; height: 8px; border: solid var(--text); border-width: 0 1.5px; background:
  linear-gradient(var(--text), var(--text)) center / 100% 1.5px no-repeat; }

.plot { position: relative; width: 100%; }
.plot svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font); }
.plot svg text { fill: var(--text); font-size: 12px; }
.plot svg text.muted { fill: var(--muted); font-size: 11px; }
.plot svg .grid { stroke: var(--line); }
.plot svg .zero { stroke: var(--axis); stroke-width: 1.2; }
.plot svg .pt { cursor: default; }
.plot svg .pt:focus { outline: none; }
.plot svg .pt:focus .ring, .plot svg .pt:hover .ring { stroke: var(--focus); stroke-width: 2; }

.empty { color: var(--muted); font-size: 14px; margin: 8px 0; }
.foot { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

.tip {
  position: absolute;
  pointer-events: none;
  background: #000;
  border: 1px solid #34343f;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  z-index: 2;
}
.tip[hidden] { display: none; }
.tip b { display: block; }

details.table { margin: 28px 0; }
details.table summary { cursor: pointer; font-weight: 600; }
.tablewrap { overflow-x: auto; margin-top: 10px; }
table { border-collapse: collapse; font-size: 13px; min-width: 720px; width: 100%; }
th, td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }
th { color: var(--muted); font-weight: 600; }

footer { color: var(--muted); font-size: 13px; padding: 12px 0 40px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: no-preference) {
  .plot svg rect.bar { transition: width 200ms ease-out; }
  .seg span, button { transition: background-color 120ms, border-color 120ms; }
}

@media (max-width: 560px) {
  header.top h1 { font-size: 20px; }
  header.top img { width: 44px; height: 44px; }
  section.chart { padding: 14px 12px 10px; }
}
