/* ============ 设计系统：家庭食谱本 ============
   规范：移动优先 · 70-20-10 暖色调 · 非纯白背景 · 字号 2x+ 跳跃 · 44px 触控 · 反馈动画
   配色：奶油底 / 番茄橙主色 / 莴苣绿成功色
*/
:root {
  --bg: #fff7ee;
  --bg-2: #ffe9d6;
  --surface: #fffdfa;
  --surface-2: #fff3e6;
  --primary: #e8552d;
  --primary-strong: #c8411e;
  --primary-soft: #fde4d8;
  --accent: #2e9e5b;
  --accent-soft: #dcf3e4;
  --ink: #2a211c;
  --muted: #927f70;
  --border: #f1e2d2;
  --warn: #e0a100;
  --shadow-sm: 0 2px 8px rgba(120, 70, 40, 0.08);
  --shadow-md: 0 8px 24px rgba(120, 70, 40, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --font-display: "ZCOOL KuaiLe", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --maxw: 720px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--bg-2), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, #fff0e0, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 84px; /* 给底部导航留位 */
}
@media (min-width: 768px) {
  body { font-size: 18px; }
}

a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  background: rgba(255, 247, 238, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.brand-mark { font-size: 26px; }
.brand-name { font-family: var(--font-display); font-size: 22px; letter-spacing: .5px; color: var(--primary-strong); }
.topbar-right { display: flex; align-items: center; gap: 8px; }

/* ---------- 主容器 ---------- */
.app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px;
  min-height: 60vh;
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--primary), #ff7a45);
  color: #fff;
  border-radius: 24px;
  padding: 26px 22px;
  box-shadow: var(--shadow-md);
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "🍳"; position: absolute; right: -10px; bottom: -18px;
  font-size: 120px; opacity: .18; transform: rotate(-12deg);
}
.hero h1 { font-family: var(--font-display); font-size: 34px; line-height: 1.2; margin-bottom: 8px; }
.hero p { opacity: .95; font-size: 16px; max-width: 80%; }

/* ---------- 搜索/筛选 ---------- */
.searchbar { display: flex; gap: 8px; margin-bottom: 14px; }
.searchbar input {
  flex: 1; min-height: 48px; padding: 0 16px;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); font-size: 17px; color: var(--ink);
}
.searchbar input:focus { outline: 3px solid var(--primary-soft); border-color: var(--primary); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.chip {
  flex: 0 0 auto; min-height: 40px; padding: 0 16px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); font-size: 15px; white-space: nowrap;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- 食谱卡片 ---------- */
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) { .grid { grid-template-columns: 1fr 1fr; } }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease; cursor: pointer;
}
.card:active { transform: scale(.98); }
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-cover {
  font-size: 52px; text-align: center; padding: 22px 0;
  background: linear-gradient(135deg, var(--surface-2), #fff);
}
.card-body { padding: 14px 16px 16px; }
.card-title { font-family: var(--font-display); font-size: 20px; margin-bottom: 4px; }
.card-summary { color: var(--muted); font-size: 14px; min-height: 40px; }
.card-meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.tag {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-strong);
}
.tag.diff-简单 { background: var(--accent-soft); color: var(--accent); }
.tag.diff-中等 { background: #fff0d6; color: var(--warn); }
.tag.diff-进阶 { background: #fde0d6; color: #b8442a; }
.stats { display: flex; gap: 12px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.stats b { color: var(--ink); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 20px; border-radius: 14px;
  font-size: 16px; font-weight: 500; background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--border); transition: transform .1s ease, background .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ---------- 详情页 ---------- */
.detail-hero { text-align: center; padding: 18px 0 8px; }
.detail-hero .cover { font-size: 80px; }
.detail-title { font-family: var(--font-display); font-size: 30px; margin: 6px 0; }
.detail-sub { color: var(--muted); }
.meta-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 12px 0; }

.section-h { font-family: var(--font-display); font-size: 22px; margin: 22px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-h::before { content: ""; width: 6px; height: 22px; border-radius: 3px; background: var(--primary); display: inline-block; }

/* 食材 + 缩放 */
.ingredients { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.servings { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.stepper { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.stepper button { width: 44px; height: 44px; font-size: 22px; background: var(--surface-2); }
.stepper button:active { background: var(--primary-soft); }
.stepper .val { min-width: 44px; text-align: center; font-weight: 700; font-size: 18px; }
.ing-list { list-style: none; }
.ing-list li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.ing-list li:last-child { border-bottom: none; }
.ing-qty { color: var(--primary-strong); font-weight: 600; }

/* 步骤 */
.steps { display: flex; flex-direction: column; gap: 12px; }
.step {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: flex; gap: 12px;
}
.step-num {
  flex: 0 0 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--font-display);
}
.step-text { flex: 1; }
.notes { margin-top: 10px; display: grid; gap: 8px; }
.note {
  display: flex; gap: 8px; align-items: flex-start; font-size: 14px;
  background: var(--surface-2); border-radius: 10px; padding: 8px 10px;
}
.note .ico { font-size: 16px; }
.note .k { color: var(--muted); flex: 0 0 auto; }
.note .v { color: var(--ink); }
.note.cue { background: var(--accent-soft); }
.note.failure { background: #fde3da; }

/* 信任信号条 */
.trustbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.trustbar .btn { flex: 1; min-width: 110px; }
.stars { color: var(--warn); letter-spacing: 2px; font-size: 18px; }

/* 评论 */
.comment { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.comment .who { font-weight: 600; font-size: 14px; }
.comment .when { color: var(--muted); font-size: 12px; }
.comment-form { display: flex; gap: 8px; margin-top: 10px; }
.comment-form input { flex: 1; min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-size: 16px; }
.comment-form input:focus { outline: 3px solid var(--primary-soft); }

/* 空状态 */
.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
.empty .big { font-size: 56px; }

/* ---------- 编辑器 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 15px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); font-size: 16px; color: var(--ink); font-family: inherit;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: 3px solid var(--primary-soft); border-color: var(--primary); }
.field textarea { min-height: 72px; resize: vertical; }
.ing-row, .step-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: flex-start; }
.ing-row input { flex: 1; }
.ing-row .qty { flex: 0 0 84px; }
.ing-row .unit { flex: 0 0 72px; }
.step-row textarea { flex: 1; }
.icon-btn { flex: 0 0 44px; height: 44px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 20px; }
.icon-btn.danger { color: var(--primary-strong); }
.note-grid { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 8px; background: var(--surface-2); border-radius: 12px; padding: 10px; }
@media (min-width: 560px) { .note-grid { grid-template-columns: 1fr 1fr; } }
.note-grid .field { margin: 0; }

/* ---------- 做菜模式（全屏） ---------- */
.cook {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; flex-direction: column; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.cook-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.cook-progress { height: 6px; background: var(--border); border-radius: 3px; margin: 0 18px; overflow: hidden; }
.cook-progress > span { display: block; height: 100%; background: var(--primary); transition: width .3s ease; }
.cook-body { flex: 1; overflow-y: auto; padding: 22px 18px; max-width: var(--maxw); margin: 0 auto; width: 100%; }
.cook-step-no { font-family: var(--font-display); color: var(--primary); font-size: 18px; }
.cook-step-text { font-size: 26px; line-height: 1.5; font-weight: 500; margin: 10px 0 18px; font-family: var(--font-display); }
.cook-timer { display: flex; align-items: center; gap: 14px; margin: 16px 0; flex-wrap: wrap; }
.timer-ring {
  width: 92px; height: 92px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--accent) var(--p, 0%), var(--surface-2) 0);
  font-size: 22px; font-weight: 700; color: var(--ink); position: relative;
}
.timer-ring::before { content: ""; position: absolute; inset: 8px; background: var(--surface); border-radius: 50%; }
.timer-ring span { position: relative; z-index: 1; }
.cook-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.cook-foot .btn { flex: 1; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-around;
  background: rgba(255, 253, 250, 0.92); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border); padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  max-width: var(--maxw); margin: 0 auto;
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); min-width: 60px; padding: 4px 0; }
.tab-ico { font-size: 22px; }
.tab-tx { font-size: 12px; }
.tab.active { color: var(--primary-strong); }
.tab-fab {
  background: var(--primary); color: #fff; width: 58px; height: 58px; border-radius: 50%;
  margin-top: -22px; box-shadow: var(--shadow-md); justify-content: center;
}
.tab-fab-ico { font-size: 30px; line-height: 1; }

/* ---------- 提示 toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 200; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--primary-strong); }

/* 登录浮层 */
.modal-mask { position: fixed; inset: 0; background: rgba(42, 33, 28, .5); display: flex; align-items: center; justify-content: center; z-index: 150; padding: 20px; }
.modal { background: var(--surface); border-radius: 22px; padding: 24px; width: 100%; max-width: 360px; box-shadow: var(--shadow-md); }
.modal h3 { font-family: var(--font-display); font-size: 24px; margin-bottom: 6px; }
.modal p { color: var(--muted); font-size: 14px; margin-bottom: 16px; }

/* 采购清单 */
.shop-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 8px; }
.shop-item.done { opacity: .5; }
.shop-item.done .name { text-decoration: line-through; }
.shop-item .name { flex: 1; font-weight: 500; }
.shop-item .qty { color: var(--primary-strong); font-weight: 600; }
.shop-empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* 工具类 */
.row { display: flex; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.mt { margin-top: 16px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.loading { text-align: center; color: var(--muted); padding: 40px; }
