* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0a0a0a;
  color: #fff;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
}

/* === JOIN SCREEN === */
#joinScreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 3vh;
}

#joinScreen h1 {
  font-size: clamp(28px, 6vw, 64px);
  color: #00f0f0;
  text-shadow: 0 0 30px #00f0f0, 0 4px 0 #006060;
  letter-spacing: 8px;
}

.subtitle {
  font-size: clamp(12px, 2vw, 20px);
  color: #f0a000;
  text-shadow: 0 0 10px #f0a000;
  letter-spacing: 6px;
}

#nameInput {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: clamp(12px, 1.5vw, 18px);
  padding: 12px 20px;
  width: min(300px, 80vw);
  background: #111;
  border: 2px solid #00f0f0;
  color: #fff;
  text-align: center;
  outline: none;
  text-transform: uppercase;
}

#nameInput:focus {
  border-color: #f0f000;
  box-shadow: 0 0 15px rgba(240, 240, 0, 0.3);
}

#joinBtn, #rejoinBtn {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: clamp(12px, 1.5vw, 18px);
  padding: 14px 32px;
  background: #111;
  border: 2px solid #00f000;
  color: #00f000;
  cursor: pointer;
  letter-spacing: 2px;
  transition: all 0.15s;
}

#joinBtn:hover, #rejoinBtn:hover {
  background: #00f000;
  color: #000;
  box-shadow: 0 0 20px rgba(0, 240, 0, 0.4);
}

.controls-hint {
  font-size: clamp(7px, 1vw, 10px);
  color: #555;
  margin-top: 10px;
  text-align: center;
  line-height: 2;
}

/* === GAME SCREEN === */
#gameScreen {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

#gameContainer {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transform-origin: center center;
}

/* === MINI BOARD CONTAINERS === */
.mini-container {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  width: 250px;
  max-height: 620px;
  overflow-y: hidden;
  align-content: flex-start;
}

.mini-board {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mini-board canvas {
  border: 1px solid #2a2a2a;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.mini-board.dead canvas {
  border-color: #400;
  opacity: 0.25;
}

.mini-label {
  font-size: 5px;
  color: #666;
  margin-top: 1px;
  max-width: 32px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mini-board.dead .mini-label {
  color: #600;
}

/* === CENTER AREA === */
#centerArea {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

#mainCanvas {
  border: 3px solid #444;
  box-shadow: 0 0 30px rgba(0, 240, 240, 0.1);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* === STATS & INFO PANELS === */
#statsPanel, #infoPanel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 120px;
}

.stat-box {
  background: #111;
  border: 1px solid #333;
  padding: 8px;
}

.label {
  font-size: 9px;
  color: #888;
  margin-bottom: 6px;
}

.value {
  font-size: 16px;
  color: #fff;
}

#nextCanvas, #holdCanvas {
  display: block;
  background: #000;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* === LEADERBOARD === */
#leaderboardList {
  font-size: 7px;
  line-height: 2;
  max-height: 300px;
  overflow-y: hidden;
}

.lb-entry {
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-entry.me {
  color: #00f0f0;
}

/* === GAME OVER === */
#gameOverOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#gameOverContent {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

#gameOverContent h2 {
  font-size: clamp(28px, 5vw, 48px);
  color: #f00000;
  text-shadow: 0 0 20px #f00000;
  letter-spacing: 6px;
}

#positionText {
  font-size: clamp(20px, 4vw, 36px);
  color: #f0f000;
  text-shadow: 0 0 15px #f0f000;
}
