.dodge-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: 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.35rem, 6.7vw, 4.9rem);
  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.65rem); }

.game-stage {
  --attack-duration: 1500ms;
  --attack-distance: calc(min(690px, 100vw - 44px) / 2 + 48px);
  min-height: 690px;
  padding: 32px 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% 28%, #29203a 0, transparent 54%);
  background-size: 24px 24px, 24px 24px, auto;
}

.prompt-panel {
  display: flex;
  min-height: 455px;
  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;
}

.dodge-arena {
  position: relative;
  width: min(690px, 100%);
  height: 230px;
  margin: 0 auto 15px;
  overflow: hidden;
  border: 3px solid var(--ink);
  background:
    linear-gradient(180deg, #191426 0 63%, #241c31 63% 100%);
  box-shadow: 7px 7px 0 var(--shadow);
  isolation: isolate;
}

.dodge-arena::before,
.dodge-arena::after {
  position: absolute;
  z-index: 0;
  bottom: 56px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  content: "";
}

.dodge-arena::before { left: 22px; }
.dodge-arena::after { right: 22px; }

.lane-lines {
  position: absolute;
  inset: 63% 0 0;
  overflow: hidden;
  background: repeating-linear-gradient(90deg, transparent 0 48px, rgba(248, 241, 223, 0.07) 48px 54px);
}

.lane-lines span {
  position: absolute;
  top: 48%;
  width: 30%;
  height: 3px;
  background: var(--line);
}

.lane-lines span:nth-child(1) { left: 0; }
.lane-lines span:nth-child(2) { left: 35%; }
.lane-lines span:nth-child(3) { right: 0; }

.player {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 45px;
  width: 46px;
  height: 90px;
  transform: translateX(-50%);
  transition: transform 115ms steps(3, end);
}

.player-head,
.player-body,
.player-legs {
  position: absolute;
  display: block;
  background: var(--gold);
  box-shadow: inset -5px -5px 0 #c99325;
}

.player-head {
  top: 0;
  left: 10px;
  width: 27px;
  height: 27px;
  border: 3px solid #171220;
}

.player-body {
  top: 29px;
  left: 4px;
  width: 39px;
  height: 34px;
  border: 3px solid #171220;
}

.player-legs {
  top: 60px;
  left: 8px;
  width: 31px;
  height: 29px;
  border: 3px solid #171220;
  background: linear-gradient(90deg, var(--blue) 0 36%, transparent 36% 64%, var(--blue) 64% 100%);
  box-shadow: none;
}

.hazard {
  position: absolute;
  z-index: 2;
  top: 73px;
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border: 4px solid #171220;
  background:
    linear-gradient(45deg, transparent 0 18%, #ed4e5c 18% 82%, transparent 82%),
    linear-gradient(-45deg, transparent 0 18%, #ed4e5c 18% 82%, transparent 82%);
  filter: drop-shadow(5px 5px 0 var(--shadow));
  opacity: 0;
}

.hazard span {
  display: grid;
  width: 30px;
  height: 36px;
  place-items: center;
  border: 3px solid #171220;
  background: #f8f1df;
  color: #171220;
  font-size: 1.55rem;
  font-weight: 900;
}

.hazard-left { left: -90px; }
.hazard-right { right: -90px; }

.direction-callout {
  position: absolute;
  z-index: 4;
  top: 18px;
  color: var(--red);
  font-size: 2.1rem;
  font-weight: 900;
  opacity: 0;
}

.callout-left { left: 14%; }
.callout-right { right: 14%; }

.game-stage[data-state="active"][data-threat="threat-left"] .hazard-left {
  opacity: 1;
  animation: attack-left var(--attack-duration) linear forwards;
}

.game-stage[data-state="active"][data-threat="threat-right"] .hazard-right {
  opacity: 1;
  animation: attack-right var(--attack-duration) linear forwards;
}

.game-stage[data-state="active"][data-threat="threat-left"] .callout-left,
.game-stage[data-state="active"][data-threat="threat-right"] .callout-right {
  opacity: 1;
  animation: alert-blink 260ms steps(2, end) infinite;
}

.game-stage[data-dodge="left"] .player { transform: translateX(calc(-50% - min(145px, 22vw))) rotate(-7deg); }
.game-stage[data-dodge="right"] .player { transform: translateX(calc(-50% + min(145px, 22vw))) rotate(7deg); }

.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: 690px;
  min-height: 46px;
  margin: 10px 0 9px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.timing-wrap {
  width: min(460px, 92%);
  margin: 1px auto 11px;
}

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

.timing-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.timing-wrap .deadline-track {
  width: 100%;
  height: 16px;
  margin: 0;
  border-width: 3px;
}

.timing-wrap .deadline-fill {
  background: linear-gradient(90deg, var(--green) 0 40%, var(--gold) 68%, var(--red) 100%);
  transform-origin: left center;
}

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

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

.dodge-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 850px;
  margin: 18px auto 0;
}

.dodge-button {
  display: grid;
  min-width: 0;
  min-height: 112px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  padding: 16px;
  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;
}

.dodge-button:disabled { cursor: default; opacity: 0.5; }
.dodge-button:not(:disabled):hover { background: #302540; }
.dodge-button:not(:disabled):active,
.dodge-button.is-pressed { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--shadow); }
.dodge-button:focus-visible { outline: 4px solid var(--gold); outline-offset: 3px; }

.dodge-arrow {
  color: var(--blue);
  font-size: 3.25rem;
  font-weight: 900;
}

.dodge-button > span:nth-child(2) { min-width: 0; text-align: left; }
.dodge-button strong { display: block; font-size: 0.9rem; letter-spacing: 0.08em; overflow-wrap: anywhere; }
.dodge-button small { display: block; margin-top: 7px; color: var(--muted); font-size: 0.66rem; line-height: 1.35; }
.key-pair { display: flex; gap: 5px; }
.key-pair kbd { width: 31px; height: 31px; border-color: var(--line); font-size: 0.78rem; }

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

.game-stage[data-state="waiting"] .dodge-arena { animation: ready-pulse 650ms steps(2, end) infinite; }
.game-stage[data-state="waiting"] .primary-button,
.game-stage[data-state="active"] .primary-button,
.game-stage[data-state="feedback"] .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-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; overflow-wrap: anywhere; }
.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 attack-left {
  from { transform: translateX(0) rotate(0); }
  to { transform: translateX(var(--attack-distance)) rotate(540deg); }
}

@keyframes attack-right {
  from { transform: translateX(0) rotate(0); }
  to { transform: translateX(calc(-1 * var(--attack-distance))) rotate(-540deg); }
}

@keyframes alert-blink { 0%, 49% { opacity: 0.25; } 50%, 100% { opacity: 1; } }
@keyframes ready-pulse { 0%, 49% { border-color: var(--line); } 50%, 100% { border-color: var(--gold); } }

@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) {
  .dodge-shell { width: min(100% - 18px, 620px); padding-top: 10px; }
  .topbar { align-items: flex-start; gap: 10px; }
  .topbar-meta { max-width: 66%; flex-wrap: wrap; justify-content: flex-end; gap: 6px 9px; }
  .language-chip { margin-left: 0; }
  .best-label,
  #saved-best { display: none; }
  .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.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); }
  .game-stage { min-height: 720px; padding: 25px 11px 24px; }
  .prompt-panel { min-height: 465px; }
  .dodge-arena { height: 205px; }
  .player { bottom: 33px; transform: translateX(-50%) scale(0.88); }
  .game-stage[data-dodge="left"] .player { transform: translateX(calc(-50% - min(105px, 24vw))) scale(0.88) rotate(-7deg); }
  .game-stage[data-dodge="right"] .player { transform: translateX(calc(-50% + min(105px, 24vw))) scale(0.88) rotate(7deg); }
  .hazard { top: 65px; width: 64px; height: 64px; }
  .dodge-controls { gap: 8px; }
  .dodge-button { min-height: 122px; grid-template-columns: 1fr; gap: 5px; justify-items: center; padding: 12px 8px; text-align: center; }
  .dodge-button > span:nth-child(2) { text-align: center; }
  .dodge-arrow { font-size: 2.55rem; line-height: 0.8; }
  .key-pair { display: none; }
  .dodge-button small { min-height: 28px; }
  .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: 390px) {
  .brand { font-size: 0.8rem; }
  .topbar-meta { max-width: 68%; }
  .topbar-link { font-size: 0.61rem; }
  .dodge-arena { height: 190px; }
  .hazard { top: 60px; }
  .game-stage { min-height: 700px; }
  .dodge-button strong { font-size: 0.76rem; }
}

@media (prefers-reduced-motion: reduce) {
  .game-stage[data-state="waiting"] .dodge-arena,
  .game-stage[data-state="active"] .direction-callout { animation: none; }
  .game-stage[data-state="active"][data-threat="threat-left"] .hazard-left { left: 18%; animation: none; }
  .game-stage[data-state="active"][data-threat="threat-right"] .hazard-right { right: 18%; animation: none; }
  .player,
  .dodge-button,
  .deadline-fill { transition: none !important; }
}
