@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;700;900&family=Rajdhani:wght@400;500;600;700&display=swap');

:root {
  --primary: #00ffff;
  --primary-dark: #00cccc;
  --secondary: #ff00ff;
  --accent: #ffff00;
  --gold: #ffd700;
  --danger: #ff3333;
  --success: #00ff66;
  --dark: #0a0a1a;
  --darker: #050510;
  --light: #e0e0ff;
  --card-bg: rgba(20, 20, 40, 0.9);
}

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

body {
  font-family: 'Rajdhani', sans-serif;
  background: var(--darker);
  color: var(--light);
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
}

.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: flex;
}

#login-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1a0a2e 0%, #0a0a1a 100%);
  position: relative;
  overflow: hidden;
}

.starfield {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(1px 1px at 10px 20px, white, transparent),
    radial-gradient(1px 1px at 50px 80px, rgba(255,255,255,0.8), transparent),
    radial-gradient(2px 2px at 100px 30px, var(--primary), transparent),
    radial-gradient(1px 1px at 200px 150px, white, transparent),
    radial-gradient(1px 1px at 300px 50px, var(--secondary), transparent),
    radial-gradient(2px 2px at 400px 200px, white, transparent),
    radial-gradient(1px 1px at 500px 100px, var(--accent), transparent),
    radial-gradient(1px 1px at 600px 250px, white, transparent),
    radial-gradient(2px 2px at 700px 50px, var(--primary), transparent),
    radial-gradient(1px 1px at 750px 300px, white, transparent);
  animation: twinkle 5s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.login-container {
  background: linear-gradient(135deg, rgba(0, 255, 255, 0.1) 0%, rgba(255, 0, 255, 0.1) 100%);
  backdrop-filter: blur(20px);
  padding: 2.5rem;
  border-radius: 20px;
  border: 2px solid var(--primary);
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.3), inset 0 0 30px rgba(0, 255, 255, 0.1);
  width: 100%;
  max-width: 400px;
  z-index: 10;
}

.logo {
  text-align: center;
  margin-bottom: 2rem;
}

.spaceship {
  width: 80px;
  height: 80px;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  clip-path: polygon(50% 0%, 100% 50%, 80% 100%, 20% 100%, 0% 50%);
  animation: pulse 2s ease-in-out infinite, float 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { filter: drop-shadow(0 0 10px var(--primary)); }
  50% { filter: drop-shadow(0 0 25px var(--secondary)); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.logo h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.2rem;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px var(--primary);
}

.tagline {
  color: var(--primary);
  font-size: 1rem;
  margin-top: 0.5rem;
}

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  flex: 1;
  padding: 0.75rem;
  border: none;
  background: transparent;
  color: var(--light);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.3s;
}

.tab-btn.active {
  border-bottom-color: var(--primary);
  color: var(--primary);
  text-shadow: 0 0 10px var(--primary);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--primary);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.8rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid rgba(0, 255, 255, 0.3);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.5);
  color: var(--light);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.btn-primary {
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--darker);
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 255, 255, 0.4);
}

.error-message {
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(255, 51, 51, 0.2);
  border: 1px solid var(--danger);
  border-radius: 8px;
  color: var(--danger);
  text-align: center;
  display: none;
}

.error-message.visible {
  display: block;
}

#dashboard-screen {
  flex-direction: column;
  background: linear-gradient(180deg, var(--darker) 0%, #0a0a20 100%);
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(0, 0, 0, 0.5);
  border-bottom: 2px solid var(--primary);
  box-shadow: 0 5px 30px rgba(0, 255, 255, 0.2);
}

.logo-small {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ship-small {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  clip-path: polygon(50% 0%, 100% 50%, 80% 100%, 20% 100%, 0% 50%);
}

.logo-small span {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.user-stats {
  display: flex;
  gap: 1.5rem;
}

.stat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 700;
  font-size: 1rem;
}

.stat.level {
  color: var(--primary);
}

.stat.rank {
  color: var(--gold);
}

.xp-bar {
  width: 200px;
  height: 20px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--primary);
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.5s ease;
}

.xp-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.75rem;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.btn-logout {
  padding: 0.5rem 1rem;
  border: 2px solid var(--danger);
  border-radius: 8px;
  background: transparent;
  color: var(--danger);
  font-family: 'Orbitron', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-logout:hover {
  background: var(--danger);
  color: white;
}

.dashboard-main {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.game-modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.mode-card {
  background: var(--card-bg);
  border: 2px solid rgba(0, 255, 255, 0.3);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.mode-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
}

.mode-card.primary {
  border-color: var(--secondary);
  background: linear-gradient(135deg, rgba(255, 0, 255, 0.2) 0%, rgba(0, 255, 255, 0.2) 100%);
}

.mode-card.primary:hover {
  box-shadow: 0 0 50px rgba(255, 0, 255, 0.5);
}

.mode-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.mode-card h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.mode-card p {
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 1rem;
}

.mode-stats {
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--accent);
  font-weight: 700;
}

.ranking-container {
  max-width: 800px;
  margin: 0 auto;
}

.ranking-container h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 2rem;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--gold);
}

.ranking-list {
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid rgba(255, 215, 0, 0.3);
}

.ranking-header {
  display: grid;
  grid-template-columns: 60px 1fr 100px 80px;
  padding: 1rem;
  background: rgba(255, 215, 0, 0.2);
  font-weight: 700;
  color: var(--gold);
}

.ranking-row {
  display: grid;
  grid-template-columns: 60px 1fr 100px 80px;
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ranking-row:nth-child(1) .rank { color: #ffd700; }
.ranking-row:nth-child(2) .rank { color: #c0c0c0; }
.ranking-row:nth-child(3) .rank { color: #cd7f32; }

.hidden {
  display: none !important;
}

#game-screen {
  flex-direction: column;
  background: var(--darker);
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.8);
  border-bottom: 2px solid var(--primary);
}

.game-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.game-stat {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  font-weight: 600;
}

.game-stat.wave {
  color: var(--secondary);
}

.game-controls {
  display: flex;
  gap: 0.5rem;
}

.btn-game {
  padding: 0.5rem 1rem;
  border: 2px solid var(--primary);
  border-radius: 8px;
  background: transparent;
  color: var(--light);
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-game:hover {
  background: var(--primary);
  color: var(--darker);
}

.btn-quit {
  border-color: var(--danger);
}

.btn-quit:hover {
  background: var(--danger);
}

.game-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
}

#game-canvas {
  background: radial-gradient(ellipse at center, #0a0a20 0%, #000 100%);
  border: 2px solid var(--primary);
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.2);
}

.info-panel {
  width: 200px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-panel > div {
  background: var(--card-bg);
  border: 1px solid rgba(0, 255, 255, 0.3);
  border-radius: 10px;
  padding: 1rem;
}

.info-panel h4 {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.xp-progress {
  height: 10px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 0.3rem;
}

.xp-progress .xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.weapons {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.weapon {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 5px;
  font-size: 0.8rem;
}

.weapon-name {
  color: var(--primary);
}

.weapon-level {
  color: var(--gold);
}

#wave-status {
  color: var(--accent);
  font-size: 0.9rem;
}

.kills-info {
  text-align: center;
  color: var(--danger);
}

.game-footer {
  display: flex;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.5);
}

.btn-start-wave {
  padding: 1rem 3rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--secondary) 0%, #aa00aa 100%);
  color: white;
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.5);
}

.btn-start-wave:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 30px rgba(255, 0, 255, 0.7);
}

.btn-start-wave:disabled {
  background: #444;
  cursor: not-allowed;
  box-shadow: none;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-content {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 20px;
  border: 3px solid var(--danger);
  text-align: center;
  max-width: 400px;
}

.modal-content h2 {
  font-family: 'Orbitron', sans-serif;
  color: var(--danger);
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
}

.results {
  margin-bottom: 1.5rem;
}

.result-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.level-up-notice {
  padding: 1rem;
  background: linear-gradient(135deg, var(--gold), #ff9900);
  border-radius: 10px;
  color: var(--darker);
  font-weight: 700;
  margin-bottom: 1rem;
  animation: pulse 1s infinite;
}

@media (max-width: 900px) {
  .game-container {
    flex-direction: column;
    align-items: center;
  }
  
  .info-panel {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .info-panel > div {
    flex: 1;
    min-width: 150px;
  }
}
