/* Raaj Recipes — warm paper palette, paprika accent, Fraunces for titles, Inter for everything else. */
@font-face { font-family: Inter; src: url(/fonts/inter-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/inter-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/inter-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/inter-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: Fraunces; src: url(/fonts/fraunces-latin-opsz-normal.woff2) format('woff2'); font-weight: 300 900; font-display: swap; }
@font-face { font-family: Fraunces; src: url(/fonts/fraunces-latin-opsz-italic.woff2) format('woff2'); font-weight: 300 900; font-style: italic; font-display: swap; }

:root {
  --bg: #faf6ef; --surface: #fffdf9; --surface-2: #f3ece1; --ink: #2b2420; --muted: #7a6d62; --line: #e7ddcf;
  --accent: #c4502f; --accent-2: #a8401f; --accent-soft: #f6e1d7; --on-accent: #fff;
  --qty: #a8620c; --herb: #4c7a4a; --herb-soft: #e3eedf; --danger: #b3261e; --star: #e0912b;
  --shadow: 0 1px 2px rgb(60 40 20 / .06), 0 6px 20px -8px rgb(60 40 20 / .18);
  --r: 16px; --r-sm: 10px;
  --serif: Fraunces, 'Iowan Old Style', Georgia, serif;
  --sans: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
  --tabbar: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #171411; --surface: #211c18; --surface-2: #2a241f; --ink: #f1e9df; --muted: #a99b8d; --line: #3a322b;
    --accent: #e2724f; --accent-2: #f08a68; --accent-soft: #3d2519; --on-accent: #1b100b;
    --qty: #e8a74c; --herb: #8fbf89; --herb-soft: #23301f; --danger: #ff8a80; --star: #f0a94a;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -10px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}
:root[data-theme=dark] {
  --bg: #171411; --surface: #211c18; --surface-2: #2a241f; --ink: #f1e9df; --muted: #a99b8d; --line: #3a322b;
  --accent: #e2724f; --accent-2: #f08a68; --accent-soft: #3d2519; --on-accent: #1b100b;
  --qty: #e8a74c; --herb: #8fbf89; --herb-soft: #23301f; --danger: #ff8a80; --star: #f0a94a;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -10px rgb(0 0 0 / .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.55 var(--sans); min-height: 100dvh; overflow-x: hidden;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font: 600 clamp(1.6rem, 4.5vw, 2.3rem)/1.15 var(--serif); letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0 0 .8em; }
a { color: var(--accent-2); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
.ic { width: 20px; height: 20px; flex: none; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 99; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .9rem; }
.warn { background: var(--accent-soft); padding: 10px 12px; border-radius: var(--r-sm); }
.err { color: var(--danger); font-size: .92rem; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer;
  transition: background .15s, transform .1s, border-color .15s; white-space: nowrap; }
.btn:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.big { min-height: 50px; padding: 10px 22px; font-size: 1rem; }
.btn.sm { min-height: 34px; padding: 4px 12px; font-size: .88rem; }
.danger-text { color: var(--danger) !important; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 0; background: transparent; color: inherit; cursor: pointer; flex: none; text-decoration: none; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .ic { width: 17px; height: 17px; }
.icon-btn.on { background: var(--accent); color: var(--on-accent); }
.linkish { background: none; border: 0; padding: 6px 2px; color: var(--accent-2); font-weight: 600; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; }
.linkish .ic { width: 17px; height: 17px; }

/* ---------- header & nav ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px max(16px, env(safe-area-inset-left)); padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid transparent; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 650 1.15rem/1 var(--serif); }
.logo { width: 32px; height: 32px; }
.topnav { display: none; gap: 4px; margin-left: 18px; }
.topnav a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .95rem; }
.topnav a.on { background: var(--surface-2); color: var(--ink); }
.sync-chip { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: .82rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.sync-chip .ic { width: 17px; height: 17px; }
.sync-chip[data-state=ok] { color: var(--herb); }
.sync-chip[data-state=error] { color: var(--danger); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tabbar { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); height: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 600; border-radius: 12px; }
.tabbar a .ic { width: 23px; height: 23px; padding: 2px 14px; box-sizing: content-box; border-radius: 999px; transition: background .15s; }
.tabbar a.on { color: var(--ink); }
.tabbar a.on .ic { background: var(--accent-soft); color: var(--accent-2); }
body.in-recipe .tabbar { display: none; }
body.in-recipe { padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 900px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  body { padding-bottom: 24px; }
}

/* ---------- pages ---------- */
main { display: block; }
.page { max-width: 1180px; margin: 0 auto; padding: 8px 16px 32px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 8px 0 6px; }
.page-head h1 { margin: 0; }
.crumb { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; color: var(--muted); font-weight: 600; margin: 6px 0 2px; }
.crumb .ic { width: 17px; height: 17px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin: 14px 0; }
.box h2 { display: flex; align-items: center; gap: 8px; }
.box .sub { font-size: .92rem; color: var(--muted); margin-top: 16px; font-weight: 600; }

/* ---------- welcome (first run, also what search engines read) ---------- */
.welcome { max-width: 1080px; margin: 0 auto; padding: 8px 16px 32px; }
.hero { padding: 28px 0 12px; max-width: 760px; }
.eyebrow { color: var(--accent-2); font-weight: 700; font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; }
.hero h1 { font-size: clamp(2rem, 7vw, 3.3rem); font-weight: 560; }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 640px; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 6px; }
.cta-more { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin: 28px 0; }
.features article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.features h2 { font: 600 1.15rem/1.25 var(--serif); }
.features p { color: var(--muted); margin: 0; font-size: .95rem; }
.faq { max-width: 760px; }
.faq > h2 { font: 600 1.5rem var(--serif); margin-top: 12px; }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { color: var(--muted); margin: 8px 0 0; }

/* ---------- list ---------- */
.list-tools { display: flex; gap: 8px; margin: 6px 0 10px; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; min-height: 46px; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--ink); padding: 10px 0; font-size: 1rem; }
.search:focus-within { border-color: var(--accent); }
.sort-sel { position: relative; display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding-left: 12px; color: var(--muted); }
.sort-sel select { appearance: none; border: 0; background: transparent; padding: 10px 14px 10px 6px; color: var(--ink); font-weight: 600; font-size: .9rem; max-width: 150px; cursor: pointer; }
@media (max-width: 520px) { .sort-sel select { width: 22px; padding: 10px 8px 10px 0; color: transparent; } .sort-sel select option { color: var(--ink); } }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-size: .9rem; font-weight: 600; cursor: pointer; color: var(--ink); }
.chip .ic { width: 16px; height: 16px; }
.chip b { font-weight: 600; color: var(--muted); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip.on b { color: inherit; opacity: .7; }
.chip.sm { padding: 4px 10px; font-size: .85rem; }
.chip.tagchip { color: var(--muted); }
.chip.tagchip.on { color: var(--bg); }
.chip.check { padding: 0; overflow: hidden; }
.chip.check input { position: absolute; opacity: 0; }
.chip.check span { padding: 7px 14px; }
.chip.check input:checked + span { background: var(--ink); color: var(--bg); }
.chip.check input:focus-visible + span { outline: 2px solid var(--accent); }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; } }
.card { display: block; text-decoration: none; color: inherit; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); overflow: hidden; transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.ph { position: relative; aspect-ratio: 4 / 3; background: color-mix(in srgb, var(--tint, #ddd) 55%, var(--surface)); overflow: hidden; }
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; }
.ph.has img { opacity: 1; }
.ph-letter { position: absolute; inset: 0; display: grid; place-items: center; font: 500 2.6rem var(--serif); color: color-mix(in srgb, var(--tint, #999) 45%, #3a2a1f); }
.ph-letter .ic { width: 34px; height: 34px; }
.ph.has .ph-letter { display: none; }
.fav-dot { position: absolute; top: 8px; right: 8px; z-index: 1; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: rgb(255 255 255 / .9); color: var(--accent); }
.fav-dot .ic { width: 17px; height: 17px; fill: currentColor; }
.card-body { padding: 10px 12px 12px; }
.card h3 { font: 600 1.02rem/1.25 var(--serif); margin: 0 0 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 4px; font-size: .8rem; color: var(--muted); margin: 0; }
.card-meta .ic { width: 14px; height: 14px; margin-right: 2px; vertical-align: -2px; }
.sep { opacity: .5; margin: 0 2px; }
.stars { display: inline-flex; gap: 1px; color: var(--line); }
.stars .star { font-style: normal; color: color-mix(in srgb, var(--muted) 35%, transparent); font-size: 1.25rem; line-height: 1; }
.stars .star.on { color: var(--star); }
.stars.sm .star { font-size: .85rem; }
.stars button.star { background: none; border: 0; padding: 2px 3px; cursor: pointer; font-size: 1.5rem; }
.fab { position: fixed; z-index: 15; right: max(16px, env(safe-area-inset-right)); bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 999px; background: var(--accent); color: var(--on-accent); padding: 0 20px 0 16px; height: 56px; font-weight: 700; font-size: 1rem; box-shadow: 0 8px 24px -6px color-mix(in srgb, var(--accent) 70%, transparent); cursor: pointer; }
.fab .ic { width: 24px; height: 24px; }
@media (min-width: 900px) { .fab { bottom: 28px; right: 28px; } }

/* ---------- groups ---------- */
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-top: 14px; }
.group-card { text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.group-card > div:last-child { padding: 10px 12px; }
.group-card h3 { font: 600 1.05rem var(--serif); margin: 0; }
.group-card p { margin: 0; color: var(--muted); font-size: .85rem; }
.mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.mini-grid .card h3 { font-size: .9rem; }
.mini-grid .stars, .mini-grid .card-meta { display: none; }

/* ---------- recipe view ---------- */
.rv { max-width: 1180px; margin: 0 auto; padding-bottom: 32px; }
.rv-bar { position: sticky; top: 0; z-index: 25; display: flex; align-items: center; gap: 2px; padding: 6px 8px; padding-top: max(6px, env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.rv-bar-title { flex: 1; min-width: 0; font: 600 1.05rem var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
body.in-recipe .top { display: none; }
.gallery { position: relative; margin: 0 16px; border-radius: var(--r); overflow: hidden; background: color-mix(in srgb, var(--tint, #ddd) 50%, var(--surface)); }
.gallery.none { display: none; }
.gal-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gal-track::-webkit-scrollbar { display: none; }
.gal-track .ph { flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 4 / 3; max-height: 62vh; background: transparent; }
.gal-dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.gal-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgb(255 255 255 / .55); }
.gal-dots i.on { background: #fff; }
.rv-head { padding: 16px 16px 4px; }
.rv-title { display: flex; align-items: flex-start; gap: 8px; }
.rv-title h1 { flex: 1; margin: 0; font-size: clamp(1.75rem, 5.5vw, 2.6rem); }
.fav { border: 1px solid var(--line); background: var(--surface); width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--muted); flex: none; }
.fav.on { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-soft); }
.fav.on .ic { fill: currentColor; }
.rv-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 12px; }
.cat { font-weight: 600; color: var(--muted); }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.facts div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 7px 12px; min-width: 78px; }
.facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; font-weight: 650; font-size: .95rem; }
.rv-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { position: sticky; top: calc(54px + env(safe-area-inset-top)); z-index: 10; display: flex; margin: 16px 0 0; padding: 0 8px; background: var(--bg); border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; background: none; padding: 13px 4px 11px; font-weight: 650; font-size: .92rem; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; letter-spacing: .02em; }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); }
.rv-body { padding: 4px 16px; }
.rv-body section { padding-top: 14px; }
.rv[data-tab=summary] [data-sec=ingredients], .rv[data-tab=summary] [data-sec=directions],
.rv[data-tab=ingredients] [data-sec=summary], .rv[data-tab=ingredients] [data-sec=directions],
.rv[data-tab=directions] [data-sec=summary], .rv[data-tab=directions] [data-sec=ingredients] { display: none; }
.sec-head { display: flex; align-items: center; justify-content: space-between; }
.sec-head h2 { font: 600 1.35rem var(--serif); margin: 0; }
.prose p { margin: 0 0 .7em; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.tag { background: var(--surface-2); border-radius: 999px; padding: 4px 11px; font-size: .85rem; color: var(--muted); text-decoration: none; font-weight: 500; }
.tag.g { background: var(--herb-soft); color: var(--herb); font-weight: 600; }
.ext { display: inline-flex; align-items: center; gap: 6px; word-break: break-all; }
.stamp { color: var(--muted); font-size: .82rem; }
.scaler { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; padding: 6px 6px 6px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; width: fit-content; max-width: 100%; }
.scaler > span { font-size: .85rem; font-weight: 600; color: var(--muted); margin-right: 4px; }
.scaler b { min-width: 28px; text-align: center; font-size: 1.05rem; }
.scaler .icon-btn { border: 1px solid var(--line); background: var(--bg); }
ul.ing { list-style: none; padding: 0; margin: 8px 0 0; }
.ing li { border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.ing li.head { font: 600 1.05rem var(--serif); padding: 18px 0 6px; border: 0; color: var(--accent-2); }
.ing li.head:first-child { padding-top: 6px; }
.ing label { display: flex; gap: 12px; align-items: flex-start; padding: 11px 2px; cursor: pointer; font-size: 1.04rem; }
.ing input { appearance: none; flex: none; width: 22px; height: 22px; border: 2px solid var(--line); border-radius: 7px; margin-top: 2px; cursor: pointer; display: grid; place-items: center; }
.ing input:checked { background: var(--herb); border-color: var(--herb); }
.ing input:checked::after { content: ''; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
.ing input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.qty { color: var(--qty); font-weight: 650; }
ol.steps { list-style: none; padding: 0; margin: 8px 0 0; position: relative; }
.steps li { display: flex; gap: 14px; padding: 10px 0; position: relative; cursor: pointer; }
.steps li:not(.head)::before { content: ''; position: absolute; left: 16px; top: 44px; bottom: -10px; width: 2px; background: var(--herb-soft); }
.steps li:last-child::before { display: none; }
.steps .num { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--herb-soft); color: var(--herb); display: grid; place-items: center; font-weight: 700; font-size: .92rem; position: relative; z-index: 1; }
.steps p { margin: 5px 0 0; font-size: 1.06rem; line-height: 1.6; }
.steps li.done .num { background: var(--herb); color: #fff; }
.steps li.done p { color: var(--muted); }
.steps li.head { font: 600 1.1rem var(--serif); color: var(--accent-2); padding: 18px 0 2px; cursor: default; }
.tchip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); color: var(--accent-2); border-radius: 999px; padding: 0 9px 0 6px; margin: 0 1px; font-weight: 650; font-size: .95em; cursor: pointer; line-height: 1.7; vertical-align: baseline; }
.tchip .ic { width: 15px; height: 15px; }
@media (min-width: 900px) {
  .rv-bar { position: static; padding: 10px 16px 0; }
  .rv-top-grid { display: grid; }
  .gallery { float: right; width: min(46%, 520px); margin: 8px 16px 16px 24px; }
  .rv-head { padding-top: 12px; }
  .tabs { display: none; }
  .rv-body { clear: both; display: grid; grid-template-columns: minmax(280px, 5fr) 7fr; gap: 12px 40px; padding-top: 12px; }
  .rv-body section { display: block !important; }
  .sec-summary { grid-column: 1 / -1; order: 3; display: grid !important; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); column-gap: 20px; align-items: start; border-top: 1px solid var(--line); margin-top: 16px; }
  .sec-summary > .prose, .sec-summary > .tags, .sec-summary > .stamp { grid-column: 1 / -1; }
  .sec-ing { order: 1; position: sticky; top: 16px; align-self: start; max-height: calc(100vh - 32px); overflow: auto; }
  .sec-dir { order: 2; }
}

/* ---------- editor ---------- */
.editor { max-width: 820px; }
.ed-bar { position: sticky; top: 0; z-index: 25; display: flex; align-items: center; gap: 8px; margin: 0 -16px 8px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.ed-bar h1 { flex: 1; margin: 0; font-size: 1.3rem; }
.field { display: block; margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.field > span, .field > legend { display: flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 650; color: var(--muted); margin-bottom: 6px; letter-spacing: .02em; }
.field > span .ic { width: 15px; height: 15px; }
.field small { font-weight: 400; }
.row-field { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 12px; }
.row-field > span:first-child { margin: 0; }
.input { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 13px; font-size: 1rem; outline: none; transition: border-color .15s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea.input { resize: vertical; line-height: 1.55; min-height: 64px; }
select.input { appearance: auto; }
.title-in { font: 600 1.45rem var(--serif); padding: 13px 14px; }
.field.sec > span { font-size: .95rem; color: var(--ink); padding: 8px 12px; border-radius: var(--r-sm) var(--r-sm) 0 0; margin: 0; }
.field.sec.ing > span { background: color-mix(in srgb, var(--qty) 22%, var(--surface)); }
.field.sec.dir > span { background: var(--herb-soft); }
.field.sec .input { border-radius: 0 0 var(--r-sm) var(--r-sm); }
.field.sec .hint { display: block; margin-top: 6px; }
.two { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
.four { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (min-width: 640px) { .two { grid-template-columns: 1fr 1fr; } .four { grid-template-columns: repeat(4, 1fr); } }
.photo-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px; margin: 0 0 14px; aspect-ratio: 2.2 / 1; }
.ptile { position: relative; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); border: 0; min-height: 0; }
.ptile.cover { grid-row: span 2; }
.ptile img { width: 100%; height: 100%; object-fit: cover; }
.ptile.add { display: grid; place-content: center; justify-items: center; gap: 4px; color: var(--muted); cursor: pointer; border: 1.5px dashed color-mix(in srgb, var(--muted) 45%, transparent); }
.ptile.add .ic { width: 28px; height: 28px; }
.ptile.add span { font-size: .85rem; font-weight: 600; }
.pt-btn { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgb(0 0 0 / .55); color: #fff; display: grid; place-items: center; cursor: pointer; font-size: .95rem; }
.pt-btn.left { right: auto; left: 6px; }
.pt-btn .ic { width: 16px; height: 16px; }
.pt-cover { position: absolute; left: 8px; bottom: 8px; background: rgb(0 0 0 / .55); color: #fff; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.ed-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.ed-foot .primary { margin-left: auto; }

/* ---------- plan ---------- */
.week-label { color: var(--muted); font-weight: 600; margin: 0 0 12px; }
.days { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .days { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .days { grid-template-columns: repeat(4, 1fr); } }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px 6px; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.day h2 { font: 600 1.08rem var(--serif); margin-bottom: 4px; }
.day h2 small { font: 500 .8rem var(--sans); color: var(--muted); margin-left: 4px; }
.day ul { list-style: none; padding: 0; margin: 0; }
.day li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.day li > a, .day li > span:not(.meal) { flex: 1; min-width: 0; color: var(--ink); font-weight: 550; text-decoration: none; overflow-wrap: anywhere; }
.meal { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--herb); background: var(--herb-soft); border-radius: 6px; padding: 2px 6px; flex: none; }
.add-meal { font-size: .9rem; }
.plan-foot { margin-top: 16px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: .9rem; cursor: pointer; }
.seg input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

/* ---------- shopping ---------- */
.shop-page { max-width: 720px; }
.add-row { display: flex; gap: 8px; margin: 8px 0 14px; }
.add-row .btn { width: 48px; padding: 0; flex: none; }
.shop-group h2 { display: flex; align-items: center; gap: 8px; font: 600 1.05rem var(--serif); margin: 18px 0 4px; color: var(--accent-2); }
.shop-group h2 .ic { width: 17px; height: 17px; }
ul.shop { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.shop li { display: flex; align-items: center; gap: 6px; padding: 0 6px 0 14px; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.shop li:last-child { border-bottom: 0; }
.shop label { flex: 1; display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; cursor: pointer; min-width: 0; overflow-wrap: anywhere; }
.shop input { appearance: none; flex: none; width: 22px; height: 22px; border: 2px solid var(--line); border-radius: 50%; margin-top: 1px; display: grid; place-items: center; cursor: pointer; }
.shop input:checked { background: var(--herb); border-color: var(--herb); }
.shop input:checked::after { content: ''; width: 5px; height: 10px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
.shop li.done span { text-decoration: line-through; color: var(--muted); }
.shop li.done .qty { color: inherit; }
.shop-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* ---------- settings ---------- */
.settings { max-width: 760px; }
.settings h1 { margin-top: 8px; }

/* ---------- sheets ---------- */
dialog.sheet { border: 0; padding: 0; background: transparent; color: var(--ink); max-width: 100vw; max-height: 100dvh; width: 100%; margin: auto auto 0; }
dialog.sheet::backdrop { background: rgb(20 12 6 / .45); }
.sheet-in { background: var(--surface); border-radius: 22px 22px 0 0; padding: 20px 18px calc(16px + env(safe-area-inset-bottom)); max-height: 88dvh; overflow: auto; animation: up .22s ease-out; }
.sheet-in h2 { font: 600 1.35rem var(--serif); }
.sheet-msg { font-size: 1.02rem; }
.sheet-in .input { margin-bottom: 10px; }
.sheet-in .search { margin: 0 0 10px; }
.sheet-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
@keyframes up { from { transform: translateY(30px); opacity: .4; } }
@media (min-width: 640px) {
  dialog.sheet { width: min(560px, calc(100vw - 32px)); margin: auto; }
  .sheet-in { border-radius: 22px; padding: 24px; }
}
.menu { display: grid; gap: 4px; }
.menu > button, .menu > a { display: flex; align-items: flex-start; gap: 14px; text-align: left; border: 0; background: none; padding: 12px; border-radius: 12px; cursor: pointer; text-decoration: none; color: var(--ink); }
.menu > button:hover, .menu > a:hover { background: var(--surface-2); }
.menu .ic { width: 24px; height: 24px; color: var(--accent-2); margin-top: 1px; }
.menu b { display: block; font-weight: 650; }
.menu small { display: block; color: var(--muted); font-size: .86rem; margin-top: 1px; }
.menu .danger b, .menu .danger .ic { color: var(--danger); }
.pick-list { max-height: 48dvh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: 10px; }
.pick { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); cursor: pointer; }
.pick:last-child { border-bottom: 0; }
.pick input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.pick span { min-width: 0; overflow-wrap: anywhere; }
.pick small { display: block; color: var(--muted); font-size: .82rem; }
.pick.btnlike { width: 100%; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); background: none; text-align: left; font-weight: 600; }
.pick.btnlike:hover { background: var(--surface-2); }
.switch { text-align: center; color: var(--muted); margin: 14px 0 0; }

/* ---------- cook mode ---------- */
dialog.cook { border: 0; padding: 0; margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: var(--bg); color: var(--ink); }
.cook-in { height: 100%; display: flex; flex-direction: column; padding: max(10px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom)); max-width: 900px; margin: 0 auto; }
.cook-top { display: flex; align-items: center; justify-content: space-between; font: 600 1.05rem var(--serif); }
.cook-progress { height: 5px; border-radius: 9px; background: var(--surface-2); margin: 8px 0 0; overflow: hidden; }
.cook-progress i { display: block; height: 100%; background: var(--herb); border-radius: 9px; transition: width .25s; }
.cook-body { flex: 1; overflow: auto; display: flex; flex-direction: column; justify-content: center; padding: 20px 4px; }
.cook-count { color: var(--herb); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: .85rem; }
.cook-step { font: 450 clamp(1.45rem, 5.2vw, 2.4rem)/1.4 var(--serif); margin: 0; }
.cook-ing { max-height: 40dvh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; margin-bottom: 12px; }
.cook-ing li { padding: 6px 0; }
.cook-nav { display: flex; gap: 8px; }
.cook-nav .btn { flex: 1; min-width: 0; }
.cook-nav .btn span { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) { .cook-nav .btn span { display: none; } }

/* ---------- timers & toasts ---------- */
#timers { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar) + 84px + env(safe-area-inset-bottom)); display: grid; gap: 6px; width: min(420px, calc(100vw - 24px)); }
body.in-recipe #timers { bottom: calc(16px + env(safe-area-inset-bottom)); }
dialog.cook ~ #timers, body:has(dialog.cook[open]) #timers { bottom: calc(84px + env(safe-area-inset-bottom)); }
.timer { display: flex; align-items: center; gap: 10px; background: var(--ink); color: var(--bg); border-radius: 16px; padding: 8px 8px 8px 16px; box-shadow: var(--shadow); }
.timer.done { background: var(--accent); color: var(--on-accent); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.02); } }
.t-time { font: 700 1.3rem var(--sans); font-variant-numeric: tabular-nums; min-width: 64px; }
.t-label { flex: 1; min-width: 0; font-size: .85rem; line-height: 1.25; overflow: hidden; }
.t-label small { display: block; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-btn { border: 0; background: rgb(255 255 255 / .16); color: inherit; border-radius: 999px; min-width: 40px; height: 36px; padding: 0 10px; font-weight: 700; cursor: pointer; }
#toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); top: calc(12px + env(safe-area-inset-top)); display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; justify-content: space-between; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow); font-size: .94rem; pointer-events: auto; animation: drop .2s ease-out; transition: opacity .3s, transform .3s; }
.toast.out { opacity: 0; transform: translateY(-8px); }
.toast button { background: none; border: 0; color: var(--accent-soft); font-weight: 700; cursor: pointer; padding: 4px; }
:root[data-theme=dark] .toast button { color: var(--accent); }
@keyframes drop { from { transform: translateY(-12px); opacity: 0; } }

/* ---------- print: the whole recipe on paper ---------- */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; color: #000; padding: 0; }
  .top, .tabbar, .rv-bar, .tabs, .rv-actions, .fab, #timers, #toasts, .scaler, .sec-head .icon-btn, .fav, .box button, .mini-grid, .box .sub, .stamp { display: none !important; }
  .rv-body section { display: block !important; }
  .gallery { float: right; width: 42%; margin: 0 0 12px 18px; }
  .gal-track .ph:not(:first-child), .gal-dots { display: none; }
  .ing input { display: none; }
  .ing label { padding: 3px 0; }
  .ing li, .steps li { border: 0; break-inside: avoid; }
  .steps li::before { display: none; }
  .box { border: 0; padding: 0; }
  a { color: #000; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
