.invaders-page {
  max-width: 700px;
  margin-inline: auto;
  padding-block: 6px 40px;
}

.invaders-intro h1 {
  margin-bottom: 6px;
  font-size: clamp(26px, 5vw, 38px);
  letter-spacing: -1px;
}

.invaders-intro p,
.how-to-play p {
  color: #565267;
  font-size: 14px;
  line-height: 1.5;
}

.ad-space {
  min-height: 24px;
  margin-block: 8px;
}

.invaders-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 2px solid #342d72;
  border-radius: 14px;
  background: #e8e4c9;
  box-shadow: 0 8px 0 #b6b091;
}

body.is-game-open {
  overflow: hidden;
}

body.is-game-open .invaders-panel {
  position: fixed;
  z-index: 10;
  top: 50%;
  left: 50%;
  width: min(94vw, 500px);
  height: min(96dvh, 760px);
  transform: translate(-50%, -50%);
}

.game-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.game-stats div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px;
  border: 1px solid #342d72;
  border-radius: 6px;
  background: #fffbe6;
  color: #28224f;
  font-size: 12px;
  font-weight: 700;
}

.game-stats strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.game-screen {
  position: relative;
  height: min(75vw, 430px);
  min-height: 300px;
  overflow: hidden;
  border: 3px solid #17163d;
  border-radius: 7px;
  background: #17163d;
}

body.is-game-open .game-screen {
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
}

#game-board {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - 68px);
}

.movement-controls {
  position: absolute;
  right: 4px;
  bottom: 4px;
  left: 4px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.movement-button {
  width: 60px;
  height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 3px solid rgb(255 251 230 / 88%);
  border-radius: 50%;
  background: rgb(90 78 157 / 65%);
  color: #fffbe6;
  cursor: pointer;
  font: inherit;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  pointer-events: auto;
  touch-action: manipulation;
}

.movement-label {
  font-size: 12px;
  text-transform: uppercase;
}

.movement-button.is-active,
.movement-button:focus-visible {
  border-color: #fffbe6;
  background: #b34036;
}

.movement-button:focus-visible,
.game-action:focus-visible {
  outline: 3px solid #f6d85b;
  outline-offset: -5px;
}

.movement-button:disabled {
  cursor: default;
  opacity: 0.7;
}

.game-status-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

#game-status {
  min-height: 48px;
  display: grid;
  flex: 1 1 auto;
  place-items: center;
  margin: 0;
  padding: 5px;
  border-radius: 5px;
  background: #28224f;
  color: #fffbe6;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.game-action {
  min-width: 76px;
  padding-inline: 10px;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.game-action[hidden] {
  display: none;
}

.sound-toggle {
  width: 64px;
  min-width: 64px;
  min-height: 44px;
  padding-inline: 3px;
  font-size: 10px;
  line-height: 1.1;
}

.sound-toggle:disabled {
  cursor: default;
  opacity: 0.75;
}

.how-to-play h2 {
  margin-bottom: 8px;
  font-size: 20px;
}

@media (max-height: 450px) {
  body.is-game-open .invaders-panel {
    gap: 3px;
    padding: 4px;
  }

  .game-stats div {
    flex-direction: row;
    justify-content: center;
    gap: 8px;
    padding: 1px;
  }

  #game-status {
    min-height: 44px;
  }
}
