/* 50대 이상 사용자 기준: 큰 글씨, 높은 대비, 큰 터치 영역(최소 48px) */
:root {
  --fs: 18px;            /* 기본 글자 크기 (글씨 크게 모드에서 21px) */
  --brand: #0B7F7A;      /* 흰 배경 대비 4.9:1 이상 */
  --brand-soft: #E3F4F3;
  --ink: #111;
  --sub: #4A4A4A;
  --line: #E4E4E4;
  --bg: #F6F6F6;
  --card: #fff;
  --accent: #D9480F;
  --radius: 16px;
}
html.big { --fs: 21px; }

[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-size: var(--fs); color: var(--ink); background: #DADADA; line-height: 1.45;
  word-break: keep-all;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

#app {
  max-width: 480px; min-height: 100%; margin: 0 auto; background: var(--bg);
  position: relative; padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

/* 상단바 */
#topbar {
  position: sticky; top: 0; z-index: 20; background: #fff;
  display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
#topbar .back { width: 48px; height: 48px; font-size: 1.5em; border-radius: 12px; }
#topbar .title { flex: 1; font-weight: 800; font-size: 1.15em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#topbar .addr { flex: 1; font-weight: 800; font-size: 1.1em; }
#topbar .addr small { display: block; font-size: .7em; color: var(--sub); font-weight: 500; }
.fontbtn {
  min-width: 64px; height: 44px; padding: 0 10px; border-radius: 22px;
  border: 2px solid var(--brand); color: var(--brand); font-weight: 800; font-size: .8em;
}
html.big .fontbtn { background: var(--brand); color: #fff; }

/* 공통 */
.section { background: #fff; padding: 20px 16px; margin-bottom: 10px; }
.section h2 { margin: 0 0 14px; font-size: 1.2em; }
.muted { color: var(--sub); }
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  min-height: 60px; border-radius: 14px; font-weight: 800; font-size: 1.1em;
  background: var(--brand); color: #fff;
}
.btn:disabled { background: #B9B9B9; }
.btn.ghost { background: #fff; color: var(--brand); border: 2px solid var(--brand); }

/* 검색 */
.search {
  display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 16px;
  border: 2px solid var(--brand); border-radius: 30px; background: #fff;
}
.search input { flex: 1; border: 0; outline: 0; font: inherit; min-width: 0; background: none; }

/* 3열 그리드 (카테고리 · 메뉴 공통) */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.cat {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  aspect-ratio: 1; background: var(--brand-soft); border-radius: var(--radius); font-weight: 700;
}
.cat .e { font-size: 2.2em; line-height: 1; }

/* 가게 카드 */
.store {
  display: flex; gap: 14px; align-items: center; padding: 14px; background: #fff;
  border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 10px;
}
.store .thumb {
  width: 84px; height: 84px; border-radius: 14px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 2.6em;
}
.store .name { font-weight: 800; font-size: 1.1em; }
.store .meta { color: var(--sub); font-size: .9em; margin-top: 2px; }
.star { color: #E8A100; font-weight: 800; }
.free { color: var(--brand); font-weight: 800; }

/* 가게 상세 헤더 */
.store-head { background: #fff; padding: 18px 16px; margin-bottom: 0; }
.store-head h1 { margin: 0 0 8px; font-size: 1.4em; }
.infogrid { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .95em; }
.infogrid dt { color: var(--sub); }
.infogrid dd { margin: 0; font-weight: 700; }

/* 메뉴 그룹 탭 */
.chips {
  position: sticky; top: 64px; z-index: 10; display: flex; gap: 8px; overflow-x: auto;
  padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line); scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 48px; padding: 0 18px; border-radius: 24px;
  border: 2px solid var(--line); font-weight: 700; white-space: nowrap; background: #fff;
}
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.group { padding: 18px 12px 8px; background: #fff; margin-bottom: 10px; scroll-margin-top: 140px; }
.group h3 { margin: 0 4px 12px; font-size: 1.15em; }

/* 메뉴 카드 (3열) */
.menu {
  display: flex; flex-direction: column; text-align: left; background: #fff;
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden; position: relative;
}
.menu .img {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center; position: relative;
}
.menu .img .e { font-size: 2.6em; line-height: 1; }
.menu .rank {
  position: absolute; top: 6px; left: 6px; background: var(--accent); color: #fff;
  font-size: .62em; font-weight: 800; padding: 2px 7px; border-radius: 8px;
}
.menu .qty-badge {
  position: absolute; top: 6px; right: 6px; min-width: 26px; height: 26px; border-radius: 13px;
  background: var(--brand); color: #fff; font-size: .7em; font-weight: 800;
  display: flex; align-items: center; justify-content: center; padding: 0 6px;
}
.menu .body { padding: 8px 8px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.menu .mname {
  font-weight: 700; font-size: .82em; line-height: 1.3; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em;
}
.menu .mprice { font-weight: 800; font-size: .9em; margin-top: auto; }

/* 하단 장바구니 바 */
#cartbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom));
  width: calc(min(480px, 100%) - 24px); z-index: 30;
}
#cartbar a {
  display: flex; align-items: center; justify-content: space-between; min-height: 64px; padding: 0 20px;
  background: var(--brand); color: #fff; border-radius: 16px; font-weight: 800; font-size: 1.05em;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
#cartbar .n { background: #fff; color: var(--brand); border-radius: 14px; padding: 1px 10px; margin-right: 8px; }

/* 하단 탭 */
#tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(480px, 100%);
  display: grid; grid-template-columns: repeat(3, 1fr); background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 40;
}
#tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: 72px; font-size: .85em; font-weight: 700; color: var(--sub); position: relative;
}
#tabbar a .ti { font-size: 1.5em; line-height: 1; filter: grayscale(1); opacity: .7; }
#tabbar a.on { color: var(--brand); }
#tabbar a.on .ti { filter: none; opacity: 1; }
#cartcount {
  position: absolute; top: 8px; left: calc(50% + 8px); background: var(--accent); color: #fff;
  font-size: .75em; min-width: 22px; height: 22px; border-radius: 11px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
}

/* 수량 조절 */
.stepper { display: inline-flex; align-items: center; border: 2px solid var(--line); border-radius: 14px; }
.stepper button { width: 52px; height: 52px; font-size: 1.4em; font-weight: 800; }
.stepper span { min-width: 40px; text-align: center; font-weight: 800; font-size: 1.1em; }

/* 장바구니 */
.cart-item { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.cart-item:last-child { border-bottom: 0; }
.cart-item .e {
  width: 64px; height: 64px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 2em;
}
.cart-item .info { flex: 1; min-width: 0; }
.cart-item .row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.del { color: var(--sub); font-size: .85em; text-decoration: underline; min-height: 44px; padding: 0 4px; }
.sum { display: grid; grid-template-columns: 1fr auto; gap: 8px 0; }
.sum .total { font-weight: 800; font-size: 1.2em; padding-top: 10px; border-top: 2px solid var(--ink); }
.empty { text-align: center; padding: 60px 20px; }
.empty .e { font-size: 4em; }

/* 주문하기 선택 버튼 */
.opts { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 0 16px;
  border: 2px solid var(--line); border-radius: 14px; text-align: left; font-weight: 700; background: #fff;
}
.opt::before {
  content: ''; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #999; flex: none;
}
.opt.on { border-color: var(--brand); background: var(--brand-soft); }
.opt.on::before { border: 7px solid var(--brand); }
.field { width: 100%; min-height: 56px; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; font: inherit; }
.field:focus { outline: 0; border-color: var(--brand); }

/* 주문 상태 */
.steps { display: grid; gap: 0; }
.step { display: flex; gap: 14px; align-items: center; padding: 12px 0; color: #9A9A9A; font-weight: 700; }
.step .dot {
  width: 40px; height: 40px; border-radius: 50%; background: #EEE; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 1.1em;
}
.step.done { color: var(--ink); }
.step.done .dot { background: var(--brand); color: #fff; }
.step.now .dot { box-shadow: 0 0 0 5px var(--brand-soft); }

.order-card { background: #fff; border-radius: var(--radius); border: 1px solid var(--line); padding: 16px; margin-bottom: 12px; }
.order-card .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.badge { font-size: .8em; font-weight: 800; padding: 3px 10px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }

/* 바텀시트 (메뉴 담기) */
#sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; }
#sheet {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: min(480px, 100%); z-index: 60;
  background: #fff; border-radius: 24px 24px 0 0; padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
  max-height: 90vh; overflow-y: auto;
}
#sheet .grab { width: 48px; height: 5px; border-radius: 3px; background: #CCC; margin: 0 auto 14px; }
#sheet .hero {
  height: 180px; border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 5em;
}
#sheet h2 { margin: 16px 0 4px; font-size: 1.35em; }
#sheet .price { font-size: 1.3em; font-weight: 800; margin: 8px 0 16px; }
#sheet .qrow { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
#sheet .close { position: absolute; top: 14px; right: 14px; width: 48px; height: 48px; font-size: 1.5em; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 170px; z-index: 80;
  background: rgba(17,17,17,.92); color: #fff; padding: 14px 22px; border-radius: 14px; font-weight: 700;
  max-width: 90%; text-align: center;
}

.notice { background: #FFF6E5; color: #6B4A00; border-radius: 12px; padding: 12px 14px; font-size: .9em; font-weight: 600; }

/* 메뉴 보기 방식 전환 (메뉴판 / 사진) */
.modebar { background: #fff; padding: 4px 16px 14px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: #EFEFEF; border-radius: 14px; padding: 4px; }
.seg button { min-height: 52px; border-radius: 11px; font-weight: 800; color: var(--sub); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.modehint { margin: 10px 2px 0; font-size: .9em; }
.group h3 .cnt { font-size: .75em; font-weight: 600; }

/* 메뉴판 보기: 이름 ······ 가격 */
.board { padding: 0 4px; }
.brow {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 60px; padding: 10px 2px;
  border-bottom: 1px solid #F0F0F0; text-align: left;
}
.brow:last-child { border-bottom: 0; }
.brow:active { background: var(--brand-soft); }
.bname { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-weight: 700; max-width: 62%; }
.bname small { font-weight: 600; font-size: .78em; }
.rk {
  width: 24px; height: 24px; border-radius: 6px; background: var(--accent); color: #fff;
  font-size: .72em; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.lead { flex: 1; min-width: 12px; border-bottom: 2px dotted #C9C9C9; transform: translateY(4px); }
.bprice { font-weight: 800; white-space: nowrap; }
.bqty {
  min-width: 28px; height: 28px; border-radius: 14px; background: var(--brand); color: #fff;
  font-size: .75em; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; flex: none;
}

/* 광고 문구 대신 작은 표시 */
.tag {
  font-size: .62em; font-weight: 800; padding: 2px 7px; border-radius: 6px;
  background: #F1F1F1; color: var(--sub); white-space: nowrap;
}

/* 담기 창: 구성 선택 */
.opthead { margin: 18px 0 10px; font-size: 1.05em; }
.optrow { justify-content: flex-start; padding: 12px 16px; }
.optrow span { flex: 1; line-height: 1.35; }
.optrow b { white-space: nowrap; }
.store-head { padding-bottom: 12px; }
.store-head h1 { margin-bottom: 4px; }
.headline { margin: 2px 0 0; font-size: .92em; font-weight: 600; }

/* 상단 배달 주소 (누르면 주소 바꾸기) */
#topbar .addr { text-align: left; min-height: 48px; padding: 2px 4px; border-radius: 10px; min-width: 0; }
#topbar .addr u { color: var(--brand); font-weight: 800; }
#topbar .addrline { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 검색 */
.sbtn { height: 44px; padding: 0 16px; border-radius: 22px; background: var(--brand); color: #fff; font-weight: 800; flex: none; margin-right: -8px; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.suggest a { min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; border-radius: 22px; background: #F1F1F1; font-weight: 700; }
.hit { margin-bottom: 18px; }
.hit .store { margin-bottom: 0; }
.hitmenus { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: 0 12px; margin-top: -8px; padding-top: 8px; background: #FCFCFC; }
.hit .store:has(+ .hitmenus) { border-radius: var(--radius) var(--radius) 0 0; }
.addbtn { flex: none; padding: 6px 12px; border-radius: 10px; background: var(--brand); color: #fff; font-weight: 800; font-size: .85em; }

/* 주소록 */
.addritem { display: grid; gap: 6px; }
.addropt { align-items: flex-start; padding: 14px 16px; }
.addropt::before { margin-top: 2px; }
.addropt > span { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.addropt .tag, .addrbox .tag { align-self: flex-start; font-size: .75em; background: var(--brand-soft); color: var(--brand); }
.road { font-weight: 800; }
.addrtools { display: flex; gap: 6px; justify-content: flex-end; }
.addrtools a, .addrtools button { min-height: 44px; padding: 0 12px; display: inline-flex; align-items: center; color: var(--sub); text-decoration: underline; font-size: .9em; }
.opts.two { grid-template-columns: 1fr 1fr; }
.roadfield[readonly] { background: #F7F7F7; }
.addrbox { border: 2px solid var(--brand); background: var(--brand-soft); border-radius: 14px; padding: 14px 16px; display: grid; gap: 2px; }
.addrbox.big .road { font-size: 1.15em; }
.postcode { height: 62vh; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.sum b { text-align: right; }
.sum > :nth-child(even) { text-align: right; }
.addrhead { display: flex; align-items: center; gap: 8px; }
.opt.on .tag { background: #fff; }
.paynote { display: block; font-weight: 500; font-size: .78em; margin-top: 2px; }
.opt > span { flex: 1; }
.btn:disabled { opacity: .7; }
.paywidget { margin-top: 14px; border: 2px solid var(--line); border-radius: 14px; padding: 10px 4px; }
.paywidget-title { margin: 4px 12px 0; font-weight: 800; }
.btn.danger { background: #fff; color: #C92A2A; border: 2px solid #C92A2A; }
.refundbox { margin: 14px 0 0; background: var(--brand-soft); color: var(--brand); border-radius: 12px; padding: 12px 14px; font-weight: 800; }
.refundbox small { font-weight: 600; }
.paywindow { display: grid; gap: 4px; margin: 10px 12px 6px; padding: 14px; border-radius: 12px; background: var(--brand-soft); }
.paywindow span { font-size: .9em; color: var(--sub); }

/* 브랜드 배너 (홈 맨 위) — 얼씨구! 배달이 이렇게 쉬울 수가! */
.brand { margin: 12px 12px 10px; padding: 22px 16px; border-radius: 20px; background: #111; color: #fff; text-align: center; }
.brand-name { font-size: 2em; font-weight: 900; letter-spacing: -.02em; line-height: 1.15; }
.brand-copy { font-size: 1.1em; font-weight: 700; margin-top: 6px; }
.brand-sub { font-size: .85em; color: #BDBDBD; margin-top: 6px; }
.sample-note { display: inline-block; margin: 0 0 8px; padding: 4px 10px; border-radius: 8px; background: #FFF6E5; color: #6B4A00; font-size: .8em; font-weight: 700; }

/* 사업자 정보 (화면 맨 아래) */
.bizfoot { padding: 20px 16px 28px; color: #6B6B6B; font-size: .78em; line-height: 1.6; background: var(--bg); }
.bizfoot p { margin: 0; }
.bizfoot a { text-decoration: underline; }
.bizlinks { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 10px; font-size: 1.05em; }
.bizlinks a { color: #333; text-decoration: none; min-height: 36px; display: inline-flex; align-items: center; }
.mediator { margin-top: 10px !important; padding-top: 10px; border-top: 1px solid var(--line); }
.agree { font-size: .85em; color: var(--sub); margin: 14px 0 0; line-height: 1.5; }
.agree a { color: var(--brand); text-decoration: underline; }

/* 약관 화면 */
.policy h3 { font-size: 1em; margin: 20px 0 6px; }
.policy h3:first-child { margin-top: 0; }
.policy p { margin: 0 0 8px; font-size: .92em; line-height: 1.6; }
.ptable { width: 100%; border-collapse: collapse; font-size: .85em; margin: 6px 0 10px; }
.ptable th, .ptable td { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
.ptable th { background: #F5F5F5; }
