* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  background: linear-gradient(135deg, #0a0a1f 0%, #1a0a2e 50%, #000 100%);
  color: #fff;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
              radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.3) 0%, transparent 50%);
  animation: bgShift 20s ease-in-out infinite alternate;
  z-index: -1;
}

.emojis {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  margin-left:-50px;
  font-size: 1em;
}

@keyframes bgShift {
  0% { transform: scale(1) rotate(0deg); }
  100% { transform: scale(1.1) rotate(1deg); }
}

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  flex-direction: column;
  height: 100vh;
  padding: 20px;
  gap: 20px;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
}

.screen.active {
  display: flex;
}

.logo {
  font-family: 'Orbitron', monospace;
  font-size: clamp(2rem, 8vw, 4rem);
  font-weight: 900;
  text-align: center;
  text-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff;
  animation: glow 2s ease-in-out infinite alternate;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px; /* Adjust spacing between emojis and title */
}

@keyframes glow {
  from { text-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff; }
  to { text-shadow: 0 0 30px #ff00ff, 0 0 60px #ff00ff; }
}

.input {
  width: 100%;
  max-width: 300px;
  padding: 15px;
  padding-right: 40px;
  border: none;
  border-radius: 10px;
  background: rgba(255,255,255,0.1);
  color: #fff !important;
  font-size: 16px;
  backdrop-filter: blur(10px);
  margin-bottom: 10px;
}

.input::placeholder {
  color: rgba(255,255,255,0.5);
}

.btn {
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  color:#fff;
  width: 100%;
  max-width: 300px;
  padding: 15px 20px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.btn.primary {
  background: linear-gradient(45deg, #00ffff, #0080ff);
  box-shadow: 0 5px 15px rgba(0, 143, 255, 0.4);
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 143, 255, 0.6);
}

.btn.secondary {
  color: #fff;
  background: linear-gradient(45deg, #ff44ff, #ff00aa);
  box-shadow: 0 5px 15px rgba(255, 0, 170, 0.4);
}

.btn.secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px #c60088;
}

.btn.success {
  background: linear-gradient(45deg, #44ff44, #00aa00);
  box-shadow: 0 5px 15px rgba(0, 255, 0, 0.4);
}

.btn.danger {
  background: linear-gradient(45deg, #b2b3bb, #a5a3aa);
  box-shadow: 0 5px 15px rgba(216, 216, 216, 0.4);
  color: #ffffff;
}

.btn.danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(216, 216, 216, 0.6);
}

.btn.large {
  padding: 20px;
  font-size: 18px;
}

.google-logo {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  vertical-align: middle;
}

.auth-form, .menu, .lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  max-width: 350px;
}

.error {
  color: #ff4444;
  font-size: 14px;
}

.code {
  font-family: 'Orbitron', monospace;
  font-size: 2rem;
  color: #00ffff;
  text-shadow: 0 0 10px #00ffff;
  margin: 10px 0;
}

.players-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

.player-slot {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  border: 3px solid rgba(255,255,255,0.3);
  transition: all 0.3s;
}

.player-slot.ready {
  border-color: #44ff44;
  box-shadow: 0 0 20px #44ff44;
}

.player-slot.host {
  border-color: #00ffff;
  box-shadow: 0 0 20px #00ffff;
}

.player-slot.bot {
  background: rgba(255,0,0,0.2);
  border-color: #ff4444;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px;
  background: rgba(0,0,0,0.5);
  border-radius: 10px;
  font-family: 'Orbitron';
}

#shop-container.hidden {
  display: none;
}

#shop-cards, #team-slots {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 0;
  scroll-snap-type: x mandatory;
  width: 100%;
}

.card {
  width: 90px;
  height: 130px;
  background: linear-gradient(145deg, rgba(50,50,70,0.8), rgba(20,20,40,0.8));
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(0,0,0,0.5);
  scroll-snap-align: center;
  position: relative;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255,255,255,0.1);
}

.card:hover, .card.sellable {
  transform: translateY(-10px) scale(1.05);
  box-shadow: 0 15px 40px rgba(0,255,255,0.4);
}

.card > span:first-child { /* name */
  font-size: 0.8rem;
  text-align: center;
  margin-bottom: 5px;
}

.card > span:nth-child(2) { /* stats */
  display: flex;
  gap: 5px;
  font-size: 0.75rem;
}

.card > span:nth-child(3) { /* cost */
  position: absolute;
  top: 5px;
  right: 5px;
  background: linear-gradient(#ffd700, #ffaa00);
  color: #000;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
}

.fire { border: 2px solid #ff4400; box-shadow: 0 0 15px #ff4400aa; }
.water { border: 2px solid #0088ff; box-shadow: 0 0 15px #0088ffaa; }
.earth { border: 2px solid #884400; box-shadow: 0 0 15px #884400aa; }
.air { border: 2px solid #44ff44; box-shadow: 0 0 15px #44ff44aa; }

.dragging {
  opacity: 0.5;
  transform: rotate(5deg);
}

#team-slots {
  min-height: 140px; /* For drop zone */
}

#battle-canvas {
  width: 100%;
  height: 400px;
  max-height: 50vh;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.7);
  background: linear-gradient(to right, #001122 45%, #220000 55%);
  image-rendering: pixelated;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* Modals (Profile/Leaderboard) */
.modal:not(.hidden) {
  display: flex;
}

.modal-content {
  background: linear-gradient(145deg, #1a1a2e, #16213e);
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  max-width: 90%;
  width: 100%;
  max-width: 400px; /* Better for mobile */
  text-align: center;
  backdrop-filter: blur(20px);
  animation: glow 2s ease-in-out infinite alternate; /* Match logo glow */
}

.modal h2 {
  font-family: 'Orbitron', monospace;
  font-size: clamp(1.5rem, 6vw, 3rem);
  text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff;
  margin-bottom: 20px;
  animation: glow 2s ease-in-out infinite alternate;
}

.modal p, .modal li {
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  color: #fff;
  margin: 10px 0;
  padding: 10px;
  background: rgba(255,255,255,0.05); /* Subtle background for readability */
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 143, 255, 0.2); /* Soft glow */
}

.modal ul {
  list-style: none;
  max-height: 300px;
  overflow-y: auto;
  padding: 0;
  margin: 0 0 20px 0;
}

.modal li {
  display: flex; /* Better alignment for potential multi-part items */
  justify-content: center;
  align-items: center;
  transition: transform 0.3s ease;
}

.modal li:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 143, 255, 0.4); /* Hover glow like buttons */
}

.empty-message {
  font-style: italic;
  color: rgba(255,255,255,0.7);
  margin: 20px 0;
}

.profile-stats {
  display: flex;
  flex-direction: column;
  gap: 15px;
  text-align: left; /* Align left for better readability */
  max-width: 300px;
  margin: 0 auto;
}

.profile-stats p {
  display: flex;
  justify-content: space-between; /* Space out label and value */
  background: linear-gradient(45deg, rgba(0,255,255,0.1), rgba(0,128,255,0.1)); /* Subtle gradient */
}

.profile-stats span {
  font-weight: 700; /* Bold values */
  color: #00ffff; /* Neon cyan for highlights */
}

.profile-stats input {
  margin-left: 10px;
  width: auto;
  min-width: 150px;
}

.profile-stats button {
  margin-top: 10px;
}

.btn.saved-state {
  background: linear-gradient(45deg, #44ff44, #00aa00) !important;
  box-shadow: 0 5px 15px rgba(0, 255, 0, 0.4) !important;
}

.screen {
  display: none;
  flex-direction: column;
  height: 100vh;
  padding: 20px;
  gap: 20px;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
}

#screen-lobby {
  justify-content: center;
  gap: 15px;
}

.btn.error-state {
  background: linear-gradient(45deg, #ff4444, #aa0000) !important;
  box-shadow: 0 5px 15px rgba(255, 68, 68, 0.4) !important;
}

/* Ensure buttons match game style */
.modal .btn.danger {
  margin-top: 20px;
  width: auto;
  min-width: 150px;
}

@media (max-width: 480px) {
  #shop-cards, #team-slots {
    gap: 5px;
  }
  .card {
    width: 70px;
    height: 100px;
  }
}

.hidden {
  display: none !important;
}

.password-wrapper { position: relative; }
.eye-icon {
  position: absolute;
  right: 52px;
  top: 40%;
  transform: translateY(-50%);
  cursor: pointer;
  z-index: 1;
  opacity: 0.6;
}

/* Menu Screen Styling */
#screen-menu {
  justify-content: center;
  gap: 30px; /* Space between welcome and buttons */
}

#screen-menu h1 {
  font-family: 'Orbitron', monospace;
  font-size: clamp(1.5rem, 6vw, 3rem);
  text-shadow: 0 0 10px #00ffff;
  animation: glow 2s ease-in-out infinite alternate;
}

/* Lobby Screen Styling */
#screen-lobby {
  justify-content: flex-start;
  gap: 15px;
}

#screen-lobby h1 {
  font-family: 'Orbitron', monospace;
  font-size: clamp(1.5rem, 6vw, 3rem);
  text-shadow: 0 0 10px #ff00ff;
}

#screen-lobby label {
  color: rgba(255,255,255,0.8);
  font-size: 14px;
}

/* Game Screen Styling */
#screen-game header {
  background: rgba(0,0,0,0.5);
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
  font-family: 'Orbitron', monospace;
  text-shadow: 0 0 5px #00ffff;
}

#shop-container {
  width: 100%;
  max-width: 400px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 5px 15px rgba(0,143,255,0.4);
}

#shop-cards {
  justify-content: center;
}

#team-slots {
  width: 100%;
  max-width: 400px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 5px 15px rgba(255,0,170,0.4);
}

#battle-canvas {
  box-shadow: 0 0 20px #ff00ff;
}