* { box-sizing: border-box; margin: 0; padding: 0; }
button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
body { -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #fdf2e3;
  --card: #ffffff;
  --ink: #3b2a1b;
  --muted: #9c8671;
  --line: #f0e2d0;
  --accent: #ff6b2c;
  --green: #2f9e63;
  --radius: 22px;
  --shadow: 0 12px 34px rgba(150, 95, 40, 0.10);
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 85% -10%, rgba(255, 158, 84, 0.20), transparent 60%),
    radial-gradient(900px 560px at -10% 112%, rgba(255, 122, 60, 0.14), transparent 55%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.page { max-width: 860px; margin: 0 auto; padding: 40px 20px 60px; }

/* ---------- 头部 ---------- */
.hero { text-align: center; margin-bottom: 26px; }
.hero h1 { font-size: 44px; font-weight: 800; letter-spacing: 2px; }
.hero .q { color: var(--accent); display: inline-block; animation: bounce 1.8s infinite ease-in-out; }
.hero .sub { color: var(--muted); margin-top: 8px; font-size: 15px; letter-spacing: 1px; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

/* ---------- 筛选区 ---------- */
.filter-card { margin-bottom: 18px; }
.filter-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 560px) { .filter-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .filter-grid { grid-template-columns: repeat(4, 1fr); } }
.fg { display: flex; flex-direction: column; gap: 8px; }
.meal-row { grid-column: 1 / -1; }
.fg-label { font-size: 13px; color: var(--muted); font-weight: 600; }

.pills { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; }
.pill {
  font: inherit; font-size: 13px; cursor: pointer;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 10px; border-radius: 999px; transition: all .18s ease;
  text-align: center; white-space: nowrap; overflow: hidden;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill.active {
  background: linear-gradient(135deg, var(--accent), #ff9a3c);
  border-color: transparent; color: #fff; font-weight: 700;
  box-shadow: 0 4px 12px rgba(255, 107, 44, .30);
}

.filter-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; gap: 10px; flex-wrap: wrap; }
.link-btn { font: inherit; font-size: 13px; color: var(--muted); background: none; border: none; cursor: pointer; padding: 4px; }
.link-btn:hover { color: var(--accent); }
.count-info { font-size: 13px; color: var(--muted); }
.count-info b { color: var(--accent); }

/* ---------- 结果区 ---------- */
.result-card { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 34px 22px 26px; }
.result-content { width: 100%; min-height: 210px; display: flex; align-items: center; justify-content: center; }
.result-content.pop { animation: pop .3s ease; }
@keyframes pop { 0% { transform: scale(.94); opacity: .4; } 100% { transform: scale(1); opacity: 1; } }

.pick { text-align: center; }
.pick.plus { border: 1px solid var(--line); border-radius: 18px; padding: 18px 12px; }
.pick-emoji {
  width: 104px; height: 104px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 56px; border-radius: 50%;
  background: linear-gradient(135deg, #fff3e4, #ffe1c8);
  border: 3px solid #ffd9b8;
  box-shadow: inset 0 -6px 14px rgba(255, 150, 70, .15), 0 8px 18px rgba(255, 140, 60, .16);
}
.pick-name { font-size: 28px; font-weight: 800; letter-spacing: 1px; }
.pick-tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tag { font-size: 12px; background: #f2f7f2; color: var(--green); border: 1px solid #d8ead9; padding: 3px 9px; border-radius: 999px; }
.pick-desc { margin-top: 12px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.pick-meta { margin-top: 8px; font-size: 12px; color: var(--muted); }

.result-multi { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; width: 100%; }
.rolling-text { color: var(--muted); margin-top: 8px; font-size: 14px; }

.roll-btn {
  display: inline-flex; align-items: center; gap: 10px;
  font: inherit; font-size: 20px; font-weight: 800; color: #fff; letter-spacing: 2px;
  padding: 16px 44px; border: none; cursor: pointer; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #ff8a3c);
  box-shadow: 0 12px 26px rgba(255, 107, 44, .38);
  transition: transform .18s ease, box-shadow .18s ease;
}
.roll-btn:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 16px 32px rgba(255, 107, 44, .44); }
.roll-btn:active { transform: scale(.97); }
.roll-emoji { font-size: 24px; }

.multi-toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; user-select: none; }
.multi-toggle input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }

/* ---------- 历史 ---------- */
.history-card { margin-top: 18px; }
.history-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.history-title { font-size: 16px; font-weight: 700; }
.history-list { display: flex; flex-wrap: wrap; gap: 8px; }
.history-chip {
  font: inherit; font-size: 13px; cursor: pointer;
  border: 1.5px solid var(--line); background: #fffdf9; color: var(--ink);
  padding: 7px 13px; border-radius: 999px; transition: all .18s ease;
}
.history-chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* ---------- 空结果 ---------- */
.empty { text-align: center; padding: 30px 0; }
.empty .pick-emoji { background: #fff0e8; border-color: #ffdcc6; }
.empty p { color: var(--muted); margin-top: 10px; }

.foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 34px; }

/* ---------- 移动端适配（≤700px） ---------- */
@media (max-width: 700px) {
  /* 结果区提到筛选前面，打开即见核心功能 */
  .page {
    display: flex;
    flex-direction: column;
    padding: 22px 16px calc(96px + env(safe-area-inset-bottom));
  }
  .hero { order: 1; margin-bottom: 18px; }
  .result-card { order: 2; margin-bottom: 16px; }
  .filter-card { order: 3; margin-bottom: 0; }
  .history-card { order: 4; margin-top: 16px; }
  .foot { order: 5; margin-top: 24px; }

  .hero h1 { font-size: clamp(30px, 9vw, 40px); letter-spacing: 1px; }
  .hero .sub { font-size: 14px; }

  .card { border-radius: 18px; padding: 16px; }

  .result-card { padding: 24px 14px 22px; gap: 16px; }
  .result-content { min-height: 176px; }
  .pick-emoji { width: 92px; height: 92px; font-size: 48px; }
  .pick-name { font-size: 24px; }
  .pick-tags { margin-top: 8px; }
  .pick-desc { font-size: 13px; margin-top: 10px; }
  .result-multi { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .pick.plus { padding: 14px 8px; }
  .pick.plus .pick-emoji { width: 70px; height: 70px; font-size: 36px; margin-bottom: 10px; }
  .pick.plus .pick-name { font-size: 16px; }
  .pick.plus .pick-desc { font-size: 12px; }

  /* 筛选与历史按钮加大触控面积 */
  .pill { padding: 10px 10px; font-size: 14px; }
  .history-chip { padding: 9px 14px; font-size: 14px; }

  /* 「帮我决定」固定悬浮底部，单手可点 */
  .roll-btn {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    margin: 0;
    width: auto;
    height: 56px;
    justify-content: center;
    font-size: 18px;
    z-index: 30;
    box-shadow: 0 10px 28px rgba(255, 107, 44, .42);
  }
  .roll-emoji { font-size: 22px; }

  .multi-toggle { font-size: 14px; }
}
