* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #1a0a2e;
  color: #e0e0e0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  text-align: center;
  width: 100%;
}

.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.hidden {
  display: none !important;
}

h1 {
  font-size: 2.5em;
  color: #f39c12;
  text-shadow: 0 0 20px rgba(243, 156, 18, 0.5);
}

h2 {
  color: #1a0a2e;
  background: #f39c12;
  padding: 8px 24px;
  border-radius: 8px;
  font-size: 1.3em;
}

.join-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 300px;
}

.join-form input {
  padding: 14px 18px;
  border: 2px solid #2d1b4e;
  border-radius: 8px;
  background: #2d1b4e;
  color: #e0e0e0;
  font-size: 1.1em;
  outline: none;
  transition: border-color 0.2s;
}

.join-form input:focus {
  border-color: #f39c12;
}

button {
  padding: 14px 32px;
  background: #f39c12;
  color: #1a0a2e;
  border: none;
  border-radius: 8px;
  font-size: 1.2em;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

button:hover {
  background: #e67e22;
  transform: scale(1.02);
}

button:active {
  transform: scale(0.98);
}

.hint {
  color: #888;
  font-size: 0.9em;
  max-width: 400px;
}

.controls-hint {
  color: #aaa;
  font-size: 0.95em;
  margin-top: 10px;
}

.controls-hint p {
  margin: 4px 0;
}

.back-link {
  color: #f39c12;
  text-decoration: none;
  margin-top: 10px;
  font-size: 0.9em;
}

.back-link:hover {
  text-decoration: underline;
}

.player-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  background: #2d1b4e;
  border-radius: 6px;
  font-size: 1.1em;
  margin: 4px 0;
  min-width: 200px;
}

.player-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.game-container {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: center;
  position: relative;
}

canvas {
  border-radius: 4px;
  box-shadow: 0 0 30px rgba(243, 156, 18, 0.3);
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 720px;
  height: 624px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 3.5em;
  font-weight: bold;
  color: white;
  text-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
  background: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  pointer-events: none;
  z-index: 10;
}

#scoreboard {
  background: #2d1b4e;
  border: 2px solid #3d2b5e;
  border-radius: 8px;
  padding: 16px;
  min-width: 180px;
  text-align: left;
}

#scoreboard h3 {
  color: #f39c12;
  margin-bottom: 10px;
  text-align: center;
}

.score-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin: 4px 0;
  border-radius: 4px;
  font-size: 0.95em;
}

.score-entry.dead {
  opacity: 0.4;
  text-decoration: line-through;
}

/* Mobile controls */
.mobile-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  margin-top: 20px;
}

.dpad {
  display: grid;
  grid-template-areas: ". up ." "left . right" ". down .";
  grid-template-columns: 60px 60px 60px;
  grid-template-rows: 60px 60px 60px;
  gap: 4px;
}

.dpad-btn {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  font-size: 1.5em;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #3d2b5e;
  color: #f39c12;
}

.dpad-btn.up { grid-area: up; }
.dpad-btn.down { grid-area: down; }
.dpad-btn.left { grid-area: left; }
.dpad-btn.right { grid-area: right; }

.bomb-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  font-size: 2em;
  background: #e74c3c;
  color: white;
  padding: 0;
}

@media (max-width: 900px) {
  .game-container {
    flex-direction: column;
    align-items: center;
  }

  canvas {
    width: 100%;
    max-width: 720px;
    height: auto;
  }

  .overlay {
    width: 100%;
    max-width: 720px;
    height: auto;
    aspect-ratio: 15 / 13;
  }

  #scoreboard {
    width: 100%;
    max-width: 720px;
  }
}
