/* RecipeTracker v2 */
:root {
	--bg: #faf6ef;
	--bg-2: #f3ece0;
	--surface: #ffffff;
	--surface-2: #fbf8f3;
	--text: #2b2620;
	--muted: #6f665b;
	--faint: #a39a8e;
	--line: #e7ddd0;
	--accent: #c2562b;
	--accent-2: #a8451f;
	--accent-soft: #f8e4d9;
	--gold: #e0a019;
	--ok: #2f7d4f;
	--danger: #b3261e;
	--shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 16px rgba(60, 40, 20, .06);
	--shadow-lg: 0 10px 40px rgba(60, 40, 20, .16);
	--radius: 14px;
	--font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--display: "Fraunces", Georgia, "Times New Roman", serif;
	--c1: #d9822b; --c2: #4f8a4b; --c3: #c2562b; --c4: #c2507a; --c5: #b8892a; --c6: #2f8483;
	color-scheme: light;
}
:root[data-theme="dark"] {
	--bg: #171411;
	--bg-2: #1f1b17;
	--surface: #231f1b;
	--surface-2: #2a2520;
	--text: #efe7dc;
	--muted: #b3a898;
	--faint: #7d7366;
	--line: #3a332c;
	--accent: #ec7a4c;
	--accent-2: #f39468;
	--accent-soft: #3d261b;
	--gold: #f0b43a;
	--ok: #5fbf85;
	--danger: #ff6b61;
	--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
	--shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
	--c1: #f0a052; --c2: #7fbd79; --c3: #ec7a4c; --c4: #e57fa6; --c5: #dcb452; --c6: #5fb8b6;
	color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #171411; --bg-2: #1f1b17; --surface: #231f1b; --surface-2: #2a2520;
		--text: #efe7dc; --muted: #b3a898; --faint: #7d7366; --line: #3a332c;
		--accent: #ec7a4c; --accent-2: #f39468; --accent-soft: #3d261b; --gold: #f0b43a;
		--ok: #5fbf85; --danger: #ff6b61;
		--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
		--shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
		--c1: #f0a052; --c2: #7fbd79; --c3: #ec7a4c; --c4: #e57fa6; --c5: #dcb452; --c6: #5fb8b6;
		color-scheme: dark;
	}
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 16px/1.55 var(--font);
	-webkit-font-smoothing: antialiased;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; letter-spacing: -.01em; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 820px; }
main { flex: 1; padding-bottom: 96px; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
	position: sticky; top: 0; z-index: 30;
	background: color-mix(in srgb, var(--bg) 86%, transparent);
	backdrop-filter: saturate(1.4) blur(12px);
	-webkit-backdrop-filter: saturate(1.4) blur(12px);
	border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--display); font-weight: 700; font-size: 1.25rem; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; color: #fff; flex: none; }
.brand-mark svg { width: 20px; height: 20px; }
.topbar .spacer { flex: 1; }

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 42px; padding: 0 16px; border-radius: 999px;
	border: 1px solid var(--line); background: var(--surface); color: var(--text);
	font-weight: 600; font-size: .95rem; cursor: pointer; white-space: nowrap;
	transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
	text-decoration: none !important;
}
.btn:hover { border-color: var(--faint); }
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-2); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.icon { width: 42px; padding: 0; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: .88rem; }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .55; cursor: default; }
.btn .label-sm { display: none; }
@media (max-width: 560px) {
	.btn.collapse .label { display: none; }
	.btn.collapse { width: 42px; padding: 0; }
}

/* ---------- Hero / search ---------- */
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 2.8rem); }
.hero p.lead { color: var(--muted); margin: 6px 0 0; }
.hero-grid { display: grid; gap: 16px; }
.family-photo { position: relative; margin: 0; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-lg); order: -1; aspect-ratio: 16 / 10; max-height: 240px; width: 100%; }
.family-photo img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 42%; }
.family-photo figcaption {
	position: absolute; left: 12px; bottom: 12px;
	padding: 4px 12px; border-radius: 999px;
	background: rgba(20, 14, 8, .55); color: #fff; font-size: .8rem; font-weight: 600;
	backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
@media (min-width: 860px) {
	.hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 32px; align-items: center; }
	.family-photo { order: 0; max-height: none; aspect-ratio: 1096 / 704; transform: rotate(1.2deg); transition: transform .3s; }
	.family-photo:hover { transform: rotate(0deg) scale(1.01); }
}
.searchbar { display: flex; gap: 10px; margin-top: 20px; align-items: stretch; }
.search-field { position: relative; flex: 1; }
.search-field svg { position: absolute; left: 16px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-field input {
	width: 100%; height: 52px; padding: 0 44px 0 48px;
	border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
	box-shadow: var(--shadow); font-size: 1.05rem; outline: none;
}
.search-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-field .clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.search-field kbd { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font: 600 .75rem var(--font); color: var(--faint); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
@media (hover: none) { .search-field kbd { display: none; } }
.searchbar .btn { height: 52px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 16px 0 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
	flex: none; display: inline-flex; align-items: center; gap: 8px;
	height: 38px; padding: 0 14px; border-radius: 999px;
	border: 1px solid var(--line); background: var(--surface); cursor: pointer;
	font-weight: 500; font-size: .92rem; color: var(--text);
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cat, var(--faint)); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip[aria-pressed="true"] .dot { background: var(--bg); }

.filters {
	display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
	padding: 16px; margin-top: 12px; box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field > label { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.select, .input, .textarea {
	width: 100%; min-height: 44px; padding: 10px 12px;
	border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); outline: none;
}
.select:focus, .input:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.seg { display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 12px; flex-wrap: wrap; }
.results-head h2 { font-size: 1.1rem; font-family: var(--font); font-weight: 600; color: var(--muted); }
.results-head h2 strong { color: var(--text); }

/* ---------- Cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.card {
	position: relative; display: flex; flex-direction: column; gap: 8px;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
	padding: 16px 16px 14px; color: var(--text); box-shadow: var(--shadow);
	transition: transform .15s, box-shadow .15s, border-color .15s;
	overflow: hidden; min-height: 150px;
}
.card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--cat, var(--accent)); }
.card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: transparent; }
.card h3 { font-size: 1.12rem; }
.card .snippet { color: var(--muted); font-size: .9rem; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { margin-top: auto; display: flex; align-items: center; gap: 10px; font-size: .82rem; color: var(--faint); padding-top: 4px; }
.card .meta .id { margin-left: auto; font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--cat, var(--accent)); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.star-badge { color: var(--gold); display: inline-flex; }
.star-badge svg { width: 18px; height: 18px; }
.stars { display: inline-flex; gap: 1px; color: var(--gold); }
.stars svg { width: 15px; height: 15px; }
.stars .off { color: var(--line); }
.card mark, .snippet mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 1px; }

.skeleton { background: linear-gradient(90deg, var(--bg-2), var(--surface-2), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.card.loading .skeleton { height: 14px; }
.card.loading .skeleton.t { height: 20px; width: 70%; }

.empty { text-align: center; padding: 60px 16px; color: var(--muted); }
.empty svg { width: 56px; height: 56px; color: var(--faint); }
.empty h3 { color: var(--text); margin: 10px 0 6px; }
.more { display: flex; justify-content: center; margin: 24px 0; }

.recent { margin-top: 18px; }
.recent h2 { font-family: var(--font); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.recent-list { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.recent-list::-webkit-scrollbar { display: none; }
.recent-list a { flex: none; max-width: 240px; padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--cat, var(--accent)); }
.recent-list a:hover { text-decoration: none; border-color: var(--faint); border-left-color: var(--cat, var(--accent)); }

.fab {
	position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 25;
	height: 58px; padding: 0 22px; border-radius: 999px; box-shadow: var(--shadow-lg); font-size: 1rem;
}
@media (min-width: 900px) { .fab { display: none; } }

/* ---------- Recipe page ---------- */
.recipe-hero { padding: 26px 0 8px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); margin-bottom: 14px; flex-wrap: wrap; }
.recipe-hero h1 { font-size: clamp(1.8rem, 5vw, 3rem); }
.recipe-sub { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; color: var(--muted); }
.rate-widget { display: inline-flex; align-items: center; gap: 2px; }
.rate-widget button { border: 0; background: none; padding: 2px; cursor: pointer; color: var(--line); line-height: 0; }
.rate-widget button.on { color: var(--gold); }
.rate-widget button svg { width: 24px; height: 24px; }
.rate-widget:hover button { color: var(--gold); }
.rate-widget button:hover ~ button { color: var(--line); }
.rate-widget .clear-rating { font-size: .8rem; color: var(--faint); line-height: 1.5; margin-left: 6px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 8px; }
.meta-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.meta-chips span { background: var(--bg-2); border-radius: 999px; padding: 4px 12px; font-size: .88rem; color: var(--muted); }

.source-link { display: flex; gap: 10px; align-items: center; padding: 12px 14px; margin-top: 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--text); overflow: hidden; }
.source-link:hover { text-decoration: none; border-color: var(--faint); }
.source-link svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.source-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .9rem; }
.source-link b { white-space: nowrap; }
.hero-img { width: 100%; max-height: 420px; object-fit: cover; border-radius: var(--radius); margin-top: 16px; box-shadow: var(--shadow); }

.scale { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.scale > span { font-size: .85rem; font-weight: 600; color: var(--muted); }

.recipe-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: 20px; }
@media (min-width: 900px) {
	.recipe-body.two { grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); align-items: start; }
	.recipe-body.two .ingredients-panel { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
}
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.panel h2 { font-size: 1.35rem; }
.intro { font-family: var(--display); font-size: 1.12rem; font-style: italic; color: var(--muted); margin: 18px 0 0; white-space: pre-wrap; }

.ing-list { list-style: none; margin: 0; padding: 0; }
.ing-list li { display: flex; gap: 12px; align-items: flex-start; padding: 8px 4px; border-bottom: 1px dashed var(--line); cursor: pointer; border-radius: 6px; user-select: none; }
.ing-list li:last-child { border-bottom: 0; }
.ing-list li:hover { background: var(--surface-2); }
.ing-list li .box { flex: none; width: 20px; height: 20px; margin-top: 2px; border: 2px solid var(--faint); border-radius: 6px; display: grid; place-items: center; transition: all .15s; }
.ing-list li .box svg { width: 14px; height: 14px; color: #fff; opacity: 0; }
/* Checked = "need to buy": highlighted, never crossed out */
.ing-list li.buy { background: var(--accent-soft); }
.ing-list li.buy:hover { background: var(--accent-soft); }
.ing-list li.buy .box { background: var(--accent); border-color: var(--accent); }
.ing-list li.buy .box svg { opacity: 1; }
.shop-hint { margin: -4px 0 6px; }
.shop-bar {
	display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
	margin: 10px -8px -6px; padding: 10px 8px; border-top: 1px solid var(--line);
	background: var(--surface);
}
.shop-bar .shop-count { font-weight: 600; font-size: .92rem; }
.shop-bar .spacer { flex: 1; }

/* Michael's comments */
.mg-box {
	margin: 18px 0 0; padding: 14px 18px; border-radius: var(--radius);
	background: var(--accent-soft); border-left: 4px solid var(--accent);
}
.mg-label { display: flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.mg-label svg { width: 16px; height: 16px; }
.mg-box p { margin: 6px 0 0; font-size: 1.05rem; line-height: 1.55; }

/* Michael's photo */
.recipe-photo { margin: 18px 0 0; }
.recipe-photo img { display: block; width: 100%; max-height: 460px; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); background: var(--bg-2); min-height: 120px; }
.recipe-photo.failed .source-link { margin-top: 0; }

/* Links inside recipe text */
.ext-link, .recipe-ref { font-weight: 600; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
.ext-link span { font-size: .8em; margin-left: 2px; text-decoration: none; display: inline-block; }
.print-source { display: none; }
.ing-list .qty { font-weight: 700; }
.ing-list .qty.scaled { color: var(--accent); }
.subhead { font-family: var(--font); font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin: 16px 0 4px; }
.subhead:first-child { margin-top: 0; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li.step { position: relative; padding: 12px 12px 12px 52px; border-radius: 12px; cursor: pointer; transition: background .15s, opacity .15s; }
.steps li.step:hover { background: var(--surface-2); }
.steps.numbered li.step::before {
	counter-increment: step; content: counter(step);
	position: absolute; left: 8px; top: 11px; width: 30px; height: 30px; border-radius: 50%;
	background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .9rem; display: grid; place-items: center;
}
.steps:not(.numbered) li.step { padding-left: 12px; }
.steps li.step.done { opacity: .45; }
.steps.numbered li.step.done::before { content: "✓"; background: var(--ok); color: #fff; }
.steps li.subhead { list-style: none; padding: 0 12px; }
.steps li.step.current { background: var(--accent-soft); }
.timer-link { border: 0; background: var(--accent-soft); color: var(--accent); font-weight: 600; padding: 0 6px; border-radius: 6px; cursor: pointer; font-size: inherit; display: inline-flex; align-items: center; gap: 4px; }
.timer-link svg { width: 14px; height: 14px; }
.timer-link:hover { background: var(--accent); color: #fff; }

.raw { white-space: pre-wrap; font-size: .98rem; margin: 0; font-family: var(--font); }
.view-toggle { font-size: .85rem; }

/* Timers */
.timers { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 40; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 32px)); }
.timer { display: flex; align-items: center; gap: 12px; background: var(--text); color: var(--bg); border-radius: 16px; padding: 10px 10px 10px 16px; box-shadow: var(--shadow-lg); animation: pop .2s ease-out; }
.timer .t-time { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer .t-label { font-size: .8rem; opacity: .75; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer button { border: 0; background: rgba(255, 255, 255, .14); color: inherit; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
:root[data-theme="dark"] .timer button { background: rgba(0, 0, 0, .12); }
.timer button svg { width: 18px; height: 18px; }
.timer.done { background: var(--accent); color: #fff; animation: pulse 1s infinite; }
@keyframes pop { from { transform: translateY(12px); opacity: 0; } }
@keyframes pulse { 50% { transform: scale(1.03); } }

/* Cook mode */
body.cook .topbar, body.cook .crumbs, body.cook .toolbar .hide-cook, body.cook footer.site { display: none; }
body.cook .recipe-body { font-size: 1.2rem; }
body.cook .steps li.step { padding-top: 16px; padding-bottom: 16px; }
.cook-banner { display: none; }
body.cook .cook-banner { display: flex; position: sticky; top: 0; z-index: 30; background: var(--accent); color: #fff; padding: 10px 16px; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; }
body.cook .cook-banner .btn { background: rgba(255, 255, 255, .18); border: 0; color: #fff; min-height: 36px; }

/* ---------- Edit page ---------- */
.form-grid { display: grid; gap: 16px; }
@media (min-width: 720px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }
.radio-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-chips label { cursor: pointer; }
.radio-chips input { position: absolute; opacity: 0; pointer-events: none; }
.radio-chips input:checked + .chip { background: var(--text); color: var(--bg); border-color: var(--text); }
.radio-chips input:checked + .chip .dot { background: var(--bg); }
.radio-chips input:focus-visible + .chip { outline: 2px solid var(--accent); outline-offset: 2px; }
.star-input { display: inline-flex; align-items: center; gap: 2px; }
.star-input button { border: 0; background: none; padding: 4px; cursor: pointer; color: var(--line); line-height: 0; }
.star-input button.on { color: var(--gold); }
.star-input button svg { width: 30px; height: 30px; }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; min-height: 44px; }
.toggle input { position: absolute; opacity: 0; }
.toggle .track { width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.toggle .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.toggle input:checked + .track { background: var(--gold); }
.toggle input:checked + .track::after { transform: translateX(18px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.textarea { min-height: 360px; resize: vertical; line-height: 1.6; font-size: .98rem; }
.hint { font-size: .85rem; color: var(--muted); margin: 0; }
.textarea.comments { min-height: 76px; resize: vertical; background: var(--accent-soft); }
.photo-preview { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.photo-preview img { width: 120px; height: 80px; object-fit: cover; border-radius: 10px; background: var(--bg-2); }
.draft-bar {
	display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap;
	margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius);
	background: color-mix(in srgb, var(--gold) 18%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent);
}
.draft-bar strong { display: block; }
.draft-bar span { font-size: .88rem; color: var(--muted); }
.draft-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.import-box { display: flex; gap: 8px; flex-wrap: wrap; }
.import-box .input { flex: 1 1 240px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.form-actions { position: sticky; bottom: 0; z-index: 20; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 0 max(12px, env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.form-actions .spacer { flex: 1; }
.error-box { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); padding: 10px 14px; border-radius: 10px; font-weight: 500; }

/* ---------- Dialogs, menus, toasts ---------- */
dialog { border: 0; border-radius: 18px; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(420px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(20, 14, 8, .45); backdrop-filter: blur(2px); }
dialog form, dialog .dlg { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
dialog h2 { font-size: 1.3rem; }
dialog p { margin: 0; color: var(--muted); }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.share-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.share-grid .btn { border-radius: 12px; justify-content: flex-start; white-space: normal; text-align: left; min-width: 0; padding: 8px 12px; line-height: 1.2; }
@media (max-width: 380px) { .share-grid { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 8px; font-size: .92rem; color: var(--muted); }

.toast-host { position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); }
.toast { background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow-lg); font-weight: 500; animation: pop .2s ease-out; pointer-events: auto; max-width: 100%; text-align: center; }
.toast.error { background: var(--danger); color: #fff; }

footer.site { border-top: 1px solid var(--line); padding: 22px 0 28px; color: var(--muted); font-size: .88rem; }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: space-between; }

.spin { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
	.hero { padding-top: 18px; }
	.panel { padding: 16px; }
	.steps li.step { padding-right: 6px; }
	.recipe-hero { padding-top: 18px; }
}

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

/* ---------- Print ---------- */
/* Compact, single-spaced layout meant to fit most recipes on one page. */
@media print {
	@page { margin: 0.5in; }
	/* :not(#x) raises specificity above the dark-theme rules so print is always black on white */
	:root:not(#p):not(#q) { --bg: #fff; --surface: #fff; --surface-2: #fff; --bg-2: #fff; --text: #000; --muted: #333; --faint: #666; --line: #bbb; --accent: #000; --accent-soft: #fff; color-scheme: light; }
	body { font-size: 10pt; line-height: 1.32; background: #fff; display: block; min-height: 0; }
	main { padding: 0; }
	.wrap { max-width: none; padding: 0; }
	.topbar, .toolbar, .crumbs, footer.site, .fab, .timers, .scale, .view-toggle, .cook-banner, .toast-host, .no-print,
	.recipe-sub, .source-link, .hero-img, .recipe-photo, .ing-list li .box { display: none !important; }
	body.print-photo .recipe-photo { display: block !important; margin: 6pt 0 0; }
	body.print-photo .recipe-photo img { max-height: 2.6in; width: auto; max-width: 100%; box-shadow: none; border-radius: 4pt; }

	.recipe-hero { padding: 0; }
	.recipe-hero h1 { font-size: 17pt; }
	.meta-chips { margin-top: 4pt; gap: 4pt 10pt; }
	.meta-chips span { background: none; padding: 0; font-size: 9.5pt; color: #333; }
	.mg-box { margin-top: 6pt; padding: 4pt 8pt; border: 1px solid #999; border-left: 3pt solid #000; border-radius: 0; background: #fff; break-inside: avoid; }
	.mg-label { font-size: 8pt; margin: 0; color: #000; }
	.mg-label svg { display: none; }
	.mg-box p { font-size: 10pt; margin: 2pt 0 0; }
	.intro { font-family: var(--font); font-style: normal; font-size: 10pt; color: #000; margin-top: 6pt; }

	.recipe-body, .recipe-body.two { display: block !important; margin-top: 8pt; }
	.panel { box-shadow: none; border: 0; padding: 0; margin: 0 0 8pt; background: #fff; }
	.recipe-body.two .ingredients-panel { position: static; max-height: none; overflow: visible; }
	.panel-head { margin: 0 0 3pt; }
	.panel h2 { font-size: 12pt; }
	.subhead { margin: 4pt 0 1pt; font-size: 8.5pt; color: #000; }

	.ing-list { columns: 2; column-gap: 18pt; }
	.ing-list li { padding: 0 0 1pt; border: 0; background: none !important; break-inside: avoid; color: #000; }
	.ing-list .qty.scaled { color: #000; }

	.steps li.step, .steps:not(.numbered) li.step { padding: 0 0 3pt 18pt; opacity: 1 !important; background: none !important; break-inside: avoid; }
	.steps:not(.numbered) li.step { padding-left: 0; }
	.steps.numbered li.step::before, .steps.numbered li.step.done::before { content: counter(step) "."; left: 0; top: 0; width: auto; height: auto; background: none; color: #000; font-size: 10pt; }
	.timer-link { background: none; color: inherit; font: inherit; padding: 0; }
	.timer-link svg { display: none; }
	.ext-link, .recipe-ref { font-weight: normal; text-decoration: none; }
	.ext-link span { display: none; }
	.raw { font-size: 10pt; }

	.print-source { display: block; margin: 6pt 0 0; font-size: 8pt; color: #333; word-break: break-all; }
	a { color: #000; }
}
