/* =============================================================================
   Secret Game Mode - ilk.online
   Aktivierung: Arrow Up Up Down Right Left Left  |  Beenden: Escape
   ============================================================================= */

/* --- Overlay --- */
.game-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  font-family: 'Courier New', monospace;
  color: #fff;
  overflow-y: auto;
}

.game-overlay.active {
  opacity: 1;
}

/* --- Epic Background Animation (Selector) --- */
.game-bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.game-overlay .game-selector {
  position: relative;
  z-index: 1;
}

.game-overlay .game-close-btn,
.game-overlay .game-mute-btn,
.game-overlay .game-fullscreen-btn {
  position: absolute;
  z-index: 10;
}

/* CSS Nebula glow layers */
.game-nebula {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.game-nebula-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  animation: game-nebula-drift 20s ease-in-out infinite alternate;
}

.game-nebula-blob:nth-child(1) {
  width: 400px;
  height: 400px;
  background: #4fc3f7;
  top: 10%;
  left: 15%;
  animation-duration: 18s;
}

.game-nebula-blob:nth-child(2) {
  width: 350px;
  height: 350px;
  background: #7c4dff;
  bottom: 10%;
  right: 10%;
  animation-duration: 22s;
  animation-delay: -5s;
}

.game-nebula-blob:nth-child(3) {
  width: 300px;
  height: 300px;
  background: #00e5ff;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-duration: 25s;
  animation-delay: -10s;
}

@keyframes game-nebula-drift {
  0% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(30px, -20px) scale(1.1);
  }
  66% {
    transform: translate(-20px, 30px) scale(0.9);
  }
  100% {
    transform: translate(10px, -10px) scale(1.05);
  }
}

/* Shooting star / streak lines */
.game-shooting-star {
  position: absolute;
  width: 80px;
  height: 1px;
  background: linear-gradient(90deg, rgba(79, 195, 247, 0.8), transparent);
  opacity: 0;
  z-index: 0;
  pointer-events: none;
  animation: game-shoot 3s linear infinite;
}

.game-shooting-star:nth-child(1) {
  top: 15%;
  left: -80px;
  animation-delay: 1s;
  animation-duration: 2.5s;
}

.game-shooting-star:nth-child(2) {
  top: 45%;
  left: -80px;
  animation-delay: 4s;
  animation-duration: 3s;
  width: 120px;
}

.game-shooting-star:nth-child(3) {
  top: 75%;
  left: -80px;
  animation-delay: 7s;
  animation-duration: 2s;
  width: 60px;
}

@keyframes game-shoot {
  0% {
    transform: translateX(0) rotate(-15deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    transform: translateX(calc(100vw + 200px)) rotate(-15deg);
    opacity: 0;
  }
}

/* Floating particles (via canvas rendered in JS) */
.game-title-glow {
  animation: game-title-pulse 3s ease-in-out infinite;
}

@keyframes game-title-pulse {
  0%,
  100% {
    text-shadow: 0 0 20px rgba(79, 195, 247, 0.6);
  }
  50% {
    text-shadow:
      0 0 40px rgba(79, 195, 247, 0.9),
      0 0 80px rgba(79, 195, 247, 0.4);
  }
}

/* --- Game Selector --- */
.game-selector {
  text-align: center;
  padding: 20px;
  max-width: 700px;
  width: 100%;
}

.game-select-grid {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.game-select-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 160px;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid rgba(79, 195, 247, 0.25);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Courier New', monospace;
  color: #cfd8dc;
}

.game-select-card:hover {
  border-color: #4fc3f7;
  background: rgba(79, 195, 247, 0.08);
  box-shadow: 0 0 25px rgba(79, 195, 247, 0.2);
  transform: translateY(-4px);
}

.game-select-card.has-thumbnail {
  width: 240px;
  height: auto;
  padding: 0;
  overflow: hidden;
}

.game-select-card.has-thumbnail .game-select-name {
  padding: 10px;
}

.game-select-thumb {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  display: block;
  border-radius: 10px 10px 0 0;
}

.game-select-icon {
  font-size: 40px;
  color: #4fc3f7;
  margin-bottom: 12px;
}

.game-select-name {
  font-size: 16px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.game-selector-highscores {
  max-width: 500px;
  margin: 0 auto;
}

/* --- Canvas --- */
#game-canvas {
  display: block;
  background: #000;
  border: 1px solid rgba(79, 195, 247, 0.3);
  border-radius: 4px;
  box-shadow: 0 0 30px rgba(79, 195, 247, 0.15);
}

/* --- HUD --- */
.game-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 800px;
  padding: 10px 0;
  font-size: 14px;
  color: #4fc3f7;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.game-hud-left,
.game-hud-right {
  display: flex;
  gap: 20px;
}

.game-hud span {
  white-space: nowrap;
}

.game-hud .game-score-val {
  color: #fff;
  font-weight: bold;
}

/* --- Start / Game Over Screen --- */
.game-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2;
  text-align: center;
  padding: 20px;
  overflow-y: auto;
}

.game-screen.hidden {
  display: none;
}

.game-title {
  font-size: 48px;
  font-weight: bold;
  color: #4fc3f7;
  text-shadow: 0 0 20px rgba(79, 195, 247, 0.6);
  margin-bottom: 10px;
  letter-spacing: 4px;
}

.game-subtitle {
  font-size: 14px;
  color: #90a4ae;
  margin-bottom: 10px;
  letter-spacing: 2px;
}

.game-controls-info {
  font-size: 13px;
  color: #607d8b;
  line-height: 1.8;
  margin-bottom: 30px;
}

.game-controls-info kbd {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  font-size: 12px;
  color: #fff;
  min-width: 24px;
  text-align: center;
}

.game-start-btn {
  display: inline-block;
  padding: 12px 40px;
  background: transparent;
  border: 2px solid #4fc3f7;
  color: #4fc3f7;
  font-family: 'Courier New', monospace;
  font-size: 16px;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 5px;
}

.game-start-btn:hover {
  background: rgba(79, 195, 247, 0.15);
  box-shadow: 0 0 20px rgba(79, 195, 247, 0.3);
}

.game-back-btn {
  border-color: #607d8b;
  color: #607d8b;
}

.game-back-btn:hover {
  border-color: #90a4ae;
  color: #90a4ae;
  background: rgba(144, 164, 174, 0.1);
  box-shadow: none;
}

.game-over-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Game Over --- */
.game-over-title {
  font-size: 42px;
  color: #ef5350;
  text-shadow: 0 0 20px rgba(239, 83, 80, 0.5);
  margin-bottom: 10px;
  letter-spacing: 3px;
}

.game-final-stats {
  display: grid;
  grid-template-columns: auto auto;
  gap: 6px 20px;
  margin: 20px auto;
  font-size: 14px;
  text-align: left;
}

.game-final-stats .stat-label {
  color: #90a4ae;
  text-align: right;
}

.game-final-stats .stat-value {
  color: #fff;
  font-weight: bold;
}

.game-rank {
  font-size: 18px;
  color: #ffb74d;
  margin: 10px 0 20px;
}

.game-new-highscore {
  color: #ffd54f;
  font-size: 16px;
  animation: game-blink 0.8s ease infinite;
  margin-bottom: 10px;
}

@keyframes game-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* --- Highscore-Tabelle --- */
.game-highscores {
  margin: 20px auto;
  max-width: 500px;
  width: 100%;
}

.game-highscores h3 {
  font-size: 16px;
  color: #4fc3f7;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.game-highscores table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.game-highscores th {
  color: #607d8b;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}

.game-highscores td {
  padding: 4px 8px;
  color: #cfd8dc;
}

.game-highscores tr.highlight td {
  color: #ffd54f;
  font-weight: bold;
}

/* --- Close / Mute Buttons --- */
.game-close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: #607d8b;
  font-size: 28px;
  cursor: pointer;
  z-index: 10;
  transition: color 0.2s;
  font-family: 'Courier New', monospace;
  line-height: 1;
}

.game-close-btn:hover {
  color: #ef5350;
}

.game-mute-btn {
  position: absolute;
  top: 14px;
  right: 56px;
  background: none;
  border: none;
  color: #607d8b;
  font-size: 18px;
  cursor: pointer;
  z-index: 10;
  transition: color 0.2s;
}

.game-mute-btn:hover {
  color: #4fc3f7;
}

.game-fullscreen-btn {
  position: absolute;
  top: 14px;
  right: 92px;
  background: none;
  border: none;
  color: #607d8b;
  font-size: 18px;
  cursor: pointer;
  z-index: 10;
  transition: color 0.2s;
}

.game-fullscreen-btn:hover {
  color: #4fc3f7;
}

/* --- Fullscreen Anpassungen --- */
.game-overlay:fullscreen {
  background: #000;
}

.game-overlay:fullscreen #game-canvas {
  max-height: calc(100vh - 60px);
}

/* --- Mobile Touch Controls --- */
.game-touch-controls {
  display: none;
  justify-content: center;
  gap: 10px;
  padding: 10px 0;
}

.game-touch-btn {
  width: 60px;
  height: 60px;
  background: rgba(79, 195, 247, 0.1);
  border: 1px solid rgba(79, 195, 247, 0.3);
  border-radius: 8px;
  color: #4fc3f7;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.game-touch-btn:active {
  background: rgba(79, 195, 247, 0.25);
}

.game-touch-btn-fire {
  width: 80px;
  background: rgba(239, 83, 80, 0.15);
  border-color: rgba(239, 83, 80, 0.4);
  color: #ef5350;
}

@media (pointer: coarse), (max-width: 768px) {
  .game-touch-controls {
    display: flex;
  }

  #game-canvas {
    max-height: 55vh;
  }

  .game-title {
    font-size: 32px;
  }

  .game-select-card {
    width: 140px;
    height: 130px;
  }
}

/* --- Activation Flash --- */
.game-activation-flash {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 99998;
  font-family: 'Courier New', monospace;
  font-size: 20px;
  color: #4fc3f7;
  letter-spacing: 4px;
  text-transform: uppercase;
  opacity: 0;
  animation: game-flash-in 0.6s ease forwards;
  pointer-events: none;
  text-shadow: 0 0 20px rgba(79, 195, 247, 0.8);
}

@keyframes game-flash-in {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  30% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}
