:root {
  --text: #191f28;
  --gray: #8b95a1;
  --gray-2: #4e5968;
  --line: #e5e8eb;
  --bg-soft: #f2f4f6;
  --bg: #ffffff;
  --green: #2b8a5a;
  --blue: #3182f6;
  --radius: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  word-break: keep-all;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

/* ---------- 위쪽 ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  padding: 12px 16px 10px;
}
.brand { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px; }
.search {
  display: flex; align-items: center; gap: 8px;
  height: 46px; padding: 0 14px;
  background: var(--bg-soft);
  border-radius: 14px;
}
.search svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--gray); stroke-width: 2; stroke-linecap: round; }
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-size: 15px;
}
.search input::placeholder { color: var(--gray); }
.search input::-webkit-search-cancel-button { display: none; }

/* ---------- 카테고리 칸 ---------- */
.cats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  padding: 6px 16px 4px;
}
.cats.four { grid-template-columns: repeat(4, 1fr); }
.cat {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 76px; padding: 10px 4px;
  border: 0; border-radius: var(--radius);
  background: var(--bg-soft);
  font-size: 14px; font-weight: 500; color: var(--gray-2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cat .ico { font-size: 24px; line-height: 1; }
.cat.on { background: var(--text); color: #fff; font-weight: 700; }

/* ---------- 본문 ---------- */
.main { padding: 18px 16px 0; }
.banner {
  margin: 0 0 14px; padding: 10px 12px;
  background: var(--bg-soft); border-radius: 12px;
  font-size: 13px; color: var(--gray-2);
}
.title { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.35; }
.sub { margin: 4px 0 0; font-size: 14px; color: var(--gray); }
.link-btn {
  border: 0; background: none; padding: 0; margin-left: 2px;
  color: var(--blue); font-size: 14px; cursor: pointer;
}

.region { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.region select, .region input {
  flex: 1 1 140px; min-width: 0; height: 46px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
  font-size: 15px;
}
.region button {
  flex: 1 1 100%; height: 46px; padding: 0 18px;
  border: 0; border-radius: 12px; background: var(--blue); color: #fff; font-weight: 700;
}

/* ---------- 목록 (토스식 번호 줄) ---------- */
.list { list-style: none; margin: 14px 0 0; padding: 0; }
.row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--bg-soft);
}
.row:last-child { border-bottom: 0; }
.rank {
  flex: none; width: 22px; padding-top: 1px;
  font-size: 18px; font-weight: 800; color: var(--text); text-align: center;
}
.body { flex: 1; min-width: 0; }
.name { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.tag {
  display: inline-block; vertical-align: 2px; margin-left: 4px; padding: 0 6px;
  border-radius: 6px; background: var(--bg-soft);
  font-size: 12px; font-weight: 500; color: var(--gray-2);
}
.status { margin: 3px 0 0; font-size: 14px; display: flex; flex-wrap: wrap; gap: 0 8px; }
.open { color: var(--green); font-weight: 700; }
.muted { color: var(--gray-2); font-weight: 700; }
.dist { color: var(--text); font-weight: 500; }
.addr { margin: 2px 0 0; font-size: 13px; color: var(--gray); overflow-wrap: anywhere; }
.links { margin: 4px 0 0; font-size: 13px; }
.links a { color: var(--blue); text-decoration: none; }
.links .dot { color: var(--gray); margin: 0 6px; }
.call {
  flex: none; align-self: center;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 64px; height: 44px; padding: 0 14px;
  border-radius: 12px; background: var(--blue); color: #fff;
  font-size: 15px; font-weight: 700; text-decoration: none;
}
.loading { padding: 24px 0; color: var(--gray); font-size: 15px; }

.empty { margin: 16px 0 0; font-size: 15px; color: var(--gray-2); }
.more {
  display: block; width: 100%; height: 48px; margin-top: 8px;
  border: 0; border-radius: 12px; background: var(--bg-soft);
  font-size: 15px; font-weight: 500; color: var(--gray-2); cursor: pointer;
}
.note { margin: 16px 0 24px; font-size: 13px; color: var(--gray); }

/* ---------- 아래 탭 ---------- */
.tabbar {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  z-index: 10;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 0;
  font-size: 11px; color: var(--gray); text-decoration: none;
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.tab.on { color: var(--text); font-weight: 700; }

@media (max-width: 360px) {
  .title { font-size: 22px; }
  .cat { font-size: 13px; }
  .call { min-width: 56px; padding: 0 10px; }
}

/* ---------- 광고 자리 ---------- */
/* ads.js가 <html>에 ads-on을 붙일 때만 보여요. 높이를 미리 잡아 둬서 광고가 들어와도 화면이 밀리지 않아요. */
.ad-slot { display: none; }
.ads-on .ad-slot:not([hidden]) {
  display: block;
  margin: 24px 0;            /* 버튼과 최소 24px 띄우기 */
  min-height: 280px;
  position: relative;
}
.ad-label { display: block; font-size: 11px; color: var(--gray); margin-bottom: 4px; }
.ads-preview .ad-slot:not([hidden]) {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 10px 12px;
}
.ads-preview .ad-slot:not([hidden])::after {
  content: '광고 자리 (' attr(data-slot) ')';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--gray);
}
.more + .ad-slot { margin-top: 24px; }

/* ---------- 알아두면 좋은 것 ---------- */
.guides { margin: 8px 0 24px; padding-top: 20px; border-top: 8px solid var(--bg-soft); }
.guides h2 { margin: 0 0 6px; font-size: 18px; font-weight: 800; }
.guide-link {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--bg-soft);
  color: var(--text); text-decoration: none; font-size: 15px;
}
.guide-link:last-child { border-bottom: 0; }
.guide-link .chev { color: var(--gray); font-size: 20px; line-height: 1; }

/* ---------- 안내 글 페이지 ---------- */
.page-top {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  padding: 12px 16px; display: flex; align-items: center; gap: 8px;
}
.back { color: var(--blue); text-decoration: none; font-size: 15px; }
.article { padding: 8px 16px 0; }
.article h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.35; }
.article .lead { margin: 6px 0 20px; font-size: 14px; color: var(--gray); }
.article h2 { margin: 28px 0 8px; font-size: 18px; font-weight: 800; }
.article p { margin: 0 0 10px; font-size: 16px; line-height: 1.7; }
.article ul { margin: 0 0 10px; padding-left: 20px; }
.article li { margin: 0 0 6px; line-height: 1.6; }
.article a { color: var(--blue); text-decoration: none; }
.callout { margin: 20px 0; padding: 14px 16px; background: var(--bg-soft); border-radius: 12px; font-size: 15px; }
.callout strong { font-weight: 800; }
.article .src { margin-top: 24px; font-size: 13px; color: var(--gray); }
.article .guide-link { color: var(--text); }

.site-foot { margin: 8px 0 24px; font-size: 13px; color: var(--gray); }
.site-foot a { color: var(--gray); text-decoration: underline; }
