:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #dde1e6;
  --text: #1b1f24;
  --text-muted: #5b6470;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --bad: #d92d20;
  --warn-bg: #fff4e5;
  --warn-text: #8a4b00;
  --grid: #e8ebef;
  --series-1: #2563eb;
  --series-1-soft: #93b4f5;
  --series-2: #0f9d76;
  --series-3: #c2410c;
  --band-download: rgba(15, 157, 118, 0.08);
  --band-upload: rgba(194, 65, 12, 0.08);
  --series-4: #7c3aed;
  --band-inference: rgba(124, 58, 237, 0.07);
  --good: #12850f;
  --warn: #b7791f;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111418;
    --surface: #1a1e24;
    --border: #2c323a;
    --text: #e6e9ed;
    --text-muted: #9aa3ae;
    --accent: #5b8def;
    --accent-text: #0b0d10;
    --bad: #f97066;
    --warn-bg: #3a2a12;
    --warn-text: #f5c07a;
    --grid: #262b32;
    --series-1: #6b9bf2;
    --series-1-soft: #3c5a92;
    --series-2: #34c39a;
    --series-3: #f08a4b;
    --band-download: rgba(52, 195, 154, 0.10);
    --band-upload: rgba(240, 138, 75, 0.10);
    --series-4: #a78bfa;
    --band-inference: rgba(167, 139, 250, 0.10);
    --good: #4cc26a;
    --warn: #f5b84a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
}

main { max-width: 960px; margin: 0 auto; padding: 24px 16px 48px; }
main.wide { max-width: 1200px; }

header h1 { font-size: 20px; margin: 0 0 4px; }
header p { margin: 0 0 20px; color: var(--text-muted); }
h3 { font-size: 15px; margin: 28px 0 8px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 16px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
input[type="text"], select {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
}
.quick-start { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.quick-start label { flex: 1 1 240px; }
.quick-start button { font-size: 16px; padding: 10px 28px; }
details.options { margin-top: 16px; }
details.options > summary { cursor: pointer; font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
#form-error:not(:empty) { display: block; margin-top: 10px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 14px; }

button, .button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 6px; padding: 9px 18px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text); text-decoration: none; display: inline-block;
}
button.secondary, .button.secondary { background: transparent; color: var(--accent); }
button:disabled { opacity: 0.5; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; align-items: center; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 560px) { .cards { grid-template-columns: repeat(2, 1fr); } .card-value { font-size: 22px; } }
.card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.card-label { font-size: 12px; color: var(--text-muted); }
.card-value { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.card-value .unit { font-size: 13px; font-weight: 500; color: var(--text-muted); margin-left: 4px; }
.card-note { font-size: 11px; color: var(--text-muted); }

.progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.phase-name { font-size: 18px; font-weight: 650; }
.status { color: var(--text-muted); font-size: 13px; min-height: 1.5em; }
.bar { height: 6px; background: var(--grid); border-radius: 3px; overflow: hidden; margin: 10px 0 16px; }
.bar > div { height: 100%; width: 0; background: var(--accent); transition: width 0.4s linear; }

.chart { width: 100%; min-height: 260px; margin-top: 8px; }
.legend-note, .meta { font-size: 12px; color: var(--text-muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
.banner { border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px; }
.banner.warn { background: var(--warn-bg); color: var(--warn-text); }
.error { color: var(--bad); }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
table.detail tbody th { font-weight: 500; color: var(--text-muted); }
table.list thead th { cursor: pointer; user-select: none; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: var(--bg); }
th.left, td.left { text-align: left; }
.bad { color: var(--bad); font-weight: 600; }

.summary { display: grid; gap: 8px; }
.summary-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.answer { font-size: 22px; font-weight: 700; letter-spacing: 0.02em; padding: 2px 14px; border-radius: 6px; border: 2px solid var(--c, var(--border)); color: var(--c, var(--text)); }
.answer.ok { --c: var(--good); }
.answer.warn { --c: var(--warn); }
.answer.bad { --c: var(--bad); }
.result-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; color: var(--text-muted); }
.summary-text { margin: 0; font-size: 16px; line-height: 1.55; }
details.report { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
details.report > summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.verdict { display: grid; gap: 6px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); margin-bottom: 8px; }
.verdict-title { font-size: 19px; font-weight: 650; line-height: 1.35; }
.verdict-note { margin: 0; font-size: 13px; color: var(--text-muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.pill::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--text-muted)); }
.pill.ok { --c: var(--good); }
.pill.warn { --c: var(--warn); }
.pill.bad { --c: var(--bad); }
table.cond td { vertical-align: top; }
table.cond td:nth-child(2) { white-space: normal; min-width: 9rem; }
table.cond td:nth-child(4) { white-space: normal; min-width: 11rem; }
td.why { white-space: normal; text-align: left; color: var(--text-muted); min-width: 16rem; }
.good { color: var(--good); font-weight: 600; }

.inline-bar { display: inline-block; height: 8px; border-radius: 2px; background: var(--series-1); vertical-align: middle; margin-left: 6px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-bottom: 12px; }

.hidden { display: none !important; }

.u-legend { font-size: 12px; color: var(--text-muted); }
.u-legend .u-marker { border-radius: 2px; }
