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

.game-heading {
  display: grid;
  grid-template-columns: 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: 800px;
  font-size: clamp(2.7rem, 8vw, 5.7rem);
  line-height: 0.9;
}

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

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

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

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

.game-card > .mode-panel {
  margin: 0;
  padding: 20px 24px;
  border-bottom: 3px solid var(--ink);
}

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

.stat {
  min-width: 0;
  padding: 18px 20px;
  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);
}

.game-stage {
  display: flex;
  min-height: 900px;
  flex-direction: column;
  align-items: center;
  padding: 34px 26px 30px;
  overflow: hidden;
  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% 40%, #2b233b 0, transparent 58%);
  background-size: 24px 24px, 24px 24px, auto;
}

.stage-copy {
  min-height: 108px;
  text-align: center;
}

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

.stage-copy h2 {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2.7rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.stage-copy > p:last-child {
  max-width: 650px;
  margin: 12px auto 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.target-cue {
  display: grid;
  width: min(430px, 92%);
  min-height: 116px;
  grid-template-columns: auto 84px 1fr;
  gap: 14px;
  align-items: center;
  margin: 4px auto 14px;
  padding: 12px 15px;
  border: 3px solid var(--gold);
  background: #171220;
  box-shadow: 6px 6px 0 var(--shadow);
}

.target-cue-label {
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.target-cue strong {
  min-width: 0;
  color: var(--ink);
  font-size: 0.75rem;
  line-height: 1.45;
  letter-spacing: 0.05em;
  overflow-wrap: anywhere;
}

.pixel-token {
  --token-color: var(--gold);
  position: relative;
  display: grid;
  width: 58px;
  height: 58px;
  flex: none;
  place-items: center;
  overflow: hidden;
  border: 3px solid var(--token-color);
  background: #171220;
  color: var(--token-color);
  image-rendering: pixelated;
}

.pixel-token::before {
  position: absolute;
  inset: 4px;
  background: transparent;
  content: "";
  opacity: 0.3;
}

.pixel-token[data-color="blue"] { --token-color: var(--blue); }
.pixel-token[data-color="green"] { --token-color: var(--green); }
.pixel-token[data-color="red"] { --token-color: var(--red); }
.pixel-token[data-color="gold"] { --token-color: var(--gold); }

.pixel-token[data-pattern="dots"]::before {
  background-image: radial-gradient(circle, var(--token-color) 1.5px, transparent 2px);
  background-size: 8px 8px;
}

.pixel-token[data-pattern="bars"]::before {
  background-image: repeating-linear-gradient(90deg, var(--token-color) 0 3px, transparent 3px 8px);
}

.pixel-token[data-pattern="cross"]::before {
  background-image:
    repeating-linear-gradient(45deg, var(--token-color) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(-45deg, var(--token-color) 0 2px, transparent 2px 9px);
}

.token-glyph {
  position: relative;
  z-index: 1;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 2.25rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 2px 2px 0 #08060d;
}

.target-token {
  width: 76px;
  height: 76px;
  border-width: 4px;
}

.target-token .token-glyph {
  font-size: 3rem;
}

.deadline-wrap {
  width: min(540px, 94%);
  margin: 0 auto 14px;
}

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

.deadline-copy {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.deadline-copy output {
  color: var(--gold);
}

.deadline-track {
  width: 100%;
  height: 13px;
  margin: 0;
  overflow: hidden;
  border: 2px solid var(--line);
  background: #0d0a12;
}

.search-grid {
  display: grid;
  width: min(576px, 94vw);
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  margin: 0 auto 18px;
}

.search-cell {
  position: relative;
  display: flex;
  aspect-ratio: 1;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
  border: 3px solid var(--line);
  border-radius: 0;
  background: #211a2e;
  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, border-color 100ms ease;
  user-select: none;
}

.search-cell .cell-number {
  position: absolute;
  top: 6px;
  left: 7px;
  color: #8c8494;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.search-cell .token-name {
  display: block;
  max-width: calc(100% - 10px);
  overflow: hidden;
  color: #b9b0c2;
  font-size: 0.56rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-cell kbd {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 25px;
  height: 25px;
  border-width: 1px;
  border-bottom-width: 3px;
  color: #d1c7d9;
  font-size: 0.66rem;
}

.search-cell:hover {
  border-color: #71637e;
  background: #2d243b;
}

.search-cell:active,
.search-cell.is-pressed {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 var(--shadow);
}

.search-cell:focus-visible {
  z-index: 2;
  outline: 4px solid var(--blue);
  outline-offset: 3px;
}

.search-cell.is-correct,
.search-cell.is-target-reveal {
  border-color: var(--green);
  background: #193726;
}

.search-cell.is-wrong {
  border-color: var(--red);
  background: #491b29;
}

.feedback {
  display: flex;
  min-height: 45px;
  margin: 0 0 14px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.feedback[hidden] {
  display: none;
}

.feedback strong {
  color: var(--green);
  font-size: 1.2rem;
}

.feedback span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

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

.game-stage[data-state="active"] .search-grid {
  animation: grid-enter 130ms steps(2, end);
}

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

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

.control-note {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
  text-align: center;
}

.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 grid-enter {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

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

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

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

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

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

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

  .game-heading h1 {
    font-size: clamp(2.5rem, 14vw, 4rem);
  }

  .game-card > .mode-panel {
    padding-inline: 16px;
  }

  .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);
  }

  .game-stage {
    min-height: 760px;
    padding: 28px 7px 24px;
  }

  .stage-copy {
    min-height: 122px;
  }

  .target-cue {
    width: min(390px, calc(100vw - 42px));
    min-height: 96px;
    grid-template-columns: auto 64px 1fr;
    gap: 9px;
    padding: 9px 10px;
    box-shadow: 4px 4px 0 var(--shadow);
  }

  .target-token {
    width: 60px;
    height: 60px;
  }

  .target-token .token-glyph {
    font-size: 2.4rem;
  }

  .search-grid {
    width: min(400px, calc(100vw - 36px));
    gap: 6px;
  }

  .search-cell {
    gap: 2px;
    border-width: 2px;
    box-shadow: 3px 3px 0 var(--shadow);
  }

  .search-cell .pixel-token {
    width: min(52px, 72%);
    height: min(52px, 54%);
    border-width: 2px;
  }

  .search-cell .token-glyph {
    font-size: clamp(1.45rem, 7vw, 2rem);
  }

  .search-cell .cell-number {
    top: 3px;
    left: 4px;
    font-size: 0.52rem;
  }

  .search-cell kbd {
    right: 3px;
    bottom: 3px;
    width: 20px;
    height: 20px;
    font-size: 0.56rem;
  }

  .search-cell .token-name {
    font-size: 0.46rem;
  }

  .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) {
  .target-cue strong {
    font-size: 0.62rem;
  }

  .search-grid {
    width: min(304px, calc(100vw - 30px));
    gap: 4px;
  }

  .search-cell .pixel-token {
    width: 43px;
    height: 39px;
  }

  .search-cell .token-glyph {
    font-size: 1.45rem;
  }

  .search-cell .token-name {
    max-width: calc(100% - 6px);
    font-size: 0.41rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .search-cell,
  .deadline-fill {
    transition: none !important;
  }

  .game-stage[data-state="active"] .search-grid {
    animation: none;
  }
}
