/* ===========================================================
   我们的小饭桌 · 样式
   暖色纸感 / 手机优先
   =========================================================== */

:root{
  --bg:        #fbf7f1;
  --bg-soft:   #f4ece1;
  --card:      #ffffff;
  --ink:       #2a2320;
  --ink-2:     #6d6057;
  --ink-3:     #a3958a;
  --line:      #ece2d6;
  --line-2:    #f4ece2;
  --accent:    #d9532f;
  --accent-2:  #b8411f;
  --accent-bg: #fdefe9;
  --gold:      #dfa32b;
  --green:     #4b8f6b;
  --green-bg:  #eaf4ee;
  --shadow:    0 1px 2px rgba(60,38,20,.05), 0 8px 24px -12px rgba(60,38,20,.18);
  --shadow-lg: 0 2px 6px rgba(60,38,20,.06), 0 24px 48px -20px rgba(60,38,20,.28);
  --r:         18px;
  --r-sm:      12px;
  --tab-h:     64px;
}

@media (prefers-color-scheme: dark){
  :root{
    --bg:        #17130f;
    --bg-soft:   #1f1a15;
    --card:      #221c17;
    --ink:       #f2e9df;
    --ink-2:     #b3a396;
    --ink-3:     #7d6f64;
    --line:      #352c24;
    --line-2:    #2a231c;
    --accent:    #f0704a;
    --accent-2:  #ff8a66;
    --accent-bg: #2d1b14;
    --green-bg:  #17251d;
    --shadow:    0 1px 2px rgba(0,0,0,.5), 0 10px 28px -14px rgba(0,0,0,.8);
    --shadow-lg: 0 2px 8px rgba(0,0,0,.6), 0 28px 56px -24px rgba(0,0,0,.9);
  }
}

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

html,body{ margin:0; padding:0; }

body{
  background:var(--bg);
  color:var(--ink);
  font-family:-apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
              "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-size:15px;
  line-height:1.55;
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
}

body::before{
  content:"";
  position:fixed; inset:0;
  background:
    radial-gradient(1100px 420px at 12% -8%, rgba(217,83,47,.07), transparent 60%),
    radial-gradient(900px 380px at 100% 0%, rgba(223,163,43,.07), transparent 60%);
  pointer-events:none; z-index:0;
}
@media (prefers-color-scheme: dark){
  body::before{ opacity:.55; }
}

.app{
  position:relative; z-index:1;
  max-width:880px; margin:0 auto;
  padding:0 16px calc(var(--tab-h) + 34px + env(safe-area-inset-bottom));
}
body.has-cart .app{
  padding-bottom:calc(var(--tab-h) + 116px + env(safe-area-inset-bottom));
}

img{ max-width:100%; display:block; }
button{ font-family:inherit; }
input,textarea,select{ font-family:inherit; font-size:inherit; color:inherit; }

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

.topbar{
  position:sticky; top:0; z-index:20;
  display:flex; align-items:center; gap:10px;
  padding:14px 0 12px;
  background:linear-gradient(to bottom, var(--bg) 62%, rgba(251,247,241,0));
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}
@media (prefers-color-scheme: dark){
  .topbar{ background:linear-gradient(to bottom, var(--bg) 62%, rgba(23,19,15,0)); }
}

.brand{ display:flex; align-items:baseline; gap:8px; min-width:0; margin-right:auto; }
.brand h1{
  font-size:20px; margin:0; letter-spacing:.2px; font-weight:750;
  white-space:nowrap;
}
.brand .sub{ font-size:12px; color:var(--ink-3); white-space:nowrap; }

.who{
  margin-left:10px; flex:none;
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 11px; border-radius:999px;
  background:var(--card); border:1px solid var(--line);
  color:var(--ink-2); font-size:13px; cursor:pointer;
  box-shadow:var(--shadow);
}
.who b{ color:var(--ink); font-weight:650; }
.who .dot{ width:7px; height:7px; border-radius:50%; background:var(--accent); }

.sync-pill{
  flex:none; display:inline-flex; align-items:center; gap:6px;
  padding:6px 10px; border-radius:999px;
  border:1px solid var(--line); background:var(--card);
  color:var(--ink-3); font-size:12px; cursor:pointer;
  box-shadow:var(--shadow); white-space:nowrap;
}
.sync-pill .sdot{ width:7px; height:7px; border-radius:50%; background:var(--green); }
.sync-pill.syncing .sdot{ background:var(--gold); animation:blink 1s ease-in-out infinite; }
.sync-pill.error .sdot{ background:var(--accent); }
.sync-pill.idle .sdot{ background:var(--ink-3); }
@keyframes blink{ 50%{ opacity:.2 } }

/* ---------------- 通用 ---------------- */

.view{ position:relative; }

.section-title{
  display:flex; align-items:center; gap:8px;
  margin:22px 0 10px; font-size:13px; font-weight:700;
  color:var(--ink-3); letter-spacing:.6px;
}
.section-title .line{ flex:1; height:1px; background:var(--line); }

.chips{
  display:flex; gap:8px; overflow-x:auto; padding:2px 0 6px;
  scrollbar-width:none; -ms-overflow-style:none;
}
.chips::-webkit-scrollbar{ display:none; }

.chip{
  flex:none; padding:7px 13px; border-radius:999px;
  border:1px solid var(--line); background:var(--card);
  color:var(--ink-2); font-size:13.5px; cursor:pointer;
  transition:all .16s ease; white-space:nowrap;
}
.chip:active{ transform:scale(.96); }
.chip.on{
  background:var(--ink); border-color:var(--ink); color:var(--bg); font-weight:600;
}
.chip .n{ opacity:.5; margin-left:5px; font-size:11.5px; }

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  padding:11px 18px; border-radius:14px; border:1px solid var(--line);
  background:var(--card); color:var(--ink);
  font-size:14.5px; font-weight:600; cursor:pointer;
  transition:transform .12s ease, background .16s ease, opacity .16s;
}
.btn:active{ transform:scale(.97); }
.btn.primary{ background:var(--accent); border-color:var(--accent); color:#fff; }
.btn.primary:active{ background:var(--accent-2); }
.btn.ghost{ background:transparent; }
.btn.danger{ color:var(--accent); border-color:var(--accent-bg); background:var(--accent-bg); }
.btn.wide{ width:100%; }
.btn.sm{ padding:8px 13px; font-size:13px; border-radius:11px; }
.btn:disabled{ opacity:.45; cursor:default; }

.search{
  display:flex; align-items:center; gap:9px;
  background:var(--card); border:1px solid var(--line);
  border-radius:14px; padding:10px 14px; box-shadow:var(--shadow);
}
.search svg{ flex:none; opacity:.45; }
.search input{
  flex:1; border:0; outline:0; background:transparent; font-size:15px; min-width:0;
}
.search input::placeholder{ color:var(--ink-3); }

/* ---------------- 菜谱卡片 ---------------- */

.grid{
  display:grid; gap:14px;
  grid-template-columns:repeat(auto-fill, minmax(150px, 1fr));
}

.card{
  background:var(--card); border-radius:var(--r); overflow:hidden;
  border:1px solid var(--line-2); box-shadow:var(--shadow);
  cursor:pointer; transition:transform .18s ease, box-shadow .18s ease;
  animation:rise .32s cubic-bezier(.2,.8,.3,1);
}
.card:active{ transform:scale(.975); }
@media (hover:hover){ .card:hover{ transform:translateY(-2px); box-shadow:var(--shadow-lg); } }

.card .cover{ position:relative; aspect-ratio:4/3; background:var(--bg-soft); }
.card .cover img{ width:100%; height:100%; object-fit:cover; }

.ph{
  width:100%; height:100%;
  display:grid; place-items:center;
  background:linear-gradient(145deg,
     hsl(var(--h) 64% 92%), hsl(calc(var(--h) + 26) 68% 84%));
  color:hsl(var(--h) 42% 34%);
  font-size:34px; font-weight:800; letter-spacing:2px;
  font-family:"Songti SC","STSong",serif;
}
@media (prefers-color-scheme: dark){
  .ph{
    background:linear-gradient(145deg, hsl(var(--h) 24% 22%), hsl(calc(var(--h) + 26) 26% 16%));
    color:hsl(var(--h) 46% 72%);
  }
}

.card .body{ padding:9px 11px 11px; }
.card .name{
  font-size:14.5px; font-weight:650; line-height:1.35;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
  overflow:hidden; min-height:2.7em;
}
.card .meta{
  margin-top:6px; display:flex; align-items:center; gap:8px;
  font-size:11.5px; color:var(--ink-3);
}
.stars{ display:inline-flex; gap:1px; letter-spacing:-1px; font-size:11.5px; }
.stars i{ font-style:normal; color:var(--line); }
.stars i.on{ color:var(--gold); }

/* ---------------- 空状态 ---------------- */

.empty{
  text-align:center; padding:52px 24px; color:var(--ink-3);
}
.empty .big{ font-size:44px; margin-bottom:12px; filter:grayscale(.2); }
.empty h3{ margin:0 0 6px; color:var(--ink-2); font-size:16px; }
.empty p{ margin:0 auto 18px; max-width:280px; font-size:13.5px; line-height:1.6; }

/* ---------------- 悬浮加号 ---------------- */

.fab{
  position:fixed; right:calc(50% - 440px + 18px); bottom:calc(var(--tab-h) + 24px + env(safe-area-inset-bottom));
  width:56px; height:56px; border-radius:50%;
  border:0; background:var(--accent); color:#fff;
  font-size:28px; line-height:1; cursor:pointer;
  box-shadow:0 10px 26px -8px rgba(217,83,47,.65), 0 2px 6px rgba(0,0,0,.12);
  z-index:15; transition:transform .14s ease;
}
.fab:active{ transform:scale(.92); }
@media (max-width: 920px){ .fab{ right:18px; } }

/* ---------------- 底部导航 ---------------- */

.tabbar{
  position:fixed; left:0; right:0; bottom:0; z-index:30;
  height:calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom:env(safe-area-inset-bottom);
  display:flex; justify-content:center;
  background:var(--card);
  background:color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter:blur(16px) saturate(1.4);
  -webkit-backdrop-filter:blur(16px) saturate(1.4);
  border-top:1px solid var(--line);
}
.tab{
  flex:1; max-width:150px;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
  border:0; background:transparent; color:var(--ink-3);
  font-size:11px; cursor:pointer; padding:0;
  transition:color .16s;
}
.tab svg{ width:22px; height:22px; stroke:currentColor; fill:none; stroke-width:1.7;
          stroke-linecap:round; stroke-linejoin:round; }
.tab.on{ color:var(--accent); font-weight:650; }
.tab .badge{
  position:absolute; transform:translate(16px,-14px);
  background:var(--accent); color:#fff; font-size:10px; font-weight:700;
  min-width:16px; height:16px; border-radius:8px; line-height:16px; text-align:center;
  padding:0 4px;
}

/* ---------------- 点菜页 ---------------- */

.pick-row{
  display:flex; align-items:center; gap:12px;
  padding:9px; margin-bottom:10px;
  background:var(--card); border:1px solid var(--line-2);
  border-radius:16px; box-shadow:var(--shadow);
}
.pick-row .thumb{
  width:58px; height:58px; border-radius:12px; overflow:hidden; flex:none;
}
.pick-row .thumb img{ width:100%; height:100%; object-fit:cover; }
.pick-row .thumb .ph{ font-size:20px; }
.pick-row .info{ flex:1; min-width:0; }
.pick-row .info .n{ font-weight:650; font-size:14.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pick-row .info .s{ font-size:11.5px; color:var(--ink-3); margin-top:2px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pick-row .info .s .tag{ color:var(--ink-2); }

.pick-btn{
  flex:none; width:36px; height:36px; border-radius:50%;
  border:1.5px solid var(--line); background:var(--card); color:var(--ink-2);
  font-size:19px; line-height:1; cursor:pointer; display:grid; place-items:center;
  transition:all .15s;
}
.pick-btn.on{ background:var(--accent); border-color:var(--accent); color:#fff; }

.cartbar{
  position:fixed; left:0; right:0; bottom:calc(var(--tab-h) + env(safe-area-inset-bottom));
  z-index:25; display:flex; justify-content:center; padding:0 16px;
}
.cartbar .inner{
  width:100%; max-width:848px; margin:0 0 10px;
  background:var(--ink); color:var(--bg);
  border-radius:18px; padding:10px 12px 10px 18px;
  display:flex; align-items:center; gap:12px;
  box-shadow:var(--shadow-lg);
  animation:rise .22s ease both;
}
@media (prefers-color-scheme: dark){ .cartbar .inner{ background:#f2e9df; color:#17130f; } }
.cartbar .txt{ flex:1; font-size:13.5px; }
.cartbar .txt b{ font-size:16px; margin-right:2px; }
.cartbar button{
  border:0; border-radius:12px; padding:10px 18px;
  background:var(--accent); color:#fff; font-weight:650; font-size:14px; cursor:pointer;
}

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

.order-card{
  background:var(--card); border:1px solid var(--line-2);
  border-radius:var(--r); padding:16px; margin-bottom:14px;
  box-shadow:var(--shadow);
}
.order-head{ display:flex; align-items:baseline; gap:10px; margin-bottom:12px; }
.order-head h3{ margin:0; font-size:16px; font-weight:700; }
.order-head .date{ font-size:12.5px; color:var(--ink-3); margin-left:auto; }

.order-items{ display:flex; flex-direction:column; gap:8px; }
.order-item{
  display:flex; align-items:center; gap:10px;
  padding:8px; border-radius:12px; background:var(--bg-soft);
}
.order-item img{ width:40px; height:40px; border-radius:9px; object-fit:cover; }
.order-item .n{ flex:1; font-size:14px; font-weight:600; min-width:0;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.order-item .by{
  font-size:11px; padding:2px 8px; border-radius:999px;
  background:var(--accent-bg); color:var(--accent); font-weight:650; flex:none;
}
.order-item .x{
  border:0; background:transparent; color:var(--ink-3);
  font-size:17px; cursor:pointer; padding:2px 6px; flex:none;
}

.ing-box{
  margin-top:12px; border-top:1px dashed var(--line); padding-top:12px;
}
.ing-box .hd{
  display:flex; align-items:center; gap:8px; margin-bottom:8px;
  font-size:12px; font-weight:700; color:var(--ink-3); letter-spacing:.4px;
}
.ing-box .hd .sp{ flex:1; }
.ing-list{ display:flex; flex-direction:column; gap:5px; }
.ing-line{
  display:flex; gap:8px; font-size:13.5px; align-items:baseline;
}
.ing-line .dot{ width:4px; height:4px; border-radius:50%; background:var(--ink-3); flex:none; margin-top:.55em; }
.ing-line .q{ color:var(--ink-2); }
.ing-line .note{ color:var(--ink-3); font-size:12.5px; }

.muted{ color:var(--ink-3); font-size:13px; }

/* ---------------- 浮层 ---------------- */

.overlay{
  position:fixed; inset:0; z-index:60;
  background:var(--bg); overflow-y:auto; overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  animation:slideUp .26s cubic-bezier(.2,.8,.3,1);
}
.overlay[hidden]{ display:none; }

@keyframes slideUp{ from{ transform:translateY(18px); opacity:0 } to{ transform:none; opacity:1 } }
@keyframes rise{ from{ transform:translateY(6px); opacity:0 } to{ transform:none; opacity:1 } }

.sheet{
  max-width:720px; margin:0 auto; padding:0 16px 40px;
}
.sheet-top{
  position:sticky; top:0; z-index:5;
  display:flex; align-items:center; gap:10px;
  padding:12px 0; background:var(--bg);
}
.sheet-top .grow{ flex:1; }

.icon-btn{
  width:38px; height:38px; border-radius:50%; flex:none;
  border:1px solid var(--line); background:var(--card); color:var(--ink);
  display:grid; place-items:center; cursor:pointer; font-size:17px;
}
.icon-btn svg{ width:19px; height:19px; stroke:currentColor; fill:none; stroke-width:1.8;
  stroke-linecap:round; stroke-linejoin:round; }

/* 详情 */
.hero{
  position:relative; border-radius:22px; overflow:hidden;
  aspect-ratio:16/10; background:var(--bg-soft); box-shadow:var(--shadow);
}
.hero img{ width:100%; height:100%; object-fit:cover; }
.hero .ph{ font-size:64px; }

.detail-title{ margin:16px 0 4px; font-size:26px; font-weight:800; line-height:1.25; letter-spacing:.2px; }
.detail-sub{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; color:var(--ink-3); font-size:13px; }
.detail-sub .tag{
  background:var(--bg-soft); color:var(--ink-2);
  padding:3px 10px; border-radius:999px; font-size:12px;
}

.rating-row{ display:flex; align-items:center; gap:10px; margin:14px 0 4px; }
.stars.big{ font-size:24px; gap:3px; cursor:pointer; }
.stars.big i{ transition:transform .12s; }
.stars.big i:active{ transform:scale(1.2); }

.block{ margin-top:26px; }
.block h4{
  margin:0 0 10px; font-size:13px; font-weight:750; color:var(--ink-3);
  letter-spacing:1px; display:flex; align-items:center; gap:8px;
}
.block h4 .line{ flex:1; height:1px; background:var(--line); }

.ing-table{ background:var(--card); border:1px solid var(--line-2); border-radius:16px; overflow:hidden; }
.ing-row{
  display:flex; gap:12px; padding:11px 14px; font-size:14.5px;
  border-bottom:1px solid var(--line-2);
}
.ing-row:last-child{ border-bottom:0; }
.ing-row .a{ color:var(--ink-2); margin-left:auto; }

.steps{ counter-reset:s; display:flex; flex-direction:column; gap:2px; }
.step{
  display:flex; gap:13px; padding:10px 0;
  border-bottom:1px dashed var(--line-2);
}
.step:last-child{ border-bottom:0; }
.step .num{
  counter-increment:s; flex:none;
  width:26px; height:26px; border-radius:50%;
  background:var(--accent-bg); color:var(--accent);
  font-size:12.5px; font-weight:750;
  display:grid; place-items:center; margin-top:1px;
}
.step .num::before{ content:counter(s); }
.step .txt{ flex:1; font-size:14.5px; line-height:1.65; white-space:pre-wrap; }

.tips{
  background:linear-gradient(180deg, var(--accent-bg), transparent);
  border-left:3px solid var(--accent);
  border-radius:0 14px 14px 0;
  padding:12px 14px; font-size:14px; color:var(--ink-2);
  white-space:pre-wrap; line-height:1.65;
}

.detail-actions{ display:flex; gap:10px; margin-top:28px; }
.detail-actions .btn{ flex:1; }

/* 表单 */
.field{ margin-bottom:20px; }
.field > label{
  display:block; font-size:12.5px; font-weight:750; color:var(--ink-3);
  letter-spacing:.8px; margin-bottom:8px;
}
.field input[type=text], .field textarea, .field select, .inp{
  width:100%; padding:12px 14px; border-radius:13px;
  border:1px solid var(--line); background:var(--card);
  outline:0; font-size:15px; transition:border-color .16s, box-shadow .16s;
}
.field input:focus, .field textarea:focus, .inp:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.field textarea{ resize:vertical; min-height:76px; line-height:1.6; }

.cover-edit{
  position:relative; border-radius:18px; overflow:hidden;
  aspect-ratio:16/9; background:var(--bg-soft); border:1px dashed var(--line);
  display:grid; place-items:center; cursor:pointer;
}
.cover-edit img{ width:100%; height:100%; object-fit:cover; }
.cover-edit .hint{ font-size:13px; color:var(--ink-3); text-align:center; line-height:1.7; }
.cover-edit .rm{
  position:absolute; top:8px; right:8px;
  border:0; border-radius:999px; background:rgba(0,0,0,.55); color:#fff;
  font-size:12px; padding:5px 10px; cursor:pointer;
}

.row{ display:flex; gap:8px; margin-bottom:8px; align-items:flex-start; }
.row .inp{ flex:1; }
.row .inp.amt{ max-width:110px; flex:none; }
.row .del{
  flex:none; width:38px; height:44px; border-radius:11px;
  border:1px solid var(--line); background:var(--card); color:var(--ink-3);
  font-size:18px; cursor:pointer;
}
.row textarea{ min-height:56px; flex:1; }
.row .idx{
  flex:none; width:26px; padding-top:12px; text-align:center;
  color:var(--ink-3); font-size:12.5px; font-weight:700;
}

.add-line{
  border:1px dashed var(--line); background:transparent; color:var(--ink-2);
  width:100%; padding:10px; border-radius:12px; font-size:13.5px; cursor:pointer;
}
.add-line:active{ background:var(--bg-soft); }

.hint-sm{ font-size:12px; color:var(--ink-3); margin-top:6px; line-height:1.6; }

/* 设置页 */
.set-card{
  background:var(--card); border:1px solid var(--line-2);
  border-radius:var(--r); padding:16px; margin-bottom:14px; box-shadow:var(--shadow);
}
.set-card h3{ margin:0 0 4px; font-size:15px; font-weight:700; }
.set-card .desc{ font-size:12.5px; color:var(--ink-3); margin:0 0 14px; line-height:1.6; }

.set-line{
  display:flex; align-items:center; gap:12px;
  padding:11px 0; border-bottom:1px solid var(--line-2); font-size:14.5px;
}
.set-line:last-child{ border-bottom:0; }
.set-line .lbl{ flex:1; }
.set-line .val{ color:var(--ink-3); font-size:13px; }

.seg{
  display:inline-flex; background:var(--bg-soft); border-radius:11px; padding:3px;
}
.seg button{
  border:0; background:transparent; padding:7px 14px; border-radius:9px;
  font-size:13.5px; color:var(--ink-2); cursor:pointer;
}
.seg button.on{ background:var(--card); color:var(--ink); font-weight:650; box-shadow:0 1px 3px rgba(0,0,0,.08); }

/* Toast */
.toast{
  position:fixed; left:50%; bottom:calc(var(--tab-h) + 30px + env(safe-area-inset-bottom));
  transform:translateX(-50%); z-index:80;
  background:var(--ink); color:var(--bg);
  padding:11px 20px; border-radius:999px; font-size:13.5px; font-weight:600;
  box-shadow:var(--shadow-lg); white-space:nowrap; max-width:90vw;
  overflow:hidden; text-overflow:ellipsis;
  animation:toastIn .22s ease both;
}
@media (prefers-color-scheme: dark){ .toast{ background:#f2e9df; color:#17130f; } }
@keyframes toastIn{ from{ transform:translate(-50%, 8px); opacity:0 } to{ transform:translate(-50%,0); opacity:1 } }

/* 密码锁 */
.lock{
  position:fixed; inset:0; z-index:90;
  display:flex; align-items:center; justify-content:center;
  background:var(--bg); padding:24px;
}
.lock-box{ width:100%; max-width:320px; text-align:center; }
.lock-logo{ font-size:54px; margin-bottom:6px; }
.lock-box h2{ margin:0; font-size:22px; font-weight:800; letter-spacing:.5px; }
.lock .inp{ font-family:inherit; }
.lock .inp::placeholder{ letter-spacing:8px; }

/* 小屏 */
@media (max-width:380px){
  .grid{ grid-template-columns:repeat(2, 1fr); gap:11px; }
  .detail-title{ font-size:22px; }
  .brand h1{ font-size:18px; }
}
