:root {
  color-scheme: light;
  --paper: #f8f3eb;
  --card: #fffdf9;
  --ink: #27332e;
  --muted: #6f766f;
  --line: #e3dbcf;
  --green: #3f6556;
  --green-soft: #e3ebe4;
  --terracotta: #bd5e43;
  --terracotta-soft: #f3e1d9;
  --gold: #d99235;
  --shadow: 0 14px 40px rgb(62 46 37 / 10%);
  font-family: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

html { background: var(--paper); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% -10%, rgb(220 167 103 / 17%), transparent 28rem),
    var(--paper);
}

button, input { font: inherit; }
button { color: inherit; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 24px 10px;
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand img { border-radius: 13px; box-shadow: 0 5px 14px rgb(72 57 42 / 12%); }
.brand h1, .brand p { margin: 0; }
.brand h1 { font-family: Georgia, "Times New Roman", serif; font-size: 1.3rem; line-height: 1; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--terracotta);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.ghost-button, .favorites-filter, .filters button, .empty-state button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(255 253 249 / 78%);
  cursor: pointer;
}

.ghost-button { padding: 9px 14px; font-weight: 700; }

main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 30px 24px calc(60px + env(safe-area-inset-bottom));
}

.intro { max-width: 660px; }
.intro h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 8vw, 4.8rem);
  font-weight: 500;
  letter-spacing: -.045em;
  line-height: .95;
}
.intro > p:last-child { margin: 16px 0 0; color: var(--muted); font-size: 1rem; }

.search-panel {
  position: sticky;
  z-index: 10;
  top: 0;
  margin: 34px -8px 0;
  padding: 10px 8px 12px;
  background: rgb(248 243 235 / 90%);
  backdrop-filter: blur(14px);
}

.search-box {
  display: grid;
  grid-template-columns: 24px 1fr 34px;
  align-items: center;
  max-width: 760px;
  min-height: 58px;
  padding: 0 10px 0 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 8px 30px rgb(70 54 43 / 8%);
}
.search-box:focus-within { border-color: #98ab9e; box-shadow: 0 0 0 4px rgb(63 101 86 / 10%); }
.search-box svg { width: 22px; fill: none; stroke: var(--green); stroke-width: 1.8; stroke-linecap: round; }
.search-box input { width: 100%; padding: 0 13px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 1rem; }
.search-box input::placeholder { color: #999890; }
.search-box button { border: 0; border-radius: 50%; background: var(--paper); color: var(--muted); cursor: pointer; font-size: 1.35rem; }

.filters { display: flex; gap: 8px; overflow-x: auto; padding-top: 11px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button { flex: 0 0 auto; padding: 8px 13px; color: var(--muted); font-size: .83rem; font-weight: 700; }
.filters button[aria-pressed="true"] { border-color: var(--green); background: var(--green); color: white; }

.results-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 22px 0 14px; }
.results-head p { margin: 0; color: var(--muted); font-size: .88rem; }
.favorites-filter { padding: 8px 12px; color: var(--terracotta); font-size: .82rem; font-weight: 750; }
.favorites-filter[aria-pressed="true"] { border-color: var(--terracotta); background: var(--terracotta-soft); }

.recipe-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.recipe-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease; }
.recipe-card:hover { transform: translateY(-3px); box-shadow: 0 18px 48px rgb(62 46 37 / 15%); }
.card-open { display: block; width: 100%; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
.image-wrap { position: relative; aspect-ratio: 3 / 2; overflow: hidden; background: #eadfce; }
.image-wrap img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.recipe-card:hover img { transform: scale(1.025); }
.meal-badge { position: absolute; left: 13px; bottom: 13px; padding: 6px 10px; border-radius: 999px; background: rgb(255 253 249 / 91%); backdrop-filter: blur(8px); color: var(--green); font-size: .7rem; font-weight: 800; }
.review-badge { position: absolute; top: 13px; left: 13px; padding: 6px 9px; border-radius: 999px; background: rgb(255 253 249 / 91%); backdrop-filter: blur(8px); color: var(--terracotta); font-size: .68rem; font-weight: 800; }
.review-badge[data-status="verified"] { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; background: rgb(227 235 228 / 94%); color: var(--green); font-size: .85rem; }
.review-badge[data-status="clarify"] { background: rgb(255 245 223 / 95%); color: #806124; }
.card-copy { padding: 17px 18px 20px; }
.card-copy h2 { min-height: 2.5em; margin: 0 42px 12px 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.25rem; font-weight: 600; line-height: 1.22; }
.nutrition-row { display: flex; flex-wrap: wrap; gap: 6px; }
.nutrition-row span { padding: 5px 8px; border-radius: 8px; background: var(--green-soft); color: var(--green); font-size: .7rem; font-weight: 750; }
.ingredient-preview { display: -webkit-box; overflow: hidden; margin: 13px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.favorite-button { position: absolute; z-index: 2; right: 13px; top: calc(66.66% + 14px); display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: var(--card); color: var(--terracotta); cursor: pointer; font-size: 1.25rem; }
.favorite-button.is-favorite { border-color: var(--terracotta); background: var(--terracotta); color: white; }

.empty-state { padding: 60px 20px; text-align: center; }
.empty-state span { font-size: 3rem; }
.empty-state h2 { margin: 10px 0 5px; font-family: Georgia, serif; }
.empty-state p { margin: 0 auto 18px; max-width: 400px; color: var(--muted); }
.empty-state button { padding: 10px 16px; background: var(--green); color: white; font-weight: 700; }

.recipe-dialog { width: min(760px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; overflow: auto; border: 0; border-radius: 28px; background: var(--card); color: var(--ink); box-shadow: 0 30px 90px rgb(33 26 21 / 35%); }
.recipe-dialog::backdrop { background: rgb(34 37 34 / 55%); backdrop-filter: blur(4px); }
.detail-hero { position: relative; }
.detail-hero img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.dialog-close { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgb(255 253 249 / 92%); cursor: pointer; font-size: 1.5rem; }
.detail-body { padding: 24px 26px 30px; }
.detail-body h2 { margin: 0 0 9px; font-family: Georgia, serif; font-size: clamp(1.8rem, 6vw, 2.7rem); font-weight: 500; line-height: 1.05; }
.detail-meta { margin: 0 0 20px; color: var(--muted); font-size: .86rem; }
.macro-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 26px; }
.macro { padding: 11px 8px; border-radius: 13px; background: var(--green-soft); text-align: center; }
.macro strong, .macro span { display: block; }
.macro strong { color: var(--green); font-size: .95rem; }
.macro span { margin-top: 3px; color: var(--muted); font-size: .68rem; }
.detail-columns { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.35fr); gap: 30px; }
.detail-columns h3 { margin: 0 0 12px; font-family: Georgia, serif; font-size: 1.25rem; }
.ingredient-list, .steps-list { margin: 0; padding: 0; list-style: none; }
.ingredient-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.ingredient-list b { flex: 0 0 auto; font-weight: 700; }
.steps-list { counter-reset: steps; }
.steps-list li { position: relative; margin-bottom: 14px; padding-left: 34px; color: #424c47; font-size: .9rem; line-height: 1.55; counter-increment: steps; }
.steps-list li::before { content: counter(steps); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; background: var(--terracotta-soft); color: var(--terracotta); font-size: .72rem; font-weight: 850; }
.review-note { margin: 24px 0 0; padding: 13px 15px; border-left: 3px solid var(--gold); border-radius: 8px; background: #fff5df; color: #695638; font-size: .82rem; line-height: 1.45; }
.no-instructions { color: var(--muted); font-style: italic; }

.verification-box { margin-top: 28px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: #fbf7f0; }
.verification-box.is-collapsed { display: flex; justify-content: flex-end; margin-top: 18px; padding: 0; border: 0; background: transparent; }
.verification-summary { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid #bfd0c3; border-radius: 50%; background: var(--green-soft); color: var(--green); cursor: pointer; font-size: 1rem; font-weight: 900; transition: transform .18s ease, background .18s ease; }
.verification-summary:hover { transform: scale(1.05); background: #d6e4d8; }
.verification-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.verification-head .eyebrow { margin-bottom: 4px; }
.verification-head h3 { margin: 0; font-family: Georgia, serif; font-size: 1.25rem; }
.verification-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--terracotta); box-shadow: 0 0 0 5px var(--terracotta-soft); }
.verification-box[data-status="verified"] .verification-dot { background: var(--green); box-shadow: 0 0 0 5px var(--green-soft); }
.verification-box[data-status="clarify"] .verification-dot { background: var(--gold); box-shadow: 0 0 0 5px #fff0cc; }
.verification-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 16px; }
.verification-actions button, .clarification-form button { min-height: 43px; padding: 9px 13px; border-radius: 12px; cursor: pointer; font-weight: 750; }
.verify-button { border: 1px solid var(--green); background: var(--green); color: white; }
.clarify-button { border: 1px solid #d9ad54; background: #fff5df; color: #72541d; }
.verification-note { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: #fff5df; color: #695638; font-size: .84rem; line-height: 1.45; }
.verification-meta { margin: 9px 0 0; color: var(--muted); font-size: .72rem; }
.verification-error { margin: 12px 0 0; color: #9c3f32; font-size: .8rem; font-weight: 700; }
.verification-actions button:disabled, .clarification-form button:disabled { cursor: wait; opacity: .6; }
.clarification-form { margin-top: 16px; }
.clarification-form label { display: block; margin-bottom: 7px; font-size: .82rem; font-weight: 750; }
.clarification-form textarea { display: block; width: 100%; resize: vertical; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; outline: 0; background: white; color: var(--ink); font: inherit; font-size: .88rem; }
.clarification-form textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgb(63 101 86 / 10%); }
.clarification-form div { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.clarification-form button[type="submit"] { border: 1px solid var(--terracotta); background: var(--terracotta); color: white; }
.clarification-form button[type="button"] { border: 1px solid var(--line); background: white; }
.verification-hint { margin: 12px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.4; }
.locked-state { margin-top: 24px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: var(--shadow); }

@media (max-width: 820px) {
  .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .topbar { padding-inline: 16px; }
  main { padding: 22px 16px calc(44px + env(safe-area-inset-bottom)); }
  .intro h2 { font-size: 2.75rem; }
  .search-panel { margin-top: 26px; }
  .recipe-grid { grid-template-columns: 1fr; gap: 16px; }
  .card-copy h2 { min-height: 0; }
  .favorite-button { top: calc(66.66% + 14px); }
  .recipe-dialog { width: 100%; max-height: 94dvh; margin: auto 0 0; border-radius: 25px 25px 0 0; }
  .detail-body { padding: 21px 19px calc(30px + env(safe-area-inset-bottom)); }
  .detail-columns { grid-template-columns: 1fr; gap: 25px; }
  .macro-grid { gap: 5px; }
  .macro { padding-inline: 3px; }
  .verification-actions { grid-template-columns: 1fr; }
}

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