:root {
  --paper: #f6f6f2; --surface: #ffffff; --ink: #1b2430; --muted: #5d6773; --line: #d9d9d1;
  --blue: #1f4e8c; --blue-ink: #ffffff; --blue-soft: #e6edf6; --heart: #c8372d; --warn: #a3281f;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14181d; --surface: #1c222a; --ink: #eef0f2; --muted: #a4adb8; --line: #323a44;
    --blue: #8db4e8; --blue-ink: #10151b; --blue-soft: #1f2c3d; --heart: #ff7b6f; --warn: #ff8a80;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.5 var(--sans); }
h1, h2 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 2rem; } h2 { font-size: 1.3rem; }
a { color: var(--blue); }
.wrap { max-width: 44rem; margin: 0 auto; padding: 16px 16px 96px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

input, textarea, button, select { font: inherit; color: inherit; }
input, textarea { width: 100%; padding: 12px; min-height: 48px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
label { display: block; margin: 0 0 14px; font-weight: 600; font-size: .95rem; }
label input, label textarea { margin-top: 4px; font-weight: 400; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 12px; }
.flash { background: var(--blue-soft); padding: 12px 14px; border-radius: 10px; }

.btn, button.btn, form button[type=submit], #more-ing {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 18px;
  background: var(--blue); color: var(--blue-ink); border: 0; border-radius: 10px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn.ghost, #more-ing { background: transparent; color: var(--blue); border: 1px solid var(--line); }
.btn.warn { background: var(--warn); color: #fff; }
.fav { background: none !important; border: 0; min-width: 48px; min-height: 48px; font-size: 1.7rem; color: var(--muted) !important; padding: 0; cursor: pointer; }
.fav.on { color: var(--heart) !important; }
.fav-form { margin: 0; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top h1 { margin: 0; }
#search-form { margin: 12px 0 8px; }
input[type=search] { font-size: 1.1rem; min-height: 52px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); text-decoration: none; font-size: .95rem; }
.chip.on { background: var(--blue); color: var(--blue-ink); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }

.cards { list-style: none; margin: 12px 0 0; padding: 0; }
.card { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--line); }
.card:last-child { border-bottom: 1px solid var(--line); }
.card-link { flex: 1; display: flex; align-items: center; gap: 14px; padding: 12px 0; color: inherit; text-decoration: none; min-width: 0; }
.card img, .noimg { width: 64px; height: 64px; flex: none; border-radius: 8px; object-fit: cover; background: var(--blue-soft); }
.card-body { display: flex; flex-direction: column; min-width: 0; }
.card-body strong { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }
.meta { color: var(--muted); font-size: .9rem; }
.empty { padding: 24px 0; color: var(--muted); }

.bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.bar .back { flex: 1; text-decoration: none; min-height: 48px; display: inline-flex; align-items: center; }
.recipe h1 { margin-bottom: .1em; }
.source { color: var(--muted); font-size: .95rem; margin: 4px 0 12px; }
.hero { display: flex; gap: 8px; overflow-x: auto; margin: 12px 0; }
.hero img { max-height: 260px; max-width: 100%; border-radius: 12px; object-fit: cover; }
.cook { margin: 8px 0 20px; }
.ing-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.stepper { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.stepper button { width: 48px; height: 48px; font-size: 1.5rem; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.stepper output { min-width: 2ch; text-align: center; font-weight: 700; font-size: 1.3rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.ingredients { list-style: none; margin: 8px 0; padding: 0; }
.ingredients li { display: flex; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ingredients .q { flex: 0 0 7.5rem; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.hint { color: var(--muted); font-size: .9rem; }
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.steps li { counter-increment: step; padding: 8px 0; }
.steps label { display: flex; align-items: flex-start; gap: 12px; font-weight: 400; font-size: 1em; margin: 0; cursor: pointer; }
.steps label::before { content: counter(step) "."; flex: 0 0 2ch; text-align: right; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.steps input { width: 28px; min-height: 28px; height: 28px; margin: 0; flex: none; }
.steps input:checked + span { color: var(--muted); text-decoration: line-through; }
.notes { white-space: pre-wrap; }
.danger { margin-top: 40px; color: var(--muted); }
.danger summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }

.recipe-form fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 0 0 16px; }
.ing { display: grid; grid-template-columns: 5rem 5.5rem 1fr; gap: 6px; margin-bottom: 6px; }
.ing input:nth-child(4) { grid-column: 1 / -1; }

.foot { position: fixed; inset: auto 0 0 0; display: flex; justify-content: center; gap: 28px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line); }
.foot a { text-decoration: none; min-height: 36px; display: inline-flex; align-items: center; }

/* Kookstand: grote tekst, alleen het recept. */
body.cook-mode { font-size: 22px; }
body.cook-mode .foot, body.cook-mode .bar, body.cook-mode .photos-manage, body.cook-mode .danger, body.cook-mode .hero, body.cook-mode .tags, body.cook-mode .source { display: none; }
body.cook-mode .cook { position: sticky; top: 8px; z-index: 2; box-shadow: 0 0 0 10px var(--paper); }
body.cook-mode .steps li { padding: 14px 0; }
body.cook-mode .steps label { font-size: 1.2em; line-height: 1.45; }
body.cook-mode .steps input { width: 36px; height: 36px; }

@media (min-width: 900px) { .wrap { max-width: 52rem; } body { font-size: 18px; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

.photos-manage { margin: 4px 0 12px; color: var(--muted); }
.photos-manage summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.photo-del { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.photo-del img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.photo-del span { flex: 1; }
.actions { display: flex; gap: 8px; }
.warnings { margin: 0 0 12px; padding-left: 1.6rem; }
.retry { margin: 0 0 16px; }
button[disabled] { opacity: .6; cursor: progress; }
