:root {
  --bg: #f2f5fb;
  --bg-soft: #ffffff;
  --text: #131722;
  --text-dim: #626b7e;
  --line: rgba(19, 23, 34, 0.1);
  --accent: #1a7fe8;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --bg-soft: #141a2e;
    --text: #f2f5ff;
    --text-dim: #8a93a6;
    --line: rgba(255, 255, 255, 0.08);
    --accent: #3b9dff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Segoe UI',
    'Noto Sans KR', sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.7;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.top a.home {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.top a.home span { color: var(--accent); }

.top a.back {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 28px 0 6px;
}

.lede {
  margin: 0 0 26px;
  color: var(--text-dim);
  font-size: 14px;
}

h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 32px 0 8px;
}

h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 20px 0 4px;
}

p, li { font-size: 15px; }

ul { padding-left: 20px; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 4px;
  font-size: 14px;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

th, td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  font-weight: 700;
  color: var(--text-dim);
  font-size: 13px;
}

.grade { font-weight: 700; }
.g1 { color: #3b9dff; }
.g2 { color: #2fbf71; }
.g3 { color: #f5a524; }
.g4 { color: #ef4444; }

.card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  margin: 16px 0;
}

footer {
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-dim);
}

footer a { color: var(--accent); }

a { color: var(--accent); }

/* 지역 페이지에서 앱으로 넘어가는 버튼 */
.cta {
  display: inline-block;
  padding: 13px 24px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  transition: filter 160ms ease;
}

.cta:hover {
  filter: brightness(1.08);
}

/* 측정소 이름이 길어 표가 넘칠 수 있으므로 작게 */
table td.names {
  white-space: normal;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}

table th {
  white-space: nowrap;
}

.region-links {
  line-height: 2.4;
}

.region-links a {
  white-space: nowrap;
}
