:root {
  --bg: #f7f5f0;
  --surface: #fff;
  --surface-2: #f0eee8;
  --text: #272a24;
  --muted: #70746b;
  --line: #deddd5;
  --red: #a93c2c;
  --red-dark: #7d2c21;
  --green: #3e654c;
  --gold: #c89135;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.topbar { position: sticky; top: 0; z-index: 20; height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 max(18px, calc((100vw - 1240px) / 2)); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 6px; background: var(--red); color: #fff; font: 700 21px/1 serif; }
.brand strong, .brand small { display: block; letter-spacing: 0; }
.brand strong { font-size: 17px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.account-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.account-link { color: var(--red); font-size: 13px; text-decoration: none; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); text-decoration: none; font-size: 18px; }
.page-shell { width: min(1240px, calc(100% - 36px)); margin: 0 auto 72px; }
.intro-band { min-height: 184px; display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; padding: 45px 0 30px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 8px; color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: 0; }
.intro-band h1 { margin: 0; font: 700 clamp(34px, 5vw, 54px)/1.12 Georgia, "Songti SC", serif; }
.intro-band p:last-child { margin: 14px 0 0; color: var(--muted); font-size: 16px; }
.today-stats { min-width: 120px; padding-left: 24px; border-left: 2px solid var(--red); }
.today-stats strong, .today-stats span { display: block; }
.today-stats strong { font: 700 34px/1 Georgia, serif; }
.today-stats span { margin-top: 6px; color: var(--muted); font-size: 12px; }
.view-tabs { display: flex; gap: 2px; overflow-x: auto; padding: 18px 0; border-bottom: 1px solid var(--line); }
.view-tab { flex: 0 0 auto; min-height: 40px; padding: 0 18px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); }
.view-tab span { margin-left: 5px; font-size: 11px; }
.view-tab.is-active { background: var(--text); color: #fff; }
[data-panel] { padding-top: 24px; }
.filter-bar { display: grid; grid-template-columns: minmax(240px, 2fr) repeat(4, minmax(120px, 1fr)); gap: 10px; }
.filter-bar label, .plan-form-grid label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.filter-bar select, .filter-bar input, .plan-form-grid select, .plan-form-grid input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 5px; outline: none; background: #fff; color: var(--text); font-weight: 400; }
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(169,60,44,.1); }
.search-field { position: relative; justify-content: flex-end; }
.search-field input { padding-left: 42px; }
.search-icon { position: absolute; left: 14px; bottom: 10px; color: var(--muted); font-size: 22px; font-weight: 400; }
.result-line { display: flex; align-items: baseline; gap: 5px; min-height: 52px; padding: 16px 0 12px; color: var(--muted); font-size: 12px; }
.result-line strong { color: var(--text); font-size: 14px; }
.result-line button { margin-left: auto; border: 0; background: none; color: var(--red); font-size: 12px; }
.recipe-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.recipe-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); transition: transform .16s ease, box-shadow .16s ease; }
.recipe-card:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(43,42,35,.09); }
.card-image-wrap { position: relative; aspect-ratio: 4/3; overflow: hidden; background: var(--surface-2); }
.card-image { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .3s ease; }
.recipe-card:hover .card-image { transform: scale(1.025); }
.favorite-button { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255,255,255,.94); color: #5e6259; font-size: 20px; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.favorite-button.is-active { color: var(--gold); }
.card-body { padding: 16px; }
.card-kicker { display: flex; justify-content: space-between; gap: 10px; color: var(--red); font-size: 11px; font-weight: 700; }
.card-kicker span:last-child { color: var(--muted); font-weight: 400; }
.card-body h3 { margin: 8px 0 4px; font: 700 22px/1.25 Georgia, "Songti SC", serif; }
.card-body p { min-height: 40px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; min-height: 23px; margin: 13px 0; }
.tag-row span, .detail-meta span { padding: 4px 7px; border-radius: 4px; background: var(--surface-2); color: #5e6259; font-size: 11px; }
.view-recipe { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--text); }
.view-recipe:hover { border-color: var(--red); color: var(--red); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; font: 700 30px/1.2 Georgia, "Songti SC", serif; }
.section-heading > p, .sync-note { color: var(--muted); font-size: 12px; }
.primary-button, .secondary-button, .quiet-button { min-height: 40px; padding: 0 16px; border-radius: 5px; }
.primary-button { border: 1px solid var(--red); background: var(--red); color: #fff; }
.primary-button:hover { background: var(--red-dark); }
.secondary-button, .quiet-button { border: 1px solid var(--line); background: #fff; color: var(--text); }
.quiet-button { color: var(--muted); }
.empty-state { padding: 72px 20px; border: 1px dashed #c9c7bd; text-align: center; }
.empty-state strong { font: 700 22px Georgia, serif; }
.empty-state p { margin-bottom: 0; color: var(--muted); }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.day-column { min-width: 150px; border-top: 3px solid var(--text); background: #fff; }
.day-column h3 { margin: 0; padding: 13px; border: 1px solid var(--line); border-top: 0; font-size: 14px; }
.meal-slot { min-height: 114px; padding: 11px; border: 1px solid var(--line); border-top: 0; }
.meal-slot > span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.meal-slot strong { display: block; font-size: 13px; line-height: 1.45; }
.meal-slot small { display: block; margin-top: 4px; color: var(--muted); }
.slot-actions { display: flex; gap: 5px; margin-top: 9px; }
.slot-actions button { height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--muted); font-size: 11px; }
.empty-slot { width: 100%; height: 52px; border: 1px dashed #d0cec5; border-radius: 4px; background: transparent; color: #9a9b93; }
.heading-actions { display: flex; gap: 8px; }
.shopping-summary { display: flex; gap: 12px; margin-bottom: 14px; color: var(--muted); font-size: 12px; }
.shopping-list { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.shopping-item { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 13px; border: 1px solid var(--line); background: #fff; }
.shopping-item input { width: 18px; height: 18px; accent-color: var(--green); }
.shopping-item span { flex: 1; }
.shopping-item strong { font-size: 13px; }
.shopping-item.is-checked span, .shopping-item.is-checked strong { color: #999; text-decoration: line-through; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 80; max-width: min(390px, calc(100vw - 40px)); padding: 13px 16px; border-radius: 5px; background: #272a24; color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.22); font-size: 13px; }
dialog { width: min(920px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 0; border-radius: 7px; background: #fff; color: var(--text); box-shadow: 0 22px 70px rgba(24,25,21,.28); }
dialog::backdrop { background: rgba(24,25,21,.62); }
.recipe-dialog article { padding: 24px; }
.dialog-header { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.dialog-header h2 { margin: 0; font: 700 34px/1.15 Georgia, "Songti SC", serif; }
.dialog-header p:last-child { margin: 7px 0 0; color: var(--muted); }
.detail-image { width: 100%; aspect-ratio: 4/3; display: block; object-fit: cover; border-radius: 5px; background: var(--surface-2); }
.detail-meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.detail-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0 18px; border-bottom: 1px solid var(--line); }
.serving-control { display: flex; align-items: center; gap: 9px; }
.serving-control > span { margin-right: 5px; color: var(--muted); font-size: 12px; }
.serving-control button { width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.serving-control strong { min-width: 22px; text-align: center; }
.detail-actions { display: flex; gap: 8px; }
.detail-layout { display: grid; grid-template-columns: minmax(220px, .78fr) minmax(0, 1.65fr); gap: 28px; padding-top: 24px; }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.section-title span { color: var(--red); font: 700 12px Georgia, serif; }
.section-title h3 { margin: 0; font-size: 18px; }
.ingredient-list { margin: 0; padding: 0; list-style: none; }
.ingredient-list li { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.ingredient-list strong { white-space: nowrap; }
.step-list { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.step-list li { position: relative; padding: 0 0 20px 42px; counter-increment: step; }
.step-list li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--red); color: #fff; font-size: 12px; }
.step-list h4 { margin: 0 0 5px; font-size: 14px; }
.step-list p { margin: 0; color: #54584f; font-size: 13px; line-height: 1.65; }
.step-tip { display: block; margin-top: 6px; color: var(--red); font-size: 12px; }
.rescue-box { margin-top: 6px; padding: 15px 17px; border-left: 3px solid var(--gold); background: #f6f0e5; }
.rescue-box p { margin: 6px 0 0; color: #665a45; font-size: 13px; line-height: 1.65; }
.plan-dialog { width: min(520px, calc(100% - 28px)); }
.plan-dialog form { padding: 24px; }
.selected-recipe { padding: 12px; background: var(--surface-2); font-weight: 700; }
.plan-form-grid { display: grid; grid-template-columns: 1fr 1fr 90px; gap: 10px; margin: 18px 0; }
.form-warning { min-height: 20px; margin: 0; color: var(--red); font-size: 12px; }
.plan-dialog footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
@media (max-width: 920px) {
  .filter-bar { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .search-field { grid-column: 1 / -1; }
  .recipe-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .shopping-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 620px) {
  .topbar { height: 60px; padding: 0 14px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand small, .account-name { display: none; }
  .account-link { max-width: 58px; overflow: hidden; white-space: nowrap; }
  .page-shell { width: min(100% - 24px, 1240px); margin-bottom: 38px; }
  .intro-band { min-height: 150px; align-items: center; padding: 30px 0 20px; }
  .intro-band h1 { font-size: 38px; }
  .intro-band p:last-child { font-size: 14px; }
  .today-stats { display: none; }
  .view-tabs { margin: 0 -12px; padding: 12px; }
  .view-tab { padding: 0 14px; }
  [data-panel] { padding-top: 18px; }
  .filter-bar { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .recipe-grid, .shopping-list { grid-template-columns: 1fr; }
  .card-image-wrap { aspect-ratio: 4/3; }
  .section-heading { align-items: flex-start; }
  .section-heading h2 { font-size: 26px; }
  .section-heading > p { max-width: 45%; margin: 0; text-align: right; }
  .heading-actions { flex-direction: column-reverse; }
  .week-grid { margin-right: -12px; }
  .recipe-dialog article, .plan-dialog form { padding: 17px; }
  .dialog-header h2 { font-size: 28px; }
  .detail-image { aspect-ratio: 4/3; }
  .detail-controls { align-items: stretch; flex-direction: column; }
  .detail-actions button { flex: 1; }
  .detail-layout { grid-template-columns: 1fr; gap: 24px; }
  .plan-form-grid { grid-template-columns: 1fr 1fr; }
  .plan-form-grid label:last-child { grid-column: 1/-1; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
