/* Version 4.1: Design 4 (real recipe photos, Whop sign-in, the 30-Day Meal Plan) plus install-the-app and PDF downloads.
   Layout: a navigation rail on wide screens and a floating tab bar on phones around one calm content
   column; recipes split into ingredients and steps on wide screens. Figtree throughout, for reading ease.
   Father Amos ([data-brand='amos']): cream paper, forest green and terracotta, as in Design 1 and
   fatheramosrecipes.shop.
   Alejandro Muñoz ([data-brand='alejandro']): paprika and saffron, from a Spanish kitchen. */

:root {
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --bg: #ffffff;
  --bg-2: #f2f5f9;
  --bg-3: #e5ebf2;
  --surface: #ffffff;
  --line: #e2e8ef;
  --line-2: #c9d3de;
  --ink: #0e1a2b;
  --ink-2: #3e4b5c;
  --ink-3: #5f6b7b;
  --brand: #1c4f86;
  --brand-2: #153e6a;
  --brand-ink: #ffffff;
  --brand-soft: #e6eef8;
  --pop: #f0b429;
  --pop-soft: #fdf3d8;
  --pop-ink: #5a3d00;
  --heart: #d93f45;
  --ok: #1d7f47;
  --ok-ink: #ffffff;
  --danger: #c0352f;
  --scrim: rgb(9 16 27 / 46%);
  --glass: rgb(255 255 255 / 84%);
  --art-blob: 0.45;
  --shadow-1: 0 1px 2px rgb(14 26 43 / 6%), 0 2px 10px rgb(14 26 43 / 5%);
  --shadow-2: 0 18px 44px rgb(14 26 43 / 15%), 0 3px 8px rgb(14 26 43 / 6%);
  --tap: 52px;
  --rail: 264px;
  --bar-h: 68px;
  color-scheme: light;
}
/* Father Amos: Design 1 palette (cream paper, forest green, terracotta hearts). */
:root[data-brand='amos'] {
  --bg: #f5f0e6; --bg-2: #ede5d5; --bg-3: #e3d8c4; --surface: #fffbf3; --line: #e1d7c4; --line-2: #cdbfa6;
  --ink: #1f3328; --ink-2: #3e4c40; --ink-3: #5d6556;
  --brand: #294738; --brand-2: #1f382b; --brand-ink: #ffffff; --brand-soft: #e2eadf;
  --pop: #b4532a; --pop-soft: #f6e2d6; --pop-ink: #6e2c11; --heart: #b4532a; --ok: #2f6b45; --danger: #b33a2a;
  --glass: rgb(255 251 243 / 86%); --scrim: rgb(24 30 20 / 46%);
  --shadow-1: 0 1px 2px rgb(40 30 10 / 7%), 0 2px 10px rgb(40 30 10 / 5%);
  --shadow-2: 0 18px 44px rgb(40 30 10 / 15%), 0 3px 8px rgb(40 30 10 / 6%);
}
:root[data-brand='alejandro'] {
  --bg-2: #f8f3ef; --bg-3: #efe5de; --line: #ede4dc; --line-2: #dccdc2;
  --ink: #1d1411; --ink-2: #55453e; --ink-3: #76665e;
  --brand: #b43c1c; --brand-2: #962f14; --brand-soft: #fbe9e2;
  --pop: #f2b630; --pop-soft: #fdf2d6; --pop-ink: #5a3b00; --heart: #d6334f;
  --shadow-1: 0 1px 2px rgb(40 20 12 / 7%), 0 2px 10px rgb(40 20 12 / 5%);
  --shadow-2: 0 18px 44px rgb(40 20 12 / 15%), 0 3px 8px rgb(40 20 12 / 6%);
  --scrim: rgb(29 15 10 / 46%);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme='auto'] {
    --bg: #0c1219; --bg-2: #151d27; --bg-3: #1e2834; --surface: #111923; --line: #243040; --line-2: #34435a;
    --ink: #eef3f9; --ink-2: #b9c5d3; --ink-3: #94a1b2; --brand: #8cbaf0; --brand-2: #a8cbf5; --brand-ink: #0b1a2c; --brand-soft: #16263a;
    --pop: #f3c55a; --pop-soft: #2c2412; --pop-ink: #f7d98c; --heart: #ff7a7f; --ok: #5cc98a; --ok-ink: #062012; --danger: #ff8a80;
    --scrim: rgb(0 0 0 / 60%); --glass: rgb(17 25 35 / 84%); --art-blob: 0.04;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 40%), 0 2px 10px rgb(0 0 0 / 25%); --shadow-2: 0 18px 44px rgb(0 0 0 / 50%), 0 3px 8px rgb(0 0 0 / 30%);
    color-scheme: dark;
  }
  :root[data-brand='amos'][data-theme='auto'] {
    --bg: #151916; --bg-2: #1d231f; --bg-3: #262e28; --surface: #1a1f1b; --line: #333c35; --line-2: #45503f;
    --ink: #ede6d8; --ink-2: #cdc6b6; --ink-3: #aab09f; --brand: #9cc4a6; --brand-2: #b4d6bb; --brand-ink: #10180f; --brand-soft: #24342a;
    --pop: #e98a63; --pop-soft: #3b2a22; --pop-ink: #f3b89c; --heart: #e98a63; --ok: #8fd1a2; --danger: #f08a6a; --glass: rgb(26 31 27 / 86%);
  }
  :root[data-brand='alejandro'][data-theme='auto'] {
    --bg: #130d0b; --bg-2: #1e1714; --bg-3: #2a201b; --surface: #19120f; --line: #33261f; --line-2: #4a382e;
    --ink: #f7efe9; --ink-2: #d6c6bc; --ink-3: #ad9b91; --brand: #f39272; --brand-2: #f6a98d; --brand-ink: #2a0f06; --brand-soft: #3a1c12;
    --pop: #f4c65c; --pop-soft: #2f2412; --pop-ink: #f7d98c; --heart: #ff7a8f; --glass: rgb(25 18 15 / 86%);
  }
}
:root[data-theme='dark'] {
  --bg: #0c1219; --bg-2: #151d27; --bg-3: #1e2834; --surface: #111923; --line: #243040; --line-2: #34435a;
  --ink: #eef3f9; --ink-2: #b9c5d3; --ink-3: #94a1b2; --brand: #8cbaf0; --brand-2: #a8cbf5; --brand-ink: #0b1a2c; --brand-soft: #16263a;
  --pop: #f3c55a; --pop-soft: #2c2412; --pop-ink: #f7d98c; --heart: #ff7a7f; --ok: #5cc98a; --ok-ink: #062012; --danger: #ff8a80;
  --scrim: rgb(0 0 0 / 60%); --glass: rgb(17 25 35 / 84%); --art-blob: 0.04;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 40%), 0 2px 10px rgb(0 0 0 / 25%); --shadow-2: 0 18px 44px rgb(0 0 0 / 50%), 0 3px 8px rgb(0 0 0 / 30%);
  color-scheme: dark;
}
:root[data-brand='amos'][data-theme='dark'] {
    --bg: #151916; --bg-2: #1d231f; --bg-3: #262e28; --surface: #1a1f1b; --line: #333c35; --line-2: #45503f;
    --ink: #ede6d8; --ink-2: #cdc6b6; --ink-3: #aab09f; --brand: #9cc4a6; --brand-2: #b4d6bb; --brand-ink: #10180f; --brand-soft: #24342a;
    --pop: #e98a63; --pop-soft: #3b2a22; --pop-ink: #f3b89c; --heart: #e98a63; --ok: #8fd1a2; --danger: #f08a6a; --glass: rgb(26 31 27 / 86%);
}
:root[data-brand='alejandro'][data-theme='dark'] {
  --bg: #130d0b; --bg-2: #1e1714; --bg-3: #2a201b; --surface: #19120f; --line: #33261f; --line-2: #4a382e;
  --ink: #f7efe9; --ink-2: #d6c6bc; --ink-3: #ad9b91; --brand: #f39272; --brand-2: #f6a98d; --brand-ink: #2a0f06; --brand-soft: #3a1c12;
  --pop: #f4c65c; --pop-soft: #2f2412; --pop-ink: #f7d98c; --heart: #ff7a8f; --glass: rgb(25 18 15 / 86%);
}

/* Text size (everything is in rem) */
html { font-size: 106.25%; -webkit-text-size-adjust: 100%; }
html[data-text-size='large'] { font-size: 118.75%; }
html[data-text-size='xl'] { font-size: 131.25%; }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  padding-bottom: calc(var(--bar-h) + 30px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
body.locked { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-weight: 750; letter-spacing: -0.02em; line-height: 1.15; text-wrap: balance; margin: 0; }
p { margin: 0 0 0.8em; }
.muted { color: var(--ink-3); }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.print-only { display: none; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 10px; }
#main:focus-visible, .cook-main:focus-visible { outline: none; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--brand); color: var(--brand-ink); padding: 10px 16px; border-radius: 12px; }
.skip:focus { left: 8px; }

.icon { width: 1.4em; height: 1.4em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[aria-current] .icon .f, .btn .icon .f, .badge .icon .f, .timer-start .icon .f { fill: currentColor; }
[aria-current] .icon .d { stroke: var(--brand-soft); }

/* ---------- Boot ---------- */
.boot { min-height: 80vh; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 24px; text-align: center; color: var(--ink-2); }
.boot-dot { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--bg-3); border-top-color: var(--brand); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; }
.skeleton.hero { aspect-ratio: 4 / 3; border-radius: 24px; margin-bottom: 18px; }
.skeleton.line { height: 20px; margin: 14px 0; }
.w60 { width: 60%; } .w40 { width: 40%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Avatars ---------- */
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; background: var(--bg-2); }
.avatar.sm { width: 32px; height: 32px; }
.avatar.xl { width: 72px; height: 72px; box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--pop); }
.avatar.xxl { width: 104px; height: 104px; margin: 0 auto 16px; box-shadow: 0 0 0 4px var(--surface), 0 0 0 7px var(--pop); }

/* ---------- Shell: rail, top bar, tab bar ---------- */
.rail { display: none; }
.frame { min-width: 0; }
#main { max-width: 1100px; margin: 0 auto; padding: 4px max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left)); outline: none; }

.appbar {
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px;
  height: calc(60px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
  transition: background 0.2s, box-shadow 0.2s;
}
.appbar.scrolled { background: var(--glass); -webkit-backdrop-filter: blur(18px) saturate(1.6); backdrop-filter: blur(18px) saturate(1.6); box-shadow: 0 1px 0 var(--line); }
.appbar-lead { min-width: 0; }
.appbar-title { font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; opacity: 0; transition: opacity 0.2s; }
.appbar.scrolled .appbar-title { opacity: 1; }
.appbar-tools { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.brand-mini { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 750; font-size: 1rem; min-height: 48px; }
.brand-mini span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body[data-view='home'] .appbar:not(.scrolled) .brand-mini { opacity: 0; pointer-events: none; }
.brand-mini { transition: opacity 0.2s; }
.back-btn { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 14px 0 6px; border-radius: 999px; text-decoration: none; font-weight: 650; color: var(--ink); }
.back-btn:hover { background: var(--bg-2); }
body[data-view='recipe'] .appbar:not(.scrolled) .back-btn,
body[data-view='recipe'] .appbar:not(.scrolled) .appbar-tools > * { background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: var(--shadow-1); }

.tabbar {
  position: fixed; z-index: 40; left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right));
  bottom: calc(10px + env(safe-area-inset-bottom)); height: var(--bar-h);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; padding: 0 6px;
  border-radius: 26px; background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(1.7); backdrop-filter: blur(20px) saturate(1.7);
  box-shadow: var(--shadow-2); border: 1px solid var(--line);
}
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--ink-3); font-size: 0.72rem; font-weight: 650; padding: 6px 0; }
.tabbar a .icon { width: 58px; height: 32px; padding: 4px 17px; border-radius: 16px; transition: background 0.2s, color 0.2s; }
.tabbar a[aria-current] { color: var(--ink); }
.tabbar a[aria-current] .icon { background: var(--brand-soft); color: var(--brand); }
.count { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); font-size: 0.7rem; font-weight: 800; font-style: normal; }
.count[hidden] { display: none; }
.tabbar .count { position: absolute; top: 2px; left: calc(50% + 10px); }
body.no-tabs .tabbar { display: none; }
body.no-tabs { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
body.full { padding-bottom: 0; }
body.full .appbar, body.full .rail { display: none !important; }
body.full #main { max-width: none; padding: 0; }
body.full .frame { margin-left: 0 !important; }

@media (min-width: 960px) {
  body { padding-bottom: 40px; }
  body.no-tabs { padding-bottom: 40px; }
  .tabbar { display: none; }
  .rail {
    display: flex; flex-direction: column; gap: 6px; position: fixed; z-index: 35; inset: 0 auto 0 0; width: var(--rail);
    padding: 22px 14px 18px; border-right: 1px solid var(--line); background: var(--bg); overflow-y: auto;
  }
  .rail-brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; text-decoration: none; }
  .rail-brand strong { display: block; font-size: 1.05rem; font-weight: 750; line-height: 1.2; }
  .rail-brand small { color: var(--ink-3); font-weight: 600; font-size: 0.85rem; }
  .rail-nav { display: grid; gap: 4px; }
  .rail-nav a { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 14px; border-radius: 16px; text-decoration: none; color: var(--ink-2); font-weight: 650; }
  .rail-nav a:hover { background: var(--bg-2); }
  .rail-nav a[aria-current] { background: var(--brand-soft); color: var(--brand); }
  .rail-nav .count { margin-left: auto; }
  .rail-foot { margin-top: auto; display: flex; gap: 6px; align-items: center; padding: 14px 6px 0; border-top: 1px solid var(--line); }
  .frame { margin-left: var(--rail); }
  #main { padding-inline: 40px; }
  .appbar { height: 64px; padding-inline: 32px; }
  .appbar-tools, .brand-mini { display: none; }
  body[data-view='recipe'] .appbar:not(.scrolled) .back-btn { background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ---------- Buttons & controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: var(--tap); padding: 0 1.25rem; border-radius: 16px; border: 0;
  background: var(--bg-2); color: var(--ink); font-weight: 650; text-decoration: none; line-height: 1.2; text-align: center;
  transition: background 0.15s, transform 0.12s, box-shadow 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn .icon { width: 1.25em; height: 1.25em; }
.btn.primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 8px 20px -10px var(--brand); }
.btn.primary:hover { background: var(--brand-2); }
.btn.tonal { background: var(--brand-soft); color: var(--brand); }
.btn.quiet:hover { background: var(--bg-3); }
.btn.danger { background: var(--danger); color: #fff; }
.danger-text { color: var(--danger) !important; }
.btn.lg { min-height: 60px; padding: 0 1.5rem; font-size: 1.06rem; border-radius: 18px; }
.btn.sm { min-height: 44px; padding: 0 1rem; font-size: 0.95rem; border-radius: 14px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: 0.45; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row.center { justify-content: center; }
.icon-btn { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; border: 0; background: transparent; color: inherit; text-decoration: none; flex: none; }
.icon-btn:hover { background: var(--bg-2); }
.icon-btn[disabled] { opacity: 0.4; cursor: default; }
.icon-btn.sm { width: 40px; height: 40px; }
.icon-btn.active { background: var(--brand); color: var(--brand-ink); }
.pill-btn { min-width: 48px; height: 40px; padding: 0 12px; border-radius: 999px; border: 0; background: var(--bg-2); font-weight: 800; font-size: 0.82rem; letter-spacing: 0.06em; }
.pill-btn:hover { background: var(--bg-3); }
.link-btn { background: none; border: 0; padding: 8px 2px; min-height: 44px; color: var(--brand); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }

.chips { display: flex; gap: 8px; }
.chips.wrap { flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid transparent; background: var(--bg-2); font-weight: 550; font-size: 0.95rem; white-space: nowrap; }
.chip:hover { background: var(--bg-3); }
.chip.on { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.chip.ghost { background: transparent; border-color: var(--line); }
.chip .icon { width: 1.05em; height: 1.05em; stroke-width: 2.4; }
.chip .count { margin-left: 2px; }

.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 14px; background: var(--bg-2); }
.seg button { min-height: 44px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); font-weight: 650; font-size: 0.93rem; }
.seg button[aria-checked='true'] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.seg.small button { min-height: 40px; padding: 0 12px; }

.searchbar {
  position: sticky; top: calc(62px + env(safe-area-inset-top)); z-index: 10;
  display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 0 6px 0 18px; border-radius: 18px; background: var(--bg-2);
  box-shadow: 0 0 0 6px var(--bg);
}
.searchbar:focus-within { box-shadow: 0 0 0 6px var(--bg), inset 0 0 0 2px var(--brand); }
.searchbar > .icon { color: var(--ink-3); }
.searchbar input { flex: 1; min-width: 0; min-height: 56px; border: 0; background: transparent; outline: none; font-size: 1.06rem; }
.searchbar input::-webkit-search-cancel-button { -webkit-appearance: none; }
.searchbar input::placeholder { color: var(--ink-3); }
.searchbar .clear-q[hidden] { display: none; }
.searchbar.small { position: static; min-height: 52px; margin-bottom: 12px; box-shadow: none; }
.searchbar.small:focus-within { box-shadow: inset 0 0 0 2px var(--brand); }
.searchbar.small input { min-height: 50px; }
@media (min-width: 960px) { .searchbar { top: 70px; } }

/* ---------- Page structure ---------- */
.page-head { margin: 6px 0 18px; }
.page-title { font-size: clamp(1.9rem, 1.35rem + 2.2vw, 2.6rem); font-weight: 800; letter-spacing: -0.03em; }
.page-sub { color: var(--ink-2); margin: 8px 0 0; max-width: 60ch; }
.section { margin: 30px 0 8px; }
.section.tight { margin: 20px 0 6px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 1.32rem; }
.section-head > a { display: inline-flex; align-items: center; gap: 2px; color: var(--brand); font-weight: 650; text-decoration: none; white-space: nowrap; min-height: 44px; }
.section-head > a .icon { width: 1.1em; height: 1.1em; }
.section-sub { color: var(--ink-3); margin: 4px 0 0; font-size: 0.93rem; }
.mini-head { font-size: 0.98rem; font-weight: 750; color: var(--ink-2); margin: 18px 0 10px; letter-spacing: -0.005em; }
.eyebrow { display: inline-block; color: var(--brand); font-weight: 700; font-size: 0.88rem; text-decoration: none; margin-bottom: 4px; }
.foot-note { text-align: center; color: var(--ink-3); font-size: 0.85rem; margin: 44px 0 0; }
.empty { text-align: center; padding: 40px 16px; color: var(--ink-2); }
.empty.big { padding: 64px 16px; }
.empty p { max-width: 36ch; margin: 0 auto 18px; }
.empty-icon { width: 60px; height: 60px; stroke-width: 1.4; color: var(--brand); margin: 0 auto 14px; }
.empty-icon.heart { color: var(--heart); }
mark { background: var(--pop-soft); color: inherit; border-radius: 4px; padding: 0 2px; }

/* ---------- Illustrations ---------- */
.art { position: relative; overflow: hidden; aspect-ratio: 4 / 3; border-radius: 20px; background: var(--bg-2); max-width: 100%; }
.art img, .art-svg { display: block; width: 100%; height: 100%; object-fit: cover; }
.art-svg { --art-bg: var(--a); }
:root[data-theme='dark'] .art-svg { --art-bg: var(--b); }
@media (prefers-color-scheme: dark) { :root[data-theme='auto'] .art-svg { --art-bg: var(--b); } }
.art.thumb { width: 72px; aspect-ratio: 1; border-radius: 16px; flex: none; }
.art.thumb.sm { width: 56px; border-radius: 14px; }
.art.thumb.xs { width: 44px; border-radius: 12px; }

/* ---------- Cards, rows, rails ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 26px 18px; }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr 1fr; gap: 20px 12px; } }
.rcard { position: relative; min-width: 0; }
.rcard-link { display: block; text-decoration: none; }
.rcard .art { transition: transform 0.2s, box-shadow 0.2s; }
.rcard-link:hover .art { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.rcard-title { font-size: 1.02rem; font-weight: 700; line-height: 1.3; margin: 10px 0 4px; letter-spacing: -0.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rcard-meta, .rrow-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--ink-3); font-size: 0.88rem; font-weight: 550; margin: 0; }
.rcard-meta span, .rrow-meta span { display: inline-flex; align-items: center; gap: 4px; }
.rcard-meta .icon, .rrow-meta .icon { width: 1.05em; height: 1.05em; }
.fav { display: inline-grid; place-items: center; border: 0; color: var(--ink-2); }
.fav.over { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 50%; background: var(--glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: var(--shadow-1); }
.fav.on { color: var(--heart); }
.fav.on .icon .f { fill: var(--heart); }
.fav.pop .icon, .act.fav.pop .icon { animation: pop 0.38s ease; }
@keyframes pop { 40% { transform: scale(1.3); } }

.rail-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: min(46%, 240px); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 2px 16px 10px; scrollbar-width: none; }
.rail-scroll::-webkit-scrollbar { display: none; }
.rail-scroll > * { scroll-snap-align: start; }
@media (min-width: 960px) { .rail-scroll { margin: 0; padding-inline: 0; grid-auto-columns: 232px; } }

.rows { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.rrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 8px; border-radius: 18px; text-decoration: none; width: 100%; text-align: left; border: 0; background: none; }
.rrow:hover { background: var(--bg-2); }
.rrow-text { display: grid; gap: 2px; min-width: 0; }
.rrow-text strong { font-size: 1.02rem; font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rrow-cat { color: var(--brand); font-weight: 700; font-size: 0.8rem; }
.rrow .chev { color: var(--ink-3); width: 1.2em; }
.count-line { color: var(--ink-3); font-size: 0.92rem; margin: 6px 0 12px; }
.cat-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }

/* ---------- Home ---------- */
.hello { display: flex; align-items: center; gap: 18px; margin: 4px 0 20px; }
.hello-text { min-width: 0; }
.hello-greet { color: var(--ink-3); font-weight: 650; margin: 0 0 2px; }
.hello-line { font-size: clamp(1.4rem, 1.05rem + 1.6vw, 2.05rem); font-weight: 800; letter-spacing: -0.025em; line-height: 1.18; max-width: 24ch; }
.search-cta { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 0 20px; margin-bottom: 26px; border-radius: 20px; background: var(--bg-2); color: var(--ink-3); font-weight: 550; font-size: 1.04rem; text-decoration: none; }
.search-cta:hover { background: var(--bg-3); }
.search-cta .icon { color: var(--brand); }
.feature-rail { display: grid; grid-auto-flow: column; grid-auto-columns: min(86%, 400px); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 4px 16px 14px; scrollbar-width: none; }
.feature-rail::-webkit-scrollbar { display: none; }
.feature { scroll-snap-align: start; display: flex; flex-direction: column; border-radius: 26px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); overflow: hidden; }
.feature-link { display: block; text-decoration: none; flex: 1; }
.feature-art { border-radius: 0; aspect-ratio: 16 / 10; }
.feature-text { display: grid; gap: 4px; padding: 14px 18px 0; }
.feature-text .eyebrow { margin: 0; }
.feature-text strong { font-size: 1.22rem; font-weight: 750; line-height: 1.25; letter-spacing: -0.015em; }
.feature-cta { margin: 14px 18px 18px; align-self: flex-start; }
@media (min-width: 960px) {
  .feature-rail { margin: 0; padding-inline: 0; grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; }
  .feature:nth-child(n + 4) { display: none; }
}
.resume { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px; margin-bottom: 26px; border-radius: 22px; background: var(--brand-soft); text-decoration: none; }
.resume-text { display: grid; gap: 4px; min-width: 0; }
.resume-text .eyebrow { margin: 0; font-size: 0.8rem; }
.resume-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 750; }
.resume-text small { color: var(--ink-2); font-weight: 600; }
.bar { display: block; height: 6px; border-radius: 999px; background: var(--bg-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--ok); transition: width 0.4s; }
.resume .bar > span { background: var(--brand); }
.bar.big { height: 10px; margin: 0 0 18px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0 4px; }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { display: grid; align-content: start; gap: 6px; padding: 16px; min-height: 132px; border-radius: 22px; background: var(--bg-2); text-decoration: none; transition: background 0.15s, transform 0.15s; }
.tile:hover { background: var(--bg-3); transform: translateY(-2px); }
.tile > .icon { width: 44px; height: 44px; padding: 10px; border-radius: 14px; background: var(--surface); color: var(--brand); box-shadow: var(--shadow-1); margin-bottom: 6px; }
.tile strong { font-weight: 750; line-height: 1.25; }
.tile small { color: var(--ink-3); font-size: 0.86rem; line-height: 1.35; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 10px; }
@media (max-width: 560px) { .cat-grid { grid-template-columns: 1fr 1fr; } }
.cat-tile { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; border-radius: 20px; background: var(--bg-2); text-decoration: none; min-width: 0; }
.cat-tile:hover { background: var(--bg-3); }
.cat-art { width: 56px; aspect-ratio: 1; border-radius: 14px; flex: none; }
.cat-tile span { display: grid; min-width: 0; }
.cat-tile strong { font-weight: 700; font-size: 0.97rem; line-height: 1.25; }
.cat-tile small { color: var(--ink-3); font-size: 0.82rem; }

/* ---------- Search ---------- */
.filterbar { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 12px 16px 6px; scrollbar-width: none; }
.filterbar::-webkit-scrollbar { display: none; }
@media (min-width: 960px) { .filterbar { margin: 0; padding-inline: 0; flex-wrap: wrap; } }
.filter-body .chips { margin-bottom: 4px; }

/* ---------- Recipe ---------- */
.recipe { display: grid; grid-template-columns: minmax(0, 1fr); }
.recipe-hero { margin: calc(-64px - env(safe-area-inset-top)) -16px 0; }
.hero-art { border-radius: 0; aspect-ratio: 4 / 3.2; }
.recipe-head { position: relative; margin: -30px -16px 0; padding: 24px 16px 0; background: var(--bg); border-radius: 30px 30px 0 0; }
.recipe-head .page-title { font-size: clamp(1.85rem, 1.3rem + 2.4vw, 2.7rem); }
.lead { color: var(--ink-2); font-size: 1.07rem; margin: 10px 0 14px; max-width: 60ch; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border-radius: 999px; font-weight: 650; font-size: 0.82rem; }
.badge .icon { width: 1em; height: 1em; }
.badge.pop { background: var(--pop-soft); color: var(--pop-ink); }
.badge.draft { background: var(--bg-2); color: var(--ink-3); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 18px 0 14px; border: 1px solid var(--line); border-radius: 20px; }
.stats > div { padding: 12px 14px; min-width: 0; }
.stats > div + div { border-left: 1px solid var(--line); }
.stats dt { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 0.8rem; font-weight: 650; }
.stats dt .icon { width: 1.1em; height: 1.1em; }
.stats dd { margin: 4px 0 0; font-weight: 800; font-size: 1.06rem; line-height: 1.25; }
.stats dd small { color: var(--ink-3); font-weight: 600; font-size: 0.78rem; }
.timebar { display: flex; gap: 3px; height: 10px; border-radius: 999px; overflow: hidden; }
.timebar span { display: block; height: 100%; }
.tb-prep { background: var(--pop); }
.tb-cook { background: var(--brand); }
.tb-rest { background: var(--line-2); }
.timebar-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0; margin: 10px 0 16px; color: var(--ink-2); font-size: 0.88rem; }
.timebar-legend li { display: inline-flex; align-items: center; gap: 6px; }
.timebar-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.diet-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.tag { display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 0 12px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); font-weight: 550; font-size: 0.86rem; text-decoration: none; }
.tag .icon { width: 1em; height: 1em; color: var(--ok); }
.tag:hover { background: var(--bg-3); }
.head-actions { display: grid; gap: 12px; }
.start { width: 100%; }
.action-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 68px; padding: 8px 4px; border: 0; border-radius: 18px; background: var(--bg-2); color: var(--ink-2); font-weight: 650; font-size: 0.8rem; line-height: 1.2; text-align: center; }
.act:hover { background: var(--bg-3); }
.act.fav.on { color: var(--heart); }
.cooked { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 0.9rem; }
.cooked .icon { color: var(--ok); }

.block { margin-top: 30px; min-width: 0; }
.block-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.block-head h2 { font-size: 1.4rem; }
.controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 6px; }
.stepper { display: inline-flex; align-items: center; gap: 6px; padding: 4px; border-radius: 999px; background: var(--bg-2); }
.stepper .icon-btn { width: 44px; height: 44px; background: var(--surface); box-shadow: var(--shadow-1); }
.stepper output { display: grid; justify-items: center; min-width: 4.6rem; line-height: 1.05; }
.stepper output b { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stepper output small { font-size: 0.72rem; font-weight: 650; color: var(--ink-3); }

.ing-list { list-style: none; padding: 0; margin: 6px 0 0; }
.ing-list li { border-bottom: 1px solid var(--line); }
.ing-list li:last-child { border-bottom: 0; }
.ing-row { display: grid; grid-template-columns: 28px minmax(4.4rem, max-content) minmax(0, 1fr); align-items: baseline; gap: 2px 12px; width: 100%; padding: 13px 4px; border: 0; background: none; text-align: left; line-height: 1.4; }
.ing-row .tick { align-self: center; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); transition: background 0.15s, border-color 0.15s; }
.ing-row .tick .icon { width: 16px; height: 16px; stroke-width: 3; color: var(--ok-ink); opacity: 0; transition: opacity 0.15s; }
.ing-row .qty { font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ing-row .name { min-width: 0; }
.ing-row .note { display: block; color: var(--ink-3); font-size: 0.88rem; }
.ing-row .opt { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--bg-2); color: var(--ink-3); font-size: 0.72rem; font-weight: 650; vertical-align: 2px; }
.ing-row.on .tick { background: var(--ok); border-color: var(--ok); }
.ing-row.on .tick .icon { opacity: 1; }
.ing-row.on .qty, .ing-row.on .name { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.ing-row .qty:empty { display: none; }
.ing-row:has(.qty:empty) { grid-template-columns: 28px minmax(0, 1fr); }
.equip { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.equip li { padding: 8px 12px; border-radius: 12px; background: var(--bg-2); color: var(--ink-2); font-size: 0.9rem; }

.steps { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 12px; }
.step { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 16px 16px 14px; border-radius: 22px; background: var(--bg-2); transition: opacity 0.2s; }
.step.on { opacity: 0.62; }
.step-num { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface); color: var(--brand); font-weight: 800; font-size: 1.05rem; box-shadow: var(--shadow-1); }
.step-num .icon { width: 20px; height: 20px; stroke-width: 2.6; }
.step.on .step-num { background: var(--ok); color: var(--ok-ink); }
.step-body p { margin: 8px 0 10px; font-size: 1.07rem; line-height: 1.6; }
.need { margin: 2px 0 10px; }
.need-label { display: block; font-size: 0.78rem; font-weight: 750; color: var(--ink-3); margin-bottom: 6px; }
.need ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.need li { padding: 5px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 0.88rem; line-height: 1.35; }
.need li b { color: var(--ink); font-weight: 750; font-variant-numeric: tabular-nums; }

.good { margin-top: 28px; }
.mini-title { font-size: 1.2rem; margin-bottom: 6px; }
.good details { border-top: 1px solid var(--line); }
.good details:last-child { border-bottom: 1px solid var(--line); }
.good summary, details.aisle summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 58px; font-weight: 700; cursor: pointer; }
.good summary::-webkit-details-marker, details.aisle summary::-webkit-details-marker { display: none; }
.good summary .icon:first-child { color: var(--brand); }
summary .chev { margin-left: auto; color: var(--ink-3); transition: transform 0.2s; }
details[open] > summary .chev { transform: rotate(180deg); }
.good details > :not(summary) { margin: 0 0 16px 34px; color: var(--ink-2); }
.bullets { padding-left: 1.1em; margin: 0; }
.bullets li { margin-bottom: 6px; }
.notes { margin-top: 26px; padding: 18px; border-radius: 22px; background: var(--bg-2); }
.notes textarea, .field textarea { display: block; width: 100%; min-height: 96px; margin: 12px 0; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--surface); resize: vertical; }
.stars { display: flex; gap: 4px; }
.stars button { width: 46px; height: 46px; padding: 6px; border: 0; background: none; color: var(--line-2); border-radius: 12px; }
.stars button .icon { width: 100%; height: 100%; stroke: none; }
.stars button .icon .f { fill: currentColor; }
.stars button.on { color: var(--pop); }
.stars.big { justify-content: center; margin: 14px 0 18px; }
.stars.big button { width: 58px; height: 58px; }

.action-bar { position: fixed; z-index: 40; left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; padding: 10px; border-radius: 26px; background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(1.7); backdrop-filter: blur(20px) saturate(1.7); box-shadow: var(--shadow-2); border: 1px solid var(--line); }
.action-bar .btn { flex: 1; }
.action-bar .bar { width: 60px; height: 60px; border-radius: 18px; background: var(--bg-2); }

@media (min-width: 960px) {
  /* The heading spans two rows so the ingredients card can start right under the picture. */
  .recipe { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-areas: 'hero head' 'ing head' 'ing method'; grid-template-rows: min-content auto 1fr; gap: 0 48px; align-items: start; }
  .recipe-hero { grid-area: hero; margin: 0; }
  .hero-art { border-radius: 28px; aspect-ratio: 1 / 1; }
  .recipe-head { grid-area: head; margin: 0; padding: 8px 0 0; border-radius: 0; }
  .ingredients { grid-area: ing; position: sticky; top: 84px; margin-top: 36px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 26px; max-height: calc(100vh - 104px); overflow: auto; }
  .method { grid-area: method; margin-top: 36px; }
  .action-bar { display: none; }
  #results .rows { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 28px; }
}

/* ---------- Cooking mode ---------- */
.cook { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; background: var(--bg); }
.cook-top { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto auto; align-items: center; gap: 6px;
  padding: calc(8px + env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 10px max(10px, env(safe-area-inset-left)); background: var(--glass); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); border-bottom: 1px solid var(--line); }
.cook-name { min-width: 0; }
.cook-name strong { display: block; text-align: center; font-size: 0.95rem; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.segs { display: flex; gap: 4px; margin-top: 8px; }
.seg-bar { flex: 1; height: 7px; padding: 0; border: 0; border-radius: 4px; background: var(--bg-3); }
.seg-bar.past { background: var(--brand); }
.seg-bar.now { background: var(--pop); }
.cook-main { display: flex; justify-content: center; padding: 26px max(20px, env(safe-area-inset-right)) 28px max(20px, env(safe-area-inset-left)); outline: none; }
.cook-body { width: 100%; max-width: 780px; }
.cook-kicker { color: var(--brand); font-weight: 750; margin: 0 0 12px; }
.cook-step { font-size: clamp(1.55rem, 1.05rem + 2.7vw, 2.55rem); font-weight: 650; line-height: 1.32; letter-spacing: -0.018em; margin: 0 0 24px; text-wrap: pretty; }
.cook-title { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.5rem); font-weight: 800; letter-spacing: -0.03em; margin: 0 0 6px; }
.need.big { margin-bottom: 24px; }
.need.big .need-label { font-size: 0.9rem; }
.need.big li { padding: 10px 14px; border-radius: 14px; font-size: 1.04rem; background: var(--bg-2); border-color: transparent; }
.ready .ing-row { padding: 15px 4px; font-size: 1.08rem; }
.timer-start { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 76px; padding: 0 22px; border-radius: 22px; border: 2px dashed var(--line-2); background: var(--brand-soft); color: var(--brand); font-size: 1.08rem; text-align: left; }
.timer-start .icon { width: 30px; height: 30px; }
.timer-big { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 22px; background: var(--brand-soft); }
.timer-big .ring { width: 76px; height: 76px; }
.timer-big strong { display: block; font-size: 2.1rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.timer-big span { color: var(--ink-2); font-size: 0.92rem; }
.timer-big.done { background: var(--pop-soft); animation: pulse 1s infinite; }
.cook-foot { position: sticky; bottom: 0; display: flex; gap: 12px; padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: var(--glass); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
.cook-foot .btn { flex: 1; }
.cook-foot .grow { flex: 2; }
@media (min-width: 760px) { .cook-foot { justify-content: center; } .cook-foot .btn { flex: 0 1 220px; } .cook-foot .grow { flex: 0 1 380px; } }
.finished { text-align: center; padding-top: 5vh; }
.finished .lead { margin-inline: auto; }
.done-mark { display: grid; place-items: center; width: 104px; height: 104px; margin: 0 auto 18px; border-radius: 50%; background: var(--ok); color: var(--ok-ink); animation: pop-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
.done-mark .icon { width: 54px; height: 54px; stroke-width: 2.6; }
@keyframes pop-in { from { transform: scale(0.4); opacity: 0; } }
.field { display: grid; gap: 6px; width: 100%; text-align: left; font-weight: 650; max-width: 520px; margin: 0 auto 16px; }
.field input { min-height: 56px; padding: 0 16px; border-radius: 16px; border: 1.5px solid var(--line-2); background: var(--surface); font-size: 1.1rem; letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------- Ring (timers) ---------- */
.ring { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--bg-3); stroke-width: 5; }
.ring-fg { fill: none; stroke: var(--brand); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset 0.25s linear; }
.timers { position: fixed; z-index: 50; right: max(12px, env(safe-area-inset-right)); bottom: calc(var(--bar-h) + 22px + env(safe-area-inset-bottom)); display: grid; gap: 8px; width: min(340px, calc(100% - 24px)); }
.timers[hidden] { display: none; }
body.no-tabs .timers { bottom: calc(96px + env(safe-area-inset-bottom)); }
body.full .timers { bottom: calc(100px + env(safe-area-inset-bottom)); }
@media (min-width: 960px) { .timers { top: 18px; bottom: auto !important; right: 22px; } body.full .timers { top: auto; bottom: 104px !important; } }
.timer { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 10px 8px 10px 12px; border-radius: 20px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-2); }
.timer .ring { width: 44px; height: 44px; }
.timer .ring-bg { stroke: color-mix(in srgb, var(--bg) 22%, transparent); }
.timer .ring-fg { stroke: var(--pop); }
.timer-text { display: grid; min-width: 0; }
.timer-label { font-size: 0.78rem; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer-time { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.timer .icon-btn:hover { background: color-mix(in srgb, var(--bg) 14%, transparent); }
.timer.done { background: var(--pop); color: var(--pop-ink); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.025); } }

/* ---------- Plan ---------- */
.week-switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; }
.week-switch strong { font-weight: 750; font-size: 1.05rem; }
.day-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 22px; }
.day-strip button { display: grid; justify-items: center; gap: 2px; padding: 10px 0 8px; border: 0; border-radius: 16px; background: var(--bg-2); color: var(--ink-2); }
.day-strip small { font-size: 0.74rem; font-weight: 650; text-transform: capitalize; }
.day-strip b { font-size: 1.18rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.day-strip .dots { display: flex; gap: 3px; height: 6px; }
.day-strip .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.day-strip .is-today { box-shadow: inset 0 0 0 2px var(--pop); }
.day-strip [aria-selected='true'] { background: var(--brand); color: var(--brand-ink); }
.day-strip [aria-selected='true'] b { color: var(--brand-ink); }
.day-strip [aria-selected='true'] .dots i { background: var(--brand-ink); }
.day-title { font-size: 1.25rem; margin: 0 0 14px; }
.day-title::first-letter { text-transform: uppercase; }
.meals { display: grid; gap: 12px; margin-bottom: 22px; }
@media (min-width: 760px) { .meals { grid-template-columns: 1fr 1fr; } }
.meal { padding: 14px 14px 16px; border-radius: 22px; border: 1px solid var(--line); }
.meal h3 { font-size: 0.95rem; color: var(--ink-3); font-weight: 750; margin: 0 0 4px 4px; }
.planned { display: flex; align-items: center; }
.planned .rrow { flex: 1; }
.add-meal { display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 0 14px; margin-top: 6px; border-radius: 14px; border: 1.5px dashed var(--line-2); background: transparent; color: var(--brand); font-weight: 650; }
.add-meal:hover { background: var(--brand-soft); border-color: transparent; }
.add-meal .icon { width: 1.15em; height: 1.15em; }

/* ---------- Shopping list ---------- */
.add-item { display: flex; gap: 8px; margin: 0 0 16px; }
.add-item input { flex: 1; min-width: 0; min-height: 54px; padding: 0 16px; border-radius: 16px; border: 0; background: var(--bg-2); font-size: 1rem; }
.add-item input:focus { outline: 2px solid var(--brand); outline-offset: 0; }
.add-item .btn { width: 54px; padding: 0; }
.recipe-chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 8px; padding: 0 16px 8px; scrollbar-width: none; }
.recipe-chips::-webkit-scrollbar { display: none; }
@media (min-width: 960px) { .recipe-chips { margin-inline: 0; padding-inline: 0; flex-wrap: wrap; } }
.recipe-chip { display: flex; align-items: center; gap: 10px; flex: none; max-width: 270px; padding: 6px 14px 6px 6px; border: 0; border-radius: 18px; background: var(--bg-2); text-align: left; }
.recipe-chip:hover { background: var(--bg-3); }
.recipe-chip span { display: grid; min-width: 0; }
.recipe-chip strong { font-size: 0.9rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recipe-chip small { color: var(--ink-3); font-size: 0.8rem; }
.list-groups { display: grid; gap: 4px; max-width: 760px; }
.aisle h2 { display: flex; align-items: center; gap: 8px; font-size: 1.02rem; margin: 18px 0 2px; }
.count-pill { padding: 2px 9px; border-radius: 999px; background: var(--bg-2); color: var(--ink-3); font-size: 0.75rem; font-weight: 750; }
details.aisle { margin-top: 10px; border-radius: 18px; background: var(--bg-2); padding: 0 14px; }
details.aisle summary { color: var(--ink-2); }
details.aisle .ing-list li { border-color: var(--line-2); }
.extra { display: flex; align-items: center; }
.extra .ing-row { flex: 1; grid-template-columns: 28px minmax(0, 1fr); }
.list-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.edit-recipe { display: flex; align-items: center; gap: 16px; }
.edit-recipe .thumb { width: 92px; }
.edit-recipe .sheet-title { margin: 0 0 10px; }

/* ---------- Pantry ---------- */
.pantry { display: grid; gap: 24px; }
@media (min-width: 960px) { .pantry { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } .pantry-results { position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow: auto; } }
.pantry-status { display: flex; align-items: center; justify-content: space-between; color: var(--ink-3); font-weight: 600; }
.pantry-pick .chip { white-space: normal; text-align: left; }
.pantry-results .mini-head { margin-top: 0; }
.missing { display: block; color: var(--ink-3); font-size: 0.86rem; }
.have-all { display: inline-flex; align-items: center; gap: 4px; color: var(--ok); font-weight: 700; font-size: 0.86rem; }
.have-all .icon { width: 1em; height: 1em; stroke-width: 2.6; }
.match { position: relative; display: flex; align-items: baseline; justify-content: center; width: 54px; height: 54px; padding-top: 16px; border-radius: 50%; background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--bg-3) 0); }
.match::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--bg); }
.match b, .match small { position: relative; }
.match b { font-weight: 800; font-size: 1rem; }
.match small { color: var(--ink-3); font-size: 0.72rem; font-weight: 650; }
.see-matches { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: calc(var(--bar-h) + 24px + var(--dock, 0px) + env(safe-area-inset-bottom)); box-shadow: var(--shadow-2); }
.see-matches[hidden] { display: none; }
@media (min-width: 960px) { .see-matches { display: none; } }

/* ---------- Settings ---------- */
.settings { display: grid; gap: 14px; max-width: 720px; }
.group { padding: 18px; border-radius: 22px; border: 1px solid var(--line); }
.group h2 { font-size: 1.05rem; margin: 0 0 12px; }
.group .seg { display: flex; }
.group .seg button { flex: 1; }
.sample { margin: 12px 0 0; color: var(--ink-2); }
.switch-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px; cursor: pointer; font-weight: 550; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-row i { flex: none; position: relative; width: 54px; height: 32px; border-radius: 16px; background: var(--bg-3); transition: background 0.2s; }
.switch-row i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 25%); transition: transform 0.2s; }
.switch-row input:checked + i { background: var(--ok); }
.switch-row input:checked + i::after { transform: translateX(22px); }
.switch-row input:focus-visible + i { outline: 3px solid var(--brand); outline-offset: 2px; }
.file-btn { cursor: pointer; }

/* ---------- Welcome ---------- */
.welcome { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(120% 70% at 50% 0%, var(--brand-soft), var(--bg) 70%); }
.welcome-card { width: min(440px, 100%); text-align: center; padding: 34px 24px 28px; border-radius: 30px; background: var(--surface); box-shadow: var(--shadow-2); }
.welcome-card h1 { font-size: 1.8rem; margin: 6px 0 8px; }
.welcome-card form { margin-top: 20px; display: grid; gap: 12px; }
.whop-btn { margin-top: 22px; }
.code-alt { margin-top: 18px; text-align: left; }
.code-alt summary { cursor: pointer; color: var(--brand); font-weight: 650; text-align: center; padding: 8px; }
.notice { display: grid; gap: 12px; margin: 18px 0 4px; padding: 16px; border-radius: 18px; background: var(--pop-soft); color: var(--pop-ink); text-align: center; }
.notice p { margin: 0; }
.account p { margin: 0 0 10px; }
.error { color: var(--danger); font-weight: 650; margin: 0; }

/* ---------- Sheets, toast ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity 0.2s; }
.sheet { position: relative; width: min(640px, 100%); max-height: min(88vh, 88dvh); overflow: auto; overscroll-behavior: contain;
  padding: 10px max(20px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: var(--surface); border-radius: 28px 28px 0 0; box-shadow: var(--shadow-2); transform: translateY(28px); opacity: 0; transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s; }
.sheet-wrap.open .sheet { transform: none; opacity: 1; }
.sheet-wrap.open .sheet-scrim { opacity: 1; }
.grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto 12px; }
.sheet-x { position: absolute; top: 10px; right: 10px; }
.sheet-title { font-size: 1.32rem; margin: 6px 52px 14px 0; }
.sheet-sub { font-size: 0.9rem; color: var(--ink-3); font-weight: 750; margin: 20px 0 10px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 22px; }
.sheet-actions .btn { flex: 1; }
@media (min-width: 700px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 28px; padding-bottom: 24px; } .grabber { display: none; } }
.day-pick { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day-pick button { display: grid; justify-items: center; padding: 10px 0; border: 0; border-radius: 14px; background: var(--bg-2); }
.day-pick small { font-size: 0.72rem; font-weight: 650; color: var(--ink-3); text-transform: capitalize; }
.day-pick b { font-size: 1.1rem; font-weight: 800; }
.day-pick [aria-checked='true'] { background: var(--brand); color: var(--brand-ink); }
.day-pick [aria-checked='true'] small { color: var(--brand-ink); }
.meal-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.size-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.size-pick button { display: grid; place-items: center; gap: 4px; padding: 14px 6px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface); }
.size-pick [aria-checked='true'] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.size-pick small { font-weight: 650; font-size: 0.8rem; color: var(--ink-2); }
.size-a { font-weight: 800; line-height: 1; }
.size-normal { font-size: 1.2rem; } .size-large { font-size: 1.55rem; } .size-xl { font-size: 1.95rem; }
.size-sample { margin: 14px 0 0; color: var(--ink-2); }
.confirm-msg { font-size: 1.1rem; font-weight: 650; margin: 8px 44px 20px 0; }
.confirm .btn-row > * { flex: 1; }
.ing-sheet .ing-row { font-size: 1.05rem; }
.pick-list { margin-top: 4px; }
.toast { position: fixed; z-index: 70; left: 50%; bottom: calc(var(--bar-h) + 26px + var(--dock, 0px) + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 16px; background: var(--ink); color: var(--bg); font-weight: 650; font-size: 0.95rem; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.no-tabs .toast { bottom: calc(100px + var(--dock, 0px) + env(safe-area-inset-bottom)); }
@media (min-width: 960px) { .toast { bottom: 28px !important; } body.full .toast { bottom: calc(104px + var(--dock, 0px)) !important; } }
/* With a sheet open the bottom of the screen is taken, so messages drop in from the top. */
body.locked .toast { top: calc(14px + env(safe-area-inset-top)); bottom: auto !important; }
body.locked .toast:not(.show) { transform: translate(-50%, -16px); }

/* ---------- Motion ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.22s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- Print: recipe cards and shopping lists ---------- */
@media print {
  @page { margin: 14mm; }
  :root { --bg: #fff; --bg-2: #fff; --surface: #fff; --ink: #111; --ink-2: #333; --ink-3: #555; --line: #ccc; }
  body { padding: 0; font-size: 10.5pt; }
  .rail, .appbar, .tabbar, .action-bar, .timers, .toast, .no-print, .fav, .skip, .sheet-wrap { display: none !important; }
  .frame { margin: 0 !important; }
  main { padding: 0; max-width: none; }
  .print-only { display: block; }
  .recipe { grid-template-columns: 1fr 1.6fr !important; gap: 0 24px !important; }
  .recipe-hero { margin: 0 !important; }
  .hero-art { aspect-ratio: 4 / 3 !important; border-radius: 12px !important; }
  .recipe-head { margin: 0 !important; padding: 0 !important; }
  .ingredients { position: static !important; max-height: none !important; overflow: visible !important; border: 0 !important; padding: 0 !important; }
  .step { background: none; padding: 6px 0; break-inside: avoid; }
  .step-num { box-shadow: none; border: 1.5px solid #999; width: 28px; height: 28px; font-size: 10pt; }
  .step .btn { display: none; }
  .ing-row { padding: 4px 0; }
  .ing-row .tick { width: 14px; height: 14px; border-width: 1.5px; }
  .good details { border: 0; }
  .good details > :not(summary) { margin-left: 0; }
  .print-foot { margin-top: 16px; font-size: 9pt; color: #555; border-top: 1px solid #ccc; padding-top: 6px; }
  a { text-decoration: none; }
}

/* ---------- 30-Day Meal Plan ---------- */
.p30-banner { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; padding: 16px 18px; border-radius: 20px; background: var(--brand-soft); color: var(--ink); text-decoration: none; }
.p30-banner > .icon { color: var(--brand); width: 28px; height: 28px; flex: none; }
.p30-banner span { display: grid; flex: 1; min-width: 0; }
.p30-banner small { color: var(--ink-2); }
.plan30-locked { display: grid; justify-items: center; gap: 18px; padding: 24px 0; }
.plan30-locked .checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.plan30-locked .checks li { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.plan30-locked .checks .icon { color: var(--ok); }
.p30-start { max-width: 320px; margin: 0 0 8px; }
.p30-start input { min-height: 52px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; }
.p30-week { margin-top: 28px; }
.p30-prep { color: var(--ink-2); margin: 0 0 12px; }
.p30-prep a { color: var(--brand); }
.p30-days { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.p30-day { padding: 14px 16px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); }
.p30-day h4 { margin: 0 0 8px; font-size: 1rem; }
.p30-meal { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); align-items: center; gap: 8px; padding: 4px 0; }
.p30-label { color: var(--ink-3); font-size: 0.82rem; font-weight: 650; }
.p30-item { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.p30-item span { display: grid; min-width: 0; }
.leftover { color: var(--pop-ink); font-size: 0.8rem; font-weight: 650; }

.p30-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 10px; }
.p30-actions .btn { flex: 1 1 220px; }
.p30-more { margin-top: 8px; border-radius: 18px; background: var(--bg-2); padding: 0 16px; }
.p30-more summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 54px; font-weight: 700; cursor: pointer; }
.p30-more summary::-webkit-details-marker { display: none; }
.p30-more summary .chev { margin-left: auto; transition: transform .2s; }
.p30-more[open] summary .chev { transform: rotate(180deg); }
.p30-more h4 { margin: 10px 0 4px; font-size: .9rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.p30-groc, .p30-notes { list-style: none; padding: 0 0 12px; margin: 0; display: grid; gap: 6px; }
.p30-groc { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.p30-groc b { font-variant-numeric: tabular-nums; }
.p30-notes li { line-height: 1.45; }
.p30-notes a { color: var(--brand); font-weight: 700; }
.p30-notes span { color: var(--ink-2); }
.p30-price { font-size: 1.6rem; margin: 0; }
.p30-price s { color: var(--ink-3); font-size: 1.1rem; margin-left: 6px; }

/* ---------- Version 4.1: install the app, PDF downloads ---------- */
.install-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: 'icon text x' 'icon btn btn'; align-items: center; gap: 4px 14px; margin: -8px 0 24px; padding: 14px 8px 14px 14px; border-radius: 22px; background: var(--brand-soft); }
.install-card img { grid-area: icon; width: 52px; height: 52px; border-radius: 14px; box-shadow: var(--shadow-1); align-self: start; }
.install-card-text { grid-area: text; display: grid; gap: 2px; min-width: 0; }
.install-card-text strong { font-weight: 750; line-height: 1.25; }
.install-card-text small { color: var(--ink-2); font-size: 0.88rem; }
.install-card [data-install-hide] { grid-area: x; align-self: start; }
.install-card .btn { grid-area: btn; justify-self: start; margin-top: 8px; }
.install-head { display: flex; align-items: center; gap: 14px; margin: 4px 48px 6px 0; }
.install-head img { width: 56px; height: 56px; border-radius: 14px; box-shadow: var(--shadow-1); flex: none; }
.install-head .sheet-title { margin: 0; }
.install-sub { color: var(--ink-2); margin: 8px 0 16px; }
.install-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 10px; }
.install-steps li { counter-increment: step; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; align-items: center; padding: 12px 14px 12px 12px; border-radius: 18px; background: var(--bg-2); line-height: 1.5; }
.install-steps li::before { content: counter(step); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 800; }
.ki { display: inline-grid; place-items: center; width: 30px; height: 30px; margin: 0 3px; vertical-align: middle; border-radius: 9px; background: var(--surface); box-shadow: var(--shadow-1); color: var(--ink); }
.ki svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ki .dot { fill: currentColor; stroke: none; }
.ki-share, .ki-add { color: #0a7cff; }
.install-inapp { padding: 14px; border-radius: 18px; background: var(--pop-soft); color: var(--pop-ink); line-height: 1.55; margin: 0 0 12px; }
.install-ok { display: flex; align-items: center; gap: 8px; color: var(--ok); font-weight: 700; margin: 0; }
.install-ok .icon { stroke-width: 2.6; }
.dl-strip { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; margin: 16px 0 4px; padding: 12px 14px; border-radius: 20px; border: 1px solid var(--line); text-decoration: none; }
.dl-strip:hover { background: var(--bg-2); }
.dl-strip > .icon:first-child { width: 46px; height: 46px; padding: 11px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); }
.dl-strip span { display: grid; gap: 2px; min-width: 0; }
.dl-strip strong { font-weight: 750; }
.dl-strip small { color: var(--ink-3); font-size: 0.88rem; }
.dl-strip .chev { color: var(--ink-3); }
.dl-list { display: grid; gap: 14px; max-width: 760px; }
.dl-card { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 16px; align-items: center; padding: 14px; border-radius: 24px; border: 1px solid var(--line); background: var(--surface); }
.dl-card img { width: 132px; height: 99px; object-fit: cover; border-radius: 14px; background: var(--bg-2); }
.dl-card h2 { font-size: 1.15rem; }
.dl-card p { color: var(--ink-2); margin: 4px 0 12px; font-size: 0.95rem; }
.dl-card.locked { background: var(--bg-2); border-color: transparent; }
@media (max-width: 480px) { .dl-card { grid-template-columns: 1fr; } .dl-card img { width: 100%; height: auto; aspect-ratio: 4 / 3; } }

/* Email sign-in (welcome screen) */
.email-signin { text-align: left; }
.email-signin .sent-to { margin: 0; font-size: 1.05rem; line-height: 1.5; }
.email-signin #otp { font-size: 1.6rem; letter-spacing: .3em; text-align: center; }
.email-msg.error p, .email-msg.notice p { margin: 0 0 10px; }
.welcome-card .small { font-size: .92rem; }
.welcome-card .help-line { margin-top: 18px; }
.welcome-card form[hidden], .welcome-card [hidden] { display: none; }
.welcome-card #email { text-transform: none; letter-spacing: normal; font-size: 1.1rem; }
