/* ===== Base ===== */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #05060a;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #c0d0e0;
}

/* ===== Lobby ===== */
#lobby-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  overflow-y: auto;
  background: radial-gradient(ellipse at 50% 30%, #0e1a2e 0%, #05060a 100%);
  z-index: 100;
}

#lobby-title {
  font-size: 36px;
  font-weight: 800;
  color: #5fae4a;
  letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(95, 174, 74, 0.4);
}

#lobby-subtitle {
  font-size: 13px;
  color: #506070;
  margin-bottom: 8px;
}

#connection-status {
  font-size: 12px;
  padding: 3px 12px;
  border-radius: 12px;
  font-weight: 600;
}
#connection-status.connected { background: #1a3a1a; color: #5fe85a; }
#connection-status.disconnected { background: #3a1a1a; color: #e85a5a; }
#connection-status.connecting { background: #3a3a1a; color: #ffd84a; }

.lobby-section {
  width: 100%;
  max-width: 520px;
  background: rgba(15, 25, 40, 0.8);
  border: 1px solid rgba(60, 80, 100, 0.3);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lobby-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #8090a0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-primary, .btn-secondary, .btn-ready {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  font-family: inherit;
}
.btn-primary { background: #2a6a4a; color: #fff; }
.btn-primary:hover { background: #3a8a5a; }
.btn-primary:disabled { opacity: 0.4; cursor: default; }
.btn-secondary { background: #3a4a5a; color: #c0d0e0; }
.btn-secondary:hover { background: #4a5a6a; }
.btn-ready { background: #5a3a8a; color: #fff; padding: 12px 40px; font-size: 16px; }
.btn-ready:hover:not(:disabled) { background: #6a4a9a; }
.btn-ready:disabled { opacity: 0.4; cursor: default; }
.btn-ready.ready { background: #5a8a3a; }

#room-code-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #3a4a5a;
  border-radius: 6px;
  background: #0a0e14;
  color: #c0d0e0;
  font-size: 14px;
  text-transform: uppercase;
  font-family: monospace;
  letter-spacing: 2px;
}
#room-code-input:focus { outline: none; border-color: #5fae4a; }

#lobby-room-code {
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  color: #5fae4a;
  letter-spacing: 6px;
  padding: 8px;
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
  font-family: monospace;
}

/* Character cards */
.char-cards {
  display: flex;
  gap: 10px;
}
.char-card {
  flex: 1;
  background: rgba(20, 30, 45, 0.8);
  border: 2px solid rgba(60, 80, 100, 0.4);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.char-card:hover { border-color: rgba(95, 174, 74, 0.5); }
.char-card.selected {
  border-color: #ffd84a;
  background: rgba(40, 50, 30, 0.6);
}
.char-portrait {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin: 0 auto 6px;
  border: 2px solid rgba(255,255,255,0.2);
}
.char-name { font-size: 14px; font-weight: 700; color: #e0e8f0; }
.char-stats { font-size: 11px; color: #8090a0; margin-top: 2px; }
.char-weapon { font-size: 11px; color: #bfe85a; margin-top: 4px; }
.char-ability { font-size: 11px; color: #bfe3f5; }
.char-passive { font-size: 10px; color: #ffd84a; margin-top: 2px; }

/* Player slots */
.player-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.player-slot {
  flex: 1 1 110px;
  min-width: 110px;
  background: rgba(15, 25, 40, 0.6);
  border: 1px solid rgba(60, 80, 100, 0.3);
  border-left-width: 3px;
  border-radius: 6px;
  padding: 10px;
  text-align: center;
}
.player-slot.connected { border-color: rgba(95, 174, 74, 0.4); }
/* Distinct per-player accent (matches in-game ring colors P1..P4). */
#slot-p1 { border-left-color: #4aa3ff; }
#slot-p2 { border-left-color: #ff9f43; }
#slot-p3 { border-left-color: #5cd65c; }
#slot-p4 { border-left-color: #e056fd; }
.slot-label { font-size: 11px; color: #607080; font-weight: 600; text-transform: uppercase; }
.slot-name { font-size: 14px; color: #e0e8f0; margin: 4px 0; }
.slot-char { font-size: 12px; color: #ffd84a; }
.slot-status { font-size: 11px; color: #8090a0; }
.slot-status.ready { color: #5fe85a; font-weight: 600; }
.slot-ping { font-size: 10px; color: #506070; }

#lobby-status-text {
  font-size: 12px;
  color: #607080;
  text-align: center;
}
#lobby-error {
  font-size: 12px;
  color: #e85a5a;
  text-align: center;
  min-height: 16px;
}

/* ===== Game canvas ===== */
#game-wrapper {
  position: fixed;
  inset: 0;
  background: #05060a;
  z-index: 50;
}

#stage {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, #0b0f18 0%, #05060a 100%);
}

#game {
  width: min(100vw, 177.78vh);
  height: min(56.25vw, 100vh);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #0a1410;
  border: 0;
  box-shadow: 0 0 24px rgba(0,0,0,0.8);
  cursor: crosshair;
}

/* ===== Overlays ===== */
#countdown-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  z-index: 60;
}
#countdown-number {
  font-size: 120px;
  font-weight: 900;
  color: #ffd84a;
  text-shadow: 0 0 40px rgba(255, 216, 74, 0.6);
}

#net-warning {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  background: rgba(232, 90, 90, 0.9);
  color: #fff;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  z-index: 65;
}

#disconnected-overlay, #death-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  background: rgba(0,0,0,0.85);
  z-index: 70;
}
#dc-title, #death-title {
  font-size: 32px;
  color: #e85a5a;
  margin: 0;
}
#dc-message, #death-message {
  font-size: 14px;
  color: #a0b0c0;
  text-align: center;
  max-width: 400px;
}
