:root {
  color-scheme: light;
  font: 100%/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #142844;
  background: #edf5ff;
  --ink: #142844;
  --muted: #465e7a;
  --blue: #1558ba;
  --line: #d5e3f3;
  --white: #fff;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
h1, h2, h3, p, dl, dd { margin: 0; }
a { color: var(--blue); text-underline-offset: .2em; }
button, input { font: inherit; }
:focus-visible { outline: 3px solid #2469cf; outline-offset: 3px; }
.page-width { width: min(100% - 3rem, 72rem); margin-inline: auto; }

.site-header { background: var(--white); border-bottom: 1px solid var(--line); }
.header-content { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.75rem; }
.brand { display: flex; align-items: center; gap: .7rem; font-size: 1.35rem; font-weight: 780; letter-spacing: -.035em; }
.brand-mark { display: flex; align-items: end; justify-content: center; gap: 3px; width: 2.1rem; height: 2.1rem; padding-bottom: .58rem; background: var(--blue); border-radius: .65rem; }
.brand-mark i { display: block; width: 4px; height: 7px; border-radius: 2px; background: white; }
.brand-mark i:nth-child(2) { height: 11px; }
.brand-mark i:nth-child(3) { height: 15px; }
.header-label { color: var(--muted); font-size: .83rem; font-weight: 650; }

.layout { display: grid; grid-template-columns: minmax(0, .91fr) minmax(0, 1.09fr); align-items: start; grid-template-areas: "intro calculator" "reference calculator"; column-gap: clamp(2.2rem, 6vw, 5.5rem); row-gap: 2.1rem; padding-block: clamp(3rem, 7vw, 6rem) 2rem; }
.intro { grid-area: intro; }
.scope { color: var(--blue); font-size: .875rem; font-weight: 750; }
h1 { max-width: 12ch; margin-block: .65rem 1rem; font-size: clamp(2.45rem, 5vw, 4.15rem); line-height: 1.03; letter-spacing: -.066em; text-wrap: balance; }
.lede { max-width: 38ch; font-size: 1.05rem; color: var(--muted); }
.reference { grid-area: reference; max-width: 27rem; padding-top: 1.15rem; border-top: 1px solid #c7d9ee; }
.reference h2 { font-size: .92rem; }
.reference dl { margin-block: .6rem .75rem; font-size: .875rem; }
.reference dl div { display: flex; justify-content: space-between; gap: .65rem; padding-block: .32rem; }
.reference dt { font-weight: 620; }
.reference dd { color: var(--muted); text-align: right; }
.reference a { display: inline-block; font-size: .84rem; font-weight: 700; }

.calculator { grid-area: calculator; min-width: 0; border: 1px solid var(--line); border-radius: 1.45rem; background: var(--white); padding: clamp(1.25rem, 3.2vw, 2.25rem); box-shadow: 0 .8rem 2.6rem #23466f12; }
.steps { margin: 0 0 1.65rem; padding: 0 0 1.15rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; border-bottom: 1px solid var(--line); list-style: none; }
.steps li { display: flex; align-items: center; gap: .45rem; font-size: .875rem; font-weight: 650; color: var(--muted); }
.steps span { display: grid; place-items: center; width: 1.55rem; height: 1.55rem; flex-shrink: 0; border-radius: 50%; background: #edf3fb; }
.steps [aria-current] { color: var(--blue); font-weight: 750; }
.steps [aria-current] span { color: var(--white); background: var(--blue); }
.calculator h2 { font-size: clamp(1.7rem, 3vw, 2.2rem); line-height: 1.15; letter-spacing: -.04em; margin-bottom: 1.3rem; }
fieldset { padding: 0; border: 0; margin: 0 0 1.3rem; }
legend, .field label { padding: 0; font-size: .95rem; font-weight: 700; }
.unit-options, .paired { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.unit-options { margin-top: .5rem; }
.unit-options label { display: flex; align-items: center; gap: .45rem; padding: .65rem .7rem; min-height: 3rem; border: 1px solid #aebfd4; border-radius: .65rem; font-size: .88rem; font-weight: 650; cursor: pointer; }
.unit-options label:has(:checked) { border-color: var(--blue); background: #edf5ff; color: #164a90; }
.unit-options input { margin: 0; width: 1rem; height: 1rem; flex-shrink: 0; accent-color: var(--blue); }
.field { min-width: 0; }
.field label { display: block; }
.field input { width: 100%; min-height: 3rem; margin-top: .35rem; padding: .5rem .8rem; border: 1px solid #a9bdd6; border-radius: .65rem; color: var(--ink); background: var(--white); }
.field input[aria-invalid="true"] { border-color: #a32231; }
.example, .error { margin-top: .32rem; font-size: .835rem; }
.example { color: var(--muted); }
.error { color: #a32231; font-weight: 650; }

.actions { display: flex; gap: .65rem; flex-wrap: wrap; margin-top: 1.6rem; }
.actions button { min-height: 2.85rem; padding: .55rem .95rem; border: 1px solid transparent; border-radius: .65rem; font-size: .9rem; font-weight: 700; cursor: pointer; }
.actions .primary { background: var(--blue); color: var(--white); }
.actions .primary:hover { background: #124b9d; }
.actions .secondary { border-color: #a9bdd6; background: var(--white); color: #164a90; }
.actions .secondary:hover, .actions .text-button:hover { background: #edf5ff; }
.actions .text-button { color: var(--blue); background: var(--white); }

.result-score { border: 1px solid var(--line); background: #edf5ff; border-radius: .85rem; padding: 1rem 1.15rem; }
.result-score p { font-size: .86rem; font-weight: 700; color: #164a90; }
.score-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .75rem; }
#score { font-size: clamp(2.4rem, 6vw, 3.8rem); line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; min-width: 0; }
#category { font-weight: 750; color: #164a90; }
.measurements { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.measurements dt { font-size: .85rem; color: var(--muted); }
.measurements dd { font-weight: 730; overflow-wrap: anywhere; }
.support { margin-block: 1rem; }
.screening { border-left: 3px solid #a9c9ed; padding: .1rem 0 .1rem .8rem; color: var(--muted); font-size: .88rem; }
.screening h3 { font-size: .9rem; color: var(--ink); margin-bottom: .2rem; }
.site-footer { padding-block: .4rem 1.8rem; color: var(--muted); font-size: .83rem; }
.print-scope { display: none; }

@media (max-width: 50rem) {
  .layout { grid-template-columns: 1fr; grid-template-areas: "intro" "calculator" "reference"; gap: 1.55rem; padding-block: 2rem 1.1rem; }
  h1 { max-width: 16ch; }
  .reference { width: 100%; }
}

@media (max-width: 28rem) {
  .page-width { width: calc(100% - 2rem); }
  .header-content { min-height: 3.75rem; }
  .header-label { font-size: .75rem; }
  .unit-options { grid-template-columns: 1fr; }
  .actions button { flex: 1 1 auto; }
}

@media print {
  @page { margin: 18mm; }
  :root, body { background: white; color: #171717; }
  .site-header { border: 0; margin-bottom: .65rem; }
  .header-content, .layout { width: 100%; min-height: 0; }
  .brand { color: #171717; }
  .brand-mark, .header-label, .intro, .reference, .site-footer, .steps, .actions { display: none !important; }
  .layout { display: block; padding: 0; }
  .calculator { border: 0; box-shadow: none; padding: 0; max-width: 42rem; }
  .calculator h2 { margin-bottom: .3rem; }
  .print-scope { display: block; margin-bottom: .85rem; }
  .result-score { background: white; color: #171717; border-color: #999; }
  .result-score p, #category, .screening, .screening h3, .measurements dt { color: #171717; }
  .screening, .measurements { border-color: #aaa; }
  .result-score, .measurements, .screening, .support { break-inside: avoid; }
  body:not(.has-result) .layout { display: none; }
}
