:root {
  --bg: #fffbeb;
  --card: #ffffff;
  --primary: #f59e0b;
  --primary-dark: #d97706;
  --text: #111827;
  --muted: #6b7280;
  --border: #f3f4f6;
  --tab-h: 56px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
}
button, a { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { text-decoration: none; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

#app { overflow: hidden; }
#app.scroll-page { overflow-y: auto; padding-bottom: calc(var(--tab-h) + 16px); }

.topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  padding: 12px 8px 8px;
  display: flex; gap: 6px; align-items: center;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.logo-card {
  background: var(--card); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  height: 40px; padding: 0 12px; display: flex; align-items: center; flex-shrink: 0;
}
.logo-card img { height: 24px; width: auto; }
.btn-pill {
  background: var(--card); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  height: 40px; padding: 0 10px; display: flex; align-items: center; gap: 4px;
  font-size: 14px; font-weight: 500; color: #374151; white-space: nowrap;
  transition: background .15s, transform .1s;
}
.btn-pill:hover { background: #f9fafb; }
.btn-pill:active { transform: scale(.96); }

.map-wrap { position: absolute; inset: 0; }
#map { width: 100%; height: 100%; }

.locate-btn {
  position: absolute; bottom: calc(var(--tab-h) + 96px); right: 16px; z-index: 20;
  width: 48px; height: 48px; border-radius: 9999px; background: var(--card);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  display: flex; align-items: center; justify-content: center;
  ring: 1px solid rgba(0,0,0,.05);
}
.locate-btn:active { transform: scale(.95); }

.list-panel {
  position: absolute; left: 0; right: 0; z-index: 15;
  bottom: var(--tab-h);
  max-height: 42dvh; overflow-y: auto;
  padding: 8px 8px 12px;
  -webkit-overflow-scrolling: touch;
}
.sauna-card {
  width: 100%; text-align: left;
  background: var(--card); border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  padding: 12px 14px; margin-bottom: 8px;
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--border);
  cursor: pointer;
}
.sauna-card:active { background: #fafafa; }
.sauna-head { display: flex; align-items: center; gap: 8px; }
.badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 9999px;
  background: #fef3c7; color: #92400e; flex-shrink: 0;
}
.badge.bath { background: #dbeafe; color: #1e40af; }
.badge.steam { background: #ede9fe; color: #5b21b6; }
.fav-mini {
  margin-left: auto; font-size: 12px; padding: 4px 10px; border-radius: 9999px;
  background: #fef2f2; color: #dc2626; font-weight: 600; flex-shrink: 0;
  border: none; cursor: pointer;
}
.fav-mini.on { background: #dc2626; color: #fff; }
.sauna-name { font-size: 15px; font-weight: 700; }
.sauna-addr { font-size: 12px; color: var(--muted); }
.sauna-meta { display: flex; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; margin-top: 2px; }
.sauna-meta .hot { color: #ea580c; font-weight: 600; }
.sauna-meta .star { color: #d97706; font-weight: 600; }
.load-more {
  width: 100%; padding: 12px; border-radius: 16px; background: var(--card);
  border: 1px solid var(--border); font-weight: 600; color: var(--primary-dark);
}

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: var(--card); border-top: 1px solid var(--border);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: var(--tab-h); color: #9ca3af; font-size: 10px; font-weight: 500;
  transition: color .15s;
}
.tabbar a .ico { font-size: 20px; line-height: 1; }
.tabbar a.active { color: var(--primary); }

.page { padding: 16px 16px calc(var(--tab-h) + 24px); max-width: 720px; margin: 0 auto; }
.page-back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 600; color: var(--muted); }
.page h1 { font-size: 20px; font-weight: 800; margin-bottom: 12px; }
.page h2 { font-size: 16px; font-weight: 700; margin: 16px 0 8px; }
.page .sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; line-height: 1.5; }

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  padding: 8px 14px; border-radius: 9999px; background: var(--card);
  border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: #374151;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.rank-card {
  display: flex; gap: 12px; align-items: center;
  background: var(--card); border-radius: 16px; border: 1px solid var(--border);
  padding: 14px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.rank-num { font-size: 18px; font-weight: 800; width: 32px; text-align: center; flex-shrink: 0; }
.rank-num.g1 { color: #f59e0b; } .rank-num.g2 { color: #9ca3af; } .rank-num.g3 { color: #b45309; }
.rank-body { flex: 1; min-width: 0; }
.rank-body .name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-body .addr { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-stat { font-size: 12px; color: var(--muted); flex-shrink: 0; font-weight: 600; }

.region-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.region-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px 14px; display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.05); font-weight: 700;
}
.region-card .count {
  background: #fef3c7; color: #92400e; font-size: 12px; font-weight: 700;
  padding: 2px 10px; border-radius: 9999px;
}

.empty {
  text-align: center; padding: 48px 24px; color: var(--muted);
}
.empty .emoji { font-size: 48px; margin-bottom: 12px; }

.modal-mask {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.4);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--card); width: 100%; max-width: 520px;
  border-radius: 20px 20px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  max-height: 80dvh; overflow-y: auto;
}
.modal h3 { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.modal .row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.modal .row a, .modal .row button {
  flex: 1; min-width: 120px; text-align: center; padding: 12px; border-radius: 12px;
  background: #f9fafb; border: 1px solid var(--border); font-weight: 600; font-size: 13px;
}
.modal .row a.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.modal .close { float: right; font-size: 20px; color: var(--muted); }

.filter-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--card); border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px) + var(--tab-h));
}
.search-sheet {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  background: var(--card); padding: 16px; box-shadow: 0 4px 20px rgba(0,0,0,.12);
}
.search-sheet input {
  width: 100%; height: 44px; border-radius: 12px; border: 1px solid #e5e7eb;
  padding: 0 14px; font-size: 15px; outline: none;
}
.search-sheet input:focus { border-color: var(--primary); }
.champ-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 14px; margin-bottom: 8px; display: flex; justify-content: space-between; gap: 8px;
}
.champ-card .crown { color: var(--primary); font-weight: 800; }
.profile-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 20px; text-align: center; margin-bottom: 16px;
}
.profile-card .big { font-size: 40px; margin-bottom: 8px; }
.stat-row { display: flex; gap: 8px; }
.stat-box {
  flex: 1; background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; text-align: center;
}
.stat-box .num { font-size: 20px; font-weight: 800; color: var(--primary-dark); }
.stat-box .lbl { font-size: 11px; color: var(--muted); margin-top: 2px; }
.loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg); z-index: 40; color: var(--muted); font-weight: 600;
}
