:root {
  --ink: #17211d;
  --muted: #637069;
  --paper: #f7f5ef;
  --card: #fffdf8;
  --line: #dedbd0;
  --green: #165c43;
  --green-soft: #e5f1eb;
  --amber: #94620e;
  --amber-soft: #fff0ca;
  --blue: #315f7d;
  --blue-soft: #e8f1f6;
  --shadow: 0 18px 55px rgba(31, 43, 37, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgba(211, 231, 219, .8), transparent 29rem),
    var(--paper);
  font: 16px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--green); }
.topbar, main, footer { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-block: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 760; }
.brand small { color: var(--muted); font-weight: 600; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: white; background: var(--green); font-size: 13px; letter-spacing: .05em; }
.brand-mark.brand-logo { overflow: hidden; background: transparent; }
.brand-mark.brand-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.text-link { text-decoration: none; font-weight: 650; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; min-width: 0; }
.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; }
.ingredient-search { position: relative; width: min(330px, 38vw); margin: 0; }
.ingredient-search-control { display: flex; align-items: stretch; border: 1px solid #aeb8b0; border-radius: 12px; background: white; box-shadow: 0 6px 22px rgba(31, 43, 37, .06); overflow: hidden; }
.ingredient-search-control:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22, 92, 67, .12); }
.ingredient-search input { min-width: 0; width: 100%; height: 42px; padding: 0 12px; border: 0; outline: 0; color: var(--ink); background: transparent; font: inherit; font-size: 14px; }
.ingredient-search button { flex: 0 0 auto; padding: 0 14px; border: 0; color: white; background: var(--green); font: inherit; font-size: 13px; font-weight: 760; cursor: pointer; }
.ingredient-search button:hover { background: #104a35; }
.ingredient-search-results { position: absolute; z-index: 120; top: calc(100% + 7px); right: 0; left: 0; max-height: min(430px, 65vh); overflow-y: auto; padding: 7px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: 0 18px 55px rgba(31, 43, 37, .2); }
.ingredient-search-result { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; padding: 11px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.ingredient-search-result:hover, .ingredient-search-result.is-active { background: var(--green-soft); }
.ingredient-search-result strong, .ingredient-search-result small { min-width: 0; overflow-wrap: anywhere; }
.ingredient-search-result strong { font-size: 14px; line-height: 1.3; }
.ingredient-search-result small { color: var(--muted); font-size: 11px; }
.ingredient-search-status { justify-self: start; max-width: 100%; padding: 4px 7px; border-radius: 8px; font-size: 10px; font-weight: 750; line-height: 1.3; text-align: left; overflow-wrap: break-word; }
.ingredient-search-status.search-danger { color: #8d241b; background: #f7d4cd; }
.ingredient-search-status.search-context { color: var(--amber); background: var(--amber-soft); }
.ingredient-search-status.search-safe { color: var(--green); background: var(--green-soft); }
.ingredient-search-status.search-unknown { color: var(--blue); background: var(--blue-soft); }
.ingredient-search-message { margin: 0; padding: 11px; color: var(--muted); font-size: 13px; }
.ingredient-search-message strong { display: block; margin-bottom: 3px; color: var(--ink); }
.ingredient-search-wide { width: 100%; margin-top: 18px; }
.ingredient-search-wide .ingredient-search-control { min-height: 52px; }
.ingredient-search-wide input { height: 50px; padding-inline: 16px; font-size: 16px; }
.ingredient-search-wide button { padding-inline: 20px; font-size: 14px; }
.hero { padding: 76px 0 54px; max-width: 830px; }
.eyebrow, .step { margin: 0 0 8px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(39px, 6vw, 68px); line-height: 1.03; letter-spacing: -.035em; font-weight: 500; }
.lead { max-width: 720px; margin: 25px 0 0; color: var(--muted); font-size: 19px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, .8fr); gap: 22px; align-items: start; }
.panel, .results { border: 1px solid rgba(222, 219, 208, .9); border-radius: 24px; background: rgba(255, 253, 248, .94); box-shadow: var(--shadow); }
.input-panel { padding: clamp(22px, 4vw, 38px); }
.note-panel { padding: 28px; position: sticky; top: 20px; }
.panel-heading, .results-heading { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
h2 { margin: 0; font-family: Georgia, serif; font-size: 29px; font-weight: 500; }
.privacy-chip, .count-chip { padding: 6px 10px; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 750; white-space: nowrap; }
.upload-box { margin: 27px 0 0; min-height: 105px; display: flex; align-items: center; gap: 16px; padding: 20px; border: 1.5px dashed #9fac9f; border-radius: 17px; cursor: pointer; background: #fafcf8; transition: .18s ease; }
.upload-box:hover { border-color: var(--green); transform: translateY(-1px); }
.upload-box input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.upload-box small { display: block; color: var(--muted); margin-top: 2px; }
.upload-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; color: white; background: var(--green); font-size: 25px; }
.status-line { min-height: 24px; margin: 8px 0 0; color: var(--green); font-weight: 650; font-size: 14px; }
.crop-panel { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 17px; background: #f3f1ea; }
.crop-heading { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.crop-heading strong, .crop-heading small { display: block; }
.crop-heading small { margin-top: 3px; color: var(--muted); }
#crop-canvas { display: block; width: 100%; height: auto; max-height: 560px; border-radius: 12px; background: #222; cursor: crosshair; touch-action: none; }
.crop-panel .primary-button { margin-top: 12px; }
.secondary-button { flex: 0 0 auto; padding: 8px 11px; border: 1px solid #aeb8b0; border-radius: 10px; color: var(--green); background: white; font: inherit; font-size: 13px; font-weight: 720; cursor: pointer; }
.ocr-quality { margin: 8px 0 0; padding: 11px 13px; border-radius: 12px; color: #46534c; background: var(--green-soft); font-size: 13px; }
.ocr-quality.quality-medium { color: #76500d; background: var(--amber-soft); }
.ocr-quality.quality-low { color: #852b22; background: #f9ded8; }
.ocr-quality strong { display: block; margin-bottom: 3px; }
.ocr-quality ul { margin: 5px 0 0; padding-left: 18px; }
.divider { margin: 19px 0; display: flex; align-items: center; gap: 12px; color: #909990; font-size: 13px; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
label[for="ingredients"] { display: block; margin-bottom: 7px; font-weight: 750; }
textarea { width: 100%; min-height: 170px; resize: vertical; padding: 16px; border: 1px solid #bcc4bd; border-radius: 15px; color: var(--ink); background: white; font: inherit; outline: none; }
textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22, 92, 67, .12); }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.primary-button { width: 100%; margin-top: 19px; padding: 14px 18px; border: 0; border-radius: 14px; color: white; background: var(--green); font: inherit; font-weight: 760; cursor: pointer; }
.primary-button:hover { background: #104a35; }
.primary-button:disabled { opacity: .65; cursor: wait; }
.note-panel ul { margin: 20px 0 0; padding-left: 21px; color: var(--muted); }
.note-panel li + li { margin-top: 12px; }
.results { margin-top: 28px; padding: clamp(22px, 4vw, 38px); scroll-margin-top: 20px; }
.result-card { margin-top: 19px; padding: 23px; border: 2px solid var(--line); border-radius: 18px; background: white; box-shadow: inset 6px 0 0 transparent; transition: border-color .18s ease, background .18s ease; }
.result-card.result-safe { border-color: #65ae8d; background: #f1faf5; box-shadow: inset 6px 0 0 #23825e; }
.result-card.result-danger { border-color: #d77b6b; background: #fff2ef; box-shadow: inset 6px 0 0 #b83e2f; }
.result-card.result-context { border-color: #dfb459; background: #fff9e9; box-shadow: inset 6px 0 0 #b97a12; }
.result-card.result-unknown { border-color: #a7b9c4; background: #f5f8fa; box-shadow: inset 6px 0 0 #668397; }
.share-results { margin-top: 24px; padding: 20px; border: 1px solid #c7d8cf; border-radius: 16px; background: #f3f8f5; }
.share-results > strong { font: 600 20px/1.25 Georgia, serif; }
.share-results > p { margin: 8px 0 14px; color: var(--muted); font-size: 13px; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.share-actions a, .share-actions button { min-height: 38px; padding: 8px 12px; border: 1px solid #8eaa9b; border-radius: 10px; color: #155e46; background: white; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.share-actions .share-primary { color: white; border-color: #17684e; background: #17684e; }
.result-card-top { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
.recognized { margin: 0 0 4px; color: var(--muted); font-size: 12px; }
.result-card h3 { margin: 0; font: 500 24px/1.2 Georgia, serif; }
.result-card h3 a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.result-badge { padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 760; text-align: center; }
.badge-caution { color: #8d241b; background: #f7d4cd; }
.badge-context { color: var(--amber); background: var(--amber-soft); }
.badge-unknown { color: var(--blue); background: var(--blue-soft); }
.badge-neutral { color: var(--green); background: var(--green-soft); }
.summary { margin: 18px 0 8px; font-size: 17px; }
.context { margin: 0; color: var(--muted); }
.card-details-link { display: inline-block; margin-top: 13px; font-size: 14px; font-weight: 750; text-decoration: none; }
.inline-glossary { color: inherit; text-decoration-line: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.other-risks { margin-top: 17px; padding: 14px 16px; border: 1px solid #e5b989; border-radius: 13px; background: #fff8ee; }
.other-risks strong { color: #884b18; }
.other-risks ul { margin: 8px 0 0; padding-left: 20px; }
.other-risks li + li { margin-top: 4px; }
.other-risks p { margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.sources-details { margin-top: 18px; }
.sources-details summary { width: fit-content; padding: 7px 11px; border-radius: 10px; color: var(--green); background: rgba(229, 241, 235, .8); font-size: 13px; font-weight: 780; cursor: pointer; user-select: none; }
.sources-details summary:hover { background: var(--green-soft); }
.sources-details[open] summary { margin-bottom: 9px; }
.source-list { display: grid; gap: 7px; }
.source-link { display: flex; justify-content: space-between; gap: 15px; padding: 11px 13px; border-radius: 11px; background: #f4f7f3; text-decoration: none; }
.source-link span { color: var(--muted); font-size: 13px; text-align: right; }
.unmatched, .empty-state { margin-top: 19px; padding: 18px; border-radius: 14px; background: #f1efe8; color: var(--muted); }
.unmatched p { margin: 6px 0 0; overflow-wrap: anywhere; }
.search-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--ink); }
.search-progress-head span { color: var(--green); font-size: 13px; font-weight: 800; }
.search-progress-track { height: 10px; margin-top: 12px; overflow: hidden; border-radius: 999px; background: #d9ddd8; }
.search-progress-bar { height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, #2a8562, var(--green)); transition: width .45s ease; }
.search-progress-note { font-size: 13px; }
.food-warning { margin-bottom: 16px; padding: 14px 16px; border: 1px solid #dfb459; border-radius: 12px; color: #714b0c; background: var(--amber-soft); }
.food-warning p { margin: 5px 0 0; color: #714b0c; }
.search-status-group { margin-top: 13px; padding-top: 12px; border-top: 1px solid #dcd9cf; }
.search-status-group strong { color: var(--ink); font-size: 13px; }
.search-status-group p { font-size: 13px; }
.dataset-note { margin: 18px 0 0; color: var(--muted); font-size: 12px; }
.hidden { display: none !important; }
footer { padding: 55px 0 35px; display: flex; justify-content: space-between; gap: 24px; color: var(--muted); font-size: 13px; }
footer p { margin: 0; }
footer nav { display: flex; flex-wrap: wrap; gap: 15px; }
.footer-back { align-self: flex-start; padding: 8px 12px; border: 1px solid #9fb1a6; border-radius: 10px; color: var(--green); background: var(--card); font: inherit; font-weight: 750; cursor: pointer; }
.document { max-width: 780px; margin: 55px auto 90px; padding: clamp(24px, 5vw, 48px); border: 1px solid var(--line); border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.document h1 { font-size: clamp(36px, 6vw, 54px); }
.document h2 { margin-top: 30px; font-family: inherit; font-size: 21px; font-weight: 750; }
.document p, .document li { color: #4e5a54; }
.topic-section { margin-top: 64px; }
.topic-section h2 { font-size: clamp(30px, 4vw, 42px); }
.topic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 24px; }
.topic-grid a { min-height: 132px; padding: 21px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: var(--card); box-shadow: 0 10px 30px rgba(31, 43, 37, .05); text-decoration: none; }
.topic-grid a:hover { border-color: #8eaa9b; transform: translateY(-2px); }
.topic-grid strong, .topic-grid span { display: block; }
.topic-grid strong { font: 500 21px/1.2 Georgia, serif; }
.topic-grid span { margin-top: 9px; color: var(--muted); font-size: 14px; }
.seo-main { max-width: 820px; }
.seo-article { padding: 48px 0 30px; }
.seo-article > h1 { max-width: 780px; font-size: clamp(34px, 5vw, 52px); line-height: 1.08; }
.seo-article > .lead { margin-bottom: 34px; }
.seo-article > section { margin-top: 18px; padding: clamp(22px, 4vw, 34px); border: 1px solid var(--line); border-radius: 20px; background: var(--card); }
.seo-article > section h2 { font-family: Georgia, serif; font-size: 27px; }
.seo-article > section p { margin: 12px 0 0; color: #4e5a54; }
.seo-article > .article-copy { margin-top: 30px; padding: 0; border: 0; background: transparent; }
.article-paragraph { padding: 0 0 26px; border-bottom: 1px solid var(--line); }
.article-paragraph + .article-paragraph { padding-top: 26px; }
.article-paragraph h2 { margin: 0; font-size: clamp(23px, 3vw, 29px); }
.article-paragraph p { max-width: 740px; margin: 11px 0 0; color: #34443c; font-size: 17px; line-height: 1.72; }
.seo-article > .related-section { padding: 24px; }
.seo-cta { margin: 30px 0; padding: 25px; border-radius: 20px; color: white; background: var(--green); }
.seo-cta strong { font: 500 27px/1.2 Georgia, serif; }
.seo-cta p { margin: 7px 0 18px; color: #dcece4; }
.cta-link { display: inline-block; padding: 11px 15px; border-radius: 11px; color: var(--green); background: white; text-decoration: none; font-weight: 760; }
.query-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 17px 0 0; padding: 0; list-style: none; }
.query-list li { padding: 7px 10px; border-radius: 999px; color: #46534c; background: var(--green-soft); font-size: 13px; }
.small-note { font-size: 12px; }
.related-links { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.related-links a { padding: 8px 11px; border: 1px solid #b9cabf; border-radius: 10px; text-decoration: none; }
.seo-notice { margin-top: 18px; padding: 18px 20px; border-radius: 14px; color: var(--muted); background: #ebe9e1; font-size: 13px; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; color: var(--muted); font-size: 13px; }
.breadcrumbs a { text-decoration: none; }
.ingredient-status { margin: 30px 0; padding: 24px; border: 2px solid var(--line); border-radius: 20px; background: var(--card); box-shadow: inset 6px 0 0 #668397; }
.ingredient-status strong { font-size: 18px; }
.ingredient-status p { margin: 12px 0 0; color: #34443c; font-size: 16px; line-height: 1.65; }
.ingredient-status .status-evidence { padding-top: 12px; border-top: 1px solid rgba(70, 83, 76, .18); font-size: 14px; }
.ingredient-status .status-evidence span { font-weight: 750; }
.ingredient-status.seo-status-danger { border-color: #d77b6b; background: #fff2ef; box-shadow: inset 6px 0 0 #b83e2f; }
.ingredient-status.seo-status-context { border-color: #dfb459; background: #fff9e9; box-shadow: inset 6px 0 0 #b97a12; }
.ingredient-status.seo-status-safe { border-color: #65ae8d; background: #f1faf5; box-shadow: inset 6px 0 0 #23825e; }
.alias-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.alias-list li { padding: 7px 10px; border-radius: 999px; background: var(--blue-soft); font-size: 13px; }
.ingredient-sources { margin-top: 16px; }
.ingredient-sources summary { width: fit-content; padding: 9px 12px; border-radius: 10px; color: var(--green); background: var(--green-soft); font-weight: 750; cursor: pointer; }
.ingredient-sources ul { display: grid; gap: 9px; margin: 14px 0 0; padding: 0; list-style: none; }
.ingredient-sources li { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.ingredient-sources a, .ingredient-sources span { display: block; }
.ingredient-sources span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.ingredient-sources .source-interpretation { margin-top: 8px; color: var(--ink); font-size: 13px; line-height: 1.45; }
.ingredient-directory { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 17px; }
.ingredient-directory a { min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; font-size: 14px; overflow-wrap: anywhere; word-break: normal; }
.chemical-facts { display: grid; grid-template-columns: minmax(150px, .55fr) 1.45fr; gap: 8px 16px; margin: 17px 0; }
.chemical-facts dt { color: var(--muted); font-size: 13px; }
.chemical-facts dd { margin: 0; overflow-wrap: anywhere; }
.ingredient-article h3 { margin: 22px 0 8px; font-size: 16px; }
.reference-sources { margin: 16px 0 0; padding-left: 20px; }
.reference-sources li + li { margin-top: 8px; }
.analytics-consent { position: fixed; z-index: 1000; right: 20px; bottom: 20px; left: 20px; display: flex; align-items: center; justify-content: space-between; gap: 42px; max-width: 1120px; margin: 0 auto; padding: 32px 36px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: 0 18px 60px rgba(31, 43, 37, .24); }
.analytics-consent strong { font: 500 25px/1.2 Georgia, serif; }
.analytics-consent p { max-width: 720px; margin: 10px 0 0; color: var(--muted); font-size: 16px; line-height: 1.5; }
.analytics-consent-actions { display: flex; flex: 0 0 auto; gap: 9px; }
.analytics-consent button { width: auto; min-height: 54px; padding: 14px 22px; white-space: nowrap; font-size: 16px; }

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; }
  .topbar-actions { flex: 1 1 100%; order: 3; width: 100%; }
  .topbar-actions .ingredient-search { flex: 1 1 auto; width: auto; }
  .topbar > .ingredient-search { flex: 1 1 100%; order: 3; width: 100%; }
  .topbar-actions .text-link { display: none; }
  .hero { padding-top: 44px; }
  .workspace { grid-template-columns: 1fr; }
  .note-panel { position: static; }
  .result-card-top, footer { flex-direction: column; }
  .result-badge { align-self: start; }
  .source-link { flex-direction: column; }
  .source-link span { text-align: left; }
  .crop-heading { flex-direction: column; }
  .topic-grid { grid-template-columns: 1fr; }
  .ingredient-directory { grid-template-columns: 1fr; }
  .chemical-facts { grid-template-columns: 1fr; gap: 2px; }
  .chemical-facts dd + dt { margin-top: 8px; }
  .analytics-consent { right: 12px; bottom: 12px; left: 12px; align-items: stretch; flex-direction: column; gap: 18px; padding: 24px; }
  .analytics-consent-actions { display: grid; grid-template-columns: 1fr; }
  .analytics-consent button { width: 100%; }
}
