:root { color-scheme: light; font-family: Inter, ui-sans-serif, system-ui, sans-serif; color: #25231f; background: #f7f4ee; --header-height: 4.5rem; --ink: #25231f; --muted: #736d64; --line: #ddd5c8; --paper: #fffdf9; --accent: #d85432; --accent-dark: #a93a20; --green: #426b53; }
html[lang="zh-hans"] { font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 10; background: white; padding: .75rem; }
.site-header { height: var(--header-height); display: flex; align-items: center; gap: 2rem; padding: 0 3vw; border-bottom: 1px solid #ded8cd; background: #fffdf9; }
.brand { font-size: 1.35rem; font-weight: 750; text-decoration: none; }
.site-header nav { display: flex; align-items: center; gap: .4rem; flex: 1; }
.site-header nav a { position: relative; padding: .45rem .55rem .45rem .95rem; border-radius: .5rem; color: var(--muted); text-decoration: none; white-space: nowrap; }
.site-header nav a::before { position: absolute; left: .35rem; top: 50%; width: .18rem; height: .9rem; border-radius: 999px; background: transparent; content: ""; transform: translateY(-50%); }
.site-header nav a:hover { color: var(--ink); background: #f7f4ee; }
.site-header nav a[aria-current="page"] { color: var(--ink); }
.site-header nav a[aria-current="page"]::before { background: var(--accent); }
.language-switcher { display: inline-flex; align-items: stretch; }
.language-switcher a { position: relative; display: grid; place-items: center; width: 2.6rem; min-height: 2.4rem; border: 1px solid var(--line); background: white; text-decoration: none; font-size: 1.25rem; line-height: 1; }
.language-switcher a:first-child { border-radius: .65rem 0 0 .65rem; }
.language-switcher a:last-child { border-radius: 0 .65rem .65rem 0; }
.language-switcher a + a { margin-left: -1px; }
.language-switcher a[aria-current] { z-index: 1; border-color: var(--accent); background: #fbe8e1; }
.logout-form { margin: 0; }
.logout-form button { width: 2.4rem; min-height: 2.4rem; padding: 0; border: 1px solid var(--line); border-radius: .65rem; background: white; color: var(--muted); font-size: 1.2rem; }
main { padding: 1.5rem 3vw; }
.empty-shell { min-height: 70vh; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
button, input, textarea { font: inherit; }
button, .primary-button, .secondary-button, .icon-button, .today-button { min-height: 2.75rem; border-radius: .75rem; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #2e6ea6; outline-offset: 2px; }
.eyebrow { color: var(--accent); font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; margin: 0 0 .35rem; }
h1 { font-family: Georgia, "Songti SC", serif; font-size: clamp(2rem, 3vw, 3.4rem); line-height: 1.05; margin: 0; }
.page-heading, .calendar-toolbar { display: flex; justify-content: space-between; align-items: end; gap: 2rem; margin-bottom: 2rem; }
.calendar-page { display: flex; flex-direction: column; height: calc(100dvh - var(--header-height) - 3rem); min-height: 0; }
.calendar-toolbar { flex: 0 0 auto; justify-content: flex-end; margin-bottom: .65rem; }
.calendar-actions { display: flex; align-items: center; gap: .65rem; }
.icon-button, .today-button, .primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; border: 1px solid var(--line); background: var(--paper); padding: .55rem 1rem; font-weight: 700; }
.icon-button { width: 2.75rem; padding: 0; font-size: 1.25rem; }
.primary-button { color: white; background: var(--accent); border-color: var(--accent); }
.primary-button:hover { background: var(--accent-dark); }
.day-carousel { display: grid; flex: 1 1 auto; min-height: 0; grid-auto-flow: column; grid-auto-columns: calc((100% - 4rem) / 5); gap: 1rem; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none; scroll-snap-type: x mandatory; padding: .2rem; }
.day-carousel::-webkit-scrollbar { display: none; }
.day-card { display: grid; grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr); height: 100%; min-width: 0; min-height: 0; overflow: hidden; scroll-snap-align: start; scroll-snap-stop: always; background: var(--paper); border: 1px solid var(--line); border-radius: 1.25rem; padding: .7rem; box-shadow: 0 10px 28px rgba(61,49,34,.06); }
.day-card.is-today { border: 2px solid var(--accent); }
.day-card > header { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; padding: 0 .1rem .5rem; border-bottom: 1px solid var(--line); }
.day-date { display: grid; gap: .15rem; }
.weekday { color: var(--muted); text-transform: capitalize; font-size: .76rem; font-weight: 750; }
.day-number { display: flex; align-items: baseline; gap: .4rem; }
.day-number strong { font-family: Georgia, serif; font-size: 2rem; line-height: 1; }
.day-number small { color: var(--muted); text-transform: lowercase; font-size: .78rem; font-weight: 750; }
.day-card > header em { color: var(--accent); background: #fbe8e1; border-radius: 999px; padding: .25rem .45rem; font-size: .68rem; font-style: normal; font-weight: 800; }
.meal { position: relative; min-height: 0; overflow-y: auto; padding: .45rem 0; border-bottom: 1px dashed var(--line); }
.meal:last-child { border-bottom: 0; }
.meal-heading { display: flex; justify-content: space-between; align-items: center; }
.meal-heading h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; margin: 0; }
.meal-actions { display: inline-flex; flex: 0 0 auto; align-items: stretch; }
.meal-actions > button { min-height: 2rem; border: 1px solid var(--line); background: white; }
.meal-actions > button:first-child { border-radius: .65rem 0 0 .65rem; }
.meal-actions > button:last-child { border-radius: 0 .65rem .65rem 0; }
.meal-actions > button + button { border-left: 0; }
.skip-meal { padding: .2rem .55rem; color: var(--muted); font-size: .75rem; }
.meal-dishes { display: grid; gap: .3rem; margin: .35rem 0; }
.add-dish-trigger { display: grid; place-items: center; width: 2rem; padding: 0; color: var(--accent-dark); font-size: 1.15rem; line-height: 1; }
.dish-chip { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; border: 1px solid var(--line); border-radius: .85rem; background: white; }
.dish-preview { display: flex; gap: .45rem; text-align: left; align-items: center; min-width: 0; border: 0; padding: .3rem .4rem; background: transparent; text-decoration: none; }
.dish-preview img, .dish-placeholder { width: 2.5rem; height: 2.5rem; object-fit: cover; border-radius: .55rem; display: grid; place-items: center; background: #f3e7d9; font-size: 1.2rem; flex: 0 0 auto; }
.dish-preview span span { min-width: 0; }
.dish-preview strong, .dish-preview small, .dish-row strong, .dish-row small { display: block; }
.dish-preview strong { font-size: .88rem; }
.dish-preview small { margin-top: .05rem; color: var(--muted); }
.remove-dish { border: 0; background: transparent; color: var(--muted); font-size: 1.25rem; padding: .4rem .65rem; }
.combobox { position: relative; }
.combobox input, .library-search input, .field input:not([type=file]), .field textarea { width: 100%; min-height: 2.4rem; border: 1px solid var(--line); border-radius: .75rem; background: white; padding: .45rem .7rem; }
.combobox [role=listbox] { position: absolute; z-index: 10; inset: calc(100% + .25rem) 0 auto; list-style: none; padding: .35rem; margin: 0; background: white; border: 1px solid var(--line); border-radius: .75rem; box-shadow: 0 15px 40px rgba(30,22,15,.16); max-height: 18rem; overflow-y: auto; }
.combobox [role=option] { border-radius: .5rem; padding: .65rem .7rem; cursor: pointer; }
.combobox [role=option][aria-selected=true] { background: #f5e1d7; }
.combobox [role=option] small { display: block; color: var(--muted); }
.combobox .dish-option { display: flex; align-items: center; gap: .65rem; }
.dish-option-thumbnail { display: grid; flex: 0 0 auto; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: .55rem; background: #f3e7d9; object-fit: cover; font-size: 1.2rem; }
.create-option { color: var(--accent-dark); font-weight: 750; }
.dish-dialog { width: min(42rem, calc(100vw - 2rem)); max-width: none; max-height: calc(100dvh - 2rem); padding: 0; border: 0; border-radius: 1.2rem; background: transparent; overflow: visible; }
.dish-dialog::backdrop { background: rgba(37, 35, 31, .55); backdrop-filter: blur(2px); }
.dish-dialog-panel { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 1rem; max-height: calc(100dvh - 2rem); padding: 1.25rem; border: 1px solid var(--line); border-radius: 1.2rem; background: var(--paper); box-shadow: 0 24px 70px rgba(30, 22, 15, .28); overflow: hidden; }
.dish-dialog-panel > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.dish-dialog-panel h2 { margin: 0; font-family: inherit; font-size: 1.25rem; line-height: 1.35; }
.dish-dialog-close { flex: 0 0 auto; width: 2.5rem; min-height: 2.5rem; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: white; font-size: 1.35rem; }
.dish-dialog .combobox { display: grid; grid-template-rows: auto minmax(0, 1fr); align-content: start; gap: .75rem; min-height: 0; }
.dish-dialog .combobox input { height: 3.25rem; min-height: 3.25rem; padding: .75rem 1rem; font-size: 1.05rem; }
.dish-dialog .combobox [role=listbox] { position: static; max-height: min(28rem, calc(100dvh - 10rem)); padding: .4rem; box-shadow: none; overflow-y: auto; }
.dish-dialog .combobox [role=option] { padding: .8rem .9rem; }
.dish-editor-dialog { width: min(64rem, calc(100vw - 2rem)); max-width: none; max-height: calc(100dvh - 2rem); padding: 0; border: 0; border-radius: 1.2rem; background: transparent; }
.dish-editor-dialog::backdrop { background: rgba(37, 35, 31, .62); backdrop-filter: blur(2px); }
.dish-editor-panel { display: grid; grid-template-rows: auto minmax(0, 1fr); max-height: calc(100dvh - 2rem); padding: 1.25rem; border: 1px solid var(--line); border-radius: 1.2rem; background: var(--paper); box-shadow: 0 24px 70px rgba(30, 22, 15, .28); overflow: hidden; }
.dish-editor-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; }
.dish-editor-panel h2 { margin: 0; font-family: inherit; font-size: 1.25rem; line-height: 1.35; }
.dish-editor-close { flex: 0 0 auto; width: 2.5rem; min-height: 2.5rem; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: white; font-size: 1.35rem; }
.dish-editor-content { min-height: 0; overflow: hidden; }
.dish-editor-content .dish-form { display: grid; grid-template-rows: minmax(0, 1fr) auto; height: 100%; padding: 0; border: 0; }
.dish-editor-content .editor-grid { min-height: 0; padding-right: .35rem; overflow-y: auto; }
.dish-editor-content .form-actions { position: static; margin-top: 1rem; padding-top: 1rem; }
.skip-state { display: grid; gap: .35rem; color: var(--muted); background: #f1eee8; border-radius: .75rem; padding: 1rem; }
.skip-state button { justify-self: start; border: 0; background: transparent; padding: 0; color: var(--accent-dark); }
.toast { position: fixed; z-index: 40; bottom: 1.5rem; left: 50%; transform: translateX(-50%); color: white; background: #292722; border-radius: .75rem; padding: .8rem 1rem; box-shadow: 0 12px 35px rgba(0,0,0,.25); }
.toast button { min-height: 0; color: #ffd0bf; border: 0; background: transparent; margin-left: 1rem; font-weight: 800; }
.library-page, .editor-page { max-width: 1120px; margin: 0 auto; }
.editor-page { padding-bottom: 5.75rem; }
.library-search { display: grid; grid-template-columns: 1fr auto; gap: .6rem; margin-bottom: 1.2rem; }
.library-search label { grid-column: 1/-1; font-weight: 700; }
.library-search button { border: 1px solid var(--line); background: white; padding: .5rem 1rem; }
.dish-list { display: grid; gap: .55rem; }
.dish-row { display: grid; grid-template-columns: 4.5rem 1fr auto; gap: 1rem; align-items: center; padding: .7rem; border: 1px solid var(--line); border-radius: .9rem; background: var(--paper); text-decoration: none; }
.dish-row:hover { border-color: var(--accent); }
.dish-row img, .row-placeholder { width: 4.5rem; height: 4.5rem; object-fit: cover; border-radius: .7rem; display: grid; place-items: center; background: #f3e7d9; font-size: 1.7rem; }
.dish-row small { color: var(--muted); margin-top: .3rem; }
.empty-state { text-align: center; padding: 5rem 1rem; border: 1px dashed var(--line); border-radius: 1rem; }
.empty-state > span { font-size: 3rem; }
.back-link { display: inline-block; margin-bottom: .7rem; color: var(--muted); }
.dish-form { background: var(--paper); border: 1px solid var(--line); border-radius: 1.2rem; padding: 1.4rem; }
.editor-grid { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(320px, 1.5fr); gap: 2rem; }
.photo-preview { width: 100%; min-height: 0; aspect-ratio: 1 / 1; display: grid; place-items: center; align-content: center; background: #f2ede5; border-radius: 1rem; overflow: hidden; color: var(--muted); }
.photo-preview img { width: 100%; height: 100%; min-height: 0; object-fit: cover; }
.photo-preview > span { font-size: 3.5rem; }
.photo-panel > input[type=file] { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; }
.photo-panel .secondary-button { width: 100%; margin-top: .75rem; }
.fields-panel { display: grid; gap: 1rem; }
.field label { display: block; margin-bottom: .4rem; font-weight: 750; }
.field textarea { resize: vertical; }
.required, .errorlist { color: #bd2e21; }
.errorlist { margin: .35rem 0 0; padding-left: 1.2rem; }
.danger-zone { grid-column: 1 / -1; display: flex; justify-content: flex-start; margin-top: .5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.editor-page .danger-zone { margin-bottom: 5.75rem; }
.danger-button { color: #a3261d; border: 1px solid #d9aaa5; background: #fff8f7; padding: .65rem 1rem; font-weight: 700; }
.danger-button:hover { color: white; border-color: #a3261d; background: #a3261d; }
.auth-body { display: grid; min-height: 100dvh; place-items: center; padding: 1rem; background: radial-gradient(circle at top, #fffdf9, #f3ece1 72%); }
.auth-main { width: 100%; padding: 0; }
.auth-card { width: min(28rem, 100%); margin: 0 auto; padding: clamp(1.5rem, 5vw, 2.5rem); border: 1px solid var(--line); border-radius: 1.5rem; background: var(--paper); box-shadow: 0 24px 70px rgba(61,49,34,.12); }
.auth-brand { display: grid; width: 3rem; height: 3rem; margin-bottom: 1.25rem; place-items: center; border-radius: 1rem; color: white; background: var(--accent); font-family: Georgia, serif; font-size: 1.5rem; font-weight: 800; }
.auth-intro { margin: .65rem 0 1.5rem; color: var(--muted); }
.auth-hint { margin: .15rem 0; color: var(--muted); font-size: .88rem; line-height: 1.4; }
.passkey-hint { margin-top: .75rem; }
.auth-form { display: grid; gap: .65rem; }
.auth-form label, .passkey-register label { font-weight: 750; }
.auth-form input, .auth-form select, .passkey-register input { width: 100%; min-height: 3rem; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: .75rem; background: white; }
.phone-input-row { display: grid; grid-template-columns: 6.75rem minmax(0, 1fr); gap: .5rem; }
.country-select-shell { position: relative; min-width: 0; }
.country-select-shell select { position: relative; z-index: 1; min-width: 0; appearance: none; color: transparent; -webkit-text-fill-color: transparent; cursor: pointer; }
.country-select-shell select option { color: var(--ink); -webkit-text-fill-color: var(--ink); }
.country-select-shell::after { position: absolute; z-index: 2; top: 50%; right: .75rem; width: .5rem; height: .5rem; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); content: ""; pointer-events: none; transform: translateY(-70%) rotate(45deg); }
.country-select-value { position: absolute; z-index: 2; inset: 0; display: flex; align-items: center; padding: .65rem 1.75rem .65rem .8rem; white-space: nowrap; pointer-events: none; }
.auth-form .primary-button { width: 100%; margin-top: .35rem; }
.passkey-button { display: flex; width: 100%; align-items: center; justify-content: center; gap: .6rem; padding: .7rem 1rem; border: 1px solid var(--line); border-radius: .75rem; color: var(--ink); background: var(--paper); font-weight: 750; }
.passkey-button:hover { border-color: var(--accent); color: var(--accent-dark); background: #faf7f1; }
.passkey-button:disabled, .primary-button:disabled { opacity: .6; cursor: wait; }
.auth-separator { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; color: var(--muted); font-size: .85rem; }
.auth-separator::before, .auth-separator::after { height: 1px; flex: 1; background: var(--line); content: ""; }
.auth-error { margin: .35rem 0 0; color: #a3261d; font-size: .9rem; }
@media (max-width: 24rem) {
  .phone-input-row { grid-template-columns: 6.25rem minmax(0, 1fr); }
  .phone-input-row select, .phone-input-row input { padding-inline: .6rem; }
  .country-select-value { padding-left: .6rem; }
}
.security-page { width: min(52rem, 100%); margin: 0 auto; }
.security-card { padding: clamp(1.2rem, 4vw, 2rem); border: 1px solid var(--line); border-radius: 1.2rem; background: var(--paper); }
.security-card h2 { margin-top: 0; }
.security-card > p { color: var(--muted); }
.passkey-register { display: grid; gap: .5rem; margin: 1.5rem 0; }
.passkey-register > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .65rem; }
.passkey-list { display: grid; gap: .55rem; padding: 0; list-style: none; }
.passkey-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem; border: 1px solid var(--line); border-radius: .8rem; }
.passkey-list small { display: block; margin-top: .3rem; color: var(--muted); }
.passkey-empty { color: var(--muted); }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; padding-top: 1.5rem; margin-top: 1.5rem; border-top: 1px solid var(--line); }
.editor-page .form-actions { position: fixed; z-index: 30; left: 50%; bottom: 0; width: min(1120px, calc(100vw - 2rem)); margin: 0; padding: .75rem max(1.4rem, env(safe-area-inset-right)) max(.75rem, env(safe-area-inset-bottom)) max(1.4rem, env(safe-area-inset-left)); border: 1px solid var(--line); border-bottom: 0; border-radius: 1rem 1rem 0 0; background: rgba(255, 253, 249, .96); box-shadow: 0 -10px 30px rgba(37, 35, 31, .1); transform: translateX(-50%); backdrop-filter: blur(10px); }
@media (max-width: 900px) {
  :root { --header-height: 3.5rem; }
  .site-header { display: flex; height: var(--header-height); gap: .55rem; padding: .4rem .65rem; }
  .site-header nav { min-width: 0; justify-content: center; gap: .25rem; }
  .site-header nav a { padding: .35rem .3rem .35rem .7rem; font-size: .82rem; }
  .site-header nav a::before { left: .2rem; height: .8rem; }
  .site-header .export-link { display: none; }
  .site-header .security-link { display: none; }
  .site-header .language-switcher { flex: 0 0 auto; }
  .site-header .language-switcher a { width: 2.15rem; min-height: 2.15rem; font-size: 1.1rem; }
  .brand { flex: 0 0 auto; font-size: 1rem; }
  main { padding: .75rem 1rem; }
  .calendar-page { height: calc(100dvh - var(--header-height) - 1.5rem); }
  .calendar-toolbar { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: .45rem; margin-bottom: .65rem; }
  .calendar-actions { justify-content: space-between; gap: .35rem; }
  .calendar-actions .icon-button { width: 2.4rem; min-height: 2.4rem; }
  .calendar-actions .today-button { min-height: 2.4rem; padding-inline: .65rem; font-size: .82rem; }
  .day-carousel { grid-auto-columns: 100%; gap: .75rem; padding: 0; }
  .day-card { border-radius: 1rem; padding: .65rem; }
  .meal { padding-block: .4rem; }
  .dish-dialog { width: calc(100vw - 1rem); height: calc(100dvh - 1rem); max-height: none; border-radius: 1rem; }
  .dish-dialog-panel { height: 100%; max-height: none; padding: 1rem; border-radius: 1rem; }
  .dish-dialog .combobox [role=listbox] { max-height: none; }
  .dish-editor-dialog { width: 100vw; height: 100dvh; max-height: none; margin: 0; border-radius: 0; }
  .dish-editor-panel { height: 100%; max-height: none; padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); border: 0; border-radius: 0; }
  .editor-grid { grid-template-columns: 1fr; }
  .passkey-register > div { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
html[lang="zh-hans"] .meal-heading h3 { font-size: 1.1rem; line-height: 1.5; font-weight: 400; color: var(--green); }
html[lang="zh-hans"] .language-switcher a[aria-current],
html[lang="zh-hans"] .today-button,
html[lang="zh-hans"] .primary-button,
html[lang="zh-hans"] .secondary-button,
html[lang="zh-hans"] .weekday,
html[lang="zh-hans"] .day-number small,
html[lang="zh-hans"] .day-card > header em,
html[lang="zh-hans"] .create-option,
html[lang="zh-hans"] .library-search label,
html[lang="zh-hans"] .field label,
html[lang="zh-hans"] .dish-row strong { font-weight: 400; }
html[lang="zh-hans"] .weekday,
html[lang="zh-hans"] .day-number small,
html[lang="zh-hans"] .day-card > header em { font-size: 1rem; line-height: 1.5; }
