body {
  background: #000;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: "Press Start 2P", monospace;
  position: relative;
  overflow: hidden;
  perspective: 1000px;
  padding: 20px;
  box-sizing: border-box;
}

.game-container {
  width: 100%;
  max-width: 600px;
  padding: 20px;
  background: #000;
  border: 6px solid #fff;
  box-shadow: 0 0 0 4px #000, 0 0 0 8px #fff, 0 0 40px rgba(255, 255, 255, 0.3),
    0 10px 30px rgba(0, 0, 0, 0.5);
  position: relative;
  margin: 0 auto;
  filter: contrast(120%) brightness(105%);
  box-sizing: border-box;
}

canvas {
  width: 100%;
  height: auto;
  max-width: 512px;
  aspect-ratio: 1 / 1;
  border: 3px solid #fff;
  image-rendering: crisp-edges;
  box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.2),
    0 0 15px rgba(255, 255, 255, 0.1);
  margin: 0 auto;
  display: block;
}

button {
  background: #000;
  border: 3px solid #fff;
  color: #fff;
  padding: 12px 24px;
  font-family: "Press Start 2P";
  font-size: 14px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.2s;
  margin: 12px 0;
  letter-spacing: 2px;
  position: relative;
  box-shadow: 6px 6px 0 #fff;
}

button:hover {
  transform: translate(2px, 2px);
  box-shadow: 4px 4px 0 #fff;
}

button:active {
  transform: translate(6px, 6px);
  box-shadow: 0 0 0 #fff;
}

#status {
  background: #000;
  color: #fff;
  padding: 20px 30px;
  border: 4px solid #fff;
  font-size: 16px;
  text-align: center;
  margin: 20px 0;
  position: relative;
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 #000, 3px 3px 0 rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.1),
    0 0 10px rgba(255, 255, 255, 0.05);
}

#status::before {
  content: attr(data-player-count) " ■";
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 12px;
  opacity: 0.9;
  text-shadow: none;
}

#status::after {
  content: "■ " attr(data-ai-count);
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 12px;
  opacity: 0.9;
  text-shadow: none;
}

.ai-thinking #status {
  animation: thinking 1s infinite step-end;
}

@keyframes thinking {
  0%,
  50% {
    opacity: 1;
  }
  25%,
  75% {
    opacity: 0.5;
  }
}

#victoryScreen {
  background: #000;
  border: 6px solid #fff;
  padding: 40px;
  gap: 30px;
  box-shadow: 0 0 0 4px #000, 0 0 0 8px #fff, 0 0 40px rgba(255, 255, 255, 0.2);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 80%;
  max-width: 500px;
  z-index: 1000;
  backdrop-filter: contrast(120%) brightness(50%);
  animation: victory-shimmer 2s infinite alternate;
}

#victoryScreen::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border: 2px solid #fff;
  pointer-events: none;
}

#victoryScreen h2 {
  margin: 0;
  text-align: center;
  line-height: 1.6;
  font-size: 28px;
  color: #fff;
  text-shadow: 3px 3px 0 #000;
  letter-spacing: 2px;
}

@keyframes victory-shimmer {
  from {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
  }
  to {
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.3);
  }
}

#crtOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.04) 0px,
    rgba(255, 255, 255, 0.04) 1px,
    transparent 1px,
    transparent 2px
  );
  animation: scanlines 6s linear infinite;
  opacity: 0.8;
}

@keyframes scanlines {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-8px);
  }
}

.controls {
  border-top: 4px solid #fff;
  margin-top: 20px;
  padding: 20px 25px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  position: relative;
}

.controls::after {
  content: "▶ ALT-F4 TO QUIT";
  position: absolute;
  bottom: -40px;
  right: 0;
  font-size: 14px;
  color: #fff;
  text-shadow: 1px 1px 0 #000, 2px 2px 0 #000,
    3px 3px 0 rgba(255, 255, 255, 0.1);
  letter-spacing: 3px;
  padding: 6px 12px;
  background: #000;
  border: 3px solid #fff;
  animation: quit-pulse 2s infinite alternate;
}

@keyframes quit-pulse {
  from {
    opacity: 0.7;
    transform: scale(1);
  }
  to {
    opacity: 1;
    transform: scale(1.02);
  }
}

.particle {
  position: fixed;
  color: #fff;
  font-size: 24px;
  pointer-events: none;
  z-index: 1000;
  text-shadow: 2px 2px 0 #000;
}

#aiThinkingIndicator {
  display: none;
}

.rules-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  color: #fff;
  font-family: "Press Start 2P", monospace;
  text-align: center;
}

.rules-container {
  border: 6px solid #fff;
  padding: 40px;
  max-width: 500px;
  background: #000;
  box-shadow: 0 0 0 4px #000, 0 0 0 8px #fff, 0 0 40px rgba(255, 255, 255, 0.3);
}

.rules-screen h1 {
  margin-bottom: 30px;
  letter-spacing: 3px;
  font-size: 24px;
}

.rules-screen .rules {
  margin-bottom: 30px;
}

.rules-screen ul {
  list-style-type: none;
  padding: 0;
  text-align: left;
}

.rules-screen li {
  margin-bottom: 15px;
  position: relative;
  padding-left: 20px;
}

.rules-screen li::before {
  content: "■";
  position: absolute;
  left: 0;
  color: #fff;
}

.code-attribution {
  position: absolute;
  bottom: -40px;
  right: 0;
  font-size: 10px;
  color: #fff;
  letter-spacing: 2px;
}

@media screen and (max-width: 768px) {
  body {
    padding: 10px;
  }

  .game-container {
    padding: 10px;
    border-width: 4px;
  }

  canvas {
    max-width: 100%;
  }

  #victoryScreen {
    width: 90%;
    padding: 20px;
  }

  #victoryScreen h2 {
    font-size: 20px;
  }

  #status {
    font-size: 14px;
    padding: 10px;
    margin: 10px 0;
  }

  .controls {
    padding: 10px;
    gap: 10px;
  }

  button {
    font-size: 12px;
    padding: 8px 16px;
  }

  .controls::after {
    bottom: -30px;
    font-size: 10px;
  }
}

@media screen and (max-width: 600px) {
  .rules-container {
    width: 90%;
    padding: 20px;
  }

  .rules-screen h1 {
    font-size: 18px;
  }

  .rules-screen li {
    font-size: 12px;
  }
}

@media screen and (max-width: 480px) {
  #victoryScreen h2 {
    font-size: 16px;
  }

  #status {
    font-size: 12px;
    padding: 8px;
  }

  button {
    font-size: 10px;
    padding: 6px 12px;
  }
}