:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #1b2328;
  --muted: #5f6e76;
  --line: #d9e1e5;
  --accent: #0b6f7f;
  --accent-strong: #075563;
  --green: #2f7d51;
  --gold: #a46b00;
  --red: #b54242;
  --shadow: 0 16px 40px rgba(26, 45, 54, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 28px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.eyebrow,
.note-label,
.metric-label {
  display: block;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: 0;
}

h2,
legend {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0;
}

.lede {
  max-width: 700px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 1.05rem;
}

.threshold-note {
  border-left: 4px solid var(--accent);
  background: #eaf4f5;
  padding: 14px 16px;
  color: #32434a;
}

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(420px, 1.15fr);
  gap: 20px;
  align-items: start;
}

.measurement-panel,
.results-panel,
.formula-band {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.measurement-panel {
  padding: 22px;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

fieldset + fieldset {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

small {
  color: var(--muted);
  font-weight: 400;
}

input,
textarea {
  width: 100%;
  border: 1px solid #c9d3d8;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
}

input {
  height: 46px;
  padding: 8px 10px;
  font-size: 1.05rem;
}

input:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(11, 111, 127, 0.22);
  outline-offset: 2px;
  border-color: var(--accent);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.secondary-button {
  background: #eef3f5;
  color: #26363d;
  border-color: #d6e0e4;
  padding: 8px 14px;
}

.copy-button {
  width: fit-content;
  background: var(--accent);
  color: #ffffff;
  padding: 9px 16px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.form-error {
  min-height: 24px;
  margin-top: 12px;
  color: var(--red);
  font-weight: 700;
}

.results-panel {
  padding: 22px;
}

.results-panel.pre-only-mode .comparison-only {
  display: none;
}

.results-panel.pre-only-mode .selected-volumes {
  grid-template-columns: 1fr;
}

.results-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.headline-card {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #cbdde2;
  border-radius: 8px;
  background: #f7fbfc;
}

.headline-card strong {
  display: block;
  margin: 4px 0 2px;
  color: var(--accent-strong);
  font-size: 2.4rem;
  line-height: 1;
  letter-spacing: 0;
}

.headline-card span:last-child {
  color: var(--muted);
}

.headline-card.increase strong {
  color: var(--red);
}

.selected-volumes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.volume-card {
  min-height: 128px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.volume-card-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.volume-card strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0;
}

.volume-card strong + span {
  display: block;
  margin-top: 8px;
  color: var(--accent-strong);
  font-size: 0.95rem;
  font-weight: 700;
}

.volume-visual {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 220px);
  gap: 18px;
  align-items: center;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.anatomy-stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
  height: 210px;
  min-width: 260px;
  overflow: hidden;
}

.anatomy-stage::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 20px;
  width: 220px;
  height: 18px;
  border-radius: 50%;
  background: rgba(40, 63, 71, 0.1);
  filter: blur(4px);
  transform: translateX(-50%);
}

.anatomy-figure {
  position: absolute;
  top: 10px;
  width: 136px;
  height: 184px;
  z-index: 1;
}

.pre-figure {
  left: calc(50% - 132px);
}

.post-figure {
  left: calc(50% + 8px);
}

.bladder {
  position: absolute;
  left: 50%;
  top: 0;
  width: 108px;
  height: 76px;
  border: 2px solid rgba(30, 103, 120, 0.35);
  border-radius: 50% 50% 44% 44%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 35%),
    linear-gradient(145deg, rgba(151, 206, 215, 0.8), rgba(91, 160, 174, 0.55));
  transform: translateX(-50%);
}

.prostate-gland {
  content: "";
  position: absolute;
  left: 50%;
  top: 70px;
  width: var(--gland-width, 92px);
  height: var(--gland-height, 66px);
  border-radius: 52% 52% 45% 45% / 44% 44% 56% 56%;
  transform: translateX(-50%);
  transition: width 180ms ease, height 180ms ease, opacity 180ms ease;
}

.pre-gland {
  --gland-width: 96px;
  --gland-height: 70px;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 245, 223, 0.9), rgba(255, 245, 223, 0) 28%),
    linear-gradient(145deg, rgba(241, 174, 123, 0.92), rgba(210, 96, 77, 0.86));
  border: 2px solid rgba(181, 74, 61, 0.54);
  box-shadow: inset -10px -14px 20px rgba(151, 59, 48, 0.18), 0 14px 20px rgba(95, 57, 48, 0.12);
}

.post-gland {
  --gland-width: 82px;
  --gland-height: 70px;
  background:
    radial-gradient(circle at 35% 28%, rgba(232, 252, 236, 0.9), rgba(232, 252, 236, 0) 30%),
    linear-gradient(145deg, rgba(126, 191, 145, 0.9), rgba(47, 125, 81, 0.86));
  border: 2px solid rgba(47, 125, 81, 0.5);
  box-shadow: inset -8px -12px 18px rgba(31, 85, 54, 0.16), 0 12px 18px rgba(54, 91, 65, 0.1);
}

.prostate-gland::before,
.prostate-gland::after {
  content: "";
  position: absolute;
  top: 12%;
  bottom: 10%;
  width: 48%;
  border-radius: 50%;
  border-top: 1px solid rgba(255, 255, 255, 0.38);
}

.prostate-gland::before {
  left: 6%;
  transform: rotate(-10deg);
}

.prostate-gland::after {
  right: 6%;
  transform: rotate(10deg);
}

.urethra {
  position: absolute;
  left: 50%;
  top: 69px;
  width: var(--urethra-width, 7px);
  height: 101px;
  border-radius: 999px;
  background: rgba(246, 248, 249, 0.9);
  border: 1px solid rgba(66, 86, 94, 0.28);
  transform: translateX(-50%);
  z-index: 3;
}

.pre-urethra {
  --urethra-width: 5px;
}

.post-urethra {
  --urethra-width: 8px;
}

.figure-label {
  position: absolute;
  left: 50%;
  bottom: -2px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  transform: translateX(-50%);
}

.visual-summary {
  display: grid;
  gap: 16px;
  align-content: center;
}

.visual-legend {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.visual-legend span {
  display: grid;
  grid-template-columns: 14px auto 1fr;
  align-items: center;
  gap: 8px;
}

.visual-legend strong {
  justify-self: end;
  color: var(--ink);
  font-size: 0.95rem;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.pre-swatch {
  background: var(--accent);
}

.post-swatch {
  background: var(--green);
}

.reduction-meter {
  display: grid;
  gap: 8px;
}

.meter-label,
.visual-change {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.meter-label strong,
.visual-change strong {
  color: var(--accent-strong);
}

.visual-change.increase strong,
.meter-label.increase strong {
  color: var(--red);
}

.mode-note {
  min-height: 22px;
  margin: 0;
  color: var(--gold);
  font-size: 0.86rem;
  font-weight: 700;
}

.meter-track {
  height: 10px;
  border-radius: 999px;
  background: #e3eaed;
  overflow: hidden;
}

.meter-track span {
  display: block;
  width: var(--meter, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #78b68c);
  transition: width 180ms ease;
}

.meter-track span.increase {
  background: linear-gradient(90deg, var(--red), #d67b7b);
}

.copy-panel {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

textarea {
  min-height: 108px;
  resize: vertical;
  padding: 10px 12px;
  color: #2b3a40;
}

.copy-status {
  min-height: 22px;
  color: var(--green);
  font-size: 0.9rem;
  font-weight: 700;
}

.formula-band {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 22px;
  margin-top: 20px;
  padding: 20px 22px;
  color: var(--muted);
}

.formula-band h2 {
  margin-bottom: 6px;
}

.citation {
  align-self: center;
}

footer {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 880px) {
  .intro,
  .calculator-grid,
  .formula-band {
    grid-template-columns: 1fr;
  }

  .calculator-grid {
    gap: 16px;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 22px;
  }

  h1 {
    font-size: 2.1rem;
  }

  .measurement-panel,
  .results-panel,
  .formula-band {
    padding: 16px;
  }

  .field-grid,
  .selected-volumes,
  .volume-visual {
    grid-template-columns: 1fr;
  }

  .anatomy-stage {
    min-width: 180px;
    height: 190px;
  }

  .visual-summary {
    gap: 12px;
  }

  .results-header {
    display: grid;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions button {
    flex: 1;
  }
}
