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

body {
  overflow: hidden;
  background: #0a0a0f;
  font-family: 'Orbitron', 'JetBrains Mono', monospace;
  color: #fff;
  -webkit-user-select: none;
  user-select: none;
}

#scene-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#ui-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

#ui-overlay * {
  pointer-events: auto;
}

/* Menu Styles */
.menu-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background: radial-gradient(ellipse at center, rgba(26, 0, 48, 0.8) 0%, rgba(10, 10, 15, 0.95) 100%);
}

.menu-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(45deg, transparent 48%, rgba(0, 255, 255, 0.03) 50%, transparent 52%),
    linear-gradient(-45deg, transparent 48%, rgba(255, 0, 255, 0.03) 50%, transparent 52%);
  background-size: 60px 60px;
  animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
  0% { background-position: 0 0; }
  100% { background-position: 60px 60px; }
}

.menu-content {
  position: relative;
  text-align: center;
  z-index: 2;
}

.game-title {
  font-size: clamp(3rem, 12vw, 6rem);
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #00ffff 0%, #ff00ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 40px rgba(0, 255, 255, 0.5);
  animation: titlePulse 2s ease-in-out infinite;
}

.title-accent {
  background: linear-gradient(180deg, #ff00ff 0%, #00ffff 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

@keyframes titlePulse {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(0, 255, 255, 0.5)); }
  50% { filter: drop-shadow(0 0 40px rgba(255, 0, 255, 0.8)); }
}

.subtitle {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.8rem, 2vw, 1rem);
  color: rgba(255, 255, 255, 0.6);
  margin-top: 0.5rem;
  letter-spacing: 0.05em;
}

.stats-display {
  display: flex;
  gap: 3rem;
  margin: 2rem 0;
  justify-content: center;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 0.7rem;
  color: rgba(0, 255, 255, 0.7);
  letter-spacing: 0.2em;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #00ffff;
  text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.play-button {
  position: relative;
  padding: 1.2rem 4rem;
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0a0a0f;
  background: linear-gradient(135deg, #00ffff 0%, #00ff88 100%);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-top: 1rem;
}

.play-button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 40px rgba(0, 255, 255, 0.6);
}

.play-button:active {
  transform: scale(0.98);
}

.btn-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 40%, rgba(255, 255, 255, 0.4) 50%, transparent 60%);
  animation: btnShine 3s ease-in-out infinite;
}

@keyframes btnShine {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

.controls-hint {
  margin-top: 2rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.hint-icon {
  font-size: 1.2rem;
}

.menu-footer {
  position: absolute;
  bottom: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
}

.menu-footer a {
  color: #00ffff;
  text-decoration: none;
}

.menu-footer a:hover {
  text-decoration: underline;
}

/* HUD Styles */
.hud {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.5rem;
  pointer-events: none;
}

.hud-left, .hud-center, .hud-right {
  pointer-events: none;
}

.score-display, .combo-display {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.score-label, .combo-label, .speed-label {
  font-size: 0.7rem;
  color: rgba(0, 255, 255, 0.7);
  letter-spacing: 0.15em;
}

.score-value {
  font-size: 3rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
  line-height: 1;
}

.combo-display {
  margin-top: 0.5rem;
  opacity: 0.3;
  transition: opacity 0.3s;
}

.combo-display.active {
  opacity: 1;
}

.combo-value {
  font-size: 2rem;
  font-weight: 700;
  color: #ff00ff;
  text-shadow: 0 0 15px rgba(255, 0, 255, 0.5);
}

.speed-display {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.speed-bar {
  width: 150px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin: 0.3rem 0;
}

.speed-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ffff, #ff00ff);
  transition: width 0.5s ease-out;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.speed-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #00ffff;
}

.input-indicators {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.input-row {
  display: flex;
  gap: 0.3rem;
}

.input-arrow {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.4);
  transition: all 0.1s;
}

.input-arrow.flash {
  background: rgba(0, 255, 136, 0.5);
  border-color: #00ff88;
  color: #00ff88;
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

.speed-up-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 4rem;
  font-weight: 900;
  color: #ff00ff;
  text-shadow: 0 0 40px rgba(255, 0, 255, 0.8);
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
}

.speed-up-overlay.visible {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  animation: speedUpPop 1s ease-out forwards;
}

@keyframes speedUpPop {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

.combo-milestone {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 3rem;
  font-weight: 900;
  color: #00ffff;
  text-shadow: 0 0 40px rgba(0, 255, 255, 0.8);
  opacity: 0;
  pointer-events: none;
}

.combo-milestone.visible {
  animation: comboPop 1.5s ease-out forwards;
}

@keyframes comboPop {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

.pause-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 15, 0.9);
  font-size: 4rem;
  font-weight: 900;
  color: #00ffff;
  text-shadow: 0 0 40px rgba(0, 255, 255, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  pointer-events: none;
}

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

.pause-hint {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 1rem;
}

.mobile-swipe-hint {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.5);
  animation: swipeHint 2s ease-in-out infinite;
}

.swipe-icon {
  font-size: 2rem;
}

@keyframes swipeHint {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-10px); }
}

/* Countdown Styles */
.countdown {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 15, 0.8);
}

.countdown-number {
  font-size: clamp(6rem, 25vw, 12rem);
  font-weight: 900;
  color: #00ffff;
  text-shadow: 0 0 60px rgba(0, 255, 255, 0.8);
  animation: countPop 1s ease-out;
}

.countdown.go .countdown-number {
  background: linear-gradient(135deg, #00ffff, #00ff88);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

/* Game Over Styles */
.gameover-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background: radial-gradient(ellipse at center, rgba(50, 0, 30, 0.9) 0%, rgba(10, 10, 15, 0.98) 100%);
}

.gameover-glitch {
  font-size: clamp(2.5rem, 10vw, 5rem);
  font-weight: 900;
  color: #ff3366;
  text-shadow: 0 0 40px rgba(255, 51, 102, 0.8);
  animation: glitch 0.5s ease-in-out infinite alternate;
  position: relative;
}

.gameover-glitch::before,
.gameover-glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.gameover-glitch::before {
  color: #00ffff;
  animation: glitchLeft 0.3s ease-in-out infinite alternate;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.gameover-glitch::after {
  color: #ff00ff;
  animation: glitchRight 0.3s ease-in-out infinite alternate;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

@keyframes glitch {
  0% { transform: skew(0deg); }
  20% { transform: skew(-2deg); }
  40% { transform: skew(2deg); }
  60% { transform: skew(0deg); }
  80% { transform: skew(1deg); }
  100% { transform: skew(-1deg); }
}

@keyframes glitchLeft {
  0% { transform: translate(-2px, 0); }
  100% { transform: translate(2px, 0); }
}

@keyframes glitchRight {
  0% { transform: translate(2px, 0); }
  100% { transform: translate(-2px, 0); }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 2rem 0;
  max-width: 400px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(0, 255, 255, 0.2);
  border-radius: 8px;
}

.stat-icon {
  font-size: 1.5rem;
  margin-bottom: 0.3rem;
}

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #00ffff;
}

.stat-card .stat-label {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.new-record {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffff00;
  text-shadow: 0 0 20px rgba(255, 255, 0, 0.5);
  margin-bottom: 1rem;
  opacity: 0;
  transform: scale(0);
  transition: all 0.5s;
}

.new-record.visible {
  opacity: 1;
  transform: scale(1);
  animation: recordPulse 0.5s ease-out;
}

@keyframes recordPulse {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.restart-btn {
  margin-top: 1rem;
}

.share-button {
  margin-top: 1rem;
  padding: 0.8rem 2rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.share-button:hover {
  color: #00ffff;
  border-color: #00ffff;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

/* Damage Flash */
.damage-flash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(255, 51, 102, 0.4) 100%);
  pointer-events: none;
  z-index: 100;
  animation: damageFlash 0.3s ease-out forwards;
}

@keyframes damageFlash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .hud {
    padding: 1rem;
  }
  
  .score-value {
    font-size: 2rem;
  }
  
  .combo-value {
    font-size: 1.5rem;
  }
  
  .speed-bar {
    width: 100px;
  }
  
  .input-arrow {
    width: 35px;
    height: 35px;
    font-size: 1rem;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }
  
  .stat-card {
    padding: 0.8rem;
  }
  
  .stat-card .stat-value {
    font-size: 1.4rem;
  }
}