.flanker-shell {
  width: min(1060px, calc(100% - 32px));
}

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

.test-card {
  overflow: hidden;
  border: 3px solid var(--ink);
  background: var(--panel);
  box-shadow: 10px 10px 0 var(--shadow);
}

.test-heading {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: end;
  padding: 30px 34px;
  border-bottom: 3px solid var(--ink);
}

.test-heading .eyebrow {
  margin-bottom: 10px;
}

.test-heading h1 {
  max-width: 760px;
  font-size: clamp(2.4rem, 7vw, 5rem);
  line-height: 0.94;
}

.lede {
  max-width: 690px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.progress-box {
  min-width: 150px;
  padding: 16px;
  border: 2px solid var(--line);
  background: #171220;
  text-align: center;
}

.progress-box > span,
.stat > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.progress-box strong {
  color: var(--gold);
  font-size: 1.6rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 3px solid var(--ink);
}

.stat {
  min-width: 0;
  padding: 18px 16px;
  border-right: 2px solid var(--line);
  text-align: center;
}

.stat:last-child {
  border-right: 0;
}

.stat strong {
  color: var(--ink);
  font-size: clamp(1.05rem, 3vw, 1.65rem);
}

.test-stage {
  min-height: 570px;
  padding: 38px 34px 32px;
  background:
    linear-gradient(rgba(88, 199, 215, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 199, 215, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 50% 27%, #203142 0, transparent 55%);
  background-size: 24px 24px, 24px 24px, auto;
}

.prompt-panel {
  display: flex;
  min-height: 330px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.stage-kicker {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.arrow-frame {
  display: grid;
  width: min(720px, 100%);
  min-height: 138px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(2px, 1vw, 10px);
  align-items: center;
  margin-bottom: 20px;
  padding: 14px;
  border: 3px solid var(--line);
  background: #120f1d;
  box-shadow: 7px 7px 0 var(--shadow);
}

.arrow-frame span {
  display: grid;
  min-width: 0;
  height: 88px;
  place-items: center;
  color: #9da6b9;
  font-size: clamp(2.4rem, 8vw, 5.6rem);
  font-weight: 900;
  line-height: 1;
  text-shadow: 4px 4px 0 var(--shadow);
}

.arrow-frame .center-arrow {
  border: 3px solid var(--gold);
  background: #2a2518;
  color: var(--gold);
  box-shadow: 4px 4px 0 var(--shadow);
}

.prompt-panel h2 {
  margin: 0;
  font-size: clamp(1.45rem, 4vw, 2.5rem);
  letter-spacing: -0.04em;
}

.prompt-panel > p:not(.stage-kicker, .sr-only) {
  max-width: 650px;
  min-height: 48px;
  margin: 12px 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.result-flash {
  display: flex;
  min-height: 42px;
  margin: 0 0 15px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.result-flash[hidden] {
  display: none;
}

.result-flash strong {
  color: var(--green);
  font-size: 1.75rem;
}

.result-flash span {
  color: var(--muted);
  font-size: 0.82rem;
}

.direction-pad {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 760px;
  margin: 24px auto 0;
}

.direction-button {
  display: grid;
  min-height: 120px;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border: 3px solid var(--ink);
  border-radius: 0;
  background: #231b30;
  box-shadow: 6px 6px 0 var(--shadow);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 80ms ease, box-shadow 80ms ease, background 100ms ease;
  user-select: none;
}

.direction-button:disabled {
  cursor: default;
  opacity: 0.48;
}

.direction-button:not(:disabled):hover {
  background: #302540;
}

.direction-button:not(:disabled):active,
.direction-button.is-pressed {
  transform: translate(4px, 4px);
  box-shadow: 2px 2px 0 var(--shadow);
}

.direction-button:focus-visible {
  outline: 4px solid var(--gold);
  outline-offset: 3px;
}

.direction-mark {
  color: var(--blue);
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 900;
  line-height: 1;
}

.direction-right .direction-mark {
  color: var(--orange);
}

.direction-button strong {
  font-size: clamp(1rem, 3vw, 1.35rem);
  letter-spacing: 0.1em;
  text-align: left;
}

.key-pair {
  display: flex;
  gap: 6px;
}

.key-pair kbd {
  width: 34px;
  height: 34px;
  border-color: var(--line);
  font-size: 0.9rem;
}

.control-note {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
  text-align: center;
}

.test-stage[data-state="countdown"] .center-arrow {
  animation: ready-pulse 700ms steps(2, end) infinite;
}

.test-stage[data-state="active"] .arrow-frame {
  border-color: var(--blue);
}

.test-stage[data-state="active"] .center-arrow {
  transform: translateY(-2px);
}

.test-stage[data-state="active"] .primary-button,
.test-stage[data-state="feedback"] .primary-button,
.test-stage[data-state="countdown"] .primary-button {
  visibility: hidden;
}

.test-stage[data-state="game-over"] {
  background-color: #351521;
}

.test-stage[data-state="complete"] {
  background-color: #1d3128;
}

.content-section {
  display: grid;
  grid-template-columns: 0.85fr 1.6fr;
  gap: 64px;
  padding: 76px 18px 58px;
}

.content-section h2,
.info-panel h2,
.faq-section h2,
.related-section h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.steps-list {
  margin: 0;
  padding: 0;
  border-top: 2px solid var(--line);
  list-style: none;
}

.steps-list li {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 18px;
  padding: 20px 0;
  border-bottom: 2px solid var(--line);
}

.steps-list span {
  color: var(--gold);
  font-weight: 800;
}

.steps-list p,
.info-panel p,
.faq-list p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.reading-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.info-panel {
  padding: 30px;
  border: 2px solid var(--line);
  background: var(--panel);
}

.info-panel h2 {
  margin-bottom: 22px;
}

.info-panel > p:not(.section-kicker) + p {
  margin-top: 16px;
}

.faq-section,
.related-section {
  padding: 72px 18px 0;
}

.faq-list {
  margin-top: 28px;
  border-top: 2px solid var(--line);
}

.faq-list details {
  border-bottom: 2px solid var(--line);
}

.faq-list summary {
  padding: 22px 44px 22px 0;
  color: var(--ink);
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.4;
}

.faq-list details p {
  max-width: 850px;
  padding: 0 0 24px;
}

.related-links {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 28px;
}

.related-links a {
  display: flex;
  min-height: 118px;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  border: 2px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
  line-height: 1.35;
  text-decoration: none;
}

.related-links a:hover,
.related-links a:focus-visible {
  border-color: var(--gold);
  outline: 0;
}

.related-links small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 400;
}

@keyframes ready-pulse {
  0%, 49% { opacity: 0.4; }
  50%, 100% { opacity: 1; }
}

@media (max-width: 820px) {
  .test-heading {
    grid-template-columns: 1fr;
  }

  .progress-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .progress-box > span {
    margin: 0;
  }

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

@media (max-width: 650px) {
  .flanker-shell {
    width: min(100% - 18px, 620px);
    padding-top: 10px;
  }

  .test-card {
    box-shadow: 6px 6px 0 var(--shadow);
  }

  .test-heading {
    gap: 20px;
    padding: 24px 18px;
  }

  .test-heading h1 {
    font-size: clamp(2.15rem, 11vw, 3.7rem);
  }

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

  .stat:nth-child(2) {
    border-right: 0;
  }

  .stat:nth-child(-n + 2) {
    border-bottom: 2px solid var(--line);
  }

  .test-stage {
    min-height: 570px;
    padding: 28px 14px 24px;
  }

  .prompt-panel {
    min-height: 320px;
  }

  .arrow-frame {
    min-height: 104px;
    padding: 9px;
    box-shadow: 5px 5px 0 var(--shadow);
  }

  .arrow-frame span {
    height: 68px;
    font-size: clamp(2rem, 13vw, 4.1rem);
    text-shadow: 2px 2px 0 var(--shadow);
  }

  .arrow-frame .center-arrow {
    border-width: 2px;
  }

  .direction-pad {
    gap: 10px;
  }

  .direction-button {
    min-height: 104px;
    grid-template-columns: 1fr;
    gap: 5px;
    justify-items: center;
    padding: 12px 8px;
  }

  .direction-button strong {
    text-align: center;
  }

  .key-pair {
    display: none;
  }

  .content-section,
  .reading-grid {
    grid-template-columns: 1fr;
  }

  .content-section {
    gap: 30px;
    padding: 58px 8px 44px;
  }

  .info-panel {
    padding: 24px 20px;
  }

  .faq-section,
  .related-section {
    padding: 58px 8px 0;
  }

  .related-links {
    grid-template-columns: 1fr;
  }

  .related-links a {
    min-height: 92px;
  }
}

@media (max-width: 370px) {
  .arrow-frame {
    padding-inline: 5px;
  }

  .arrow-frame span {
    height: 58px;
    font-size: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .test-stage[data-state="countdown"] .center-arrow {
    animation: none;
  }

  .direction-button,
  .center-arrow,
  .deadline-fill {
    transition: none !important;
  }
}
