* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  overflow: hidden;
  background: #000;
  font-family: 'Orbitron', sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
}

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

#scene-container canvas {
  display: block;
}

.hidden { display: none !important; }

/* ---- START SCREEN ---- */
#start-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #0a0e17 0%, #000 80%);
}

#start-bg-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0.15;
}

.start-content {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 2rem;
}

.title {
  font-size: clamp(3rem, 10vw, 7rem);
  font-weight: 900;
  letter-spacing: 0.3em;
  color: #00ff88;
  text-shadow:
    0 0 20px #00ff8888,
    0 0 60px #00ff8844,
    0 0 120px #00ff8822;
  animation: titlePulse 3s ease-in-out infinite;
}

@keyframes titlePulse {
  0%, 100% { text-shadow: 0 0 20px #00ff8888, 0 0 60px #00ff8844, 0 0 120px #00ff8822; }
  50% { text-shadow: 0 0 30px #00ff88cc, 0 0 80px #00ff8866, 0 0 160px #00ff8833; }
}

.subtitle {
  font-family: 'Share Tech Mono', monospace;
  font-size: clamp(0.8rem, 2vw, 1.1rem);
  color: #557766;
  margin-top: 0.5rem;
  letter-spacing: 0.15em;
}

.difficulty-select {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin: 2.5rem 0 2rem;
  flex-wrap: wrap;
}

.diff-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.8rem 1.5rem;
  border: 2px solid #1a3a2a;
  background: transparent;
  color: #448866;
  cursor: pointer;
  transition: all 0.25s;
  letter-spacing: 0.1em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 100px;
}

.diff-btn span {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  color: #336655;
}

.diff-btn:hover, .diff-btn.selected {
  border-color: #00ff88;
  color: #00ff88;
  box-shadow: 0 0 15px #00ff8833, inset 0 0 15px #00ff8811;
}

.diff-btn.selected span { color: #00ff88aa; }

#start-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  font-weight: 700;
  padding: 1rem 3rem;
  border: 2px solid #00ff88;
  background: transparent;
  color: #00ff88;
  cursor: pointer;
  letter-spacing: 0.2em;
  transition: all 0.3s;
  animation: btnPulse 2s ease-in-out infinite;
}

@keyframes btnPulse {
  0%, 100% { box-shadow: 0 0 15px #00ff8833; }
  50% { box-shadow: 0 0 30px #00ff8866, 0 0 60px #00ff8822; }
}

#start-btn:hover {
  background: #00ff8822;
  transform: scale(1.05);
}

.instructions {
  font-family: 'Share Tech Mono', monospace;
  font-size: clamp(0.65rem, 1.5vw, 0.8rem);
  color: #335544;
  margin-top: 1.5rem;
  letter-spacing: 0.1em;
}

.best-times {
  margin-top: 2rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.75rem;
  color: #336655;
}

.start-footer {
  position: absolute;
  bottom: 1rem;
  width: 100%;
  text-align: center;
  z-index: 10;
}

.start-footer a {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  color: #223322;
  text-decoration: none;
  letter-spacing: 0.1em;
}

.start-footer a:hover { color: #00ff8866; }

/* ---- HUD ---- */
#hud {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 50;
  pointer-events: none;
}

#hud-top-left {
  position: absolute;
  top: 1rem;
  left: 1rem;
}

#timer {
  font-family: 'Share Tech Mono', monospace;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  color: #00ff88;
  text-shadow: 0 0 10px #00ff8866;
  background: #000000aa;
  padding: 0.3rem 0.8rem;
  border: 1px solid #00ff8833;
}

#steps {
  font-family: 'Share Tech Mono', monospace;
  font-size: clamp(0.7rem, 1.5vw, 0.9rem);
  color: #00ff8899;
  margin-top: 0.3rem;
  padding-left: 0.2rem;
}

#hud-top-center {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
}

#level-indicator {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  font-weight: 700;
  color: #00ff88;
  letter-spacing: 0.3em;
  text-shadow: 0 0 15px #00ff8866;
  background: #000000aa;
  padding: 0.3rem 1.2rem;
  border: 1px solid #00ff8833;
}

#hud-top-right {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

#minimap {
  border: 2px solid #00ff8844;
  background: #000000cc;
  border-radius: 4px;
  image-rendering: pixelated;
}

#crosshair {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.5rem;
  color: #ffffff55;
  pointer-events: none;
}

#hint-text {
  position: absolute;
  bottom: 3rem;
  width: 100%;
  text-align: center;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.9rem;
  color: #00ff8888;
  animation: hintFade 2s ease-in-out infinite;
}

@keyframes hintFade {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ---- MOBILE CONTROLS ---- */
#mobile-controls {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 55;
  pointer-events: none;
}

#joystick-zone-left {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  width: 130px;
  height: 130px;
  pointer-events: auto;
}

#joystick-base {
  width: 100%; height: 100%;
  border-radius: 50%;
  border: 2px solid #00ff8844;
  background: #00ff8811;
  position: relative;
}

#joystick-thumb {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: #00ff8844;
  border: 2px solid #00ff8888;
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  transition: none;
}

#joystick-zone-right {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  pointer-events: auto;
}

/* ---- VICTORY SCREEN ---- */
#victory-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000dd;
}

#confetti-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

.victory-content {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 2rem;
}

.victory-title {
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 900;
  color: #ffd700;
  letter-spacing: 0.2em;
  text-shadow: 0 0 30px #ffd70088, 0 0 80px #ffd70044;
  animation: titlePulseGold 2s ease-in-out infinite;
}

@keyframes titlePulseGold {
  0%, 100% { text-shadow: 0 0 30px #ffd70088, 0 0 80px #ffd70044; }
  50% { text-shadow: 0 0 50px #ffd700cc, 0 0 120px #ffd70066; }
}

.stars {
  font-size: clamp(2rem, 6vw, 3.5rem);
  margin: 1.5rem 0;
  letter-spacing: 0.5em;
}

.star-filled { color: #ffd700; text-shadow: 0 0 15px #ffd70088; }
.star-empty { color: #333; }

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

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.stat-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.75rem;
  color: #888;
  letter-spacing: 0.2em;
}

.stat-value {
  font-family: 'Share Tech Mono', monospace;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  color: #00ff88;
  text-shadow: 0 0 10px #00ff8866;
}

.victory-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.victory-buttons button {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.8rem 2rem;
  border: 2px solid #00ff88;
  background: transparent;
  color: #00ff88;
  cursor: pointer;
  letter-spacing: 0.15em;
  transition: all 0.25s;
}

.victory-buttons button:hover {
  background: #00ff8822;
  box-shadow: 0 0 20px #00ff8844;
}

#next-level-btn {
  border-color: #ffd700 !important;
  color: #ffd700 !important;
}

#next-level-btn:hover {
  background: #ffd70022 !important;
  box-shadow: 0 0 20px #ffd70044 !important;
}