:root {
  --ink: #172019;
  --muted: #667068;
  --paper: #ffffff;
  --canvas: #f6f4ef;
  --line: #d8d8d1;
  --line-strong: #aeb4ad;
  --accent: #315f70;
  --accent-dark: #214653;
  --accent-soft: #e7f0f2;
  --sand: #e6d6aa;
  --lavender: #cfcce1;
  --slate: #a9b9bd;
  --shadow: 0 7px 0 rgba(23, 32, 25, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
input { font: inherit; }

button,
label { -webkit-tap-highlight-color: transparent; }

a { color: inherit; }

[hidden] { display: none !important; }

.shell {
  width: min(100% - 32px, 1040px);
  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;
}

.hero {
  max-width: 760px;
  padding: 54px 0 26px;
}

.product-name,
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.product-name { font-size: 13px; }

.hero h1,
.guide h2,
.faq h2 {
  margin: 0;
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.hero h1 {
  max-width: 710px;
  font-size: clamp(34px, 6vw, 58px);
}

.hero-lead {
  margin: 22px 0 2px;
  color: var(--ink);
  font-size: 21px;
  font-weight: 800;
}

.hero > p:last-child {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.tool,
.results {
  max-width: 760px;
  scroll-margin-top: 88px;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.tool { padding: 26px; }

.tool-heading,
.result-top,
.section-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.tool-heading {
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.tool-heading h2,
.results h3,
.meaning h3 {
  margin: 0;
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.tool-heading h2 { font-size: 26px; }

.unit-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(70px, 1fr));
  margin: 0;
  padding: 4px;
  background: #eeeee9;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
}

.unit-switch label { cursor: pointer; }

.unit-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.unit-switch span {
  display: grid;
  min-height: 44px;
  padding: 0 14px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 800;
}

.unit-switch input:checked + span {
  background: var(--paper);
  border-color: var(--ink);
  box-shadow: 0 2px 0 rgba(23, 32, 25, 0.12);
}

.unit-switch input:focus-visible + span,
button:focus-visible,
input:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid #75a9bd;
  outline-offset: 3px;
}

#bmiForm { padding-top: 24px; }

.measurement-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
  gap: 16px;
  align-items: end;
}

.metric-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.height-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0;
}

.height-group legend,
.field > span:first-child {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.height-group legend {
  grid-column: 1 / -1;
  margin-bottom: -3px;
}

.compact-field > span:first-child {
  color: var(--muted);
  font-size: 13px;
}

.input-with-unit {
  display: flex;
  min-height: 56px;
  align-items: center;
  overflow: hidden;
  background: #fbfbf8;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.input-with-unit:focus-within {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(49, 95, 112, 0.13);
}

.input-with-unit:has(input[aria-invalid="true"]) {
  border-color: #a65945;
  box-shadow: 0 0 0 3px rgba(166, 89, 69, 0.11);
}

.input-with-unit input {
  width: 100%;
  min-width: 0;
  height: 54px;
  padding: 0 4px 0 16px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 20px;
  font-weight: 800;
}

.input-with-unit input::placeholder { color: #a9afa9; }

.input-with-unit b {
  flex: 0 0 auto;
  padding: 0 15px 0 7px;
  color: var(--muted);
  font-size: 14px;
}

.form-status {
  min-height: 24px;
  margin: 13px 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.form-status.is-error { color: #8d422f; }

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 54px;
  padding: 13px 22px;
  cursor: pointer;
  border: 2px solid var(--ink);
  border-radius: 14px;
  font-weight: 900;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.primary-button {
  color: #fff;
  background: var(--accent-dark);
  box-shadow: 0 4px 0 var(--ink);
  font-size: 18px;
}

.primary-button:hover { background: var(--accent); }

.primary-button:active,
.secondary-button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

.privacy-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.privacy-note > span,
.tool-note > span {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  margin-top: 6px;
  background: #2b806b;
  border-radius: 50%;
}

.privacy-note p { margin: 0; color: var(--muted); font-size: 14px; }
.privacy-note strong { color: var(--ink); }

.results {
  margin-top: 28px;
  padding: 0;
  animation: reveal 240ms ease-out both;
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-top {
  align-items: center;
  padding: 28px;
  color: #fff;
  background: var(--accent-dark);
  border-radius: 16px 16px 0 0;
}

.result-top .eyebrow { color: #cae2e8; }

.result-top h2 { margin: 0; line-height: 0.9; }

#bmiValue {
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  font-size: clamp(58px, 16vw, 82px);
  letter-spacing: -0.07em;
}

.category-badge {
  margin: 0;
  padding: 9px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}

.bmi-range,
.healthy-range,
.scenario,
.meaning { padding: 26px 28px; border-bottom: 1px solid var(--line); }

.results h3,
.meaning h3 { font-size: 20px; }

.section-title-row > span {
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.bmi-track-wrap { position: relative; margin-top: 38px; padding-top: 8px; }

.bmi-track {
  display: grid;
  grid-template-columns: 6.5fr 6.5fr 5fr 10fr;
  height: 18px;
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 999px;
}

.bmi-track i:nth-child(1) { background: #d9e2e3; }
.bmi-track i:nth-child(2) { background: #bcd9d2; }
.bmi-track i:nth-child(3) { background: var(--sand); }
.bmi-track i:nth-child(4) { background: var(--lavender); }

.bmi-marker {
  position: absolute;
  top: -22px;
  left: 0;
  width: 2px;
  height: 36px;
  background: var(--ink);
  transform: translateX(-1px);
  transition: left 240ms ease;
  z-index: 2;
}

.bmi-marker span {
  position: absolute;
  top: -1px;
  left: 50%;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.bmi-thresholds { position: relative; height: 23px; color: var(--muted); font-size: 11px; }
.bmi-thresholds span { position: absolute; top: 4px; transform: translateX(-50%); }
.bmi-thresholds span:nth-child(1) { left: 0; transform: none; }
.bmi-thresholds span:nth-child(2) { left: 23.21%; }
.bmi-thresholds span:nth-child(3) { left: 46.43%; }
.bmi-thresholds span:nth-child(4) { left: 64.29%; }
.bmi-thresholds span:nth-child(5) { right: 0; left: auto; transform: none; }

.bmi-labels {
  display: grid;
  grid-template-columns: 6.5fr 6.5fr 5fr 10fr;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.bmi-labels span:not(:first-child) { text-align: center; }
.bmi-labels span:last-child { text-align: right; }

.range-number {
  margin: 9px 0 32px;
  color: var(--accent-dark);
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  font-size: clamp(34px, 9vw, 48px);
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.weight-track-wrap { position: relative; }

.weight-track {
  position: relative;
  height: 13px;
  background: #e9e9e4;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}

.weight-track i {
  position: absolute;
  inset: -1px 23.68%;
  background: #bcd9d2;
  border: 1px solid var(--ink);
  border-radius: 999px;
}

.weight-marker {
  position: absolute;
  bottom: -9px;
  left: 50%;
  width: 20px;
  height: 30px;
  background: var(--ink);
  clip-path: polygon(50% 0, 100% 36%, 67% 36%, 67% 100%, 33% 100%, 33% 36%, 0 36%);
  transform: translateX(-50%);
  transition: left 240ms ease;
}

.weight-marker span { display: none; }

.weight-endpoints {
  display: flex;
  justify-content: space-between;
  margin: 14px 23.68% 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.position-copy { margin: 18px 0 0; font-size: 17px; font-weight: 800; }

.text-button {
  padding: 4px 0;
  color: var(--accent-dark);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.scenario-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.scenario-buttons button {
  min-height: 48px;
  padding: 8px 5px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  cursor: pointer;
  font-weight: 800;
}

.scenario-buttons button:hover,
.scenario-buttons button.is-active { background: var(--accent-soft); border-color: var(--accent); }

.scenario-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  padding: 16px;
  background: #f7f7f3;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.scenario-result > div:not(.scenario-arrow) { display: grid; gap: 1px; }
.scenario-result span { color: var(--muted); font-size: 12px; }
.scenario-result strong { font-size: 18px; }
.scenario-result small { color: var(--accent-dark); font-size: 14px; font-weight: 800; }
.scenario-arrow { color: var(--muted); font-size: 22px; }

.meaning { background: #fbfbf8; }
.meaning p { margin: 10px 0 0; color: #4f5952; }

.secondary-button {
  display: block;
  width: calc(100% - 56px);
  margin: 24px 28px 28px;
  background: #fff;
  box-shadow: 0 3px 0 var(--ink);
  font-size: 17px;
}

.tool-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 11px;
  align-items: start;
  max-width: 760px;
  margin-top: 28px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
}

.tool-note p { margin: 0; color: var(--muted); font-size: 14px; }
.tool-note strong { color: var(--ink); }
.tool-note b { font-size: 13px; white-space: nowrap; }

.guide,
.faq {
  max-width: 760px;
  margin-top: 72px;
}

.guide-heading {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--ink);
}

.guide h2,
.faq h2 { font-size: clamp(30px, 6vw, 44px); }
.guide-heading > p:last-child { margin: 14px 0 0; color: var(--muted); font-size: 17px; }

.guide > section { padding: 27px 0; border-bottom: 1px solid var(--line); }
.guide h3 { margin: 0 0 9px; font-size: 21px; }
.guide section > p { margin: 0 0 12px; color: #4f5952; }
.guide section > p:last-child { margin-bottom: 0; }

.range-list,
.formula-list,
.height-examples {
  margin: 17px 0;
  padding: 0;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
}

.range-list { list-style: none; }
.range-list li,
.height-examples div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.range-list li:last-child,
.height-examples div:last-child { border-bottom: 0; }
.range-list span { color: var(--muted); }

.formula-list p { margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.formula-list p:last-child { border-bottom: 0; }

.height-examples div { margin: 0; }
.height-examples dt { font-weight: 800; }
.height-examples dd { margin: 0; color: var(--muted); }

.source-note { font-size: 14px; }
.source-note a { color: var(--accent-dark); font-weight: 700; text-underline-offset: 3px; }

.faq { margin-bottom: 76px; }
.faq h2 { margin-bottom: 22px; }
.faq details { border-top: 1px solid var(--line-strong); }
.faq details:last-child { border-bottom: 1px solid var(--line-strong); }
.faq summary { padding: 17px 2px; cursor: pointer; font-size: 17px; font-weight: 800; }
.faq details p { max-width: 680px; margin: -5px 0 18px; color: var(--muted); }

@media (max-width: 620px) {
  .shell { width: min(100% - 24px, 1040px); }
  .hero { padding: 35px 0 20px; }
  .hero h1 { font-size: clamp(32px, 10vw, 42px); }
  .hero-lead { margin-top: 17px; font-size: 19px; }
  .hero > p:last-child { font-size: 16px; }

  .tool { padding: 20px; border-radius: 16px; }
  .tool-heading { align-items: flex-start; }
  .tool-heading h2 { font-size: 23px; }
  .unit-switch { grid-template-columns: repeat(2, minmax(59px, 1fr)); }
  .unit-switch span { min-height: 42px; padding-inline: 10px; }

  .measurement-fields { grid-template-columns: 1fr; gap: 15px; }
  .height-group { gap: 10px; }
  .weight-field { margin-top: 0; }
  .input-with-unit { min-height: 55px; }
  .input-with-unit input { font-size: 19px; }

  .result-top,
  .bmi-range,
  .healthy-range,
  .scenario,
  .meaning { padding: 22px 20px; }
  .result-top { border-radius: 14px 14px 0 0; }
  #bmiValue { font-size: 64px; }
  .category-badge { max-width: 126px; padding: 8px 11px; }
  .section-title-row { display: block; }
  .section-title-row > span { display: block; margin-top: 4px; text-align: left; }
  .bmi-range .section-title-row h3 { max-width: 270px; }
  .bmi-labels { font-size: 10px; }
  .range-number { font-size: 37px; }
  .weight-endpoints { margin-inline: 23.68%; font-size: 10px; }
  .position-copy { font-size: 16px; }
  .scenario .section-title-row { display: flex; align-items: flex-start; }
  .scenario-buttons { gap: 6px; }
  .scenario-buttons button { font-size: 13px; }
  .scenario-result { gap: 8px; padding: 13px; }
  .scenario-result strong { font-size: 16px; }
  .scenario-arrow { font-size: 18px; }
  .secondary-button { width: calc(100% - 40px); margin: 21px 20px 24px; }

  .tool-note { grid-template-columns: auto minmax(0, 1fr); }
  .tool-note b { grid-column: 2; }
  .guide, .faq { margin-top: 58px; }
  .range-list li, .height-examples div { gap: 12px; }
}

@media (max-width: 370px) {
  .tool-heading { display: block; }
  .unit-switch { margin-top: 16px; }
  .scenario-result { grid-template-columns: 1fr; }
  .scenario-arrow { transform: rotate(90deg); text-align: center; }
}

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