:root {
  /* 모카 크림 팔레트 (시안 A) */
  --bg: #f7f1e8;
  --card: #fffaf2;
  --ink: #2e211a;
  --ink-2: #4f4035;
  --muted: #735f4e;      /* 시안 #8a7868 → 크림 위 4.5:1 이상이 되도록 어둡게 */
  --line: #e4d8c8;
  --hd: #3a2a21;         /* 헤더 · 탭 · 주 버튼(에스프레소) */
  --hd-ink: #f7f1e8;
  --hd-mute: #cdbba8;
  --accent: #a9713f;     /* 밑줄 · 테두리 · 포커스 링 */
  --accent-text: #8c5a2e;/* 글자용 강조색 (대비 4.5:1 이상) */
  --accent-light: #e3c39b;/* 어두운 배경 위 강조색 */
  --accent-soft: #efe2d0;
  --chip: #f2e8da;
  --col: 640px;
  --r: 14px;
  --title-font: 'Jua', -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --focus: 0 0 0 3px rgba(169, 113, 63, .6);
  --focus-dark: 0 0 0 3px rgba(227, 195, 155, .85);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
body.detail-open { overflow: hidden; }
button { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.col { max-width: var(--col); margin: 0 auto; }

/* 제목 글꼴(주아체): 제목 · 버튼 · 탭 · 가게 이름 · 메뉴 이름 · 섹션 제목 */
.top h1, .tab, .row-name, .d-head h1, .d-bar-title, .d-sec h2, .menu-name, .btn, .btn-ghost, .state strong {
  font-family: var(--title-font); font-weight: 400;
}

/* ── 헤더 · 검색 ───────────────────────── */
.top {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .72) 0%, rgba(0, 0, 0, .45) 55%, rgba(0, 0, 0, .15) 100%),
    url('/img/hero.jpg') center / cover,
    var(--hd);
  color: var(--hd-ink);
  padding: calc(26px + env(safe-area-inset-top)) 18px 18px;
}
.home-link {
  display: inline-flex; align-items: center; min-height: 44px; margin: -12px 0 2px -8px; padding: 0 8px;
  border-radius: 10px; color: var(--hd-ink); font-size: 14px; text-decoration: none;
}
.home-link:focus-visible { box-shadow: var(--focus-dark); }
.eyebrow { margin: 0; font-size: 11px; letter-spacing: .22em; color: var(--accent-light); }
.top h1 { margin: 6px 0 4px; font-size: 27px; line-height: 1.2; text-shadow: 0 1px 8px rgba(0, 0, 0, .35); }
.sub { margin: 0 0 16px; font-size: 13px; color: var(--hd-mute); }
.search { position: relative; }
.search input {
  width: 100%; height: 46px; border: 0; border-radius: var(--r);
  background: rgba(255, 255, 255, .94); color: var(--ink);
  font: inherit; font-size: 16px; padding: 0 46px 0 42px;
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: #776a5d; }
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus-visible { box-shadow: var(--focus-dark); }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 15px; opacity: .6; pointer-events: none; }
.search-clear {
  position: absolute; right: 1px; top: 1px; width: 44px; height: 44px;
  border: 0; background: transparent; color: var(--muted); font-size: 15px; cursor: pointer; border-radius: 10px;
}

/* ── 탭 ────────────────────────────────── */
.tabs { position: sticky; top: 0; z-index: 5; background: var(--hd); padding: 0 16px; }
.tabs-inner { display: grid; grid-template-columns: 1fr 1fr; }
.tab {
  appearance: none; border: 0; background: transparent; color: var(--hd-mute);
  font-size: 17px; min-height: 48px; cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab.is-on { color: var(--hd-ink); border-bottom-color: var(--accent); }
.tab:focus-visible { box-shadow: inset var(--focus-dark); }

/* ── 카테고리 그리드 ───────────────────── */
.main { padding: 0 0 40px; }
.cats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 4px;
  padding: 16px 12px 6px;
}
.cat {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 4px 0 8px; min-height: 44px; border-radius: var(--r);
}
.cat-tile {
  position: relative; overflow: hidden;
  width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center;
  font-size: 28px; background: var(--tint, var(--chip)); border: 1px solid var(--line);
  transition: transform .15s ease, box-shadow .15s ease;
}
.cat-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cat-label { font-size: 13px; color: var(--muted); line-height: 1.2; white-space: nowrap; }
.cat.is-on .cat-tile { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.cat.is-on .cat-label { color: var(--ink); font-weight: 600; }
.cat:active .cat-tile { transform: scale(.95); }

/* ── 필터 칩 ───────────────────────────── */
.filters { display: flex; gap: 8px; padding: 12px 16px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.fchip {
  flex: none; display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  font-size: 14px; font-weight: 600; color: var(--muted);
}
.fchip.is-fixed { background: var(--ink); border-color: var(--ink); color: var(--bg); }
button.fchip { cursor: pointer; position: relative; }
button.fchip::after { content: ""; position: absolute; inset: -5px 0; } /* 터치 영역 44px */
button.fchip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
button.fchip[aria-pressed="true"]::before { content: "✓ "; white-space: pre; }

/* ── 가게 목록 ─────────────────────────── */
.list { background: var(--card); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.list:empty { display: none; }
.row {
  display: flex; gap: 12px; padding: 14px 16px; text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--line); position: relative;
}
.row:last-child { border-bottom: 0; }
.row:active { background: #f3ebdf; }
.row:focus-visible { box-shadow: inset var(--focus); }
.row.is-closed .thumb { opacity: .7; }
.thumb {
  flex: none; position: relative; width: 76px; height: 76px; border-radius: var(--r); overflow: hidden;
  background: var(--tint, var(--chip)); display: grid; place-items: center; font-size: 34px;
}
.thumb img, .hero img, .m-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.row-body { min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.row-name { font-size: 19px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-dist { font-size: 13px; color: var(--muted); }
.row-menu { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { margin-top: 2px; font-size: 13px; color: var(--muted); }
/* 영업 상태: 배지 없이 글자색만 — 영업 중은 강조색, 준비 중은 흐린 글자 */
.status { font-size: inherit; }
.status.open { color: var(--accent-text); font-weight: 600; }
.status.closed { color: var(--muted); }
.row-meta > * + *::before, .d-status > * + *::before { content: "·"; margin: 0 5px; color: var(--muted); }

/* 그룹별 색 (사진이 없을 때 이모지 타일 바탕) */
.tint-all { --tint: #efe2d0; }
.tint-chicken { --tint: #f6e2c8; }
.tint-korean { --tint: #f1dfcf; }
.tint-chinese { --tint: #f3d8cc; }
.tint-pizza { --tint: #f3e3c4; }
.tint-japanese { --tint: #e3e6d8; }
.tint-snack { --tint: #f3dcd4; }
.tint-cafe { --tint: #eadccb; }
.tint-night { --tint: #ede0c2; }
.tint-etc { --tint: #ebe2d6; }

/* ── 빈 화면 · 로딩 · 오류 ─────────────── */
.state { text-align: center; padding: 56px 24px; color: var(--muted); }
.state-icon { font-size: 40px; display: block; margin-bottom: 8px; }
.state strong { display: block; color: var(--ink); font-size: 18px; margin-bottom: 4px; }
.state p { margin: 0; font-size: 14px; }
.state .btn-ghost { margin-top: 16px; }
.btn-ghost {
  appearance: none; border: 1px solid var(--line); background: var(--card); border-radius: var(--r);
  min-height: 44px; padding: 0 18px; font-size: 16px; cursor: pointer;
}
.skel { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.skel i { display: block; background: #efe5d8; border-radius: 8px; }
.skel .s-thumb { width: 76px; height: 76px; border-radius: var(--r); flex: none; }
.skel .s-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.skel .s-lines i { height: 12px; }
.skel .s-lines i:nth-child(1) { width: 45%; height: 15px; }
.skel .s-lines i:nth-child(2) { width: 30%; }
.skel .s-lines i:nth-child(3) { width: 75%; }
@keyframes pulse { 50% { opacity: .5; } }
.skel i { animation: pulse 1.2s ease-in-out infinite; }

/* ── 상세 화면 ─────────────────────────── */
.detail {
  position: fixed; inset: 0; z-index: 20; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--bg); overscroll-behavior: contain;
  animation: slide-in .22s ease-out;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.d-bar {
  position: sticky; top: 0; z-index: 2; background: rgba(247, 241, 232, .94);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  padding-top: env(safe-area-inset-top); border-bottom: 1px solid var(--line);
}
.d-bar-inner { display: flex; align-items: center; gap: 4px; height: 52px; padding: 0 6px; }
.back {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  width: 44px; height: 44px; border-radius: 12px; font-size: 22px; display: grid; place-items: center;
}
.d-bar-title { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.hero {
  position: relative; aspect-ratio: 16 / 10; max-height: 360px; width: 100%;
  background: var(--tint, var(--chip)); display: grid; place-items: center; font-size: 72px; overflow: hidden;
}
.hero.is-empty { aspect-ratio: auto; height: 168px; font-size: 64px; }
.d-head { background: var(--card); padding: 16px 20px 18px; border-bottom: 1px solid var(--line); }
.d-head h1 { margin: 0; font-size: 26px; line-height: 1.25; }
.d-sub { margin: 4px 0 8px; font-size: 14px; color: var(--muted); }
.d-status { font-size: 14px; color: var(--muted); }
.tip {
  margin: 12px 16px 0; padding: 12px 14px; border-radius: var(--r);
  background: var(--accent-soft); border: 1px solid var(--line); color: var(--ink); font-size: 15px;
}
.tip b { color: var(--accent-text); font-weight: 600; }
.d-sec { background: var(--card); margin-top: 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 20px; }
.d-sec h2 { margin: 14px 0 6px; font-size: 19px; }
.info { margin: 0; }
.info-row { display: grid; grid-template-columns: 76px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.info-row:last-child { border-bottom: 0; }
.info dt { color: var(--muted); }
.info dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.info a { color: inherit; }
.today { font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.note { white-space: pre-line; }
.memo { margin: 6px 0 0; color: var(--ink-2); white-space: pre-line; font-size: 14px; }
.week summary {
  cursor: pointer; color: var(--accent-text); font-size: 14px; font-weight: 600;
  min-height: 32px; display: inline-flex; align-items: center; list-style: none;
}
.week summary::-webkit-details-marker { display: none; }
.week summary::after { content: " ▾"; white-space: pre; }
.week[open] summary::after { content: " ▴"; }
.week ul { list-style: none; margin: 4px 0 0; padding: 0; font-size: 14px; }
.week li { display: flex; gap: 14px; padding: 3px 0; color: var(--ink-2); }
.week li span:first-child { width: 20px; color: var(--muted); }
.week li.is-today { color: var(--ink); font-weight: 700; }
.week li.is-today span:first-child { color: var(--accent-text); }
.menus { list-style: none; margin: 0; padding: 0; }
.menu { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.menu:last-child { border-bottom: 0; }
.menu-txt { flex: 1; min-width: 0; }
.menu-name { font-size: 17px; overflow-wrap: anywhere; }
.menu-price { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.menu-price.ask { color: var(--muted); }
.m-thumb { position: relative; flex: none; width: 56px; height: 56px; border-radius: var(--r); overflow: hidden; background: var(--chip); }

/* 하단 고정 버튼 */
.d-actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.d-actions-inner { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.d-actions-inner.map-only { grid-template-columns: 1fr; }
.no-phone { margin: 0 0 8px; text-align: center; font-size: 13px; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 52px; padding: 0 18px; border-radius: var(--r);
  font-size: 18px; text-decoration: none;
}
.btn.call { background: var(--hd); color: var(--hd-ink); }
.btn.call:active { background: #2a1e17; }
.btn.map { background: var(--card); color: var(--ink); border: 1px solid var(--line); }

@media (min-width: 641px) {
  .list { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
  .list { border-radius: 0 0 16px 16px; }
  .d-page, .d-bar-inner, .d-actions-inner, .no-phone { max-width: var(--col); margin-left: auto; margin-right: auto; }
  .d-page { background: var(--bg); }
  .hero { border-radius: 0 0 16px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 안내 팝업 (인트로 z-index 100 아래) */
.notice {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px;
  background: rgba(46, 33, 26, .55);
}
.notice-box {
  width: 100%; max-width: 340px; padding: 24px 20px 20px; border-radius: var(--r);
  background: var(--card); text-align: center; box-shadow: 0 12px 40px rgba(46, 33, 26, .3);
}
.notice-box h2 { margin: 0 0 12px; font-family: var(--title-font); font-weight: 400; font-size: 21px; }
.notice-box p { margin: 0 0 10px; color: var(--ink-2); font-size: 15px; line-height: 1.55; word-break: keep-all; }
.notice-box .btn { width: 100%; margin-top: 14px; border: 0; cursor: pointer; }
