:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1c1b19;
  --muted: #5f5c55;
  --border: #e3e0d8;
  --accent: #c2410c;
  --accent-soft: #fbe5d8;
  --track: #e7e4dc;
  --bar-region: #8a8578;
  --bar-seoul: #c9c4b8;
  --warn: #9a3412;
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161514;
    --surface: #201f1d;
    --text: #f0eee9;
    --muted: #a9a59c;
    --border: #34322e;
    --accent: #fb8a4c;
    --accent-soft: #3d2416;
    --track: #3a3834;
    --bar-region: #9b968a;
    --bar-seoul: #5c5952;
    --warn: #fdba74;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #161514;
  --surface: #201f1d;
  --text: #f0eee9;
  --muted: #a9a59c;
  --border: #34322e;
  --accent: #fb8a4c;
  --accent-soft: #3d2416;
  --track: #3a3834;
  --bar-region: #9b968a;
  --bar-seoul: #5c5952;
  --warn: #fdba74;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

.site-header { padding: 40px 0 24px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.02em; }
h1 { margin: 0 0 10px; font-size: clamp(1.5rem, 3.6vw, 2.1rem); line-height: 1.25; letter-spacing: -0.02em; }
.lede { margin: 0; max-width: 46em; color: var(--muted); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.panel h2 { margin: 0 0 16px; font-size: 1.05rem; }

.result { position: sticky; top: 16px; }

.field { margin-bottom: 18px; }
.field label, .field .label {
  display: flex; justify-content: space-between; gap: 12px;
  font-weight: 600; font-size: 0.95rem; margin-bottom: 6px;
}
.field output { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 700; white-space: nowrap; }
.hint { margin: 4px 0 0; font-size: 0.8rem; color: var(--muted); }

.region-field { padding-bottom: 18px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }

select {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

input[type="range"] {
  width: 100%;
  margin: 4px 0 0;
  accent-color: var(--accent);
  height: 28px;
  background: transparent;
}

.group-title { margin: 22px 0 10px; font-size: 0.8rem; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; }

.constraint {
  margin: 0 0 16px; padding: 10px 12px;
  border-radius: 10px; background: var(--accent-soft); color: var(--warn); font-size: 0.85rem;
}

.btn {
  font: inherit; font-weight: 600; font-size: 0.9rem;
  padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: default; }

.pred { display: flex; align-items: baseline; gap: 6px; }
.pred-value { font-size: clamp(3rem, 9vw, 4.2rem); font-weight: 800; letter-spacing: -0.03em; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1; }
.pred-unit { font-size: 1.3rem; font-weight: 700; color: var(--muted); }
.pred-caption { margin: 8px 0 22px; color: var(--muted); font-size: 0.88rem; }

.compare { display: grid; gap: 12px; margin-bottom: 20px; }
.bar-row { display: grid; grid-template-columns: 7.5em 1fr 4em; gap: 10px; align-items: center; font-size: 0.85rem; }
.bar-row .name { color: var(--muted); }
.bar-row .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.bar-track { height: 12px; background: var(--track); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; transition: width 0.2s ease; }
.bar-fill.pred { background: var(--accent); }
.bar-fill.region { background: var(--bar-region); }
.bar-fill.seoul { background: var(--bar-seoul); }

.about { border-top: 1px solid var(--border); padding-top: 14px; font-size: 0.85rem; color: var(--muted); }
.about summary { cursor: pointer; font-weight: 600; color: var(--text); }
.about dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 12px 0 0; }
.about dt { font-weight: 600; }
.about dd { margin: 0; }

.site-footer { padding: 28px 16px 40px; color: var(--muted); font-size: 0.82rem; }
.site-footer p { margin: 0; max-width: 60em; }

.error { color: var(--warn); }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .result { position: static; order: -1; }
  .site-header { padding: 28px 0 18px; }
}
