:root {
  --brand: #ff6b35;
  --brand-dark: #e2551f;
  --brand-soft: #fff1ea;
  --bg: #fff8f3;
  --card: #ffffff;
  --text: #2b2420;
  --muted: #8a7f78;
  --line: #f0e4dc;
  --green: #2e9d5b;
  --blue: #2f74d0;
  --orange: #e08a00;
  --red: #d64545;
  --gray: #9a9a9a;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(80, 40, 20, .07);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1714; --card: #26211d; --text: #f3ece6; --muted: #a99e96;
    --line: #3a322c; --brand-soft: #3a2519; --shadow: none;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.55 -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

/* 頂部與底部 */
.top {
  position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: 64px 1fr 64px; align-items: center;
  padding: 10px 12px; background: var(--brand); color: #fff;
}
.top h1 { margin: 0; font-size: 17px; text-align: center; }
.logo { font-weight: 900; font-size: 20px; }
.logo b { font-weight: 900; margin-left: 1px; }
.icon-btn { background: none; border: 0; color: #fff; font-size: 30px; line-height: 1; padding: 0 8px; cursor: pointer; text-align: left; }
.badge-demo { justify-self: end; font-size: 11px; background: rgba(255,255,255,.25); padding: 2px 7px; border-radius: 99px; white-space: nowrap; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; max-width: 186px; text-align: center; padding: 7px 0 8px; font-size: 12px; color: var(--muted); text-decoration: none;
}
.tabbar a span { display: block; font-size: 20px; filter: grayscale(1); opacity: .6; }
.tabbar a.on { color: var(--brand-dark); font-weight: 700; }
.tabbar a.on span { filter: none; opacity: 1; }
main { padding: 12px 16px; }
.loading, .empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* 首頁 */
.search input {
  width: 100%; padding: 10px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--card);
}
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--card); padding: 5px 14px; border-radius: 99px; cursor: pointer;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.list { display: grid; gap: 14px; margin-top: 10px; }
.card {
  display: block; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  color: inherit; text-decoration: none;
}
.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--line) center / cover; }
.thumb .tag { position: absolute; top: 10px; left: 10px; }
.card-body { padding: 10px 14px 12px; }
.card h3 { margin: 0 0 2px; font-size: 16px; }
.price { color: var(--brand-dark); font-weight: 800; font-size: 18px; }
.price small { color: var(--muted); font-weight: 400; font-size: 12px; }
.price.big { font-size: 24px; }
.bar { position: relative; height: 8px; background: var(--brand-soft); border-radius: 99px; margin: 8px 0 3px; }
.bar > div { height: 100%; background: var(--brand); border-radius: 99px; }
.bar .min { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--text); opacity: .5; }
.bar-text { font-size: 12px; color: var(--muted); }
.bar-text b { color: var(--brand-dark); }
.meta { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-top: 6px; }
.meta.owner { color: var(--muted); font-size: 12px; justify-content: flex-start; }

/* 標籤與按鈕 */
.tag { display: inline-block; font-size: 12px; padding: 1px 9px; border-radius: 99px; background: var(--line); color: var(--text); }
.tag.green { background: var(--green); color: #fff; }
.tag.blue { background: var(--blue); color: #fff; }
.tag.orange { background: var(--orange); color: #fff; }
.tag.red { background: var(--red); color: #fff; }
.tag.gray { background: var(--gray); color: #fff; }
.btn {
  display: inline-block; border: 1px solid var(--line); background: var(--card); padding: 9px 16px; border-radius: 10px;
  cursor: pointer; text-align: center; text-decoration: none; color: var(--text); font-weight: 600;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:active { background: var(--brand-dark); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn.ghost { border-color: transparent; color: var(--muted); font-weight: 400; }
.btn.small { padding: 4px 10px; font-size: 13px; white-space: nowrap; flex: none; }
.btn.block { display: block; width: 100%; margin-top: 10px; }
.btn:disabled { opacity: .6; }
.btn.google { background: #fff; color: #333; border-color: #dadce0; }

/* 詳情 */
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin: -12px -16px 0; scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery img { flex: none; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; scroll-snap-align: start; }
.dots { display: flex; justify-content: center; gap: 5px; margin-top: 6px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.detail h2 { margin: 6px 0 2px; font-size: 20px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row.gap { justify-content: flex-start; margin-top: 8px; }
.row.wrap { flex-wrap: wrap; }
.detail > .row:first-child { justify-content: flex-start; margin-top: 12px; }
.info { display: grid; grid-template-columns: 76px 1fr; gap: 6px 10px; margin: 14px 0; padding: 12px; background: var(--card); border-radius: var(--radius); }
.info dt { color: var(--muted); }
.info dd { margin: 0; }
.desc { background: var(--card); padding: 12px; border-radius: var(--radius); margin: 0 0 12px; }
.owner-card { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--card); border-radius: var(--radius); }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--brand-soft); display: grid; place-items: center; font-size: 24px; flex: none; }
.avatar.big { width: 64px; height: 64px; font-size: 34px; }
.reviews { font-size: 13px; padding: 8px 12px; display: grid; gap: 4px; }
.box { background: var(--card); border-radius: var(--radius); padding: 14px; margin-top: 14px; box-shadow: var(--shadow); border: 2px solid var(--brand-soft); }
.box.mine { border-color: var(--blue); }
.box.center { text-align: center; }
.owner-panel { border-color: var(--brand); display: grid; gap: 10px; }
.roster { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.roster li { padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.stepper { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.stepper button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); font-size: 20px; cursor: pointer; }
.stepper input { width: 60px; text-align: center; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.total { text-align: right; }
.total b { color: var(--brand-dark); font-size: 20px; }
.rate { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; padding: 10px; background: var(--brand-soft); border-radius: 10px; }
.rate input[name=comment] { flex: 1 1 160px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.warn { margin: 0; padding: 8px 10px; background: #fff3cd; color: #7a5800; border-radius: 8px; font-size: 13px; }
.hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* 表單 */
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.form small { font-weight: 400; color: var(--muted); }
.form input, .form select, .form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-weight: 400;
}
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.photo-pick { display: flex; gap: 8px; }
.photo-pick .add, .photo-pick .ph {
  width: 92px; height: 92px; border-radius: 10px; display: grid; place-items: center; position: relative;
}
.photo-pick .add { border: 2px dashed var(--line); font-size: 30px; color: var(--muted); cursor: pointer; background: var(--card); }
.photo-pick .add[hidden] { display: none; }
.photo-pick .ph { background: center / cover; }
.photo-pick .ph button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; line-height: 1; }
.photo-pick .ph small { position: absolute; bottom: 3px; left: 3px; background: rgba(0,0,0,.55); color: #fff; padding: 0 5px; border-radius: 6px; font-size: 10px; }

/* 我的 */
.profile { display: flex; gap: 14px; align-items: center; padding: 10px 0 16px; }
.profile h2 { margin: 0; font-size: 20px; }
.seg { display: flex; background: var(--card); border-radius: 10px; padding: 3px; }
.seg a { flex: 1; text-align: center; padding: 7px; border-radius: 8px; text-decoration: none; color: var(--muted); }
.seg a.on { background: var(--brand); color: #fff; font-weight: 700; }
.minis { display: grid; gap: 10px; margin-top: 12px; }
.mini { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; background: var(--card); padding: 10px; border-radius: 12px; color: inherit; text-decoration: none; }
.mini-img { width: 64px; height: 64px; border-radius: 8px; background: var(--line) center / cover; }
.footer-actions { margin-top: 24px; }

/* 登入 */
.login { padding-top: 20px; }
.hero { text-align: center; font-size: 56px; font-weight: 900; color: var(--brand); line-height: 1.1; margin-bottom: 8px; }
.hero small { display: block; font-size: 16px; color: var(--muted); font-weight: 400; }
.user-pick {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 12px; margin-top: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.doc { background: var(--card); padding: 4px 16px; border-radius: var(--radius); }

/* 距離與追蹤 */
.near { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.near-label { flex: none; font-size: 13px; font-weight: 700; }
.chips.tight { padding: 0; }
.chip.small { padding: 3px 11px; font-size: 13px; }
.chip.follow.on { background: #f5b301; border-color: #f5b301; color: #3a2a00; }
.loc-line { font-size: 12px; color: var(--muted); margin-top: 6px; }
.link { background: none; border: 0; padding: 0; color: var(--brand-dark); text-decoration: underline; cursor: pointer; font-size: inherit; }
.tag.soft { background: var(--brand-soft); color: var(--brand-dark); }
.grow { flex: 1; min-width: 0; }
.btn.following { background: #fff6d6; border-color: #f5b301; color: #7a5800; }
.followee { background: var(--card); border-radius: var(--radius); padding: 12px; display: grid; gap: 10px; }
.row.gap0 { justify-content: flex-start; gap: 10px; }
.hscroll { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.tile { flex: none; width: 140px; display: grid; gap: 2px; color: inherit; text-decoration: none; font-size: 13px; }
.tile b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-img { position: relative; height: 90px; border-radius: 10px; background: var(--line) center / cover; }
.tile-img .tag { position: absolute; top: 6px; left: 6px; font-size: 11px; }
.geo { display: grid; gap: 6px; padding: 12px; border: 1px dashed var(--line); border-radius: 10px; }
.geo .ok { color: var(--green); }

/* 登入與個人資料 */
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 18px 0 6px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.avatar-pick { display: flex; flex-wrap: wrap; gap: 6px; font-weight: 400; }
.avatar-pick input { display: none; }
.avatar-pick span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--bg); border: 2px solid transparent; font-size: 22px; cursor: pointer; }
.avatar-pick input:checked + span { border-color: var(--brand); background: var(--brand-soft); }
#profile-form { margin-bottom: 12px; }

.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  background: #2b2420; color: #fff; padding: 9px 18px; border-radius: 99px; font-size: 14px; max-width: 90vw; text-align: center;
}
.toast.error { background: var(--red); }
