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

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
  background: #1d1b2f;
  color: #e2e2e2;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

header { text-align: center; }

h1 {
  font-size: 2rem;
  letter-spacing: 0.35em;
  color: #ffa300;
  text-shadow: 0 0 12px rgba(255, 163, 0, 0.6);
}

.status-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 0.85rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.online { background: #00e436; box-shadow: 0 0 8px #00e436; }
.dot.offline { background: #ff004d; }

#user-count { opacity: 0.8; }

#spectate-note {
  color: #ffa300;
  font-size: 0.8rem;
  border: 1px dashed #ffa300;
  border-radius: 6px;
  padding: 2px 8px;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.canvas-wrap {
  position: relative;
  width: min(90vmin, 440px);
  aspect-ratio: 1;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  border: 2px solid #ffa300;
  box-shadow: 0 0 20px rgba(255, 163, 0, 0.25);
  background: #26203c;
}

#winner-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-size: 1.1rem;
  letter-spacing: 0.15em;
  white-space: nowrap;
  color: #ffec27;
  text-shadow: 0 0 12px rgba(255, 236, 39, 0.7), 0 2px 4px #000;
  pointer-events: none;
}

.hidden { display: none; }

.touch-controls {
  display: flex;
  align-items: center;
  gap: 28px;
  user-select: none;
  touch-action: manipulation;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(2, 56px);
  gap: 6px;
}

.dpad .up { grid-column: 2; grid-row: 1; }
.dpad .left { grid-column: 1; grid-row: 2; }
.dpad .down { grid-column: 2; grid-row: 2; }
.dpad .right { grid-column: 3; grid-row: 2; }

.dbtn {
  font: inherit;
  font-size: 1.2rem;
  color: #e2e2e2;
  background: #2b2444;
  border: 1px solid #33354d;
  border-radius: 10px;
  cursor: pointer;
}

.dbtn:active { transform: translateY(2px); background: #3a3158; }

#bomb-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  font: inherit;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: #fff;
  background: #ff004d;
  border: 2px solid #ff77a8;
  box-shadow: 0 0 16px rgba(255, 0, 77, 0.5);
  cursor: pointer;
}

#bomb-btn:active { transform: translateY(2px); box-shadow: none; }

.hud {
  display: flex;
  justify-content: center;
  padding: 8px;
}

#players {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #33354d;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.85rem;
}

.chip.dead { opacity: 0.5; }

.chip-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
