:root {
  color-scheme: light;
  --bg: #f5f6f2;
  --panel: #ffffff;
  --text: #181a17;
  --muted: #6d716a;
  --line: #dfe2da;
  --accent: #e5ff50;
  --accent-soft: #f4ffc2;
  --dark: #1c211a;
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }

.site-header {
  background: rgba(245, 246, 242, 0.95);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}
.header-inner, .footer-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 850;
  letter-spacing: -0.035em;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--dark);
  color: var(--accent);
  font-weight: 900;
}
.beta-pill, .system-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: .78rem;
  font-weight: 750;
}

.page { padding: 56px 0 72px; }
.intro { max-width: 720px; margin-bottom: 30px; }
.eyebrow, .section-kicker {
  margin: 0 0 7px;
  font-size: .74rem;
  letter-spacing: .13em;
  font-weight: 850;
}
.section-kicker { color: var(--muted); }
h1, h2, p { margin-top: 0; }
h1 {
  font-size: clamp(2.2rem, 6vw, 4.7rem);
  line-height: .98;
  letter-spacing: -0.055em;
  margin-bottom: 16px;
  max-width: 900px;
}
.lede {
  color: var(--muted);
  font-size: 1.08rem;
  max-width: 620px;
  margin-bottom: 0;
}

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
  gap: 22px;
  align-items: start;
}
.input-panel, .results-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.input-panel { padding: 10px 24px; }
.results-panel {
  padding: 24px;
  position: sticky;
  top: 92px;
}
.section-block { padding: 24px 0; border-bottom: 1px solid var(--line); }
.section-block:last-child { border-bottom: 0; }
.section-block h2, .results-heading h2 {
  font-size: 1.16rem;
  margin-bottom: 0;
  letter-spacing: -0.02em;
}
.section-heading-row, .results-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}
.tiny-note { color: var(--muted); font-size: .8rem; margin: 21px 0 0; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 18px 0;
  padding: 5px;
  border-radius: 14px;
  background: var(--bg);
}
.segmented input, .choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { position: relative; }
.segmented span {
  display: block;
  padding: 10px 12px;
  text-align: center;
  border-radius: 10px;
  font-size: .92rem;
  font-weight: 720;
  cursor: pointer;
}
.segmented input:checked + span { background: var(--panel); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.segmented input:focus-visible + span, .choice-card input:focus-visible + span { outline: 3px solid rgba(0,0,0,.22); outline-offset: 2px; }

.input-set { margin-top: 16px; }
.two-col { grid-template-columns: 1fr 1fr; gap: 14px; }
.field-label { display: block; font-size: .82rem; font-weight: 750; margin-bottom: 7px; }
.input-with-unit {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  background: #fff;
}
.input-with-unit:focus-within { outline: 3px solid var(--accent-soft); border-color: #9da74b; }
.input-with-unit input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 15px 0;
  color: var(--text);
  background: transparent;
  font-size: 1.08rem;
  font-weight: 720;
}
.input-with-unit span { color: var(--muted); font-size: .84rem; white-space: nowrap; }
.input-with-unit.compact { width: 160px; }

.choice-grid { display: grid; gap: 9px; margin-top: 16px; }
.choice-grid.three { grid-template-columns: repeat(3, 1fr); }
.choice-grid.four { grid-template-columns: repeat(4, 1fr); }
.choice-card { position: relative; }
.choice-card span {
  min-height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px 8px;
  font-weight: 780;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.choice-card span:hover { transform: translateY(-1px); border-color: #b9bdb3; }
.choice-card input:checked + span { background: var(--dark); color: white; border-color: var(--dark); }
.choice-card.small span { min-height: 46px; font-size: .9rem; }
.custom-waste { margin-top: 14px; }
.hidden { display: none !important; }

.results-heading { margin-bottom: 18px; }
.results-heading .eyebrow { margin-bottom: 5px; }
.system-badge { background: var(--accent); border-color: #d2e63d; }
.results-list { border-top: 1px solid var(--line); }
.result-row {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}
.primary-result { min-height: 88px; }
.result-label, .result-helper { display: block; }
.result-label { font-weight: 790; }
.result-helper { color: var(--muted); font-size: .78rem; margin-top: 3px; }
.result-number { display: flex; align-items: baseline; gap: 6px; text-align: right; }
.result-number strong { font-size: 1.72rem; letter-spacing: -0.04em; }
.primary-result .result-number strong { font-size: 2rem; }
.result-number span { color: var(--muted); font-size: .76rem; font-weight: 750; }

.math-toggle {
  width: 100%;
  margin-top: 18px;
  border: 0;
  border-radius: 13px;
  padding: 14px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--dark);
  color: white;
  font-weight: 800;
}
.math-toggle:hover { opacity: .94; }
.math-panel {
  margin-top: 10px;
  border-radius: 13px;
  padding: 14px;
  background: #f0f2eb;
}
.math-line {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 0;
  border-bottom: 1px solid #d9dcd4;
  font-size: .82rem;
}
.math-line:last-of-type { border-bottom: 0; }
.math-line code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-align: right; }
.math-note, .disclaimer { color: var(--muted); font-size: .75rem; line-height: 1.45; }
.math-note { margin: 12px 0 0; }
.disclaimer { margin: 16px 0 0; }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.footer-inner { min-height: 72px; }

@media (max-width: 860px) {
  .calculator-grid { grid-template-columns: 1fr; }
  .results-panel { position: static; }
  .page { padding-top: 38px; }
}
@media (max-width: 560px) {
  .shell { width: min(100% - 20px, 1120px); }
  .site-header .shell { width: min(100% - 24px, 1120px); }
  .page { padding-bottom: 46px; }
  h1 { font-size: 2.55rem; }
  .input-panel, .results-panel { border-radius: 15px; }
  .input-panel { padding: 6px 16px; }
  .results-panel { padding: 18px 16px; }
  .choice-grid.three { grid-template-columns: 1fr 1fr 1fr; }
  .choice-grid.four { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .footer-inner { align-items: flex-start; justify-content: center; flex-direction: column; gap: 4px; }
  .math-line { flex-direction: column; gap: 4px; }
  .math-line code { text-align: left; }
}
