/* Petit Chats · 在线点单 */
:root {
  --cream: #F5F0E7;
  --paper: #FFFDF9;
  --ink: #33251F;
  --ink-2: #5A4636;
  --muted: #8B8178;
  --line: #E3D9C9;
  --accent: #B4794A;
  --accent-soft: #EFE2D2;
  --green: #4E7A55;
  --red: #A4453B;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(51, 37, 31, .07);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --spring: cubic-bezier(.22, 1.2, .36, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* hidden 属性必须真的隐藏（否则会被 display:flex 覆盖） */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body { padding-bottom: calc(96px + var(--safe-b)); }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 14px;
  background: rgba(245, 240, 231, .94);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-name { font-size: 17px; font-weight: 600; letter-spacing: 1px; white-space: nowrap; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 2px; }

.state {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--green);
  background: #E7F1E8; border: 1px solid #CFE3D2;
  padding: 5px 10px; border-radius: 999px;
  white-space: nowrap; flex: 0 0 auto;
}
.state.off { color: var(--red); background: #FBEAE8; border-color: #F0CEC9; }
.state .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* 主体 */
main { padding: 14px 14px 8px; max-width: 640px; margin: 0 auto; }
.loading, .empty {
  text-align: center; color: var(--muted); font-size: 13px;
  padding: 40px 12px; line-height: 1.9;
}

/* 顶部切换 */
.tabs {
  display: flex; gap: 6px; padding: 4px; margin: 4px 0 16px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 999px;
}
.tabs button {
  flex: 1; border: 0; background: none; padding: 10px;
  border-radius: 999px; font-size: 14px; color: var(--muted);
  transition: all .18s var(--spring);
}
.tabs button.on { background: var(--ink); color: #F7EFE3; font-weight: 600; }
.tabs button:active { transform: scale(.96); }

/* 蛋糕预定 */
.cake-head { margin: 2px 2px 16px; }
.cake-title { font-size: 18px; font-weight: 600; }
.cake-sub { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.6; }

.cake-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.cake-pick button {
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
  border-radius: 10px; padding: 9px 13px; font-size: 13px;
  transition: all .18s var(--spring);
}
.cake-pick button.on { background: var(--ink); color: #F7EFE3; border-color: var(--ink); font-weight: 600; }
.cake-pick button:active { transform: scale(.94); }

/* 分类 */
.cats {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px;
  scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--paper);
  color: var(--ink-2); border-radius: 999px; padding: 8px 16px; font-size: 13px;
  transition: all .18s var(--spring);
}
.cat.on { background: var(--ink); color: #F7EFE3; border-color: var(--ink); font-weight: 600; }
.cat:active { transform: scale(.94); }

/* 商品 */
.items { display: flex; flex-direction: column; gap: 10px; }

.item {
  display: flex; gap: 12px; align-items: center;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px;
  box-shadow: var(--shadow);
  min-width: 0;
  transition: transform .16s var(--spring);
}
.item:active { transform: scale(.985); }

.item-img {
  width: 74px; height: 74px; flex: 0 0 74px;
  border-radius: 12px; object-fit: cover; background: var(--accent-soft);
}
.item-img.placeholder {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 10px; text-align: center; line-height: 1.4;
}

.item-body { flex: 1 1 0; min-width: 0; }
.item-name { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.item-desc { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.item-price { font-size: 15px; font-weight: 600; margin-top: 6px; color: var(--accent); }

.stepper { display: inline-flex; align-items: center; gap: 10px; }
.stepper button {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: transform .16s var(--spring), background-color .16s;
}
.stepper button:active { transform: scale(.86); background: var(--accent-soft); }
.stepper .qty {
  min-width: 20px; text-align: center; font-variant-numeric: tabular-nums;
  font-size: 15px;
}
.stepper .qty.pop { animation: pop .34s var(--spring); }
@keyframes pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.38); color: var(--accent); }
  100% { transform: scale(1); }
}

.add-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: var(--ink); color: #F7EFE3; font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(51, 37, 31, .2);
  transition: transform .16s var(--spring);
}
.add-btn:active { transform: scale(.85); }

/* 底部购物车 */
.cartbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: rgba(255, 253, 249, .97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.cartbar-info { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.cartbar-count { font-size: 11px; color: var(--muted); }
.cartbar-total { font-size: 19px; font-weight: 600; }
.btn {
  border: 0; border-radius: 14px; padding: 14px 26px;
  font-size: 16px; font-weight: 600; color: #FFF8EE;
  background: linear-gradient(180deg, #6B4B33, #4A3426);
  box-shadow: 0 4px 14px rgba(51, 37, 31, .18);
  transition: transform .14s var(--spring);
}
.btn:active { transform: scale(.96) translateY(1px); }
.btn:disabled { opacity: .5; }
.btn.block { width: 100%; }

/* 弹层 */
.sheet-mask {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(40, 28, 22, .4);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.sheet {
  width: 100%; max-width: 640px; max-height: 90dvh; overflow: auto;
  background: var(--cream); border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(20px + var(--safe-b));
  animation: up .32s var(--spring);
}
@keyframes up { from { transform: translateY(100%) } to { transform: translateY(0) } }
.sheet h3 { margin: 0 0 16px; font-size: 17px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; letter-spacing: .5px; }
input, textarea {
  width: 100%; font-family: inherit; font-size: 16px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 13px; outline: none; appearance: none;
  transition: border-color .18s, box-shadow .18s;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(180,120,74,.14); }
textarea { min-height: 70px; resize: vertical; }

.seg { display: flex; gap: 8px; }
.seg button {
  flex: 1; border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
  border-radius: 12px; padding: 12px; font-size: 14px;
  transition: all .18s var(--spring);
}
.seg button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); font-weight: 600; }
.seg button:active { transform: scale(.95); }

.total-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 6px 2px 16px; font-size: 15px;
}
.total-row b { font-size: 21px; }

.hint { font-size: 12px; color: var(--muted); line-height: 1.7; margin-top: 8px; }

/* 成功页 */
.done { text-align: center; padding: 40px 20px; }
.done .check {
  width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 30px;
}
.done h2 { margin: 0 0 8px; font-size: 20px; }
.done .no {
  font-size: 24px; font-weight: 700; letter-spacing: 1px;
  background: var(--paper); border: 1px dashed var(--line);
  border-radius: 14px; padding: 14px; margin: 16px 0;
}
.done p { color: var(--muted); font-size: 13px; line-height: 1.8; }

.toast {
  position: fixed; left: 50%; bottom: calc(110px + var(--safe-b));
  transform: translateX(-50%);
  background: rgba(51, 37, 31, .94); color: #FFF6E9; font-size: 13px;
  padding: 10px 16px; border-radius: 999px; z-index: 60; max-width: 86vw;
  text-align: center;
  animation: toastIn .26s var(--spring);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px) } to { opacity: 1; transform: translate(-50%, 0) } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
