:root {
  color-scheme: light;
  font-family: ui-sans-serif, system-ui, sans-serif;
  color: #102f37;
  background: #edf5f2;
  --ink: #102f37;
  --muted: #47636a;
  --line: #cddedb;
  --accent: #07675d;
  --deep: #103f46;
  --warning: #8b4215;
  --error: #9f2931;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, select, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #087d74; outline-offset: 3px; }

.shell { width: min(100% - 3rem, 76rem); margin: 0 auto; padding: 2rem 0 4rem; }
.hero {
  isolation: isolate;
  overflow: hidden;
  position: relative;
  border-radius: 1.6rem;
  padding: clamp(1.6rem, 5vw, 3.5rem);
  background: linear-gradient(116deg, #12343f 15%, #0d4d55 71%, #116d69);
  color: #f2fcf8;
}
.hero::before, .hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  border: 1px solid #a8e5d04a;
  border-radius: 44%;
  width: clamp(20rem, 50vw, 48rem);
  aspect-ratio: 1.35;
  transform: rotate(-24deg);
}
.hero::before { right: -7%; top: 1%; box-shadow: 0 0 0 1.1rem #a8e5d010, 0 0 0 2.2rem #a8e5d014; }
.hero::after { right: -10%; top: 25%; box-shadow: 0 0 0 1.3rem #a8e5d012; }
.brand { display: flex; align-items: center; gap: .65rem; font-weight: 700; color: #b4f0dc; }
.drop { width: .95rem; height: .95rem; background: #a0eacb; border-radius: 70% 0 70% 70%; transform: rotate(-45deg); }
h1 { margin: .85rem 0; font-size: clamp(2.1rem, 5.5vw, 4.5rem); line-height: 1.01; letter-spacing: -.055em; text-wrap: balance; }
.hero p { max-width: 32rem; margin: 0; color: #d1eee9; }
p { line-height: 1.5; }
.layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; gap: 1.25rem; margin-top: 1.25rem; }
form { display: grid; gap: 1rem; min-width: 0; }
.card { min-width: 0; padding: clamp(1rem, 2.5vw, 1.6rem); border: 1px solid var(--line); border-radius: 1.2rem; background: #fff; box-shadow: 0 12px 38px #16443a08; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .7rem; }
h2 { margin: 0; font-size: 1.35rem; letter-spacing: -.025em; }
h3 { font-size: 1rem; margin: 0; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { padding: 0; }
.choice, .reading, #change-panel, #source-controls { margin-top: 1.2rem; }
.choice legend, .reading legend { font-weight: 650; }
.segments { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem; padding: .25rem; margin-top: .45rem; border-radius: .8rem; background: #eaf3f0; }
.segments label { position: relative; cursor: pointer; }
.segments input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.segments span { display: grid; place-items: center; min-height: 2.7rem; padding: .35rem .5rem; border: 1px solid transparent; border-radius: .6rem; text-align: center; font-size: .9rem; font-weight: 650; }
.segments input:checked + span { background: white; color: #07564e; border-color: #c6ded7; box-shadow: 0 2px 4px #113c3410; }
.segments input:focus-visible + span { outline: 3px solid #087d74; outline-offset: 1px; }
.grid { display: grid; align-items: start; gap: .75rem; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.readings { grid-template-columns: repeat(auto-fit, minmax(min(100%, 5.6rem), 1fr)); margin-top: .5rem; }
.field { display: grid; gap: .32rem; min-width: 0; }
#volume-field { margin-top: 1.15rem; max-width: 15rem; }
.field label { color: var(--ink); font-size: .88rem; font-weight: 600; }
.control { display: flex; align-items: center; border: 1px solid #b8cecb; border-radius: .65rem; min-height: 2.8rem; background: #fbfdfc; }
.control:focus-within { border-color: var(--accent); outline: 2px solid var(--accent); }
.control input, .control select { width: 100%; min-width: 0; border: 0; padding: .6rem .65rem; color: var(--ink); background: transparent; border-radius: inherit; outline: 0; }
.control select { min-height: 2.75rem; padding-right: 1.7rem; appearance: none; cursor: pointer; }
.control:has(select) { position: relative; }
.control:has(select)::after { content: ""; position: absolute; right: .8rem; width: .45rem; height: .45rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-2px) rotate(45deg); pointer-events: none; }
.control input::placeholder { color: #597277; }
.unit { padding-right: .55rem; color: var(--muted); font-size: .78rem; white-space: nowrap; }
.field:has([aria-invalid="true"]) .control { border-color: var(--error); }
.error { color: var(--error); font-size: .86rem; overflow-wrap: anywhere; }
.hint { color: var(--muted); font-size: .89rem; margin: .45rem 0 0; }
.recipe { margin: .85rem 0 0; padding: .65rem .75rem; background: #e8f5f0; border-radius: .65rem; color: #18584f; font-size: .94rem; }
.product { border: 1px solid var(--line); border-radius: .8rem; margin-top: .85rem; padding: .75rem .85rem; }
.check { min-height: 2rem; display: flex; align-items: center; gap: .5rem; font-weight: 650; cursor: pointer; }
.check input { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; margin: 0; }
.optional summary { cursor: pointer; padding: .4rem .15rem; font-weight: 650; color: #184f54; }
.product > div, .optional > div { margin-top: .7rem; }
.product .grid + .grid, .product .grid + .field, .product .field + .grid, .product .hint + .field, .optional { margin-top: .8rem; }
.primary, .secondary { min-height: 2.75rem; border-radius: .75rem; font-weight: 720; }
.primary { color: white; background: var(--accent); border: 0; padding: .7rem 1.4rem; justify-self: start; }
.primary:hover { background: #04574f; }
.secondary { color: var(--accent); background: #f1f8f5; border: 1px solid #c8ded8; padding: .35rem .7rem; font-size: .85rem; }
.secondary:hover { background: #e3f2eb; }
.result { position: sticky; top: 1rem; background: #f8fcfa; }
.result h2 { color: var(--deep); }
#results:empty { display: none; }
.doses { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: .65rem; margin: .85rem 0; }
.dose { background: #e4f4ed; padding: .85rem; border: 1px solid #c5e3d8; border-radius: .8rem; }
.dose strong { display: block; margin-top: .2rem; font-size: clamp(1.4rem, 2vw, 1.85rem); letter-spacing: -.035em; color: #0c554d; }
.dose .message { color: var(--warning); }
.forecast { width: 100%; border-collapse: collapse; margin-top: .8rem; font-size: .88rem; line-height: 1.35; }
.forecast caption { text-align: left; font-weight: 700; font-size: 1rem; margin-bottom: .45rem; }
.forecast th, .forecast td { text-align: left; vertical-align: top; padding: .55rem .3rem; border-bottom: 1px solid var(--line); }
.forecast thead th { font-size: .8rem; color: var(--muted); }
.forecast .note { color: var(--muted); font-size: .79rem; display: block; margin-top: .2rem; }
.forecast .excess { color: var(--warning); }
.value { font-variant-numeric: tabular-nums; }
@media (max-width: 57rem) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .result { position: static; }
}
@media (max-width: 32rem) {
  .shell { width: calc(100% - 1.35rem); padding-top: .7rem; }
  .hero { border-radius: 1.2rem; }
  .primary { justify-self: stretch; }
}
