:root {
  --test-navy: #071227;
  --test-blue: #123e67;
  --test-yellow: #f4c76c;
  --test-coral: #d96857;
  --test-teal: #1c716d;
  --test-paper: #f5f7fa;
  --test-line: #d8e0e8;
}

.test-main {
  min-height: 70vh;
  background: var(--test-paper);
}

.test-intro,
.test-game,
.test-results,
.test-error {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.test-intro {
  padding: 18px 0 92px;
}

.test-intro-media {
  height: clamp(190px, 28vw, 310px);
  display: grid;
  grid-template-columns: 1.45fr 0.8fr 0.8fr;
  gap: 8px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--test-navy);
}

.test-intro-media img {
  width: 100%;
  height: 100%;
  min-width: 0;
  object-fit: cover;
}

.test-intro-copy {
  max-width: 860px;
  margin: -54px auto 0;
  padding: 34px 42px 0;
  position: relative;
  z-index: 1;
  border-top: 5px solid var(--test-yellow);
  background: var(--test-paper);
  text-align: center;
}

.test-intro-copy .section-label,
.test-result-summary .section-label,
.test-review-heading .section-label {
  color: var(--test-teal);
}

.test-intro h1 {
  max-width: 800px;
  margin: 12px auto 18px;
  color: var(--test-navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.25rem, 5vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: 0;
  text-wrap: balance;
}

.test-intro-copy > p:last-child {
  max-width: 720px;
  margin: 0 auto;
  color: #4f5f70;
  font-size: 1.08rem;
  line-height: 1.72;
}

.test-levels {
  margin-top: 62px;
}

.test-levels-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.test-levels-heading h2,
.test-review-heading h2 {
  margin: 0;
  color: var(--test-navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  letter-spacing: 0;
}

.test-levels-heading p,
.test-review-heading p {
  margin: 0;
  color: #5e6b79;
}

.test-level-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.test-level {
  min-height: 172px;
  display: grid;
  align-content: end;
  gap: 6px;
  padding: 26px;
  border: 1px solid var(--test-line);
  border-top: 5px solid var(--test-teal);
  border-radius: 8px;
  background: #fff;
  color: var(--test-navy);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.test-level-medium { border-top-color: var(--test-yellow); }
.test-level-hard { border-top-color: var(--test-coral); }

.test-level:hover,
.test-level:focus-visible {
  transform: translateY(-4px);
  border-color: #8798a8;
  box-shadow: 0 18px 38px rgba(7, 18, 39, 0.12);
}

.test-level span {
  color: var(--test-teal);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.test-level-medium span { color: #8a6514; }
.test-level-hard span { color: #a64236; }

.test-level strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.48rem;
  letter-spacing: 0;
}

.test-level small {
  color: #687585;
  font-size: 0.92rem;
}

.test-game {
  max-width: 820px;
  padding: 64px 0 100px;
}

.test-game-top {
  min-height: 44px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
}

.test-game-top p {
  margin: 0;
  color: #586879;
  font-weight: 800;
}

.test-quiet-action {
  justify-self: start;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--test-blue);
  font-weight: 800;
  cursor: pointer;
}

.test-level-chip {
  justify-self: end;
  padding: 7px 11px;
  border-radius: 999px;
  background: #e5ecef;
  color: var(--test-blue);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.test-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce3ea;
}

.test-progress span {
  display: block;
  width: 10%;
  height: 100%;
  border-radius: inherit;
  background: var(--test-yellow);
  transition: width 220ms ease;
}

#testQuestionForm {
  margin-top: 28px;
  padding: 38px;
  border: 1px solid var(--test-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 50px rgba(7, 18, 39, 0.08);
}

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

#testQuestion {
  width: 100%;
  margin: 0 0 28px;
  color: var(--test-navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  font-weight: 750;
  line-height: 1.18;
  letter-spacing: 0;
  text-wrap: balance;
}

.test-options {
  display: grid;
  gap: 11px;
}

.test-option {
  position: relative;
  min-height: 58px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  padding: 12px 16px;
  border: 1px solid #cfd8e1;
  border-radius: 6px;
  background: #fff;
  color: #1b2b3c;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.test-option:hover { border-color: #7890a4; }

.test-option:has(input:focus-visible) {
  outline: 3px solid rgba(244, 199, 108, 0.5);
  outline-offset: 2px;
}

.test-option.is-selected {
  border-color: var(--test-blue);
  background: #eef4f8;
  box-shadow: inset 4px 0 0 var(--test-yellow);
}

.test-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.test-option-marker {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid #aebbc7;
  border-radius: 50%;
  color: transparent;
  font-size: 0.78rem;
  font-weight: 900;
}

.test-option.is-selected .test-option-marker {
  border-color: var(--test-blue);
  background: var(--test-blue);
  color: #fff;
}

.test-option-text {
  line-height: 1.45;
}

.test-next,
.test-primary,
.test-secondary,
.test-share,
.test-error button {
  min-height: 50px;
  padding: 0 20px;
  border: 1px solid var(--test-blue);
  border-radius: 6px;
  background: var(--test-blue);
  color: #fff;
  font-weight: 850;
  cursor: pointer;
}

.test-next {
  width: 100%;
  margin-top: 26px;
}

.test-next:disabled {
  border-color: #d7dde3;
  background: #e7ebef;
  color: #798592;
  cursor: not-allowed;
}

.test-results {
  padding: 62px 0 110px;
}

.test-result-summary {
  max-width: 790px;
  margin: 0 auto;
  padding: 42px;
  border-top: 6px solid var(--test-yellow);
  border-radius: 0 0 8px 8px;
  background: var(--test-navy);
  color: #fff;
  text-align: center;
  box-shadow: 0 24px 56px rgba(7, 18, 39, 0.18);
}

.test-result-summary h2 {
  margin: 7px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  letter-spacing: 0;
}

.test-score {
  display: block;
  margin: 10px 0 4px;
  color: var(--test-yellow);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4.2rem, 11vw, 7.4rem);
  line-height: 1;
  letter-spacing: 0;
}

.test-result-summary > p:not(.section-label, .test-share-status) {
  max-width: 580px;
  margin: 14px auto 0;
  color: #c9d2dc;
  line-height: 1.65;
}

.test-result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
}

.test-primary {
  border-color: var(--test-yellow);
  background: var(--test-yellow);
  color: var(--test-navy);
}

.test-secondary,
.test-share {
  border-color: #718095;
  background: transparent;
}

.test-share-status {
  min-height: 1.5em;
  margin: 12px 0 0;
  color: #f4dba6;
  font-size: 0.9rem;
}

.test-review-heading {
  max-width: 780px;
  margin: 78px auto 30px;
  text-align: center;
}

.test-review-heading h2 { margin: 7px 0 14px; }

.test-review {
  max-width: 900px;
  display: grid;
  gap: 14px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  counter-reset: review;
}

.test-review-item {
  counter-increment: review;
  padding: 26px 28px;
  border: 1px solid var(--test-line);
  border-left: 5px solid var(--test-teal);
  border-radius: 6px;
  background: #fff;
}

.test-review-item.is-wrong { border-left-color: var(--test-coral); }

.test-review-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--test-teal);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.test-review-item.is-wrong .test-review-status { color: #a33f35; }

.test-review-status::before {
  content: counter(review, decimal-leading-zero);
  min-width: 30px;
  color: #778391;
}

.test-review-item h3 {
  margin: 12px 0 18px;
  color: var(--test-navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.32rem;
  line-height: 1.28;
  letter-spacing: 0;
}

.test-review-answer {
  margin: 7px 0;
  color: #405164;
  line-height: 1.5;
}

.test-review-answer strong { color: var(--test-navy); }

.test-review-explanation {
  margin: 16px 0 0;
  padding-top: 15px;
  border-top: 1px solid #e1e6eb;
  color: #536273;
  line-height: 1.65;
}

.test-review-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  margin-top: 13px;
  color: var(--test-blue);
  font-weight: 850;
  text-decoration: underline;
  text-decoration-color: var(--test-yellow);
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
}

.test-error {
  max-width: 720px;
  padding: 90px 0 120px;
  text-align: center;
}

.test-error h2 {
  color: var(--test-navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  letter-spacing: 0;
}

.test-error p { color: #5b6978; }
.test-error button { margin-top: 18px; }

.test-page [hidden] { display: none !important; }

@media (max-width: 760px) {
  .test-intro,
  .test-game,
  .test-results,
  .test-error {
    width: min(100% - 32px, 1120px);
  }

  .test-intro { padding-bottom: 68px; }

  .test-intro-media {
    height: 182px;
    grid-template-columns: 1.35fr 0.8fr;
  }

  .test-intro-media img:last-child { display: none; }

  .test-intro-copy {
    width: calc(100% - 20px);
    margin-top: -34px;
    padding: 26px 16px 0;
  }

  .test-intro h1 { font-size: clamp(2.25rem, 12vw, 3.45rem); }

  .test-levels { margin-top: 44px; }

  .test-levels-heading {
    display: block;
    margin-bottom: 18px;
  }

  .test-levels-heading p { margin-top: 7px; }

  .test-level-grid { grid-template-columns: 1fr; }

  .test-level {
    min-height: 126px;
    padding: 21px;
  }

  .test-game { padding: 38px 0 74px; }

  .test-game-top {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .test-game-top p {
    grid-column: 1 / -1;
    grid-row: 2;
    text-align: center;
  }

  #testQuestionForm {
    margin-top: 22px;
    padding: 25px 18px;
  }

  #testQuestion { font-size: 1.65rem; }

  .test-option {
    min-height: 62px;
    padding: 12px;
  }

  .test-results { padding: 38px 0 82px; }

  .test-result-summary { padding: 34px 18px; }

  .test-result-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .test-review-heading { margin-top: 58px; }

  .test-review-item { padding: 23px 19px; }
}

@media (max-height: 430px) and (orientation: landscape) {
  .test-intro-media { height: 150px; }
  .test-intro-copy { margin-top: -24px; }
  .test-levels { margin-top: 30px; }
  .test-level-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .test-level { min-height: 112px; padding: 16px; }
  .test-level strong { font-size: 1.14rem; }
  .test-game { padding-top: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .test-level,
  .test-progress span,
  .test-option {
    transition: none;
  }
}
