:root {
  --bg: #0f1020;
  --surface: #1a1b33;
  --text: #e8e8f0;
  --muted: #a0a0b8;
  --accent: #ffcc00;
  --accent-text: #1a1b33;
  --radius: 10px;
  --red: #ff5a63;
  --blue: #5aa9ff;
  --pixel-font: "Press Start 2P", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: var(--accent);
}

/* Header */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--surface);
}

.logo {
  font-family: var(--pixel-font);
  font-size: 1rem;
  text-decoration: none;
}

.site-header nav a {
  margin-left: 1rem;
  color: var(--text);
  text-decoration: none;
}

.site-header nav a:hover {
  color: var(--accent);
}

/* Layout */
main {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1rem;
}

section {
  padding: 2rem 0;
}

.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}

.hero h1 {
  font-family: var(--pixel-font);
  font-size: clamp(1.5rem, 6vw, 2.5rem);
  color: var(--accent);
  margin: 0 0 0.5rem;
}

.hero p {
  color: var(--muted);
}

/* Buttons */
.button {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--muted);
}

.button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Game */
.game-wrapper {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #000;
  image-rendering: pixelated;
  border-radius: var(--radius);
  /* Keeps the game area full size even if the game can't draw (e.g. JavaScript is off).
     800 x 484 is the canvas size set in js/game/game.js. */
  aspect-ratio: auto 800 / 484;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.65);
  border-radius: var(--radius);
}

.game-overlay.hidden {
  display: none;
}

.game-message {
  margin: 0;
  font-family: var(--pixel-font);
  font-size: clamp(0.8rem, 3vw, 1.4rem);
  line-height: 1.5;
}

.game-warning {
  max-width: 34rem;
  margin: 0;
  color: #ffb347;
}

.overlay-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
}

.red {
  color: var(--red);
}

.blue {
  color: var(--blue);
}

.keyboard-note {
  display: none;
  text-align: center;
  color: var(--muted);
}

/* How to play */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.player-card {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  border-left: 4px solid;
}

.player-card h3 {
  margin: 0 0 0.25rem;
}

.player-card p {
  margin: 0.25rem 0;
}

.red-card {
  border-color: var(--red);
}

.blue-card {
  border-color: var(--blue);
}

.things li {
  margin-bottom: 0.5rem;
}

.game-hud {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1rem;
  max-width: 800px;
  margin: 0.75rem auto 0;
}

.hud-buttons {
  display: flex;
  gap: 0.5rem;
}

.score-line {
  margin: 0;
  font-family: var(--pixel-font);
  font-size: 0.8rem;
}

/* Fullscreen: the game fills the screen, as big as it can be without stretching */
.game-wrapper:fullscreen {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: none;
  background: #000;
}

.game-wrapper:fullscreen #game-canvas {
  width: min(100vw, 100vh * 800 / 484);
  border-radius: 0;
}

.game-wrapper:fullscreen .game-overlay {
  border-radius: 0;
}

kbd {
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--muted);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9em;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
}

/* Phones and tablets without a keyboard */
@media (hover: none) and (pointer: coarse) {
  .keyboard-note {
    display: block;
  }
}

@media (max-width: 600px) {
  .overlay-controls {
    display: none;
  }
}

@media (max-width: 500px) {
  .site-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .site-header nav a {
    margin: 0 0.5rem;
  }
}

.start-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
