:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-alt: #f5f0e8;
  --text: #2c2418;
  --text-muted: #6b5e4e;
  --border: #e4ddd1;
  --accent: #c4652a;
  --accent-dark: #a85220;
  --accent-light: #f4e4d6;
  --success: #3d8b5e;
  --warning: #b8860b;
  --focus: #c4652a;
  --shadow-sm: 0 1px 2px rgba(44,36,24,0.06);
  --shadow-md: 0 4px 12px rgba(44,36,24,0.08);
  --radius: 8px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent-dark); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}
.brand:hover { text-decoration: none; color: var(--accent); }
.brand-icon { color: var(--accent); }

.site-nav {
  display: flex;
  gap: 20px;
  font-size: 0.92rem;
}
.site-nav a {
  color: var(--text-muted);
  font-weight: 500;
  padding: 6px 2px;
}
.site-nav a:hover { color: var(--accent); text-decoration: none; }
.site-nav .ext-link::after {
  content: " →";
  font-size: 0.85em;
}

main { max-width: 1200px; margin: 0 auto; padding: 0 24px 60px; }

.hero {
  padding: 60px 0 40px;
}
.hero-inner { max-width: 720px; }
.hero h1 {
  font-size: 2.6rem;
  line-height: 1.15;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}
.hero-sub {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 0 28px;
}
.hero-stats {
  display: flex;
  gap: 28px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.stat { display: flex; flex-direction: column; }
.stat strong { font-size: 1.3rem; color: var(--accent); }
.stat span { font-size: 0.85rem; color: var(--text-muted); }

.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); text-decoration: none; color: white; }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border-color: transparent;
  padding: 8px 12px;
}
.btn-ghost:hover { background: var(--accent-light); text-decoration: none; }

.btn-icon {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.btn-icon:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-light); }

.workspace { padding: 40px 0; }
.workspace h2 { font-size: 1.8rem; margin: 0 0 8px; }
.workspace-intro { color: var(--text-muted); margin: 0 0 28px; max-width: 640px; }

.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.panel-header h3 { margin: 0; font-size: 1.15rem; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; }
.preset-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}
.preset-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

.field-row { margin-bottom: 18px; }
.field-row label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
}
.hint { font-weight: 400; color: var(--text-muted); font-size: 0.83rem; }

input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196,101,42,0.15);
}
.field-row.half {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ingredient-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ingredient-row {
  display: grid;
  grid-template-columns: 90px 1fr 130px 32px;
  gap: 8px;
  align-items: center;
}
.ingredient-row input, .ingredient-row select { padding: 8px 10px; font-size: 0.9rem; }
.ingredient-row .remove-row {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.3rem;
  padding: 4px;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ingredient-row .remove-row:hover { background: #fde8e8; color: #c0392b; }

.actions { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

.scale-summary {
  background: var(--accent-light);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.ratio-badge {
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 6px 14px;
  border-radius: 20px;
}
.scale-note { font-size: 0.92rem; color: var(--text); }

.output-list { display: flex; flex-direction: column; gap: 6px; }
.output-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-alt);
  border-radius: var(--radius);
  align-items: start;
}
.output-amount { font-weight: 600; color: var(--accent-dark); }
.output-detail { font-size: 0.88rem; color: var(--text-muted); grid-column: 1 / -1; }
.output-note {
  font-size: 0.8rem;
  color: var(--warning);
  font-style: italic;
  grid-column: 1 / -1;
}
.output-row.has-note { border-left: 3px solid var(--warning); }

.output-actions { display: flex; gap: 8px; }

.pan-note {
  margin-top: 16px;
  padding: 12px 16px;
  background: #eef6f0;
  border: 1px solid #c8e4d2;
  border-radius: var(--radius);
  font-size: 0.92rem;
  color: var(--success);
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state svg { margin-bottom: 12px; opacity: 0.5; }
.empty-state.small { padding: 24px 20px; }
.empty-sub { font-size: 0.88rem; }

.reference { padding: 48px 0; }
.reference h2 { font-size: 1.7rem; margin: 0 0 12px; }
.ref-lead { color: var(--text-muted); max-width: 680px; margin: 0 0 28px; }
.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-bottom: 36px;
}
.ref-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.ref-card h3 { margin: 0 0 10px; font-size: 1.05rem; color: var(--accent-dark); }
.ref-card p { margin: 0; font-size: 0.92rem; color: var(--text-muted); }

.scenario {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 32px;
}
.scenario h3 { margin: 0 0 18px; }
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}
.scenario-grid h4 { margin: 0 0 10px; font-size: 0.95rem; color: var(--text-muted); }
.scenario-grid ul { margin: 0; padding-left: 20px; font-size: 0.92rem; }
.scenario-grid li { margin-bottom: 4px; }
.scenario-grid div:last-child { background: #eef6f0; padding: 14px; border-radius: var(--radius); }

.mistakes {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 32px;
}
.mistakes h3 { margin: 0 0 16px; }
.mistakes ul { margin: 0; padding-left: 20px; }
.mistakes li { margin-bottom: 10px; font-size: 0.93rem; }

.faq { margin-bottom: 32px; }
.faq h3 { margin: 0 0 16px; }
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 8px;
}
.faq summary { cursor: pointer; font-weight: 600; color: var(--accent-dark); }
.faq details[open] summary { margin-bottom: 10px; }
.faq p { margin: 0; font-size: 0.92rem; color: var(--text-muted); }

.saved-section { padding: 20px 0 60px; }
.saved-section h2 { font-size: 1.5rem; margin: 0 0 8px; }
.saved-intro { color: var(--text-muted); margin: 0 0 20px; }
.saved-list { display: flex; flex-direction: column; gap: 12px; }
.saved-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.saved-card-info h4 { margin: 0 0 4px; font-size: 1rem; }
.saved-card-info p { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
.saved-card-actions { display: flex; gap: 8px; flex-shrink: 0; }

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: 2fr 1fr auto;
  gap: 24px;
  align-items: start;
  font-size: 0.88rem;
}
.footer-inner strong { display: block; margin-bottom: 4px; }
.footer-inner p { margin: 0; color: var(--text-muted); }
.footer-inner nav { display: flex; flex-direction: column; gap: 6px; }
.updated { color: var(--text-muted); font-size: 0.8rem; }

@media (max-width: 900px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  .footer-inner { grid-template-columns: 1fr; }
  .ingredient-row { grid-template-columns: 70px 1fr 110px 32px; }
}
@media (max-width: 560px) {
  .header-inner { padding: 12px 16px; }
  main { padding: 0 16px 40px; }
  .hero { padding: 36px 0 24px; }
  .hero h1 { font-size: 1.65rem; }
  .panel { padding: 18px; }
  .ingredient-row { grid-template-columns: 60px 1fr 100px 32px; font-size: 0.85rem; }
  .field-row.half { grid-template-columns: 1fr; }
  .hero-stats { gap: 18px; }
}

@media print {
  .site-header, .site-footer, .actions, .output-actions, .presets, .btn-ghost, #add-row, #clear-btn { display: none !important; }
  .workspace-grid { grid-template-columns: 1fr 1fr; }
  .panel { box-shadow: none; border: 1px solid #ccc; }
  body { background: white; }
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
  z-index: 100;
  animation: toast-in 0.3s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}


/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
