/* 吃点啥 · Web 端样式（简约版） */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #faf8f5; color: #333;
  max-width: 520px; margin: 0 auto;
  box-shadow: 0 0 24px rgba(0,0,0,.05);
  min-height: 100vh; display: flex; flex-direction: column;
}

/* 顶栏 */
#topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: #fff; border-bottom: 1px solid #f0ece5;
}
.brand { font-size: 19px; font-weight: 800; letter-spacing: 1px; color: #ff6a3d; }
.loc-chip {
  background: #fff3ec; border: 1px solid #ffd9c6; color: #e05a2b;
  border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer;
}
.loc-chip:active { transform: scale(.96); }

/* 视图 */
#views { flex: 1; padding: 14px 14px calc(78px + env(safe-area-inset-bottom)); }
.view { display: none; animation: fadein .18s ease; }
.view.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view-head h2 { font-size: 17px; margin-bottom: 10px; }
.muted { color: #999; font-size: 13px; line-height: 1.6; }
.small { font-size: 12px; }

/* 推荐页 */
.hero { text-align: center; padding: 22px 0 16px; }
.hero-q { font-size: 28px; font-weight: 800; }
.hero-q span { color: #ff6a3d; }
.hero-sub { margin-top: 8px; color: #a09686; font-size: 13px; line-height: 1.5; }
.plan-banner {
  background: #e8f7ee; border: 1px solid #bce5cc; color: #217a4b;
  border-radius: 12px; padding: 9px 12px; font-size: 13px;
}
.cta {
  display: block; width: 100%; border: none; border-radius: 14px; padding: 14px;
  font-size: 17px; font-weight: 700; cursor: pointer; transition: transform .08s ease;
}
.cta:active { transform: scale(.98); }
.cta-primary { background: #ff6a3d; color: #fff; box-shadow: 0 6px 16px rgba(255,106,61,.28); }
.cta-ghost { background: #fff; color: #666; border: 1.5px solid #e8e2d8; margin-top: 10px; font-weight: 600; }
.custom-row { display: flex; gap: 8px; margin-top: 12px; }
.custom-row input {
  flex: 1; border: 1.5px solid #e8e2d8; border-radius: 12px; padding: 10px 14px; font-size: 14px; background: #fff; outline: none;
}
.custom-row input:focus { border-color: #ff9a5a; }
.custom-row button {
  border: none; background: #fff3ec; color: #e05a2b; border-radius: 12px; padding: 0 18px; font-size: 16px; cursor: pointer;
}

/* 推荐结果卡 */
.result-card {
  margin-top: 16px; background: #fff; border-radius: 16px; padding: 18px 16px;
  border: 1px solid #f0ece5; animation: pop .22s ease;
}
@keyframes pop { 0% { opacity: 0; transform: scale(.95); } 100% { opacity: 1; transform: scale(1); } }
.result-name { font-size: 21px; font-weight: 800; line-height: 1.35; }
.result-cats { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.tagchip {
  font-size: 12px; border-radius: 999px; padding: 3px 10px;
  background: #fff3ec; color: #e05a2b; border: 1px solid #ffd9c6;
}
.tagchip.gray { background: #f5f4f2; color: #777; border-color: #e8e5e0; }
.reason-box { margin-top: 12px; background: #faf8f4; border-radius: 12px; padding: 10px 12px; }
.reason-title { font-size: 12px; color: #b09a7e; margin-bottom: 6px; font-weight: 700; }
.reason-box li { font-size: 13px; color: #6f6558; line-height: 1.8; list-style: none; padding-left: 16px; position: relative; }
.reason-box li::before { content: "✓"; position: absolute; left: 0; color: #38a862; font-weight: 700; }
.result-actions { display: flex; gap: 10px; margin-top: 14px; }
.result-actions .cta { padding: 11px; font-size: 15px; }
.btn-ok { background: #2fa360; color: #fff; }
.btn-swap { background: #fff; color: #666; border: 1.5px solid #e8e2d8; }

/* 附近页 */
.search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.search-row input {
  flex: 1; border: 1.5px solid #e8e2d8; border-radius: 12px; padding: 9px 14px; font-size: 14px; background: #fff; outline: none;
}
.search-row input:focus { border-color: #ff9a5a; }
.search-row button {
  border: none; background: #ff6a3d; color: #fff; border-radius: 12px; padding: 0 16px; font-size: 14px; cursor: pointer;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .chip {
  border: 1.5px solid #e5dfd5; background: #fff; color: #7a7064;
  border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; user-select: none;
}
.chips .chip.on { background: #ff6a3d; border-color: #ff6a3d; color: #fff; }
.nearby-tip { margin-top: 8px; font-size: 12px; color: #a89e8f; }
.card-list { display: flex; flex-direction: column; gap: 8px; }
.food-card {
  background: #fff; border-radius: 12px; padding: 12px 14px; border: 1px solid #f0ece5; cursor: pointer;
}
.food-card:active { transform: scale(.99); }
.food-name { font-size: 16px; font-weight: 700; }
.food-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }

/* 历史页 */
.stats-box {
  background: #fff; border: 1px solid #f0ece5; border-radius: 12px; padding: 11px 14px; margin-bottom: 12px;
  display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; font-size: 13px;
}
.stat-num { font-weight: 800; color: #ff6a3d; font-size: 16px; }
.hist-date { font-size: 13px; font-weight: 700; color: #a89e8f; margin: 12px 2px 8px; }
.hist-row {
  background: #fff; border: 1px solid #f0ece5; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.hist-main { flex: 1; min-width: 0; }
.hist-name { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-meta { font-size: 12px; color: #a09686; margin-top: 2px; }
.fb-btn {
  border: 1.5px solid #eee9e1; background: #fff; border-radius: 10px; width: 36px; height: 34px;
  font-size: 15px; cursor: pointer; flex-shrink: 0;
}
.fb-btn.on-up { background: #e8f7ee; border-color: #9fdcba; }
.fb-btn.on-down { background: #fdecec; border-color: #f2bcbc; }
.del-btn { border: none; background: none; color: #ccc; font-size: 15px; cursor: pointer; padding: 4px; }

/* 我的页 */
.card { background: #fff; border: 1px solid #f0ece5; border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; }
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.pref-label { font-size: 12px; color: #a89e8f; margin: 10px 0 6px; }
.card input[type="range"] { width: 100%; accent-color: #ff6a3d; }
.card .cta { margin-top: 14px; padding: 11px; font-size: 15px; }
.custom-form { display: flex; gap: 8px; }
.custom-form input {
  flex: 1; border: 1.5px solid #e8e2d8; border-radius: 10px; padding: 9px 12px; font-size: 14px; outline: none;
}
.custom-form button {
  border: none; background: #ff6a3d; color: #fff; border-radius: 10px; padding: 0 16px; cursor: pointer;
}
.custom-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f4efe8; font-size: 14px;
}
.custom-item:last-child { border-bottom: none; }
.custom-item .ci-meta { color: #a09686; font-size: 12px; }

/* 云同步开关 */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch { position: relative; display: inline-block; width: 50px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; background: #ddd8d0; border-radius: 999px; transition: .2s; cursor: pointer;
}
.switch span::before {
  content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + span { background: #2fa360; }
.switch input:checked + span::before { transform: translateX(22px); }

/* 计划 */
.plan-list { display: flex; flex-direction: column; gap: 2px; }
.plan-line {
  display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-bottom: 1px solid #f4efe8; font-size: 14px;
  flex-wrap: wrap;
}
.plan-line:last-child { border-bottom: none; }
.plan-line.today .plan-day { color: #ff6a3d; }
.plan-day { font-weight: 700; width: 40px; flex-shrink: 0; }
.plan-chip {
  background: #fff3ec; color: #d4531f; border-radius: 8px; padding: 3px 9px; font-size: 12px;
  display: inline-flex; align-items: center; gap: 4px;
}
.plan-chip b { cursor: pointer; color: #d9a08a; font-weight: 400; }

/* 底部 Tab */
#tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px; z-index: 30;
  display: flex; background: #fff; border-top: 1px solid #f0ece5;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; border: none; background: none; padding: 8px 0 7px; font-size: 20px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px; color: #b8b0a4;
}
.tab span { font-size: 11px; }
.tab.active { color: #ff6a3d; }

/* 菜品（列表为核心操作单元） */
.rest-line { margin-top: 6px; font-size: 13px; color: #8a8177; }
.food-sig { font-size: 12px; color: #b0603a; margin-top: 3px; }
.dish-section { margin-top: 14px; border-top: 1px dashed #eee7dc; padding-top: 10px; }
.dish-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.dish-list { display: flex; flex-direction: column; }
.dish-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 2px; border-bottom: 1px solid #f4efe8; font-size: 14px;
}
.dish-row:last-of-type { border-bottom: none; }
.dish-row.sig .dish-row-name { color: #b0603a; font-weight: 700; }
.dish-row.mine .dish-row-name { color: #217a4b; }
.dish-row-main { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.dish-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dish-row-meta { font-size: 12px; color: #a89e8f; flex-shrink: 0; }
.row-btn {
  border: 1.5px solid #eee9e1; background: #fff; border-radius: 8px;
  width: 34px; height: 32px; font-size: 14px; cursor: pointer; flex-shrink: 0;
}
.row-btn.eat { background: #e8f7ee; border-color: #bce5cc; }
.row-btn.del { color: #ccc; }
.dish-note { font-size: 11px; color: #b8ae9f; margin-top: 8px; line-height: 1.5; }
.dish-form { display: flex; gap: 6px; margin-top: 10px; }
.dish-form input {
  flex: 1; border: 1.5px solid #e8e2d8; border-radius: 10px; padding: 8px 10px; font-size: 13px; outline: none; min-width: 0;
}
.dish-form button {
  border: none; background: #ff6a3d; color: #fff; border-radius: 10px; padding: 0 14px; font-size: 13px; cursor: pointer;
}

/* 弹窗与 Toast */
#modalMask {
  position: fixed; inset: 0; background: rgba(40,30,20,.45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
#modal {
  background: #fff; width: 100%; max-width: 520px; border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: slideup .2s ease;
  max-height: 82vh; overflow-y: auto;
}
@keyframes slideup { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
#modal h3 { font-size: 17px; margin-bottom: 12px; }
#modal .modal-close {
  float: right; border: none; background: #f4f0ea; width: 28px; height: 28px; border-radius: 999px; cursor: pointer; font-size: 14px;
}
.modal-field { margin-bottom: 10px; }
.modal-field label { display: block; font-size: 12px; color: #a89e8f; margin-bottom: 5px; }
.modal-field select {
  width: 100%; border: 1.5px solid #e8e2d8; border-radius: 10px; padding: 10px 12px; font-size: 15px; background: #fff; outline: none;
}
#toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: rgba(50,40,30,.9); color: #fff; font-size: 14px;
  border-radius: 999px; padding: 10px 20px; z-index: 60; max-width: 86%; animation: fadein .2s ease;
}
.hidden { display: none !important; }
.empty { text-align: center; color: #b8ae9f; font-size: 13px; padding: 30px 0; line-height: 1.8; }
