:root {
  color-scheme: light;
  --ink: #191919;
  --muted: #6b6b68;
  --line: #e5e5e1;
  --soft: #f6f6f3;
  --surface: #ffffff;
  --accent: #111111;
  --warning: #6f5621;
  --shadow: 0 16px 48px rgba(22, 22, 18, 0.09), 0 2px 8px rgba(22, 22, 18, 0.04);
  font-family: "Inter Variable", Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html,
textarea,
.detail-content,
.how-content {
  scrollbar-width: thin;
  scrollbar-color: #bbbcb6 transparent;
}
html::-webkit-scrollbar,
textarea::-webkit-scrollbar,
.detail-content::-webkit-scrollbar,
.how-content::-webkit-scrollbar { width: 11px; height: 11px; }
html::-webkit-scrollbar-track,
textarea::-webkit-scrollbar-track,
.detail-content::-webkit-scrollbar-track,
.how-content::-webkit-scrollbar-track { background: transparent; }
html::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb,
.detail-content::-webkit-scrollbar-thumb,
.how-content::-webkit-scrollbar-thumb {
  background: #bbbcb6;
  background-clip: padding-box;
  border: 3px solid transparent;
  border-radius: 999px;
}
html::-webkit-scrollbar-thumb:hover,
textarea::-webkit-scrollbar-thumb:hover,
.detail-content::-webkit-scrollbar-thumb:hover,
.how-content::-webkit-scrollbar-thumb:hover { background-color: #92938d; }
html::-webkit-scrollbar-corner,
textarea::-webkit-scrollbar-corner,
.detail-content::-webkit-scrollbar-corner,
.how-content::-webkit-scrollbar-corner { background: transparent; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface);
  letter-spacing: -0.012em;
}
html.modal-open, body.modal-open { overflow: hidden; }
body.modal-open { position: fixed; top: var(--locked-scroll-offset, 0); right: 0; left: 0; width: 100%; padding-right: var(--scrollbar-compensation, 0); }

button, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.top-actions {
  position: absolute;
  z-index: 5;
  top: 24px;
  right: 28px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.top-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  text-decoration: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.top-link:hover { color: var(--ink); background: var(--soft); }
.top-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

main { width: min(1040px, calc(100% - 40px)); margin: 0 auto; }
.hero { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 96px 0; transition: min-height .24s ease, padding .24s ease; }
.title-lockup { --title-intro-offset: 54px; display: flex; align-items: center; justify-content: center; gap: 15px; margin: 0 0 12px; }
h1 { margin: 0; font-size: clamp(40px, 6vw, 58px); line-height: 1.04; font-weight: 650; letter-spacing: -0.052em; transform: translateX(var(--title-intro-offset)); animation: title-make-room .34s cubic-bezier(.22,.72,.24,1) .48s forwards; transition: font-size .24s ease; }
.title-word { display: inline-block; white-space: nowrap; }
.food-icons { display: inline-flex; align-items: center; gap: 2px; transform-origin: left center; transition: transform .24s ease; }
.food-icon { width: 30px; height: 30px; opacity: 0; transform-origin: center 75%; animation: food-arrive .64s cubic-bezier(.2,.82,.25,1.12) forwards; }
.food-icon-bowl { color: #d4663d; animation-delay: .86s; }
.food-icon-carrot { color: #d88a2d; animation-delay: .95s; }
.food-icon-apple { color: #64915f; animation-delay: 1.04s; }
@keyframes title-make-room {
  from { transform: translateX(var(--title-intro-offset)); }
  to { transform: translateX(0); }
}
@keyframes food-arrive {
  0% { opacity: 0; transform: translateY(13px) rotate(-11deg) scale(.65); }
  58% { opacity: 1; transform: translateY(-5px) rotate(6deg) scale(1.08); }
  76% { transform: translateY(2px) rotate(-3deg) scale(.98); }
  100% { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}
.hero > p { max-width: 580px; margin: 0 auto; color: var(--muted); font-size: 17px; line-height: 1.55; }

.composer {
  width: min(720px, 100%);
  margin: 38px auto 0;
  padding: 10px 12px 12px;
  text-align: left;
  background: var(--surface);
  border: 1px solid #deded9;
  border-radius: 25px;
  box-shadow: var(--shadow);
  transition: border-color .18s, box-shadow .18s, margin .24s ease;
}
.composer:focus-within { border-color: #bdbdb7; box-shadow: 0 16px 44px rgba(22,22,18,.1), 0 0 0 3px rgba(22,22,18,.035); }
.mode-switch { display: inline-flex; gap: 3px; padding: 3px; background: var(--soft); border-radius: 10px; }
.mode-button { border: 0; color: var(--muted); background: transparent; padding: 7px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; }
.mode-button.active { color: var(--ink); background: white; box-shadow: 0 1px 3px rgba(0,0,0,.09); }
textarea { width: 100%; min-height: 74px; resize: none; padding: 17px 6px 7px; color: var(--ink); border: 0; outline: 0; background: transparent; line-height: 1.45; font-size: 16px; transition: min-height .24s ease; }
textarea::placeholder { color: #aaa9a3; }
.composer-footer { display: flex; justify-content: flex-end; }
.send-button { display: grid; place-items: center; width: 38px; height: 38px; color: white; background: var(--accent); border: 0; border-radius: 12px; cursor: pointer; }
.send-button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.send-button:disabled { opacity: .35; cursor: wait; }

.has-results .hero { min-height: 0; display: block; padding: 34px 0 28px; }
.has-results h1 { font-size: clamp(32px, 4vw, 40px); }
.has-results .food-icons { transform: scale(.84); }
.has-results .hero > p { display: none; }
.has-results .composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "mode mode" "input send"; gap: 5px 10px; margin-top: 20px; padding: 8px 10px 9px; box-shadow: 0 8px 28px rgba(22,22,18,.07); }
.has-results .mode-switch { grid-area: mode; justify-self: start; }
.has-results textarea { grid-area: input; min-height: 38px; height: 38px; padding: 9px 6px 5px; align-self: end; overflow-y: auto; }
.has-results .composer-footer { grid-area: send; align-self: end; }
.has-results .send-button { width: 36px; height: 36px; }

.results-section { padding: 26px 0 72px; }
.results-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
h2 { margin: 0; font-size: 29px; line-height: 1.15; letter-spacing: -.04em; }
h2[tabindex="-1"]:focus { outline: none; }
.results-query { max-width: 680px; margin: 7px 0 0; color: var(--muted); font-size: 14px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-meta { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.notice { margin: 0 0 14px; padding: 11px 13px; color: var(--warning); background: #fff8e8; border: 1px solid #f0dfb3; border-radius: 12px; font-size: 13px; }
.results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.empty-state { grid-column: 1 / -1; padding: 44px 24px; text-align: center; color: var(--muted); background: var(--soft); border-radius: 18px; }
.empty-state h3 { margin: 0 0 7px; color: var(--ink); font-size: 17px; }
.empty-state p { margin: 0; font-size: 13px; }

.recipe-card {
  width: 100%;
  min-width: 0;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  padding: 20px;
  color: inherit;
  text-align: left;
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.animate-results .recipe-card {
  --card-delay: 0ms;
  --card-rise: 15px;
  --card-turn: -.8deg;
  opacity: 0;
  transform-origin: center 82%;
  animation: card-arrive .5s cubic-bezier(.22,.72,.24,1) var(--card-delay) both;
}
.animate-results .recipe-card:nth-child(2) { --card-delay: 60ms; --card-rise: 19px; --card-turn: .7deg; }
.animate-results .recipe-card:nth-child(3) { --card-delay: 120ms; --card-rise: 14px; --card-turn: -.5deg; }
.animate-results .recipe-card:nth-child(4) { --card-delay: 180ms; --card-rise: 18px; --card-turn: .8deg; }
.animate-results .recipe-card:nth-child(5) { --card-delay: 240ms; --card-rise: 15px; --card-turn: -.6deg; }
.animate-results .recipe-card:nth-child(6) { --card-delay: 300ms; --card-rise: 19px; --card-turn: .5deg; }
.animate-results .recipe-card:nth-child(7) { --card-delay: 360ms; --card-rise: 14px; --card-turn: -.7deg; }
.animate-results .recipe-card:nth-child(8) { --card-delay: 420ms; --card-rise: 18px; --card-turn: .6deg; }
.animate-results .recipe-card:nth-child(9) { --card-delay: 480ms; --card-rise: 16px; --card-turn: -.4deg; }
.animate-results .recipe-card:nth-child(10) { --card-delay: 540ms; --card-rise: 19px; --card-turn: .7deg; }
@keyframes card-arrive {
  0% { opacity: 0; transform: translateY(var(--card-rise)) rotate(var(--card-turn)) scale(.975, .96); }
  62% { opacity: 1; transform: translateY(-1.5px) rotate(.12deg) scale(1.004, .997); }
  82% { transform: translateY(.5px) rotate(-.05deg) scale(.999, 1.001); }
  100% { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}
.recipe-card:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.card-top { display: flex; gap: 13px; align-items: flex-start; }
.rank { flex: 0 0 auto; display: grid; place-items: center; width: 31px; height: 31px; color: #6f6e68; background: var(--soft); border-radius: 9px; font-size: 12px; font-weight: 700; }
.card-copy { min-width: 0; flex: 1; }
.match-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .015em; }
.recipe-title { display: block; margin: 0; font-size: 17px; font-weight: 650; line-height: 1.3; letter-spacing: -.025em; }
.recipe-overview { margin: 16px 0; color: var(--muted); font-size: 13px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: auto; padding-top: 13px; border-top: 1px solid #eeeeea; }
.recipe-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: var(--muted); font-size: 12px; line-height: 1.3; }
.recipe-fact { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.recipe-fact svg { width: 14px; height: 14px; color: #777771; stroke-width: 1.9; }
.recipe-fact > span:not(.sr-only) { color: #55554f; font-weight: 630; }
.view-label { display: inline-flex; align-items: center; gap: 5px; color: var(--ink); font-size: 12px; font-weight: 650; }
.view-label svg { width: 13px; height: 13px; }
@media (hover: hover) and (pointer: fine) {
  .recipe-card:hover {
    background: #fdfdfb;
    border-color: #d5d5cf;
    box-shadow: 0 12px 30px rgba(22,22,18,.09), 0 2px 7px rgba(22,22,18,.04);
  }
}

.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 26px; }
.page-button { min-width: 36px; height: 36px; padding: 0 11px; color: var(--muted); background: white; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 12px; font-weight: 600; }
.page-button.active { color: white; background: var(--ink); border-color: var(--ink); }
.page-button:disabled { opacity: .38; cursor: default; }
.page-button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

dialog { width: min(820px, calc(100% - 32px)); max-height: min(90vh, 860px); padding: 0; color: var(--ink); background: white; border: 0; border-radius: 26px; box-shadow: 0 28px 90px rgba(16,16,14,.22); overflow: hidden; overscroll-behavior: contain; }
dialog:focus { outline: none; }
dialog::backdrop { background: rgba(22,22,20,.42); backdrop-filter: blur(3px); }
.dialog-shell { position: relative; }
.dialog-close { position: absolute; z-index: 3; top: 17px; right: 17px; display: grid; place-items: center; width: 38px; height: 38px; color: var(--ink); background: rgba(255,255,255,.9); border: 1px solid rgba(229,229,225,.9); border-radius: 12px; cursor: pointer; }
.dialog-close:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.detail-grid { min-height: 0; }
.detail-content { max-height: min(90vh, 860px); overflow-y: auto; overscroll-behavior: contain; padding: 42px 44px 48px; }
.detail-kicker { margin: 0 0 10px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.detail-content h2 { max-width: 610px; padding-right: 16px; font-size: clamp(29px, 4vw, 42px); }
.detail-summary { margin: 18px 0 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin: 24px 0 30px; }
.detail-metric { display: inline-flex; align-items: center; gap: 6px; min-width: 0; color: #55544e; }
.metric-icon { display: grid; place-items: center; flex: 0 0 auto; color: #74746e; }
.metric-icon svg { width: 15px; height: 15px; stroke-width: 1.9; }
.metric-copy { display: inline-flex; align-items: baseline; gap: 4px; line-height: 1.2; white-space: nowrap; }
.metric-copy strong { color: #4e4e49; font-size: 12px; font-weight: 680; }
.metric-copy > span { color: var(--muted); font-size: 12px; font-weight: 520; }
.detail-section { padding-top: 26px; margin-top: 26px; border-top: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 16px; font-size: 16px; letter-spacing: -.02em; }
.method-provenance { margin: -7px 0 16px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.ingredient-list, .method-list { margin: 0; padding-left: 20px; color: #494943; font-size: 14px; line-height: 1.65; }
.ingredient-list { columns: 2; column-gap: 34px; }
.ingredient-list li { break-inside: avoid; padding: 2px 8px 2px 0; }
.method-list li { padding: 0 0 11px 5px; }
.recipe-amount { font-style: italic; font-weight: 560; }
.recipe-time, .recipe-temperature { color: var(--ink); font-weight: 720; }
.original-link { display: inline-flex; align-items: center; gap: 7px; margin-top: 28px; color: var(--ink); font-size: 13px; font-weight: 650; text-decoration: none; }
.original-link svg { width: 14px; height: 14px; }
.source-block { padding-top: 24px; margin-top: 28px; border-top: 1px solid var(--line); }
.source-link { display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 9px 12px; color: var(--muted); background: var(--soft); border: 1px solid transparent; border-radius: 12px; font-size: 12px; font-weight: 560; text-decoration: none; transition: color .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease; }
.source-link strong { color: var(--ink); font-size: 13px; font-weight: 720; }
.source-favicon { flex: 0 0 auto; width: 20px; height: 20px; object-fit: contain; border-radius: 5px; }
.source-favicon-fallback { display: grid; place-items: center; color: #65655f; background: white; border: 1px solid #deded8; }
.source-favicon-fallback svg { width: 13px; height: 13px; }
.source-external { width: 14px; height: 14px; margin-left: 2px; color: #75756f; }
.source-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .source-link:hover { color: var(--ink); background: #f1f1ed; border-color: #ddddD7; box-shadow: 0 5px 15px rgba(22,22,18,.06); }
}

.how-dialog { width: min(760px, calc(100% - 32px)); }
.how-content { max-height: min(90vh, 860px); overflow-y: auto; overscroll-behavior: contain; padding: 42px 48px 50px; }
.how-content > h2 { max-width: 600px; padding-right: 34px; font-size: clamp(30px, 4vw, 42px); }
.how-intro { max-width: 630px; margin: 17px 0 0; color: var(--muted); font-size: 16px; line-height: 1.65; }
.how-section { padding-top: 27px; margin-top: 27px; border-top: 1px solid var(--line); }
.how-section h3 { margin: 0 0 15px; font-size: 16px; letter-spacing: -.02em; }
.how-section > p, .how-section > ul { margin: 0; color: #4f4f49; font-size: 14px; line-height: 1.68; }
.how-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.how-options > div { padding: 15px; background: var(--soft); border-radius: 14px; }
.how-options strong, .how-options span { display: block; }
.how-options strong { margin-bottom: 6px; font-size: 13px; }
.how-options span { color: var(--muted); font-size: 12px; line-height: 1.55; }
.how-steps { display: grid; gap: 13px; margin: 0; padding: 0; list-style: none; }
.how-steps li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.how-steps li > span { display: grid; place-items: center; width: 28px; height: 28px; color: #5e5d57; background: var(--soft); border-radius: 9px; font-size: 11px; font-weight: 700; }
.how-steps strong { display: block; margin: 2px 0 4px; font-size: 13px; }
.how-steps p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.how-safety { padding: 22px; background: #f8f8f5; border: 0; border-radius: 16px; }
.how-safety ul { padding-left: 19px; }
.how-safety li { margin: 0 0 8px; }
.how-safety li:last-child { margin-bottom: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .top-actions { top: 12px; right: 8px; }
  .top-link { padding: 8px; font-size: 12px; }
  .top-link svg { width: 16px; height: 16px; }
  main { width: min(100% - 24px, 1040px); }
  .hero { padding: 72px 0; }
  .hero > p { font-size: 15px; }
  .title-lockup { --title-intro-offset: 38px; gap: 8px; }
  .food-icons { gap: 0; }
  .food-icon { width: 23px; height: 23px; }
  .composer { margin-top: 28px; border-radius: 21px; }
  .has-results .hero { padding-top: 64px; }
  .results { grid-template-columns: 1fr; }
  .results-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .results-query { max-width: calc(100vw - 24px); }
  .pagination { flex-wrap: wrap; }
  .page-button[data-direction] { font-size: 0; }
  .page-button[data-direction]::after { font-size: 15px; }
  .page-button[data-direction="previous"]::after { content: "←"; }
  .page-button[data-direction="next"]::after { content: "→"; }
  dialog { width: calc(100% - 16px); max-height: 94vh; border-radius: 22px; }
  .detail-content { max-height: 94vh; padding: 30px 24px 36px; }
  .detail-content h2 { padding-right: 38px; }
  .ingredient-list { columns: 1; }
  .how-content { max-height: 94vh; padding: 30px 24px 36px; }
  .how-content > h2 { padding-right: 38px; }
  .how-options { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  h1 { opacity: 1; transform: none; animation: none; }
  .food-icon { opacity: 1; transform: none; animation: none; }
  .animate-results .recipe-card { opacity: 1; transform: none; animation: none; }
}
