/* 今天吃啥 · 样式 */
:root {
  --bg: #fbf5ec;
  --bg-2: #f5ecdf;
  --card: #ffffff;
  --ink: #2e241c;
  --ink-2: #8b7b6b;
  --ink-3: #b3a394;
  --line: #efe2d2;
  --brand: #e4572e;
  --brand-2: #f4663b;
  --brand-soft: #fdece4;
  --green: #4e8a5b;
  --green-soft: #e8f2e9;
  --gold: #d99a2b;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 2px 14px rgba(120, 88, 56, 0.07);
  --shadow-lg: 0 14px 40px rgba(90, 62, 36, 0.16);
  --nav-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body {
  background-image:
    radial-gradient(circle at 12% 4%, rgba(228, 87, 46, 0.07), transparent 42%),
    radial-gradient(circle at 92% 0%, rgba(217, 154, 43, 0.09), transparent 38%);
  background-attachment: fixed;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button { border: 0; background: none; padding: 0; cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
input, textarea { -webkit-appearance: none; }

.app-shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 16px calc(var(--nav-h) + var(--safe-b) + 26px);
  position: relative;
}

/* --------------------------------------------------- 顶部 */
.page-head {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 -16px;
  padding: 14px 16px 10px;
  background: linear-gradient(to bottom, var(--bg) 68%, rgba(251, 245, 236, 0));
  backdrop-filter: blur(8px);
}
.page-head .row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hello { font-size: 13px; color: var(--ink-2); letter-spacing: 0.3px; }
.page-title { font-size: 27px; font-weight: 800; letter-spacing: -0.6px; margin: 2px 0 0; }
.page-title small { font-size: 14px; font-weight: 600; color: var(--ink-3); margin-left: 6px; letter-spacing: 0; }

.head-actions { display: flex; gap: 8px; flex-shrink: 0; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--card); box-shadow: var(--shadow);
  font-size: 19px; transition: transform 0.15s, background 0.15s;
}
.icon-btn:active { transform: scale(0.93); }
.icon-btn.brand { background: var(--brand); color: #fff; }

/* --------------------------------------------------- 通用 */
.section { margin-top: 22px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; padding: 0 2px;
}
.section-title { font-size: 16px; font-weight: 800; letter-spacing: -0.2px; display: flex; align-items: center; gap: 6px; }
.section-title .count { font-size: 12px; font-weight: 700; color: var(--ink-3); background: var(--bg-2); padding: 1px 8px; border-radius: 20px; }
.section-more { font-size: 13px; color: var(--ink-2); font-weight: 600; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px;
  border-radius: var(--radius-sm);
  font-weight: 700; font-size: 15px;
  background: var(--bg-2); color: var(--ink);
  transition: transform 0.12s, opacity 0.15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(228, 87, 46, 0.28); }
.btn-primary:active { background: #d64d26; }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-green { background: var(--green-soft); color: var(--green); }
.btn-block { width: 100%; }
.btn-lg { min-height: 52px; font-size: 16.5px; border-radius: 16px; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 11px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.chip-row {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; height: 34px; padding: 0 14px; border-radius: 20px;
  background: var(--card); color: var(--ink-2);
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
  display: inline-flex; align-items: center; gap: 4px;
  transition: all 0.15s;
}
.chip.active { background: var(--ink); color: #fff; box-shadow: none; }
.chip.ghost { box-shadow: inset 0 0 0 1.5px var(--line); background: transparent; }

.empty {
  text-align: center; padding: 22px 10px; color: var(--ink-3); font-size: 14px;
}
.empty .big { font-size: 30px; display: block; margin-bottom: 4px; opacity: 0.65; }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg-2); font-size: 16px; flex-shrink: 0;
}

/* --------------------------------------------------- 今天的点菜 */
.meal-card { margin-bottom: 12px; }
.meal-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 2px;
}
.meal-emoji { font-size: 20px; }
.meal-name { font-size: 15.5px; font-weight: 800; }
.meal-count { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.meal-add {
  margin-left: auto; width: 30px; height: 30px; border-radius: 10px;
  display: grid; place-items: center; background: var(--bg-2); color: var(--ink-2);
  font-size: 17px; font-weight: 700;
}
.meal-add:active { background: var(--brand-soft); color: var(--brand); }

.order-list { display: flex; flex-direction: column; gap: 8px; }
.order {
  display: flex; align-items: center; gap: 11px;
  background: var(--card); border-radius: 16px; padding: 10px 12px;
  box-shadow: var(--shadow);
  transition: transform 0.12s, opacity 0.2s;
  position: relative;
  width: 100%; text-align: left;
}
.order:active { transform: scale(0.985); }
.order.is-done { opacity: 0.55; }
.order.is-done .order-name { text-decoration: line-through; text-decoration-color: var(--ink-3); }
.order-emoji {
  width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(145deg, var(--bg-2), #fff);
}
.order-main { min-width: 0; flex: 1; }
.order-name { font-size: 15.5px; font-weight: 700; letter-spacing: -0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-name .qty { font-size: 12.5px; color: var(--brand); font-weight: 800; margin-left: 4px; }
.order-sub { font-size: 12px; color: var(--ink-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-sub .note { color: var(--ink); font-style: normal; }
.status-pill {
  flex-shrink: 0; height: 32px; padding: 0 11px; border-radius: 12px;
  font-size: 12.5px; font-weight: 800; display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-2); color: var(--ink-2);
}
.status-pill.done { background: var(--green-soft); color: var(--green); }
.status-pill:active { transform: scale(0.94); }

.summary-strip {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 16px;
  background: linear-gradient(115deg, #fff4ec, #fdeee2);
  box-shadow: var(--shadow);
  margin-top: 4px;
}
.summary-strip .t { font-size: 13px; color: #9a6a4d; line-height: 1.35; }
.summary-strip .t b { color: var(--brand); font-weight: 800; }

/* --------------------------------------------------- 菜品网格 */
.dish-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dish-card {
  background: var(--card); border-radius: 18px; overflow: hidden;
  box-shadow: var(--shadow); text-align: left;
  transition: transform 0.13s;
  display: flex; flex-direction: column;
}
.dish-card:active { transform: scale(0.975); }
.dish-thumb {
  height: 96px; display: grid; place-items: center; font-size: 40px;
  background: linear-gradient(150deg, #fdf1e5, #f6e7d6);
  position: relative; overflow: hidden;
}
.dish-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dish-thumb .badge {
  position: absolute; right: 7px; top: 7px; font-size: 10.5px; font-weight: 800;
  background: rgba(255, 255, 255, 0.9); color: var(--brand);
  padding: 2px 7px; border-radius: 20px; backdrop-filter: blur(4px);
}
.dish-body { padding: 9px 11px 11px; }
.dish-name { font-size: 14.5px; font-weight: 750; letter-spacing: -0.2px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dish-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; display: flex; gap: 6px; align-items: center; }

/* --------------------------------------------------- 详情页 */
.detail-hero {
  margin: 0 -16px; padding: 0 16px 20px;
  background: linear-gradient(165deg, #fdeee2, #fbf5ec 78%);
  border-radius: 0 0 28px 28px;
}
.detail-hero .thumb {
  height: 168px; border-radius: 22px; overflow: hidden;
  display: grid; place-items: center; font-size: 76px;
  background: linear-gradient(150deg, #fdf1e5, #f4e2ce);
  box-shadow: var(--shadow);
  margin-top: 10px;
}
.detail-hero .thumb img { width: 100%; height: 100%; object-fit: cover; }
.detail-title { font-size: 25px; font-weight: 800; letter-spacing: -0.6px; margin: 16px 2px 6px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 2px; }
.tag {
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 8px;
  background: var(--brand-soft); color: var(--brand);
}
.tag.gray { background: var(--bg-2); color: var(--ink-2); }
.prose { font-size: 15px; line-height: 1.75; color: #4a3c30; white-space: pre-wrap; word-break: break-word; }
.prose.muted { color: var(--ink-2); font-size: 14px; }

.steps { counter-reset: s; display: flex; flex-direction: column; gap: 12px; }
.step { display: flex; gap: 11px; align-items: flex-start; }
.step-n {
  counter-increment: s; flex-shrink: 0;
  width: 24px; height: 24px; border-radius: 50%; margin-top: 1px;
  background: var(--brand); color: #fff; font-size: 12.5px; font-weight: 800;
  display: grid; place-items: center;
}
.step-n::before { content: counter(s); }
.step-t { font-size: 15px; line-height: 1.65; padding-top: 1px; }
.ing { display: flex; flex-direction: column; gap: 7px; }
.ing-item { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.ing-item::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); flex-shrink: 0; }

.detail-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 10px 16px calc(10px + var(--safe-b));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: flex; gap: 10px;
  max-width: 560px; margin: 0 auto;
}
.detail-bar .btn { flex: 1; }
.detail-bar .btn-icon { flex: 0 0 52px; }

/* --------------------------------------------------- 表单 */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 7px; }
.input, textarea.input {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border-radius: 14px; background: var(--card);
  border: 1.5px solid var(--line); font-size: 16px; line-height: 1.5;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(228, 87, 46, 0.1); }
textarea.input { min-height: 100px; resize: vertical; }
.field-hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; line-height: 1.5; }

.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-opt {
  aspect-ratio: 1; border-radius: 11px; display: grid; place-items: center;
  font-size: 21px; background: var(--card); border: 1.5px solid transparent;
}
.emoji-opt.sel { border-color: var(--brand); background: var(--brand-soft); }

.photo-pick {
  display: flex; gap: 10px; align-items: center;
}
.photo-box {
  width: 90px; height: 90px; border-radius: 16px; overflow: hidden;
  background: var(--bg-2); display: grid; place-items: center; font-size: 12px; color: var(--ink-3);
  border: 1.5px dashed var(--line); flex-shrink: 0;
}
.photo-box img { width: 100%; height: 100%; object-fit: cover; }

/* --------------------------------------------------- 底部导航 */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-width: 560px; margin: 0 auto;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 11px; font-weight: 700; color: var(--ink-3);
  transition: color 0.15s;
}
.nav-item .ni { font-size: 21px; line-height: 1; filter: grayscale(1); opacity: 0.5; transition: all 0.18s; }
.nav-item.active { color: var(--brand); }
.nav-item.active .ni { filter: none; opacity: 1; transform: translateY(-1px) scale(1.06); }
.nav-item { position: relative; }
.nav-badge {
  position: absolute; top: 8px; right: 50%; margin-right: -22px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--brand); color: #fff; font-size: 10px; font-weight: 800;
  display: grid; place-items: center;
}

/* --------------------------------------------------- 浮层 */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(46, 36, 28, 0.34);
  backdrop-filter: blur(2px);
  animation: fade 0.18s ease;
  display: flex; align-items: flex-end; justify-content: center;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px;
  max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg);
  border-radius: 26px 26px 0 0;
  padding: 8px 16px calc(18px + var(--safe-b));
  animation: rise 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  -webkit-overflow-scrolling: touch;
}
@keyframes rise { from { transform: translateY(28px); opacity: 0.6; } }
.sheet-grab {
  width: 38px; height: 4.5px; border-radius: 3px; background: #ddd0c0;
  margin: 6px auto 12px;
}
.sheet-title { font-size: 19px; font-weight: 800; letter-spacing: -0.4px; margin-bottom: 4px; }
.sheet-sub { font-size: 13px; color: var(--ink-2); margin-bottom: 16px; }
.sheet-close { float: right; font-size: 20px; color: var(--ink-3); padding: 0 2px; }

.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border-radius: 14px; padding: 0 14px;
  box-shadow: var(--shadow); height: 46px; margin-bottom: 12px;
}
.search-box input { flex: 1; border: 0; outline: none; background: none; font-size: 16px; }
.search-box .ic { font-size: 15px; opacity: 0.45; }

.pick-row {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 4px; border-bottom: 1px solid var(--line); text-align: left;
}
.pick-row:last-child { border-bottom: 0; }
.pick-row:active { background: var(--bg-2); }
.pick-emoji { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 21px; background: var(--bg-2); flex-shrink: 0; overflow: hidden; }
.pick-emoji img { width: 100%; height: 100%; object-fit: cover; }
.pick-main { flex: 1; min-width: 0; }
.pick-name { font-size: 15px; font-weight: 700; }
.pick-sub { font-size: 12px; color: var(--ink-3); }

.seg {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  background: var(--bg-2); padding: 4px; border-radius: 14px;
}
.seg-opt {
  height: 40px; border-radius: 11px; font-size: 14px; font-weight: 700; color: var(--ink-2);
  display: grid; place-items: center;
}
.seg-opt.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.stepper { display: flex; align-items: center; gap: 14px; justify-content: center; }
.stepper button {
  width: 42px; height: 42px; border-radius: 13px; background: var(--card);
  box-shadow: var(--shadow); font-size: 20px; font-weight: 700; color: var(--ink);
  display: grid; place-items: center;
}
.stepper .v { font-size: 21px; font-weight: 800; min-width: 42px; text-align: center; }

.toast {
  position: fixed; left: 50%; top: 22px; z-index: 300;
  transform: translate(-50%, -16px);
  background: rgba(46, 36, 28, 0.94); color: #fff;
  font-size: 14px; font-weight: 600; padding: 10px 18px; border-radius: 14px;
  opacity: 0; pointer-events: none; transition: all 0.24s; max-width: 82vw; text-align: center;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* --------------------------------------------------- 引导 / 加入 */
.welcome {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: center;
  padding: 40px 6px; text-align: center;
}
.welcome .logo { font-size: 66px; line-height: 1; margin-bottom: 14px; animation: pop 0.6s cubic-bezier(0.22,1.4,0.36,1); }
@keyframes pop { from { transform: scale(0.7); opacity: 0; } }
.welcome h1 { font-size: 30px; font-weight: 850; letter-spacing: -1px; margin: 0 0 6px; }
.welcome p { color: var(--ink-2); font-size: 14.5px; margin: 0 0 26px; line-height: 1.6; }
.welcome .stack { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.welcome .foot { margin-top: 26px; font-size: 12px; color: var(--ink-3); }

.code-input {
  text-align: center; font-size: 26px; letter-spacing: 8px; font-weight: 800;
  text-transform: uppercase; padding-left: 8px;
}

/* --------------------------------------------------- 家里 */
.family-code-card {
  background: linear-gradient(140deg, #2e241c, #4a3628);
  color: #fff; border-radius: 22px; padding: 20px;
  box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.family-code-card::after {
  content: ""; position: absolute; right: -30px; top: -30px;
  width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, rgba(228, 87, 46, 0.5), transparent 70%);
}
.family-code-card .lbl { font-size: 12.5px; opacity: 0.72; letter-spacing: 1px; }
.family-code-card .code {
  font-size: 34px; font-weight: 850; letter-spacing: 7px; margin: 4px 0 12px;
  font-variant-numeric: tabular-nums;
}
.family-code-card .actions { display: flex; gap: 8px; position: relative; z-index: 1; }
.family-code-card .btn { background: rgba(255, 255, 255, 0.16); color: #fff; backdrop-filter: blur(4px); }
.family-code-card .btn:active { background: rgba(255, 255, 255, 0.26); }

.member-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.member-row:last-child { border-bottom: 0; }
.member-row .nm { font-weight: 700; font-size: 15px; }
.member-row .me-tag { font-size: 10.5px; font-weight: 800; color: var(--brand); background: var(--brand-soft); padding: 1px 6px; border-radius: 6px; margin-left: 6px; }
.member-row .cnt { margin-left: auto; font-size: 12.5px; color: var(--ink-3); font-weight: 700; }

.rank-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.rank-n { width: 20px; font-size: 13px; font-weight: 800; color: var(--ink-3); text-align: center; flex-shrink: 0; }
.rank-n.top { color: var(--brand); }
.rank-bar { flex: 1; height: 26px; background: var(--bg-2); border-radius: 8px; overflow: hidden; position: relative; }
.rank-fill {
  position: absolute; inset: 0 auto 0 0; border-radius: 8px;
  background: linear-gradient(90deg, #f6c39e, #e4572e);
  animation: grow 0.5s ease;
}
@keyframes grow { from { width: 0 !important; } }
.rank-label {
  position: relative; z-index: 1; height: 26px; display: flex; align-items: center;
  padding: 0 9px; font-size: 12.5px; font-weight: 700; color: #5a4030; gap: 5px;
}
.rank-c { font-size: 12px; color: var(--ink-3); font-weight: 700; flex-shrink: 0; }

.hist-day { margin-bottom: 14px; }
.hist-date { font-size: 12.5px; font-weight: 800; color: var(--ink-2); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.hist-date .sep { flex: 1; height: 1px; background: var(--line); }
.hist-items { display: flex; flex-wrap: wrap; gap: 6px; }
.hist-item {
  font-size: 12.5px; background: var(--card); border-radius: 9px; padding: 4px 9px;
  box-shadow: var(--shadow); display: inline-flex; align-items: center; gap: 4px;
}

.list-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 14px 4px; border-bottom: 1px solid var(--line); text-align: left; font-size: 15px;
}
.list-row:last-child { border-bottom: 0; }
.list-row .arrow { margin-left: auto; color: var(--ink-3); font-size: 16px; }
.list-row .ic { font-size: 18px; width: 22px; text-align: center; }

.skeleton { background: linear-gradient(90deg, #f2e9de 25%, #f8f1e8 50%, #f2e9de 75%); background-size: 200% 100%; animation: shine 1.2s infinite; border-radius: 12px; }
@keyframes shine { to { background-position: -200% 0; } }

@media (min-width: 480px) {
  .dish-grid { gap: 12px; }
  .dish-thumb { height: 118px; }
}
