:root {
  --navy: #172554;
  --blue: #263c88;
  --red: #c21f30;
  --red-dark: #a81727;
  --yellow: #f5c842;
  --ink: #172554;
  --muted: #667085;
  --line: #dfe4ef;
  --paper: #fff;
  --soft: #f4f7ff;
  --radius: 28px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(194,31,48,.09), transparent 24rem),
    radial-gradient(circle at 92% 24%, rgba(38,60,136,.13), transparent 28rem),
    #f7f8fc;
  font-family: "Poppins", sans-serif;
  line-height: 1.6;
}

button, input { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.skip-link { position: fixed; top: -100px; left: 1rem; z-index: 1000; padding: .75rem 1rem; background: #fff; }
.skip-link:focus { top: 1rem; }
.test-announcement { padding: .45rem 1rem; color: #fff; background: var(--navy); text-align: center; font-size: .78rem; font-weight: 600; }
.test-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 82px;
  padding: .65rem clamp(1rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid rgba(23,37,84,.1);
  backdrop-filter: blur(14px);
}
.test-logo img { width: 100px; height: 64px; object-fit: contain; }
.test-header nav { display: flex; align-items: center; justify-content: flex-end; gap: .35rem; }
.test-header nav a { padding: .6rem .8rem; color: var(--muted); border-radius: 999px; font-size: .88rem; font-weight: 600; }
.test-header nav a:hover, .test-header nav a.active { color: var(--blue); background: var(--soft); }
.test-header nav .header-cta { color: #fff; background: var(--red); }
.test-header nav .header-cta:hover { color: #fff; background: var(--red-dark); }

.test-page { width: min(920px, calc(100% - 2rem)); min-height: calc(100vh - 118px); margin: 0 auto; padding: clamp(2rem, 6vw, 5rem) 0; }
.test-card {
  padding: clamp(1.4rem, 5vw, 3.6rem);
  background: rgba(255,255,255,.98);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(23,37,84,.12);
}
.intro-card { text-align: center; }
.age-badge { width: 92px; height: 92px; margin: 0 auto 1.25rem; display: grid; place-items: center; color: #fff; background: var(--red); border: 7px solid #ffe8eb; border-radius: 50%; font: 700 1.05rem "Fredoka", sans-serif; transform: rotate(-3deg); }
.eyebrow { color: var(--red); font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; font-family: "Fredoka", sans-serif; line-height: 1.1; }
h1 { margin-top: .65rem; font-size: clamp(2.3rem, 7vw, 4.2rem); }
.lead { max-width: 690px; margin: 1rem auto 2rem; color: var(--muted); font-size: clamp(1rem, 2vw, 1.15rem); }
.info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; }
.info-grid article { padding: 1.15rem .75rem; display: grid; background: var(--soft); border: 1px solid #e2e8fb; border-radius: 18px; }
.info-grid strong { color: var(--blue); font: 700 1.55rem "Fredoka", sans-serif; }
.info-grid span { color: var(--muted); font-size: .78rem; }
.content-summary { margin-top: 1.5rem; padding: 1.3rem; text-align: left; background: #fff8e4; border: 1px solid #f3df9c; border-radius: 20px; }
.content-summary h2 { font-size: 1.35rem; }
.content-summary ul { margin: .8rem 0 0; padding-left: 1.2rem; }
.content-summary li + li { margin-top: .45rem; }
.test-note { max-width: 720px; margin: 1.35rem auto 0; color: var(--muted); font-size: .9rem; }
.actions { margin-top: 1.8rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1rem; }
.primary-button, .secondary-button {
  min-height: 52px;
  padding: .85rem 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.primary-button { color: #fff; background: var(--red); box-shadow: 0 12px 26px rgba(194,31,48,.24); }
.primary-button:hover { background: var(--red-dark); transform: translateY(-2px); }
.primary-button:disabled { cursor: not-allowed; opacity: .48; transform: none; box-shadow: none; }
.secondary-button { color: var(--blue); background: #fff; border: 2px solid var(--blue); }
.secondary-button:hover { color: #fff; background: var(--blue); }
.secondary-button:disabled { cursor: not-allowed; opacity: .45; color: var(--muted); background: #fff; }
.text-link { color: var(--blue); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }

.form-card { max-width: 760px; margin: 0 auto; }
.form-card h1 { font-size: clamp(2rem, 6vw, 3.2rem); }
.form-card .lead { margin: .75rem 0 1.6rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.field { display: grid; gap: .4rem; }
.field-full { grid-column: 1 / -1; }
.field label { font-weight: 700; font-size: .9rem; }
.field input {
  width: 100%;
  min-height: 50px;
  padding: .75rem .9rem;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 13px;
}
.field input:focus { outline: 3px solid rgba(38,60,136,.12); border-color: var(--blue); }
.consent { grid-column: 1 / -1; display: flex; align-items: flex-start; gap: .7rem; padding: .9rem; color: var(--muted); background: var(--soft); border-radius: 13px; font-size: .82rem; }
.consent input { width: 20px; height: 20px; flex: 0 0 auto; margin-top: .1rem; }
.form-error { min-height: 1.4rem; margin: 1rem 0 0; color: var(--red); font-size: .9rem; font-weight: 700; }
.form-actions { margin-top: .6rem; display: flex; justify-content: space-between; gap: .8rem; }

.test-shell { display: grid; gap: 1rem; }
.progress-card { padding: 1rem 1.2rem; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 10px 28px rgba(23,37,84,.07); }
.progress-meta { margin-bottom: .55rem; display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .82rem; font-weight: 700; }
.progress-track { height: 9px; overflow: hidden; background: #e8ecf5; border-radius: 999px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--red), #eb5a67 55%, var(--blue)); border-radius: inherit; transition: width .25s ease; }
.question-card { padding: clamp(1.3rem, 4vw, 2.5rem); }
.section-label { display: inline-flex; padding: .35rem .7rem; color: var(--blue); background: var(--soft); border-radius: 999px; font-size: .76rem; font-weight: 700; }
.question-number { margin-top: 1rem; color: var(--red); font-size: .82rem; font-weight: 700; text-transform: uppercase; }
.question-card h1 { margin: .45rem 0 1.4rem; font-size: clamp(1.45rem, 4vw, 2.15rem); line-height: 1.32; }
.options { display: grid; gap: .75rem; }
.option { position: relative; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option label { padding: .95rem 1rem; display: grid; grid-template-columns: 38px 1fr; gap: .85rem; align-items: center; background: #fff; border: 2px solid var(--line); border-radius: 16px; cursor: pointer; transition: border .15s ease, background .15s ease, transform .15s ease; }
.option label:hover { border-color: #aab7db; transform: translateY(-1px); }
.option-mark { width: 38px; height: 38px; display: grid; place-items: center; color: var(--blue); background: var(--soft); border-radius: 11px; font-weight: 800; text-transform: uppercase; }
.option input:checked + label { border-color: var(--red); background: #fff7f8; box-shadow: 0 0 0 3px rgba(194,31,48,.08); }
.option input:checked + label .option-mark { color: #fff; background: var(--red); }
.question-actions { margin-top: 1.5rem; display: flex; justify-content: space-between; gap: .75rem; }

.reading-passage { margin: .85rem 0 1.35rem; border: 1px solid #d7def2; border-radius: 18px; background: var(--soft); }
.reading-passage summary { padding: .9rem 1rem; cursor: pointer; color: var(--blue); font-weight: 700; }
.passage-body { max-height: 310px; overflow: auto; padding: 0 1rem 1rem; color: #34405e; font-size: .93rem; }
.passage-body p { margin: .75rem 0 0; }

.loading-card { text-align: center; }
.spinner { width: 50px; height: 50px; margin: 0 auto 1rem; border: 5px solid #e8ecf5; border-top-color: var(--red); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.result-card { text-align: center; }
.result-level { width: 124px; height: 124px; margin: 1.2rem auto; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, var(--blue), var(--navy)); border: 8px solid #e8ecfb; border-radius: 50%; font: 700 2.7rem "Fredoka", sans-serif; }
.result-card h1 { font-size: clamp(2rem, 6vw, 3.4rem); }
.result-title { margin: 0; color: var(--red); font: 700 1.3rem "Fredoka", sans-serif; }
.result-description { max-width: 650px; margin: 1rem auto 1.5rem; color: var(--muted); }
.score-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.score-grid article { padding: 1.1rem; display: grid; background: var(--soft); border-radius: 16px; }
.score-grid strong { color: var(--blue); font: 700 1.4rem "Fredoka", sans-serif; }
.score-grid span { color: var(--muted); font-size: .78rem; }
.result-recommendation { margin-top: 1.4rem; padding: 1.2rem; text-align: left; color: #4e4525; background: #fff8e4; border: 1px solid #f3df9c; border-radius: 18px; }
.result-recommendation h2 { color: var(--ink); font-size: 1.3rem; }
.result-recommendation p { margin: .45rem 0 0; }

@media (max-width: 760px) {
  .test-announcement { font-size: .68rem; }
  .test-header { position: static; padding: .65rem 1rem .85rem; align-items: flex-start; }
  .test-logo img { width: 78px; height: 54px; }
  .test-header nav { max-width: 255px; flex-wrap: wrap; gap: .2rem; }
  .test-header nav a { padding: .42rem .62rem; font-size: .72rem; }
  .test-header nav .header-cta { width: 100%; text-align: center; }
  .test-page { min-height: auto; padding: 2rem 0 4rem; }
  .info-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .field-full, .consent { grid-column: auto; }
  .score-grid { grid-template-columns: 1fr; }
}

@media (max-width: 440px) {
  .test-page { width: min(100% - 1rem, 920px); }
  .test-card { border-radius: 20px; }
  .form-actions, .question-actions { flex-direction: column-reverse; }
  .form-actions button, .question-actions button { width: 100%; }
  .option label { grid-template-columns: 34px 1fr; gap: .65rem; }
  .option-mark { width: 34px; height: 34px; }
}

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