:root {
  --ink: #243026;
  --muted: #697268;
  --paper: #fffdf8;
  --canvas: #f4f0e7;
  --line: #d9ded5;
  --accent: #ef6a54;
  --accent-dark: #c94d3b;
  --accent-soft: #ffe6df;
  --green: #dff0df;
  --yellow: #f8dc83;
  --radius: 18px;
  --shadow: 0 14px 36px rgba(45, 59, 47, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: "DM Sans", system-ui, sans-serif; }
button, input { font: inherit; }
button { color: inherit; }
button[hidden], [hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky; top: 0; z-index: 20; height: 72px; display: flex; align-items: center; gap: 24px;
  padding: 0 max(20px, calc((100vw - 1180px) / 2)); border-bottom: 1px solid var(--line);
  background: rgba(255,253,248,.93); backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 10px; font: 700 25px/1 "Fredoka", sans-serif; white-space: nowrap; }
.brand b { color: var(--accent); }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--yellow); font-size: 22px; }
.topbar-note { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 700; }
.topbar-note span { color: #52a36b; margin-right: 5px; }
.model-status { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: white; font-size: 12px; font-weight: 700; cursor: pointer; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #e1a732; box-shadow: 0 0 0 4px #faedc8; }
.status-dot.ready { background: #43a762; box-shadow: 0 0 0 4px #d9efdf; }

.app-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 40px 0 64px; }
.welcome { display: flex; align-items: center; justify-content: space-between; gap: 40px; margin-bottom: 28px; padding: 8px 4px; }
.eyebrow, .panel-heading p, .result-top p, .section-label p { margin: 0; color: #788177; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.welcome h1 { margin: 8px 0 12px; font: 700 clamp(42px, 5vw, 68px)/.95 "Fredoka", sans-serif; letter-spacing: -.04em; }
.welcome h1 em { color: var(--accent); font-style: normal; }
.welcome > div:first-child > p:last-child { max-width: 650px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.6; }
.welcome-side { display: flex; align-items: center; gap: 14px; }
.mascot-bubble { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); background: var(--green); }
.mascot-bubble > span { font-size: 30px; }
.mascot-bubble p { margin: 0; color: #5b665b; font-size: 11px; line-height: 1.35; }
.listen-button { min-height: 44px; padding: 0 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); font-weight: 700; cursor: pointer; }

.workspace { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 24px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.setup-panel { padding: 28px; }
.recipe-card { position: sticky; top: 94px; padding: 34px; overflow: hidden; }
.panel-heading > div, .result-top > div:first-child, .section-label { display: flex; align-items: center; gap: 9px; }
.panel-heading h2, .recipe-card > h2 { margin: 8px 0 0; font: 700 31px/1.05 "Fredoka", sans-serif; letter-spacing: -.025em; }
.step { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 9px; background: var(--yellow); font-size: 12px; font-weight: 800; }

.meal-counts { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: end; margin: 24px 0 16px; padding: 16px; border-radius: 14px; background: #f7f4ec; }
.meal-counts label, .people-control span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.segmented { display: flex; gap: 6px; }
.segmented button { min-width: 48px; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: white; font-size: 12px; font-weight: 800; cursor: pointer; }
.segmented button.active { color: white; border-color: var(--accent); background: var(--accent); }
.people-control { margin: 0 !important; }
.people-control input { width: 76px; height: 38px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: white; text-align: center; font-weight: 800; outline: none; }

.kitchen-stack { display: grid; gap: 10px; }
.house-card { padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.house-card.coral { border-left: 5px solid #ef8979; }
.house-card.mint { border-left: 5px solid #79b98b; }
.house-card.yellow { border-left: 5px solid #e7b849; }
.house-title { display: flex; align-items: center; gap: 10px; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: #f4f1e9; font-size: 21px; }
.house-title small { display: block; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.house-title h3 { margin: 0; font: 700 17px/1 "Fredoka", sans-serif; }
.neighbor-identity { position: relative; min-width: 0; flex: 1; }
.neighbor-name { width: min(190px, 100%); margin: 1px 0 0; padding: 3px 24px 3px 6px; border: 1px solid transparent; border-radius: 7px; color: var(--ink); background: linear-gradient(90deg, transparent 0 calc(100% - 22px), #f4f1e9 calc(100% - 22px)); font: 700 17px/1.2 "Fredoka", sans-serif; outline: none; }
.neighbor-name:hover { border-color: var(--line); }
.neighbor-name:focus { border-color: var(--accent); background: white; box-shadow: 0 0 0 3px var(--accent-soft); }
.neighbor-identity::after { content: "✎"; position: absolute; right: 6px; bottom: 4px; color: #8d958c; font-size: 11px; pointer-events: none; }
.ready { margin-left: auto; padding: 4px 8px; border-radius: 8px; color: #3f7950; background: #e7f4e9; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.ingredient-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; margin: 12px 0 10px; }
.ingredient { padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px; background: #fbfaf6; font-size: 11px; font-weight: 700; cursor: pointer; }
.ingredient b { margin-left: 4px; color: #9aa099; }
.add-form { display: flex; gap: 7px; }
.add-form input { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: white; font-size: 12px; }
.add-form input:focus, .people-control input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.add-form button { width: 36px; height: 36px; border: 0; border-radius: 10px; color: white; background: var(--ink); font-size: 19px; cursor: pointer; }
.pot-path { display: flex; justify-content: center; gap: 8px; margin: 14px 0; }
.pot-path span { width: 5px; height: 5px; border-radius: 50%; background: #c9cec7; }

.scanner { margin: 16px 0; padding: 16px; border: 1px dashed #c8cec5; border-radius: 14px; background: #f7f4ec; }
.scanner-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.scanner-heading small { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.scanner-heading h3 { margin: 2px 0 0; font: 700 18px/1.1 "Fredoka", sans-serif; }
.local-pill { padding: 5px 8px; border-radius: 8px; color: #3f7950; background: #e1f1e4; font-size: 9px; font-weight: 800; }
.scan-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 13px 0 9px; }
.scan-modes button { min-height: 36px; border: 1px solid var(--line); border-radius: 9px; background: white; font-size: 10px; font-weight: 800; cursor: pointer; }
.scan-modes button.active { color: white; border-color: var(--ink); background: var(--ink); }
.upload-drop { min-height: 66px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid var(--line); border-radius: 11px; background: white; cursor: pointer; }
.upload-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--accent); background: var(--accent-soft); font-size: 20px; }
.upload-drop b, .upload-drop small { display: block; font-size: 11px; }
.upload-drop small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.scan-preview { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; margin-top: 9px; }
.scan-preview img { width: 52px; height: 52px; border-radius: 9px; object-fit: cover; }
.scan-preview strong, .scan-preview small { display: block; font-size: 10px; }
.scan-preview small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.scan-preview button, .scan-result-actions button { min-height: 34px; padding: 0 11px; border: 0; border-radius: 9px; color: white; background: var(--accent); font-size: 10px; font-weight: 800; cursor: pointer; }
.scan-results { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.scan-results > p { margin: 0 0 8px; font-size: 10px; }
.scan-results > p b, .scan-results > p span { display: block; }
.scan-results > p span { color: var(--muted); font-size: 8px; }
#scanSuggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
#scanSuggestions input { position: absolute; opacity: 0; }
#scanSuggestions span { display: block; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: white; font-size: 9px; font-weight: 700; cursor: pointer; }
#scanSuggestions input:checked + span { border-color: #79b98b; background: #e2f2e5; }
#scanSuggestions small { display: block; margin-top: 2px; color: var(--muted); font-size: 7px; }
.scan-result-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.scan-result-actions button.secondary { color: var(--ink); border: 1px solid var(--line); background: white; }

.promise-block { padding-top: 4px; }
.section-label h3 { margin: 2px 0 0; font: 700 19px/1.1 "Fredoka", sans-serif; }
.preference-controls { margin-top: 16px; }
.choice-group small, details summary { display: block; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.choice-group > div { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.preference-controls input { position: absolute; opacity: 0; pointer-events: none; }
.choice-group label span, .allergy-grid label span { display: block; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: white; font-size: 11px; font-weight: 700; cursor: pointer; }
.preference-controls input:checked + span { color: #7b3228; border-color: #eea294; background: var(--accent-soft); }
details { margin-top: 12px; padding: 12px; border-radius: 12px; background: #f7f4ec; }
details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; float: right; color: var(--ink); font-size: 17px; }
details[open] summary::after { content: "−"; }
details summary b { margin-left: 6px; color: #9ca39b; font-size: 9px; letter-spacing: 0; text-transform: none; }
.allergy-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 11px; }
.allergy-grid label span { text-align: center; }
.safety-note { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.safety-note.alert { padding: 8px 10px; border-radius: 9px; color: #812e23; background: #ffe2dc; }
.cook-button { width: 100%; min-height: 58px; margin-top: 20px; display: flex; align-items: center; gap: 12px; padding: 0 16px; border: 0; border-radius: 14px; color: white; background: var(--accent); box-shadow: 0 8px 18px rgba(201,77,59,.23); text-align: left; cursor: pointer; }
.cook-button:hover { background: var(--accent-dark); }
.cook-button .cook-icon { font-size: 24px; }
.cook-button small { display: block; opacity: .75; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.cook-button b { margin-left: auto; font-size: 22px; }

.result-top { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.peper { position: relative; width: 62px; height: 56px; border-radius: 52% 48% 46% 54%; background: #ef6a54; box-shadow: inset -8px -7px 0 rgba(150,42,28,.12), 0 5px 0 #f8dc83; transform-origin: 50% 100%; }
.peper > i { position: absolute; inset: 7px 10px 10px; border-radius: 50%; background: rgba(255,255,255,.1); }
.peper-eye { position: absolute; top: 21px; width: 6px; height: 8px; border-radius: 50%; background: #243026; animation: blink 4s infinite; }
.peper-eye.left { left: 19px; } .peper-eye.right { right: 19px; }
.peper-mouth { position: absolute; left: 26px; top: 35px; width: 11px; height: 6px; border-bottom: 3px solid #243026; border-radius: 50%; }
.peper > b { position: absolute; top: -12px; left: 22px; transform: rotate(-18deg); font-size: 23px; }
.peper.speaking { animation: peperTalk .48s ease-in-out infinite alternate; }
.peper.speaking .peper-mouth { width: 10px; height: 10px; border: 3px solid #243026; border-top-width: 1px; border-radius: 50%; }
@keyframes blink { 0%,45%,49%,100% { transform: scaleY(1); } 47% { transform: scaleY(.1); } }
@keyframes peperTalk { to { transform: translateY(-7px) rotate(4deg); box-shadow: inset -8px -7px 0 rgba(150,42,28,.12), 0 12px 0 #f8dc83; } }
.recipe-card > h2 { max-width: 15ch; margin-top: 20px; font-size: clamp(36px, 4vw, 50px); line-height: 1.08; }
.recipe-tagline { max-width: 62ch; margin: 12px 0 20px; color: var(--muted); font-size: 15px; line-height: 1.7; }
.recipe-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.recipe-meta span { padding: 7px 10px; border-radius: 8px; background: #f4f1e9; font-size: 11px; font-weight: 800; line-height: 1.35; }
.dish-visual { position: relative; margin: 18px 0 0; overflow: hidden; border-radius: 15px; background: #eee8dc; }
.dish-visual img { display: block; width: 100%; height: 230px; object-fit: cover; }
.dish-visual figcaption { position: absolute; right: 10px; bottom: 10px; max-width: calc(100% - 20px); padding: 7px 9px; border-radius: 7px; color: white; background: rgba(24,32,25,.8); font-size: 10px; line-height: 1.4; }
.verified-strip { display: flex; gap: 11px; align-items: center; margin-top: 12px; padding: 13px 14px; border-radius: 11px; color: #386c48; background: #e5f3e7; }
.verified-strip > span { display: grid; place-items: center; flex: 0 0 24px; height: 24px; border-radius: 50%; color: white; background: #52a36b; font-weight: 900; }
.verified-strip p { margin: 0; font-size: 11px; line-height: 1.5; }
.verified-strip b, .verified-strip small { display: block; }
.verified-strip small { margin-top: 2px; color: #59705f; font-size: 10px; }
.verified-strip a { text-decoration: underline; }
.ingredient-columns { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; margin-top: 26px; }
.ingredient-columns .recipe-block { margin-top: 0; padding: 18px; border-radius: 14px; background: #f7f4ec; }
.ingredient-columns ul { margin: 0; padding: 0; list-style: none; }
.ingredient-columns li { display: flex; justify-content: space-between; gap: 14px; margin: 0; padding: 9px 0; border-bottom: 1px solid rgba(36,48,38,.1); color: #586158; font-size: 11px; line-height: 1.5; }
.ingredient-columns li:last-child { border: 0; }
.ingredient-columns li b { color: var(--ink); font-size: 12px; }
.ingredient-columns li span { flex: 0 0 42%; color: #6e786f; text-align: right; }
.missing-block { background: #fff1e4 !important; }
.recipe-block { margin-top: 28px; }
.recipe-block h3, .info-box h3, .nutrition-box h3 { margin: 0 0 14px; font: 700 18px/1.2 "Fredoka", sans-serif; }
.recipe-block ol { display: grid; gap: 10px; margin: 0; padding: 0; color: #535e55; list-style: none; }
.recipe-block ol li { margin: 0; padding: 14px 16px; border: 1px solid #e3e5df; border-radius: 12px; background: #fbfaf6; }
.recipe-block ol li b { display: block; margin-bottom: 6px; color: var(--accent-dark); font-size: 11px; letter-spacing: .03em; text-transform: uppercase; }
.recipe-block ol li span { display: block; font-size: 13px; line-height: 1.65; }
.compact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.info-box { min-height: 118px; padding: 18px; border-radius: 14px; background: #f7f4ec; }
.info-box p { margin: 0; color: #5f685f; font-size: 12px; line-height: 1.65; }
#sharePlan { display: grid; gap: 9px; }
#sharePlan > span { display: block; padding-bottom: 9px; border-bottom: 1px solid rgba(36,48,38,.1); }
#sharePlan > span:last-child { padding-bottom: 0; border-bottom: 0; }
#sharePlan b { display: block; margin-bottom: 2px; color: var(--ink); }
.used-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.used-chips span { padding: 6px 8px; border-radius: 7px; background: white; font-size: 10px; font-weight: 700; line-height: 1.3; }

.nutrition-box { margin-top: 14px; padding: 20px; border-radius: 14px; background: var(--green); }
.nutrition-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nutrition-heading small { display: block; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.nutrition-heading h3 { margin: 3px 0 0; font-size: 19px; }
.nutrition-heading strong { padding: 8px 10px; border-radius: 10px; background: white; font: 700 18px/1 "Fredoka", sans-serif; }
.nutrition-box dl { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 22px; margin: 16px 0 0; }
.nutrition-box dl div { display: flex; justify-content: space-between; padding-bottom: 7px; border-bottom: 1px solid rgba(36,48,38,.12); font-size: 11px; }
.nutrition-box dt { color: #617063; }
.nutrition-box dd { margin: 0; font-weight: 800; }
.nutrition-box > p { margin: 12px 0 0; color: #667267; font-size: 10px; line-height: 1.55; }
.recipe-actions { display: flex; gap: 10px; margin-top: 18px; }
.action-button { min-height: 46px; padding: 0 16px; border: 1px solid var(--line); border-radius: 11px; background: white; font-size: 12px; font-weight: 800; cursor: pointer; }
.action-button.primary { color: white; border-color: var(--ink); background: var(--ink); }

.model-dock { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.model-intro, .model-card { min-height: 58px; display: flex; align-items: center; gap: 8px; padding: 9px; border: 0; border-radius: 11px; background: #f7f4ec; text-align: left; }
.model-intro > span, .model-card > span { font-size: 20px; }
.model-intro p { margin: 0; font-size: 9px; }
.model-intro small, .model-card small, .model-card em { display: block; color: var(--muted); font-size: 8px; font-style: normal; }
.model-card { cursor: pointer; }
.model-card strong { display: block; font-size: 10px; }

footer { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 24px 4px 34px; display: flex; align-items: center; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
footer span { color: var(--ink); font: 700 16px/1 "Fredoka"; }
footer p { margin-right: auto; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translate(-50%, 100px); padding: 11px 16px; border-radius: 11px; color: white; background: var(--ink); box-shadow: var(--shadow); font-size: 11px; font-weight: 800; transition: transform .2s ease; }
.toast.show { transform: translate(-50%, 0); }
.recipe-card.thinking .peper { animation: peperTalk .48s ease-in-out infinite alternate; }

@media (max-width: 980px) {
  .welcome { align-items: flex-end; }
  .mascot-bubble { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .recipe-card { position: static; }
}

@media (max-width: 640px) {
  .topbar { height: 64px; padding-inline: 14px; }
  .topbar-note { display: none; }
  .model-status { margin-left: auto; width: 42px; padding: 0; justify-content: center; }
  .model-status #brainLabel { display: none; }
  .app-shell { width: min(100% - 20px, 1180px); padding-top: 24px; }
  .welcome { display: block; }
  .welcome h1 { font-size: 43px; }
  .welcome-side { margin-top: 18px; }
  .setup-panel, .recipe-card { padding: 20px; }
  .meal-counts { grid-template-columns: 1fr; }
  .segmented button { flex: 1; }
  .people-control input { width: 100%; }
  .allergy-grid, .compact-grid, .nutrition-box dl, .ingredient-columns { grid-template-columns: 1fr; }
  .scan-preview { grid-template-columns: 48px 1fr; }
  .scan-preview button { grid-column: 1 / -1; }
  .dish-visual img { height: 200px; }
  .model-dock { grid-template-columns: 1fr; }
  footer { flex-direction: column; align-items: flex-start; gap: 6px; }
  footer p { margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
