/* style.css — 移动端优先，无 UI 框架；颜色全部走变量，自动适配深色模式 */

:root {
  color-scheme: light;
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-2: #f6f8f7;
  --surface-3: #eaeeec;
  --text: #17201b;
  --text-2: #4f5b55;
  --text-3: #7a8680;
  --border: #e2e7e4;
  --border-strong: #cbd3cf;
  --primary: #1a8448;
  --primary-hover: #146d3b;
  --primary-soft: #e3f2e9;
  --primary-ink: #146d3b;
  --on-primary: #ffffff;
  --danger: #c43838;
  --danger-soft: #fbeaea;
  --warn-soft: #fdf3dc;
  --warn-ink: #855d00;
  --track: #e5ebe8;
  --grid: #e8ecea;
  --axis: #c6cec9;
  --macro-carbs: #2a78d6;
  --macro-protein: #eb6834;
  --macro-fat: #1baf7a;
  --shadow: 0 1px 2px rgba(16, 24, 20, 0.04), 0 6px 20px rgba(16, 24, 20, 0.05);
  --radius: 18px;
  --radius-sm: 12px;
  --tabbar-h: 62px;
  --font: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f1311;
    --surface: #1a201d;
    --surface-2: #212924;
    --surface-3: #29322d;
    --text: #e9efeb;
    --text-2: #b3bfb8;
    --text-3: #89958e;
    --border: #2a332e;
    --border-strong: #3b4741;
    --primary: #3fb46c;
    --primary-hover: #52c47d;
    --primary-soft: #1c3325;
    --primary-ink: #7fd6a0;
    --on-primary: #05200e;
    --danger: #ee6a6a;
    --danger-soft: #3a1f1f;
    --warn-soft: #3a3016;
    --warn-ink: #f0c460;
    --track: #2a332e;
    --grid: #262e2a;
    --axis: #3b4741;
    --macro-carbs: #3987e5;
    --macro-protein: #d95926;
    --macro-fat: #199e70;
    --shadow: none;
  }
}

/* ========== 基础 ========== */

* { box-sizing: border-box; margin: 0; padding: 0; }
/* 作者样式里的 display:flex 会盖过浏览器默认的 [hidden]，这里统一强制隐藏 */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.view {
  max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px);
}
.page-head { margin: 8px 2px 16px; }
.page-head h1 { font-size: 28px; font-weight: 700; letter-spacing: 0.5px; }
.page-sub { color: var(--text-3); font-size: 14px; margin-top: 2px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-3); margin: 24px 4px 10px; letter-spacing: 1px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card-head { margin-bottom: 10px; }
.card-title { font-size: 16px; font-weight: 600; }
.card-desc { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.card > .card-desc + * { margin-top: 14px; }
.fine-print { font-size: 12px; color: var(--text-3); text-align: center; margin: 12px 8px; }
.notice {
  background: var(--primary-soft); color: var(--primary-ink); font-size: 13px;
  border-radius: var(--radius-sm); padding: 10px 12px; margin: 0 0 14px;
}
.notice.warn { background: var(--warn-soft); color: var(--warn-ink); }

/* ========== 按钮与表单 ========== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 18px; border-radius: 14px;
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 16px; font-weight: 500; color: var(--text);
  transition: background-color 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { background: none; border-color: transparent; color: var(--primary-ink); }
.btn.danger-outline { background: none; border-color: var(--border-strong); color: var(--danger); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.block { display: flex; width: 100%; }
.btn.block + .btn.block { margin-top: 10px; }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.row-btns { display: flex; gap: 10px; }
.row-btns > .btn { flex: 1; }

.input {
  width: 100%; min-height: 46px; padding: 10px 12px; font-size: 16px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); outline: none;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input[readonly] { color: var(--text-2); }
.code-input { text-transform: uppercase; letter-spacing: 2px; font-family: var(--mono); }
.code-input::placeholder { letter-spacing: 0; font-family: var(--font); text-transform: none; }
.link-input { font-size: 13px; min-height: 40px; }

.field { display: block; margin-bottom: 12px; }
.field > span, .field-label { display: block; font-size: 13px; color: var(--text-2); margin: 0 2px 6px; }
.field-hint { font-size: 12px; color: var(--text-3); margin: -4px 2px 12px; min-height: 1em; }
.field-hint.ok { color: var(--primary-ink); }
.field-hint.err { color: var(--danger); }
.inline-form { display: flex; gap: 8px; align-items: stretch; }
.inline-form > .input, .inline-form > .input-suffix { flex: 1; min-width: 0; }
.input-suffix { position: relative; }
.input-suffix > span {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); font-size: 14px; pointer-events: none;
}
.input-suffix > .input { padding-right: 48px; }

.segmented {
  display: flex; gap: 2px; padding: 3px; margin-bottom: 14px;
  background: var(--surface-3); border-radius: 13px;
}
.segmented > button {
  flex: 1; min-height: 38px; border: none; border-radius: 10px; background: none;
  font-size: 15px; color: var(--text-2);
}
.segmented > button[aria-pressed="true"], .segmented > button[aria-selected="true"] {
  background: var(--surface); color: var(--text); font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 2px 14px; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 1px; flex: none; accent-color: var(--primary); }
.check small { display: block; font-size: 12px; color: var(--text-3); }

.divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; color: var(--text-3); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface); display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn svg, .back-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.back-btn {
  display: inline-flex; align-items: center; gap: 2px; border: none; background: none;
  color: var(--primary-ink); font-size: 16px; padding: 8px 4px; margin-left: -4px;
}

.badge {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-ink);
}
.badge.muted { background: var(--surface-3); color: var(--text-3); }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); }

.empty { text-align: center; padding: 28px 16px; color: var(--text-3); }
.empty .btn { margin-top: 14px; }

/* ========== 启动 & 登录 ========== */

.boot {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center;
}
.boot-logo { width: 72px; height: 72px; animation: breathe 1.6s ease-in-out infinite; }
.boot-text { color: var(--text-2); }
.boot-slow { color: var(--text-3); font-size: 13px; max-width: 260px; }
@keyframes breathe { 50% { transform: scale(0.92); opacity: 0.7; } }

.auth-view {
  min-height: 100vh; min-height: 100dvh; padding: 24px 16px;
  display: flex; align-items: center; justify-content: center;
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 24px; padding: 28px 20px 20px; box-shadow: var(--shadow);
}
.auth-logo { width: 64px; height: 64px; margin: 0 auto 12px; display: block; }
.auth-card h1 { text-align: center; font-size: 22px; }
.auth-sub { text-align: center; color: var(--text-3); font-size: 14px; margin: 4px 0 20px; }
.auth-card .btn.primary { margin-top: 6px; }

/* ========== 拍照 ========== */

.capture-hero { text-align: center; padding: 28px 20px 18px; }
.hero-icon {
  width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 24px;
  background: var(--primary-soft); color: var(--primary-ink);
  display: flex; align-items: center; justify-content: center;
}
.hero-icon svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.capture-hero h2 { font-size: 20px; }
.capture-hero p { color: var(--text-3); font-size: 14px; margin: 6px 0 20px; }

.preview-frame {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: #000; margin-bottom: 14px;
}
#preview-img { display: block; width: 100%; max-height: 52vh; object-fit: contain; }
.scan { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.35); display: flex; align-items: flex-end; justify-content: center; }
.scan-line {
  position: absolute; left: 0; right: 0; height: 3px; top: 0;
  background: linear-gradient(90deg, transparent, #7ee2a6, transparent);
  box-shadow: 0 0 16px #7ee2a6; animation: scan 1.8s ease-in-out infinite;
}
.scan-text {
  margin-bottom: 16px; padding: 6px 14px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 14px;
}
@keyframes scan { 0% { top: 0; } 50% { top: calc(100% - 3px); } 100% { top: 0; } }
@media (prefers-reduced-motion: reduce) { .scan-line, .boot-logo { animation: none; } }

.result-total {
  display: flex; align-items: baseline; gap: 6px; margin: 0 2px 8px;
  font-size: 14px; color: var(--text-2);
}
.result-total b { font-size: 28px; color: var(--text); }
.result-count { margin-left: auto; color: var(--text-3); }
.notes { font-size: 13px; color: var(--text-3); margin: 0 2px 12px; }

.field > span small { font-size: 12px; color: var(--text-3); margin-left: 6px; }
.hint-input { display: block; min-height: 64px; resize: vertical; line-height: 1.45; }
.hint-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 14px; }
.hint-chips > button {
  min-height: 34px; padding: 0 12px; border-radius: 999px; font-size: 14px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
}
.hint-chips > button[aria-pressed="true"] {
  background: var(--primary-soft); border-color: var(--primary); color: var(--primary-ink);
}
.rerecognize { min-height: 36px; padding: 0 2px; margin: -6px 0 8px; font-size: 14px; }

.food-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.food-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.food-head .input { flex: 1; font-weight: 600; }
.conf { font-size: 12px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.conf-high { background: var(--primary-soft); color: var(--primary-ink); }
.conf-medium { background: var(--warn-soft); color: var(--warn-ink); }
.conf-low { background: var(--danger-soft); color: var(--danger); }
.del-btn {
  width: 36px; height: 36px; border: none; background: none; color: var(--text-3);
  font-size: 18px; border-radius: 10px; flex: none;
}
.food-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.food-fields label { font-size: 12px; color: var(--text-3); }
.food-fields .input { min-height: 42px; margin-top: 2px; padding: 8px 10px; }
.food-fields .wide { grid-column: span 2; }
.editor-actions { display: flex; gap: 8px; margin-top: 12px; }
.editor-actions .btn { flex: 1; }

/* ========== 今日汇总 ========== */

.summary { padding: 18px 16px 16px; }
.sum-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.sum-label { font-size: 13px; color: var(--text-3); }
.hero { display: flex; align-items: baseline; gap: 4px; }
.hero-num { font-size: 48px; font-weight: 700; line-height: 1.05; letter-spacing: -1px; }
.hero-unit { font-size: 15px; color: var(--text-3); }
.sum-side { text-align: right; }
.sum-remain { font-size: 20px; font-weight: 600; }
.sum-remain.over { color: var(--danger); }

.meter { height: 10px; border-radius: 999px; background: var(--track); margin: 14px 0 8px; overflow: hidden; }
.meter-fill { height: 100%; width: 0; border-radius: 999px; background: var(--primary); transition: width 0.5s ease; }
.meter-fill.over { background: var(--danger); }
.meter.thin { height: 6px; margin: 0; }
.sum-goal { font-size: 13px; color: var(--text-3); }

.macro-bar { display: flex; gap: 2px; height: 8px; margin: 16px 0 12px; border-radius: 999px; }
.macro-bar.empty { background: var(--track); }
.macro-seg { min-width: 4px; border-radius: 2px; }
.macro-seg:first-child { border-top-left-radius: 999px; border-bottom-left-radius: 999px; }
.macro-seg:last-child { border-top-right-radius: 999px; border-bottom-right-radius: 999px; }
.m-carbs { background: var(--macro-carbs); }
.m-protein { background: var(--macro-protein); }
.m-fat { background: var(--macro-fat); }
.macro-legend { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.macro-legend li { display: grid; grid-template-columns: 10px 1fr; column-gap: 6px; align-items: center; }
.swatch { width: 10px; height: 10px; border-radius: 3px; }
.m-name { font-size: 12px; color: var(--text-2); }
.m-val { grid-column: 2; font-size: 16px; font-weight: 600; }
.m-val small { font-size: 12px; font-weight: 400; color: var(--text-3); margin-left: 4px; }

/* ========== 餐次与记录 ========== */

.meal-card { padding: 14px 14px 6px; }
.meal-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0 2px 10px; }
.meal-head h3 { font-size: 16px; }
.meal-head span { font-size: 14px; color: var(--text-2); font-weight: 500; }
.photo-strip { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 8px; scrollbar-width: none; }
.photo-strip::-webkit-scrollbar { display: none; }
.meal-photo {
  width: 104px; height: 104px; flex: none; object-fit: cover;
  border-radius: 12px; background: var(--surface-3); cursor: zoom-in;
}
.items { list-style: none; }
.item + .item { border-top: 1px solid var(--border); }
.item-main {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  border: none; background: none; padding: 10px 2px; min-height: 52px;
}
.item-text { flex: 1; min-width: 0; }
.item-name { display: block; font-size: 15px; font-weight: 500; }
.item-meta { display: block; font-size: 12px; color: var(--text-3); margin-top: 1px; }
.item-kcal { font-size: 15px; font-weight: 600; white-space: nowrap; }
.item-detail { font-size: 12px; color: var(--text-2); padding: 0 2px 10px; }
.item-actions { display: flex; gap: 8px; padding: 0 2px 12px; }
.item-actions .btn { flex: 1; }
.item .food-card { box-shadow: none; background: var(--surface-2); margin: 0 0 12px; }

.meal-flat { margin-top: 8px; }
.meal-flat .meal-head { margin: 4px 2px 2px; }
.meal-flat .meal-head h3 { font-size: 13px; color: var(--text-3); font-weight: 600; }
.meal-flat .meal-head span { font-size: 13px; color: var(--text-3); }

/* ========== 历史 ========== */

.chart-card { padding-bottom: 12px; }
.chart { display: grid; grid-template-columns: 38px 1fr; }
.chart-y { position: relative; height: 168px; }
.chart-y span {
  position: absolute; right: 6px; transform: translateY(50%);
  font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums;
}
.chart-plot { position: relative; height: 168px; }
.grid-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--grid); }
.grid-line.base { background: var(--axis); }
.goal-line { position: absolute; left: 0; right: 0; height: 0; border-top: 1.5px solid var(--text-3); z-index: 2; pointer-events: none; }
.chart-key { display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: 12px; color: var(--text-2); margin: -4px 0 10px; }
.chart-key i { width: 16px; height: 0; border-top: 1.5px solid var(--text-3); }
.cols { position: absolute; inset: 0; display: flex; }
.col {
  flex: 1; position: relative; border: none; background: none; padding: 0;
  display: flex; align-items: flex-end; justify-content: center;
}
.col:hover, .col:focus-visible { background: var(--surface-2); outline: none; }
.bar {
  width: 60%; max-width: 24px; background: var(--primary);
  border-radius: 4px 4px 0 0; transition: height 0.4s ease;
}
.col:hover .bar, .col:focus-visible .bar { filter: brightness(1.12); }
.bar-label {
  position: absolute; left: 50%; transform: translate(-50%, -4px);
  font-size: 11px; font-weight: 600; color: var(--text); white-space: nowrap;
  background: var(--surface); padding: 0 2px; border-radius: 3px; z-index: 3;
}
.chart-x { grid-column: 2; display: flex; margin-top: 6px; }
.chart-x span { flex: 1; text-align: center; font-size: 11px; color: var(--text-3); }
.chart-x span.today { color: var(--text); font-weight: 600; }
.chart-tip {
  position: absolute; z-index: 5; transform: translate(-50%, calc(-100% - 8px));
  background: var(--text); color: var(--surface); border-radius: 8px;
  padding: 6px 10px; font-size: 12px; white-space: nowrap; pointer-events: none;
}
.chart-tip b { display: block; font-size: 14px; }
.chart-tip.edge-left { transform: translate(-16%, calc(-100% - 8px)); }
.chart-tip.edge-right { transform: translate(-84%, calc(-100% - 8px)); }

.day-card { padding: 0; overflow: hidden; }
.day-head {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  border: none; background: none; padding: 14px 16px 10px;
}
.day-title { flex: 1; }
.day-title b { font-size: 15px; font-weight: 600; }
.day-title small { font-size: 12px; color: var(--text-3); margin-left: 6px; }
.day-kcal { font-size: 15px; font-weight: 600; white-space: nowrap; }
.day-kcal small { font-size: 12px; font-weight: 400; color: var(--text-3); }
.chev { width: 18px; height: 18px; fill: none; stroke: var(--text-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s; }
.day-card.open .chev { transform: rotate(90deg); }
.day-meter { padding: 0 16px 14px; }
.day-body { padding: 0 14px 6px; border-top: 1px solid var(--border); }
.over-tag { color: var(--danger); font-size: 12px; font-weight: 600; margin-left: 4px; }

/* ========== 好友 ========== */

.friend-row {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.avatar {
  width: 52px; height: 52px; flex: none; border-radius: 16px; overflow: hidden;
  background: var(--primary-soft); color: var(--primary-ink);
  font-size: 20px; font-weight: 600; display: flex; align-items: center; justify-content: center;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.f-main { flex: 1; min-width: 0; }
.f-name { font-size: 16px; font-weight: 600; }
.f-sub { font-size: 13px; color: var(--text-3); margin: 1px 0 8px; }
.friend-row .chev { flex: none; }

.code-box { margin-top: 14px; }
.code-big {
  text-align: center; font-family: var(--mono); font-size: 30px; font-weight: 700;
  letter-spacing: 5px; margin: 4px 0 12px;
}
.code-box .input { margin-bottom: 10px; }
.code-box .fine-print { margin-bottom: 0; }

.date-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: -4px 0 14px; font-size: 15px; font-weight: 500;
}
#btn-remove-friend { margin-top: 20px; }

/* ========== 我的 & 管理 ========== */

.profile { display: flex; align-items: center; gap: 14px; }
.profile-name { font-size: 20px; font-weight: 600; margin-bottom: 2px; }
#btn-logout { margin-top: 24px; }

.password-form { margin-top: 14px; }
.temp-pw {
  display: flex; align-items: center; gap: 10px; margin: 0 2px 12px; padding: 10px 12px;
  border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn-ink); font-size: 13px;
}
.temp-pw b { font-family: var(--mono); font-size: 17px; letter-spacing: 1px; color: var(--text); }
.temp-pw .grow { flex: 1; min-width: 0; }
.plain-list li.has-extra { flex-wrap: wrap; }
.plain-list li.has-extra .temp-pw { flex-basis: 100%; margin: 10px 0 0; }

.list-title { font-size: 13px; font-weight: 600; color: var(--text-3); margin: 20px 2px 4px; }
.plain-list { list-style: none; }
.plain-list li { display: flex; align-items: center; gap: 10px; padding: 12px 2px; }
.plain-list li + li { border-top: 1px solid var(--border); }
.li-main { flex: 1; min-width: 0; }
.li-title { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.li-title.mono { font-family: var(--mono); letter-spacing: 1px; }
.li-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.li-actions { display: flex; gap: 6px; flex: none; }
.plain-list .empty-li { color: var(--text-3); font-size: 13px; justify-content: center; }

/* ========== 底部导航 ========== */

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; height: var(--tabbar-h); border: none; background: none; color: var(--text-3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab span { font-size: 11px; }
.tab.active { color: var(--primary); }
.tab.active span { font-weight: 600; }

/* ========== 浮层 ========== */

.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.9);
  display: flex; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  transform: translateX(-50%); z-index: 99; max-width: calc(100vw - 48px);
  background: var(--text); color: var(--surface); font-size: 14px; text-align: center;
  padding: 10px 18px; border-radius: 999px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

@media (min-width: 600px) {
  .tabbar { justify-content: center; }
  .tab { flex: 0 0 104px; }
}
