@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --neon-green: #13ec49;
  --neon-green-glow: #0ea839;
  --dark-bg: #000000;
  --dark-secondary: #0a0a0a;
  --text-light: #ffffff;
  --shadow-neon: 0 0 20px var(--neon-green);
}

body {
  font-family: 'Press Start 2P', cursive;
  background: linear-gradient(135deg, #000000 0%, #0a2e0a 100%);
  color: var(--text-light);
  overflow-x: hidden;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(19, 236, 73, 0.03) 2px,
      rgba(19, 236, 73, 0.03) 4px
    );
  pointer-events: none;
  z-index: 1;
  animation: scanlines 8s linear infinite;
}

@keyframes scanlines {
  0% { transform: translateY(0); }
  100% { transform: translateY(50px); }
}

header {
  position: relative;
  z-index: 10;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--neon-green);
  box-shadow: 0 4px 20px rgba(19, 236, 73, 0.3);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo-img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px var(--neon-green));
  animation: logoPulse 2s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.logo-text h1 {
  font-size: 1.5rem;
  color: var(--neon-green);
  text-shadow: var(--shadow-neon);
  letter-spacing: 2px;
  margin-bottom: 5px;
}

.logo-text p {
  font-size: 0.5rem;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 1px;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 24px;
  background: transparent;
  border: 2px solid var(--neon-green);
  color: var(--neon-green);
  font-family: 'Press Start 2P', cursive;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  display: inline-block;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--neon-green);
  transition: left 0.3s ease;
  z-index: -1;
}

.btn:hover::before {
  left: 0;
}

.btn:hover {
  color: #000;
  box-shadow: var(--shadow-neon);
  transform: translateY(-2px);
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.6rem;
}

.btn-primary {
  background: var(--neon-green);
  color: #000;
}

.btn-primary::before {
  background: transparent;
}

.btn-primary:hover {
  background: transparent;
  color: var(--neon-green);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(19, 236, 73, 0.1);
  border: 2px solid var(--neon-green);
  border-radius: 8px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--neon-green);
}

.user-icon {
  font-size: 1.5rem;
}

.user-name {
  font-size: 0.7rem;
  color: var(--neon-green);
}

.user-badge.guest {
  border-color: #ff9800;
  background: rgba(255, 152, 0, 0.1);
}

.user-badge.guest .user-name {
  color: #ff9800;
}

.btn-logout {
  padding: 6px 12px;
  font-size: 0.6rem;
  background: transparent;
  border: 1px solid #f44336;
  color: #f44336;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-logout:hover {
  background: #f44336;
  color: #fff;
}

main {
  position: relative;
  z-index: 10;
  max-width: 1400px;
  margin: 40px auto;
  padding: 20px;
}

.game-container {
  display: flex;
  gap: 30px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: center;
}

.canvas-wrapper {
  position: relative;
  background: rgba(0, 0, 0, 0.8);
  border: 3px solid var(--neon-green);
  border-radius: 10px;
  box-shadow: 
    var(--shadow-neon),
    inset 0 0 20px rgba(19, 236, 73, 0.1);
  overflow: hidden;
}

.canvas-wrapper::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(19, 236, 73, 0.02) 10px,
    rgba(19, 236, 73, 0.02) 20px
  );
  animation: gridMove 20s linear infinite;
  pointer-events: none;
}

@keyframes gridMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(50px, 50px); }
}

#gameCanvas {
  display: block;
  position: relative;
  z-index: 1;
}

.game-info {
  flex: 1;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.info-panel {
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid var(--neon-green);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(19, 236, 73, 0.2);
}

.info-panel h2 {
  font-size: 1rem;
  color: var(--neon-green);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: var(--shadow-neon);
}

.score-display {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}

.score-item {
  text-align: center;
}

.score-label {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 10px;
  text-transform: uppercase;
}

.score-value {
  font-size: 2.5rem;
  color: var(--neon-green);
  text-shadow:var(--shadow-neon);
  font-weight: bold;
}

.difficulty-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.difficulty-label {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 10px;
  text-transform: uppercase;
}

#currentDifficulty {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 15px;
}

.difficulty-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.difficulty-btn {
  flex: 1;
  min-width: 80px;
  padding: 10px;
  background: transparent;
  border: 2px solid;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.6rem;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
}

.difficulty-btn[data-difficulty="easy"] {
  border-color: #4CAF50;
  color: #4CAF50;
}

.difficulty-btn[data-difficulty="medium"] {
  border-color: #FF9800;
  color: #FF9800;
}

.difficulty-btn[data-difficulty="hard"] {
  border-color: #F44336;
  color: #F44336;
}

.difficulty-btn.active[data-difficulty="easy"] {
  background: #4CAF50;
  color: #000;
  box-shadow: 0 0 20px #4CAF50;
}

.difficulty-btn.active[data-difficulty="medium"] {
  background: #FF9800;
  color: #000;
  box-shadow: 0 0 20px #FF9800;
}

.difficulty-btn.active[data-difficulty="hard"] {
  background: #F44336;
  color: #000;
  box-shadow: 0 0 20px #F44336;
}

.difficulty-btn:hover {
  transform: translateY(-2px);
}

.controls-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.control-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: rgba(19, 236, 73, 0.05);
  border-radius: 5px;
}

.control-label {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.8);
}

.control-keys {
  display: flex;
  gap: 5px;
}

.key {
  padding: 5px 10px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid var(--neon-green);
  border-radius: 3px;
  font-size: 0.6rem;
  color: var(--neon-green);
}

.game-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-game-control {
  width: 100%;
}

.toggle-controls {
  display: flex;
  gap: 10px;
}

.btn-toggle {
  flex: 1;
  padding: 10px;
  font-size: 0.6rem;
}

#guestWarning {
  display: none;
  background: rgba(255, 152, 0, 0.2);
  border: 2px solid #FF9800;
  border-radius: 10px;
  padding: 15px;
  margin-top: 20px;
  animation: warningPulse 2s ease-in-out infinite;
}

@keyframes warningPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 152, 0, 0.3); }
  50% { box-shadow: 0 0 20px rgba(255, 152, 0, 0.6); }
}

#guestWarning p {
  font-size: 0.6rem;
  color: #FF9800;
  text-align: center;
  line-height: 1.6;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: rgba(0, 0, 0, 0.9);
  border: 3px solid var(--neon-green);
  border-radius: 20px;
  padding: 40px;
  max-width: 500px;
  width: 90%;
  position: relative;
  box-shadow: 
    var(--shadow-neon),
    inset 0 0 50px rgba(19, 236, 73, 0.1);
  animation: modalSlideIn 0.4s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  text-align: center;
  margin-bottom: 30px;
}

.modal-header h2 {
  font-size: 1.5rem;
  color: var(--neon-green);
  text-shadow: var(--shadow-neon);
  margin-bottom: 15px;
}

.modal-header p {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.btn-auth {
  width: 100%;
  padding: 15px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-google {
  background: #fff;
  color: #000;
  border-color: #fff;
}

.btn-google:hover {
  background: var(--neon-green);
  border-color: var(--neon-green);
}

.btn-guest {
  background: transparent;
  color: #FF9800;
  border-color: #FF9800;
}

.btn-guest:hover {
  background: #FF9800;
  color: #000;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 10px 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.divider span {
  padding: 0 10px;
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.5);
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  color: var(--neon-green);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-modal:hover {
  transform: rotate(90deg);
  color: #F44336;
}

#pauseMenu {
  display: none;
}

#pauseMenu .modal-content {
  max-width: 400px;
}

.pause-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

#gameOverModal .modal-content {
  text-align: center;
}

#gameOverTitle {
  font-size: 2rem;
  margin-bottom: 20px;
}

#gameOverMessage {
  font-size: 1rem;
  margin-bottom: 30px;
  color: var(--neon-green);
}

.game-over-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.notification {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.95);
  border: 2px solid var(--neon-green);
  border-radius: 10px;
  padding: 15px 30px;
  font-size: 0.7rem;
  color: var(--neon-green);
  box-shadow: var(--shadow-neon);
  transition: bottom 0.3s ease;
  z-index: 2000;
  max-width: 90%;
  text-align: center;
}

.notification.show {
  bottom: 30px;
}

.notification-success {
  border-color: #4CAF50;
  color: #4CAF50;
  box-shadow: 0 0 20px #4CAF50;
}

.notification-error {
  border-color: #F44336;
  color: #F44336;
  box-shadow: 0 0 20px #F44336;
}

.notification-warning {
  border-color: #FF9800;
  color: #FF9800;
  box-shadow: 0 0 20px #FF9800;
}

.notification-info {
  border-color: #2196F3;
  color: #2196F3;
  box-shadow: 0 0 20px #2196F3;
}

#loadingScreen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 30px;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(19, 236, 73, 0.2);
  border-top-color: var(--neon-green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 1rem;
  color: var(--neon-green);
  text-shadow: var(--shadow-neon);
}

footer {
  position: relative;
  z-index: 10;
  background: rgba(0, 0, 0, 0.8);
  border-top: 2px solid var(--neon-green);
  padding: 30px 20px;
  margin-top: 60px;
  text-align: center;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 15px;
}

.footer-logo img {
  width: 50px;
  height: 50px;
  filter: drop-shadow(0 0 10px var(--neon-green));
}

.footer-logo span {
  font-size: 1rem;
  color: var(--neon-green);
  text-shadow: var(--shadow-neon);
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.6rem;
  transition: all 0.3s;
}

.footer-links a:hover {
  color: var(--neon-green);
  text-shadow: var(--shadow-neon);
}

.footer-copyright {
  font-size: 0.5rem;
  color: rgba(255, 255, 255, 0.5);
}

#fps {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--neon-green);
  padding: 5px 10px;
  font-size: 0.6rem;
  color: var(--neon-green);
  border-radius: 5px;
  z-index: 100;
}

@media (max-width: 1024px) {
  .game-container {
    flex-direction: column;
    align-items: center;
  }

  .canvas-wrapper {
    width: 100%;
    max-width: 800px;
  }

  #gameCanvas {
    width: 100%;
    height: auto;
  }

  .game-info {
    width: 100%;
    max-width: 800px;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .logo-text h1 {
    font-size: 1.2rem;
  }

  .logo-text p {
    font-size: 0.4rem;
  }

  .btn {
    font-size: 0.6rem;
    padding: 10px 20px;
  }

  .modal-content {
    padding: 30px 20px;
  }

  .modal-header h2 {
    font-size: 1.2rem;
  }

  .score-value {
    font-size: 2rem;
  }

  .difficulty-buttons {
    flex-direction: column;
  }

  .difficulty-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .header-container {
    flex-direction: column;
    text-align: center;
  }

  .nav-controls {
    width: 100%;
    justify-content: center;
  }

  .logo-text h1 {
    font-size: 1rem;
  }

  .btn {
    font-size: 0.5rem;
    padding: 8px 16px;
  }

  .modal-content {
    padding: 20px 15px;
  }

  #gameCanvas {
    max-height: 400px;
  }
}

.particle {
  position: fixed;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  pointer-events: none;
  animation: particleFade 1s ease-out forwards;
  z-index: 999;
}

@keyframes particleFade {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0);
  }
}

.glow-effect {
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% {
    filter: drop-shadow(0 0 5px var(--neon-green));
  }
  50% {
    filter: drop-shadow(0 0 20px var(--neon-green));
  }
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #000;
}

::-webkit-scrollbar-thumb {
  background: var(--neon-green);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--neon-green-glow);
}

::selection {
  background: var(--neon-green);
  color: #000;
}