/* Hedgewars Battle — Dark theme styles */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #1a1a2e;
  color: #eee;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
  overflow: hidden;
}

/* ─── Lobby Screen ───────────────────────────────────────────── */

#lobby-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  overflow-y: auto;
}

.lobby-container {
  background: #16213e;
  border: 2px solid #0f3460;
  border-radius: 16px;
  padding: 40px 32px;
  max-width: 600px;
  width: 100%;
  text-align: center;
}

.lobby-icon {
  font-size: 4rem;
  margin-bottom: 8px;
}

.lobby-container h1 {
  font-size: 2rem;
  margin-bottom: 4px;
  color: #e94560;
}

.lobby-sub {
  color: #8899aa;
  margin-bottom: 24px;
  font-size: 0.95rem;
}

/* ─── Name Input ─────────────────────────────────────────────── */

.name-input {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 0 auto 16px;
  padding: 12px 16px;
  font-size: 1.1rem;
  background: #0f3460;
  border: 2px solid #1a4a7a;
  border-radius: 8px;
  color: #eee;
  font-family: inherit;
  text-align: center;
}

.name-input:focus {
  outline: none;
  border-color: #e94560;
}

.name-input::placeholder {
  color: #5a6a7a;
}

/* ─── Buttons ────────────────────────────────────────────────── */

.btn-primary {
  display: inline-block;
  padding: 12px 32px;
  background: #e94560;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}

.btn-primary:hover {
  background: #ff6b81;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.start-btn {
  margin-top: 16px;
  background: #27ae60;
}

.start-btn:hover {
  background: #2ecc71;
}

/* ─── Settings Panel ─────────────────────────────────────────── */

.settings-panel {
  margin: 20px 0;
  padding: 16px;
  background: #0f3460;
  border-radius: 12px;
  text-align: left;
}

.settings-panel h3 {
  text-align: center;
  margin-bottom: 16px;
  color: #e94560;
  font-size: 1.1rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  align-items: center;
}

.settings-grid label {
  font-size: 0.9rem;
  color: #aabbcc;
}

.settings-grid select,
.settings-grid input[type="range"] {
  width: 100%;
  padding: 6px;
  background: #1a1a2e;
  border: 1px solid #1a4a7a;
  border-radius: 6px;
  color: #eee;
  font-family: inherit;
}

.settings-grid input[type="range"] {
  -webkit-appearance: none;
  height: 6px;
  background: #1a4a7a;
  border-radius: 3px;
  padding: 0;
}

.settings-grid input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e94560;
  cursor: pointer;
}

/* ─── Player List ────────────────────────────────────────────── */

.player-list {
  margin: 16px 0;
  min-height: 40px;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 4px 0;
  background: #0f3460;
  border-radius: 8px;
  font-size: 0.95rem;
}

.player-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.player-name {
  flex: 1;
  text-align: left;
}

.player-host-badge {
  font-size: 0.75rem;
  background: #e94560;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
}

/* ─── Status Text ────────────────────────────────────────────── */

.status-text {
  margin-top: 12px;
  color: #8899aa;
  font-size: 0.9rem;
}

/* ─── Help Button ────────────────────────────────────────────── */

.btn-help {
  display: inline-block;
  margin-top: 16px;
  padding: 8px 20px;
  background: transparent;
  color: #8899aa;
  border: 1px solid #3a4a6a;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-help:hover {
  color: #eee;
  border-color: #e94560;
  background: rgba(233, 69, 96, 0.1);
}

/* ─── Help Modal ─────────────────────────────────────────────── */

.help-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.help-content {
  background: #16213e;
  border: 2px solid #0f3460;
  border-radius: 16px;
  padding: 32px;
  max-width: 650px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  text-align: left;
}

.help-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: #8899aa;
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}

.help-close:hover {
  color: #e94560;
}

.help-content h2 {
  text-align: center;
  color: #e94560;
  margin-bottom: 20px;
  font-size: 1.5rem;
}

.help-section {
  margin-bottom: 18px;
}

.help-section h3 {
  color: #eee;
  font-size: 1rem;
  margin-bottom: 8px;
  border-bottom: 1px solid #1a4a7a;
  padding-bottom: 4px;
}

.help-keys {
  width: 100%;
  border-collapse: collapse;
}

.help-keys td {
  padding: 5px 8px;
  font-size: 0.88rem;
  color: #ccc;
  vertical-align: top;
}

.help-keys td.key {
  white-space: nowrap;
  color: #ffcc00;
  font-weight: 600;
  width: 180px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.85rem;
}

.help-section ul {
  padding-left: 20px;
  color: #aabbcc;
  font-size: 0.88rem;
}

.help-section ul li {
  margin-bottom: 4px;
}

/* ─── Countdown Overlay ─────────────────────────────────────── */

.countdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #0a0a1a;  /* solid dark matches game background */
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}

.countdown-number {
  font-size: 160px;
  font-weight: 900;
  color: #ffd700;
  text-shadow:
    0 0 20px rgba(255, 215, 0, 0.8),
    0 0 60px rgba(255, 215, 0, 0.4);
  animation: countdownPulse 1s ease-in-out infinite;
  user-select: none;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

@keyframes countdownPulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%       { transform: scale(1.2); opacity: 0.75; }
}

/* ─── Hidden utility ─────────────────────────────────────────── */

.hidden {
  display: none !important;
}

/* ─── Game Screen ────────────────────────────────────────────── */

.game-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #0a0a1a;
}

.canvas-container {
  position: relative;
  width: 100%;
  height: 100%;
}

#terrain-canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

#entity-canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
}

#ui-canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  pointer-events: none;
}

/* ─── Game HUD ───────────────────────────────────────────────── */

.game-hud {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  padding: 12px 20px;
}

.turn-indicator {
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 1rem;
  pointer-events: auto;
}

.weapon-panel {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

/* Spectator banner */
.spectator-banner {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 180, 0, 0.92);
  color: #000;
  font-weight: 700;
  padding: 6px 18px;
  border-radius: 0 0 8px 8px;
  font-size: 14px;
  letter-spacing: 1px;
  z-index: 10000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.spectator-banner.hidden { display: none; }
