:root {
  --bg: #fbf7f2;
  --surface: #ffffff;
  --surface-2: #f4ece2;
  --text: #2b2420;
  --muted: #6e625a;
  --border: #e6dbcf;
  --accent: #b4532a;
  --accent-ink: #ffffff;
  --accent-soft: #f7e3d8;
  --good: #2f7d4f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 16px rgba(60, 40, 20, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1714;
    --surface: #25201c;
    --surface-2: #2e2823;
    --text: #f1e9e1;
    --muted: #b3a69b;
    --border: #3b332d;
    --accent: #e0835a;
    --accent-ink: #1b1714;
    --accent-soft: #3a2a21;
    --good: #6cc391;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 56px; gap: 12px; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; display: flex; gap: 8px; align-items: center; }
.brand-mark { color: var(--accent); font-size: 1.3rem; }
.menu { position: relative; }
.menu summary { cursor: pointer; list-style: none; padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px; font-weight: 600; font-size: .95rem; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: " ▾"; color: var(--muted); }
.nav { position: absolute; right: 0; top: calc(100% + 8px); margin: 0; padding: 8px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 230px; }
.nav { max-height: 75vh; overflow-y: auto; }
.nav-group { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px 4px; }
.nav a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
.nav a:hover, .nav a[aria-current] { background: var(--accent-soft); color: var(--accent); }

/* Content */
main { padding-top: 24px; padding-bottom: 48px; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.2; margin: 8px 0 8px; }
h2 { font-size: 1.3rem; margin: 36px 0 10px; }
h3 { font-size: 1.05rem; margin: 22px 0 6px; }
.lead { color: var(--muted); font-size: 1.08rem; margin: 0 0 20px; }
.crumbs { font-size: .88rem; color: var(--muted); }
.crumbs a { color: var(--muted); }

/* Tool card */
.tool { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea { min-height: 180px; resize: vertical; }
button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px; padding: 10px 16px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
}
button.ghost { background: transparent; color: var(--accent); }
button.icon { padding: 6px 10px; background: transparent; color: var(--muted); border-color: var(--border); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.result { margin-top: 18px; background: var(--accent-soft); border-radius: 12px; padding: 16px; }
.result-main { font-size: 1.6rem; font-weight: 700; color: var(--accent); line-height: 1.2; }
.result-sub { color: var(--muted); margin-top: 4px; }
.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 18px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 1.25rem; }
.stat span { color: var(--muted); font-size: .88rem; }

table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .95rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* Recipe cost rows */
.rows { display: grid; gap: 10px; }
.row { display: grid; gap: 8px; grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto; align-items: end; background: var(--surface-2); padding: 10px; border-radius: 12px; }
.row label { font-size: .78rem; margin-bottom: 4px; }
.row .cost { font-weight: 700; padding: 10px 0; white-space: nowrap; }
@media (max-width: 680px) {
  .row { grid-template-columns: 1fr 1fr; }
  .row .name { grid-column: 1 / -1; }
}

/* Notes & home */
.note { border-left: 4px solid var(--accent); background: var(--surface); padding: 14px 16px; border-radius: 0 12px 12px 0; margin: 20px 0; }
.note strong { color: var(--accent); }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 20px; }
.card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: border-color .15s; }
.card:hover { border-color: var(--accent); }
.card h2, .card h3 { margin: 0 0 6px; font-size: 1.1rem; color: var(--accent); }
.search { position: relative; margin: 8px 0 4px; }
.search input { font-size: 1.1rem; padding: 14px 16px 14px 44px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); }
.search::before { content: "⌕"; position: absolute; left: 16px; top: 50%; transform: translateY(-52%); font-size: 1.3rem; color: var(--muted); }
.group-title { margin-top: 28px; }
.empty { color: var(--muted); margin-top: 16px; }
.tabs { display: flex; gap: 6px; background: var(--surface-2); padding: 4px; border-radius: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { flex: 1; background: transparent; color: var(--text); border: 0; padding: 9px 10px; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.check input { width: auto; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.faq details { border-bottom: 1px solid var(--border); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; }

.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#out li { margin: 4px 0; }
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .88rem; padding: 20px 0 32px; }
.foot-links { list-style: none; padding: 0; margin: 0 0 8px; display: flex; gap: 16px; flex-wrap: wrap; }
.foot-links a { color: var(--muted); }
