:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --text-1: #0b0b0b;
  --text-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --shade: rgba(11, 11, 11, 0.045);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --supply: #2a78d6;
  --drain: #e34948;
  --neutral: #c3c2b7;
  --neutral-fill: #f0efec;
  --supply-ink: #1c5cab;
  --drain-ink: #b8302f;
  --radius: 14px;
  --font: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232322;
    --text-1: #f0efec;
    --text-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --shade: rgba(255, 255, 255, 0.05);
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --supply: #3987e5;
    --drain: #e66767;
    --neutral: #55554f;
    --neutral-fill: #383835;
    --supply-ink: #86b6ef;
    --drain-ink: #f09a9a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232322;
  --text-1: #f0efec;
  --text-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --shade: rgba(255, 255, 255, 0.05);
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --supply: #3987e5;
  --drain: #e66767;
  --neutral: #55554f;
  --neutral-fill: #383835;
  --supply-ink: #86b6ef;
  --drain-ink: #f09a9a;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--text-1);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--series-1); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ── header ── */
header.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
header.top .wrap { display: flex; align-items: center; gap: 16px; height: 56px; }
.brand { font-weight: 700; letter-spacing: -0.01em; font-size: 16px; white-space: nowrap; }
.brand small { font-weight: 500; color: var(--muted); margin-left: 8px; font-size: 12px; }
header.top nav { display: flex; gap: 14px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
header.top nav a { color: var(--text-2); font-size: 13px; white-space: nowrap; }
.icon-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  border-radius: 8px; height: 32px; min-width: 32px; cursor: pointer; font-size: 14px;
}
@media (max-width: 760px) { header.top nav { display: none; } .icon-btn { margin-left: auto; } }

/* ── layout ── */
main { padding: 24px 0 64px; }
section { margin-top: 44px; scroll-margin-top: 70px; }
h1, h2, h3 { letter-spacing: -0.015em; margin: 0; }
h2 { font-size: 20px; }
.section-head { margin-bottom: 14px; }
.section-head p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; max-width: 760px; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 14px;
  min-width: 0;
}
.card h3 { font-size: 15px; font-weight: 650; }
.card .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } }

/* ── hero ── */
.hero { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; }
@media (max-width: 860px) { .hero { grid-template-columns: minmax(0, 1fr); } }
.verdict-label { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.verdict-label .big { font-size: 34px; font-weight: 750; letter-spacing: -0.025em; }
.verdict-label .tag { font-size: 14px; color: var(--text-2); }
.verdict-supply { color: var(--supply-ink); }
.verdict-drain { color: var(--drain-ink); }
.verdict-neutral { color: var(--text-1); }

.gauge { margin: 18px 0 6px; }
.gauge-track { position: relative; height: 10px; border-radius: 5px; display: flex; gap: 2px; }
.gauge-track span { flex: 1; border-radius: 3px; }
.gauge-marker {
  position: absolute; top: -5px; width: 4px; height: 20px; border-radius: 2px;
  background: var(--text-1); box-shadow: 0 0 0 2px var(--surface); transform: translateX(-2px);
}
.gauge-scale { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.subscores { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--text-2); }
.subscores b { color: var(--text-1); font-variant-numeric: tabular-nums; }

.narrative { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.narrative li { font-size: 14px; color: var(--text-2); padding-left: 16px; position: relative; }
.narrative li::before { content: ""; position: absolute; left: 2px; top: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.narrative li b { color: var(--text-1); font-weight: 600; }

.hero-num { font-size: 44px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.1; margin-top: 8px; }
.formula { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.deltas { display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap; }
.delta { font-size: 13px; color: var(--muted); }
.delta b { font-size: 15px; font-variant-numeric: tabular-nums; }
.up { color: var(--supply-ink); }
.down { color: var(--drain-ink); }

/* ── KPI tiles ── */
.kpi .label { font-size: 13px; color: var(--text-2); font-weight: 550; }
.kpi .value { font-size: 26px; font-weight: 720; letter-spacing: -0.02em; margin-top: 4px; }
.kpi .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.kpi .meta b { font-variant-numeric: tabular-nums; font-weight: 600; }
.kpi svg { display: block; margin-top: 8px; width: 100%; height: 36px; }
.kpi .note { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ── signal table ── */
.table-wrap { overflow-x: auto; }
table.signals { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.signals th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--axis); white-space: nowrap;
}
table.signals td { padding: 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.signals td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.signals tr.group td {
  background: var(--surface-2); font-weight: 650; font-size: 12.5px; color: var(--text-2); padding: 7px 10px;
}
.why { color: var(--muted); font-size: 12.5px; max-width: 380px; }
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px;
  border-radius: 999px; font-size: 12.5px; font-weight: 650; white-space: nowrap;
  border: 1px solid var(--border);
}
.pill.s-supply { color: var(--supply-ink); background: color-mix(in srgb, var(--supply) 12%, transparent); }
.pill.s-drain { color: var(--drain-ink); background: color-mix(in srgb, var(--drain) 12%, transparent); }
.pill.s-neutral { color: var(--text-2); background: var(--neutral-fill); }

/* ── range filter ── */
.filter-row {
  position: sticky; top: 56px; z-index: 15;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 0; margin-top: 36px;
  background: color-mix(in srgb, var(--page) 92%, transparent);
  backdrop-filter: blur(8px);
}
.filter-row .label { font-size: 13px; color: var(--text-2); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button {
  border: 0; background: transparent; color: var(--text-2); padding: 6px 13px; font-size: 13px;
  cursor: pointer; font-family: inherit;
}
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--text-1); color: var(--surface); font-weight: 600; }

/* ── charts ── */
.chart { position: relative; margin-top: 10px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font-family: var(--font); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-top: 8px; }
.legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.legend i.bar { height: 10px; width: 10px; border-radius: 2px; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  padding: 8px 10px; font-size: 12.5px; min-width: 140px; display: none;
}
.tooltip .t-date { color: var(--muted); font-size: 11.5px; margin-bottom: 4px; }
.tooltip .t-row { display: flex; align-items: center; gap: 7px; justify-content: space-between; }
.tooltip .t-row span:first-child { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.tooltip .t-row b { font-variant-numeric: tabular-nums; }
.tooltip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* contribution bars */
.contrib { display: grid; gap: 10px; margin-top: 12px; }
.contrib-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) 76px; align-items: center; gap: 10px; font-size: 13px; }
.contrib-row .name { color: var(--text-2); }
.contrib-row.total .name, .contrib-row.total .val { color: var(--text-1); font-weight: 650; }
.contrib-row .val { text-align: right; font-variant-numeric: tabular-nums; }
.contrib-bar { position: relative; height: 16px; }
.contrib-bar::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--axis); }
.contrib-bar span { position: absolute; top: 2px; height: 12px; border-radius: 3px; }
.contrib-head { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 10px; padding: 0 86px 0 122px; }

/* ── methodology ── */
.method p, .method li { font-size: 14px; color: var(--text-2); }
.method h3 { margin-top: 4px; margin-bottom: 6px; }
.method ul { padding-left: 18px; margin: 6px 0; }
.method li { margin: 5px 0; }
.method code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }
.timeline { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.timeline li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; font-size: 13.5px; }
.timeline li span:first-child { color: var(--muted); font-variant-numeric: tabular-nums; }

footer { border-top: 1px solid var(--border); padding: 24px 0 40px; color: var(--muted); font-size: 12.5px; }
footer code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }

.gauge-title { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--text-2); margin-bottom: 8px; flex-wrap: wrap; }
.gauge-title b { font-variant-numeric: tabular-nums; }
.gauge + .gauge { margin-top: 18px; }

/* 증감 의미 태그 */
.dir { margin-top: 8px; }
.dtags { display: flex; gap: 6px; flex-wrap: wrap; }
.dtag { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 6px; white-space: nowrap; border: 1px solid var(--border); }
.dtag.ease { color: var(--supply-ink); background: color-mix(in srgb, var(--supply) 10%, transparent); }
.dtag.tight { color: var(--drain-ink); background: color-mix(in srgb, var(--drain) 10%, transparent); }
.dtag.none { color: var(--text-2); background: var(--neutral-fill); }
.dwhy { font-size: 12.5px; color: var(--text-2); margin-top: 5px; line-height: 1.5; }

/* 확대 버튼 & 팝업 */
.card.has-zoom { position: relative; }
.zoom-btn {
  position: absolute; top: 14px; right: 14px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  border-radius: 7px; padding: 3px 9px; font-size: 12px; font-family: inherit; cursor: pointer;
}
.zoom-btn:hover { color: var(--text-1); border-color: var(--axis); background: var(--surface-2); }
.card.has-zoom > h3 { padding-right: 64px; }
.modal {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.45); padding: 24px 16px;
}
.modal[hidden] { display: none; }
.modal-box {
  width: min(1080px, 100%); max-height: 100%; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 20px 22px 18px; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
}
.modal-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.modal-head h3 { font-size: 18px; }
.modal-ctrl { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.zm-range { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.zm-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.zm-hint b { color: var(--text-2); font-weight: 600; }
.zstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin-top: 14px; }
.zstat { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.zname { font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.zname i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.zrow { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text-2); padding: 2px 0; flex-wrap: wrap; }
.zrow b { color: var(--text-1); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.zrow .muted, .zstats .muted { color: var(--muted); font-weight: 400; }
@media (max-width: 640px) {
  .modal { padding: 0; align-items: stretch; }
  .modal-box { border-radius: 0; max-height: none; height: 100%; padding: 16px; }
  .seg button { padding: 6px 10px; }
}

/* 차트 사용법 안내 */
.howto { margin-top: 6px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 14px 18px; }
.howto-title { font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.howto-btn { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); border-radius: 7px; padding: 2px 9px; font-size: 12px; font-weight: 500; }
.howto ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.howto li { font-size: 13.5px; color: var(--text-2); }
.howto li b { color: var(--text-1); font-weight: 600; }
