.nback-shell {
  width: min(1080px, 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;
}

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

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

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

.game-heading h1 {
  max-width: 790px;
  overflow-wrap: anywhere;
  font-size: clamp(2.35rem, 6.7vw, 5rem);
  line-height: 0.94;
}

.lede {
  max-width: 740px;
  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, minmax(0, 1fr));
  border-bottom: 3px solid var(--ink);
}

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

.stat:last-child { border-right: 0; }
.stat strong { overflow-wrap: anywhere; font-size: clamp(1rem, 3vw, 1.55rem); }

.game-stage {
  min-height: 700px;
  padding: 34px 30px 30px;
  background:
    linear-gradient(rgba(88, 199, 215, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 199, 215, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 50% 25%, #29203a 0, transparent 54%);
  background-size: 24px 24px, 24px 24px, auto;
}

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

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

.memory-board {
  display: grid;
  width: min(620px, 100%);
  grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 0 auto 20px;
}

.symbol-card {
  display: grid;
  min-width: 0;
  min-height: 205px;
  grid-template-rows: auto 1fr;
  place-items: center;
  padding: 13px;
  border: 2px solid var(--line);
  background:
    repeating-linear-gradient(0deg, transparent 0 19px, rgba(247, 201, 72, 0.045) 19px 20px),
    #171220;
}

.symbol-card--current {
  border: 3px solid var(--ink);
  box-shadow: 7px 7px 0 var(--shadow);
}

.symbol-card-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.pixel-symbol {
  display: grid;
  width: 130px;
  height: 130px;
  place-items: center;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 7rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 6px 6px 0 var(--shadow);
}

.pixel-symbol--star { color: var(--gold); }
.pixel-symbol--circle { color: var(--blue); }
.pixel-symbol--triangle { color: var(--red); }
.pixel-symbol--square { color: var(--green); }
.pixel-symbol--muted { color: var(--muted); font-size: 4.5rem; text-shadow: none; }

.compare-arrow {
  color: var(--gold);
  font-size: 2.1rem;
  font-weight: 900;
}

.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: 680px;
  min-height: 44px;
  margin: 9px 0 10px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.timing-wrap {
  width: min(620px, 100%);
  margin: 3px 0 12px;
}

.timing-wrap[hidden] { display: none; }

.timing-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.deadline-track {
  height: 14px;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: #171220;
}

.deadline-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--green);
  transform: scaleX(1);
  transform-origin: left center;
  will-change: transform;
}

[dir="rtl"] .deadline-fill { transform-origin: right center; }
.deadline-fill.is-danger { background: var(--red); }

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

.result-flash[hidden] { display: none; }
.result-flash strong { color: var(--green); font-size: 1.35rem; }
.result-flash span { color: var(--muted); font-size: 0.8rem; }

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

.answer-button {
  display: grid;
  min-width: 0;
  min-height: 105px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border: 3px solid var(--ink);
  border-radius: 0;
  background: #231b30;
  box-shadow: 5px 5px 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;
}

.answer-button:disabled { cursor: default; opacity: 0.48; }
.answer-button:not(:disabled):hover { background: #302540; }

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

.answer-button:focus-visible { outline: 4px solid var(--gold); outline-offset: 3px; }
.answer-icon { color: var(--gold); font-size: 2.4rem; font-weight: 900; }
.answer-button--different .answer-icon { color: var(--red); }
.answer-button strong { min-width: 0; overflow-wrap: anywhere; font-size: clamp(0.9rem, 2.2vw, 1.2rem); }

.key-pair { display: flex; gap: 5px; }
.key-pair kbd { width: 31px; height: 31px; border-color: var(--line); }

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

.game-stage[data-state="learning"] .symbol-card--current { animation: ready-pulse 700ms steps(2, end) 2; }
.game-stage[data-state="active"] .symbol-card--current { animation: symbol-arrive 120ms steps(2, end); }

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

.game-stage[data-state="game-over"] { background-color: #351521; }
.game-stage[data-state="complete"] { background-color: #2d2515; }
.game-stage[data-state="cancelled"] { background-color: #241a31; }

.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 { min-width: 0; 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(4, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
.related-links a { display: flex; min-width: 0; 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.48; } 50%, 100% { opacity: 1; } }
@keyframes symbol-arrive { from { transform: scale(0.82); } to { transform: scale(1); } }

@media (max-width: 900px) {
  .game-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, minmax(0, 1fr)); }
}

@media (max-width: 650px) {
  .nback-shell { width: min(100% - 18px, 620px); padding-top: 10px; }
  .game-card { box-shadow: 6px 6px 0 var(--shadow); }
  .game-heading { gap: 20px; padding: 24px 18px; }
  .game-heading h1 { font-size: clamp(2.05rem, 11vw, 3.8rem); }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n + 2) { border-bottom: 2px solid var(--line); }
  .game-stage { min-height: 690px; padding: 26px 10px 24px; }
  .prompt-panel { min-height: 475px; }
  .memory-board { grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr); gap: 6px; }
  .compare-arrow { font-size: 1.35rem; }
  .symbol-card { min-height: 165px; padding: 9px 5px; }
  .symbol-card--current { box-shadow: 4px 4px 0 var(--shadow); }
  .pixel-symbol { width: 100px; height: 105px; font-size: 5.5rem; text-shadow: 4px 4px 0 var(--shadow); }
  .pixel-symbol--muted { font-size: 3.5rem; text-shadow: none; }
  .symbol-card-label { font-size: 0.64rem; }
  .answer-pad { gap: 8px; }
  .answer-button { min-height: 122px; grid-template-columns: auto minmax(0, 1fr); gap: 5px 8px; padding: 11px 9px; }
  .answer-icon { font-size: 1.8rem; }
  .key-pair { grid-column: 1 / -1; justify-content: center; }
  .answer-button strong { font-size: 0.78rem; }
  .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: 360px) {
  .game-stage { padding-right: 7px; padding-left: 7px; }
  .memory-board { grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr); }
  .symbol-card { min-height: 150px; }
  .pixel-symbol { width: 82px; height: 92px; font-size: 4.7rem; }
  .compare-arrow { font-size: 1rem; }
  .answer-button { padding: 9px 6px; }
  .answer-icon { font-size: 1.55rem; }
  .answer-button strong { font-size: 0.7rem; }
  .key-pair kbd { width: 27px; height: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .game-stage[data-state="learning"] .symbol-card--current,
  .game-stage[data-state="active"] .symbol-card--current { animation: none; }
  .answer-button { transition: none; }
}
