:root {
  font-family: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --yellow: #f2c94c;
  --orange: #f2994a;
  --red: #e53935;
  --green: #4caf50;
  --dark: #1a1a1a;
  --light: #ffffff;
  --muted: rgba(255, 255, 255, 0.7);
  --overlay: rgba(0, 0, 0, 0.85);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: var(--light);
}

.hidden {
  display: none !important;
}

/* ========== LOGIN SCREEN ========== */
.login-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 9999;
}

.login-mascots {
  display: flex;
  gap: 3rem;
  margin-bottom: 2rem;
  animation: float 3s ease-in-out infinite;
}

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

.mascot {
  width: 120px;
  height: 150px;
  filter: drop-shadow(0 10px 30px rgba(255, 152, 0, 0.3));
  transition: transform 0.3s ease;
}

.mascot:hover {
  transform: scale(1.1) rotate(-5deg);
}

.mascot-penguin:hover {
  transform: scale(1.1) rotate(5deg);
}

.mascot svg {
  width: 100%;
  height: 100%;
}

.login-title {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(1.5rem, 5vw, 3rem);
  color: var(--yellow);
  text-shadow: 
    0 0 10px var(--orange),
    0 0 20px var(--orange),
    0 0 40px var(--red);
  margin: 0 0 0.5rem 0;
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from { text-shadow: 0 0 10px var(--orange), 0 0 20px var(--orange), 0 0 40px var(--red); }
  to { text-shadow: 0 0 20px var(--yellow), 0 0 40px var(--yellow), 0 0 60px var(--orange); }
}

.login-subtitle {
  color: var(--muted);
  font-size: 1rem;
  margin: 0 0 2rem 0;
  text-align: center;
}

.password-container {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 50px;
  padding: 0.5rem;
  width: 100%;
  max-width: 400px;
  transition: all 0.3s ease;
}

.password-container:focus-within {
  border-color: var(--yellow);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 20px rgba(242, 201, 76, 0.3);
}

.password-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--light);
  font-size: 1.1rem;
  padding: 0.8rem 1rem;
  outline: none;
}

.password-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.toggle-password,
.submit-password {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.toggle-password:hover,
.submit-password:hover {
  color: var(--yellow);
}

.toggle-password svg,
.submit-password svg {
  width: 24px;
  height: 24px;
}

.submit-password {
  background: var(--yellow);
  color: var(--dark);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  margin-left: 0.5rem;
}

.submit-password:hover {
  background: var(--orange);
  color: var(--dark);
  transform: scale(1.1);
}

.login-error {
  color: var(--red);
  font-size: 0.9rem;
  margin-top: 1rem;
  min-height: 1.5rem;
  text-align: center;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
  animation: shake 0.5s ease;
}

.password-container.shake {
  border-color: var(--red) !important;
}

/* ========== GAME CONTAINER (VOLLBILD) ========== */
.game-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}

#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ========== GAME HUD (oben) ========== */
.game-hud {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  border-radius: 30px;
  padding: 8px 20px;
  z-index: 100;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.hud-item span {
  font-size: 1.2rem;
}

.hud-item strong {
  font-size: 1.1rem;
  color: var(--yellow);
  min-width: 40px;
}

.hud-pause-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hud-pause-btn:hover {
  background: var(--yellow);
  color: var(--dark);
}

/* ========== OVERLAY ========== */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay);
  backdrop-filter: blur(8px);
  transition: opacity 300ms ease;
  z-index: 2000;
  padding: 1rem;
}

.overlay--hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay__card {
  background: linear-gradient(145deg, #1a1a2e, #16213e);
  padding: 2rem;
  border-radius: 20px;
  text-align: center;
  max-width: 500px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  max-height: 85vh;
  overflow-y: auto;
}

.overlay__card h2 {
  margin-top: 0;
  color: var(--yellow);
  font-size: 1.5rem;
}

.overlay-message {
  text-align: left;
  line-height: 1.7;
  margin-bottom: 1.5rem;
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 0.5rem;
  font-size: 0.95rem;
}

.overlay-message h3 {
  color: var(--orange);
  margin: 1rem 0 0.5rem 0;
  font-size: 1rem;
}

.overlay-message h3:first-child {
  margin-top: 0;
}

.overlay-message ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.overlay-message li {
  margin-bottom: 0.25rem;
}

.overlay-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ========== BUTTONS ========== */
.primary-btn,
.secondary-btn {
  border: none;
  border-radius: 999rem;
  padding: 0.8rem 1.6rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
  font-size: 1rem;
}

.primary-btn {
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  color: var(--dark);
  box-shadow: 0 4px 15px rgba(242, 153, 74, 0.4);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(242, 153, 74, 0.5);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--light);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

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

/* ========== HIGHSCORE ========== */
.highscore-card {
  max-width: 400px;
}

.highscore-card #finalScore {
  color: var(--yellow);
  font-size: 2rem;
}

.player-name-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  color: var(--light);
  font-size: 1rem;
  margin: 1rem 0;
  outline: none;
  transition: all 0.2s ease;
}

.player-name-input:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 15px rgba(242, 201, 76, 0.2);
}

.highscore-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.highscore-list {
  text-align: left;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.highscore-list h3 {
  text-align: center;
  color: var(--orange);
  margin: 0 0 1rem 0;
}

#highscoreEntries {
  list-style: none;
  padding: 0;
  margin: 0;
}

#highscoreEntries li {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  margin-bottom: 0.3rem;
  background: rgba(255, 255, 255, 0.05);
}

#highscoreEntries li:nth-child(1) {
  background: rgba(255, 215, 0, 0.2);
  border: 1px solid rgba(255, 215, 0, 0.3);
}

#highscoreEntries li:nth-child(2) {
  background: rgba(192, 192, 192, 0.15);
}

#highscoreEntries li:nth-child(3) {
  background: rgba(205, 127, 50, 0.15);
}

#highscoreEntries .score-name {
  color: var(--light);
}

#highscoreEntries .score-value {
  color: var(--yellow);
  font-weight: bold;
}

/* ========== LOADING ========== */
.loading-content {
  text-align: center;
  color: var(--light);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--yellow);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

/* ========== FULLSCREEN BUTTON ========== */
.fullscreen-btn {
  position: fixed;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(5px);
}

.fullscreen-btn:hover {
  background: var(--yellow);
  color: var(--dark);
  border-color: var(--yellow);
  transform: scale(1.1);
}

.fullscreen-btn:active {
  transform: scale(0.95);
}

/* ========== MOBILE CONTROLS ========== */
.mobile-controls {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  pointer-events: none;
  z-index: 50;
}

.mobile-controls-left,
.mobile-controls-right {
  position: absolute;
  bottom: 1rem;
  display: flex;
  gap: 0.5rem;
  pointer-events: auto;
}

.mobile-controls-left {
  left: 1rem;
}

.mobile-controls-right {
  right: 1rem;
  flex-direction: column;
  align-items: flex-end;
}

.mobile-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: all 0.1s ease;
}

.mobile-btn:active,
.mobile-btn.active {
  background: var(--yellow);
  color: var(--dark);
  border-color: var(--yellow);
  transform: scale(0.95);
}

.mobile-btn-jump {
  background: rgba(76, 175, 80, 0.5);
  border-color: rgba(76, 175, 80, 0.7);
}

.mobile-btn-action {
  background: rgba(229, 57, 53, 0.5);
  border-color: rgba(229, 57, 53, 0.7);
}

/* ========== MOBILE WEAPON BAR ========== */
.mobile-weapon-bar {
  position: fixed;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  border-radius: 25px;
  padding: 6px 10px;
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.weapon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.weapon-btn.active {
  background: var(--yellow);
  border-color: var(--orange);
  transform: scale(1.15);
  box-shadow: 0 0 15px rgba(242, 201, 76, 0.5);
}

.weapon-btn:active {
  transform: scale(0.9);
}

/* ========== FIRE ZONE (Aim + Power) ========== */
.fire-zone {
  position: relative;
  width: 90px;
  height: 90px;
  pointer-events: auto;
  touch-action: none;
}

.fire-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 3px solid rgba(229, 57, 53, 0.7);
  background: rgba(229, 57, 53, 0.5);
  color: white;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.1s ease;
}

.fire-btn.active {
  background: var(--red);
  border-color: var(--orange);
  transform: translate(-50%, -50%) scale(1.1);
}

.fire-btn.charging {
  animation: pulse-fire 0.3s ease-in-out infinite;
}

@keyframes pulse-fire {
  0%, 100% { box-shadow: 0 0 10px rgba(229, 57, 53, 0.5); }
  50% { box-shadow: 0 0 25px rgba(255, 152, 0, 0.8); }
}

/* Zielwinkel-Anzeige */
.aim-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 50px;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.8), transparent);
  transform-origin: bottom center;
  transform: translate(-50%, -100%) rotate(0deg);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: 2px;
}

.fire-zone.active .aim-indicator {
  opacity: 1;
}

/* Auflade-Anzeige */
.charge-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 85px;
  height: 85px;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: var(--yellow);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.fire-zone.active .charge-indicator {
  opacity: 1;
  animation: charge-spin 0.8s linear infinite;
}

@keyframes charge-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .mobile-controls {
    display: block;
  }
  
  .game-hud {
    gap: 1rem;
    padding: 6px 14px;
  }
  
  .hud-item strong {
    font-size: 1rem;
    min-width: 30px;
  }
  
  .hud-pause-btn {
    width: 32px;
    height: 32px;
  }
  
  .mascot {
    width: 80px;
    height: 100px;
  }
  
  .login-mascots {
    gap: 1.5rem;
  }
  
  .overlay__card {
    padding: 1.5rem;
    margin: 0.5rem;
  }
}

@media (max-width: 480px) {
  .game-hud {
    gap: 0.6rem;
    padding: 5px 10px;
    font-size: 0.9rem;
  }
  
  .hud-item span {
    font-size: 1rem;
  }
  
  .hud-item strong {
    font-size: 0.9rem;
  }
  
  .mobile-btn {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }
  
  .mobile-weapon-bar {
    bottom: 120px;
    gap: 4px;
    padding: 4px 8px;
  }
  
  .weapon-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
  
  .fire-zone {
    width: 75px;
    height: 75px;
  }
  
  .fire-btn {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }
  
  .charge-indicator {
    width: 70px;
    height: 70px;
  }
  
  .fullscreen-btn {
    width: 35px;
    height: 35px;
    font-size: 1rem;
  }
}

/* Landscape orientation */
@media (max-height: 500px) and (orientation: landscape) {
  .game-hud {
    top: 5px;
    padding: 4px 12px;
  }
  
  .mobile-controls-left,
  .mobile-controls-right {
    bottom: 0.5rem;
  }
  
  .mobile-btn {
    width: 45px;
    height: 45px;
    font-size: 1rem;
  }
  
  .mobile-weapon-bar {
    bottom: auto;
    top: 50px;
    padding: 3px 6px;
  }
  
  .weapon-btn {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }
  
  .fire-zone {
    width: 65px;
    height: 65px;
  }
  
  .fire-btn {
    width: 55px;
    height: 55px;
    font-size: 1.3rem;
  }
  
  .fullscreen-btn {
    top: 5px;
    width: 32px;
    height: 32px;
  }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

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

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