:root {
  --bg: #f3f0e8;
  --bg-elev: #fffcf7;
  --bg-sunken: #e8e2d6;
  --text: #17241e;
  --muted: #5c6d64;
  --line: #e3dcd0;
  --accent: #1b6b45;
  --accent-ink: #f4fff8;
  --accent-soft: #e3f2ea;
  --gold: #a9791c;
  --danger: #9d3b32;
  --shadow: 0 10px 28px rgba(23, 36, 30, 0.06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101815;
    --bg-elev: #18241e;
    --bg-sunken: #0c1411;
    --text: #e7f0ea;
    --muted: #93a79c;
    --line: #2c3d34;
    --accent: #8dceb0;
    --accent-ink: #10241b;
    --accent-soft: #1c3329;
    --gold: #e6b15a;
    --danger: #f0b0a8;
    --shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
    color-scheme: dark;
  }
  .ex-img { filter: invert(0.92); }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: #e5dfd3;
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Source Han Sans SC", "WenQuanYi Micro Hei", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
@media (prefers-color-scheme: dark) {
  body { background: #070c0a; }
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
[v-cloak] { display: none; }

.shell {
  width: min(520px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
}
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pad { padding: 4px 16px calc(168px + env(safe-area-inset-bottom)); }
.stack > .btn-ghost { width: 100%; }
.brand { font-weight: 700; letter-spacing: 0.04em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.stat {
  font-size: 32px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.card h2, .card h3 { margin: 0; font-size: 18px; font-weight: 700; }
.btn, .btn-ghost, .btn-quiet, .btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 14px;
  border: 0;
  font-weight: 650;
  font-weight: 600;
}
.btn { background: var(--accent); color: var(--accent-ink); width: 100%; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-quiet { background: var(--accent-soft); color: var(--accent); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
.btn:disabled, .btn-quiet:disabled { opacity: 0.45; }
.btn:active, .icon-btn:active, .chip:active, .tab:active { transform: scale(0.98); }
.icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: var(--bg-sunken);
  color: var(--text);
  font-size: 22px;
}
.text-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  min-height: 44px;
  padding: 0 8px;
}
.field, .field-line input, .field-line select {
  font-size: 16px;
}
.field {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-sunken);
  padding: 0 12px;
}
.field-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-sunken);
  padding: 0 12px;
}
.field-line input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  min-height: 44px;
  padding: 0;
}
.field:focus, .field-line:focus-within, .icon-btn:focus-visible, .btn:focus-visible, .tab:focus-visible, .chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.field-line input:focus { outline: none; }
.suffix { color: var(--muted); font-size: 13px; flex: none; }
label.lbl { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.err { color: var(--danger); min-height: 1.3em; font-size: 14px; margin: 8px 0 0; }
.meter { height: 8px; border-radius: 99px; background: var(--bg-sunken); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.meter.over > span { background: var(--gold); }
.chip {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  min-height: 40px;
  padding: 0 14px;
  flex: none;
}
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
.scroller { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.scroller::-webkit-scrollbar { display: none; }
.icon-tile {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  flex: none;
}
.ex-img { width: 32px; height: 32px; display: block; }
.star {
  border: 0;
  background: transparent;
  color: var(--line);
  font-size: 30px;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
}
.star.on { color: var(--gold); }
.seg { display: flex; padding: 4px; background: var(--bg-sunken); border-radius: 14px; gap: 4px; }
.seg button {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
}
.seg button.on { background: var(--bg-elev); color: var(--text); font-weight: 600; }
.tabbar {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(520px, 100%);
  display: flex;
  background: var(--bg-elev);
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  min-height: 58px;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
}
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--accent); font-weight: 700; }
.fab {
  position: fixed;
  z-index: 36;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  right: max(16px, calc(50vw - 260px + 16px));
  bottom: calc(4.6rem + env(safe-area-inset-bottom));
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 32px;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(20, 40, 30, 0.28);
}
.rest {
  position: fixed;
  z-index: 35;
  left: max(12px, calc(50vw - 260px + 12px));
  right: max(84px, calc(50vw - 260px + 84px));
  bottom: calc(4.55rem + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 16px;
  background: var(--text);
  color: var(--bg);
}
.rest .clock { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 700; margin-left: auto; }
.rest button {
  border: 0;
  background: transparent;
  color: inherit;
  min-height: 36px;
  padding: 0 6px;
  font-weight: 600;
}
.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(6.2rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(440px, calc(100% - 32px));
  background: var(--text);
  color: var(--bg);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
}
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(8, 14, 12, 0.48);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.backdrop.center { align-items: center; padding: 24px; }
.sheet, .dialog {
  width: min(520px, 100%);
  background: var(--bg-elev);
  color: var(--text);
}
.sheet {
  max-height: min(86dvh, 760px);
  overflow: auto;
  border-radius: 22px 22px 0 0;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
}
.dialog { width: min(400px, 100%); border-radius: 20px; padding: 20px; }
.grab { width: 40px; height: 4px; border-radius: 99px; background: var(--line); margin: 6px auto 12px; }
.menu-item {
  width: 100%;
  text-align: left;
  min-height: 52px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font-size: 16px;
}
.offline, .banner {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--gold-soft, var(--accent-soft));
  color: var(--text);
  font-size: 13px;
}
.set-row, .food-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
}
.num { font-variant-numeric: tabular-nums; }
.login-mark { width: 84px; height: 84px; border-radius: 22px; }
.chart-box { position: relative; height: 220px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
/* 这些类在 Tailwind 到达之前也要成立，避免首屏散开。 */
.min-h-dvh { min-height: 100dvh; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.w-full { width: 100%; }
.max-w-sm { max-width: 24rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.m-0 { margin: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mb-0 { margin-bottom: 0; }
.block { display: block; }
.text-3xl { font-size: 1.875rem; line-height: 1.15; }
.text-xl { font-size: 1.25rem; }
.text-lg { font-size: 1.125rem; }
.text-base { font-size: 1rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.h-0\.5 { height: 2px; background: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
