:root {
  --bg-primary: #07070f;
  --bg-secondary: #0f0f1a;
  --neon-cyan: #00f0ff;
  --neon-magenta: #ff00aa;
  --neon-blue: #3366ff;
  --neon-gold: #ffcc00;
  --neon-green: #00ff88;
  --neon-red: #ff3355;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg-primary);
  color: #e0e0f0;
  font-family: 'Bricolage Grotesque', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated background grid */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(0,240,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,240,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

#root {
  position: relative;
  z-index: 1;
}

@keyframes titleGlow {
  0%, 100% { text-shadow: 0 0 20px rgba(0,240,255,0.5), 0 0 40px rgba(0,240,255,0.2); }
  50% { text-shadow: 0 0 30px rgba(0,240,255,0.8), 0 0 60px rgba(0,240,255,0.4), 0 0 80px rgba(255,0,170,0.2); }
}

@keyframes breathe {
  0%, 100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-4px) scale(1.01); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 50%, 90% { transform: translateX(-4px); }
  30%, 70% { transform: translateX(4px); }
}

@keyframes levelUp {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

@keyframes perfectBurst {
  0% { transform: scale(0); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.8; }
  100% { transform: scale(2); opacity: 0; }
}

@keyframes confettiDrop {
  0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0.3; }
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes pulseBtn {
  0%, 100% { box-shadow: 0 0 20px rgba(0,240,255,0.3); }
  50% { box-shadow: 0 0 40px rgba(0,240,255,0.6), 0 0 60px rgba(255,0,170,0.3); }
}

@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

.title-glow {
  animation: titleGlow 2s ease-in-out infinite;
}

.breathe {
  animation: breathe 2.5s ease-in-out infinite;
}

.shake {
  animation: shake 0.3s ease-in-out;
}

.level-up-anim {
  animation: levelUp 1s ease-out forwards;
}

.perfect-burst {
  animation: perfectBurst 0.8s ease-out forwards;
}

.pulse-btn {
  animation: pulseBtn 2s ease-in-out infinite;
}

.slide-up {
  animation: slideUp 0.5s ease-out forwards;
}

/* Confetti pieces */
.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  animation: confettiDrop linear forwards;
  pointer-events: none;
  z-index: 100;
}

/* Hidden input for typing */
.hidden-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Focus visible input */
.hidden-input:focus {
  outline: none;
}

/* Progress bar */
.progress-bar-bg {
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Letter styles */
.letter {
  display: inline-block;
  transition: color 0.1s, transform 0.1s;
  font-family: 'Fira Code', monospace;
}

.letter-pending {
  color: rgba(255,255,255,0.25);
}

.letter-correct {
  color: var(--neon-green);
  text-shadow: 0 0 10px rgba(0,255,136,0.5);
}

.letter-wrong {
  color: var(--neon-red);
  text-shadow: 0 0 10px rgba(255,51,85,0.5);
}

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

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

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

/* Mobile warning */
@media (max-width: 640px) {
  .mobile-warning {
    display: flex !important;
  }
}

/* Timer font */
.timer-font {
  font-family: 'Fira Code', monospace;
  font-variant-numeric: tabular-nums;
}

/* Leaderboard */
.lb-row {
  transition: background 0.2s;
}

.lb-row:hover {
  background: rgba(0,240,255,0.05);
}