body {
  margin: 0;
  overflow: hidden;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  touch-action: none;
}

canvas {
  background: #111;
}

#ui {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  max-width: 400px;
}

.health-bars {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.health-bar {
  flex: 1;
}

.label {
  color: white;
  text-align: center;
  margin-bottom: 5px;
  font-family: Arial, sans-serif;
}

.bar {
  height: 10px;
  background: #333;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  transition: width 0.3s;
}

.red-health::before {
  background: #ff4444;
}

.blue-health::before {
  background: #4444ff;
}

#betting {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  max-width: 400px;
  text-align: center;
  color: white;
  font-family: Arial, sans-serif;
}

.money {
  font-size: 1.2em;
  margin-bottom: 10px;
}

.bet-buttons {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  transition: transform 0.1s;
}

button:active {
  transform: scale(0.95);
}

.bet-red {
  background: #ff4444;
  color: white;
}

.bet-blue {
  background: #4444ff;
  color: white;
}

.bet-amount {
  width: 100%;
  padding: 5px;
  margin: 10px 0;
  text-align: center;
}

.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.winner-message {
  font-size: 1.5em;
  color: white;
  text-align: center;
  margin-bottom: 15px;
  font-weight: bold;
  height: 1.5em;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  padding: 30px 60px;
  border-radius: 10px;
  border: 2px solid #444;
  color: white;
  font-family: Arial, sans-serif;
  text-align: center;
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
}

.popup.show {
  opacity: 1;
  pointer-events: auto;
}

.popup-close {
  position: absolute;
  top: 5px;
  right: 10px;
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 5px;
  line-height: 1;
  transition: color 0.3s;
}

.popup-close:hover {
  color: #ddd;
}

.popup-message {
  font-size: 24px;
  margin-bottom: 10px;
}

.popup.red .popup-message {
  color: #ff4444;
}

.popup.blue .popup-message {
  color: #4444ff;
}

#loading-screen {
  position: fixed;
  inset: 0;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.5s ease;
}

#loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: pulse 1.5s ease-in-out infinite;
}

.loading-text {
  color: white;
  font-family: Arial, sans-serif;
  margin-top: 20px;
  font-size: 24px;
  letter-spacing: 2px;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0.6; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

#info-button {
  position: fixed;
  top: 15px;
  right: 15px;
  padding: 10px 15px;
  background: #222;
  color: #fff;
  border: 2px solid #555;
  border-radius: 5px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  z-index: 10;
  cursor: pointer;
  transition: background 0.3s, transform 0.1s;
}

#info-button:hover {
  background: #333;
}

#info-panel-menu,
#about-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #111;
  border: 2px solid #555;
  border-radius: 10px;
  color: #fff;
  padding: 20px;
  max-width: 90%;
  width: 400px;
  z-index: 1001;
  font-family: Arial, sans-serif;
  display: none;
}

#info-panel-menu.show,
#about-panel.show {
  display: block;
}

#info-panel-menu h2,
#about-panel h2 {
  margin-top: 0;
  font-size: 20px;
  border-bottom: 1px solid #555;
  padding-bottom: 5px;
}

#info-panel-menu ul,
#about-panel ul {
  padding-left: 20px;
  margin: 10px 0;
}

#info-panel-menu .close-info,
#about-panel .close-about {
  position: absolute;
  top: 5px;
  right: 10px;
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

#menu-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(to bottom, #1a1a1a, #000);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  color: #fff;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  z-index: 100;
  text-align: center;
  padding: 30px;
}

#menu-screen h1 {
  font-size: 3em;
  margin-bottom: 10px;
  text-shadow: 0 0 10px rgba(255,255,255,0.4);
  letter-spacing: 2px;
  color: #ffff00;
  animation: glow 2s ease-in-out infinite alternate;
}

#menu-screen button {
  padding: 15px 30px;
  font-size: 20px;
  background: #222;
  border: 2px solid #666;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s, transform 0.1s, border-color 0.3s;
  width: 220px;
  max-width: 80%;
  box-shadow: 0 0 10px rgba(255,255,255,0.04);
}

#menu-screen button:hover {
  background: #333;
  border-color: #999;
}

#menu-screen p {
  font-size: 1em;
  color: #ccc;
  max-width: 400px;
  margin-top: -10px;
}

@keyframes glow {
  from { text-shadow: 0 0 5px #ffff0080, 0 0 10px #ffff0055; }
  to   { text-shadow: 0 0 10px #ffffffaa, 0 0 20px #ffff0080; }
}

#back-to-menu {
  position: fixed;
  top: 15px;
  left: 15px;
  padding: 10px 15px;
  background: #222;
  color: #fff;
  border: 2px solid #555;
  border-radius: 5px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  z-index: 10;
  cursor: pointer;
  transition: background 0.3s, transform 0.1s;
}

#back-to-menu:hover {
  background: #333;
}

#game-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

.hidden {
  display: none !important;
}

#console-toggle {
  position: fixed;
  bottom: 100px;
  right: 15px;
  background: #222;
  padding: 8px 12px;
  border: 2px solid #666;
  border-radius: 5px;
  color: #fff;
  font-family: monospace;
  font-size: 14px;
  z-index: 10;
  cursor: pointer;
}

#event-console {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: rgba(0, 0, 0, 0.85);
  font-family: monospace;
  font-size: 13px;
  color: #0f0;
  overflow-y: auto;
  padding: 10px;
  z-index: 10;
  display: none;
  border-top: 2px solid #444;
}

#event-console.show {
  display: block;
}

#signup-popup input {
  font-family: Arial, sans-serif;
  font-size: 16px;
  border: 1px solid #555;
  background: #222;
  color: white;
  border-radius: 5px;
}

#signup-popup button {
  background: #ffff00;
  color: #000;
  font-weight: bold;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

#signup-popup button:hover {
  background: #ff0;
}

#leaderboard {
  background: #111;
  border: 2px solid #555;
  border-radius: 10px;
  padding: 15px 20px;
  color: white;
  font-family: Arial, sans-serif;
  max-width: 300px;
  width: 90%;
  margin-top: 30px;
  box-shadow: 0 0 10px #000;
  animation: fadein 1s ease-in-out;
}

#leaderboard h2 {
  font-size: 1.4em;
  text-align: center;
  border-bottom: 1px solid #444;
  padding-bottom: 5px;
  margin-bottom: 10px;
  color: #ffff00;
  text-shadow: 0 0 5px #ffff0080;
}

#leaderboard ol {
  padding-left: 20px;
  margin: 0;
}

#leaderboard li {
  margin: 5px 0;
  font-size: 1em;
  display: flex;
  justify-content: space-between;
}

@keyframes fadein {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}