@font-face { font-family: 'Fraunces 144'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/fraunces-144.woff2) format('woff2'); }
@font-face { font-family: 'Fraunces 144'; font-style: italic; font-weight: 400 700; font-display: swap; src: url(fonts/fraunces-144-italic.woff2) format('woff2'); }
@font-face { font-family: 'Fraunces Soft'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/fraunces-soft.woff2) format('woff2'); }
@font-face { font-family: 'Fraunces Soft'; font-style: italic; font-weight: 400 700; font-display: swap; src: url(fonts/fraunces-soft-italic.woff2) format('woff2'); }
@font-face { font-family: 'Bricolage 85'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/bricolage-85.woff2) format('woff2'); }
@font-face { font-family: 'Bricolage 96'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/bricolage-96.woff2) format('woff2'); }
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 400 600; font-display: swap; src: url(fonts/geist.woff2) format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 400 500; font-display: swap; src: url(fonts/geist-mono.woff2) format('woff2'); }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/manrope.woff2) format('woff2'); }
@font-face { font-family: 'Young Serif'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/young-serif.woff2) format('woff2'); }
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 400 600; font-display: swap; src: url(fonts/geist-fracs.woff2) format('woff2'); unicode-range: U+2153-215E; }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 400 500; font-display: swap; src: url(fonts/geist-mono-fracs.woff2) format('woff2'); unicode-range: U+2153-215E; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/geist-fracs.woff2) format('woff2'); unicode-range: U+2153-215E; }
:root {
  color-scheme: dark;
  --bg: #0f0e0d;
  --surface: #1a1816;
  --raised: #24211e;
  --line: rgba(255, 244, 230, 0.08);
  --line-strong: rgba(255, 244, 230, 0.16);
  --fg: #f2ede6;
  --body: #e4ddd4;
  --muted: #a39b91;
  --faint: #6f6861;
  --accent: #f5a524;
  --accent-ink: #1c1203;
  --accent-soft: rgba(245, 165, 36, 0.14);
  --ok: #7bc47f;
  --fav: #ef5b4c;
  --danger: #ef5b4c;
  --scrim: rgba(15, 14, 13, 0.72);
  --shade: rgba(10, 9, 8, 0.92);
  --on-photo: rgba(242, 237, 230, 0.75);
  --photo-fg: #f5f0e9;
  --tab-bg: rgba(20, 18, 17, 0.78);
  --cook-bg: #000;
  --cook-chip: #161412;
  --cook-track: #2a2622;
  --cta-glow: 0 10px 30px -10px rgba(245, 165, 36, 0.55);
  --grain: 0;
  --display: "Fraunces 144", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --display-weight: 500;
  --display-track: -0.025em;
  --display-vars: normal;
  --display-em: italic;
  --ui: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --nums: var(--ui);
  --icon-stroke: 1.75;
  --r-card: 20px;
  --r-tile: 16px;
  --r-pill: 999px;
  --label-case: lowercase;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --tabbar-h: 64px;
}
:root[data-theme="clay"], :root[data-theme="clay-soft"] {
  --bg: #171513;
  --surface: #201d1a;
  --raised: #2a2622;
  --line: rgba(232, 222, 210, 0.07);
  --line-strong: rgba(232, 222, 210, 0.14);
  --fg: #ebe3d8;
  --body: #d9d0c4;
  --muted: #9b9186;
  --faint: #6a625a;
  --accent: #c9905f;
  --accent-ink: #1d130b;
  --accent-soft: rgba(201, 144, 95, 0.14);
  --ok: #94a88a;
  --fav: #c4705f;
  --danger: #d47a68;
  --scrim: rgba(23, 21, 19, 0.8);
  --shade: rgba(23, 21, 19, 0.94);
  --on-photo: rgba(235, 227, 216, 0.72);
  --tab-bg: #1c1a17;
  --cook-bg: #12100f;
  --cook-chip: #201d1a;
  --cook-track: #2c2824;
  --cta-glow: none;
  --grain: 0.07;
  --display: "Young Serif", "Iowan Old Style", Georgia, serif;
  --display-weight: 400;
  --display-track: -0.015em;
  --display-em: normal;
  --ui: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --icon-stroke: 1.75;
  --r-card: 14px;
  --r-tile: 12px;
}
:root[data-theme="clay-soft"] {
  --display: "Fraunces Soft", "Iowan Old Style", Georgia, serif;
  --display-weight: 600;
  --display-track: -0.02em;
  --display-em: italic;
}
:root[data-theme="sage"] {
  --bg: #121512;
  --surface: #1a1e1a;
  --raised: #232823;
  --line: rgba(226, 234, 219, 0.07);
  --line-strong: rgba(226, 234, 219, 0.14);
  --fg: #e6eadf;
  --body: #d3d9cc;
  --muted: #959e91;
  --faint: #636c60;
  --accent: #b4c79a;
  --accent-ink: #162011;
  --accent-soft: rgba(180, 199, 154, 0.13);
  --ok: #d8bf7f;
  --fav: #d88b78;
  --danger: #d88b78;
  --scrim: rgba(18, 21, 18, 0.8);
  --shade: rgba(14, 17, 14, 0.94);
  --on-photo: rgba(230, 234, 223, 0.72);
  --tab-bg: #171a17;
  --cook-bg: #0d0f0d;
  --cook-chip: #1a1e1a;
  --cook-track: #283028;
  --cta-glow: none;
  --grain: 0.05;
  --display: "Young Serif", "Iowan Old Style", Georgia, serif;
  --display-weight: 400;
  --display-track: -0.015em;
  --display-em: normal;
  --ui: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --icon-stroke: 2;
  --r-card: 24px;
  --r-tile: 18px;
}
:root[data-theme="graphite"] {
  --bg: #111214;
  --surface: #18191c;
  --raised: #212226;
  --line: rgba(236, 236, 240, 0.07);
  --line-strong: rgba(236, 236, 240, 0.14);
  --fg: #ececf0;
  --body: #d4d4da;
  --muted: #9a9ba3;
  --faint: #63646b;
  --accent: #9fb4f5;
  --accent-ink: #0e1526;
  --accent-soft: rgba(159, 180, 245, 0.13);
  --ok: #7fcfab;
  --fav: #f08a7e;
  --danger: #f08a7e;
  --scrim: rgba(17, 18, 20, 0.78);
  --shade: rgba(12, 13, 15, 0.94);
  --on-photo: rgba(236, 236, 240, 0.72);
  --tab-bg: rgba(20, 21, 24, 0.82);
  --cook-bg: #0a0a0b;
  --cook-chip: #18191c;
  --cook-track: #26272b;
  --cta-glow: none;
  --grain: 0;
  --display: "Bricolage 85", "Geist", ui-sans-serif, system-ui, sans-serif;
  --display-weight: 600;
  --display-track: -0.035em;
  --display-em: normal;
  --ui: "Geist", ui-sans-serif, system-ui, sans-serif;
  --nums: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --icon-stroke: 1.5;
  --r-card: 10px;
  --r-tile: 10px;
  --label-case: none;
}
:root[data-theme="ink"] {
  --bg: #0e1117;
  --surface: #161a22;
  --raised: #1f2430;
  --line: rgba(233, 230, 223, 0.07);
  --line-strong: rgba(233, 230, 223, 0.14);
  --fg: #e9e6df;
  --body: #d6d3cc;
  --muted: #959aa6;
  --faint: #5f6573;
  --accent: #d4b06a;
  --accent-ink: #1a1406;
  --accent-soft: rgba(212, 176, 106, 0.13);
  --ok: #8cc2a5;
  --fav: #e0857a;
  --danger: #e0857a;
  --scrim: rgba(14, 17, 23, 0.78);
  --shade: rgba(10, 12, 17, 0.94);
  --tab-bg: rgba(18, 21, 28, 0.86);
  --cook-bg: #090b0f;
  --cook-chip: #161a22;
  --cook-track: #252a36;
  --cta-glow: none;
  --grain: 0.04;
  --display: "Fraunces 144", "Iowan Old Style", Georgia, serif;
  --display-weight: 400;
  --display-track: -0.025em;
  --ui: "Geist", ui-sans-serif, system-ui, sans-serif;
  --icon-stroke: 1.5;
  --r-card: 16px;
  --r-tile: 14px;
}
:root[data-theme="plum"] {
  --bg: #151015;
  --surface: #1e171e;
  --raised: #281f28;
  --line: rgba(239, 230, 234, 0.07);
  --line-strong: rgba(239, 230, 234, 0.14);
  --fg: #efe6ea;
  --body: #ddd2d7;
  --muted: #a2949b;
  --faint: #6c5f66;
  --accent: #f2a477;
  --accent-ink: #24120a;
  --accent-soft: rgba(242, 164, 119, 0.13);
  --ok: #a8c48e;
  --fav: #ff7a90;
  --danger: #ff7a90;
  --scrim: rgba(21, 16, 21, 0.8);
  --shade: rgba(16, 11, 16, 0.94);
  --tab-bg: #1a141a;
  --cook-bg: #0e0a0e;
  --cook-chip: #1e171e;
  --cook-track: #302630;
  --cta-glow: none;
  --grain: 0.05;
  --display: "Bricolage 96", ui-sans-serif, system-ui, sans-serif;
  --display-weight: 650;
  --display-track: -0.03em;
  --display-em: normal;
  --ui: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --icon-stroke: 2;
  --r-card: 22px;
  --r-tile: 16px;
}
:root[data-theme="linen"] {
  color-scheme: light;
  --bg: #f4efe7;
  --surface: #fbf8f3;
  --raised: #ffffff;
  --line: rgba(40, 30, 20, 0.08);
  --line-strong: rgba(40, 30, 20, 0.16);
  --fg: #2a231d;
  --body: #3d342c;
  --muted: #6b5f54;
  --faint: #857868;
  --accent: #8f4f21;
  --accent-ink: #fff8f0;
  --accent-soft: rgba(143, 79, 33, 0.12);
  --ok: #5f8a55;
  --fav: #c4523f;
  --danger: #b5432f;
  --scrim: rgba(251, 248, 243, 0.82);
  --shade: rgba(22, 17, 12, 0.86);
  --on-photo: rgba(255, 250, 244, 0.8);
  --tab-bg: rgba(251, 248, 243, 0.88);
  --cook-bg: #f4efe7;
  --cook-chip: #e9e2d7;
  --cook-track: #ddd4c7;
  --cta-glow: none;
  --grain: 0.05;
  --display: "Young Serif", "Iowan Old Style", Georgia, serif;
  --display-weight: 400;
  --display-track: -0.015em;
  --display-em: normal;
  --ui: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --icon-stroke: 1.75;
  --r-card: 14px;
  --r-tile: 12px;
}

@view-transition { navigation: auto; }

* { box-sizing: border-box; scrollbar-color: var(--line-strong) transparent; }
html, body { background: var(--bg); color: var(--fg); }
html { padding-top: env(safe-area-inset-top, 0px); }
body { margin: 0; font-family: var(--ui); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
body::after { content: ""; position: fixed; inset: 0; z-index: 40; pointer-events: none; opacity: var(--grain); mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
img { max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.num { font-family: var(--nums); font-variant-numeric: tabular-nums; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: var(--icon-stroke); stroke-linecap: round; stroke-linejoin: round; }
.display { font-family: var(--display); font-weight: var(--display-weight); letter-spacing: var(--display-track); font-variation-settings: var(--display-vars); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.view { padding-bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom, 0px)); }
.view[data-recipe] { padding-bottom: calc(var(--tabbar-h) + 112px + env(safe-area-inset-bottom, 0px)); }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }

/* Home */
.top { padding-block: 20px 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-size: 30px; text-decoration: none; }
.brand i { color: var(--accent); font-style: normal; }
.top-right { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.round { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--fg); }
.hello { font-size: clamp(30px, 7.5vw, 48px); line-height: 1.06; margin: 6px 0 16px; text-wrap: balance; }
.hello em { font-style: var(--display-em); color: var(--accent); }

.searchbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: linear-gradient(var(--bg) 78%, transparent); padding-block: 8px 10px; margin-bottom: -10px; }
.search.htmx-request .icon { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.search { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; background: none; border: 0; color: var(--fg); font: inherit; font-size: 16px; outline: none; }
.search input::placeholder { color: var(--muted); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-block: 10px 2px; margin-bottom: 10px; scrollbar-width: none; margin-left: calc(-1 * var(--gutter-l)); margin-right: calc(-1 * var(--gutter-r)); padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; height: 40px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); color: var(--muted); font-size: 13px; font-weight: 500; text-transform: var(--label-case); text-decoration: none; }
.tg { opacity: .6; margin-right: 4px; }
.chip[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cell { position: relative; }
.card { position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; border-radius: var(--r-card); overflow: hidden; background: var(--surface); isolation: isolate; color: var(--photo-fg); text-decoration: none; }
.card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.card .noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); background: radial-gradient(circle at 30% 20%, var(--accent-soft), transparent 60%), var(--surface); }
.card .noimg .icon { width: 40px; height: 40px; }
.card:hover img { transform: scale(1.04); }
.card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 36%, var(--shade) 100%); }
.card .meta { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 1; display: grid; gap: 5px; }
.card h3 { margin: 0; font-size: 17px; line-height: 1.15; text-wrap: balance; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .sub { display: flex; align-items: center; gap: 5px; color: var(--on-photo); font-size: 12px; }
.card .sub .icon { width: 13px; height: 13px; }
.heart { position: absolute; top: 10px; right: 10px; z-index: 2; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--scrim); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--fg); }
.heart .icon { width: 18px; height: 18px; }
.cell .heart::before { content: ""; position: absolute; inset: -4px; }
.heart.htmx-request { opacity: .5; }
.heart[aria-pressed="true"] { color: var(--fav); }
.heart[aria-pressed="true"] .icon { fill: currentColor; }
.empty { grid-column: 1 / -1; padding: 48px 0; text-align: center; color: var(--muted); }
.empty a { color: var(--accent); }

/* Recipe */
.hero { position: relative; max-width: 1120px; margin: 0 auto; }
.hero img, .hero .noimg { display: block; width: 100%; max-width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.hero .noimg { aspect-ratio: 16 / 7; background: radial-gradient(circle at 25% 30%, var(--accent-soft), transparent 60%), var(--surface); }
@media (min-width: 800px) { .hero img { aspect-ratio: 21 / 9; border-radius: 0 0 28px 28px; } }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, var(--scrim) 0%, transparent 26%, transparent 50%, var(--bg) 100%); pointer-events: none; }
.hero .back, .hero .hero-actions { position: absolute; top: 12px; z-index: 2; }
.hero-actions { right: var(--gutter-r); display: flex; gap: 8px; }
.hero-actions .heart { position: static; }
.round-photo { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--scrim); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--fg); }
.round-photo .icon { width: 18px; height: 18px; }
.hero .back { left: var(--gutter-l); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--scrim); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--fg); }
.hero .heart { width: 40px; height: 40px; }
.rhead { margin-top: -56px; position: relative; z-index: 1; }
.rtitle { font-size: clamp(32px, 8.4vw, 56px); line-height: 1.02; margin: 0 0 12px; text-wrap: balance; }
.desc { color: var(--muted); margin: 0 0 14px; max-width: 65ch; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tag { display: inline-flex; align-items: center; min-height: 32px; font-size: 13px; color: var(--muted); padding: 5px 12px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); text-transform: var(--label-case); text-decoration: none; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-tile); overflow: hidden; }
.fact { background: var(--surface); padding: 12px 14px; display: grid; gap: 4px; min-width: 0; }
.fact .k { display: flex; align-items: center; gap: 6px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; }
.fact .k .icon { width: 14px; height: 14px; color: var(--accent); }
.fact .v { font-size: 17px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { position: relative; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--raised); display: grid; place-items: center; }
.stepper button::before { content: ""; position: absolute; inset: -7px; }
.stepper [data-servings-out] { min-width: 1.4em; padding: 0 2px; background: none; border-radius: 6px; text-align: center; }
.stepper [data-servings-out]::before { content: none; }
.stepper .scaled { color: var(--accent); }
.stepper button .icon { width: 14px; height: 14px; }
.stepper button:active { background: var(--accent); color: var(--accent-ink); }

.cols { display: grid; gap: 32px; margin-top: 28px; }
@media (min-width: 860px) { .cols { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; align-items: start; } .cols .ings { position: sticky; top: 16px; } }
.h2 { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.h2 h2 { margin: 0; font-size: 26px; }
.h2 span { color: var(--muted); font-size: 13px; }
.group { margin: 18px 0 2px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ilist, .slist { list-style: none; margin: 0; padding: 0; }
.ilist li button { width: 100%; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: start; padding: 11px 0; border-bottom: 1px solid var(--line); text-align: left; }
.box { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line-strong); display: grid; place-items: center; margin-top: 1px; transition: background .15s, border-color .15s; color: var(--bg); }
.box .icon { width: 14px; height: 14px; stroke-width: 3; opacity: 0; }
.ilist li button[aria-pressed="true"] .box { background: var(--ok); border-color: var(--ok); }
.ilist li button[aria-pressed="true"] .box .icon { opacity: 1; }
.ilist li button[aria-pressed="true"] .itext { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--faint); }
.itext { min-width: 0; overflow-wrap: anywhere; }
.qty { color: var(--accent); font-weight: 600; font-family: var(--nums); font-variant-numeric: tabular-nums; }
.inote { color: var(--muted); }
.slist { display: grid; gap: 4px; counter-reset: s; }
.slist li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.slist li::before { counter-increment: s; content: counter(s); font-family: var(--display); font-weight: var(--display-weight); font-size: 22px; line-height: 1.2; color: var(--accent); font-variant-numeric: tabular-nums; }
.slist p { margin: 0; color: var(--body); max-width: 65ch; overflow-wrap: anywhere; }
.slist b { display: block; color: var(--fg); margin-bottom: 2px; }
.notes { margin-top: 24px; padding: 14px 16px; border-radius: var(--r-tile); background: var(--surface); border: 1px solid var(--line); color: var(--body); white-space: pre-line; }
.source { display: flex; align-items: center; gap: 6px; margin-top: 20px; font-size: 13px; color: var(--muted); }
.source .icon { width: 14px; height: 14px; }
.source a { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }

.cta { position: fixed; z-index: 6; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding: 12px var(--gutter-r) 12px var(--gutter-l); background: linear-gradient(transparent, var(--bg) 40%); pointer-events: none; }
.cta a { pointer-events: auto; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; max-width: 480px; margin: 0 auto; height: 54px; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 16px; text-decoration: none; box-shadow: var(--cta-glow); }

/* Tab bar */
.tabbar { position: fixed; z-index: 7; left: 0; right: 0; bottom: 0; padding: 0 var(--gutter-r) env(safe-area-inset-bottom, 0px) var(--gutter-l); background: var(--tab-bg); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); border-top: 1px solid var(--line); }
.tabbar nav { max-width: 480px; margin: 0 auto; height: var(--tabbar-h); display: grid; grid-template-columns: repeat(4, 1fr); }
.tab { display: grid; place-items: center; align-content: center; gap: 3px; font-size: 12px; color: var(--muted); text-decoration: none; }
.tab .icon { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--fg); }
.tab[aria-current="page"] .icon { color: var(--accent); }
.tab .plus { width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }

/* Forms: add, settings */
.page-title { font-size: clamp(30px, 7vw, 44px); margin: 8px 0 6px; }
.lead { color: var(--muted); margin: 0 0 24px; max-width: 60ch; }
.lead a { color: var(--accent); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-tile); padding: 18px; display: grid; gap: 12px; margin-bottom: 16px; }
.panel h2 { margin: 0; font-size: 20px; }
.panel p { margin: 0; color: var(--muted); font-size: 14px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }
.input, .textarea { width: 100%; background: var(--bg); color: var(--fg); border: 1px solid var(--line-strong); border-radius: 12px; font: inherit; font-size: 16px; padding: 12px 14px; outline: none; }
.input:focus, .textarea:focus { border-color: var(--accent); }
.textarea { min-height: 180px; resize: vertical; font-family: var(--nums); font-size: 16px; field-sizing: content; max-height: 70vh; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none; }
.btn.ghost { background: var(--raised); color: var(--fg); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.error:focus { outline: none; }
.panel p.ok { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--ok); color: var(--fg); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.error { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--danger); color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.prompt { max-height: 220px; overflow: auto; margin: 0; padding: 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); font-family: var(--nums); font-size: 12px; white-space: pre-wrap; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.themes form { display: grid; }
.theme { display: grid; align-content: start; gap: 10px; width: 100%; height: 100%; padding: 12px; border-radius: var(--r-tile); border: 1px solid var(--line); background: var(--bg); text-align: left; }
.theme[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.theme .dots { display: flex; gap: 4px; }
.theme .dots i { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(128, 128, 128, .3); }
.theme b { display: block; font-size: 14px; }
.theme small { color: var(--muted); font-size: 12px; }
.about { color: var(--muted); font-size: 12px; }

/* Cook mode */
.cook { position: fixed; inset: 0; z-index: 20; background: var(--cook-bg); color: var(--fg); display: grid; grid-template-rows: auto 1fr auto; padding: calc(12px + env(safe-area-inset-top, 0px)) var(--gutter-r) calc(16px + env(safe-area-inset-bottom, 0px)) var(--gutter-l); }
.cook header { display: grid; gap: 14px; max-width: 760px; width: 100%; margin: 0 auto; }
.cook .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cook .x { width: 40px; height: 40px; border-radius: 50%; background: var(--cook-chip); display: grid; place-items: center; color: var(--fg); }
.cook .ctitle { font-size: 16px; color: var(--muted); text-align: center; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cook .ingbtn { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: var(--r-pill); background: var(--cook-chip); font-size: 13px; }
.cook .ingbtn .icon { width: 16px; height: 16px; }
.bars { display: flex; gap: 4px; }
.bars i { flex: 1; height: 3px; border-radius: 3px; background: var(--cook-track); transition: background .25s; }
.bars i.on { background: var(--accent); }
.cook main { display: flex; flex-direction: column; max-width: 760px; width: 100%; margin: 0 auto; overflow-y: auto; padding-block: 16px; touch-action: pan-y; }
.cook main > * { flex: none; }
.cook main > .sn { margin-top: auto; }
.cook main > [data-step]:not([hidden]) { margin-bottom: auto; }
.cook .sn { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.cook .stitle { font-size: 15px; color: var(--muted); margin: 0 0 6px; }
.cook .stext { font-size: clamp(24px, 6.2vw, 38px); line-height: 1.32; letter-spacing: -0.01em; font-weight: 400; margin: 0; text-wrap: pretty; overflow-wrap: anywhere; }
.cook .stext.long { font-size: clamp(19px, 4.6vw, 28px); }
.cook footer { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; max-width: 760px; width: 100%; margin: 0 auto; }
.cook footer button, .cook footer a { display: flex; align-items: center; justify-content: center; gap: 8px; height: 60px; border-radius: calc(var(--r-tile) + 2px); font-weight: 600; font-size: 16px; text-decoration: none; }
.cook .prev { background: var(--cook-chip); color: var(--muted); }
.cook .prev:disabled { opacity: .4; }
.cook .next { background: var(--accent); color: var(--accent-ink); }
.cook .awake { font-size: 12px; color: var(--muted); text-align: center; grid-column: 1 / -1; }
.sheet { position: fixed; inset: auto 0 0 0; z-index: 30; max-height: 70%; overflow-y: auto; background: var(--raised); border-radius: 24px 24px 0 0; padding: 10px var(--gutter-r) calc(20px + env(safe-area-inset-bottom, 0px)) var(--gutter-l); box-shadow: 0 -20px 60px rgba(0, 0, 0, .6); }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 0 auto 12px; }
.sheet .inner { max-width: 760px; margin: 0 auto; }
.sheet .h2 { align-items: center; }
.sheet .h2 .num { margin-right: auto; }
.ings .h2 .reset { margin-left: auto; }
.h2 .reset { font-size: 13px; color: var(--accent); min-height: 32px; padding: 0 4px; }
.veil { position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .5); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* Accounts */
.login .hello { margin-top: 24px; }
code { font-family: var(--nums); font-size: .92em; padding: 1px 5px; border-radius: 6px; background: var(--raised); color: var(--fg); }
.newtoken { display: grid; gap: 8px; padding: 12px; border-radius: 12px; border: 1px solid var(--accent); background: var(--accent-soft); }
.newtoken p { color: var(--fg); }
.newtoken .prompt { user-select: all; color: var(--fg); }
.tokens { list-style: none; margin: 0; padding: 0; display: grid; }
.tokens li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tokens li > div { display: grid; min-width: 0; }
.tokens small { color: var(--muted); font-size: 12px; }
.btn.small { height: 36px; padding: 0 14px; font-size: 13px; }
.btn.small .icon { width: 16px; height: 16px; }
.token-form { display: flex; gap: 8px; flex-wrap: wrap; }
.token-form .input { flex: 1 1 180px; min-width: 0; }

/* Units */
.v-alt { display: none; }
.swap .itext.has-alt .v-main { display: none; }
.swap .itext.has-alt .v-alt { display: inline; }
.unit-toggle { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; margin: 0 0 6px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); color: var(--muted); font-size: 12px; font-weight: 500; }
.unit-toggle .icon { width: 15px; height: 15px; color: var(--accent); }
.seg { display: inline-flex; gap: 4px; padding: 4px; margin: 0; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--bg); justify-self: start; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: var(--r-pill); font-size: 13px; color: var(--muted); }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.rules { display: grid; gap: 10px; }
@media (min-width: 640px) { .rules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rule { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.rule select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(-45deg, transparent 50%, var(--muted) 50%); background-position: right 18px center, right 13px center; background-size: 5px 5px; background-repeat: no-repeat; }
.panel p.hint { font-size: 12px; }

/* Editor */
.editor { display: grid; gap: 0; }
.textarea.short { min-height: 88px; font-family: var(--ui); }
.textarea.tall { min-height: 260px; font-family: var(--ui); line-height: 1.6; }
.row3 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .row3 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.thumb { width: 100%; max-width: 320px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-tile); }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.upload { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px; border-radius: var(--r-pill); border: 1px dashed var(--line-strong); color: var(--fg); justify-self: start; cursor: pointer; }
.upload .icon { color: var(--accent); }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.savebar { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); z-index: 4; display: flex; gap: 10px; padding-block: 12px; background: linear-gradient(transparent, var(--bg) 35%); }
.savebar .btn { flex: 1; max-width: 260px; }
body:has(input:not([type="checkbox"], [type="radio"], [type="file"]):focus, textarea:focus, select:focus) .tabbar { display: none; }
body:has(input:focus, textarea:focus) .savebar { bottom: env(safe-area-inset-bottom, 0px); }
body:has(textarea:focus) .savebar { display: none; }
.danger summary { cursor: pointer; color: var(--danger); font-weight: 600; }
.dangerbtn { background: var(--danger); color: var(--bg); }
