/* ==========================================
   GAME MODE ISOLATED STYLES
   All selectors are strictly scoped with .game- or body.game-mode-active
   ========================================== */

/* Hide Website Footer completely during Game Mode */
body.game-mode-active footer.footer,
body.game-mode-active footer,
body.game-mode-active .footer {
  display: none !important;
}

/* Main Panel Layout */
.game-view-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0.75rem 1rem 1.5rem;
  box-sizing: border-box;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.game-title-group h1 {
  margin: 0;
  font-size: 1.8rem;
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Outer Game Arena Frame - Narrow & Tall Arcade Display */
.game-frame {
  position: relative;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  height: 680px;
  background: radial-gradient(circle at 50% 30%, #1e1b4b 0%, #0f172a 70%, #020617 100%);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), inset 0 0 90px rgba(56, 189, 248, 0.08);
  overflow: hidden;
  user-select: none;
}

/* Background Animated Grid Pattern */
.game-bg-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* Game HUD Top Bar */
.game-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 10;
}

.game-hud-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.game-hud-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: #94a3b8;
  font-weight: 500;
}

.game-hud-value {
  color: #f8fafc;
  font-weight: 700;
  font-size: 0.95rem;
}

.game-hud-lives {
  font-size: 1.1rem;
  letter-spacing: 2px;
}

/* Danger Line */
.game-danger-line {
  position: absolute;
  bottom: 55px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ef4444 20%, #ef4444 80%, transparent);
  box-shadow: 0 0 12px #ef4444, 0 0 24px #ef4444;
  z-index: 5;
  pointer-events: none;
}

.game-danger-line::before {
  content: "DANGER ZONE";
  position: absolute;
  right: 15px;
  top: -18px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: #ef4444;
  opacity: 0.7;
}

.game-danger-flash {
  animation: game-danger-pulse 0.4s ease-in-out;
}

@keyframes game-danger-pulse {
  0% { background: transparent; }
  50% { background: rgba(239, 68, 68, 0.25); }
  100% { background: transparent; }
}

/* Futuristic Arcade Laser Turret Cannon */
.game-player-ship {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 54px;
  height: 52px;
  z-index: 9;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

/* Rotatable Aiming Head (Barrel + Housing Pod + Core) */
.game-turret-aim {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: 50% 85%;
  transition: transform 0.12s ease-out;
  will-change: transform;
}

/* Firing Recoil State on Aim Assembly */
.game-turret-aim.is-firing {
  filter: brightness(1.6);
}

.game-turret-aim.is-firing .game-turret-barrel {
  box-shadow: 0 0 20px #ffffff, 0 0 35px #38bdf8, 0 -6px 15px #ffffff;
}

.game-turret-aim.is-firing .game-turret-core {
  background: #ffffff;
  box-shadow: 0 0 22px #ffffff, 0 0 35px #38bdf8;
  transform: translate(-50%, -50%) scale(1.4);
}

/* Dual Cannon Barrel */
.game-turret-barrel {
  width: 12px;
  height: 22px;
  background: linear-gradient(180deg, #38bdf8 0%, #1e293b 80%);
  border-radius: 4px 4px 0 0;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
  position: relative;
  transition: box-shadow 0.08s, filter 0.08s;
  z-index: 2;
}

/* Barrel Muzzle Tip Glow */
.game-turret-barrel::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 4px;
  background: #ffffff;
  border-radius: 2px;
  box-shadow: 0 0 12px #38bdf8, 0 0 20px #ffffff;
}

/* Turret Armored Housing Pod */
.game-turret-housing {
  position: relative;
  width: 38px;
  height: 22px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 10px 10px 4px 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6), 0 0 12px rgba(56, 189, 248, 0.3);
  z-index: 3;
}

/* Glowing Energy Core in Center of Pod */
.game-turret-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background: #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 12px #38bdf8, 0 0 20px #818cf8;
  transition: transform 0.08s, background 0.08s, box-shadow 0.08s;
}

/* Armored Side Flanges */
.game-turret-housing::before,
.game-turret-housing::after {
  content: '';
  position: absolute;
  top: 4px;
  width: 6px;
  height: 12px;
  background: #334155;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 3px;
}
.game-turret-housing::before { left: -7px; }
.game-turret-housing::after { right: -7px; }

/* Heavy Base Pedestal */
.game-turret-base {
  width: 50px;
  height: 8px;
  background: linear-gradient(180deg, #334155 0%, #020617 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.7);
  z-index: 1;
}

/* Engine Thruster Glow */
.game-turret-thruster {
  width: 22px;
  height: 6px;
  background: linear-gradient(180deg, #818cf8 0%, rgba(56, 189, 248, 0) 100%);
  border-radius: 0 0 50% 50%;
  box-shadow: 0 4px 14px rgba(129, 140, 248, 0.9);
  animation: game-thruster-pulse 0.2s infinite alternate;
}

@keyframes game-thruster-pulse {
  0% { opacity: 0.7; transform: scaleY(0.9); }
  100% { opacity: 1; transform: scaleY(1.3); }
}

/* ZType Energy Projectile */
.game-projectile {
  position: absolute;
  width: 6px;
  height: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #38bdf8 60%, #818cf8 100%);
  border-radius: 4px;
  box-shadow: 0 0 12px #38bdf8, 0 0 24px #38bdf8;
  pointer-events: none;
  z-index: 7;
  transform-origin: center center;
  will-change: transform, left, top;
}

/* Impact Flash Spark */
.game-impact-spark {
  position: absolute;
  width: 22px;
  height: 22px;
  background: radial-gradient(circle, #ffffff 0%, #38bdf8 50%, transparent 85%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 8;
  transform: translate(-50%, -50%);
  animation: game-spark-fade 0.15s ease-out forwards;
}

@keyframes game-spark-fade {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.6); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); }
}

/* Falling Word Styling */
.game-word {
  position: absolute;
  transform: translate(-50%, 0);
  padding: 0.45rem 0.9rem;
  border-radius: 10px;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 1.15rem;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  white-space: nowrap;
  transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
  z-index: 6;
  pointer-events: none;
}

/* Locked Target Active State */
.game-word.is-target {
  background: rgba(15, 23, 42, 0.95);
  border: 2px solid #38bdf8;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.6), 0 0 40px rgba(56, 189, 248, 0.2);
  z-index: 8;
  color: #ffffff;
  transform: translate(-50%, 0) scale(1.08);
}

.game-word.is-dimmed {
  opacity: 0.45;
}

.game-word.is-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.8) !important;
  animation: game-shake 0.25s ease-in-out;
}

@keyframes game-shake {
  0%, 100% { transform: translate(-50%, 0) scale(1.08); }
  20% { transform: translate(-55%, 0) scale(1.08); }
  40% { transform: translate(-45%, 0) scale(1.08); }
  60% { transform: translate(-53%, 0) scale(1.08); }
  80% { transform: translate(-47%, 0) scale(1.08); }
}

/* Character Highlighting inside Word */
.game-word-typed {
  color: #4ade80;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}

.game-word-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background-color: #38bdf8;
  vertical-align: middle;
  margin: 0 1px;
  animation: game-blink 0.8s infinite;
}

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

.game-word-remaining {
  color: #e2e8f0;
}

/* Destroy Particle Effect */
.game-pop-particle {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  animation: game-pop-fade 0.4s ease-out forwards;
}

@keyframes game-pop-fade {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(0.2);
  }
}

/* Overlay Screen Container (Start, Pause, Game Over) */
.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 20;
  text-align: center;
}

.game-overlay[hidden] {
  display: none !important;
}

.game-modal-card {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 2.5rem 3rem;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.game-modal-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin: 0;
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.game-modal-sub {
  color: #94a3b8;
  font-size: 1rem;
  line-height: 1.5;
  margin: 0;
}

.game-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  width: 100%;
  margin: 0.5rem 0;
}

.game-stat-box {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-stat-label {
  font-size: 0.8rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.game-stat-val {
  font-size: 1.4rem;
  font-weight: 700;
  color: #38bdf8;
  margin-top: 0.2rem;
}

/* Custom Buttons for Game Mode */
.game-btn-group {
  display: flex;
  gap: 1rem;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.game-btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1.75rem;
  border-radius: 12px;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.game-btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #4f46e5 100%);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.4);
}

.game-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.6);
}

.game-btn-secondary {
  background: rgba(30, 41, 59, 0.8);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.game-btn-secondary:hover {
  background: rgba(51, 65, 85, 0.9);
  color: #ffffff;
  transform: translateY(-2px);
}

.game-btn-pause {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  background: rgba(30, 41, 59, 0.8);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.game-btn-pause:hover {
  background: rgba(51, 65, 85, 1);
  color: #ffffff;
}

/* Mobile Hidden Focusable Input */
.game-mobile-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  filter: alpha(opacity=0);
  padding: 0;
  margin: 0;
  border: none;
  outline: none;
  background: transparent;
  color: transparent;
  pointer-events: none;
  z-index: -1;
}

/* Responsive adjust */
@media (max-width: 640px) {
  .game-view-panel {
    padding: 0.5rem;
  }
  .game-frame {
    height: 480px;
    max-height: calc(100dvh - 60px);
    border-radius: 14px;
  }
  .game-hud {
    padding: 0 0.5rem;
    height: 52px;
  }
  .game-hud-stats {
    gap: 0.5rem;
    font-size: 0.75rem;
  }
  .game-hud-value {
    font-size: 0.85rem;
  }
  .game-hud-lives {
    font-size: 0.95rem;
  }
  .game-modal-card {
    padding: 1.5rem;
  }
}


