:root {
  --n-ink: #1d2939;
  --n-muted: #667085;
  --n-paper: #fffdf8;
  --n-wash: #f4efe5;
  --n-panel: #fff;
  --n-line: #ddd4c5;
  --n-accent: #d75b3f;
  --n-accent-dark: #a83b2d;
  --n-accent-soft: #f7d8c9;
  --n-sage: #5b806f;
  --n-sky: #8fb9c8;
  --n-gold: #d9a441;
  --n-plum: #72506f;
  --n-white: #fff;
  --n-glint: rgba(255, 255, 255, 0.8);
  --n-shadow: 0 22px 55px rgba(82, 54, 32, 0.13);
  --n-shadow-small: 0 8px 22px rgba(82, 54, 32, 0.1);
}

.theme-dark {
  --n-ink: #f4eee4;
  --n-muted: #b4b0a8;
  --n-paper: #191b1e;
  --n-wash: #202428;
  --n-panel: #24282d;
  --n-line: #3c4147;
  --n-accent: #ed8364;
  --n-accent-dark: #ffad90;
  --n-accent-soft: #4d2e2a;
  --n-sage: #8ab6a1;
  --n-sky: #9dccdc;
  --n-gold: #e1b866;
  --n-plum: #ba8db5;
  --n-white: #fff;
  --n-glint: rgba(255, 255, 255, 0.8);
  --n-shadow: 0 22px 55px rgba(0, 0, 0, 0.3);
  --n-shadow-small: 0 8px 22px rgba(0, 0, 0, 0.24);
}

.vo2-tool {
  color: var(--n-ink);
}

.vo2-card {
  border: 1px solid var(--n-line);
  border-radius: 24px;
  background: var(--n-panel);
  box-shadow: var(--n-shadow);
  overflow: hidden;
}

.vo2-result-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  min-height: 260px;
  overflow: hidden;
  padding: 2rem;
  border-bottom: 1px solid var(--n-line);
  background: linear-gradient(120deg, var(--n-paper), var(--n-wash));
}

.vo2-result-card::after {
  position: absolute;
  inset: auto -10% -60% 30%;
  height: 230px;
  border-radius: 50%;
  background: var(--n-accent-soft);
  content: '';
  opacity: 0.42;
}

.vo2-result-copy,
.vo2-constellation {
  position: relative;
  z-index: 1;
}

.vo2-result-copy {
  align-self: center;
}

.vo2-kicker {
  margin: 0;
  color: var(--n-accent-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.vo2-number-row {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  margin: 0.3rem 0;
}

.vo2-number-row strong {
  font-size: clamp(3.7rem, 8vw, 6.4rem);
  font-weight: 800;
  letter-spacing: -0.09em;
  line-height: 0.95;
}

.vo2-number-row span {
  max-width: 90px;
  color: var(--n-muted);
  font-size: 0.78rem;
  line-height: 1.2;
}

.vo2-method-note,
.vo2-percentile {
  max-width: 510px;
  margin: 0;
  color: var(--n-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.vo2-percentile {
  margin-top: 0.55rem;
  color: var(--n-ink);
  font-weight: 700;
}

.vo2-constellation {
  min-height: 210px;
  overflow: hidden;
}

.vo2-core,
.vo2-star,
.vo2-orbit {
  position: absolute;
  display: block;
  border-radius: 50%;
}

.vo2-core {
  top: 50%;
  left: 50%;
  width: 78px;
  height: 78px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 30%, var(--n-white), var(--n-accent) 34%, var(--n-accent-dark));
  box-shadow: 0 0 0 14px var(--n-accent-soft), 0 0 50px var(--n-accent);
  animation: vo2-core-breathe var(--vo2-motion-duration, 1.45s) ease-in-out infinite;
}

.vo2-orbit {
  top: 50%;
  left: 50%;
  border: 1px solid var(--n-line);
  transform: translate(-50%, -50%);
}

.vo2-orbit-one {
  width: 124px;
  height: 124px;
}

.vo2-orbit-two {
  width: 176px;
  height: 176px;
}

.vo2-orbit-three {
  width: 236px;
  height: 236px;
}

.vo2-star {
  width: 10px;
  height: 10px;
  box-shadow: 0 0 0 5px var(--n-paper);
  animation: vo2-star-drift var(--vo2-motion-duration, 1.45s) ease-in-out infinite alternate;
}

.vo2-star-one {
  top: 22%;
  left: 30%;
  background: var(--n-sage);
}

.vo2-star-two {
  top: 74%;
  left: 24%;
  background: var(--n-gold);
}

.vo2-star-three {
  top: 17%;
  right: 18%;
  background: var(--n-sky);
}

.vo2-star-four {
  right: 12%;
  bottom: 21%;
  background: var(--n-plum);
}

.vo2-input-layout {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  border-top: 1px solid var(--n-line);
}

.vo2-card fieldset {
  border: 0;
  margin: 0;
  min-width: 0;
}

.vo2-method-panel,
.vo2-test-panel,
.vo2-context-panel {
  min-width: 0;
  padding: 1.25rem;
}

.vo2-method-panel {
  padding: 1.25rem;
  border-bottom: 1px solid var(--n-line);
}

.vo2-test-panel {
  border-right: 1px solid var(--n-line);
}

.vo2-method-grid,
.vo2-sex-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}

.vo2-sex-grid {
  grid-template-columns: repeat(2, 1fr);
}

.vo2-choice,
.vo2-unit,
.vo2-primary,
.vo2-secondary {
  min-height: 44px;
  border: 1px solid var(--n-line);
  border-radius: 13px;
  background: var(--n-paper);
  color: var(--n-ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.vo2-choice:hover,
.vo2-unit:hover,
.vo2-primary:hover,
.vo2-secondary:hover {
  transform: translateY(-2px);
}

.vo2-choice.is-active,
.vo2-unit.is-active {
  border-color: var(--n-accent);
  background: var(--n-accent-soft);
  color: var(--n-accent-dark);
}

.vo2-field-header,
.vo2-unit-switch {
  display: flex;
  align-items: center;
}

.vo2-field-header {
  justify-content: space-between;
  gap: 0.7rem;
}

.vo2-unit-switch {
  justify-content: flex-start;
  gap: 0.4rem;
}

.vo2-unit {
  min-height: 34px;
  padding: 0.35rem 0.75rem;
}

.vo2-field {
  display: grid;
  gap: 0.4rem;
  margin-top: 1rem;
}

.vo2-field[hidden] {
  display: none;
}

.vo2-field label,
.vo2-label {
  color: var(--n-ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.vo2-field input {
  box-sizing: border-box;
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--n-line);
  border-radius: 12px;
  background: var(--n-paper);
  color: var(--n-ink);
  font: inherit;
  font-size: 1.15rem;
  padding: 0.7rem 0.8rem;
}

.vo2-field input:focus,
.vo2-choice:focus-visible,
.vo2-unit:focus-visible,
.vo2-primary:focus-visible,
.vo2-secondary:focus-visible {
  outline: 3px solid var(--n-accent-soft);
  outline-offset: 2px;
}

.vo2-field small {
  color: var(--n-muted);
  font-size: 0.72rem;
}

.vo2-input-with-unit {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.vo2-input-with-unit input {
  flex: 1;
}

.vo2-unit-label {
  min-width: 2rem;
  color: var(--n-muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
}

.vo2-time-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.45rem;
}

.vo2-time-grid span {
  color: var(--n-accent);
  font-size: 1.5rem;
  font-weight: 800;
}

.vo2-context-panel {
  background: linear-gradient(145deg, transparent, var(--n-wash));
}

.vo2-actions {
  display: flex;
  justify-content: center;
  gap: 0.7rem;
  padding: 1.25rem 1.25rem 0;
  border-top: 1px solid var(--n-line);
}

.vo2-primary,
.vo2-secondary {
  padding: 0.7rem 1.3rem;
}

.vo2-primary {
  border-color: var(--n-accent);
  background: var(--n-accent);
  color: var(--n-white);
  box-shadow: var(--n-shadow-small);
}

.vo2-secondary {
  background: var(--n-paper);
}

.vo2-safety {
  max-width: 760px;
  margin: 0 auto;
  padding: 0.7rem 1.25rem 1.25rem;
  color: var(--n-muted);
  font-size: 0.74rem;
  line-height: 1.5;
  text-align: center;
}

.vo2-reference-panel {
  padding: 1.15rem 1.5rem 1.45rem;
  border-top: 1px solid var(--n-line);
  background: linear-gradient(180deg, transparent, var(--n-wash));
}

.vo2-reference-scale {
  position: relative;
  padding-top: 1.2rem;
}

.vo2-reference-line,
.vo2-reference-marker {
  position: absolute;
  top: 0;
  display: block;
}

.vo2-reference-line {
  right: 0;
  left: 0;
  height: 10px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--n-plum), var(--n-sky), var(--n-sage), var(--n-gold), var(--n-accent));
  overflow: hidden;
}

.vo2-reference-line::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -24%;
  width: 20%;
  background: linear-gradient(90deg, transparent, var(--n-glint), transparent);
  content: '';
  opacity: 0;
}

.vo2-reference-marker {
  left: var(--vo2-position, 0%);
  z-index: 1;
  width: 6px;
  height: 34px;
  border-radius: 6px;
  background: var(--n-ink);
  box-shadow: 0 0 0 4px var(--n-accent-soft), 0 0 18px var(--n-accent);
  transform: translate(-50%, -12px);
  transition: left 760ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.vo2-reference-segments {
  display: grid;
  grid-template-columns: 10fr 15fr 25fr 25fr 15fr 10fr;
  gap: 0.35rem;
}

.vo2-reference-segments span {
  color: var(--n-muted);
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.vo2-reference-segments span.is-active {
  color: var(--n-accent-dark);
}

.vo2-reference-panel.is-empty .vo2-reference-marker {
  opacity: 0;
}

.vo2-reference-panel.is-updating .vo2-reference-line::after {
  animation: vo2-reference-scan 900ms ease-out;
}

.vo2-reference-panel.is-updating .vo2-reference-marker {
  animation: vo2-marker-arrive 900ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.vo2-reference-panel.is-updating .vo2-reference-segments span.is-active {
  animation: vo2-band-flash var(--vo2-motion-duration, 1.45s) ease-out;
}

.vo2-result-card.is-strong .vo2-core {
  box-shadow: 0 0 0 14px var(--n-accent-soft), 0 0 70px var(--n-gold);
}

.vo2-result-card.is-caution .vo2-core {
  background: radial-gradient(circle at 35% 30%, var(--n-white), var(--n-gold) 34%, var(--n-accent-dark));
}

.vo2-result-card.is-caution {
  --vo2-motion-duration: 2.2s;
}

.vo2-result-card.is-strong {
  --vo2-motion-duration: 0.85s;
}

@keyframes vo2-core-breathe {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(0.94);
  }

  50% {
    transform: translate(-50%, -50%) scale(1.06);
  }
}

@keyframes vo2-star-drift {
  from {
    transform: translate3d(-3px, 2px, 0) scale(0.8);
  }

  to {
    transform: translate3d(3px, -2px, 0) scale(1.15);
  }
}

@keyframes vo2-reference-scan {
  0% {
    left: -24%;
    opacity: 0;
  }

  18%,
  72% {
    opacity: 0.85;
  }

  100% {
    left: 108%;
    opacity: 0;
  }
}

@keyframes vo2-marker-arrive {
  0% {
    opacity: 0.35;
    transform: translate(-50%, -12px) scaleY(0.55);
  }

  65% {
    opacity: 1;
    transform: translate(-50%, -12px) scaleY(1.16);
  }

  100% {
    transform: translate(-50%, -12px) scaleY(1);
  }
}

@keyframes vo2-band-flash {
  0% {
    color: var(--n-muted);
    transform: translateY(5px);
  }

  55% {
    color: var(--n-accent-dark);
    transform: translateY(0);
  }

  100% {
    color: var(--n-accent-dark);
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .vo2-core,
  .vo2-star,
  .vo2-reference-panel.is-updating .vo2-reference-line::after,
  .vo2-reference-panel.is-updating .vo2-reference-marker,
  .vo2-reference-panel.is-updating .vo2-reference-segments span.is-active {
    animation: none;
  }

  .vo2-reference-marker {
    transition: none;
  }
}

@media (max-width: 760px) {
  .vo2-result-card,
  .vo2-input-layout {
    grid-template-columns: 1fr;
  }

  .vo2-test-panel {
    border-right: 0;
    border-bottom: 1px solid var(--n-line);
  }

  .vo2-constellation {
    min-height: 180px;
  }

  .vo2-method-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .vo2-result-card {
    padding: 1.5rem;
  }
}
