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

.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: 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: 820px;
  font-size: clamp(2.4rem, 7vw, 5rem);
  line-height: 0.94;
}

.lede {
  max-width: 720px;
  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 { font-size: clamp(1.05rem, 3vw, 1.55rem); }

.game-stage {
  min-height: 700px;
  padding: 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% 38%, #30233e 0, transparent 57%);
  background-size: 24px 24px, 24px 24px, auto;
}

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

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

.status-panel h2 {
  margin: 0;
  font-size: clamp(1.4rem, 4vw, 2.45rem);
  letter-spacing: -0.04em;
}

.status-panel > p:not(.stage-kicker) {
  max-width: 700px;
  min-height: 44px;
  margin: 9px 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.deadline-track {
  width: min(460px, 88%);
  height: 8px;
  margin: 1px 0 16px;
  overflow: hidden;
  border: 2px solid var(--line);
  background: #171220;
}

.deadline-track[hidden] { display: none; }
.deadline-fill {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left;
  background: var(--green);
}
.deadline-fill.is-danger { background: var(--red); }

.simon-board {
  display: grid;
  width: min(620px, 100%);
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 12px auto 0;
  padding: 16px;
  border: 3px solid var(--ink);
  background: #171220;
  box-shadow: 8px 8px 0 var(--shadow);
}

.simon-pad {
  position: relative;
  display: grid;
  min-height: 190px;
  grid-template-columns: 1fr auto;
  grid-template-rows: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 18px;
  border: 4px solid var(--ink);
  border-radius: 0;
  box-shadow: inset 0 -10px 0 rgba(0, 0, 0, 0.2), 5px 5px 0 var(--shadow);
  color: #120f1d;
  cursor: pointer;
  touch-action: manipulation;
  transition: filter 90ms ease, transform 90ms ease, box-shadow 90ms ease;
  user-select: none;
}

.simon-pad--one { background: #b93d50; }
.simon-pad--two { background: #348da3; }
.simon-pad--three { background: #c89b25; }
.simon-pad--four { background: #4e9c60; }

.simon-pad:disabled { cursor: default; }
.simon-pad:not(:disabled):hover { filter: brightness(1.15); }
.simon-pad:not(:disabled):active,
.simon-pad.is-pressed {
  transform: translate(4px, 4px);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12), 1px 1px 0 var(--shadow);
  filter: brightness(1.45) saturate(1.15);
}

.simon-pad.is-playing {
  z-index: 1;
  transform: scale(1.035);
  border-color: #fff6d6;
  box-shadow: 0 0 0 5px var(--gold), 8px 8px 0 var(--shadow);
  filter: brightness(1.65) saturate(1.2);
}

.simon-pad.is-wrong {
  animation: wrong-flash 180ms steps(2, end) 2;
}

.simon-pad:focus-visible {
  z-index: 2;
  outline: 4px solid #fff6d6;
  outline-offset: 3px;
}

.pad-symbol {
  grid-column: 1 / -1;
  justify-self: center;
  color: #fff6d6;
  font-family: system-ui, sans-serif;
  font-size: clamp(3.5rem, 10vw, 6rem);
  line-height: 1;
  text-shadow: 4px 4px 0 rgba(18, 15, 29, 0.55);
}

.simon-pad strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.77rem;
  letter-spacing: 0.04em;
  text-align: left;
}

.simon-pad kbd {
  border-color: rgba(18, 15, 29, 0.75);
  background: #fff6d6;
  color: #120f1d;
}

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

.game-stage[data-state="playing"] .simon-pad { opacity: 0.68; }
.game-stage[data-state="playing"] .simon-pad.is-playing { opacity: 1; }
.game-stage[data-state="playing"] .primary-button,
.game-stage[data-state="input"] .primary-button,
.game-stage[data-state="feedback"] .primary-button,
.game-stage[data-state="countdown"] .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 { 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 wrong-flash {
  from { background: var(--red); }
  to { background: #fff6d6; }
}

@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, 1fr); }
}

@media (max-width: 650px) {
  .simon-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.2rem, 12vw, 3.8rem); }
  .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: 620px; padding: 24px 10px; }
  .status-panel { min-height: 174px; }
  .simon-board { gap: 8px; padding: 9px; box-shadow: 5px 5px 0 var(--shadow); }
  .simon-pad { min-height: 150px; padding: 12px 10px; border-width: 3px; }
  .pad-symbol { font-size: clamp(3.2rem, 18vw, 5.3rem); }
  .simon-pad strong { font-size: 0.66rem; }
  .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: 380px) {
  .simon-pad { min-height: 132px; grid-template-columns: 1fr; justify-items: center; }
  .simon-pad strong { text-align: center; }
  .simon-pad kbd { display: none; }
  .pad-symbol { font-size: 3.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .simon-pad { transition: none; }
  .simon-pad.is-wrong { animation: none; }
  .deadline-fill { transition: none !important; }
}
