/* How Chefs Cook — design E: black, grey, green for selections, lime for scan. */

@font-face { font-family: "Bricolage Grotesque"; src: url("/fonts/bricolage-grotesque.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("/fonts/dm-sans.woff2") format("woff2"); font-weight: 100 1000; font-display: swap; }

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f3f2;
  --text: #111111;
  --muted: #5e5e5e;
  --border: #e4e4e2;
  --green: #1e7a4a;
  --green-hover: #17643c;
  --green-soft: #e3f1da;
  --green-ink: #14532f;
  --lime: #d4ec5c;
  --lime-hover: #c6e043;
  --lime-ink: #111111;
  --primary: #111111;
  --primary-hover: #2b2b2b;
  --primary-ink: #ffffff;
  --accent: var(--green);
  --accent-hover: var(--green-hover);
  --accent-ink: #ffffff;
  --accent-soft: var(--green-soft);
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --ok: #1e7a4a;
  --warn-bg: #fdf0cf;
  --warn-ink: #6b4b00;
  --focus: #1f5fd6;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --radius-small: 8px;
  --radius-tag: 6px;
  --tabbar-h: 64px;
  --font-head: "Bricolage Grotesque", "DM Sans", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214;
    --surface: #1a1c1e;
    --surface-2: #24272a;
    --text: #f2f2f0;
    --muted: #a9aba8;
    --border: #303336;
    --green: #4cb57e;
    --green-hover: #63c792;
    --green-soft: #1d3a2a;
    --green-ink: #bfe8cf;
    --primary: #f2f2f0;
    --primary-hover: #ffffff;
    --primary-ink: #111111;
    --accent-ink: #0d1f15;
    --danger: #f28b82;
    --danger-soft: #3d1f1c;
    --ok: #63c792;
    --warn-bg: #3d3112;
    --warn-ink: #f3d68a;
    --focus: #8ab4ff;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 var(--font-body);
  min-height: 100vh; display: flex; flex-direction: column;
}

main { flex: 1; outline: none; padding-bottom: 40px; }

a { color: var(--text); text-underline-offset: 3px; }
a:hover { color: var(--green); }

h1, h2, h3 { line-height: 1.15; margin: 0; font-family: var(--font-head); letter-spacing: -0.02em; }
h1 { font-size: clamp(1.75rem, 3vw + 1rem, 2.4rem); font-weight: 700; outline: none; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-weight: 700; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1[tabindex="-1"]:focus, h1[tabindex="-1"]:focus-visible { outline: none; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }

.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; }

.skip-link { position: absolute; left: 12px; top: -48px; z-index: 50; background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: var(--radius-small); border: 1px solid var(--border); }
.skip-link:focus { top: 12px; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.error { color: var(--danger); }
[hidden] { display: none !important; }

/* header and tab bar */

.site-header { background: var(--bg); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-family: var(--font-head); font-weight: 800; font-size: 1.25rem; letter-spacing: -0.03em; }
.brand:hover { color: var(--text); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: var(--lime); padding: 4px; }
.header-tools { display: flex; align-items: center; gap: 8px; }

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; list-style: none; margin: 0; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-small); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); z-index: 40; }
.menu-list a { display: block; padding: 10px 12px; border-radius: 6px; text-decoration: none; color: var(--text); font-weight: 500; }
.menu-list a:hover, .menu-list a[aria-current="page"] { background: var(--surface-2); color: var(--text); }

.tabbar { display: flex; gap: 4px; }
.tabbar a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: var(--radius-small); color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.tabbar a:hover { color: var(--text); background: var(--surface-2); }
.tabbar a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.tabbar svg { width: 20px; height: 20px; flex: none; }

@media (max-width: 860px) {
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; gap: 0;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    background: var(--surface); border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { flex-direction: column; justify-content: center; gap: 2px; height: var(--tabbar-h); border-radius: 0; font-size: 0.75rem; padding: 0; }
  .tabbar a:hover { background: transparent; }
  .tabbar a[aria-current="page"] { background: transparent; color: var(--text); font-weight: 700; }
  .tabbar svg { width: 24px; height: 24px; }
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)) !important; }
  .site-footer { display: none; }
}

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.875rem; padding: 18px 0; }

/* buttons and inputs */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: var(--radius-small);
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-ink); }
.btn-scan { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
.btn-scan:hover { background: var(--lime-hover); border-color: var(--lime-hover); color: var(--lime-ink); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 0.875rem; }
.btn svg { width: 18px; height: 18px; flex: none; }

.link-button { background: none; border: 0; padding: 4px 2px; font: inherit; color: var(--green); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-button:hover { color: var(--green-hover); }
.link-danger { color: var(--danger); }

.label { display: block; font-weight: 600; margin-bottom: 6px; }
.optional { font-weight: 400; color: var(--muted); }

.input {
  width: 100%; min-height: 46px; padding: 10px 14px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-small);
}
.input:focus-visible { outline-offset: 0; border-color: var(--focus); }
.input[aria-invalid="true"] { border-color: var(--danger); }
textarea.input { resize: vertical; min-height: 96px; }
.input-small { min-height: 38px; padding: 6px 10px; width: auto; flex: 1 1 160px; }

.field { margin-bottom: 20px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-hint { margin: 6px 0 0; font-size: 0.875rem; color: var(--muted); }
.field-hint.is-error { color: var(--danger); }
.field-hint.is-ok { color: var(--ok); }

/* chips and tags */

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 2px; min-height: 36px; padding: 0 4px 0 12px;
  background: var(--green); color: #fff; border-radius: var(--radius-small); font-weight: 600; border: 1.5px solid transparent;
}
@media (prefers-color-scheme: dark) { .chip { color: var(--accent-ink); } }
.chip-x { border: 0; background: transparent; color: inherit; font-size: 1.15rem; line-height: 1; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; opacity: 0.85; }
.chip-x:hover { background: rgba(255, 255, 255, 0.18); opacity: 1; }
.chips-small .chip { min-height: 30px; padding: 0 4px 0 10px; font-size: 0.85rem; }
.chip-static, .chips-small .chip-static { background: var(--surface-2); color: var(--text); padding: 0 10px; font-weight: 500; }

.chip-button, .tag {
  display: inline-flex; align-items: center; font: inherit; cursor: pointer;
  min-height: 34px; padding: 0 10px; font-size: 0.85rem; font-weight: 600;
  border-radius: var(--radius-tag); border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
}
.chip-button:hover, .tag:hover { border-color: var(--green); color: var(--text); }
.tag { background: var(--surface-2); border-color: var(--surface-2); text-decoration: none; }
.tag.is-on, .chip-button[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
@media (prefers-color-scheme: dark) { .tag.is-on, .chip-button[aria-pressed="true"] { color: var(--accent-ink); } }
.tag-more { color: var(--muted); }

.filter-row { display: flex; gap: 8px; overflow-x: auto; scroll-padding-inline: 16px; margin-inline: -16px; padding: 2px 16px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-row > * { flex: none; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border-radius: var(--radius-small); border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.filter-chip:hover { border-color: var(--text); color: var(--text); }
.filter-chip svg { width: 16px; height: 16px; flex: none; }
.filter-chip[aria-pressed="true"].is-diet { background: var(--green); border-color: var(--green); color: #fff; }
.filter-chip[aria-pressed="true"].is-kitchen { background: var(--green-soft); border-color: var(--green); color: var(--green-ink); }
@media (prefers-color-scheme: dark) { .filter-chip[aria-pressed="true"].is-diet { color: var(--accent-ink); } }
.filter-chip.is-more { background: var(--surface-2); border-color: var(--surface-2); }
.filter-chip .count { color: var(--muted); font-weight: 500; }
.filter-chip[aria-pressed="true"] .count { color: inherit; opacity: 0.8; }

.diet-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.diet-tile {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 6px;
  border-radius: var(--radius-small); background: var(--surface-2); color: var(--text); border: 1.5px solid var(--surface-2);
  font-weight: 700; font-size: 0.875rem; text-decoration: none;
}
.diet-tile:hover { border-color: var(--green); color: var(--text); }
.diet-tile svg { width: 17px; height: 17px; flex: none; }

/* picker */

.picker { position: relative; }
.picker-box { position: relative; }
.picker-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; list-style: none; margin: 0; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-small); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 320px; overflow-y: auto;
}
.picker-option { display: flex; align-items: baseline; gap: 10px; padding: 10px 12px; border-radius: 6px; cursor: pointer; }
.picker-option[aria-selected="true"] { background: var(--green-soft); }
.picker-option:hover { background: var(--surface-2); }
.opt-name { font-weight: 600; }
.opt-alias { color: var(--muted); font-size: 0.85rem; }
.opt-count { margin-left: auto; color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.picker-create { color: var(--green); }
.opt-icon { font-weight: 700; width: 1em; text-align: center; }
.picker-panel { margin-top: 10px; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: var(--radius-small); background: var(--surface); }
.panel-title { margin: 0 0 8px; font-weight: 600; }
.panel-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.panel-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.panel-actions, .panel-footer { display: flex; flex-wrap: wrap; gap: 6px; }

/* search bar with scan button */

.searchbar { display: flex; gap: 8px; align-items: flex-start; }
.searchbar .picker { flex: 1; min-width: 0; }
.searchbar .picker .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.searchbar .input { min-height: 52px; }
.searchbar .btn-scan { min-height: 52px; padding: 0 16px; }
.searchbar .field-hint { display: none; }

/* home */

.home { display: grid; gap: 28px; padding-top: 20px; }
.home-hero { display: grid; gap: 12px; }
.home-hero .lede { margin: 0; }
.home-section { display: grid; gap: 12px; min-width: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head a { font-weight: 700; font-size: 0.9rem; text-decoration: none; white-space: nowrap; }
.section-head a:hover { text-decoration: underline; color: var(--text); }
.shelf { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; margin-inline: -16px; padding: 2px 16px 6px; scrollbar-width: none; }
.shelf::-webkit-scrollbar { display: none; }
.shelf > * { scroll-snap-align: start; }
.label-caps { margin: 0; font-family: var(--font-body); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.rcard { flex: none; width: 250px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.rcard-small { width: 168px; }
.rcard-media { position: relative; display: block; aspect-ratio: 5 / 3; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.rcard-small .rcard-media { aspect-ratio: 4 / 3; }
.rcard-media .ph { border-radius: var(--radius); }
.rcard-title { font-size: 1.05rem; line-height: 1.2; overflow-wrap: anywhere; }
.rcard-small .rcard-title { font-size: 0.95rem; font-family: var(--font-body); }
.rcard-title a { text-decoration: none; }
.rcard-title a:hover { text-decoration: underline; color: var(--text); }
.rcard-meta { margin: 0; font-size: 0.8rem; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 5px; list-style: none; margin: 0; padding: 0; }

.chef-shelf .chef { flex: none; width: 80px; display: grid; justify-items: center; gap: 4px; text-decoration: none; color: var(--text); text-align: center; }
.chef-avatar { width: 64px; height: 64px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; background: var(--surface-2); color: var(--text); }
.chef:nth-child(4n+1) .chef-avatar { background: var(--primary); color: var(--primary-ink); }
.chef:nth-child(4n+2) .chef-avatar { background: var(--lime); color: var(--lime-ink); }
.chef-name { font-size: 0.78rem; font-weight: 600; overflow-wrap: anywhere; line-height: 1.25; }
.chef-count { font-size: 0.72rem; color: var(--muted); }

.recent { list-style: none; margin: 0; padding: 14px 0 0; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.recent a { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.recent-thumb { position: relative; flex: none; width: 52px; height: 52px; border-radius: var(--radius-small); overflow: hidden; background: var(--surface-2); }
.recent-thumb .ph-tag, .recent-thumb .ph-letter, .recent-thumb .ph-diet { display: none; }
.recent-title { font-weight: 600; display: block; }
.recent-meta { font-size: 0.8rem; color: var(--muted); }

/* search page */

.search-head { display: grid; gap: 12px; padding: 20px 0 8px; }
.selected-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.filters { display: grid; gap: 10px; margin-top: 4px; }
.mode-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }

.seg { display: inline-flex; border: 1.5px solid var(--border); border-radius: 10px; padding: 3px; margin: 0; background: var(--surface); }
.seg-option { position: relative; }
.seg-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-option span { display: inline-block; padding: 7px 14px; border-radius: 7px; font-weight: 600; font-size: 0.875rem; color: var(--muted); }
.seg-option input:checked + span { background: var(--primary); color: var(--primary-ink); }
.seg-option input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }
.seg-tabs button { border: 0; background: transparent; font: inherit; font-weight: 600; font-size: 0.9rem; color: var(--muted); padding: 8px 16px; border-radius: 7px; cursor: pointer; }
.seg-tabs button[aria-selected="true"] { background: var(--primary); color: var(--primary-ink); }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.check input { width: 18px; height: 18px; accent-color: var(--green); }

.results { padding-top: 12px; }
.results-head { font-size: 1.25rem; margin-bottom: 14px; }
.results-notes:empty { display: none; }
.results-notes { margin-bottom: 16px; }
.empty { padding: 24px; border: 1.5px dashed var(--border); border-radius: var(--radius); text-align: center; }
.empty p { margin: 0 0 14px; }
.empty.muted { padding: 18px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; align-items: start; }

/* full recipe card */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card-off .media { filter: grayscale(0.85); opacity: 0.75; }
.card-body { padding: 14px 16px 16px; display: grid; gap: 10px; }
.card-title { font-size: 1.15rem; overflow-wrap: anywhere; }
.card-title a { text-decoration: none; }
.card-title a:hover { text-decoration: underline; color: var(--text); }
.card-meta { margin: -4px 0 0; display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; font-size: 0.875rem; color: var(--muted); }
.meta-sep { color: var(--border); }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.match-badge { justify-self: start; display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 4px; background: var(--lime); color: var(--lime-ink); font-size: 0.75rem; font-weight: 700; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); }

.chef-link, .meta-link { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.chef-link:hover, .meta-link:hover { color: var(--text); text-decoration-color: currentColor; }

.media { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); }
.media.is-loaded { aspect-ratio: auto; background: #000; }
.media iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; background: #000; }
.media-short.is-loaded iframe { aspect-ratio: 9 / 16; max-height: 560px; }
.media-ig.is-loaded { background: var(--surface); }
.media-ig.is-loaded iframe { aspect-ratio: auto; height: 640px; background: var(--surface); }

.ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--surface-2); }
.ph-letter { position: relative; z-index: 1; font-family: var(--font-head); font-size: 3rem; font-weight: 800; color: #9a9a96; letter-spacing: -0.03em; }
.ph-tag { position: absolute; z-index: 2; right: 8px; bottom: 8px; height: 22px; padding: 0 7px; border-radius: 4px; display: flex; align-items: center; background: rgba(17, 17, 17, 0.7); font-size: 0.7rem; font-weight: 600; color: #fff; }
.ph-diet { position: absolute; z-index: 2; left: 8px; top: 8px; height: 24px; padding: 0 8px; border-radius: 4px; display: flex; align-items: center; background: #fff; color: #111; font-size: 0.72rem; font-weight: 700; }
.ph-diet.is-plant { background: var(--green); color: #fff; }
.ph-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph-0, .ph-3 { background: #e2e2e0; }
.ph-1, .ph-4 { background: #d6d6d3; }
.ph-2, .ph-5 { background: #eaeae8; }
@media (prefers-color-scheme: dark) { .ph-0, .ph-1, .ph-2, .ph-3, .ph-4, .ph-5 { background: #2a2d30; } .ph-letter { color: #5c6064; } }
.form-preview-img { display: block; max-width: 260px; max-height: 260px; border-radius: var(--radius-small); border: 1px solid var(--border); margin-bottom: 10px; object-fit: cover; }
.preview-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.preview-actions .input { flex: 1 1 240px; width: auto; }

.play {
  position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; border-radius: var(--radius-small);
  border: 0; background: rgba(17, 17, 17, 0.78); color: #fff; font: inherit; font-weight: 600; cursor: pointer; min-height: 44px;
}
.play:hover { background: rgba(17, 17, 17, 0.92); }
.play-icon { width: 28px; height: 28px; border-radius: 6px; background: var(--lime); position: relative; }
.play-icon::after { content: ""; position: absolute; left: 11px; top: 8px; border-left: 9px solid #111; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.media-note { position: absolute; z-index: 2; bottom: 10px; left: 12px; margin: 0; color: #fff; font-weight: 600; font-size: 0.85rem; }
.media-problem { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; text-align: center; background: rgba(17, 17, 17, 0.86); color: #fff; }
.media-problem p { margin: 0; font-weight: 600; }
.media-problem-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.media-problem .btn-ghost { color: #fff; }
.media-problem .btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }
.player-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; background: var(--surface-2); flex-wrap: wrap; }
.player-bar-actions { display: flex; gap: 12px; margin-left: auto; }
.player-bar .link-button { font-size: 0.875rem; }

/* recipe page */

.recipe-page { max-width: 720px; padding-top: 16px; display: grid; gap: 16px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; text-decoration: none; color: var(--muted); }
.back-link:hover { color: var(--text); }

/* browse */

.browse { display: grid; gap: 16px; padding-top: 20px; }
.list-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list-rows a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); background: var(--surface); }
.list-rows a:hover { border-color: var(--text); color: var(--text); }
.list-rows .chef-avatar { width: 48px; height: 48px; font-size: 1rem; }
.list-rows li:nth-child(4n+1) .chef-avatar { background: var(--primary); color: var(--primary-ink); }
.list-rows li:nth-child(4n+2) .chef-avatar { background: var(--lime); color: var(--lime-ink); }
.row-title { font-weight: 700; display: block; }
.row-meta { font-size: 0.85rem; color: var(--muted); }
.row-go { margin-left: auto; color: var(--muted); }
.browse-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.browse-grid .rcard { width: auto; }

/* scan */

.scan-page { max-width: 640px; padding-top: 20px; display: grid; gap: 16px; }
.scan-hero { aspect-ratio: 4 / 3; border-radius: var(--radius); background: #1b1d1f; color: #d7dad6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; }
.scan-hero svg { width: 56px; height: 56px; color: var(--lime); }

/* pages */

.page-head { padding: 28px 0 20px; max-width: 760px; }
.page-head h1 { margin-bottom: 8px; }
.page-head .lede, .lede { color: var(--muted); margin: 0; font-size: 1.02rem; }

.form { max-width: 760px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 8px; }
.push-right { margin-left: auto; }
.form .chips { margin-top: 12px; }
.error-summary { margin-bottom: 20px; padding: 12px 16px; border-radius: var(--radius-small); background: var(--danger-soft); color: var(--danger); font-weight: 600; outline: none; }
.caption-box { margin-bottom: 20px; border: 1px solid var(--border); border-radius: var(--radius-small); padding: 12px 16px; background: var(--surface-2); }
.caption-box summary { cursor: pointer; font-weight: 600; }
.caption-box[open] summary { margin-bottom: 12px; }
.caption-box .field { margin-bottom: 0; }
.caption-actions { margin-top: 10px; }

.ing-tools { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; max-width: 900px; align-items: start; }
.ing-list { display: grid; gap: 12px; max-width: 900px; margin-top: 10px; }
.ing-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 10px; }
.ing-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ing-name { font-size: 1.1rem; outline: none; overflow-wrap: anywhere; }
.ing-count { font-size: 0.875rem; white-space: nowrap; }
.ing-aliases { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ing-aliases .inline-form { flex: 1 1 260px; }
.ing-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.ing-edit:empty { display: none; }
.ing-type { display: flex; align-items: center; gap: 8px; }
.ing-type .input { width: auto; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inline-form .label { margin: 0; }

.panel-card { max-width: 760px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 16px; }
.panel-card h2 { margin-bottom: 6px; }
.panel-card p { margin-top: 0; }
.code { background: var(--surface-2); padding: 14px 16px; border-radius: var(--radius-small); overflow-x: auto; font: 0.875rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 0; }

.chip-chef { background: var(--primary); color: var(--primary-ink); }
.chip-label { opacity: 0.75; font-size: 0.78em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-right: 3px; }
.opt-chef { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; }
.chef-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chef-row:empty { display: none; }
.staples-card { max-width: 900px; }
.staple-form { margin-top: 12px; max-width: 420px; }
.source-text { white-space: pre-wrap; max-height: 260px; overflow-y: auto; margin-bottom: 12px; }
.source-body .label { margin-top: 10px; }

/* toasts */

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; max-width: min(420px, calc(100% - 32px)); }
.toast { background: var(--primary); color: var(--primary-ink); padding: 12px 16px; border-radius: var(--radius-small); font-weight: 500; transition: opacity 0.3s, transform 0.3s; }
.toast-error { background: var(--danger); color: #fff; }
.toast-out { opacity: 0; transform: translateY(6px); }

@media (max-width: 640px) {
  .field-row, .ing-tools { grid-template-columns: 1fr; gap: 0; }
  .form { padding: 18px; }
  .push-right { margin-left: 0; }
  .grid { grid-template-columns: 1fr; }
  .brand-text { font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
.loading { padding-top: 20px; }
.scan-hero p { margin: 0; }
.scan-strong { font-weight: 600; }

/* favorites, sign-in, admin, legal */
.heart { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 36px; border-radius: var(--radius-small); border: 1.5px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; padding: 0; }
.heart svg { width: 20px; height: 20px; }
.heart[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.heart[aria-pressed="true"] svg { fill: currentColor; }
.heart:hover { border-color: var(--green); }
.rcard-wrap { position: relative; }
.heart-small { position: absolute; right: 8px; bottom: 8px; z-index: 3; width: 36px; height: 36px; border: 0; background: rgba(255, 255, 255, 0.94); color: #111; }
.heart-small[aria-pressed="true"] { background: var(--green); color: #fff; }
.rcard-wrap .ph-tag { display: none; }
.signin { max-width: 520px; padding-top: 20px; display: grid; gap: 14px; justify-items: start; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.admin-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.admin-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.admin-row > div:first-child { display: grid; gap: 2px; min-width: 0; }
.admin-row .row-title { overflow-wrap: anywhere; }
.admin-actions { display: flex; align-items: center; gap: 12px; }
.act-action { font-weight: 500; color: var(--muted); }
.act-detail { overflow-wrap: anywhere; }
.legal { max-width: 720px; padding-top: 20px; }
.legal h2 { margin: 24px 0 6px; font-size: 1.1rem; }
.legal p { margin: 0 0 10px; }
.legal-links { text-align: center; margin: 0; }
.legal-links a { color: var(--muted); }
.site-footer a { color: var(--muted); }
.brand-text { white-space: nowrap; }
@media (max-width: 420px) { .brand-text { font-size: 1.05rem; } .hide-narrow { display: none; } .header-tools { gap: 6px; } }

/* Sign-in */
.signin-form { display: grid; gap: 12px; width: 100%; max-width: 380px; }
.signin-form[hidden] { display: none; }
.signin .input-code { font-size: 1.5rem; letter-spacing: 0.3em; font-variant-numeric: tabular-nums; max-width: 220px; }
.btn-google { gap: 10px; width: 100%; max-width: 380px; justify-content: center; }
.g-mark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 4px;
  background: #fff; color: #111; font-weight: 800; font-size: 14px; border: 1px solid var(--border); }
.signin .or { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 380px; margin: 4px 0;
  color: var(--muted); font-size: 0.875rem; }
.signin .or::before, .signin .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.btn-link { background: none; border: 0; padding: 8px 0; font: inherit; font-size: 0.9375rem; font-weight: 600;
  color: var(--green); text-align: left; cursor: pointer; justify-self: start; min-height: 44px; }
.btn-link:hover { text-decoration: underline; }
