/* ===== 顏色與字體：從 App 圖示取色（米白底、陶土橘紅） ===== */
:root {
  /* 典雅：米白底、暖墨色字、單一主色；細線取代陰影；數字用襯線字（iPhone 內建的 New York） */
  --bg: #FBF6EF;
  --surface: #FFFDF9;
  --surface-2: #F3ECE2;
  --ink: #2A2420;
  --ink-2: #6B625A;
  --ink-3: #A0968B;
  --line: rgba(42, 36, 32, 0.11);
  --brand: #C2553A;        /* 文字與按鈕用（比圖示的橘紅深一點，字才看得清楚） */
  --brand-soft: rgba(194, 85, 58, 0.09);
  --ok: #4F7A55;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --num: ui-serif, "New York", "Iowan Old Style", Georgia, "PingFang TC", serif;
  --tabbar-h: 62px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16130F;
    --surface: #1E1A16;
    --surface-2: #29231E;
    --ink: #EFE8DE;
    --ink-2: #B3A99D;
    --ink-3: #7C7369;
    --line: rgba(239, 232, 222, 0.11);
    --brand: #EE8A68;
    --brand-soft: rgba(238, 138, 104, 0.13);
    --ok: #8DB892;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
.num { font-family: var(--num); font-variant-numeric: lining-nums tabular-nums; }

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + var(--tabbar-h) + 28px);
}

/* ===== 頂部：目前查詢的位置 ===== */
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.loc { text-align: left; min-width: 0; flex: 1; display: grid; gap: 1px; }
.eyebrow { font-size: 11px; letter-spacing: .14em; color: var(--ink-3); }
.loc-line { display: flex; align-items: center; gap: 4px; min-width: 0; }
.loc-line b { font-size: 22px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--brand); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.loc-sub { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; flex: none; }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: var(--ink-2); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ===== 範圍與排序 ===== */
.controls { display: grid; gap: 10px; padding: 14px 0 6px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); padding: 3px; }
.seg button { height: 32px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--ink-2); font-family: var(--num); }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--bg); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips:empty { display: none; }
/* 一排放不下就左右滑（料理類別、排序＋篩選），左右貼齊螢幕邊 */
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.scroll .chips { flex-wrap: nowrap; flex: none; }
.chips.scroll .chip { flex: none; white-space: nowrap; }
.chips.scroll > #filters::before { content: ""; width: 1px; align-self: stretch; margin: 5px 2px; background: var(--line); }
.seg-2 { grid-template-columns: 1fr 1fr; }
.seg-2 button { font-family: var(--font); }
.chip { height: 30px; padding: 0 12px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); font-size: 13.5px; color: var(--ink-2); }
.chip[aria-checked="true"] { box-shadow: inset 0 0 0 1px var(--brand); color: var(--brand); background: var(--brand-soft); font-weight: 500; }

/* ===== 列表 ===== */
.list { display: block; }
.list-head { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 2px 4px; font-size: 13px; color: var(--ink-3); letter-spacing: .04em; }
.list-head b { font-weight: 500; color: var(--ink-2); }
/* 「餐廳・全部」的料理框框 */
.box { margin: 14px 0 4px; padding: 2px 14px 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.box-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0; padding: 14px 0 6px; font-size: 18px; font-weight: 600; color: var(--brand); border-bottom: 1px solid var(--line); }
.box-n { font-size: 13px; font-weight: 400; color: var(--ink-3); }
.box > .card:last-child { border-bottom: 0; }
.card { display: flex; gap: 14px; width: 100%; text-align: left; padding: 16px 2px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.card:active { background: var(--brand-soft); }
.card-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.card h3 { margin: 0; font-size: 16.5px; font-weight: 600; line-height: 1.35; letter-spacing: .01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { margin: 0; font-size: 13.5px; color: var(--ink-2); display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }
.meta .dot { color: var(--ink-3); }
.dist { font-family: var(--num); color: var(--ink); font-size: 14.5px; }
.left { font-family: var(--num); }
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); border-radius: 4px; padding: 0 6px; line-height: 19px; }
.price { margin: 0; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; flex: none; background: var(--surface-2); }

/* 好吃／好玩 */
.rating { color: var(--ink); }
.rating .num { font-size: 14.5px; }
.count { color: var(--ink-3); font-size: 12.5px; }
.muted { color: var(--ink-3); }
.open { color: var(--ok); font-weight: 500; }
.closed { color: var(--ink-3); font-weight: 500; }
.closing { color: var(--brand); font-weight: 500; }
.link-btn.small { font-size: 12.5px; letter-spacing: 0; }
.chip.toggle[aria-checked="true"]::before { content: "✓ "; }
.week { list-style: none; margin: 0; padding: 0; }
.week li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.week li .num { text-align: right; }
.week li.today { color: var(--ink); font-weight: 600; }
.info dd small { color: var(--ink-3); font-size: 12.5px; }

.empty { text-align: center; padding: 48px 16px; color: var(--ink-2); font-size: 15px; }
.empty b { display: block; font-size: 17px; color: var(--ink); margin-bottom: 6px; font-weight: 600; }
.empty .btn-ghost { margin-top: 16px; }
.more-btn { display: block; width: 100%; padding: 14px; color: var(--brand); font-size: 14.5px; font-weight: 500; text-align: center; }
.note { font-size: 12.5px; color: var(--ink-3); padding: 14px 2px; line-height: 1.6; }

/* ===== 底部分頁 ===== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px max(8px, env(safe-area-inset-left)) calc(env(safe-area-inset-bottom) + 4px);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar button { height: 52px; display: grid; place-items: center; align-content: center; gap: 1px; font-size: 11.5px; color: var(--ink-3); letter-spacing: .06em; }
.tab-emoji { font-size: 21px; line-height: 1; filter: grayscale(1); opacity: .55; }
.tabbar button[aria-selected="true"] { color: var(--brand); font-weight: 600; }
.tabbar button[aria-selected="true"] .tab-emoji { filter: none; opacity: 1; }

/* ===== 下方滑出的面板 ===== */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(22, 19, 15, 0.34); animation: fade .2s ease; }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 86dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--bg); border-radius: 20px 20px 0 0; box-shadow: 0 -1px 0 var(--line);
  padding: 18px 16px calc(env(safe-area-inset-bottom) + 24px);
  animation: up .24s cubic-bezier(.2, .8, .2, 1);
}
.sheet-tall { max-height: 92dvh; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.sheet-title { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: .02em; line-height: 1.35; }
.btn-close { width: 32px; height: 32px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); flex: none; font-size: 13px; }

.row-btn { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.row-btn b { display: block; font-weight: 500; }
.row-btn small { display: block; font-size: 12.5px; color: var(--ink-3); }
.row-icon { font-size: 20px; width: 28px; text-align: center; }

.search { display: flex; gap: 8px; padding: 14px 0 6px; }
.search input, .fav-form input, .pass-form input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px; border-radius: 12px; border: 0;
  background: transparent; box-shadow: inset 0 0 0 1px var(--line); font-size: 16px; outline: none;
}
.search input:focus, .fav-form input:focus, .pass-form input:focus { box-shadow: inset 0 0 0 1.5px var(--brand); }

.btn-primary { height: 44px; padding: 0 18px; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 500; letter-spacing: .04em; flex: none; }
.btn-primary:disabled { opacity: .5; }
.btn-ghost { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 16px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; text-decoration: none; color: var(--ink); }
.btn-ghost.danger, .link-btn.danger { color: #B3412E; }
.link-btn { color: var(--brand); font-size: 14px; font-weight: 500; }

.results { display: grid; }
.result { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.result > button:first-child { flex: 1; text-align: left; padding: 12px 2px; min-width: 0; }
.result b { display: block; font-weight: 500; }
.result small { display: block; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .star { width: 40px; height: 40px; font-size: 19px; color: var(--brand); }
.results .note { padding: 10px 2px; }

.section-head { display: flex; justify-content: space-between; align-items: baseline; padding: 20px 2px 6px; }
.section-head h3 { margin: 0; font-size: 13px; font-weight: 500; letter-spacing: .14em; color: var(--ink-3); }

.fav-form { display: grid; gap: 10px; padding: 8px 0 14px; border-bottom: 1px solid var(--line); }
.quick-names { display: flex; gap: 8px; }
.quick-names button { height: 30px; padding: 0 12px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); font-size: 13.5px; color: var(--ink-2); }
.fav-actions { display: flex; gap: 8px; justify-content: flex-end; }
.fav-actions .danger { margin-right: auto; }
.fav-list { list-style: none; margin: 0; padding: 0; }
.fav-list li { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.fav-list li > button:first-child { flex: 1; text-align: left; padding: 12px 2px; min-width: 0; }
.fav-list b { display: block; font-weight: 500; }
.fav-list small { display: block; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-list li.current b { color: var(--brand); }
.fav-list .edit { width: 44px; height: 44px; color: var(--ink-3); font-size: 15px; }
.fav-list .empty-li { padding: 12px 2px; font-size: 13.5px; color: var(--ink-3); }

/* ===== 詳情 ===== */
.hero { width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; margin-bottom: 14px; background: var(--surface-2); }
.facts { margin: 0; display: grid; }
.facts > div { display: grid; grid-template-columns: 72px 1fr; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.facts dt { color: var(--ink-3); font-size: 13px; letter-spacing: .06em; padding-top: 1px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
/* 店家標籤：料理類型、Google 地圖上的店家特色 */
.tags { margin: 3px 0 0; display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: 12px; line-height: 21px; padding: 0 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.tag.kind { background: var(--brand-soft); color: var(--brand); }
.tag.warn { box-shadow: inset 0 0 0 1px var(--brand); background: transparent; color: var(--brand); font-weight: 500; }
.facts .tags { margin: 0; }
.card-sum { margin: 2px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.summary { font-size: 15px; line-height: 1.7; color: var(--ink); margin: 0 0 6px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
a.row-btn { color: inherit; text-decoration: none; margin-top: 8px; }
.desc { font-size: 14.5px; color: var(--ink-2); line-height: 1.75; margin: 14px 0 0; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.detail-actions .btn-primary, .detail-actions .btn-ghost { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.detail-actions > :only-child { grid-column: 1 / -1; }

/* ===== 設定 ===== */
.info { margin: 0; }
.info > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 2px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.info dt { color: var(--ink-2); }
.info dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.info .err { color: #B3412E; font-size: 12.5px; }
.settings-actions { display: grid; gap: 10px; margin-top: 18px; }

/* ===== 通行碼畫面 ===== */
.pass-screen { max-width: 380px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 64px) 24px 40px; text-align: center; }
.pass-icon { width: 88px; height: 88px; border-radius: 20px; }
.pass-screen h1 { font-size: 24px; font-weight: 600; letter-spacing: .06em; margin: 18px 0 8px; }
.pass-hint { color: var(--ink-2); font-size: 14.5px; line-height: 1.7; }
.pass-form { display: grid; gap: 12px; margin-top: 22px; }
.pass-error { color: #B3412E; font-size: 14px; min-height: 1.5em; }

/* ===== 提示訊息 ===== */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(env(safe-area-inset-bottom) + var(--tabbar-h) + 18px);
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px;
  background: var(--ink); color: var(--bg); font-size: 14px; text-align: center;
  animation: fade .2s ease;
}

.skeleton { height: 86px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, transparent, var(--surface-2), transparent) 0 0 / 200% 100%; animation: shimmer 1.4s infinite; opacity: .6; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
}
