:root {
  --bg: #f6f1e7; --card: #fffdf8; --ink: #2b241c; --muted: #7a6d5c; --line: #e6dccb;
  --accent: #d9542b; --accent-ink: #fff; --accent-soft: #fbe3d8; --green: #3f7d4e; --green-soft: #e1efe3;
  --gold: #e3a21a; --shadow: 0 1px 2px rgba(60,40,20,.06), 0 6px 20px rgba(60,40,20,.07);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1814; --card: #25211b; --ink: #f1e9dc; --muted: #ab9d8a; --line: #3a332a;
    --accent: #ec6a40; --accent-soft: #46291e; --green: #7dc08d; --green-soft: #22352a; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1814; --card: #25211b; --ink: #f1e9dc; --muted: #ab9d8a; --line: #3a332a;
  --accent: #ec6a40; --accent-soft: #46291e; --green: #7dc08d; --green-soft: #22352a; --shadow: none;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 Inter, system-ui, sans-serif; }
h1, h2, h3, .brand { font-family: Fraunces, Georgia, serif; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.7rem; margin: .2em 0; }
main { max-width: 720px; margin: 0 auto; padding: 8px 16px 120px; }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; max-width: 720px; margin: 0 auto; }
.brand { color: var(--ink); text-decoration: none; font-size: 1.3rem; display: flex; align-items: center; gap: 6px; }
nav { display: flex; gap: 4px; align-items: center; }
nav a, .link { color: var(--muted); text-decoration: none; font: 500 .95rem Inter, sans-serif; padding: 6px 10px; border-radius: 99px; background: none; border: 0; cursor: pointer; }
nav a.on { background: var(--ink); color: var(--bg); }

.hero h1 { font-size: clamp(2.1rem, 7vw, 3.2rem); line-height: 1.05; margin: .4em 0 .3em; }
.hero h1 em { color: var(--accent); font-style: italic; }
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 34em; }
.how { list-style: none; padding: 0; display: grid; gap: 8px; margin: 20px 0; }
.how li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.auth { display: grid; gap: 12px; max-width: 420px; }
.tabs { display: flex; background: var(--bg); border-radius: 99px; padding: 4px; }
.tab { flex: 1; border: 0; background: none; padding: 8px; border-radius: 99px; font: 600 .95rem Inter, sans-serif; color: var(--muted); cursor: pointer; }
.tab.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
label { display: grid; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--muted); }
input, select { font: 400 1rem Inter, sans-serif; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); width: 100%; min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.err { color: var(--accent); margin: 0; min-height: 1.2em; font-size: .9rem; }
.fine { color: var(--muted); font-size: .8rem; margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 18px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 600 1rem Inter, sans-serif; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn.file { flex: 1; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row .btn { flex: 1; }

.steps { display: flex; gap: 6px; margin: 4px 0 8px; font-size: .8rem; font-weight: 600; }
.steps span { color: var(--muted); padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); }
.steps .on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.steps .done { color: var(--green); border-color: var(--green); }
.sub { color: var(--muted); margin-top: 0; }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.thumbs:empty { display: none; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 16px; cursor: pointer; }
.or { text-align: center; color: var(--muted); margin: 18px 0; position: relative; font-size: .85rem; }
.or::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--line); }
.or span { background: var(--bg); padding: 0 10px; position: relative; }

.add { display: flex; gap: 8px; margin: 12px 0; }
.cat { margin: 14px 0 6px; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 2px 4px 2px 2px; font-size: .92rem; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 1rem; padding: 4px 6px; border-radius: 99px; line-height: 1; }
.chip .nm { padding: 4px 2px; cursor: pointer; }
.chip .amt { color: var(--muted); font-size: .78rem; margin-left: 2px; }
.chip.must { background: var(--accent-soft); border-color: var(--accent); }
.chip.must .star { color: var(--gold); }
.mustbar { margin: 10px 0 0; font-size: .9rem; color: var(--muted); }
.mustbar b { color: var(--accent); }

.prefs { margin-top: 18px; }
.prefs summary { font-weight: 600; cursor: pointer; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.grid .full { grid-column: 1 / -1; }
.tog { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); font-size: .92rem; margin-top: 6px; }
.tog input { width: auto; accent-color: var(--accent); }

.sticky { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; justify-content: center; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); }
.sticky .btn { flex: 0 1 auto; }
.sticky .btn.primary { flex: 1 1 auto; max-width: 320px; }

.recipe h2 { font-size: 2rem; line-height: 1.1; margin: 0 0 6px; }
.recipe .desc { color: var(--muted); margin: 0 0 12px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.meta span { background: var(--bg); border-radius: 99px; padding: 3px 10px; font-size: .82rem; font-weight: 600; }
.recipe h3 { font-size: 1.15rem; margin: 18px 0 6px; }
.ing { list-style: none; padding: 0; margin: 0; columns: 2 220px; }
.ing li { padding: 4px 0; break-inside: avoid; display: flex; gap: 8px; }
.ing .mk { width: 1.2em; flex: none; text-align: center; }
.ing .need { color: var(--accent); font-weight: 600; }
.ing .amt { color: var(--muted); }
.shop { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; margin-top: 12px; font-size: .92rem; }
.method { padding-left: 0; list-style: none; counter-reset: s; margin: 0; }
.method li { counter-increment: s; position: relative; padding: 10px 10px 10px 44px; border-radius: 10px; cursor: pointer; }
.method li::before { content: counter(s); position: absolute; left: 8px; top: 9px; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--bg); font: 700 .85rem/26px Inter, sans-serif; text-align: center; }
.method li.done { opacity: .45; text-decoration: line-through; }
.method li.done::before { content: "✓"; background: var(--green); }
.tips { color: var(--muted); font-size: .92rem; padding-left: 1.2em; }

.search { margin: 8px 0 14px; }
.saved { display: grid; gap: 10px; }
.saved .item { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.saved .item h3 { margin: 0; font-size: 1.1rem; }
.saved .item p { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }
.saved .item .grow { flex: 1; min-width: 0; }
.saved .empty { color: var(--muted); text-align: center; padding: 40px 0; }

.busy { position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 88%, transparent); display: grid; place-content: center; text-align: center; z-index: 10; backdrop-filter: blur(2px); }
.pan { font-size: 64px; animation: toss 1.1s ease-in-out infinite; }
@keyframes toss { 0%,100% { transform: rotate(-12deg) translateY(0); } 50% { transform: rotate(10deg) translateY(-14px); } }
.busy p { font-weight: 600; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-weight: 600; z-index: 20; max-width: calc(100% - 32px); text-align: center; }

@media print {
  .top, .steps, .sticky, .toast { display: none !important; }
  .card { box-shadow: none; border: 0; }
}

/* phone fit: keep header on one line and the action bar inside the screen */
.brand, nav a, .link { white-space: nowrap; }
.sticky .btn { padding: 12px 14px; min-width: 0; }
@media (max-width: 420px) {
  .brand { font-size: 1.15rem; }
  nav a, .link { padding: 6px 8px; font-size: .9rem; }
}
