/* ---- 主题 ---- */
:root, [data-theme="strawberry"] {
  --bg: linear-gradient(160deg, #fff3f5 0%, #ffe3ec 45%, #fdf3e4 100%);
  --glass: rgba(255, 255, 255, 0.52); --border: rgba(255, 255, 255, 0.9);
  --text: #3b2f33; --muted: #8c7a80; --accent: #ec7598; --soft: rgba(236, 117, 152, 0.14);
  --shadow: rgba(80, 40, 60, 0.08); --input: rgba(255, 255, 255, 0.6);
  color-scheme: light;
}
[data-theme="matcha"] {
  --bg: linear-gradient(160deg, #f6f2e6 0%, #e4efd9 50%, #f5ecdd 100%);
  --glass: rgba(255, 255, 255, 0.5); --border: rgba(255, 255, 255, 0.88);
  --text: #33362b; --muted: #7f8472; --accent: #5f9a6b; --soft: rgba(95, 154, 107, 0.14);
}
[data-theme="soda"] {
  --bg: linear-gradient(160deg, #eef8ff 0%, #dcecff 50%, #f4efff 100%);
  --glass: rgba(255, 255, 255, 0.5); --border: rgba(255, 255, 255, 0.9);
  --text: #2b3340; --muted: #76829a; --accent: #4f8fe0; --soft: rgba(79, 143, 224, 0.14);
}
[data-theme="night"] {
  --bg: linear-gradient(160deg, #1c1f33 0%, #2a2442 55%, #182a3a 100%);
  --glass: rgba(255, 255, 255, 0.08); --border: rgba(255, 255, 255, 0.16);
  --text: #f1eef8; --muted: #a39fb8; --accent: #b9a2e6; --soft: rgba(185, 162, 230, 0.18);
  --shadow: rgba(0, 0, 0, 0.3); --input: rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}

/* ---- 基础 ---- */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  color: var(--text); background: #fff1f3; -webkit-tap-highlight-color: transparent;
}
[data-theme="night"] body { background: #1c1f33; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
.hidden { display: none !important; }

.bg { position: fixed; inset: 0; z-index: -2; background: var(--bg); }
.bg-img { position: fixed; inset: 0; z-index: -1; background-size: cover; background-position: center; }
.bg-img.on::after { content: ""; position: absolute; inset: 0; background: var(--glass); opacity: 0.35; }

.content { max-width: 960px; margin: 0 auto; padding: 36px 16px calc(120px + env(safe-area-inset-bottom)); }

.glass {
  background: var(--glass);
  border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 4px 18px var(--shadow);
}

h1.title { font-size: 30px; font-weight: 700; margin: 0; letter-spacing: 1px; }
.subtitle { font-size: 14px; color: var(--muted); margin: 6px 0 0; }
.section-title { font-size: 17px; font-weight: 700; margin: 24px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title .count { font-size: 12px; font-weight: 400; color: var(--muted); }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.pill { border-radius: 999px; padding: 9px 16px; font-size: 14px; text-align: center; }
.btn { display: block; width: 100%; border-radius: 999px; padding: 12px 0; font-size: 15px; font-weight: 600; text-align: center; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-danger { color: #e5484d; }
.btn:disabled { opacity: 0.6; }

.search-box { display: flex; align-items: center; gap: 8px; border-radius: 999px; padding: 0 16px; height: 48px; margin-top: 18px; }
.search-box svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.search-box input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 15px; }
input::placeholder { color: var(--muted); }

.segments { display: flex; border-radius: 999px; padding: 4px; margin-top: 16px; }
.seg { flex: 1; text-align: center; font-size: 14px; padding: 8px 0; border-radius: 999px; color: var(--muted); border: 1px solid transparent; }
.seg.on { background: var(--soft); color: var(--text); font-weight: 600; border-color: var(--border); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; }
.chip.on, .shop.on { background: var(--accent); color: #fff; border-color: var(--accent); }

.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.shop { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 11px 6px; }

.empty-box { border-radius: 18px; padding: 36px 16px; text-align: center; color: var(--muted); font-size: 14px; border-style: dashed; margin-top: 16px; line-height: 1.8; }

/* ---- 卡片 ---- */
.card { border-radius: 18px; padding: 7px; cursor: pointer; transition: transform .15s; }
.card:hover { transform: translateY(-2px); }
.cover { width: 100%; aspect-ratio: 1; border-radius: 13px; object-fit: cover; display: block; background: var(--soft); }
.cover-empty { display: grid; place-items: center; font-size: 40px; }
.card .info { padding: 7px 4px 3px; }
.card .shop-name { font-size: 12px; color: var(--muted); }
.card .name { font-size: 15px; font-weight: 700; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.card .bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 7px; min-height: 28px; gap: 6px; }
.card .price { font-size: 17px; font-weight: 700; }
.card .price.small { font-size: 13px; }
.mini-btn { border-radius: 999px; padding: 5px 13px; font-size: 12px; }
.meter { height: 5px; border-radius: 5px; background: var(--soft); margin-top: 7px; overflow: hidden; }
.meter > div { height: 100%; border-radius: 5px; background: var(--accent); }

/* ---- 底部导航 ---- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  width: min(560px, calc(100% - 24px)); height: 66px; padding: 5px;
  display: flex; border-radius: 33px; z-index: 10;
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 28px; color: var(--muted); font-size: 12px; border: 1px solid transparent; }
.tab svg { width: 23px; height: 23px; }
.tab.on { background: var(--soft); border-color: var(--border); color: var(--text); font-weight: 600; }

/* ---- 弹窗 / 表单 ---- */
dialog { border: none; padding: 0; color: var(--text); background: transparent; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(20, 10, 20, 0.35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet { width: min(520px, 100%); height: 100%; margin: 0 auto; }
.sheet-inner { min-height: 100%; background: var(--bg); padding: 20px 16px 40px; }
@media (min-width: 600px) {
  .sheet { height: auto; max-height: calc(100% - 48px); margin: 24px auto; border-radius: 24px; overflow: auto; }
}
.back { font-size: 15px; padding: 4px 0; margin-bottom: 8px; }

.photo { margin-top: 16px; border-radius: 20px; aspect-ratio: 1; max-height: 340px; width: 100%; overflow: hidden; display: grid; place-items: center; color: var(--muted); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 32px; }
.photo-empty span { font-size: 14px; }
.link-btn { font-size: 13px; color: var(--muted); }
.right { text-align: right; margin-top: 6px; }

.form { border-radius: 20px; padding: 4px 16px; margin-top: 14px; }
.field { display: flex; align-items: center; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--soft); font-size: 15px; }
.field:last-child { border-bottom: none; }
.field.column { flex-direction: column; align-items: stretch; gap: 6px; }
.field > span.label { width: 72px; flex-shrink: 0; color: var(--muted); font-size: 14px; }
.field input:not([type="range"]) { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 15px; padding: 2px 0; }
.field input[type="range"] { width: 100%; accent-color: var(--accent); }
.label-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }
.strength { color: var(--accent); font-weight: 700; }
.hint { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.field a, .field .act { color: var(--accent); font-size: 13px; text-decoration: none; flex-shrink: 0; }
.err { color: #e5484d; font-size: 13px; margin-top: 10px; text-align: center; }
.err:empty { display: none; }

/* ---- 设置 ---- */
.tiles { margin-top: 20px; grid-template-columns: 1fr 1fr; }
.tile { border-radius: 24px; height: 104px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 16px; font-weight: 700; }
.tile .emoji { font-size: 24px; font-weight: 400; }
.panel { border-radius: 24px; padding: 18px 16px; margin-top: 14px; }
.panel-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.themes { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.theme { border-radius: 16px; padding: 10px; display: flex; align-items: center; gap: 10px; text-align: left; }
.theme.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--soft); }
.swatch { width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; border: 1px solid var(--border); }
.theme-name { font-size: 15px; }
.theme-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }
.line { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; font-size: 14px; border-bottom: 1px solid var(--soft); width: 100%; }
.line .value { color: var(--muted); }
.stats { display: flex; gap: 8px; margin-top: 16px; }
.stat { flex: 1; border-radius: 16px; padding: 11px 0; display: flex; flex-direction: column; align-items: center; }
.stat b { font-size: 19px; color: var(--accent); }
.stat span { font-size: 11px; color: var(--muted); margin-top: 2px; }
.info-body { padding: 20px; border-radius: 20px; width: min(420px, calc(100vw - 32px)); background: var(--bg); line-height: 1.7; font-size: 14px; }
.info-body h3 { margin: 0 0 8px; }
