:root {
  --bg: #fffaf5;
  --card: #ffffff;
  --ink: #2b2622;
  --muted: #8a817a;
  --accent: #ff6a3d;
  --accent-soft: #ffe9e0;
  --line: #efe6dd;
  --shadow: 0 6px 20px rgba(120, 80, 50, 0.10);
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

header {
  text-align: center;
  padding: 24px 8px 8px;
}
header h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 1px;
}
header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* 全家想吃 面板 */
.wanted {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 18px 0;
}
.wanted-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.wanted-head h2 {
  margin: 0;
  font-size: 16px;
}
.wanted-head .count {
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
}
.wanted-clear {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}
.wanted-copy {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
}
.wanted-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.wanted-empty {
  color: var(--muted);
  font-size: 14px;
}
.chip-wanted {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.chip-wanted .x {
  color: var(--accent);
  font-weight: 700;
}

/* 吃货回顾 */
.stats {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 18px 0;
}
.stats h2 { margin: 0 0 10px; font-size: 16px; }
.stats-sum { color: var(--ink); font-size: 14px; margin: 0 0 10px; }
.stats-sum b { color: var(--accent); }
.stats-recent { display: flex; flex-wrap: wrap; gap: 8px; }
.stats-recent .chip-wanted .x { color: var(--muted); font-weight: 400; font-size: 12px; }

/* 筛选栏 */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 8px 0 18px;
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 10px 0;
  z-index: 5;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s ease;
}
.chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.search {
  flex: 1;
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 14px;
  outline: none;
}
.search:focus { border-color: var(--accent); }

/* 食材筛选 */
.ing-filter-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}
.ing-label {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.ing-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ing-chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s ease;
}
.ing-chip.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* 卡片网格 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .15s ease;
  position: relative;
}
.card:hover { transform: translateY(-3px); }
.card img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
}
.card-body { padding: 10px 12px 14px; }
.card-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-tags {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.tag {
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 2px 7px;
}
.heart {
  font-size: 16px;
  line-height: 1;
}
.heart.on { color: var(--accent); }
.badge-want {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
}
.badge-eaten {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(60, 120, 70, 0.92);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
}

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(40, 30, 20, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 20;
}
.modal-mask.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 20px;
  max-width: 460px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
}
.modal img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
}
.modal-body { padding: 18px 20px 22px; }
.modal-body h2 { margin: 0 0 6px; }
.modal-desc { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin: 16px 0 8px;
}
.ings { display: flex; flex-wrap: wrap; gap: 6px; }
.ing {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 13px;
}
.steps { margin: 0; padding-left: 18px; }
.steps li { margin: 6px 0; font-size: 14px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.btn {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary.off { background: var(--accent-soft); color: var(--accent); }
.btn-ghost { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.close-x {
  position: absolute;
  top: 12px;
  right: 14px;
  background: rgba(0,0,0,0.4);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}

/* 随机推荐 */
.shuffle {
  background: linear-gradient(135deg, #fff3ec, #ffe9e0);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 10px 0 18px;
  text-align: center;
}
.shuffle h2 {
  margin: 0 0 12px;
  font-size: 16px;
}
.shuffle-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.shuffle-btns .btn {
  flex: 0 1 auto;
  min-width: 160px;
}

/* 推荐一桌 结果 */
.meal-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 6px 0 4px;
}
.meal-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
}
.meal-item img {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.meal-cat {
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
}
.meal-name {
  font-size: 15px;
  font-weight: 600;
}

/* 一周菜单 */
.week-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 6px 0 4px;
}
.week-day {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.week-day-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}
.week-dishes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.week-dish {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 13px;
}
.week-add { font-size: 13px; padding: 6px 12px; }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 30px;
}
