/* styles.css — 吃嘛 · 暖调食堂编辑风（mobile-first） */
:root {
  --primary: #e8590c;
  --primary-hover: #d9480f;
  --accent: #c92a2a;
  --spicy: #e03131;
  --bg: #fbf3e7;
  --surface: #ffffff;
  --border: #eedfc9;
  --text: #2b1a10;
  --text-sub: #96755c;
  --success: #2f9e44;
  --warning: #e8930c;
  --font-display: "Kaiti SC", "STKaiti", "KaiTi", "FangSong", serif;
  --font-body: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --r-md: 14px;
  --r-lg: 20px;
  --sh-sm: 0 1px 3px rgba(43, 26, 16, 0.08);
  --sh-md: 0 6px 20px rgba(43, 26, 16, 0.1);
  --sh-lg: 0 14px 36px rgba(232, 89, 12, 0.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(620px 320px at 88% -60px, rgba(247, 103, 7, 0.12), transparent 60%),
    radial-gradient(520px 340px at -80px 32%, rgba(201, 42, 42, 0.08), transparent 60%),
    radial-gradient(rgba(43, 26, 16, 0.045) 1px, transparent 1.5px);
  background-size: auto, auto, 22px 22px;
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.app {
  max-width: 430px;
  margin: 0 auto;
  padding: 28px 20px;
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* —— 页头 —— */
.top { text-align: center; }
.logo {
  width: 46px;
  height: 46px;
  margin: 0 auto 10px;
  border-radius: 16px;
  background: linear-gradient(135deg, #f76707, #e8590c);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--sh-md);
}
.top h1 {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1.15;
}
.top h1 .accent { color: var(--primary); }
.date { margin-top: 6px; font-size: 14px; color: var(--text-sub); }

/* —— Hero 插画 —— */
.hero {
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-md);
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #ffe3c7, #ffd1a6);
}
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero.noimg { display: none; }

/* —— 偏好输入面板 —— */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--sh-sm);
}
.panel label { font-size: 14px; font-weight: 700; display: block; margin-bottom: 10px; }
.panel .opt { font-size: 12px; font-weight: 400; color: var(--text-sub); }
#pref {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  background: #fffdfa;
  resize: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#pref::placeholder { color: #c4ab93; }
#pref:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(232, 89, 12, 0.13);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); background: #fef0e6; }
.chip:active { transform: scale(0.96); }
.chip.hit { border-color: var(--primary); color: var(--primary); background: #fef0e6; }

/* —— 决定按钮 —— */
.decide {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #f76707, #e8590c);
  color: #fff;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 3px;
  cursor: pointer;
  box-shadow: var(--sh-lg);
  transition: transform 0.18s, box-shadow 0.18s, opacity 0.18s;
}
.decide:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(232, 89, 12, 0.3); }
.decide:active:not(:disabled) { transform: scale(0.97); }
.decide:disabled { opacity: 0.75; cursor: default; }
.decide .spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.decide.loading .spinner { display: block; }
.decide.loading .dice-ic { display: none; }

/* —— 结果区 —— */
#result { min-height: 120px; display: flex; flex-direction: column; }

.empty {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 36px 20px;
  text-align: center;
  color: var(--text-sub);
  background: rgba(255, 255, 255, 0.55);
}
.empty .ghost-ic { opacity: 0.35; margin-bottom: 10px; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--text); }
.empty-hint { font-size: 13px; margin-top: 4px; }
.empty .ghost-btn { margin: 16px auto 0; display: inline-flex; }

.dish-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md);
  padding: 20px;
  animation: pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.dish-card.is-loading { animation: none; box-shadow: var(--sh-sm); }

.dish-stall {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-sub);
}
.dish-stall .ic { flex: none; color: var(--primary); }

.dish-head { display: flex; gap: 14px; align-items: flex-start; }
.dish-badge {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffe8d9, #ffd8c2);
  color: var(--primary);
  display: grid;
  place-items: center;
}
.dish-title { flex: 1; min-width: 0; }
.dish-title h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}
.trow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ttag {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #f7ede0;
  color: #8c6f5d;
}
.ttag.spicy { background: #fdecec; color: var(--spicy); }

.dish-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}
.stat {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff7ee;
  border: 1px solid #f5e6d3;
  border-radius: var(--r-md);
  padding: 10px 12px;
}
.stat .ic { color: var(--primary); flex: none; }
.stat b { font-family: var(--font-mono); font-size: 22px; line-height: 1; }
.stat b.price { color: var(--primary); }
.stat small { font-size: 12px; color: var(--text-sub); }

.relaxed-note { font-size: 12.5px; color: var(--warning); margin-bottom: 10px; }

.reason {
  background: #fff4e6;
  border-radius: 12px;
  padding: 12px 14px;
}
.reason-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}
.reason p { font-size: 14.5px; line-height: 1.7; color: #5c4632; }

.match { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mchip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e9f7ec;
  color: #2b8a3e;
  font-size: 12.5px;
}
.mchip .ic { flex: none; }

.dish-actions { margin-top: 16px; }
.ghost-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 11px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: #fff;
  color: #6b4f3a;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.ghost-btn:hover { border-color: var(--primary); color: var(--primary); background: #fef0e6; }
.ghost-btn:active { transform: scale(0.98); }

.slot-hint { margin-top: 14px; font-size: 13px; color: var(--text-sub); text-align: center; }
#slotName { color: var(--primary); font-weight: 600; }

/* —— 骨架屏 —— */
.sk {
  background: linear-gradient(90deg, #f3e8d8 25%, #fbf3e7 45%, #f3e8d8 65%);
  background-size: 200% 100%;
  animation: shimmer 1.1s infinite;
}

/* —— 页脚 —— */
.foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-sub);
  text-align: center;
}
.foot .ic { opacity: 0.6; }

/* —— 动效 —— */
.reveal { opacity: 0; animation: rise 0.55s ease-out forwards; animation-delay: calc(var(--d, 0) * 70ms); }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes pop {
  0% { opacity: 0; transform: scale(0.92) translateY(10px); }
  100% { opacity: 1; transform: none; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }

.ic { flex: none; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; }
}

/* —— v2.0 口味档案 · 三卡模式 —— */
.pref-foot { margin-top: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.ghost-btn.compact { width: auto; padding: 8px 14px; font-size: 13px; border-radius: 999px; }
.profile-summary { font-size: 12.5px; color: var(--text-sub); line-height: 1.5; }

.actions { display: flex; flex-direction: column; gap: 10px; }
.novelty-btn { width: 100%; }

.card-stack { display: flex; flex-direction: column; gap: 14px; }
/* 三卡：竖屏内横向滑动，一屏露出约 1.4 张，左右滑动看其余 */
.card-stack.is-multi {
  flex-direction: row;
  gap: 12px;
  padding: 4px 0 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.card-stack.is-multi::-webkit-scrollbar { display: none; }
.card-stack.is-multi > .dish-card {
  flex: 0 0 72%;
  scroll-snap-align: start;
}
.swipe-hint { margin-top: 10px; font-size: 12px; color: var(--text-sub); text-align: center; }
.card-index { font-size: 11px; letter-spacing: 1.5px; color: var(--text-sub); margin-bottom: 8px; }
.group-actions { margin-top: 14px; }
.pick-btn.is-picked { color: var(--success); border-color: #c9e8cf; background: #effaf1; }
body.modal-open { overflow: hidden; }

.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(43, 26, 16, 0.45);
  opacity: 0; transition: opacity 0.18s;
}
.modal.is-open .modal-backdrop { opacity: 1; }
.modal-sheet {
  position: relative;
  width: 100%; max-width: 430px; max-height: 88vh; overflow-y: auto;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(24px); opacity: 0;
  transition: transform 0.22s, opacity 0.22s;
  box-shadow: 0 -10px 40px rgba(43, 26, 16, 0.18);
}
.modal.is-open .modal-sheet { transform: translateY(0); opacity: 1; }
.modal-head { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.modal-head h2 { font-family: var(--font-display); font-size: 24px; line-height: 1.25; }
.modal-head p { font-size: 13px; color: var(--text-sub); margin-top: 4px; }
.modal-x { border: none; background: transparent; font-size: 26px; line-height: 1; color: var(--text-sub); cursor: pointer; padding: 2px 6px; }
.modal-body { display: flex; flex-direction: column; gap: 18px; }
.field h3 { font-size: 14px; margin-bottom: 10px; }
.field h3 span { font-size: 12px; font-weight: 400; color: var(--text-sub); }
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 14px;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.15s;
}
.pick[aria-pressed="true"] { border-color: var(--primary); background: #fef0e6; color: var(--primary); font-weight: 700; }
.seg { display: flex; gap: 6px; padding: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 14px; }
.seg-btn {
  flex: 1;
  padding: 9px 6px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-size: 13.5px;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.15s;
}
.seg-btn[aria-pressed="true"] { background: var(--surface); color: var(--primary); font-weight: 700; box-shadow: var(--sh-sm); }
#avoidInput {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 11px 12px;
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--text);
  background: #fffdfa;
}
#avoidInput:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(232, 89, 12, 0.13); }
.field-hint { margin-top: 8px; font-size: 12px; color: var(--text-sub); }
.modal-foot { display: flex; gap: 10px; margin-top: 18px; }
.modal-foot .ghost-btn { flex: 1; }
.modal-foot .decide.compact { flex: 1.4; font-size: 16px; letter-spacing: 1px; padding: 12px; }

/* —— 条件冲突提示 —— */
.conflict-hint {
  margin-top: 10px;
  padding: 8px 11px;
  border: 1px solid #f2ddb8;
  border-radius: 10px;
  background: #fff8ea;
  color: #8a5300;
  font-size: 12.5px;
  line-height: 1.6;
}
.conflict-note {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #f2ddb8;
  border-radius: 12px;
  background: #fff8ea;
  color: #8a5300;
  font-size: 13px;
  line-height: 1.6;
}
.conflict-note span { display: flex; align-items: flex-start; gap: 6px; }
.conflict-note .ghost-btn.compact { width: auto; padding: 7px 12px; font-size: 12.5px; }
.card-label {
  display: inline-block;
  margin-bottom: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fff0e0;
  color: var(--primary);
  font-size: 12px;
}

/* —— 收藏夹 · 浮动按钮 —— */
.fav-fab {
  position: fixed;
  right: 16px;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(232, 89, 12, 0.35);
  cursor: pointer;
  z-index: 50;
  transition: transform 0.15s, box-shadow 0.15s;
}
.fav-fab:active { transform: scale(0.92); box-shadow: 0 2px 8px rgba(232, 89, 12, 0.3); }
.fav-fab .ic { width: 22px; height: 22px; }
.fav-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ff6b6b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* —— 卡片里的 ❤️ 按钮 —— */
.dish-actions { display: flex; gap: 10px; align-items: center; }
.dish-actions .ghost-btn { flex: 0 1 auto; }
.fav-btn { padding: 10px 12px !important; line-height: 1 !important; }
.fav-btn.is-faved { color: #ff4d6d; border-color: #ffd6de; background: #fff5f7; }

/* —— 收藏面板 —— */
.fav-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.fav-panel[hidden] { display: none; }
.fav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
}
.fav-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.fav-panel .fav-head + #favList,
.fav-panel #favList {
  background: #fff;
  width: 100%;
  max-height: 70vh;
  overflow-y: auto;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}
.fav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f1f3;
}
.fav-info { flex: 1; min-width: 0; }
.fav-name { font-size: 15px; font-weight: 600; color: var(--text); }
.fav-meta { font-size: 12.5px; color: var(--text-sub); margin-top: 2px; }
.fav-actions { display: flex; gap: 6px; flex-shrink: 0; }
.fav-del { color: #ff4d6d !important; border-color: #ffd6de !important; }

/* —— "已记下"撤销链接 —— */
.pick-undo {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
  background: rgba(232, 89, 12, 0.08);
  cursor: pointer;
  user-select: none;
}
.pick-undo:active { background: rgba(232, 89, 12, 0.15); }
