/* ==========================================================================
   CSS STYLING FOR BOOMONLINE - PREMIUM DARK CYBERPUNK THEME
   ========================================================================== */

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: rgba(17, 24, 39, 0.7);
  --border-glass: rgba(255, 255, 255, 0.08);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;

  --primary: #ff4757;
  /* Neon Red */
  --primary-glow: rgba(255, 71, 87, 0.5);
  --secondary: #00d2fc;
  /* Electric Cyan */
  --secondary-glow: rgba(0, 210, 252, 0.5);
  --success: #2ed573;
  /* Neon Green */
  --success-glow: rgba(46, 213, 115, 0.5);
  --warning: #ffa502;
  /* Neon Orange */

  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

  --font-display: 'Outfit', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
}

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

body {
  font-family: var(--font-display);
  background-color: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  /* Lock height to viewport */
  display: flex;
  justify-content: center;
  align-items: center;
  /* Center vertically */
  padding: 20px;
  overflow: hidden;
  /* Prevent overall page scrolling */
  position: relative;
}

/* Background animated stars */
.bg-stars {
  position: fixed;
  /* Lock background behind scrolling content */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 30% 30%, #1e1b4b 0%, #0b0f19 70%);
  z-index: -2;
}

.bg-stars::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(white, rgba(255, 255, 255, .2) 2px, transparent 40px),
    radial-gradient(white, rgba(255, 255, 255, .15) 1px, transparent 30px),
    radial-gradient(white, rgba(255, 255, 255, .1) 2px, transparent 40px);
  background-size: 550px 550px, 350px 350px, 250px 250px;
  background-position: 0 0, 40px 60px, 130px 270px;
  opacity: 0.15;
  z-index: -1;
}

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 1600px;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

/* Glassmorphism Card Panels */
.card {
  background: var(--bg-secondary);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 40px;
  box-shadow: var(--glass-shadow);
  width: 100%;
  max-width: 480px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card.w-large {
  max-width: 960px;
}

.fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Glowing Typography */
.glow-text {
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 0 15px var(--primary-glow), 0 0 30px var(--primary-glow);
  text-transform: uppercase;
  margin-bottom: 5px;
}

.glow-text-small {
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 0 8px var(--secondary-glow), 0 0 15px var(--secondary-glow);
  text-transform: uppercase;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 25px;
}

/* Form Controls */
.input-group {
  margin-bottom: 25px;
  text-align: left;
}

.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--secondary);
  margin-bottom: 8px;
  margin-left: 4px;
}

.input-group input {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 14px 20px;
  color: var(--text-main);
  font-size: 16px;
  font-family: var(--font-display);
  transition: all 0.3s ease;
}

.input-group input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 10px rgba(0, 210, 252, 0.25);
  background: rgba(0, 0, 0, 0.4);
}

.input-inline {
  display: flex;
  gap: 10px;
}

.input-inline input {
  flex: 1;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 10px 15px;
  color: var(--text-main);
  font-size: 14px;
  font-family: var(--font-display);
  transition: all 0.3s ease;
}

.input-inline input:focus {
  outline: none;
  border-color: var(--secondary);
  background: rgba(0, 0, 0, 0.4);
}

/* Buttons */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, #d63031 100%);
  border: none;
  border-radius: 14px;
  padding: 14px 28px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-display);
  cursor: pointer;
  box-shadow: 0 4px 15px var(--primary-glow);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.25),
      transparent);
  transition: all 0.5s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 71, 87, 0.7);
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-action {
  background: linear-gradient(135deg, var(--secondary) 0%, #00a8ff 100%);
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-display);
  cursor: pointer;
  box-shadow: 0 4px 10px var(--secondary-glow);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(0, 210, 252, 0.7);
}

.btn-danger {
  background: linear-gradient(135deg, #eb4d4b 0%, #b33939 100%);
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-display);
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-danger:hover {
  background: #ff4d4d;
  transform: translateY(-1px);
}

.btn-refresh {
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
}

.btn-refresh:hover {
  border-color: var(--secondary);
  color: var(--secondary);
  transform: rotate(180deg);
}

/* Card footer details */
.card-footer {
  margin-top: 25px;
  border-top: 1px solid var(--border-glass);
  padding-top: 15px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.bomb-spin {
  display: inline-block;
  animation: spin 5s linear infinite;
  color: var(--primary);
  margin-right: 5px;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   LOBBY ROOMS SCREEN STYLING
   ========================================================================== */

.lobby-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 20px;
  margin-bottom: 25px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 15px;
}

.avatar-ring {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  box-shadow: 0 0 10px rgba(0, 210, 252, 0.4);
}

.user-profile h2 {
  font-size: 16px;
  font-weight: 600;
}

.status-online {
  font-size: 11px;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.status-online i {
  font-size: 6px;
  animation: pulse 1.5s infinite alternate;
}

@keyframes pulse {
  from {
    opacity: 0.4;
  }

  to {
    opacity: 1;
  }
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 30px;
}

@media (max-width: 768px) {
  .lobby-grid {
    grid-template-columns: 1fr;
  }
}

.control-box {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  text-align: left;
}

.control-box h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--secondary);
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* Keyboard styling */
kbd {
  background: #374151;
  border: 1px solid #4b5563;
  border-bottom: 3px solid #1f2937;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  display: inline-block;
}

.tutorial-box ul {
  list-style: none;
}

.tutorial-box li {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tutorial-box li i {
  font-size: 14px;
  width: 16px;
  text-align: center;
}

.text-blue {
  color: var(--secondary);
}

.text-red {
  color: var(--primary);
}

.text-yellow {
  color: var(--warning);
}

.text-green {
  color: var(--success);
}

/* Rooms List Panel */
.lobby-rooms {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 20px;
  height: 410px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.section-title h3 {
  font-size: 14px;
  text-transform: uppercase;
  color: var(--secondary);
  letter-spacing: 0.5px;
}

.rooms-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 5px;
}

.room-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
  text-align: left;
}

.room-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--secondary);
  transform: translateX(3px);
}

.room-info h4 {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.room-details {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.room-details span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.badge {
  background: rgba(235, 77, 77, 0.15);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  border: 1px solid rgba(235, 77, 77, 0.2);
}

.badge.lobby {
  background: rgba(46, 213, 115, 0.15);
  color: var(--success);
  border-color: rgba(46, 213, 115, 0.2);
}

.empty-state {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: var(--text-muted);
  gap: 15px;
}

.empty-state i {
  font-size: 40px;
  color: rgba(255, 255, 255, 0.1);
}

.empty-state p {
  font-size: 13px;
}

/* ==========================================================================
   WAITING ROOM SCREEN STYLING
   ========================================================================== */

.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 20px;
  margin-bottom: 25px;
  text-align: left;
}

.room-tag {
  font-size: 10px;
  font-weight: 800;
  color: var(--secondary);
  background: rgba(0, 210, 252, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 1px;
}

.room-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin-top: 5px;
}

.room-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 30px;
  height: 400px;
}

@media (max-width: 768px) {
  .room-grid {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.room-players {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 20px;
  height: 100%;
  min-height: 0;
}

.room-players h3,
.room-chat h3 {
  font-size: 13px;
  text-transform: uppercase;
  color: var(--secondary);
  letter-spacing: 0.5px;
  margin-bottom: 15px;
  text-align: left;
}

.players-cards-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

/* Player Card Styling */
.player-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-left: 5px solid var(--primary);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player-card-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.player-card-info h4 {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.player-card-info .self-tag {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 6px;
}

.player-role-badge {
  font-size: 11px;
  color: var(--warning);
}

.player-role-badge i {
  margin-right: 4px;
}

.room-actions {
  margin-top: 15px;
}

.glow-button {
  box-shadow: 0 0 15px var(--primary-glow);
  animation: glowPulse 2s infinite alternate;
}

@keyframes glowPulse {
  from {
    box-shadow: 0 0 8px var(--primary-glow);
  }

  to {
    box-shadow: 0 0 20px var(--primary);
  }
}

.wait-msg {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
}

/* Chat styling */
.room-chat {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 20px;
  height: 100%;
  min-height: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 5px;
  margin-bottom: 12px;
  text-align: left;
  min-height: 0;
}

.chat-item {
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.chat-item .chat-sender {
  font-weight: 700;
  margin-right: 5px;
}

.chat-item.system-msg {
  color: var(--secondary);
  font-style: italic;
  opacity: 0.85;
}

.chat-input-area {
  display: flex;
  gap: 8px;
}

.chat-input-area input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 13px;
  font-family: var(--font-display);
}

.chat-input-area input:focus {
  outline: none;
  border-color: var(--secondary);
}

/* ==========================================================================
   GAMEPLAY SCREEN STYLING (HUD, CANVAS, GAME CHAT)
   ========================================================================== */

.game-layout {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  max-width: 1600px;
  width: 100%;
  animation: fadeIn 0.4s ease-out forwards;
}

@media (max-width: 900px) {
  .game-layout {
    flex-direction: column;
    align-items: center;
  }
}

.game-canvas-wrapper {
  position: relative;
  background: #111827;
  border: 3px solid var(--border-glass);
  border-radius: 16px;
  box-shadow: var(--glass-shadow), 0 0 20px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;

  max-height: calc(100vh - 100px);
  /* Limit height to viewport height */
  aspect-ratio: 29 / 21;
  /* Lock widescreen grid aspect ratio */
  width: auto;
  height: 100%;
}

canvas {
  display: block;
  background: #151e30;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  /* Scale down smoothly to fit container height */
}

/* Gameplay Live HUD Stats */
.game-hud {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 180px;
  background: rgba(17, 24, 39, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 15px;
  text-align: left;
}

@media (max-width: 900px) {
  .game-hud {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.hud-room-info h3 {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--secondary);
  letter-spacing: 0.5px;
}

.hud-players-status {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 900px) {
  .hud-players-status {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 15px;
  }
}

.hud-player-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 8px 10px;
}

.hud-player-name {
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.hud-player-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.hud-player-stats-row {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.hud-player-stats-row span {
  display: flex;
  align-items: center;
  gap: 3px;
}

.hud-player-stats-row .stat-life {
  color: var(--primary);
}

.hud-player-stats-row .stat-bomb {
  color: var(--warning);
}

.hud-player-stats-row .stat-fire {
  color: #f0932b;
}

.hud-player-card.dead {
  opacity: 0.4;
  border-color: rgba(255, 71, 87, 0.2);
  background: rgba(255, 71, 87, 0.05);
}

.hud-player-card.dead .hud-player-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.btn-hud {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 8px;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-hud:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Sidebar Chat during Game */
.game-sidebar-chat {
  display: flex;
  flex-direction: column;
  width: 180px;
  background: rgba(17, 24, 39, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 12px;
  height: 100%;
  min-height: 0;
}

@media (max-width: 900px) {
  .game-sidebar-chat {
    width: 100%;
    height: 150px;
  }
}

.game-chat-header {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 8px;
  text-align: left;
}

.game-chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  padding-right: 3px;
  text-align: left;
  min-height: 0;
}

.game-chat-messages .chat-item {
  font-size: 11px;
  line-height: 1.3;
}

.game-chat-input-area input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-glass);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text-main);
  font-size: 11px;
  font-family: var(--font-display);
}

.game-chat-input-area input:focus {
  outline: none;
  border-color: var(--secondary);
}

/* In-game Overlay Screens (Countdown / Game Over) */
.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  animation: fadeIn 0.3s ease-out;
}

.overlay-content {
  text-align: center;
  max-width: 400px;
  padding: 20px;
}

.overlay-content h1 {
  font-size: 44px;
  margin-bottom: 10px;
}

.overlay-content p {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 25px;
}

.overlay-buttons {
  display: flex;
  justify-content: center;
}

.overlay-buttons button {
  max-width: 220px;
}

/* Toast Notifications */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(235, 77, 77, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  z-index: 999;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform: translateY(0);
}

.notification.hidden {
  transform: translateY(-100px);
  opacity: 0;
  pointer-events: none;
}