:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --text: #1d2229;
  --muted: #5d6673;
  --line: #dfe2e6;
  --accent: #2f6db5;
  --bar: #6f95c4;
  --lin: #d1495b;
  --db: #e08a1e;
  --med: #3b9b5b;
  --grid: #eceef0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181c;
    --surface: #1d2127;
    --text: #e6e8eb;
    --muted: #9aa3ae;
    --line: #333a43;
    --accent: #7fb0ec;
    --bar: #5d86b8;
    --lin: #f07b8a;
    --db: #f2aa52;
    --med: #6cc78c;
    --grid: #2a3038;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0 auto;
  max-width: 1080px;
  padding: 16px 16px 40px;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 4px 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; margin: 26px 0 8px; }
.intro { margin: 0 0 6px; color: var(--muted); max-width: 70ch; }

.lang { text-align: right; font-size: 0.92rem; }
.lang b { font-weight: 600; }
.lang a { text-decoration: none; border-bottom: 1px solid currentColor; }

.tabs {
  display: flex; flex-wrap: wrap; gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: 18px 0 18px;
}
.tabs button {
  font: inherit; color: var(--muted); background: none; border: 0;
  padding: 8px 12px; border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs button:hover { color: var(--text); }

.controls { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; margin-bottom: 12px; }
.controls label { display: flex; flex-direction: column; gap: 4px; font-size: 0.86rem; color: var(--muted); }
.controls output { color: var(--text); font-variant-numeric: tabular-nums; }
select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; min-width: 120px;
}
input[type="range"] { width: 180px; accent-color: var(--accent); }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px 8px; margin: 0; }
legend { font-size: 0.86rem; color: var(--muted); padding: 0 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 0.9rem; color: var(--text); flex-direction: row !important; }

button.primary {
  font: inherit; color: #fff; background: var(--accent); border: 0; border-radius: 6px; padding: 7px 14px; cursor: pointer;
}
button.primary:disabled { opacity: 0.55; cursor: progress; }

.chart {
  position: relative; min-height: 220px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px;
}
.chart svg { display: block; overflow: visible; font-size: 12px; }
.chart-title { fill: var(--text); font-size: 13.5px; font-weight: 600; }
.axis text, .legend { fill: var(--muted); }
.axis path, .axis line { stroke: var(--line); }
.axis-label { fill: var(--muted); font-size: 12px; }
.grid line { stroke: var(--grid); }
.grid path { stroke: none; }
.bar { fill: var(--bar); }
.marker { stroke-width: 2; }
.marker.lin { stroke: var(--lin); }
.marker.db { stroke: var(--db); stroke-dasharray: 6 4; }
.marker.med { stroke: var(--med); stroke-dasharray: 2 3; }
.series { fill: none; stroke-width: 2; }
.tip {
  position: absolute; pointer-events: none; transform: translate(-50%, -100%);
  background: var(--text); color: var(--bg); font-size: 12px; padding: 3px 7px; border-radius: 4px; white-space: nowrap;
  transition: opacity 0.1s;
}

.status { color: var(--muted); font-size: 0.9rem; }
.status.error { color: var(--lin); }
.note { color: var(--muted); font-size: 0.92rem; max-width: 78ch; }
.note ul { padding-left: 1.2em; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 0.84rem; background: var(--surface); }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { font-weight: 600; background: var(--bg); position: sticky; top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }

.about { max-width: 80ch; }
.about table { margin: 8px 0; }
.about td, .about th { white-space: normal; }
.about pre { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; font-size: 0.82rem; }
.about code { font-size: 0.9em; }

footer { margin-top: 40px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
