:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f8fafc;
  --card: #fff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(0,0,0,.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
}
.logo { font-weight: 800; font-size: 1.15rem; color: var(--primary); }
.logo span { color: var(--text); }
.container { max-width: 960px; margin: 0 auto; padding: 20px 16px 40px; }
.hero { text-align: center; padding: 28px 0 20px; }
.hero h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 8px; }
.hero p { color: var(--muted); font-size: .95rem; }
.stats {
  display: flex; justify-content: center; gap: 24px; margin: 20px 0 28px; flex-wrap: wrap;
}
.stat { text-align: center; }
.stat .num { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.stat .label { font-size: .8rem; color: var(--muted); }
.section-title { font-size: 1.05rem; font-weight: 700; margin: 24px 0 12px; }
.region-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px;
}
.region-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 12px; text-align: center; transition: all .15s; box-shadow: var(--shadow);
}
.region-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.region-card .name { font-weight: 700; font-size: .95rem; }
.region-card .cnt { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.footer {
  text-align: center; padding: 24px 16px; font-size: .8rem; color: var(--muted);
  border-top: 1px solid var(--border); margin-top: 40px;
}
/* Map page */
.map-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(255,255,255,.95); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px; display: flex; align-items: center; gap: 10px;
}
.map-header .back { font-size: 1.2rem; padding: 4px 8px; }
.map-header .title { font-weight: 700; flex: 1; }
#map { position: fixed; top: 52px; left: 0; right: 0; bottom: 56px; }
.filter-bar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 56px;
  background: var(--card); border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; padding: 0 12px; overflow-x: auto; z-index: 50;
}
.filter-chip {
  flex-shrink: 0; border: 1px solid var(--border); background: #fff;
  border-radius: 20px; padding: 6px 14px; font-size: .8rem; font-weight: 500; cursor: pointer;
}
.filter-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.count-badge {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  background: #fff; border-radius: 20px; padding: 5px 12px; font-size: .8rem;
  font-weight: 600; box-shadow: var(--shadow); z-index: 50;
}
.my-loc {
  position: fixed; right: 14px; bottom: 72px; width: 42px; height: 42px;
  border-radius: 50%; background: #fff; border: 1px solid var(--border);
  box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 60; font-size: 1.1rem;
}
.info-card {
  position: fixed; left: 0; right: 0; bottom: 56px;
  background: #fff; border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,.12); z-index: 200;
  transform: translateY(110%); transition: transform .28s cubic-bezier(.32,.72,0,1);
  max-height: 55dvh; overflow-y: auto; padding: 16px 18px 24px;
}
.info-card.open { transform: translateY(0); }
.info-card .handle { width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 12px; }
.info-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; padding-right: 28px; }
.info-card .addr { font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.badge {
  font-size: .72rem; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: #f1f5f9;
}
.badge.open { background: #dcfce7; color: #166534; }
.badge.disabled { background: #dbeafe; color: #1e40af; }
.badge.diaper { background: #fce7f3; color: #9d174d; }
.info-row { display: flex; justify-content: space-between; font-size: .85rem; padding: 5px 0; border-bottom: 1px solid var(--border); }
.info-row .label { color: var(--muted); }
.close-btn { position: absolute; top: 12px; right: 14px; border: none; background: none; font-size: 1.3rem; color: var(--muted); cursor: pointer; }
.loading {
  position: fixed; inset: 0; background: rgba(255,255,255,.75);
  display: flex; align-items: center; justify-content: center; z-index: 200; font-weight: 600; color: var(--primary);
}
@media (min-width: 768px) {
  .info-card { left: auto; right: 16px; bottom: 72px; width: 360px; border-radius: var(--radius); max-height: 70vh; }
}

.seo-block {
  max-width: 960px; margin: 0 auto; padding: 24px 16px 48px;
  font-size: .92rem; color: var(--muted); line-height: 1.75;
}
.seo-block h2 { font-size: 1.15rem; color: var(--text); margin: 28px 0 10px; }
.seo-block h3 { font-size: 1rem; color: var(--text); margin: 20px 0 8px; }
.seo-block p { margin-bottom: 12px; }
.seo-block ul { padding-left: 18px; margin-bottom: 12px; }
.seo-block a { color: var(--primary); text-decoration: underline; }
.links-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.links-row a {
  background: #fff; border: 1px solid var(--border); border-radius: 20px;
  padding: 6px 12px; font-size: .8rem; text-decoration: none; color: var(--text);
}
.links-row a:hover { border-color: var(--primary); color: var(--primary); }
/* region page: map on top + scrollable SEO below */
body.region-page { overflow: auto; height: auto; min-height: 100dvh; }
body.region-page #map {
  position: relative; top: 0; height: 58vh; min-height: 300px;
  bottom: auto; width: 100%;
}
body.region-page .map-header { position: sticky; top: 0; z-index: 120; }
body.region-page .filter-bar {
  position: relative; bottom: auto; top: auto;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}
body.region-page .count-badge { top: 60px; z-index: 60; }
body.region-page .my-loc {
  position: absolute;
  right: 14px;
  top: calc(58vh - 56px);
  bottom: auto;
  z-index: 60;
}
body.region-page .info-card {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 200;
  max-height: 70dvh;
}
body.region-page .loading { position: fixed; z-index: 300; }
@media (min-width: 768px) {
  body.region-page .info-card {
    left: auto; right: 16px;
    bottom: 24px;
    width: 360px;
    max-height: 75vh;
    border-radius: var(--radius);
  }
}
