/* =========================================================
   御膳房 · 点餐小程序样式
   移动端优先，单页无依赖
   ========================================================= */

:root {
  --bg: #f4efe4;
  --paper: #fbf8f0;
  --card: #fffdf8;
  --ink: #23301f;
  --ink-soft: #4b5544;
  --muted: #898b7b;
  --line: rgba(41, 54, 33, 0.11);
  --green: #1f4a34;
  --green-2: #2b6446;
  --green-soft: #e7efe2;
  --orange: #c96232;
  --orange-deep: #a94d23;
  --orange-soft: #f8e7d6;
  --gold: #c9a15b;
  --serif: "Songti SC", "Noto Serif CJK SC", "Noto Serif SC", "STSong", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC",
    "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --shadow: 0 1px 2px rgba(36, 48, 31, 0.04), 0 14px 34px -22px rgba(36, 48, 31, 0.38);
  --sheet-shadow: 0 -18px 60px rgba(21, 34, 23, 0.22);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 252, 242, 0.9), transparent 32%),
    radial-gradient(circle at 84% 78%, rgba(217, 197, 160, 0.28), transparent 36%),
    #e8e1d2;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

img, svg { display: block; }
p, h1, h2, h3, h4, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
body.locked { overflow: hidden; }

::selection { background: #f0d3ae; color: var(--ink); }

.page-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.5;
  background-image: radial-gradient(rgba(57, 66, 47, 0.13) 0.55px, transparent 0.55px);
  background-size: 7px 7px;
}

.app {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  overflow: clip;
}

/* ---------------- 顶栏 ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: rgba(244, 239, 228, 0.88);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid rgba(41, 54, 33, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  border-radius: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  flex: none;
  border-radius: 13px 13px 13px 5px;
  background: var(--green);
  color: #f7e9c9;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 245, 216, 0.18), 0 6px 12px -8px rgba(20, 44, 29, 0.7);
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong {
  font-family: var(--serif);
  font-size: 16.5px;
  letter-spacing: 0.3px;
  line-height: 1.25;
  white-space: nowrap;
}
.brand-text small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.7px;
  white-space: nowrap;
}

.top-actions { display: flex; align-items: center; gap: 7px; flex: none; }

.orders-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.72);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
.orders-btn:active { transform: scale(0.97); }
.orders-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.order-dot {
  position: absolute;
  top: 5px;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 2px var(--bg);
}

.open-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.open-pill i, .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #4e865a;
  box-shadow: 0 0 0 3px rgba(78, 134, 90, 0.13);
}

/* ---------------- 连接提示 ---------------- */

.server-banner {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 8px 16px 0;
  padding: 9px 11px;
  border: 1px solid rgba(201, 98, 50, 0.16);
  border-radius: 11px;
  background: var(--orange-soft);
  color: #8a532f;
  font-size: 10px;
  line-height: 1.4;
}
.server-banner-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--orange);
}
.server-banner span:nth-child(2) { flex: 1; }
.server-banner button {
  flex: none;
  padding: 3px 7px;
  border: 1px solid rgba(169, 77, 35, 0.25);
  border-radius: 5px;
  background: transparent;
  color: var(--orange-deep);
  font-size: 9px;
  font-weight: 600;
}

/* ---------------- 首页 Hero ---------------- */

.hero {
  position: relative;
  margin: 8px 16px 0;
  padding: 23px 20px 16px;
  min-height: 216px;
  overflow: hidden;
  border-radius: 26px;
  color: #f7f0df;
  background:
    radial-gradient(circle at 88% 6%, rgba(233, 196, 126, 0.14), transparent 34%),
    linear-gradient(145deg, #27543b 0%, #1c452f 55%, #163a28 100%);
  box-shadow: 0 18px 32px -26px rgba(21, 48, 32, 0.9);
  isolation: isolate;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.16;
  background-image: radial-gradient(rgba(255, 246, 222, 0.7) 0.5px, transparent 0.5px);
  background-size: 5px 5px;
}

.hero-ring {
  position: absolute;
  right: -46px;
  bottom: -76px;
  width: 214px;
  height: 214px;
  border: 1px solid rgba(238, 207, 149, 0.2);
  border-radius: 50%;
  box-shadow: 0 0 0 18px rgba(238, 207, 149, 0.035), inset 0 0 0 24px rgba(238, 207, 149, 0.025);
}

.hero-copy { position: relative; z-index: 2; width: 74%; }

.eyebrow {
  margin-bottom: 10px;
  color: #d9c093;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 2.3px;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(29px, 8.4vw, 36px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 1px;
}
.hero h1 em {
  color: #efce97;
  font-style: normal;
  position: relative;
}
.hero h1 em::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 0;
  bottom: 1px;
  height: 5px;
  border-radius: 50%;
  background: rgba(201, 161, 91, 0.34);
  transform: rotate(-1.2deg);
}

.hero-sub {
  margin-top: 9px;
  color: rgba(247, 240, 223, 0.66);
  font-size: 11.5px;
  letter-spacing: 0.4px;
}

.hero-bowl {
  position: absolute;
  right: 6px;
  top: 42px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 94px;
  height: 94px;
  border-radius: 50%;
  border: 1px solid rgba(247, 231, 198, 0.16);
  background: radial-gradient(circle at 35% 28%, rgba(255, 248, 229, 0.18), rgba(255, 248, 229, 0.04) 62%, transparent 63%);
  box-shadow: inset 0 0 0 7px rgba(247, 231, 198, 0.035);
  transform: rotate(4deg);
}
.bowl-emoji {
  font-size: 49px;
  line-height: 1;
  filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.22));
  transform: translateY(2px);
}

.steam {
  position: absolute;
  top: 5px;
  width: 9px;
  height: 23px;
  border-radius: 50%;
  border-left: 1.5px solid rgba(250, 240, 215, 0.42);
  opacity: 0;
  animation: steam 3.4s ease-in-out infinite;
}
.steam-a { left: 35px; animation-delay: 0.3s; }
.steam-b { left: 46px; height: 28px; animation-delay: 1.3s; }
.steam-c { left: 57px; animation-delay: 2.2s; }

@keyframes steam {
  0% { opacity: 0; transform: translateY(6px) rotate(-4deg) scaleX(0.8); }
  35% { opacity: 0.7; }
  80% { opacity: 0; transform: translateY(-11px) rotate(8deg) scaleX(1.2); }
  100% { opacity: 0; }
}

.hero-foot {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding-top: 11px;
  border-top: 1px solid rgba(247, 231, 198, 0.14);
  color: rgba(247, 240, 223, 0.55);
  font-size: 9.5px;
  letter-spacing: 0.3px;
}
.hero-foot .dot { background: #9fce9f; box-shadow: 0 0 0 3px rgba(159, 206, 159, 0.1); }
.hero-divider { width: 1px; height: 9px; background: rgba(247, 231, 198, 0.18); }

.hero-stamp {
  margin-left: auto;
  padding: 3px 7px;
  border: 1px solid rgba(226, 185, 115, 0.46);
  border-radius: 4px;
  color: #e0bd83;
  font-family: var(--serif);
  font-size: 9.5px;
  letter-spacing: 2px;
  transform: rotate(-4deg);
}

/* ---------------- 用餐方式 ---------------- */

.order-mode { margin: 14px 16px 0; }

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 5px;
  border-radius: 19px;
  background: #e9e2d4;
  border: 1px solid rgba(41, 54, 33, 0.05);
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 9px 10px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.mode-btn .mode-ico { font-size: 20px; filter: grayscale(0.55); opacity: 0.75; }
.mode-btn span:last-child { display: flex; flex-direction: column; min-width: 0; }
.mode-btn b { font-size: 12.5px; font-weight: 700; line-height: 1.3; white-space: nowrap; }
.mode-btn small { margin-top: 1px; font-size: 9px; color: inherit; opacity: 0.72; white-space: nowrap; }

.mode-btn.is-active {
  background: var(--card);
  color: var(--green);
  box-shadow: 0 2px 7px rgba(55, 66, 44, 0.08);
}
.mode-btn.is-active .mode-ico { filter: none; opacity: 1; }

.mode-hint {
  margin: 7px 4px 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

/* ---------------- 优惠条 ---------------- */

.promo {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 16px 0;
  padding: 11px 14px;
  overflow: hidden;
  border: 1px solid rgba(201, 98, 50, 0.14);
  border-radius: 15px;
  background: linear-gradient(100deg, #f8e9d6, #f5e0c7);
}
.promo-tag {
  flex: none;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--orange);
  color: #fff8ed;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.promo p { color: #8a532f; font-size: 11px; letter-spacing: 0.2px; }
.promo p b { color: var(--orange-deep); font-size: 12px; }
.promo-brush {
  position: absolute;
  right: 10px;
  top: -12px;
  color: rgba(180, 93, 45, 0.09);
  font-family: var(--serif);
  font-size: 58px;
  font-weight: 700;
  transform: rotate(8deg);
}

/* ---------------- 菜单 ---------------- */

.menu-layout {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: start;
  margin-top: 17px;
}

.cats {
  position: sticky;
  top: calc(62px + env(safe-area-inset-top, 0px));
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: calc(100dvh - 78px - env(safe-area-inset-top, 0px));
  padding: 0 4px 20px 9px;
  overflow-y: auto;
  scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }

.cat-btn {
  position: relative;
  width: 100%;
  min-height: 43px;
  padding: 7px 4px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.1px;
  white-space: nowrap;
  transition: color 0.16s ease, background 0.16s ease;
}
.cat-btn::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 50%;
  width: 3px;
  height: 0;
  border-radius: 3px;
  background: var(--orange);
  transform: translateY(-50%);
  transition: height 0.18s ease;
}
.cat-btn.is-active {
  background: var(--card);
  color: var(--green);
  font-weight: 700;
  box-shadow: 0 3px 10px -6px rgba(38, 54, 34, 0.35);
}
.cat-btn.is-active::before { height: 15px; }
.cat-btn small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0.2px;
}

.sections { min-width: 0; padding: 0 14px 0 5px; }

.cat-section { margin-bottom: 21px; scroll-margin-top: 72px; }

.section-head {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 0 2px 9px;
}
.section-head h2 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.2;
}
.section-head .section-note {
  padding-bottom: 2px;
  color: var(--muted);
  font-size: 8.5px;
  letter-spacing: 0.5px;
}
.section-head .section-count {
  margin-left: auto;
  padding-bottom: 3px;
  color: #a3a292;
  font-size: 8.5px;
  letter-spacing: 0.6px;
}

.dish {
  position: relative;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 11px;
  padding: 10px;
  margin-bottom: 9px;
  border: 1px solid rgba(41, 54, 33, 0.07);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.dish.in-cart { border-color: rgba(31, 74, 52, 0.22); }
.dish.in-cart::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--orange);
}

.dish-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  overflow: hidden;
  border-radius: 14px;
  font-size: 40px;
  line-height: 1;
}
.dish-art::before {
  content: "";
  position: absolute;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 50%;
  box-shadow: 0 8px 14px -10px rgba(64, 46, 24, 0.35) inset;
}
.dish-art::after {
  content: "";
  position: absolute;
  inset: auto -12px -20px auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}
.dish-art span {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 7px 7px rgba(75, 54, 25, 0.19));
  transition: transform 0.2s ease;
}
.dish:active .dish-art span { transform: scale(0.94); }

.tone-tomato { background: linear-gradient(140deg, #f9ddcc, #efb49c); }
.tone-green { background: linear-gradient(140deg, #e5f0dc, #c4ddb9); }
.tone-amber { background: linear-gradient(140deg, #f8e9c9, #ebcd97); }
.tone-sand { background: linear-gradient(140deg, #f4ead7, #e4cda9); }
.tone-chestnut { background: linear-gradient(140deg, #ecd7c7, #d7ab8f); }
.tone-blue { background: linear-gradient(140deg, #e0edeb, #c1dad5); }
.tone-ink { background: linear-gradient(140deg, #e5e6dd, #c6c9ba); }
.tone-rice { background: linear-gradient(140deg, #f7f2e7, #e8ddc5); }

.dish-body { display: flex; flex-direction: column; min-width: 0; padding: 1px 0 0; }

.dish-title { display: flex; align-items: center; gap: 5px; min-width: 0; padding-right: 8px; }
.dish-title h3 {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.badge {
  flex: none;
  padding: 1.5px 4px;
  border-radius: 4px;
  background: var(--orange-soft);
  color: var(--orange-deep);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.4;
}
.badge.badge-green { background: var(--green-soft); color: var(--green-2); }

.dish-desc {
  display: -webkit-box;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dish-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 4px; }
.dish-tag {
  padding: 1px 4px;
  border-radius: 3px;
  background: #f3efe4;
  color: #96927f;
  font-size: 8px;
  line-height: 1.5;
}
.spice { color: #c4693d; font-size: 9px; letter-spacing: -0.5px; }

.dish-buy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
  padding-top: 5px;
}
.dish-portion { color: #a3a18f; font-size: 9px; letter-spacing: 0.2px; }

.stepper {
  display: flex;
  align-items: center;
  flex: none;
  gap: 1px;
}
.step-btn {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font-size: 17px;
  line-height: 1;
}
.step-btn.plus { background: var(--green); color: #f8f2e3; box-shadow: 0 4px 9px -5px rgba(25, 64, 41, 0.9); }
.step-btn.plus:active { background: var(--green-2); transform: scale(0.92); }
.step-btn.minus { border: 1px solid rgba(41, 54, 33, 0.17); background: transparent; color: var(--ink-soft); }
.step-btn.minus:active { background: #f0ebdf; }
.step-qty {
  min-width: 21px;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.stepper:not(.has-qty) .step-btn.minus,
.stepper:not(.has-qty) .step-qty { display: none; }

.menu-loading, .menu-empty {
  padding: 42px 16px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
  text-align: center;
}
.menu-loading::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  margin: 0 auto 10px;
  border: 1.5px solid rgba(41, 54, 33, 0.15);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spinMenu 0.8s linear infinite;
}
@keyframes spinMenu { to { transform: rotate(360deg); } }

.kitchen-note {
  padding: 10px 16px 22px;
  text-align: center;
}
.note-line {
  width: 30px;
  height: 1px;
  margin: 0 auto 13px;
  background: rgba(41, 54, 33, 0.22);
}
.kitchen-note p {
  color: #747764;
  font-family: var(--serif);
  font-size: 12.5px;
  line-height: 1.8;
  letter-spacing: 0.8px;
}
.kitchen-note small {
  display: block;
  margin-top: 7px;
  color: #a3a18f;
  font-size: 8.5px;
  letter-spacing: 1px;
}

.menu-bottom-space { height: calc(92px + var(--safe-bottom)); }

/* ---------------- 底部购物车 ---------------- */

.cartdock {
  position: fixed;
  bottom: calc(12px + var(--safe-bottom));
  left: 50%;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(calc(100% - 24px), 456px);
  padding: 8px;
  border: 1px solid rgba(255, 248, 232, 0.08);
  border-radius: 22px;
  color: #f7f1df;
  background: linear-gradient(135deg, #234d36, #173d29);
  box-shadow: 0 16px 34px -16px rgba(22, 47, 31, 0.7), inset 0 1px 0 rgba(255, 250, 234, 0.09);
  transform: translateX(-50%);
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.cartdock.is-hidden { pointer-events: none; opacity: 0; transform: translate(-50%, 16px); }

.cart-pill {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: 15px;
  background: #f3ead6;
  color: var(--green);
}
.cart-pill svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cart-pill:active { transform: scale(0.96); }
.cart-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--orange);
  color: #fff8ed;
  font-size: 9px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px #1d4630;
}
.cart-badge.is-empty { display: none; }

.cart-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}
.cart-copy span {
  width: 100%;
  overflow: hidden;
  color: rgba(247, 241, 223, 0.62);
  font-size: 9.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cart-copy strong {
  margin-top: 1px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
  line-height: 1.2;
}

.checkout-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 44px;
  padding: 0 14px;
  flex: none;
  border: 0;
  border-radius: 15px;
  background: var(--orange);
  color: #fff9ee;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow: 0 7px 16px -9px rgba(160, 67, 26, 0.9);
  transition: background 0.16s ease, opacity 0.2s ease;
}
.checkout-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.checkout-btn:active { background: var(--orange-deep); transform: scale(0.98); }
.checkout-btn:disabled { opacity: 0.42; box-shadow: none; cursor: default; }
.checkout-btn:disabled:active { transform: none; background: var(--orange); }

/* ---------------- 子页面通用 ---------------- */

.page-view { min-height: 100dvh; background: var(--bg); }

.subbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: calc(58px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 16px 0;
  background: rgba(244, 239, 228, 0.9);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  border-bottom: 1px solid rgba(41, 54, 33, 0.06);
}
.subbar h2 {
  position: absolute;
  left: 50%;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.8px;
  transform: translateX(-50%);
  white-space: nowrap;
}
.subbar-side {
  margin-left: auto;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.8px;
}
.round-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.68);
  color: var(--ink);
}
.round-btn:active { background: var(--card); }
.round-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------------- 确认订单 ---------------- */

.checkout-body {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 13px 16px calc(112px + var(--safe-bottom));
}

.panel {
  padding: 15px;
  border: 1px solid rgba(41, 54, 33, 0.08);
  border-radius: 19px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.panel-head h3 {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.4px;
}
.panel-note { color: var(--muted); font-size: 9px; letter-spacing: 0.4px; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: #f1ebdf;
}
.seg-btn {
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.18s ease;
}
.seg-btn.is-active {
  background: var(--green);
  color: #f8f1de;
  box-shadow: 0 4px 9px -6px rgba(23, 57, 37, 0.85);
}

.field { margin-top: 14px; }
.field > label, .field-label-second {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.field-label-second { margin-top: 12px; }
.field-label-second span { color: var(--muted); font-weight: 400; font-size: 9px; }
.field-help { margin-top: 6px; color: #a09e8c; font-size: 9px; line-height: 1.5; }

.input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(41, 54, 33, 0.09);
  border-radius: 11px;
  background: #f7f3e9;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.input-wrap:focus-within { border-color: rgba(31, 74, 52, 0.45); background: #fffdf8; }
.input-wrap input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}
.input-wrap input::placeholder, .note-input::placeholder { color: #b0ad9b; }
.input-suffix { flex: none; color: var(--muted); font-size: 11px; }
.input-wrap.is-error { border-color: #c9583f; background: #fdf1ed; }
.field-error { margin-top: 5px; color: #b44830; font-size: 9.5px; }

.checkout-items { display: flex; flex-direction: column; }
.checkout-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  border-bottom: 1px dashed rgba(41, 54, 33, 0.09);
}
.checkout-item:last-child { border-bottom: 0; }
.checkout-item-emoji {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #f4efe3;
  font-size: 20px;
}
.checkout-item-info { min-width: 0; }
.checkout-item-info b {
  display: block;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.checkout-item-info small { display: block; margin-top: 1px; color: var(--muted); font-size: 9px; }
.checkout-item-qty {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.add-more {
  width: 100%;
  height: 34px;
  margin-top: 7px;
  border: 1px dashed rgba(41, 54, 33, 0.2);
  border-radius: 9px;
  background: transparent;
  color: var(--green-2);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
}
.add-more:active { background: var(--green-soft); }

.note-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.note-chip {
  padding: 6px 10px;
  border: 1px solid rgba(41, 54, 33, 0.12);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  transition: all 0.16s ease;
}
.note-chip.is-active {
  border-color: rgba(31, 74, 52, 0.34);
  background: var(--green-soft);
  color: var(--green);
  font-weight: 600;
}
.note-input {
  display: block;
  width: 100%;
  margin-top: 9px;
  padding: 10px 11px;
  border: 1px solid rgba(41, 54, 33, 0.09);
  border-radius: 11px;
  background: #f7f3e9;
  font-size: 11.5px;
  line-height: 1.55;
  resize: none;
  outline: 0;
}
.note-input:focus { border-color: rgba(31, 74, 52, 0.45); background: #fffdf8; }

.checkout-tip {
  padding: 0 4px;
  color: #a3a18f;
  font-size: 9px;
  line-height: 1.6;
  text-align: center;
}

.checkout-dock {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(100%, 480px);
  padding: 10px 16px calc(10px + var(--safe-bottom));
  border-top: 1px solid rgba(41, 54, 33, 0.08);
  background: rgba(251, 248, 240, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transform: translateX(-50%);
  box-shadow: 0 -12px 28px -24px rgba(30, 43, 26, 0.45);
}
.dock-total { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.dock-total span { color: var(--muted); font-size: 9px; letter-spacing: 0.3px; }
.dock-total strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.dock-total small { color: var(--muted); font-size: 8.5px; }
.primary-btn {
  height: 46px;
  padding: 0 26px;
  flex: none;
  border: 0;
  border-radius: 14px;
  background: var(--orange);
  color: #fff9ee;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 9px 18px -10px rgba(160, 67, 26, 0.9);
  transition: background 0.16s ease, transform 0.16s ease;
}
.primary-btn:active { background: var(--orange-deep); transform: scale(0.98); }
.primary-btn:disabled { opacity: 0.45; cursor: default; box-shadow: none; }

/* ---------------- 订单页 ---------------- */

.orders-body { display: flex; flex-direction: column; gap: 11px; padding: 14px 16px 36px; }

.order-card {
  padding: 15px;
  border: 1px solid rgba(41, 54, 33, 0.08);
  border-radius: 19px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.order-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}
.order-no { font-family: var(--serif); font-size: 14px; font-weight: 700; letter-spacing: 0.6px; }
.order-time { margin-top: 3px; color: var(--muted); font-size: 9px; letter-spacing: 0.2px; }
.order-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-2);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
}
.order-status i { width: 5px; height: 5px; border-radius: 50%; background: #4e865a; }
.order-status.status-pending { background: var(--orange-soft); color: var(--orange-deep); }
.order-status.status-pending i { background: var(--orange); }
.order-status.status-preparing { background: var(--green-soft); color: var(--green-2); }
.order-status.status-completed { background: #efede4; color: #8f9181; }
.order-status.status-completed i { background: #9b9d8e; }
.order-status.status-cancelled { background: #f8e4de; color: #b44830; }
.order-status.status-cancelled i { background: #b44830; }
.order-items {
  padding: 9px 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.75;
}
.order-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.order-total { color: var(--muted); font-size: 10px; }
.reorder-btn {
  height: 32px;
  padding: 0 13px;
  border: 1px solid rgba(31, 74, 52, 0.24);
  border-radius: 999px;
  background: transparent;
  color: var(--green-2);
  font-size: 10px;
  font-weight: 600;
}
.reorder-btn:active { background: var(--green-soft); }

.empty-orders {
  padding: 56px 20px 30px;
  text-align: center;
}
.empty-bowl {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  margin: 0 auto 17px;
  border-radius: 50%;
  background: #ede6d7;
  font-size: 39px;
  filter: saturate(0.7);
}
.empty-orders h3 { font-family: var(--serif); font-size: 18px; letter-spacing: 0.5px; }
.empty-orders p { margin-top: 7px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.empty-orders .primary-btn { margin-top: 20px; height: 42px; }

/* ---------------- 弹层 ---------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.overlay-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(20, 30, 20, 0.46);
  backdrop-filter: blur(2.5px);
  -webkit-backdrop-filter: blur(2.5px);
  animation: fadeIn 0.2s ease both;
}
.sheet {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  max-height: 89dvh;
  padding: 7px 18px calc(16px + var(--safe-bottom));
  overflow-y: auto;
  border-radius: 27px 27px 0 0;
  background: var(--paper);
  box-shadow: var(--sheet-shadow);
  animation: slideUp 0.3s cubic-bezier(0.22, 0.85, 0.3, 1) both;
  overscroll-behavior: contain;
}
.sheet-handle {
  width: 34px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 99px;
  background: rgba(41, 54, 33, 0.16);
}
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.sheet-kicker {
  margin-bottom: 3px;
  color: var(--gold);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 2px;
}
.sheet-head h2, .success-sheet h2 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.6px;
}
.sheet-head-actions { display: flex; align-items: center; gap: 8px; padding-top: 2px; }
.text-btn {
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.close-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
}
.close-btn svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.cart-count-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 13px 0 4px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
}
.cart-count-line span:last-child { color: var(--green-2); }

.cart-list { max-height: 42dvh; overflow-y: auto; }
.cart-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.cart-row:last-child { border-bottom: 0; }
.cart-emoji {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #f2ecdf;
  font-size: 24px;
}
.cart-info { min-width: 0; }
.cart-info b {
  display: block;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cart-info small { display: block; margin-top: 2px; color: var(--muted); font-size: 9.5px; }
.cart-row .stepper { gap: 2px; }
.cart-row .step-btn { width: 24px; height: 24px; }
.cart-row .step-qty { min-width: 18px; font-size: 12px; }

.cart-empty { padding: 30px 0 26px; text-align: center; }
.cart-empty span { display: block; margin-bottom: 7px; font-size: 32px; filter: saturate(0.6); }
.cart-empty p { color: var(--muted); font-size: 11px; }
.cart-empty .add-more { max-width: 170px; margin: 14px auto 0; border-style: solid; }

.cart-sheet-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.cart-foot-total { display: flex; flex-direction: column; flex: 1; }
.cart-foot-total span { color: var(--muted); font-size: 9px; }
.cart-foot-total strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.cart-foot-total small { color: var(--muted); font-size: 8.5px; }
.cart-sheet-foot .primary-btn { height: 44px; padding: 0 25px; }

/* ---------------- 下单成功 ---------------- */

.success-sheet {
  padding-top: 24px;
  overflow: hidden;
  text-align: center;
}
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute;
  display: block;
  width: 5px;
  height: 9px;
  border-radius: 2px;
  opacity: 0.65;
  animation: confetti 2.6s ease-out both;
}
.confetti i:nth-child(1) { left: 14%; top: 8%; background: #d99458; transform: rotate(22deg); animation-delay: 0.05s; }
.confetti i:nth-child(2) { left: 26%; top: 2%; background: #7da27d; transform: rotate(-15deg); animation-delay: 0.2s; }
.confetti i:nth-child(3) { right: 18%; top: 6%; background: #dfb979; transform: rotate(40deg); animation-delay: 0.1s; }
.confetti i:nth-child(4) { right: 28%; top: 19%; background: #b4c5a6; transform: rotate(-24deg); animation-delay: 0.3s; }
.confetti i:nth-child(5) { left: 44%; top: 3%; background: #d18162; transform: rotate(70deg); animation-delay: 0.16s; }

.success-check {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin: 0 auto 13px;
  border-radius: 50%;
  background: var(--green);
  color: #f7ebcf;
  box-shadow: 0 0 0 7px var(--green-soft), 0 14px 22px -16px rgba(23, 58, 38, 0.9);
}
.success-check svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.success-sheet .sheet-kicker { margin: 11px 0 4px; }
.success-sub { margin-top: 6px; color: var(--muted); font-size: 10.5px; }

.receipt {
  margin: 15px 0 14px;
  padding: 12px 13px;
  border: 1px dashed rgba(41, 54, 33, 0.19);
  border-radius: 12px;
  background: #f6f1e5;
  text-align: left;
}
.receipt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  color: var(--muted);
  font-size: 10px;
}
.receipt-row b { color: var(--ink); font-size: 11px; font-weight: 600; letter-spacing: 0.3px; }
.receipt-row #successNo { font-family: var(--serif); font-size: 17px; letter-spacing: 1.5px; }

.success-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.ghost-btn {
  height: 44px;
  border: 1px solid rgba(41, 54, 33, 0.17);
  border-radius: 13px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}
.ghost-btn:active { background: #f1ecdf; }
.success-actions .primary-btn { height: 44px; padding: 0; }
.success-note { margin-top: 10px; color: #a3a18f; font-size: 8.5px; }

/* ---------------- 提示 ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + var(--safe-bottom));
  z-index: 150;
  max-width: calc(100% - 48px);
  padding: 9px 15px;
  border-radius: 999px;
  background: rgba(30, 46, 30, 0.94);
  color: #f7f0de;
  font-size: 11px;
  letter-spacing: 0.1px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 动画 ---------------- */

@keyframes slideUp {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes confetti {
  0% { opacity: 0; transform: translateY(-12px) rotate(0deg); }
  20% { opacity: 0.7; }
  100% { opacity: 0.2; transform: translateY(180px) rotate(180deg); }
}
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.cart-badge.bump { animation: pop 0.28s ease; }

/* ---------------- 小屏适配 ---------------- */

@media (max-width: 374px) {
  .topbar { padding-left: 13px; padding-right: 13px; }
  .open-pill { display: none; }
  .hero { margin-left: 13px; margin-right: 13px; padding-left: 17px; padding-right: 17px; }
  .hero-copy { width: 78%; }
  .hero h1 { font-size: 28px; }
  .hero-bowl { right: 0; top: 47px; width: 80px; height: 80px; }
  .bowl-emoji { font-size: 42px; }
  .hero-foot { left: 17px; right: 17px; font-size: 8.5px; gap: 6px; }
  .hero-stamp { display: none; }
  .order-mode, .promo { margin-left: 13px; margin-right: 13px; }
  .mode-btn { padding-left: 8px; padding-right: 8px; gap: 6px; }
  .mode-btn b { font-size: 12px; }
  .mode-btn small { font-size: 8.5px; }
  .menu-layout { grid-template-columns: 68px minmax(0, 1fr); }
  .cats { padding-left: 6px; }
  .cat-btn { font-size: 11px; }
  .sections { padding-right: 11px; }
  .dish { grid-template-columns: 74px minmax(0, 1fr); gap: 9px; padding: 9px; }
  .dish-art { width: 74px; height: 74px; font-size: 35px; }
  .dish-title h3 { font-size: 13.5px; }
  .dish-desc { font-size: 10px; }
  .checkout-btn { padding: 0 11px; font-size: 12.5px; }
  .cartdock { gap: 6px; }
  .sheet { padding-left: 15px; padding-right: 15px; }
  .cart-row { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 7px; }
  .cart-emoji { width: 40px; height: 40px; font-size: 22px; }
}

@media (min-width: 560px) {
  body { padding: 18px 0; }
  .app {
    min-height: calc(100dvh - 36px);
    border-radius: 30px;
    box-shadow: 0 28px 80px -36px rgba(30, 42, 26, 0.55), 0 2px 8px rgba(30, 42, 26, 0.08);
  }
  .topbar { border-radius: 30px 30px 0 0; }
  .hero { border-radius: 26px; }
  .cartdock { bottom: 30px; }
  .page-view { min-height: calc(100dvh - 36px); border-radius: 30px; overflow: clip; }
  .checkout-dock { bottom: 18px; width: min(100%, 480px); border-radius: 0 0 30px 30px; }
  .sheet { border-radius: 27px; margin-bottom: 18px; max-height: calc(100dvh - 80px); }
  .toast { bottom: 104px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
