@font-face { font-family: "Bricolage"; src: url(fonts/bricolagegrotesque.ttf) format("truetype"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Inter"; src: url(fonts/inter.ttf) format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Caveat"; src: url(fonts/caveat.ttf) format("truetype"); font-weight: 400 700; font-display: swap; }

:root {
  --paper: #FBF3E6;
  --card: #FFFDF8;
  --ink: #1E1A16;
  --muted: #6E655B;
  --line: #E7DAC5;
  --soft: #F1E6D4;
  --green: #2EC27E;
  --green-deep: #13804F;
  --green-ink: #0B5E39;
  --mint: #D5F5E3;
  --tomato: #E5483C;
  --sun: #FFC94D;
  --on-green: #FFFFFF;
  --shadow: 0 1px 0 rgba(30, 26, 22, .06), 0 8px 24px -12px rgba(30, 26, 22, .25);
  --r: 18px;
  --gutter: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #17120F; --card: #221B16; --ink: #F6EDE0; --muted: #B4A898; --line: #3A3028; --soft: #2E261F;
    --green-ink: #7FE0B0; --mint: #123A27; --tomato: #FF7A66; --shadow: 0 1px 0 rgba(0,0,0,.4), 0 10px 30px -14px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #17120F; --card: #221B16; --ink: #F6EDE0; --muted: #B4A898; --line: #3A3028; --soft: #2E261F;
  --green-ink: #7FE0B0; --mint: #123A27; --tomato: #FF7A66; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.5 "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: "Bricolage", "Inter", sans-serif; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#splash { position: fixed; inset: 0; display: grid; place-items: center; background: var(--paper); z-index: 50; }
#splash img { animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }

#view {
  max-width: 760px; margin: 0 auto; outline: none;
  padding: calc(var(--safe-t) + 20px) var(--gutter) calc(var(--safe-b) + 104px);
}

.i { display: inline-block; width: 1.15em; height: 1.15em; background: currentColor; flex: none;
  -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; vertical-align: -.2em; }
.i.tiny { width: .95em; height: .95em; }
.i-week { --m: url(icons/week.png); } .i-discover { --m: url(icons/discover.png); } .i-basket { --m: url(icons/basket.png); }
.i-person { --m: url(icons/person.png); } .i-heart { --m: url(icons/heart.png); } .i-heart-fill { --m: url(icons/heart-fill.png); }
.i-search { --m: url(icons/search.png); } .i-swap { --m: url(icons/swap.png); } .i-lock { --m: url(icons/lock.png); }
.i-clock { --m: url(icons/clock.png); } .i-back { --m: url(icons/back.png); } .i-chevron { --m: url(icons/chevron.png); }
.i-check { --m: url(icons/check.png); } .i-plus { --m: url(icons/plus.png); } .i-minus { --m: url(icons/minus.png); }
.i-close { --m: url(icons/close.png); } .i-share { --m: url(icons/share.png); } .i-flame { --m: url(icons/flame.png); }
.i-filter { --m: url(icons/filter.png); } .i-play { --m: url(icons/play.png); } .i-trash { --m: url(icons/trash.png); }
.i-sparkle { --m: url(icons/sparkle.png); } .i-pot { --m: url(icons/pot.png); } .i-tag { --m: url(icons/tag.png); }
.i-download { --m: url(icons/download.png); } .i-upload { --m: url(icons/upload.png); }

.kicker { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--green-ink); }
.kicker.small { font-size: 11px; }
.display { font-size: clamp(30px, 8vw, 46px); line-height: 1.04; font-weight: 700; letter-spacing: -.025em; margin: 6px 0 10px; text-wrap: balance; }
.lead { font-size: 17px; color: var(--muted); max-width: 56ch; }
.section-title { font-size: 22px; font-weight: 700; margin: 0 0 12px; }
.fine { font-size: 13px; color: var(--muted); margin-top: 8px; }
.note { font-size: 14px; color: var(--muted); margin-top: 10px; padding-left: 12px; border-left: 3px solid var(--sun); }
.warn { display: block; color: var(--tomato); font-weight: 500; margin-top: 6px; }
.save { color: var(--green-ink); }
.page-head { margin-bottom: 22px; }
.sum { font-size: 17px; color: var(--muted); }
.sum b { color: var(--ink); font-weight: 600; }

button { cursor: pointer; border: 0; background: none; }
button:disabled { opacity: .35; cursor: default; }
.primary, .secondary, .ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px;
  border-radius: 999px; font-weight: 600; text-decoration: none; transition: transform .12s ease, background .2s;
}
.primary { background: var(--green); color: var(--on-green); box-shadow: 0 6px 16px -8px rgba(19, 128, 79, .8); }
.primary:active, .secondary:active { transform: scale(.97); }
.secondary { background: var(--card); border: 1.5px solid var(--line); }
.ghost { color: var(--muted); padding: 0 12px; }
.ghost.on { color: var(--green-ink); }
.ghost.small { min-height: 34px; font-size: 13px; padding: 0 10px 0 6px; gap: 5px; }
.ghost.danger { color: var(--tomato); }
.big { min-height: 54px; font-size: 17px; padding: 0 28px; }
.icon-btn { width: 46px; padding: 0; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }

.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.day { font-family: "Caveat", cursive; font-size: 22px; line-height: 1; color: var(--tomato); }

.hero { margin: 0 calc(var(--gutter) * -1) 8px; }
.hero-img { display: block; aspect-ratio: 4 / 3; overflow: hidden; }
.hero-img img { width: 100%; height: 100%; object-fit: cover; }
.hero-body { padding: 16px var(--gutter) 6px; }
.hero h2 { font-size: 30px; line-height: 1.08; margin: 4px 0 6px; text-wrap: balance; }
.hero h2 a, .dayrow h3 a, .rrow h3 a { text-decoration: none; }
.hero .desc { color: var(--muted); }
@media (min-width: 700px) {
  .hero { margin: 0 0 8px; display: grid; grid-template-columns: 1.15fr 1fr; gap: 24px; align-items: center; }
  .hero-img { border-radius: var(--r); }
  .hero-body { padding: 0; }
}
.row-actions { display: flex; flex-wrap: wrap; gap: 2px; margin: 8px 0 0 -6px; }

.days { list-style: none; margin: 10px 0 0; padding: 0; }
.dayrow { display: grid; grid-template-columns: 108px 1fr; gap: 6px 14px; padding: 16px 0; border-top: 1px solid var(--line); }
.dayrow .row-actions { grid-column: 1 / -1; margin-top: 0; }
.dayrow h3 { font-size: 19px; line-height: 1.2; margin: 3px 0 0; }
.dayrow.cooked .thumb img { filter: grayscale(.7); opacity: .7; }
.thumb { display: block; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 3; align-self: start; background: var(--soft); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.week-foot { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 8px; }

.teaser { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--line); }
.strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.strip-item { text-decoration: none; font-size: 14px; font-weight: 500; line-height: 1.25; }
.strip-item img { aspect-ratio: 1; object-fit: cover; border-radius: 14px; margin-bottom: 6px; width: 100%; }
.more { display: inline-flex; align-items: center; gap: 4px; margin-top: 12px; color: var(--green-ink); font-weight: 600; text-decoration: none; }

.search { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1.5px solid var(--line); border-radius: 999px; padding: 0 16px; min-height: 50px; color: var(--muted); }
.search input { flex: 1; border: 0; background: none; outline: none; min-height: 48px; font-size: 16px; color: var(--ink); }
.filters { margin: 12px calc(var(--gutter) * -1) 0; }
.filters .chips { flex-wrap: nowrap; overflow-x: auto; padding: 4px var(--gutter); scrollbar-width: none; }
.filters .chips::-webkit-scrollbar { display: none; }
.filters .select { display: block; padding: 4px var(--gutter); }
select { appearance: none; background: var(--card); border: 1.5px solid var(--line); border-radius: 999px; padding: 9px 36px 9px 16px; font-size: 14px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 15px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.count { font-size: 13px; color: var(--muted); margin: 14px 0 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 8px 14px; min-height: 38px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--card); font-size: 14px; font-weight: 500; }
.chip.on { background: var(--mint); border-color: var(--green); color: var(--green-ink); }

.rlist { list-style: none; margin: 0; padding: 0; }
.rrow { display: grid; grid-template-columns: 96px 1fr auto; gap: 14px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.rrow h3 { font-size: 17px; line-height: 1.25; margin-top: 2px; }
.rrow.dim { opacity: .55; }
.fav { width: 42px; height: 42px; display: grid; place-items: center; color: var(--muted); border-radius: 50%; }
.fav.on { color: var(--tomato); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; list-style: none; }
.empty img { width: 120px; margin: 0 auto 12px; }

.recipe { margin: calc((var(--safe-t) + 20px) * -1) calc(var(--gutter) * -1) 0; }
.r-hero { position: relative; aspect-ratio: 4 / 3; max-height: 62vh; width: 100%; overflow: hidden; background: var(--soft); }
.r-hero img { width: 100%; height: 100%; object-fit: cover; }
.round { position: absolute; top: calc(var(--safe-t) + 12px); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 253, 248, .92); color: #1E1A16; box-shadow: var(--shadow); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.round.back { left: 14px; } .round.favbtn { right: 14px; } .round.favbtn.on { color: var(--tomato); }
.credit { font-size: 11px; color: var(--muted); padding: 6px var(--gutter) 0; overflow-wrap: anywhere; }
.credit a { color: inherit; }
.r-head, .r-actions, .r-ing, .r-steps, .source { padding: 0 var(--gutter); }
.r-head { padding-top: 16px; }
.facts { display: grid; grid-template-columns: repeat(5, 1fr); margin: 18px 0 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts div { padding: 10px 0; text-align: center; }
.facts div + div { border-left: 1px solid var(--line); }
.facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-family: "Bricolage"; font-size: 18px; font-weight: 700; }
.r-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 20px 0 6px; }
.pill { font-size: 13px; font-weight: 600; color: var(--green-ink); background: var(--mint); padding: 6px 12px; border-radius: 999px; }
.r-ing, .r-steps { margin-top: 28px; }
.r-ing-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.r-ing-head .section-title { margin: 0; }
.ing { list-style: none; padding: 0; margin: 0; }
.ing li { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.qty { font-weight: 600; font-variant-numeric: tabular-nums; }
.nm em { color: var(--muted); font-style: normal; font-size: 14px; }
.offer { display: inline-block; font-size: 11px; font-weight: 700; color: #fff; background: var(--m, var(--tomato)); border-radius: 6px; padding: 2px 6px; margin-left: 4px; vertical-align: 1px; }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 22px 48px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--paper);
  display: grid; place-items: center; font-family: "Bricolage"; font-weight: 700; font-size: 15px; }
.tip { margin-top: 6px; font-size: 14px; color: var(--muted); padding-left: 10px; border-left: 3px solid var(--sun); }
.mins { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 6px; }
.source { font-size: 13px; color: var(--muted); margin: 10px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper-label { font-size: 14px; color: var(--muted); margin-right: 8px; }
.stepper button { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card); display: grid; place-items: center; }
.stepper output { min-width: 32px; text-align: center; font-family: "Bricolage"; font-weight: 700; font-size: 20px; }
.form-block .stepper { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.form-block .stepper .stepper-label { flex: 1; font-size: 16px; color: var(--ink); }

.onb { max-width: 560px; margin: 0 auto; }
.onb-top { display: grid; grid-template-columns: 46px 1fr 46px; align-items: center; margin-bottom: 18px; }
.dots { display: flex; justify-content: center; gap: 6px; }
.dots i { width: 22px; height: 5px; border-radius: 3px; background: var(--line); }
.dots i.on { background: var(--green); }
.onb-hero { display: grid; place-items: center; padding: 20px 0 6px; }
.onb-logo { width: 140px; }
.onb-form { margin-top: 18px; }
.onb-actions { position: sticky; bottom: calc(var(--safe-b) + 14px); margin-top: 26px; }
.onb-actions .primary { width: 100%; }

.form-block { padding: 18px 0; border-top: 1px solid var(--line); }
.form-block:first-child { border-top: 0; padding-top: 0; }
.form-block h3 { font-size: 20px; margin-bottom: 12px; }
.form-block h4 { font: 600 13px/1.4 "Inter"; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.diet-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.diet { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; border-radius: 14px; border: 1.5px solid transparent; font-size: 12px; font-weight: 600; text-align: center; }
.diet img { width: 54px; height: 54px; }
.diet.on { border-color: var(--green); background: var(--mint); }
.range { display: block; margin: 12px 0; }
.range span { display: block; margin-bottom: 4px; }
input[type=range] { width: 100%; accent-color: var(--green); height: 32px; }
.field { display: block; margin-top: 16px; }
.field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.field input, .add input { width: 100%; min-height: 50px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); padding: 0 16px; font-size: 16px; }
.sticky-save { position: sticky; bottom: calc(var(--safe-b) + 84px); padding: 14px 0; z-index: 2; }
.sticky-save .primary { width: 100%; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.file { cursor: pointer; }
.about a { color: var(--green-ink); }

.add { display: flex; gap: 8px; margin-bottom: 8px; }
.add .primary { flex: none; height: 50px; width: 50px; }
.aisle { margin-top: 22px; }
.aisle .section-title { font-size: 15px; font-family: "Inter"; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.shop { list-style: none; margin: 0; padding: 0; }
.shop li { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.shop label { flex: 1; display: flex; align-items: center; gap: 12px; padding: 12px 0; cursor: pointer; min-width: 0; }
.shop input { position: absolute; opacity: 0; pointer-events: none; }
.box { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; flex: none; color: transparent; transition: .15s; }
.shop input:checked + .box { background: var(--green); border-color: var(--green); color: #fff; }
.shop input:focus-visible + .box { outline: 3px solid var(--green); outline-offset: 2px; }
.txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.txt small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.price { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; }
.shop li.done .txt b { text-decoration: line-through; color: var(--muted); }
.shop li.done { opacity: .6; }
.shop li.pantry .txt b { font-weight: 500; }

.cook { min-height: calc(100dvh - var(--safe-t) - 40px); display: flex; flex-direction: column; max-width: 640px; margin: 0 auto; }
.cook-top { display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 8px; }
.cook-top p { font-weight: 600; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cook-progress { height: 4px; background: var(--line); border-radius: 2px; margin: 12px 0 26px; overflow: hidden; }
.cook-progress i { display: block; height: 100%; background: var(--green); transition: width .3s; }
.cook-n { font-family: "Caveat"; font-size: 26px; color: var(--tomato); }
.cook-text { font-family: "Bricolage"; font-size: clamp(24px, 6.4vw, 34px); line-height: 1.25; font-weight: 500; margin-top: 6px; flex: 1; }
.timer { align-self: flex-start; margin-top: 20px; font-variant-numeric: tabular-nums; }
.cook-nav { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 26px; padding-bottom: calc(var(--safe-b) + 6px); }
dialog { border: 0; border-radius: var(--r); background: var(--card); color: var(--ink); width: min(520px, 92vw); max-height: 80dvh; padding: 22px; }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog .primary { width: 100%; margin-top: 16px; }

.sheet { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); display: flex; align-items: flex-end; justify-content: center; z-index: 30; animation: fade .2s; }
.sheet-card { background: var(--card); width: min(560px, 100%); border-radius: 24px 24px 0 0; padding: 22px var(--gutter) calc(var(--safe-b) + 16px); animation: up .25s ease; }
.sheet-card h2 { font-size: 22px; margin-bottom: 8px; }
.sheet-card ul { list-style: none; margin: 0 0 8px; padding: 0; }
.sheet-card li button { width: 100%; text-align: left; display: flex; flex-direction: column; padding: 12px 0; border-bottom: 1px solid var(--line); }
.sheet-card li span { color: var(--muted); font-size: 14px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

#tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 10px); z-index: 20;
  display: flex; gap: 2px; padding: 6px; border-radius: 999px; background: color-mix(in srgb, var(--card) 88%, transparent);
  box-shadow: var(--shadow); border: 1px solid var(--line); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
#tabbar[hidden] { display: none; }
#tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 72px; padding: 7px 10px 6px; border-radius: 999px;
  font-size: 11px; font-weight: 600; text-decoration: none; color: var(--muted); }
#tabbar a .i { width: 22px; height: 22px; }
#tabbar a.on { color: var(--ink); background: var(--soft); }
@media (max-width: 360px) { #tabbar a { min-width: 62px; } }

#toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 90px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 500; z-index: 40;
  transition: .25s; max-width: calc(100vw - 40px); text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
