:root {
  --navy: #080e53;
  --blue: #1f50ff;
  --blue-dark: #163bd6;
  --off-white: #f7f7f7;
  --yellow: #ffd000;
  --red: #f1283a;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --card: #ffffff;
  --soft-blue: #edf3ff;
  --soft-red: #fff0f1;
  --shadow: 0 18px 42px rgba(8, 14, 83, 0.08);
  --shadow-soft: 0 8px 20px rgba(8, 14, 83, 0.06);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--off-white);
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(31, 80, 255, 0.08), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, var(--off-white) 52%, #ffffff 100%);
  font-family: "Figtree", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 18px 20px 36px;
}

.hero {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 9px;
  margin-bottom: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.brand img {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: contain;
}

h1 {
  max-width: 700px;
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.9rem, 3.4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.07;
}

.hero p {
  max-width: 650px;
  margin: 0;
  color: #43506c;
  font-size: clamp(0.95rem, 1.6vw, 1.04rem);
  line-height: 1.48;
}

.app-surface {
  display: grid;
  place-items: center;
}

.calculator-card,
.results-wrap,
.cta-card {
  width: min(100%, 760px);
}

.calculator-card,
.results-main,
.cta-card {
  border: 1px solid rgba(8, 14, 83, 0.1);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.calculator-card {
  padding: clamp(18px, 3vw, 28px);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.step-dot,
.rank-dot,
.primary-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  color: #ffffff;
  font-weight: 900;
}

.step-dot {
  width: 30px;
  height: 30px;
  background: var(--blue);
  font-size: 0.82rem;
}

.section-heading h2 {
  margin: 0 0 2px;
  color: var(--navy);
  font-size: 1.05rem;
  line-height: 1.2;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.form-grid,
.advanced-grid {
  display: grid;
  gap: 0;
}

.question {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
  padding: 0 0 20px;
}

.question + .question {
  padding-top: 19px;
  border-top: 1px solid rgba(229, 231, 235, 0.82);
}

.question-number {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: var(--blue);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.question-main {
  min-width: 0;
}

.field-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 240px);
  align-items: flex-start;
  gap: 18px;
}

.question-copy {
  display: grid;
  gap: 5px;
}

.field label,
.field legend {
  color: var(--navy);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.35;
}

.helper {
  margin: 0;
  color: #56637a;
  font-size: 0.9rem;
  line-height: 1.42;
}

.number-control {
  display: flex;
  align-items: center;
  min-width: min(100%, 220px);
  overflow: hidden;
  border: 1px solid #cfd5df;
  border-radius: var(--radius-sm);
  background: #ffffff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.number-control:focus-within,
.number-control.is-focused {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 2px rgba(31, 80, 255, 0.22);
}

.number-control:has(input:focus) {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 2px rgba(31, 80, 255, 0.22);
}

.number-control span {
  display: grid;
  min-width: 44px;
  height: 48px;
  place-items: center;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: #fafafa;
  font-weight: 850;
}

.number-control input {
  width: 100%;
  height: 48px;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0 14px;
  color: var(--ink);
  background: transparent;
  font-weight: 720;
}

.number-control input:focus {
  outline: 0;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

fieldset.question legend {
  margin: 0 0 9px;
}

fieldset.question .helper {
  margin-top: 8px;
}

.segment-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid #cfd5df;
  border-radius: 14px;
  background: #f8fafc;
}

.segment-group.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.segment {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #2d374f;
  font-size: 0.86rem;
  font-weight: 760;
  line-height: 1.2;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.segment[aria-pressed="true"] {
  background: var(--blue);
  color: #ffffff;
  box-shadow: 0 10px 18px rgba(31, 80, 255, 0.24);
}

.advanced {
  margin-top: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.advanced summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  color: var(--navy);
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

.advanced summary span {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.advanced summary strong {
  font-size: 0.98rem;
  font-weight: 700;
}

.advanced summary small {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced summary::after {
  width: 12px;
  height: 12px;
  border-right: 2px solid var(--navy);
  border-bottom: 2px solid var(--navy);
  content: "";
  transform: rotate(45deg) translateY(-3px);
  transition: transform 160ms ease;
}

.advanced[open] summary::after {
  transform: rotate(225deg) translateY(-1px);
}

.advanced-grid {
  gap: 12px;
  padding: 5px 0 18px;
}

.advanced-grid .sub-question {
  display: block;
  min-height: 50px;
  padding: 0;
}

.advanced-grid .sub-question:last-child {
  padding-bottom: 0;
}

.advanced-grid .field-head {
  grid-template-columns: minmax(0, 1fr) 230px;
  align-items: center;
  gap: 18px;
}

.advanced-grid .question-copy {
  gap: 0;
}

.advanced-grid .number-control {
  min-width: 230px;
}

.validation-message {
  margin: 0;
  border: 1px solid rgba(241, 40, 58, 0.24);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: #9f1826;
  background: var(--soft-red);
  font-size: 0.92rem;
  font-weight: 750;
  line-height: 1.45;
}

.summary-note,
.trust-note {
  margin: 0;
  border-radius: var(--radius-md);
  padding: 13px 15px;
  color: #475569;
  background: #f1f5f9;
  font-size: 0.94rem;
  line-height: 1.45;
}

.summary-note {
  margin-top: 18px;
  margin-bottom: 22px;
}

.trust-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #eef4ff;
  color: #304269;
  margin-bottom: 19px;
}

.trust-note svg {
  flex: 0 0 auto;
  color: var(--blue);
}

.cta-button,
.cta-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 62px;
  border: 0;
  border-radius: 16px;
  padding: 16px 22px;
  background: var(--blue);
  color: #ffffff;
  text-align: center;
  text-decoration: none;
  font-size: 1.06rem;
  font-weight: 950;
  box-shadow: 0 16px 30px rgba(31, 80, 255, 0.28);
}

.button-icon {
  display: block;
  flex: 0 0 auto;
  width: 0.98em;
  height: 0.98em;
}

.cta-button:hover,
.cta-link:hover {
  background: var(--blue-dark);
}

.results-wrap {
  display: grid;
  gap: 16px;
}

.results-main {
  padding: clamp(20px, 3vw, 30px);
}

.primary-result {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: center;
  margin: 0 0 16px;
  border: 1px solid rgba(241, 40, 58, 0.24);
  border-radius: 20px;
  padding: clamp(18px, 3vw, 26px);
  background: linear-gradient(135deg, #fff8f8, #ffffff);
}

.primary-result.on-track {
  border-color: rgba(31, 80, 255, 0.24);
  background: linear-gradient(135deg, #f4f8ff, #ffffff);
}

.primary-kicker {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.primary-result h2 {
  margin: 0;
  color: var(--red);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.06;
}

.primary-result.on-track h2 {
  color: var(--blue);
}

.primary-result p:last-child {
  margin: 9px 0 0;
  color: #43506c;
  line-height: 1.45;
}

.diagnostics {
  display: grid;
  gap: 11px;
  margin-top: 14px;
}

.diagnostic-card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) minmax(148px, auto);
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 15px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.rank-dot {
  width: 32px;
  height: 32px;
  background: var(--red);
  font-size: 0.86rem;
  align-self: center;
}

.diagnostic-card.on-track .rank-dot {
  background: var(--blue);
}

.diagnostic-card h3 {
  margin: 0 0 5px;
  color: var(--navy);
  font-size: 0.98rem;
}

.diagnostic-card p {
  margin: 0;
  color: #475569;
  font-size: 0.92rem;
  line-height: 1.45;
  font-weight: 500;
  max-width: 560px;
}

.card-number {
  color: var(--navy);
  text-align: right;
  font-size: clamp(1.34rem, 2.6vw, 1.82rem);
  font-weight: 850;
  line-height: 1.05;
  white-space: nowrap;
  align-self: center;
}

.card-number span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.recommendation {
  margin-top: 14px;
  border: 1px solid #d8dee8;
  border-radius: var(--radius-md);
  padding: 16px;
  background: #f5f7fb;
  color: #334155;
  line-height: 1.55;
}

.recommendation h3 {
  margin: 0 0 6px;
  color: var(--navy);
  font-size: 1rem;
}

.recommendation p {
  margin: 0;
}

.cta-card {
  display: grid;
  gap: 16px;
  padding: clamp(19px, 2.8vw, 26px);
}

.cta-card p {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1rem, 1.8vw, 1.12rem);
  font-weight: 400;
  line-height: 1.5;
}

.cta-card .cta-link {
  width: 100%;
  justify-self: start;
  min-height: 58px;
}

.cta-card .cta-link:hover {
  background: var(--blue-dark);
}

.recalculate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: center;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 0.95rem;
  font-weight: 750;
  text-decoration: none;
}

.recalculate:hover {
  color: var(--blue-dark);
}

.disclaimer {
  max-width: 850px;
  margin: 28px auto 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.82rem;
  line-height: 1.55;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 760px) {
  .page-shell {
    padding: 16px 14px 32px;
  }

  .hero {
    margin-bottom: 16px;
  }

  .brand img {
    width: 62px;
    height: 62px;
  }

  h1 {
    font-size: clamp(1.85rem, 9vw, 2.55rem);
    line-height: 1.07;
  }

  .calculator-card,
  .results-main,
  .cta-card {
    border-radius: 18px;
  }

  .question {
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 10px;
    padding-bottom: 19px;
  }

  .question + .question {
    padding-top: 18px;
  }

  .question-number {
    width: 23px;
    height: 23px;
    font-size: 0.74rem;
  }

  .field-head,
  .advanced-grid .field-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .advanced-grid {
    gap: 15px;
  }

  .advanced-grid .number-control {
    min-width: 0;
  }

  .number-control {
    width: 100%;
  }

  .segment-group,
  .segment-group.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .primary-result,
  .diagnostic-card {
    grid-template-columns: 1fr;
  }

  .primary-result h2 {
    font-size: clamp(1.85rem, 10vw, 2.55rem);
  }

  .card-number {
    text-align: left;
    white-space: normal;
  }

  .cta-card .cta-link {
    width: 100%;
  }

  .cta-button,
  .cta-link {
    min-height: 58px;
    padding: 14px 16px;
    font-size: 0.96rem;
    line-height: 1.25;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
