/* ============ Recipe Box ============ */

:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #2a2420;
  --muted: #7a6f66;
  --line: #e8e1d8;
  --accent: #b5532b;
  --accent-ink: #ffffff;
  --accent-soft: #f7e7dd;
  --tip: #fdf6e3;
  --tip-line: #e2b84a;
  --danger: #b42318;
  --ok-bg: #e6f2ea;
  --ok-ink: #22603f;
  --err-bg: #fdecea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(42, 36, 32, .05), 0 6px 20px rgba(42, 36, 32, .06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1816;
    --surface: #25211e;
    --ink: #f1ece6;
    --muted: #a99f95;
    --line: #3a342f;
    --accent: #e3825a;
    --accent-ink: #1b1816;
    --accent-soft: #3b2a21;
    --tip: #2f2a1e;
    --tip-line: #b8923a;
    --danger: #ff8a7a;
    --ok-bg: #1f3329;
    --ok-ink: #9fd8b5;
    --err-bg: #3a2220;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.2; font-weight: 600; margin: 0 0 .5em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: 1.35rem; }
code { background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
em { font-style: normal; color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 620px; margin-left: auto; margin-right: auto; }
[hidden] { display: none !important; }

/* ---------- Header & footer ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.site-nav { display: flex; align-items: center; gap: 6px 18px; flex-wrap: wrap; }
.site-nav a { color: var(--ink); text-decoration: none; font-size: .95rem; }
.site-nav a:hover { color: var(--accent); }
.site-nav a.btn-primary, .site-nav a.btn-primary:hover { color: var(--accent-ink); }
main.wrap { padding-top: 28px; padding-bottom: 56px; }
.site-footer { border-top: 1px solid var(--line); padding: 20px 0; font-size: .88rem; color: var(--muted); }
.site-footer a { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: .95rem; line-height: 1.2; cursor: pointer; text-decoration: none;
  transition: border-color .15s, background .15s, transform .05s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-sm { padding: 6px 13px; font-size: .88rem; }
.btn-danger { color: var(--danger); border-color: currentColor; background: transparent; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
form.inline { display: inline; }

/* ---------- Messages ---------- */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; background: var(--ok-bg); color: var(--ok-ink); }
.flash-error { background: var(--err-bg); color: var(--danger); }

/* ---------- Panels & forms ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.form .field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink);
  font: inherit; font-size: 1rem;
}
input:focus, select:focus, textarea:focus, .rte-area:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; }
.input-lg { font-family: var(--serif); font-size: 1.3rem !important; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field-row.three { grid-template-columns: repeat(3, 1fr); }
.check { display: flex; align-items: center; gap: 10px; margin: 6px 0 16px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.hint { color: var(--muted); font-size: .85rem; margin: 10px 0 0; }
.form-actions { display: flex; gap: 12px; margin: 8px 0 24px; position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.delete-form { border-top: 1px solid var(--line); padding-top: 20px; }

/* ---------- Browse page ---------- */
.browse-top { margin-bottom: 22px; }
.search { display: flex; gap: 10px; margin-bottom: 16px; }
.search input { border-radius: 999px; padding: 12px 20px; background: var(--surface); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-size: .92rem; white-space: nowrap;
}
.chip:hover { border-color: var(--accent); }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip-n { font-size: .78rem; opacity: .6; }
.chip-fav.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.filter-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.tag-filter select { width: auto; padding: 7px 12px; border-radius: 999px; background: var(--surface); font-size: .92rem; }
.spacer { flex: 1; }
.sort { font-size: .9rem; color: var(--muted); }
.sort a { color: var(--muted); text-decoration: none; }
.sort a.is-on { color: var(--ink); font-weight: 600; }
.result-line { color: var(--muted); margin: -6px 0 18px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px; }
.card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; color: inherit; text-decoration: none; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(42, 36, 32, .12); }
.card-img { position: relative; aspect-ratio: 4 / 3; background: var(--accent-soft); }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-placeholder { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-size: 4rem; color: var(--accent); opacity: .55; }
.fav-badge { position: absolute; top: 10px; right: 10px; background: var(--surface); color: var(--accent); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; box-shadow: var(--shadow); }
.card-body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.card-cat { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 600; }
.card-title { font-size: 1.2rem; margin: 0; }
.card-meta { font-size: .85rem; color: var(--muted); }
.empty { text-align: center; padding: 60px 16px; color: var(--muted); }
.empty h2 { color: var(--ink); }

/* ---------- Recipe page ---------- */
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.recipe-head { max-width: 760px; margin-bottom: 24px; }
.fav-star { color: var(--accent); font-size: .7em; vertical-align: middle; }
.summary { font-size: 1.15rem; color: var(--muted); margin: 0 0 18px; }
.meta { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 28px; }
.meta li { font-weight: 600; }
.meta span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.tags, .tag-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tag { font-size: .85rem; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); text-decoration: none; border: 0; font-family: inherit; cursor: pointer; }
.tag-suggest { margin: -8px 0 16px; }
.tag-suggest .tag.is-used { opacity: .35; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.recipe-cover { margin: 0 0 32px; border-radius: var(--radius); overflow: hidden; max-height: 520px; }
.recipe-cover img { width: 100%; height: 100%; max-height: 520px; object-fit: cover; }

.recipe-body { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 40px; align-items: start; }
.ingredients-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; position: sticky; top: 84px; box-shadow: var(--shadow); }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.box-head h2 { margin: 0; }
.scaler { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.scaler button { width: 32px; height: 32px; border: 0; background: transparent; color: var(--ink); font-size: 1.1rem; cursor: pointer; }
.scaler button:hover { background: var(--accent-soft); color: var(--accent); }
.scaler output { min-width: 36px; text-align: center; font-weight: 700; font-size: .95rem; }
.scaler-note { font-size: .82rem; color: var(--accent); margin: 0 0 6px; }
.ingredients { list-style: none; margin: 0; padding: 0; }
.ingredients li.ing { padding: 9px 0 9px 26px; border-bottom: 1px dashed var(--line); position: relative; cursor: pointer; }
.ingredients li.ing::before { content: ""; position: absolute; left: 0; top: 13px; width: 14px; height: 14px; border: 1.5px solid var(--line); border-radius: 4px; }
.ingredients li.ing.done { color: var(--muted); text-decoration: line-through; }
.ingredients li.ing.done::before { background: var(--accent); border-color: var(--accent); }
.ingredients li:last-child { border-bottom: 0; }
.qty { font-weight: 700; }
.qty.scaled { color: var(--accent); }
.ing-heading { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; padding: 16px 0 4px; }
.ing-heading:first-child { padding-top: 4px; }

.method h2 { margin-top: 0; }
.method h2 + .prose { margin-bottom: 36px; }

/* Rich text (recipe page and editor share this) */
.prose { font-size: 1.05rem; }
.prose p { margin: 0 0 1em; }
.prose h3 { font-size: 1.2rem; margin: 1.4em 0 .5em; }
.prose h4 { font-size: 1.05rem; margin: 1.2em 0 .4em; }
.prose ul { padding-left: 1.3em; margin: 0 0 1em; }
.prose ul li { margin-bottom: .35em; }
.prose ol { list-style: none; counter-reset: step; padding-left: 0; margin: 0 0 1em; }
.prose ol > li { counter-increment: step; position: relative; padding-left: 48px; margin-bottom: 18px; min-height: 32px; }
.prose ol > li::before {
  content: counter(step);
  position: absolute; left: 0; top: -2px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font: 700 .95rem/32px var(--sans); text-align: center;
}
.prose blockquote { margin: 1em 0; padding: 12px 16px 12px 44px; background: var(--tip); border-left: 4px solid var(--tip-line); border-radius: 0 10px 10px 0; position: relative; }
.prose blockquote::before { content: "💡"; position: absolute; left: 14px; top: 12px; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose > :last-child { margin-bottom: 0; }
.notes { color: var(--muted); }

.gallery { margin-top: 48px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.gallery-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }

/* ---------- Editor page ---------- */
.edit-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.recipe-form { max-width: 860px; }

.ing-labels, .ing-row { display: grid; grid-template-columns: 90px 90px 1fr auto; gap: 8px; align-items: center; }
.ing-labels { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.ing-labels span:last-child { grid-column: 3 / 5; }
.ing-row { margin-bottom: 8px; }
.ing-row input { padding: 8px 10px; }
.ing-row.is-heading .ing-name { grid-column: 1 / 4; font-family: var(--serif); font-weight: 600; background: var(--accent-soft); }
.row-tools { display: inline-flex; gap: 2px; }
.row-tools button { width: 30px; height: 34px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; font-size: 1rem; }
.row-tools button:hover { background: var(--accent-soft); color: var(--accent); }
.ing-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.paste-box { background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.paste-box p { margin-top: 0; font-size: .9rem; }
.paste-box textarea { margin-bottom: 10px; }

.rte { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 64px; z-index: 5; }
.rte-toolbar button { border: 1px solid transparent; background: transparent; color: var(--ink); padding: 6px 10px; border-radius: 8px; cursor: pointer; font: inherit; font-size: .88rem; min-width: 34px; }
.rte-toolbar button:hover { background: var(--accent-soft); }
.rte-toolbar button.is-active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.rte-toolbar .sep { width: 1px; background: var(--line); margin: 4px 4px; }
.rte-area { min-height: 180px; padding: 16px 18px; outline: none; }
.rte-area.is-empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; position: absolute; }
.rte-area.is-empty { position: relative; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.photo { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); font-size: .85rem; }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo label { display: flex; gap: 6px; align-items: center; padding: 6px 10px; cursor: pointer; }
.photo .remove { color: var(--danger); padding-top: 0; }
.photo.is-removed img { opacity: .3; }
.photo.is-new { border-style: dashed; }
.photo.is-new span { display: block; padding: 6px 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload { display: block; position: relative; border: 2px dashed var(--line); border-radius: 12px; padding: 28px 16px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.upload:hover, .upload.is-drag { border-color: var(--accent); background: var(--accent-soft); }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.upload span { display: block; font-size: 1.05rem; }
.upload small { color: var(--muted); }

/* ---------- Categories, install ---------- */
.add-cat { display: flex; gap: 10px; padding: 16px; }
.cat-list { padding: 8px 16px; }
.cat-row { display: flex; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cat-row:last-child { border-bottom: 0; }
.cat-edit { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 0; }
.cat-edit .order { width: 70px; flex: none; }
.cat-edit .count { font-size: .82rem; white-space: nowrap; }
.checklist { list-style: none; padding: 0; margin: 0 0 20px; }
.checklist li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.checklist li span { display: block; font-size: .88rem; }
.checklist .ok strong { color: var(--ok-ink); }
.checklist .bad strong { color: var(--danger); }

/* ---------- Import tabs & original text ---------- */
.tabs { display: flex; gap: 6px; margin: 0 0 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 600; font-size: .95rem; }
.tabs a.is-on { color: var(--ink); border-bottom-color: var(--accent); }
.paste-btn { margin: -6px 0 16px; }
.howto summary, .original summary { cursor: pointer; font-weight: 600; }
.howto ul { margin: 12px 0 0; padding-left: 1.2em; font-size: .95rem; }
.howto li { margin-bottom: 8px; }
.head-links { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.original { max-width: 860px; }
.original-text { white-space: pre-wrap; margin-top: 12px; max-height: 340px; overflow-y: auto; font-size: .92rem; background: var(--bg); border-radius: 10px; padding: 14px; border: 1px solid var(--line); }
@media (min-width: 1240px) {
  /* Wide screens: original text sits beside the editor */
  .page-edit main.wrap { max-width: 1240px; }
  .page-edit .flash, .page-edit .edit-head { max-width: 860px; }
  .page-edit .original { position: fixed; right: max(16px, calc((100vw - 1240px) / 2)); top: 84px; width: 330px; max-height: calc(100vh - 110px); overflow: hidden; display: flex; flex-direction: column; z-index: 4; }
  .page-edit .original[open] .original-text { max-height: none; flex: 1; }
}

/* ---------- Source line ---------- */
.source { font-size: .9rem; color: var(--muted); margin: -4px 0 14px; }

/* ---------- Shopping list ---------- */
.nav-list { white-space: nowrap; }
.list-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .75rem; font-weight: 700; margin-left: 2px; }
.card-wrap { position: relative; display: flex; }
.card-wrap .card { flex: 1; }
.list-toggle {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  display: inline-flex; gap: 5px; align-items: center;
  padding: 5px 11px; border-radius: 999px; border: 0;
  background: rgba(255, 255, 255, .92); color: #2a2420;
  font: 600 .8rem/1.2 var(--sans); cursor: pointer; box-shadow: var(--shadow);
}
.list-toggle:hover { background: #fff; }
.list-toggle.is-on { background: var(--accent); color: var(--accent-ink); }
.list-bar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 14px;
  background: var(--ink); color: var(--bg);
  padding: 8px 8px 8px 18px; border-radius: 999px; box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
  font-size: .92rem; white-space: nowrap; max-width: calc(100% - 32px);
}
.list-bar span { overflow: hidden; text-overflow: ellipsis; }
.btn.is-on { border-color: var(--accent); color: var(--accent); }

.shop-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.shop-head h1 { margin: 0; }
.shop-recipes ul { list-style: none; margin: 0; padding: 0; }
.shop-recipes li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 4px 0; }
.shop-recipes .linklike { font-size: .82rem; color: var(--muted); margin-left: auto; }
.shop-progress { margin: 0 0 8px; font-size: .88rem; }
.shop-list { list-style: none; margin: 0; padding: 0; }
.shop-list li { display: flex; gap: 12px; align-items: flex-start; padding: 11px 4px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 6px; }
.shop-list li:hover { background: var(--bg); }
.shop-list li:last-child { border-bottom: 0; }
.shop-box { flex: none; width: 20px; height: 20px; margin-top: 2px; border: 2px solid var(--line); border-radius: 6px; display: grid; place-items: center; }
.shop-list li.done .shop-box { background: var(--accent); border-color: var(--accent); }
.shop-list li.done .shop-box::after { content: "✓"; color: var(--accent-ink); font-size: .8rem; font-weight: 700; }
.shop-list li.done .shop-text { text-decoration: line-through; color: var(--muted); }
.shop-text { flex: 1; }
.shop-text small { display: block; color: var(--muted); font-size: .78rem; }
.extra-remove { border: 0; background: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: 0 6px; }
.extras-title { margin: 22px 0 4px; font-size: 1.05rem; }
.add-extra { display: flex; gap: 8px; margin-top: 14px; }
.shop-foot { text-align: center; font-size: .88rem; color: var(--muted); }
.shop-foot .linklike { color: var(--muted); }

/* ---------- Cooking mode ---------- */
body.cook-open { overflow: hidden; }
.cook {
  --cook-scale: 1;
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column;
}
.cook-top { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.cook-title { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cook-count { font-size: .88rem; color: var(--muted); white-space: nowrap; }
.cook-size { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.cook-size button { border: 0; background: none; color: var(--ink); padding: 6px 10px; cursor: pointer; font: 600 .85rem var(--sans); }
.cook-size button:hover { background: var(--accent-soft); }
.cook-close { border: 0; background: none; color: var(--ink); font-size: 1.9rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.cook-bar { height: 4px; background: var(--line); }
.cook-bar span { display: block; height: 100%; background: var(--accent); transition: width .25s; }
.cook-content {
  flex: 1; overflow-y: auto;
  padding: 32px max(20px, calc((100% - 820px) / 2));
  font-size: calc(clamp(1.35rem, 3.6vw, 2rem) * var(--cook-scale)); line-height: 1.5;
}
.cook-content h2 { font-size: 1.2em; }
.cook-label { font-size: .55em; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; margin: 0 0 6px; font-family: var(--sans); }
.cook-num { font: 700 .6em var(--sans); color: var(--muted); margin-bottom: 10px; }
.cook-text p { margin: 0 0 .6em; }
.cook-tip { margin-top: 18px; padding: 12px 16px; background: var(--tip); border-left: 4px solid var(--tip-line); border-radius: 0 10px 10px 0; font-size: .75em; }
.cook-timer-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.cook-timer-btns .btn { font-size: 1rem; padding: 12px 20px; }
.cook-ings { list-style: none; padding: 0; margin: 0; font-size: .8em; }
.cook-ings li { padding: 10px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.cook-ings li.done { text-decoration: line-through; color: var(--muted); }
.cook-ings li.h { font-family: var(--serif); font-weight: 600; border: 0; padding-top: 18px; cursor: default; }
.cook-done { text-align: center; padding-top: 8vh; }
.cook-done .big { font-size: 3em; }
.cook-nav { display: flex; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.cook-nav .btn { flex: 1; padding: 16px; font-size: 1.15rem; }
.cook-nav .btn:disabled { opacity: .35; cursor: default; }
.cook-wake { margin: 0; padding: 0 16px 10px; text-align: center; font-size: .78rem; color: var(--muted); background: var(--surface); }

.cook-timers { position: fixed; right: 16px; top: 76px; z-index: 110; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.timer-chip {
  display: inline-flex; gap: 8px; align-items: center;
  padding: 9px 14px; border-radius: 999px; border: 0;
  background: var(--ink); color: var(--bg); font: .95rem var(--sans); cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
.timer-chip strong { font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.timer-chip span { opacity: .75; font-size: .82rem; }
.timer-chip.ringing { background: var(--accent); color: var(--accent-ink); animation: ring .6s ease-in-out infinite alternate; }
@keyframes ring { from { transform: scale(1); } to { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .timer-chip.ringing { animation: none; } .cook-bar span { transition: none; } }

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  .recipe-body { grid-template-columns: 1fr; gap: 28px; }
  .ingredients-box { position: static; }
  .field-row, .field-row.three { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
  .ing-labels { display: none; }
  .ing-row { grid-template-columns: 70px 64px 1fr; }
  .ing-row .row-tools { grid-column: 1 / -1; justify-content: flex-end; margin-top: -4px; }
  .ing-row.is-heading .ing-name { grid-column: 1 / -1; }
  .ing-row { padding-bottom: 6px; border-bottom: 1px solid var(--line); }
  .cat-edit .count { display: none; }
  .rte-toolbar { top: 0; position: static; }
  .site-header { position: static; }
  .cook-size { display: none; }
  .cook-content { padding-top: 22px; }
  .cook-timers { top: auto; bottom: 116px; right: 10px; }
  body:not(.cook-open) .cook-timers { bottom: 70px; }
  .list-bar { bottom: 10px; gap: 10px; padding-left: 14px; }
}

/* ---------- Printing ---------- */
@media print {
  .no-print, .site-header, .site-footer, .recipe-cover, .gallery, .hint, .scaler-note,
  .list-bar, .cook, .cook-timers, .shop-foot, .shop-progress, .add-extra, .extra-remove { display: none !important; }
  .page-shopping .panel { border: 0; box-shadow: none; padding: 0; }
  .shop-list li { padding: 6px 0; }
  body { background: #fff; color: #000; font-size: 11pt; display: block; }
  main.wrap { padding: 0; max-width: none; }
  h1 { font-size: 22pt; }
  .recipe-body { grid-template-columns: 34% 1fr; gap: 24px; }
  .ingredients-box { position: static; border: 0; box-shadow: none; padding: 0; background: none; }
  .ingredients li.ing { padding-left: 18px; break-inside: avoid; }
  .ingredients li.ing::before { width: 10px; height: 10px; top: 14px; background: none !important; border-color: #888 !important; }
  .ingredients li.ing.done { text-decoration: none; color: #000; }
  .prose ol > li { break-inside: avoid; }
  .prose ol > li::before { background: #eee; color: #000; }
  .prose blockquote { background: #f6f6f6; border-color: #999; }
  .qty.scaled { color: #000; }
  .tag { background: none; color: #555; padding: 0 6px 0 0; }
  a { color: #000; text-decoration: none; }
}
