/* The shooter game screen: a full-viewport canvas with the question banner,
   score chips and score screen layered over it. The --game-* colours are
   read by the canvas renderer, so the arena is themed from here too. */

.game-page {
  overflow: hidden;
  background: var(--game-outline);
  overscroll-behavior: none;
}

.game-page,
.game {
  --game-sky-top: #3a4fb8;
  --game-sky-bottom: #9ad0ff;
  --game-skyline: #5d6fc9;
  --game-ground: #2c3a5c;
  --game-grid: #4a6aa8;
  --game-shadow: rgb(0 0 0 / 0.3);
  --game-robot-1: #f2a900;
  --game-robot-2: #e85d75;
  --game-robot-3: #3fbf7f;
  --game-robot-4: #a66cff;
  --game-robot-dark: #39414f;
  --game-robot-screen: #12203a;
  --game-robot-text: #ffffff;
  --game-laser: #ff4d6d;
  --game-spark: #ffe066;
  --game-hit: #7dff9b;
  --game-miss: #ffd166;
  --game-crosshair: #ffffff;
  --game-outline: #10172a;
  --game-blaster: #8fa3c7;
  --game-overlay: rgb(16 23 42 / 0.85);
  --game-banner: rgb(255 255 255 / 0.92);
}

.game {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.game__canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: none;
}

.game__hud {
  position: absolute;
  inset: 0 0 auto;
  display: grid;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  padding-top: max(var(--space-2), env(safe-area-inset-top));
  pointer-events: none;
}

.game__question {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: var(--game-banner);
  color: var(--color-text);
  font-size: var(--font-size-title);
  font-weight: bold;
  line-height: 1.1;
  text-align: center;
}

.game__stats {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
}

.game__chip {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
  background: var(--game-overlay);
  color: var(--color-surface);
  font-size: var(--font-size-body);
  font-weight: bold;
}

.game__combo[data-active="true"] {
  background: var(--color-accent);
  color: var(--color-text);
}

.game__feedback {
  min-height: 1.5em;
  margin: 0;
  color: var(--color-surface);
  font-size: var(--font-size-large);
  font-weight: bold;
  text-align: center;
  text-shadow: 0 2px 0 var(--game-outline);
}

.game__feedback[data-kind="hit"] {
  color: var(--game-hit);
}

.game__feedback[data-kind="miss"] {
  color: var(--game-miss);
}

.is-popping {
  animation: game-pop 220ms ease-out;
}

@keyframes game-pop {
  from {
    transform: scale(1.25);
  }
  to {
    transform: scale(1);
  }
}

.game__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--game-overlay);
  color: var(--color-surface);
  text-align: center;
}

.game__overlay[hidden] {
  display: none;
}

.game__title {
  margin: 0;
  font-size: var(--font-size-title);
  color: var(--color-accent);
}

.game__message {
  margin: 0;
  font-size: var(--font-size-large);
}

.game__results {
  display: grid;
  grid-template-columns: auto auto;
  gap: var(--space-2) var(--space-4);
  margin: 0;
  font-size: var(--font-size-large);
  text-align: left;
}

.game__results dd {
  margin: 0;
  font-weight: bold;
  text-align: right;
}

.game__button {
  min-height: 3rem;
  padding: var(--space-2) var(--space-5);
  border: 0;
  border-radius: var(--radius);
  background: var(--color-accent);
  color: var(--color-text);
  font: inherit;
  font-size: var(--font-size-large);
  font-weight: bold;
  cursor: pointer;
}

.game__button:active {
  transform: scale(0.96);
}

.game__button:focus-visible {
  outline: 4px solid var(--color-surface);
  outline-offset: var(--space-1);
}

.game__button:disabled {
  opacity: 0.5;
  cursor: progress;
}

@media (max-height: 480px) {
  .game__question {
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-large);
  }

  .game__chip,
  .game__feedback {
    font-size: var(--font-size-body);
  }

  .game__hud {
    grid-template-columns: 1fr auto;
    align-items: start;
  }

  .game__feedback {
    grid-column: 1 / -1;
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .is-popping {
    animation: none;
  }
}
