/* Global variables for premium cyberpunk colors and gradients */
:root {
  --bg-dark: #07050f;
  --panel-bg: rgba(14, 11, 26, 0.7);
  --border-pink: rgba(255, 0, 127, 0.3);
  --border-cyan: rgba(0, 240, 255, 0.3);
  
  --neon-magenta: #ff007f;
  --neon-cyan: #00f0ff;
  --neon-green: #39ff14;
  --neon-yellow: #fffb00;
  
  --shadow-magenta: 0 0 15px rgba(255, 0, 127, 0.6), 0 0 30px rgba(255, 0, 127, 0.3);
  --shadow-cyan: 0 0 15px rgba(0, 240, 255, 0.6), 0 0 30px rgba(0, 240, 255, 0.3);
  --shadow-green: 0 0 15px rgba(57, 255, 20, 0.6);
  
  --font-cyber: 'Orbitron', -apple-system, sans-serif;
  --font-sans: 'Inter', -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-sans);
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Beautiful cyber grid background for the entire page */
body {
  background: radial-gradient(circle at center, #181135 0%, #06040d 100%);
  background-size: cover;
  position: relative;
}

body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center;
  z-index: 0;
  pointer-events: none;
}

/* Container wrapper to keep game perfectly centered & responsive */
.game-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
}

.game-container {
  position: relative;
  width: 480px;
  height: 640px;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 240, 255, 0.15);
  border: 1px solid rgba(0, 240, 255, 0.2);
  overflow: hidden;
  background-color: #0b0914;
}

/* Game Canvas Styles */
#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: #000000;
}

/* Screen overlays style - Glassmorphic */
.overlay-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  z-index: 10;
  background: rgba(4, 3, 10, 0.7);
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.overlay-screen.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Glassmorphism panel design */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--border-pink);
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.5),
    inset 0 0 15px rgba(255, 0, 127, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: panel-glow 4s infinite ease-in-out alternate;
}

#screen-pause .glass-panel {
  border: 1px solid var(--border-cyan);
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.5),
    inset 0 0 15px rgba(0, 240, 255, 0.1);
}

@keyframes panel-glow {
  0% {
    border-color: rgba(255, 0, 127, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(255, 0, 127, 0.05);
  }
  100% {
    border-color: rgba(255, 0, 127, 0.4);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 25px rgba(255, 0, 127, 0.2);
  }
}

/* Typography styles */
.text-center {
  text-align: center;
}

.game-title {
  font-family: var(--font-cyber);
  font-weight: 900;
  font-size: 3rem;
  line-height: 0.9;
  letter-spacing: 2px;
  color: #ffffff;
  text-shadow: var(--shadow-magenta);
  margin-bottom: 4px;
}

.game-title span.neon-text-blue {
  color: var(--neon-cyan);
  text-shadow: var(--shadow-cyan);
}

.game-subtitle {
  font-family: var(--font-cyber);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 8px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 24px;
  text-indent: 8px;
}

.panel-title {
  font-family: var(--font-cyber);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 24px;
}

.game-over-title {
  font-family: var(--font-cyber);
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 1px;
  animation: glitch 1.5s infinite steps(2);
}

.game-over-subtitle {
  font-family: var(--font-cyber);
  font-size: 0.8rem;
  letter-spacing: 4px;
  color: var(--neon-magenta);
  text-shadow: 0 0 5px rgba(255, 0, 127, 0.5);
  margin-bottom: 24px;
}

/* Neon Text Helpers */
.text-glow-magenta {
  color: var(--neon-magenta);
  text-shadow: var(--shadow-magenta);
}

.text-glow-cyan {
  color: var(--neon-cyan);
  text-shadow: var(--shadow-cyan);
}

.text-glow-pink {
  color: #ff68b4;
  text-shadow: 0 0 10px rgba(255, 104, 180, 0.8);
}

.text-glow-green {
  color: var(--neon-green) !important;
  text-shadow: var(--shadow-green) !important;
}

/* High Score Badge */
.high-score-badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  letter-spacing: 1px;
}

.gold-icon {
  color: var(--neon-yellow);
  text-shadow: 0 0 8px rgba(255, 251, 0, 0.8);
}

/* Settings configuration group */
.settings-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 30px;
}

.setting-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.setting-label {
  font-family: var(--font-cyber);
  font-size: 0.8rem;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.6);
}

/* Difficulty Button Selectors */
.difficulty-selector {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.diff-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  padding: 6px 12px;
  font-family: var(--font-cyber);
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.diff-btn.active {
  background: var(--neon-cyan);
  color: #000000;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
  text-shadow: none;
}

/* Sound Toggle Button */
.sound-toggle-btn {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  padding: 6px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-cyber);
  font-size: 0.8rem;
  font-weight: 700;
  transition: all 0.2s ease;
}

.sound-toggle-btn.muted {
  color: rgba(255, 255, 255, 0.3) !important;
  text-shadow: none !important;
  border-color: rgba(255, 255, 255, 0.05);
}

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 8px;
  font-family: var(--font-cyber);
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 2px;
  cursor: pointer;
  color: #000000;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  outline: none;
}

.btn-primary:active {
  transform: scale(0.96);
}

.neon-btn-magenta {
  background: var(--neon-magenta);
  box-shadow: var(--shadow-magenta);
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.neon-btn-magenta:hover {
  filter: brightness(1.2);
  box-shadow: 0 0 20px rgba(255, 0, 127, 0.8), 0 0 40px rgba(255, 0, 127, 0.5);
}

.neon-btn-cyan {
  background: var(--neon-cyan);
  box-shadow: var(--shadow-cyan);
  color: #000000;
  font-weight: 900;
}

.neon-btn-cyan:hover {
  filter: brightness(1.2);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.8), 0 0 40px rgba(0, 240, 255, 0.5);
}

.btn-secondary {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 12px;
  border-radius: 8px;
  font-family: var(--font-cyber);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-top: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Control guide */
.controls-guide {
  margin-top: 24px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.5px;
}

.controls-guide i {
  margin-right: 4px;
}

/* HUD Overlay Styles */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.3s ease;
}

.hud.hidden {
  opacity: 0;
}

.score-container {
  display: flex;
  flex-direction: column;
  background: rgba(7, 5, 15, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 16px;
  border-radius: 12px;
}

.score-label {
  font-size: 0.6rem;
  font-family: var(--font-cyber);
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 1px;
  line-height: 1;
  margin-bottom: 2px;
}

.score-value {
  font-size: 1.8rem;
  font-family: var(--font-cyber);
  font-weight: 900;
  color: var(--neon-cyan);
  text-shadow: var(--shadow-cyan);
  line-height: 1;
}

.hud-controls {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.hud-btn {
  background: rgba(7, 5, 15, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s ease;
}

.hud-btn:hover {
  color: #ffffff;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

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

/* Game Over Screen Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  margin-bottom: 24px;
}

.stat-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-family: var(--font-cyber);
  font-size: 0.65rem;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 4px;
}

.stat-val {
  font-family: var(--font-cyber);
  font-size: 1.8rem;
  font-weight: 900;
}

/* New Record Alert badge */
.new-record {
  background: linear-gradient(90deg, var(--neon-magenta), #ff00ff);
  padding: 6px 16px;
  border-radius: 4px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-magenta);
  animation: pulse-glow 1s infinite alternate;
}

.new-record-text {
  font-family: var(--font-cyber);
  font-size: 0.8rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 1.5px;
}

.pause-actions {
  width: 100%;
}

/* Animations */
@keyframes pulse-glow {
  0% {
    transform: scale(0.96);
    box-shadow: 0 0 10px rgba(255, 0, 127, 0.5);
  }
  100% {
    transform: scale(1.04);
    box-shadow: 0 0 20px rgba(255, 0, 127, 0.9);
  }
}

@keyframes glitch {
  0% {
    text-shadow: 2px -1px 0 red, -1px 2px 0 blue, var(--shadow-magenta);
  }
  20% {
    text-shadow: -2px 1px 0 red, 1px -2px 0 blue, var(--shadow-magenta);
  }
  40% {
    text-shadow: 2px 2px 0 red, -2px -2px 0 blue, var(--shadow-magenta);
  }
  60% {
    text-shadow: -1px -1px 0 red, 2px 1px 0 blue, var(--shadow-magenta);
  }
  80% {
    text-shadow: 2px -2px 0 red, -1px 1px 0 blue, var(--shadow-magenta);
  }
  100% {
    text-shadow: -2px 2px 0 red, 1px -1px 0 blue, var(--shadow-magenta);
  }
}
