:root {
  --bg: #FFF6F2;
  --bg2: #FFEAE1;
  --card: #FFFFFF;
  --primary: #FF7A9C;
  --primary-d: #F25C82;
  --accent: #FFB26B;
  --text: #5B4048;
  --muted: #B29AA2;
  --line: #F3DDD4;
  --gold: #FFC24B;
  --shadow: 0 8px 22px rgba(255, 122, 156, .16);
  --shadow-sm: 0 4px 12px rgba(255, 122, 156, .12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background:
    radial-gradient(120% 60% at 50% -10%, #FFE3EC 0%, rgba(255, 227, 236, 0) 60%),
    var(--bg);
  position: relative;
  padding-bottom: 84px;
}

/* ========== 登录页 ========== */
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 24px 40px;
  min-height: 100vh;
}

.login-hero {
  text-align: center;
  margin-bottom: 48px;
}

.login-logo {
  font-size: 72px;
  margin-bottom: 12px;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.login-title {
  font-size: 26px;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--text);
}

.login-sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.login-cards {
  display: flex;
  gap: 16px;
  width: 100%;
}

.role-card {
  flex: 1;
  border: 2.5px solid var(--line);
  background: var(--card);
  border-radius: 22px;
  padding: 28px 16px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  box-shadow: var(--shadow-sm);
}

.role-card:active {
  transform: scale(.96);
}

.role-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.role-card.foodie {
  border-color: #FFD5A0;
}

.role-card.foodie:hover {
  border-color: var(--accent);
}

.role-emoji {
  font-size: 48px;
  margin-bottom: 10px;
}

.role-name {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
}

.role-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}

/* ========== Header ========== */
.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 16px;
  background: linear-gradient(135deg, #FF9DBB, #FFB6C9);
  color: #fff;
  border-radius: 0 0 26px 26px;
  box-shadow: var(--shadow-sm);
}

.logo {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.title-wrap h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: .5px; }
.subtitle { margin: 2px 0 0; font-size: 12px; opacity: .9; }

/* ========== View ========== */
#view { padding: 14px 14px 0; }
.view-head { display: flex; align-items: center; justify-content: space-between; margin: 2px 2px 12px; }
.view-head h2 { margin: 0; font-size: 19px; font-weight: 800; }
.muted { color: var(--muted); font-size: 13px; }

/* ========== Date nav ========== */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border-radius: 18px;
  padding: 8px 10px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

.day-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 12px;
  background: var(--bg2);
  color: var(--primary-d);
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}

.day-btn:active { transform: scale(.92); }
.date-center { flex: 1; text-align: center; }
.date-center input[type=date] {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}
.date-pretty { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ========== Home hero ========== */
.home-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #FFF0D6, #FFE0E9);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.hero-title { font-weight: 800; font-size: 16px; color: #7A4A55; }

/* ========== Buttons ========== */
.btn-primary {
  border: none;
  border-radius: 14px;
  padding: 11px 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-d));
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.btn-primary:active { transform: scale(.96); }
.btn-primary.sm { padding: 8px 14px; font-size: 14px; }
.btn-ghost {
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 14px;
  padding: 11px 18px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
.btn-soft {
  flex: 1;
  border: 1.5px solid #FFD5E0;
  background: #FFF4F8;
  color: var(--primary-d);
  border-radius: 14px;
  padding: 10px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.btn-soft:active { transform: scale(.97); }
.btn-danger {
  width: 100%;
  margin-top: 18px;
  border: none;
  background: linear-gradient(135deg, #FF8A9B, #F2546B);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(242, 84, 107, .25);
}
.btn-danger:active { transform: scale(.97); }

/* ========== Meal sections ========== */
.meal { margin-bottom: 16px; }
.meal-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; margin: 0 4px 10px; }
.meal-icon { font-size: 20px; }
.meal-count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; }

/* ========== Dish small card ========== */
.dlist { display: flex; flex-direction: column; gap: 10px; }
.dcard {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 16px;
  padding: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  position: relative;
}
.dcard:active { transform: scale(.99); }
.dcard-img {
  width: 56px;
  height: 56px;
  border-radius: 13px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg2);
}
.dcard-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #FFE9D6, #FFD9E4);
  font-size: 26px;
}
.dcard-info { flex: 1; min-width: 0; }
.dcard-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dcard-cat { font-size: 12px; color: var(--muted); margin-top: 2px; }
.dcard-rate { font-size: 12px; color: var(--gold); font-weight: 700; margin-top: 2px; }
.dcard-go { color: var(--muted); font-size: 22px; }
.dcard-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(91, 64, 72, .55);
  color: #fff;
  font-size: 13px;
  line-height: 24px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  z-index: 2;
}

/* ========== Menu grid ========== */
.mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mcard {
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.mcard:active { transform: scale(.98); }
.mcard-img { width: 100%; aspect-ratio: 1/1; background: var(--bg2); }
.mcard-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mcard-img .ph { width: 100%; height: 100%; font-size: 40px; }
.mcard-body { padding: 9px 10px 11px; }
.mcard-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcard-cat { font-size: 11px; color: var(--muted); margin-top: 2px; }
.mcard { position: relative; }
.mcard-edit {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--primary-d);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
  transition: transform .15s, background .15s;
}
.mcard-edit:active { transform: scale(.88); }
.mcard-edit:hover { background: rgba(255, 255, 255, 1); }

/* ========== Segment ========== */
.segment { display: flex; background: var(--bg2); border-radius: 14px; padding: 4px; margin-bottom: 10px; }
.seg {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 11px;
  padding: 9px;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}
.seg.on { background: #fff; color: var(--primary-d); box-shadow: var(--shadow-sm); }
.order-target { font-size: 13px; color: var(--muted); margin: 0 4px 12px; }
.order-target b { color: var(--text); }

/* ========== 分类下拉筛选 ========== */
.cat-filter-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg2);
  border-radius: 14px;
  padding: 8px 12px;
  margin-bottom: 12px;
}
.cat-filter-label { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.cat-filter {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  padding: 4px 22px 4px 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%23B98A98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right center;
}
.cat-filter:focus { outline: none; }

/* ========== Order card ========== */
.ocard {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 16px;
  padding: 10px;
  box-shadow: var(--shadow-sm);
}
.ocard-info { flex: 1; min-width: 0; }
.add-btn {
  border: none;
  border-radius: 13px;
  padding: 9px 15px;
  font-weight: 700;
  font-size: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-d));
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.add-btn:active { transform: scale(.95); }
.add-btn.added { background: #fff; color: var(--primary-d); border: 1.5px solid #FFD5E0; box-shadow: none; }

/* ========== Empty ========== */
.empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
  background: var(--card);
  border-radius: 16px;
  padding: 22px 16px;
  box-shadow: var(--shadow-sm);
}
.empty.big { padding: 40px 16px; font-size: 14px; }

/* ========== Detail ========== */
.detail { padding-bottom: 10px; }
.back {
  border: none;
  background: transparent;
  color: var(--primary-d);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 8px;
}
.detail-img {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg2);
  box-shadow: var(--shadow);
}
.detail-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph.big { width: 100%; height: 100%; font-size: 64px; }
.detail-body { padding: 14px 4px 0; }
.detail-name { font-size: 22px; font-weight: 800; }
.detail-cat {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-d);
  background: #FFF0F5;
  padding: 3px 11px;
  border-radius: 20px;
}
.detail-desc { margin: 12px 0 0; font-size: 14px; color: #7A6168; line-height: 1.7; }
.detail-rate { margin-top: 12px; display: flex; align-items: center; gap: 8px; }
.stars { color: var(--gold); letter-spacing: 2px; font-size: 16px; }
.stars.sm { font-size: 13px; }
.rate-num { font-size: 13px; color: var(--muted); }
.quick-add { display: flex; gap: 10px; margin-top: 16px; }
.review-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 12px; }
.review-head h3 { margin: 0; font-size: 17px; font-weight: 800; }
.reviews { display: flex; flex-direction: column; gap: 10px; }
.review { background: var(--card); border-radius: 15px; padding: 12px; box-shadow: var(--shadow-sm); }
.review-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.review-text { font-size: 14px; color: #6B525A; line-height: 1.6; word-break: break-word; }

/* ========== Tabbar ========== */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 18px rgba(255, 122, 156, .08);
}
.tab {
  flex: 1;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  padding: 5px 0;
}
.tab span { font-size: 22px; filter: grayscale(.4); transition: .15s; }
.tab label { font-size: 11px; font-weight: 600; }
.tab.active { color: var(--primary-d); }
.tab.active span { filter: none; transform: translateY(-1px) scale(1.05); }

/* ========== Modal ========== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(91, 64, 72, .45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 480px;
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  animation: slideup .25s ease;
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 800; }
.x { border: none; background: var(--bg2); color: var(--muted); width: 30px; height: 30px; border-radius: 50%; font-size: 15px; cursor: pointer; }
.modal-body { display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; gap: 10px; margin-top: 18px; }
.modal-foot .btn-ghost, .modal-foot .btn-primary { flex: 1; }

.img-upload {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg2);
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.upload-placeholder { text-align: center; color: var(--muted); font-size: 14px; line-height: 1.7; }
.img-preview { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-remove-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  border: none;
  border-radius: 12px;
  background: rgba(242, 84, 107, .88);
  color: #fff;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  z-index: 2;
  backdrop-filter: blur(4px);
}
.img-remove-btn:active { transform: scale(.95); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 700; color: #7A6168; }
.field > span i { color: var(--primary-d); font-style: normal; }
.field input, .field textarea {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  outline: none;
  resize: none;
}
.field input:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { min-height: 80px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.chip.on { background: linear-gradient(135deg, var(--primary), var(--primary-d)); color: #fff; border-color: transparent; }

/* ========== Star input ========== */
.stars-input { display: flex; justify-content: center; gap: 10px; font-size: 36px; color: #E7D3C9; }
.stars-input span { cursor: pointer; transition: transform .1s; }
.stars-input span.on { color: var(--gold); }
.stars-input span:active { transform: scale(1.2); }

/* ========== Confirm modal ========== */
.confirm-modal { padding-top: 26px; text-align: center; }
.confirm-text { margin: 0 0 20px; font-size: 15px; line-height: 1.6; color: var(--text); }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions button { flex: 1; padding: 11px 18px; font-size: 15px; }
.confirm-actions .btn-danger { width: auto; margin-top: 0; border: 1.5px solid transparent; }

/* ========== 菜谱页 ========== */
.cb-hint {
  font-size: 13px;
  color: var(--muted);
  margin: 0 4px 14px;
  padding: 10px 14px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.cb-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.cb-card:active { transform: scale(.99); }

.cb-left { flex-shrink: 0; }
.cb-img {
  width: 56px;
  height: 56px;
  border-radius: 13px;
  overflow: hidden;
  background: var(--bg2);
}
.cb-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cb-img .ph { font-size: 26px; }

.cb-info { flex: 1; min-width: 0; }
.cb-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-cat { font-size: 11px; color: var(--primary-d); background: #FFF0F5; padding: 1px 8px; border-radius: 10px; margin-left: 6px; font-weight: 700; }
.cb-preview { font-size: 13px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cb-status {
  font-size: 22px;
  flex-shrink: 0;
  opacity: .5;
}
.cb-status.done { opacity: 1; }

/* ========== 菜谱编辑页 ========== */
.recipe-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.recipe-dish-img {
  width: 100px;
  height: 100px;
  border-radius: 18px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg2);
  box-shadow: var(--shadow-sm);
}
.recipe-dish-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recipe-dish-img .ph { font-size: 40px; }

.recipe-dish-info { flex: 1; min-width: 0; }
.recipe-dish-info .detail-name { font-size: 20px; }
.recipe-dish-info .detail-desc { margin-top: 6px; }

.recipe-editor-wrap {
  background: var(--card);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.recipe-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.recipe-editor-head h3 { margin: 0; font-size: 17px; font-weight: 800; }

.recipe-editor {
  width: 100%;
  min-height: 300px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  outline: none;
  resize: vertical;
  line-height: 1.8;
}

.recipe-editor:focus { border-color: var(--primary); }
.recipe-editor::placeholder { color: var(--muted); }

/* ========== Toast ========== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(91, 64, 72, .92);
  color: #fff;
  padding: 10px 20px;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 600;
  z-index: 99;
  opacity: 0;
  transition: .25s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.verify-hint {
  font-size: 14px;
  color: #7A6168;
  margin: 0 0 8px;
  line-height: 1.6;
}

/* 关键修复：hidden 属性覆盖 */
.modal-mask[hidden] { display: none; }
.img-preview[hidden] { display: none; }

/* ICP 备案号 */
.icp-footer {
  text-align: center;
  padding: 12px 0 68px;
  font-size: 12px;
}
.icp-footer a {
  color: var(--muted);
  text-decoration: none;
}
.icp-footer a:hover {
  color: var(--primary);
}
