:root {
  --paper: #FCFBF8;
  --ink: #1E2A32;
  --blue: #33658A;
  --butter: #F2C14E;
  --line: #E4E0D6;
  --muted: #6b7680;
  --faint: #9aa4ac;
  --card: #ffffff;
  --oven: #C4452D;
  --stovetop: #33658A;
  --grill: #2F6B4F;
  --smoker: #6B4A2F;
  --slowcooker: #8A5A83;
  --airfryer: #B07D2B;
  --nocook: #5B7065;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }
.pad-top { padding-top: 28px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-tight { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 26px; } .mt-4 { margin-top: 36px; }

/* header */
.site-header { border-bottom: 2px solid var(--ink); background: var(--paper); }
.header-inner { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding-top: 18px; padding-bottom: 18px; }
.brand { text-decoration: none; display: block; }
.brand-script { display: block; font-family: 'Caveat', cursive; font-size: 22px; color: var(--blue); line-height: 1; }
.brand-title { display: block; font-family: 'Zilla Slab', serif; font-weight: 700; font-size: 34px; line-height: 1.05; color: var(--ink); }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.greeting { font-family: 'Caveat', cursive; font-size: 21px; }

.site-footer { border-top: 1.5px solid var(--line); margin-top: 60px; padding: 22px 0 40px; color: var(--faint); font-family: 'Caveat', cursive; font-size: 19px; }

/* buttons */
button { font: inherit; }
.btn {
  font-family: 'Zilla Slab', serif; font-weight: 600; border-radius: 6px; cursor: pointer;
  padding: 9px 18px; font-size: 16px; border: 1.5px solid var(--blue);
  background: var(--blue); color: #fff; text-decoration: none; display: inline-block;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 5px 12px; font-size: 14px; }
.btn.outline { background: transparent; color: var(--blue); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger { background: var(--oven); border-color: var(--oven); color: #fff; }
.btn.surprise {
  font-family: 'Caveat', cursive; font-size: 21px; font-weight: 600; white-space: nowrap;
  border: 2px dashed var(--blue); background: transparent; color: var(--blue);
}
.linkish { background: none; border: none; padding: 0; color: var(--blue); font-weight: 600; text-decoration: underline; cursor: pointer; }

/* chips */
.chip {
  font-size: 13.5px; font-weight: 600; padding: 5px 13px; border-radius: 999px;
  cursor: pointer; border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
}
.chip.on { background: var(--ink); color: #fff; }
.chip.static { cursor: default; }
.chip.small { font-size: 12px; padding: 3px 9px; }
.chip.tag { border: none; background: #EFEDE5; color: #4a565f; cursor: default; font-weight: 500; }
.chip.fav { border-color: var(--butter); color: #8a6d1c; }
.chip.fav.on { background: var(--butter); color: var(--ink); }
.filter-label { font-family: 'Caveat', cursive; font-size: 20px; color: var(--muted); min-width: 84px; }

/* ratings */
.rating-display { display: inline-flex; align-items: center; gap: 1px; white-space: nowrap; }
.star-glyph { color: #D8D3C6; line-height: 1; }
.star-glyph.on { color: var(--butter); }
.rating-count { color: var(--muted); font-size: .82em; margin-left: 5px; }

.rating-input { display: inline-flex; gap: 2px; }
.rating-input .star-glyph {
  background: none; border: none; padding: 0 2px; cursor: pointer;
  font-size: 26px; line-height: 1; color: #D8D3C6;
}
.rating-input .star-glyph:hover { transform: scale(1.08); }
.rating-input .star-glyph.on { color: var(--butter); }

.rate-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rate-label { font-family: 'Caveat', cursive; font-size: 20px; color: var(--muted); }

/* personal bookmark */
.bookmark {
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px;
  cursor: pointer; padding: 4px 10px; font-size: 14px; line-height: 1.2;
  filter: grayscale(1); opacity: .65;
}
.bookmark:hover { opacity: 1; }
.bookmark.on { border-color: var(--blue); background: #EAF1F6; filter: none; opacity: 1; }
.bookmark.big { padding: 6px 14px; font-size: 15px; font-weight: 600; font-family: 'Zilla Slab', serif; }

/* inputs */
input[type=text], input[type=password], input[type=url], textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 6px; padding: 9px 12px;
  font-size: 15px; background: #fff; color: var(--ink); font-family: inherit;
}
input:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px;
}
textarea { min-height: 110px; line-height: 1.6; resize: vertical; }
.search { font-size: 17px; padding: 12px 16px; border-color: var(--ink); border-width: 2px; flex: 1; min-width: 200px; }
.field { display: block; margin-bottom: 16px; }
.field > span.label { font-family: 'Zilla Slab', serif; font-weight: 600; font-size: 15px; }
.field > span.hint { font-size: 12px; color: var(--muted); margin-left: 8px; }
.field .control { margin-top: 4px; }
.grid-fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.error { color: var(--oven); font-weight: 600; margin: 8px 0 12px; }

/* recipe grid */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card {
  background: var(--card); border: 1.5px solid var(--line); border-top: 6px solid var(--blue);
  border-radius: 8px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column;
  box-shadow: 0 1px 3px rgba(30,42,50,.07); position: relative; text-align: left; padding: 0;
  color: inherit; text-decoration: none;
}
.card:hover { box-shadow: 0 3px 10px rgba(30,42,50,.12); }
.card .card-star { position: absolute; top: 8px; right: 8px; z-index: 2; }
.card img { width: 100%; height: 150px; object-fit: cover; display: block; }
.card .noimg { height: 60px; background: #F4F2EC; display: flex; align-items: center; justify-content: center; font-family: 'Caveat', cursive; font-size: 22px; color: var(--faint); }
.card .body { padding: 12px 14px 14px; }
.card h3 { font-family: 'Zilla Slab', serif; font-weight: 700; font-size: 19px; line-height: 1.2; margin: 0; }
.card .from { font-family: 'Caveat', cursive; font-size: 19px; color: var(--blue); margin-top: 2px; }
.card .meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* recipe page */
.recipe { max-width: 760px; }
.recipe h2 { font-family: 'Zilla Slab', serif; font-weight: 700; font-size: 34px; line-height: 1.1; margin: 0; }
.recipe .from { font-family: 'Caveat', cursive; font-size: 24px; color: var(--blue); margin-top: 4px; }
.recipe h3 { font-family: 'Zilla Slab', serif; font-weight: 700; font-size: 22px; border-bottom: 2px solid var(--butter); display: inline-block; padding-bottom: 2px; margin: 0; }
.facts { display: flex; flex-wrap: wrap; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.fact { padding: 10px 22px; }
.fact + .fact { border-left: 1.5px solid var(--line); }
.fact .k { font-family: 'Caveat', cursive; font-size: 19px; color: var(--muted); line-height: 1; }
.fact .v { font-family: 'Zilla Slab', serif; font-weight: 700; font-size: 18px; }
.photos { display: flex; gap: 12px; flex-wrap: wrap; }
.photos img { width: 230px; height: 172px; object-fit: cover; border-radius: 8px; border: 1.5px solid var(--line); }
.ing-list { list-style: none; padding: 0; margin: 10px 0 0; }
.ing-list li { border-bottom: 1px dashed var(--line); }
.ing-btn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: none; cursor: pointer; padding: 7px 0; font-size: 15.5px; color: var(--ink); }
.ing-btn .box { width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; border: 1.5px solid var(--blue); background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); }
.ing-btn.done { color: var(--faint); text-decoration: line-through; }
.ing-btn.done .box { border-color: var(--faint); background: #EFEDE5; }
.steps { margin: 10px 0 0; padding-left: 24px; }
.steps li { padding: 6px 0; font-size: 15.5px; line-height: 1.55; }
.notecard { background: #FBF4DE; border: 1.5px solid var(--butter); border-radius: 8px; padding: 14px 18px; }
.notecard .who { font-family: 'Caveat', cursive; font-size: 22px; color: #8a6d1c; }
.notecard p { margin: 4px 0 0; font-size: 15.5px; line-height: 1.55; white-space: pre-wrap; }
.comment { background: #fff; border: 1.5px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.comment .who { font-family: 'Caveat', cursive; font-size: 20px; color: var(--blue); }
.comment p { margin: 2px 0 0; font-size: 15px; line-height: 1.5; white-space: pre-wrap; }

/* members admin */
.member { background: #fff; border: 1.5px solid var(--line); border-radius: 8px; padding: 12px 16px; }
.member .name { font-family: 'Zilla Slab', serif; font-weight: 700; font-size: 17px; }
.badge { font-size: 12px; font-weight: 700; color: #8a6d1c; background: #FBF4DE; border: 1px solid var(--butter); border-radius: 999px; padding: 2px 9px; }
.panel { background: #fff; border: 1.5px solid var(--line); border-radius: 8px; padding: 16px 18px; }
.panel h3 { font-family: 'Zilla Slab', serif; font-weight: 700; font-size: 18px; margin: 0 0 10px; border: none; }

/* photo editor */
.thumbs { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.thumb-wrap { position: relative; }
.thumb-wrap img { width: 110px; height: 84px; object-fit: cover; border-radius: 6px; border: 1.5px solid var(--line); display: block; }
.thumb-x { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; border: none; cursor: pointer; font-size: 12px; line-height: 1; }

.empty { text-align: center; padding: 70px 20px; }
.empty .big { font-family: 'Caveat', cursive; font-size: 30px; color: var(--blue); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 22px; border-radius: 8px;
  font-family: 'Zilla Slab', serif; font-weight: 600; font-size: 15px; z-index: 50;
}

.form-narrow { max-width: 420px; }
.form-medium { max-width: 680px; }

@media (max-width: 560px) {
  .brand-title { font-size: 27px; }
  .recipe h2 { font-size: 27px; }
  .fact { padding: 8px 16px; }
}

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

@media print {
  .no-print { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .wrap { max-width: none; padding: 0; }
  .card, .panel, .facts, .comment { box-shadow: none; }
  a[href]:after { content: ""; }
}

/* ---- where it came from ---- */
.origin {
  font-family: 'Caveat', cursive; font-size: 19px; color: #8a6d1c;
  background: #FBF4DE; border-left: 3px solid var(--butter);
  padding: 2px 10px; border-radius: 0 4px 4px 0; display: inline-block; margin-top: 4px;
}
.card-flag { color: #8a6d1c; font-weight: 600; }
.card-scan {
  width: 300px; max-width: 100%; height: auto; object-fit: contain;
  border: 1.5px solid var(--line); border-radius: 6px; background: #fff; padding: 6px;
}
.plan-link { font-family: 'Zilla Slab', serif; font-weight: 700; font-size: 17px; color: var(--ink); }

/* ---- cook mode ---- */
.cook-overlay {
  position: fixed; inset: 0; z-index: 100; background: var(--paper);
  display: flex; flex-direction: column; padding: 18px 20px 20px; overflow-y: auto;
}
.cook-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid var(--ink); padding-bottom: 12px; }
.cook-title { font-family: 'Zilla Slab', serif; font-weight: 700; font-size: 22px; line-height: 1.1; }
.cook-progress { font-family: 'Caveat', cursive; font-size: 20px; color: var(--blue); }
.cook-body { flex: 1; display: flex; gap: 28px; padding: 22px 0; align-items: flex-start; }
.cook-step { flex: 1; min-width: 0; }
.cook-step-text { font-size: clamp(21px, 3.4vw, 32px); line-height: 1.45; margin: 0; }
.cook-sub { font-family: 'Zilla Slab', serif; font-weight: 700; font-size: 16px; border-bottom: 2px solid var(--butter); display: inline-block; margin-bottom: 8px; }
.cook-ingredients { width: 280px; flex-shrink: 0; border-left: 1.5px solid var(--line); padding-left: 20px; }
.cook-ing {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 7px 0; font-size: 16px; cursor: pointer; color: var(--ink);
  border-bottom: 1px dashed var(--line);
}
.cook-ing.done { color: var(--faint); text-decoration: line-through; }
.cook-timers { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.cook-timer {
  font-family: 'Zilla Slab', serif; font-weight: 600; font-size: 18px;
  padding: 10px 20px; border-radius: 8px; cursor: pointer;
  border: 2px solid var(--blue); background: transparent; color: var(--blue);
  min-width: 120px;
}
.cook-timer.running { background: var(--blue); color: #fff; }
.cook-timer.done { background: var(--butter); border-color: var(--butter); color: var(--ink); }
.cook-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1.5px solid var(--line); padding-top: 14px; }
.cook-nav .btn { padding: 14px 26px; font-size: 18px; }
.cook-dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.cook-dot { width: 11px; height: 11px; border-radius: 50%; border: none; background: #D8D3C6; cursor: pointer; padding: 0; }
.cook-dot.on { background: var(--blue); transform: scale(1.25); }

@media (max-width: 760px) {
  .cook-body { flex-direction: column; gap: 20px; }
  .cook-ingredients { width: 100%; border-left: none; border-top: 1.5px solid var(--line); padding-left: 0; padding-top: 14px; }
}

/* ---- printable cookbook ---- */
.book-title-page { text-align: center; padding: 60px 0 40px; border-bottom: 2px solid var(--ink); }
.book-script { font-family: 'Caveat', cursive; font-size: 26px; color: var(--blue); }
.book-name { font-family: 'Zilla Slab', serif; font-weight: 700; font-size: 42px; margin: 6px 0; line-height: 1.1; }
.book-meta { color: var(--muted); font-size: 15px; }
.book-contents { padding: 24px 0; }
.book-contents h2, .book-recipe-title { font-family: 'Zilla Slab', serif; font-weight: 700; }
.book-toc { columns: 2; column-gap: 34px; padding-left: 20px; }
.book-toc li { break-inside: avoid; padding: 3px 0; }
.toc-from { color: var(--muted); font-size: 13px; }
.book-recipe { padding: 26px 0; border-top: 1.5px solid var(--line); }
.book-recipe-title { font-size: 27px; margin: 0 0 2px; }
.book-facts { font-family: 'Zilla Slab', serif; font-weight: 600; color: var(--muted); margin-top: 6px; }
.book-tags { font-size: 13px; color: var(--muted); margin-top: 2px; }
.book-recipe h3 { font-family: 'Zilla Slab', serif; font-size: 17px; margin: 16px 0 4px; border-bottom: 2px solid var(--butter); display: inline-block; }
.book-ing { padding-left: 20px; margin: 4px 0; }
.book-ing li { padding: 2px 0; }
.book-steps { padding-left: 22px; margin: 4px 0; }
.book-steps li { padding: 3px 0; line-height: 1.5; }
.book-note { background: #FBF4DE; border: 1.5px solid var(--butter); border-radius: 6px; padding: 10px 14px; margin-top: 14px; }
.book-note p { margin: 2px 0 0; white-space: pre-wrap; }
.book-scan { max-width: 340px; width: 100%; border: 1.5px solid var(--line); border-radius: 6px; margin-top: 14px; }
.book-link { font-size: 12px; color: var(--muted); margin-top: 10px; word-break: break-all; }

@media print {
  .book-title-page { page-break-after: always; border-bottom: none; }
  .book-contents { page-break-after: always; }
  .book-recipe { page-break-before: always; border-top: none; padding-top: 0; }
  .book-recipe, .book-note, .book-ing li, .book-steps li { break-inside: avoid; }
  .cook-overlay { display: none !important; }
}
