html:not(.brand-ready) body { visibility: hidden; }
:root {
  --accent: #ff5a36;
  --accent-dark: #c83a1b;
  --accent-soft: #ffe4d9;
  --background: #fff8ef;
  --surface: #ffffff;
  --surface-soft: rgba(255, 255, 255, 0.7);
  --text: #211b18;
  --muted: #6e625d;
  --border: rgba(33, 27, 24, 0.14);
  --success: #23855a;
  --danger: #b63333;
  --shadow: 0 20px 50px rgba(51, 35, 28, 0.10);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--background);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 85% 5%, var(--accent-soft), transparent 32rem), var(--background); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { cursor: pointer; }

.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; padding: .8rem 1rem; background: var(--text); color: white; border-radius: 10px; }
.skip-link:focus { top: 1rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem max(1rem, calc((100vw - 1180px) / 2)); background: color-mix(in srgb, var(--background) 88%, transparent); backdrop-filter: blur(18px); border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; font-weight: 800; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--accent); color: white; font-size: .72rem; letter-spacing: -.02em; box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 35%, transparent); }
.brand-name { font-size: 1.15rem; }
.top-actions { display: flex; gap: .5rem; }

main { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; }
.hero { padding: clamp(4rem, 10vw, 8rem) 0 4rem; }
.hero-copy { max-width: 850px; }
.eyebrow { margin: 0 0 1rem; color: var(--accent-dark); font-size: .82rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(3.2rem, 9vw, 7.4rem); line-height: .9; letter-spacing: -.075em; font-weight: 850; }
h1 em { color: var(--accent); font-style: normal; }
.intro { max-width: 650px; margin: 1.8rem 0 2.5rem; font-size: clamp(1.05rem, 2vw, 1.35rem); line-height: 1.55; color: var(--muted); }

.search-form { max-width: 1000px; }
.search-shell { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .7rem; padding: .55rem; border: 1px solid var(--border); border-radius: 26px; background: var(--surface); box-shadow: var(--shadow); }
.search-icon { width: 25px; margin-left: .8rem; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-shell input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; padding: 1rem .3rem; font-size: clamp(1rem, 2vw, 1.25rem); color: var(--text); }
.search-shell input::placeholder { color: color-mix(in srgb, var(--muted) 72%, transparent); }
.primary-button, .ghost-button, .text-button, .icon-button { border: 0; border-radius: 14px; transition: transform .15s ease, background .15s ease, opacity .15s ease; }
.primary-button { padding: 1rem 1.35rem; background: var(--accent); color: white; font-weight: 800; box-shadow: 0 10px 25px color-mix(in srgb, var(--accent) 25%, transparent); }
.primary-button:hover { background: var(--accent-dark); transform: translateY(-1px); }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.ghost-button { padding: .7rem .9rem; background: color-mix(in srgb, var(--surface) 80%, transparent); border: 1px solid var(--border); color: var(--text); font-weight: 700; }
.ghost-button:hover { background: var(--surface); }
.text-button { padding: .25rem; background: transparent; color: var(--accent-dark); font-weight: 750; }
.icon-button { width: 38px; height: 38px; background: transparent; font-size: 1.6rem; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: .85rem 1.2rem; padding: 1rem .5rem 0; color: var(--muted); }
.filters label { display: flex; align-items: center; gap: .5rem; font-size: .92rem; }
.filters select { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: .45rem .7rem; color: var(--text); }
.check-option input { width: 18px; height: 18px; accent-color: var(--accent); }
.examples { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; margin-top: 1.3rem; color: var(--muted); font-size: .9rem; }
.examples button { border: 1px solid var(--border); border-radius: 999px; padding: .55rem .8rem; background: var(--surface-soft); color: var(--text); }
.examples button:hover { border-color: var(--accent); }

.history-panel { max-width: 760px; margin: -2rem 0 3rem auto; padding: 1rem; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.panel-heading, .group-heading, .results-heading, .dialog-heading, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.history-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.history-list button { border: 1px solid var(--border); background: var(--background); border-radius: 999px; padding: .5rem .8rem; }

.results-section { padding: 2rem 0 5rem; scroll-margin-top: 5rem; }
.results-heading h2 { margin: 0; font-size: clamp(2rem, 4vw, 3.5rem); letter-spacing: -.055em; }
.status { min-height: 1.7rem; margin: 1rem 0; color: var(--muted); }
.status.error { color: var(--danger); }
.result-group { margin-top: 2rem; }
.group-heading { justify-content: flex-start; }
.group-heading h3 { margin: 0; font-size: 1.45rem; }
.count-badge { min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-weight: 800; }
.group-note { color: var(--muted); margin: .6rem 0 1rem; }
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr)); gap: 1rem; }
.recipe-card { display: grid; grid-template-columns: 92px 1fr; min-height: 235px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 12px 32px rgba(45, 28, 21, .06); }
.recipe-visual { display: grid; place-items: center; background: linear-gradient(145deg, var(--accent-soft), color-mix(in srgb, var(--accent) 12%, white)); }
.recipe-initials { color: var(--accent-dark); font-weight: 900; font-size: 1.5rem; letter-spacing: -.05em; }
.recipe-content { min-width: 0; padding: 1.1rem; display: flex; flex-direction: column; gap: .7rem; }
.recipe-topline, .recipe-meta, .card-actions { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.source-badge { max-width: 75%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent-dark); font-size: .78rem; font-weight: 800; }
.favorite-button { border: 0; background: transparent; color: var(--accent-dark); font-size: 1.45rem; line-height: 1; }
.recipe-title { margin: 0; font-size: 1.3rem; line-height: 1.12; letter-spacing: -.025em; }
.recipe-meta { justify-content: flex-start; color: var(--muted); font-size: .8rem; }
.recipe-meta span + span::before { content: "·"; margin-right: .6rem; }
.chip-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { padding: .33rem .55rem; border-radius: 999px; background: color-mix(in srgb, var(--accent-soft) 70%, white); color: var(--accent-dark); font-size: .75rem; font-weight: 700; }
.chip.missing { background: #fff0cd; color: #7a5413; }
.chip.extra { background: #f1efed; color: #665b55; }
.micro-label { display: block; margin-bottom: .35rem; color: var(--muted); font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.card-actions { margin-top: auto; align-items: flex-end; }
.recipe-link { color: var(--accent-dark); font-weight: 850; text-decoration: none; }
.recipe-link:hover { text-decoration: underline; }
.report-button { font-size: .78rem; color: var(--muted); }

.empty-state { padding: 4rem 1rem; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface-soft); }
.empty-mark { width: 60px; height: 60px; display: grid; place-items: center; margin: 0 auto 1rem; border-radius: 20px; background: var(--accent-soft); color: var(--accent-dark); font-size: 2rem; font-weight: 900; }
.empty-state h3 { margin: 0; font-size: 1.5rem; }
.empty-state p { color: var(--muted); }
.feedback-box { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; margin-top: 2rem; padding: 1rem; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.feedback-box button { border: 1px solid var(--border); background: var(--background); border-radius: 10px; padding: .5rem .8rem; }

footer { display: grid; gap: .8rem; justify-items: center; padding: 2.5rem 1rem calc(2.5rem + env(safe-area-inset-bottom)); text-align: center; color: var(--muted); border-top: 1px solid var(--border); }
footer p { max-width: 720px; margin: 0; }
footer nav { display: flex; gap: 1rem; }

::backdrop { background: rgba(20, 15, 13, .58); backdrop-filter: blur(5px); }
dialog { width: min(520px, calc(100% - 2rem)); padding: 0; border: 0; border-radius: 22px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.dialog-card { display: grid; gap: 1rem; padding: 1.3rem; }
.dialog-card h2 { margin: 0; }
.dialog-card label { display: grid; gap: .4rem; color: var(--muted); }
.dialog-card select, .dialog-card textarea { width: 100%; border: 1px solid var(--border); border-radius: 12px; padding: .8rem; background: var(--background); color: var(--text); }
.dialog-actions { justify-content: flex-end; }

@media (max-width: 700px) {
  .topbar { padding-inline: .8rem; }
  .brand-name { display: none; }
  .top-actions .ghost-button { font-size: .78rem; padding: .6rem; }
  main { width: min(100% - 1rem, 1180px); }
  .hero { padding-top: 3.5rem; }
  .search-shell { grid-template-columns: auto 1fr; border-radius: 20px; }
  .search-shell .primary-button { grid-column: 1 / -1; width: 100%; }
  .filters { align-items: flex-start; flex-direction: column; }
  .results-heading { align-items: flex-end; }
  .recipe-card { grid-template-columns: 64px 1fr; }
  .recipe-content { padding: .9rem; }
  .card-actions { align-items: flex-start; flex-direction: column; }
}

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