:root {
  color-scheme: light;
  font-family: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #142f3b;
  background: #f2f6f6;
  --ink: #142f3b;
  --muted: #4d6570;
  --teal: #00695f;
  --line: #cfdddd;
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
[hidden] { display: none !important; }
.frame { width: min(1140px, calc(100% - 5rem)); margin-inline: auto; }
header { background: #fff; border-bottom: 1px solid var(--line); }
.masthead, .panel-heading, footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.masthead { min-height: 4.4rem; }
a { color: var(--teal); text-underline-offset: 0.2em; }
.masthead > a:last-child { font-weight: 600; font-size: .93rem; }
.brand { display: inline-flex; align-items: center; color: var(--ink); font-weight: 750; font-size: 1.25rem; letter-spacing: .035em; text-decoration: none; }
.brand-bd { color: var(--teal); margin-left: .27rem; font-weight: 500; }
.intro { padding: clamp(2rem, 5vw, 4rem) 0 2.25rem; }
h1,h2,p { margin: 0; }
h1 { font-family: "Baskervville", Georgia, serif; font-size: clamp(2.1rem, 4.7vw, 3.7rem); line-height: 1.09; font-weight: 500; letter-spacing: -.045em; }
.intro p { color: var(--muted); max-width: 44rem; margin-top: .9rem; font-size: 1.12rem; line-height: 1.55; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; gap: 1.3rem; }
.panel { border: 1px solid var(--line); border-radius: 13px; background: white; overflow: hidden; }
.panel-heading { padding: 1.55rem 1.6rem 0; }
h2 { font-size: 1.45rem; font-weight: 650; line-height: 1.25; letter-spacing: -.025em; }
button, input { font: inherit; }
button, summary, input[type="checkbox"], input[type="radio"] { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid #cd7523; outline-offset: 3px; }
.text-button { background: transparent; color: var(--teal); border: 0; padding: .4rem .1rem; font-weight: 600; font-size: .94rem; }
.text-button:hover { text-decoration: underline; }
.instructions { padding: .4rem 1.6rem 1.35rem; color: var(--muted); font-size: .95rem; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); padding: 0 .95rem; border-bottom: 1px solid var(--line); }
.tabs button { color: var(--muted); cursor: pointer; padding: .7rem .2rem; background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; font-size: .93rem; font-weight: 600; }
.tabs button[aria-selected="true"] { color: var(--teal); border-bottom-color: var(--teal); }
.tabs button:hover { background: #eef7f5; }
.fields { padding: 1.4rem 1.6rem 1.5rem; }
fieldset { margin: 0; border: 0; padding: 0; min-inline-size: 0; }
legend, .age-field { font-weight: 600; padding: 0; }
fieldset p, small { font-size: .88rem; color: var(--muted); font-weight: 400; }
.fields > fieldset + fieldset, .demographics + fieldset { border-top: 1px solid var(--line); margin-top: 1.3rem; }
.fields > fieldset + fieldset > legend, .demographics + fieldset > legend { float: left; width: 100%; padding-top: 1rem; }
.check { display: flex; gap: .65rem; align-items: baseline; clear: both; min-height: 2rem; padding-top: .43rem; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--teal); width: 1.02rem; height: 1.02rem; flex: none; margin: 0; align-self: center; }
.demographics { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.age-field { display: flex; flex-direction: column; }
.input-unit { margin: .5rem 0 .25rem; position: relative; }
.input-unit input { width: 100%; padding: .55rem 3.7rem .55rem .65rem; color: var(--ink); background: #fff; border: 1px solid #93a9ab; border-radius: 6px; font-weight: 400; }
.input-unit > span { position: absolute; right: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .87rem; font-weight: 400; pointer-events: none; }
.sex-options { display: flex; flex-wrap: wrap; column-gap: 1rem; row-gap: .25rem; min-height: 2.5rem; margin-top: .45rem; }
.sex-options label { display: flex; align-items: center; gap: .35rem; cursor: pointer; }
.actions { border-top: 1px solid var(--line); padding: 1rem 1.6rem; }
.primary { color: white; background: var(--teal); border: 0; border-radius: 6px; font-weight: 600; padding: .7rem 1.05rem; }
.primary:hover { background: #00554d; }
.result-head { background: #163f42; color: #fff; padding: 1.55rem 1.5rem 1.35rem; }
.result-head p { color: #d6e9e7; font-size: .95rem; margin-top: .35rem; }
.result-body { padding: .75rem 1.5rem 1.3rem; }
table { border-collapse: collapse; width: 100%; text-align: left; font-variant-numeric: tabular-nums; }
th, td { padding: .83rem .2rem; border-bottom: 1px solid var(--line); }
thead th { font-size: .88rem; color: var(--muted); line-height: 1.3; vertical-align: bottom; }
th:not(:first-child), td { text-align: right; }
tbody th { font-weight: 550; }
td { font-size: 1.2rem; font-weight: 600; color: var(--teal); }
.status,.interpretation { margin-top: 1rem; color: var(--muted); font-size: .91rem; }
.interpretation { padding: .7rem .85rem; border-left: 3px solid #77a8a1; background: #f1f7f6; }
.details { margin: 1.25rem 0 2rem; background: #e9f0f0; border: 1px solid var(--line); border-radius: 9px; }
summary { padding: .95rem 1.2rem; font-weight: 600; }
.details-copy { padding: 0 1.2rem 1rem; max-width: 52rem; color: var(--muted); }
.details-copy p + p { margin-top: .55rem; }
footer { border-top: 1px solid var(--line); padding: 1.15rem 0 2rem; color: var(--muted); font-size: .88rem; }
footer span:first-child { font-weight: 650; letter-spacing: .04em; }
.skip { position: absolute; left: .5rem; top: -5rem; background: #fff; padding: .5rem; z-index: 1; }
.skip:focus { top: .5rem; }
@media (max-width: 800px) {
  .frame { width: min(650px, calc(100% - 2rem)); }
  .workspace { grid-template-columns: 1fr; }
  .intro { padding: 2rem 0 1.5rem; }
}
@media (max-width: 460px) {
  .masthead { min-height: 3.6rem; }
  .panel-heading, .instructions, .fields, .actions, .result-head, .result-body { padding-inline: 1rem; }
  .tabs { padding-inline: .25rem; }
  .demographics { gap: .8rem; grid-template-columns: 1fr 1.2fr; }
  .tabs button { font-size: .88rem; }
}
