:root{
  --bg:#ffffff;--surface:#f7f7f8;--ink:#111827;--muted:#6b7280;--line:#e5e7eb;--line-strong:#d1d5db;
  --accent:#15803d;--accent-ink:#14532d;--accent-tint:#dcfce7;--danger:#b91c1c;--danger-tint:#fee2e2;
  --radius:14px;--radius-sm:10px;
  --shadow:0 1px 2px rgba(17,24,39,.06),0 4px 12px rgba(17,24,39,.06);
  --shadow-lift:0 2px 4px rgba(17,24,39,.08),0 10px 24px rgba(17,24,39,.10);
  --tab-h:56px;--safe-b:env(safe-area-inset-bottom,0px);--safe-t:env(safe-area-inset-top,0px);
  --font:-apple-system,BlinkMacSystemFont,"PingFang SC","Hiragino Sans GB","Segoe UI","Microsoft YaHei",Roboto,"Noto Sans SC",sans-serif;
  color-scheme:light;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html{height:100%}
body{margin:0;min-height:100%;background:var(--bg);color:var(--ink);font:15px/1.5 var(--font);font-variant-numeric:tabular-nums;overscroll-behavior-y:none}
img{display:block;max-width:100%}
a{color:inherit;text-decoration:none}
button,input,textarea{font:inherit;color:inherit}
button{cursor:pointer;border:0;background:none;padding:0}
::selection{background:var(--accent-tint);color:var(--accent-ink)}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
*::-webkit-scrollbar{width:8px;height:8px}
*::-webkit-scrollbar-thumb{background:var(--line-strong);border-radius:8px;border:2px solid var(--bg)}
*::-webkit-scrollbar-track{background:transparent}
[hidden]{display:none!important}

.view{padding-bottom:calc(var(--tab-h) + var(--safe-b) + 16px);min-height:100vh}
body.cook-mode .view{padding-bottom:0}
body.cook-mode .tabbar{display:none}
.wrap{max-width:1400px;margin:0 auto;padding:0 16px}
.narrow{max-width:720px;margin:0 auto;padding:0 16px}

/* ---------- buttons / chips ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:44px;padding:0 18px;border-radius:12px;border:1px solid var(--line-strong);background:#fff;font-weight:600;font-size:15px;transition:background .15s ease-out,transform .15s ease-out,border-color .15s ease-out;user-select:none}
.btn:active{transform:scale(.98)}
.btn.primary{background:var(--accent);border-color:var(--accent);color:#fff}
@media (hover:hover){.btn.primary:hover{background:#166534}}
.btn.ghost{border-color:transparent;background:var(--surface)}
.btn.danger{color:var(--danger);border-color:#fca5a5;background:#fff}
.btn.danger.armed{background:var(--danger);border-color:var(--danger);color:#fff}
.btn.block{width:100%}
.btn.lg{height:52px;font-size:17px;border-radius:14px}
.btn:disabled{opacity:.45;cursor:not-allowed}
.btn svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round}
.chip{display:inline-flex;align-items:center;gap:6px;height:34px;padding:0 14px;border-radius:999px;background:var(--surface);border:1px solid transparent;font-size:14px;font-weight:500;white-space:nowrap;color:var(--ink);transition:background .15s ease-out,color .15s ease-out;user-select:none}
.chip.on{background:var(--accent);color:#fff}
.chip.sm{height:28px;padding:0 11px;font-size:13px;background:#fff;border-color:var(--line)}
.chip.sm.on{background:var(--accent-tint);color:var(--accent-ink);border-color:var(--accent-tint)}
.chip .n{opacity:.7;font-weight:400}
.tag{display:inline-flex;align-items:center;height:22px;padding:0 8px;border-radius:999px;background:var(--surface);color:var(--muted);font-size:12px;font-weight:500;white-space:nowrap}
.tag.made{background:var(--accent-tint);color:var(--accent-ink)}
.tag.wish{background:#fff;border:1px solid var(--line-strong);color:var(--muted)}
.tag.frozen{background:#e0f2fe;color:#075985}
.tag.hot{background:#fee2e2;color:#991b1b}

/* ---------- menu ---------- */
.menu-head{position:sticky;top:0;z-index:5;background:rgba(255,255,255,.96);backdrop-filter:saturate(1.2) blur(8px);-webkit-backdrop-filter:saturate(1.2) blur(8px);border-bottom:1px solid var(--line);padding-top:var(--safe-t)}
.brand{display:flex;align-items:baseline;gap:10px;padding:10px 16px 0}
.brand h1{margin:0;font-size:17px;font-weight:700;letter-spacing:0}
.brand .count{color:var(--muted);font-size:13px}
.search{margin:8px 16px 0;position:relative}
.search svg{position:absolute;left:14px;top:50%;transform:translateY(-50%);width:18px;height:18px;stroke:var(--muted);fill:none;stroke-width:1.75;stroke-linecap:round}
.search input{width:100%;height:44px;border-radius:12px;border:1px solid transparent;background:var(--surface);padding:0 40px 0 42px;font-size:15px;outline:none;transition:border-color .15s ease-out,background .15s ease-out}
.search input::placeholder{color:var(--muted)}
.search input:focus{background:#fff;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-tint)}
.search .clear{position:absolute;right:8px;top:50%;transform:translateY(-50%);width:30px;height:30px;border-radius:50%;display:grid;place-items:center;color:var(--muted)}
.search .clear svg{position:static;transform:none;width:16px;height:16px;stroke:currentColor}
.chips{display:flex;gap:8px;overflow-x:auto;padding:8px 16px 0;scrollbar-width:none;scroll-snap-type:x proximity}
.chips::-webkit-scrollbar{display:none}
.chips .chip{scroll-snap-align:start;flex:0 0 auto}
.chips.filters{padding-top:6px;padding-bottom:8px}
@media (min-width:1000px){.chips{flex-wrap:wrap;overflow:visible;row-gap:6px}}
.grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;padding:12px 16px 0}
@media (min-width:700px){.grid{grid-template-columns:repeat(3,1fr);gap:14px}}
@media (min-width:1000px){.grid{grid-template-columns:repeat(4,1fr);gap:16px}}
@media (min-width:1400px){.grid{grid-template-columns:repeat(5,1fr)}}
.card{position:relative;background:#fff;border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden;transition:box-shadow .15s ease-out,transform .15s ease-out}
.card:active{transform:scale(.985)}
@media (hover:hover){.card:hover{box-shadow:var(--shadow-lift)}}
.card-media{display:block;position:relative;aspect-ratio:3/2;background:var(--surface)}
.card-media img{position:relative;z-index:1;width:100%;height:100%;object-fit:cover;opacity:0;transition:opacity .25s ease-out}
.card-media img.ok{opacity:1}
.card-media .ph{position:absolute;inset:0;display:grid;place-items:center;color:var(--muted);font-size:13px}
.card-top{position:relative}
.card-media .tag{position:absolute;left:8px;top:8px;z-index:2;box-shadow:0 1px 2px rgba(0,0,0,.12)}
.card-media .tag.frozen{left:auto;right:8px}
.add{position:absolute;right:8px;bottom:8px;z-index:2;width:34px;height:34px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.18);display:grid;place-items:center;color:var(--ink);transition:background .15s ease-out,color .15s ease-out,transform .15s ease-out}
.add svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.add.on{background:var(--accent);color:#fff}
.add.pop{animation:pop .18s ease-out}
@keyframes pop{0%{transform:scale(.8)}60%{transform:scale(1.15)}100%{transform:scale(1)}}
.card-body{display:block;padding:8px 9px 9px}
.card-body h3{margin:0;font-size:16px;font-weight:600;line-height:1.35;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.card-body .meta{margin:2px 0 0;color:var(--muted);font-size:12px;line-height:1.4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;letter-spacing:-.01em}
.empty{padding:56px 24px;text-align:center;color:var(--muted)}
.empty h2{margin:0 0 6px;font-size:17px;color:var(--ink)}
.empty .btn{margin-top:16px}

/* ---------- dish ---------- */
.hero{position:relative;aspect-ratio:4/3;max-height:min(60vh,520px);background:var(--surface);overflow:hidden}
@media (min-width:720px){.hero{aspect-ratio:16/9;max-height:none;max-width:960px;margin:0 auto;border-radius:0 0 var(--radius) var(--radius)}}
.hero img{position:relative;z-index:1;width:100%;height:100%;object-fit:cover;opacity:0;transition:opacity .25s ease-out}
.hero img.ok{opacity:1}
.hero .ph{position:absolute;inset:0;display:grid;place-items:center;color:var(--muted)}
.back{position:absolute;z-index:2;left:12px;top:calc(12px + var(--safe-t));width:38px;height:38px;border-radius:50%;background:rgba(255,255,255,.92);box-shadow:0 1px 3px rgba(0,0,0,.18);display:grid;place-items:center}
.back svg,.iconbtn svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.dish-head{padding:16px 0 0}
.dish-head h1{margin:0;font-size:24px;font-weight:700;line-height:1.3}
.dish-head .sub{margin:4px 0 0;color:var(--muted);font-size:13px}
.tags{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0 0}
.stats{list-style:none;margin:14px 0 0;padding:0;display:grid;grid-template-columns:repeat(3,1fr);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden}
.stats li{padding:10px 12px;border-right:1px solid var(--line);border-bottom:1px solid var(--line)}
.stats li:nth-child(3n){border-right:0}
.stats li:nth-last-child(-n+3){border-bottom:0}
.stats b{display:block;font-size:17px;font-weight:700;line-height:1.2}
.stats small{display:block;color:var(--muted);font-size:12px;margin-top:2px;white-space:nowrap}
.actions{display:flex;gap:10px;margin:14px 0 0}
.actions .btn{flex:1}
.box{margin:16px 0 0;padding:12px 14px;border-radius:var(--radius);background:var(--surface);font-size:14px}
.box b{font-weight:600}
.box .row{display:flex;gap:10px;flex-wrap:wrap;margin-top:4px;color:var(--muted)}
.section{margin:22px 0 0}
.section h2{margin:0 0 8px;font-size:17px;font-weight:700}
.section h2 small{color:var(--muted);font-weight:400;font-size:13px;margin-left:6px}
.ing-group{margin:10px 0 0}
.ing-group h3{margin:0 0 4px;font-size:13px;color:var(--muted);font-weight:600}
.ing{list-style:none;margin:0;padding:0}
.ing li{display:flex;justify-content:space-between;gap:12px;padding:8px 0;border-bottom:1px solid var(--line);font-size:15px}
.ing li:last-child{border-bottom:0}
.ing li .amt{color:var(--muted);text-align:right;flex-shrink:0}
.ing li .tag{margin-left:6px;height:18px;font-size:11px}
.steps{list-style:none;margin:0;padding:0;counter-reset:s}
.steps li{display:flex;gap:12px;padding:10px 0;border-bottom:1px solid var(--line);counter-increment:s}
.steps li:last-child{border-bottom:0}
.steps li::before{content:counter(s);flex:0 0 26px;height:26px;border-radius:50%;background:var(--accent-tint);color:var(--accent-ink);font-weight:700;font-size:13px;display:grid;place-items:center;margin-top:1px}
.steps li p{margin:0;flex:1}
.steps li .t{color:var(--muted);font-size:13px;white-space:nowrap;margin-top:3px}
.tips{margin:0;padding-left:18px;color:var(--muted);font-size:14px}
.tips li{margin:4px 0}
.comp-group{margin:10px 0 0}
.comp-group h3{margin:0 0 6px;font-size:13px;color:var(--muted);font-weight:600}
.comp-list{display:flex;flex-wrap:wrap;gap:8px}
.comp{display:inline-flex;align-items:center;gap:6px;height:34px;padding:0 12px;border-radius:999px;border:1px solid var(--line-strong);background:#fff;font-size:14px;user-select:none;cursor:pointer}
.comp input{accent-color:var(--accent);width:16px;height:16px;margin:0}
.comp.on{background:var(--accent-tint);border-color:var(--accent-tint);color:var(--accent-ink)}
.history{margin:16px 0 0;padding:12px 14px;border-radius:var(--radius);border:1px dashed var(--line-strong);font-size:14px;color:var(--muted)}
.history b{color:var(--ink);font-weight:600}
.stars{display:inline-flex;gap:2px;vertical-align:middle}
.stars i{display:block;width:16px;height:16px}
.stars i svg{width:100%;height:100%;stroke:#d97706;fill:none;stroke-width:1.75;stroke-linejoin:round}
.stars i.on svg{fill:#d97706}
.stars.sm i{width:13px;height:13px}
.dots3{display:inline-flex;gap:5px;align-items:center;height:20px}
.dots3 i{width:10px;height:10px;border-radius:50%;border:1.75px solid var(--ink)}
.dots3 i.on{background:var(--ink)}
.snow{display:inline-block;width:14px;height:14px;margin-left:4px;vertical-align:-2px;color:#075985}
.snow svg{width:100%;height:100%;stroke:currentColor;fill:none;stroke-width:1.75;stroke-linecap:round}

/* ---------- order / list ---------- */
.page-head{padding:calc(14px + var(--safe-t)) 0 10px;display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.page-head h1{margin:0;font-size:22px;font-weight:700}
.page-head .sub{color:var(--muted);font-size:13px}
.rows{display:flex;flex-direction:column;gap:10px}
.row-card{display:flex;gap:12px;align-items:center;background:#fff;border-radius:var(--radius);box-shadow:var(--shadow);padding:10px}
.row-card .thumb{width:72px;height:54px;border-radius:10px;object-fit:cover;background:var(--surface);flex-shrink:0}
.row-card .main{flex:1;min-width:0}
.row-card h3{margin:0;font-size:15px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row-card .meta{margin:2px 0 0;color:var(--muted);font-size:12px}
.stepper{display:inline-flex;align-items:center;border:1px solid var(--line-strong);border-radius:999px;height:32px;flex-shrink:0}
.stepper button{width:32px;height:30px;display:grid;place-items:center;color:var(--ink)}
.stepper button svg,.steps li .t svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;vertical-align:-3px}
.stepper b{min-width:28px;text-align:center;font-size:14px;font-weight:600}
.iconbtn{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;color:var(--muted);flex-shrink:0}
.iconbtn:hover{background:var(--surface)}
.summary{margin:14px 0 0;padding:14px;border-radius:var(--radius);background:var(--surface);display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.summary b{display:block;font-size:22px;font-weight:700;line-height:1.2}
.summary small{color:var(--muted);font-size:12px}
.summary .over b{color:var(--danger)}
.bar{margin:10px 0 0;height:6px;border-radius:999px;background:var(--line);overflow:hidden}
.bar i{display:block;height:100%;width:100%;background:var(--accent);border-radius:999px;transform-origin:left;transition:transform .25s ease-out}
.bar i.over{background:var(--danger)}
.bar-label{margin:6px 0 0;color:var(--muted);font-size:12px}
.bar-label b{color:var(--ink);font-weight:600}
.foot-actions{display:flex;gap:10px;margin:14px 0 0}
.foot-actions .btn{flex:1}
.list-sec{margin:14px 0 0}
.list-sec h2{margin:0 0 6px;font-size:15px;font-weight:700;display:flex;align-items:center;justify-content:space-between}
.list-sec h2 small{color:var(--muted);font-weight:400;font-size:13px}
.item{display:flex;gap:12px;align-items:flex-start;padding:10px 0;border-bottom:1px solid var(--line)}
.item:last-child{border-bottom:0}
.item input{accent-color:var(--accent);width:22px;height:22px;margin:1px 0 0;flex-shrink:0}
.item .main{flex:1;min-width:0}
.item .name{font-size:15px;font-weight:600}
.item .name .en{color:var(--muted);font-weight:400;font-size:12px;margin-left:6px}
.item .from{color:var(--muted);font-size:13px;margin-top:2px}
.item.off .name{color:var(--muted);text-decoration:line-through;text-decoration-color:var(--line-strong)}
details.staples{margin:14px 0 0;border-top:1px solid var(--line);padding-top:8px}
details.staples summary{cursor:pointer;font-size:15px;font-weight:700;list-style:none;display:flex;justify-content:space-between;align-items:center;padding:6px 0}
details.staples summary::-webkit-details-marker{display:none}
details.staples summary small{color:var(--muted);font-weight:400;font-size:13px}
details.staples summary::after{content:"展开";color:var(--accent);font-size:13px;font-weight:500}
details.staples[open] summary::after{content:"收起"}

/* ---------- cook ---------- */
.cook{min-height:100vh;display:flex;flex-direction:column;background:#fff}
.cook-top{display:flex;align-items:center;gap:8px;padding:calc(10px + var(--safe-t)) 12px 10px;border-bottom:1px solid var(--line)}
.cook-top h1{flex:1;margin:0;font-size:16px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center}
.cook-top .iconbtn{color:var(--ink)}
.cook-top .iconbtn.on{background:var(--accent-tint);color:var(--accent-ink)}
.cook-ing{border-bottom:1px solid var(--line);background:var(--surface);padding:10px 16px;max-height:40vh;overflow:auto}
.cook-ing .ing li{padding:6px 0;font-size:14px}
.cook-photo{position:relative;aspect-ratio:16/7;max-height:34vh;overflow:hidden;background:var(--surface)}
.cook-photo img{position:relative;z-index:1;width:100%;height:100%;object-fit:cover;opacity:0;transition:opacity .25s ease-out}
.cook-photo img.ok{opacity:1}
.cook-photo .ph{position:absolute;inset:0;display:grid;place-items:center;color:var(--muted)}
.cook-body{flex:1;display:flex;flex-direction:column;justify-content:flex-start;padding:20px 20px 24px;max-width:760px;width:100%;margin:0 auto}
.dots{display:flex;gap:6px;margin:0 0 18px}
.dots i{flex:1;height:4px;border-radius:999px;background:var(--line)}
.dots i.done{background:var(--accent)}
.dots i.now{background:var(--accent-ink)}
.cook-body .n{color:var(--muted);font-size:14px;font-weight:600}
.cook-body .text{margin:8px 0 0;font-size:24px;line-height:1.55;font-weight:500}
.timer{margin:22px 0 0;display:flex;align-items:center;gap:12px}
.timer .clock{font-size:40px;font-weight:700;line-height:1;min-width:120px}
.timer .clock.done{color:var(--accent)}
.timer .clock.urgent{color:var(--danger)}
.cook-nav{display:flex;gap:10px;padding:12px 16px calc(14px + var(--safe-b));border-top:1px solid var(--line)}
.cook-nav .btn{flex:1;height:56px;font-size:17px;border-radius:14px}
.cook-nav .btn.primary{flex:2}

/* ---------- done / gallery ---------- */
.done-hero{text-align:center;padding:calc(28px + var(--safe-t)) 0 8px}
.done-hero .big svg{width:64px;height:64px;stroke:var(--accent);fill:var(--accent-tint);stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round}
.done-hero h1{margin:10px 0 2px;font-size:24px}
.done-hero p{margin:0;color:var(--muted)}
.rate{display:flex;justify-content:center;gap:8px;margin:18px 0 0}
.rate button{width:46px;height:46px;display:grid;place-items:center;transition:transform .12s ease-out}
.rate button svg{width:34px;height:34px;stroke:#d97706;fill:none;stroke-width:1.75;stroke-linejoin:round;transition:fill .12s ease-out}
.rate button.on svg{fill:#d97706}
.rate button:active{transform:scale(1.15)}
textarea.note{width:100%;min-height:84px;margin:14px 0 0;padding:12px;border-radius:12px;border:1px solid var(--line-strong);resize:vertical;outline:none;font-size:15px}
textarea.note:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-tint)}
.photo-box{margin:14px 0 0;border:1px dashed var(--line-strong);border-radius:var(--radius);aspect-ratio:4/3;display:grid;place-items:center;color:var(--muted);overflow:hidden;position:relative;background:var(--surface)}
.photo-box img{width:100%;height:100%;object-fit:cover}
.photo-box .pick{position:absolute;inset:0;display:grid;place-content:center;gap:6px;text-align:center;cursor:pointer}
.photo-box .pick svg{width:32px;height:32px;stroke:currentColor;fill:none;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;margin:0 auto}
.photo-box input{display:none}
.gal{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;padding-top:4px}
@media (min-width:700px){.gal{grid-template-columns:repeat(3,1fr)}}
@media (min-width:1000px){.gal{grid-template-columns:repeat(4,1fr)}}
.mem{background:#fff;border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}
.mem img{width:100%;aspect-ratio:1;object-fit:cover;background:var(--surface)}
.mem .b{padding:9px 11px 11px}
.mem h3{margin:0;font-size:15px;font-weight:600}
.mem .d{color:var(--muted);font-size:12px;margin-top:2px;display:flex;justify-content:space-between;gap:8px}
.mem p{margin:6px 0 0;font-size:13px;color:var(--ink)}
.mem .del{display:block;width:100%;text-align:right;color:var(--muted);font-size:12px;margin-top:6px}
.mem .del.armed{color:var(--danger);font-weight:600}

/* ---------- tab bar / toast ---------- */
.tabbar{position:fixed;left:0;right:0;bottom:0;height:calc(var(--tab-h) + var(--safe-b));padding-bottom:var(--safe-b);background:rgba(255,255,255,.96);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);border-top:1px solid var(--line);display:flex;z-index:10}
.tab{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;color:var(--muted);font-size:11px;font-weight:500;position:relative;transition:color .15s ease-out}
.tab svg{width:24px;height:24px;stroke:currentColor;fill:none;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round}
.tab.on{color:var(--accent)}
.tab .badge{position:absolute;top:6px;left:calc(50% + 6px);min-width:18px;height:18px;padding:0 5px;border-radius:999px;background:var(--accent);color:#fff;font-size:11px;font-weight:700;display:grid;place-items:center}
.toast{position:fixed;left:50%;bottom:calc(var(--tab-h) + var(--safe-b) + 14px);transform:translateX(-50%);background:var(--ink);color:#fff;padding:10px 16px;border-radius:999px;font-size:14px;box-shadow:var(--shadow-lift);z-index:20;max-width:calc(100% - 32px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;animation:rise .18s ease-out}
@keyframes rise{from{opacity:0;transform:translate(-50%,8px)}to{opacity:1;transform:translate(-50%,0)}}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
