:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, sans-serif;
  color: #142640;
  background: #f4f7fa;
  --navy: #101f36;
  --muted: #475c72;
  --teal: #07655d;
  --line: #d5e0e9;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
p, h1, h2 { margin: 0; }
button, input { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid #087d71; outline-offset: 3px; }
.wrap { width: min(100% - 2rem, 63rem); margin-inline: auto; }
.masthead { background: var(--navy); color: white; position: relative; overflow: hidden; }
.masthead::before {
  content: "";
  position: absolute;
  inset: 0 0 0 45%;
  background: repeating-radial-gradient(circle at 84% 111%, transparent 0 29px, #9bcfc31c 30px 31px, transparent 32px 51px);
  mask-image: linear-gradient(110deg, transparent, black 60%);
}
.masthead-content { position: relative; padding-block: 1.35rem 1.5rem; }
.brand { display: flex; align-items: center; gap: .6rem; font-size: 1.35rem; font-weight: 750; }
.brand img { border-radius: 10px; border: 1px solid #416561; }
h1 { margin-top: .8rem; font-size: clamp(1.8rem, 5vw, 3.25rem); line-height: 1.08; letter-spacing: -.045em; }
.masthead p { margin-top: .45rem; color: #a9d9d1; }
main { padding-top: 1rem; }
.calculator { display: grid; gap: .75rem; }
.panel { border: 1px solid var(--line); border-radius: 16px; padding: .95rem 1rem 1rem; }
.input-panel { background: white; box-shadow: 0 4px 16px #101f3608; }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
h2 { font-size: 1.18rem; letter-spacing: -.025em; }
.reset { color: var(--teal); background: transparent; border: 0; min-height: 44px; padding: 0 .45rem; font-weight: 650; }
.reset:hover { text-decoration: underline; }
label { display: block; font-size: .9rem; color: var(--muted); }
.input-box { display: flex; align-items: center; margin-top: .45rem; border: 1px solid #aabaca; border-radius: 8px; background: #fbfcfe; }
.input-box:focus-within { outline: 2px solid #087d71; outline-offset: 2px; }
.input-box:has([aria-invalid="true"]) { border-color: #a4262a; }
input { width: 100%; min-width: 0; min-height: 48px; padding: .55rem .7rem; color: inherit; border: 0; outline: none; background: transparent; font-weight: 650; }
input::placeholder { color: #52667b; font-weight: 400; }
#unit { padding-right: .75rem; color: var(--muted); }
.error { color: #a4262a; font-size: .875rem; }
.error:not(:empty) { margin-top: .35rem; }
fieldset { border: 0; padding: 0; margin: .85rem 0 0; min-inline-size: 0; }
legend { padding: 0; margin-bottom: .4rem; color: var(--muted); font-size: .875rem; }
.presets { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .3rem; }
.presets button { min-height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: #f4f7fa; color: var(--navy); font-weight: 650; }
.presets button:hover { border-color: var(--teal); }
.presets button[aria-pressed="true"] { background: var(--teal); color: white; border-color: var(--teal); }
.result-panel { background: #e6f4f0; border-color: #bbdad2; color: #12443f; padding-top: 1.15rem; }
.primary { display: flex; align-items: baseline; flex-wrap: wrap; gap: .4rem; color: #0c5049; font-size: clamp(2.7rem, 9vw, 4.6rem); line-height: 1.04; font-weight: 750; letter-spacing: -.06em; margin-top: .5rem; }
#rounded, #calculated { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
#rounded.compact { font-size: clamp(1.2rem, 4vw, 2.25rem); letter-spacing: -.025em; }
.result-unit { font-size: 1.05rem; letter-spacing: 0; }
.rounding { margin-top: .32rem; font-size: .875rem; }
.secondary { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .25rem 1rem; padding-top: .65rem; margin-top: .7rem; border-top: 1px solid #bbdad2; font-size: .925rem; }
.guidance { margin-top: .85rem; padding: .65rem .8rem; border-inline-start: 3px solid #168779; border-radius: 4px 9px 9px 4px; background: #eaf0f6; font-weight: 550; }
details { margin-top: .7rem; border-bottom: 1px solid var(--line); }
summary { padding: .65rem 0; font-weight: 700; color: var(--teal); }
.method { padding-bottom: 1rem; max-width: 72ch; }
.method ol { padding-left: 1.4rem; }
.disclaimer { margin-top: .7rem; color: var(--muted); }
footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem 1rem; padding-block: 1rem 1.25rem; color: var(--muted); font-size: .875rem; }
footer a { color: var(--teal); text-underline-offset: .2em; }
@media (min-width: 42rem) {
  .wrap { width: min(100% - 4rem, 63rem); }
  .masthead-content { padding-block: 2rem 2.6rem; }
  main { padding-top: 1.5rem; }
  .calculator { grid-template-columns: 1.1fr 1fr; gap: 1rem; }
  .panel { padding: 1.25rem 1.4rem 1.4rem; }
  .result-panel { padding-top: 1.7rem; }
  .guidance { margin-top: 1rem; padding: .8rem 1rem; }
}
