:root {
  --neon-cyan: #00f5ff;
  --neon-pink: #ff006e;
  --neon-yellow: #ffcc00;
  --neon-green: #39ff14;
  --dark-bg: #050510;
  --mid-bg: #0a0a20;
  --grid-color: rgba(0,245,255,0.06);
  --text: #e0e8ff;
}

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

body {
  background: var(--dark-bg);
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  user-select: none;
}

#app { width: 100%; height: 100%; position: relative; }

/* ===== SCREENS ===== */
.screen {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
}
.screen.active { display: flex; }

/* ===== BACKGROUND ===== */
.menu-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(0,245,255,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(255,0,110,0.08) 0%, transparent 50%),
    linear-gradient(180deg, #050510 0%, #0a0820 100%);
}
.menu-bg.gold {
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255,204,0,0.15) 0%, transparent 60%),
    linear-gradient(180deg, #100a00 0%, #050510 100%);
}
.scanlines {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(0,0,0,0.3) 2px, rgba(0,0,0,0.3) 4px
  );
  pointer-events: none;
  animation: scanMove 8s linear infinite;
}
@keyframes scanMove {
  0% { background-position: 0 0; }
  100% { background-position: 0 100px; }
}

/* Grid overlay */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ===== MENU ===== */
.menu-content, .how-content, .result-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  align-items: center; gap: 24px;
  text-align: center;
}

.logo {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -2px;
  animation: logoPulse 3s ease-in-out infinite;
}
.logo-geo {
  color: var(--neon-cyan);
  text-shadow: 0 0 20px var(--neon-cyan), 0 0 60px rgba(0,245,255,0.4);
}
.logo-dash {
  color: var(--neon-pink);
  text-shadow: 0 0 20px var(--neon-pink), 0 0 60px rgba(255,0,110,0.4);
}
@keyframes logoPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

.tagline {
  color: var(--neon-cyan);
  font-size: 0.75rem;
  letter-spacing: 3px;
  opacity: 0.7;
  animation: blink 2s step-end infinite;
}
@keyframes blink {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.2; }
}

/* ===== BUTTONS ===== */
.neon-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 4px;
  padding: 14px 48px;
  border: 2px solid var(--neon-cyan);
  background: transparent;
  color: var(--neon-cyan);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.2s;
  text-shadow: 0 0 8px var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0,245,255,0.2), inset 0 0 12px rgba(0,245,255,0.05);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
.neon-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--neon-cyan);
  transform: translateX(-105%);
  transition: transform 0.2s;
  z-index: -1;
}
.neon-btn:hover::before { transform: translateX(0); }
.neon-btn:hover { color: var(--dark-bg); text-shadow: none; }
.neon-btn:active { transform: scale(0.97); }

.neon-btn.secondary {
  border-color: var(--neon-pink);
  color: var(--neon-pink);
  text-shadow: 0 0 8px var(--neon-pink);
  box-shadow: 0 0 12px rgba(255,0,110,0.2), inset 0 0 12px rgba(255,0,110,0.05);
}
.neon-btn.secondary::before { background: var(--neon-pink); }
.neon-btn.secondary:hover { color: var(--dark-bg); }

/* ===== DIFFICULTY ===== */
.level-select { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.label {
  font-size: 0.65rem;
  letter-spacing: 4px;
  color: rgba(255,255,255,0.4);
}
.diff-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.diff-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 2px;
  padding: 8px 16px;
  border: 1px solid rgba(255,255,255,0.2);
  background: transparent;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: all 0.2s;
}
.diff-btn:hover, .diff-btn.active {
  border-color: var(--neon-yellow);
  color: var(--neon-yellow);
  box-shadow: 0 0 10px rgba(255,204,0,0.3);
}

.editor-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 2px;
  padding: 8px 16px;
  border: 1px solid rgba(255,255,255,0.2);
  background: transparent;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: all 0.2s;
}

.editor-btn:hover {
  border-color: var(--neon-yellow);
  color: var(--neon-yellow);
  box-shadow: 0 0 10px rgba(0,104,255,0.3);
}

/* ===== HIGH SCORE ===== */
.high-score-display { display: flex; flex-direction: column; align-items: center; gap: 4px; }
#menu-best {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  color: var(--neon-yellow);
  text-shadow: 0 0 10px var(--neon-yellow);
}

/* ===== HOW TO PLAY ===== */
.how-content h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.8rem;
  color: var(--neon-cyan);
  letter-spacing: 6px;
  text-shadow: 0 0 15px var(--neon-cyan);
}
.instructions { display: flex; flex-direction: column; gap: 14px; }
.inst-row {
  display: flex; align-items: center; gap: 16px;
  font-size: 0.9rem;
}
kbd {
  background: rgba(0,245,255,0.1);
  border: 1px solid var(--neon-cyan);
  padding: 4px 10px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  color: var(--neon-cyan);
  min-width: 70px;
  text-align: center;
}
.icon { font-size: 1.2rem; min-width: 70px; text-align: center; }

/* ===== HUD ===== */
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  background: linear-gradient(180deg, rgba(5,5,16,0.9) 0%, transparent 100%);
}
#progress-label, #attempt-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  color: var(--neon-cyan);
  letter-spacing: 2px;
  min-width: 44px;
}
#attempt-label { text-align: right; min-width: 56px; color: rgba(255,255,255,0.4); }
#progress-bar-wrap {
  flex: 1; height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}
#progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink));
  box-shadow: 0 0 8px var(--neon-cyan);
  transition: width 0.1s linear;
}

/* ===== CANVAS ===== */
#game-screen { background: var(--dark-bg); }
#gameCanvas { display: block; width: 100%; height: 100%; }

/* ===== DEATH FLASH ===== */
#death-flash {
  position: absolute; inset: 0;
  background: rgba(255,0,110,0.6);
  pointer-events: none;
  opacity: 0;
  z-index: 20;
}
#death-flash.flash {
  animation: deathFlash 0.3s ease-out forwards;
}
@keyframes deathFlash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ===== WIN / RESULT ===== */
.result-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.5rem, 5vw, 3rem);
  font-weight: 900;
  letter-spacing: 4px;
}
.result-title.win {
  color: var(--neon-yellow);
  text-shadow: 0 0 20px var(--neon-yellow), 0 0 60px rgba(255,204,0,0.4);
  animation: winPulse 1s ease-in-out infinite;
}
@keyframes winPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.4); }
}
.result-stars {
  font-size: 2.5rem;
  color: var(--neon-yellow);
  text-shadow: 0 0 15px var(--neon-yellow);
  animation: starSpin 2s ease-in-out;
}
@keyframes starSpin {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  60% { transform: scale(1.2) rotate(10deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.result-stats { display: flex; gap: 48px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stat-label { font-size: 0.65rem; letter-spacing: 3px; color: rgba(255,255,255,0.4); }
.stat span:last-child {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--neon-cyan);
}

/* Particle canvas layer */
#particles {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 5;
}

@media (max-width: 480px) {
  .neon-btn { padding: 12px 32px; font-size: 0.85rem; letter-spacing: 2px; }
  .logo { font-size: 3rem; }
}

.logo-O {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: default;
  outline: none;
  color:inherit;
  text-shadow: 0 0 20px var(--neon-cyan), 0 0 60px rgba(0,245,255,0.4);
}

.logo-v {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: default;
  outline: none;
  color:inherit;
  text-shadow: 0 0 20px var(--neon-pink), 0 0 60px rgba(0,245,255,0.4);
}

/* ===== CUSTOM CURSOR ===== */
*, *::before, *::after { cursor: none !important; }

#cursor {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  top: 0; left: 0;
}

#cursor-dot {
  width: 6px; height: 6px;
  background: var(--neon-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--neon-cyan), 0 0 20px var(--neon-cyan);
  position: absolute;
  transform: translate(-50%, -50%);
}

#cursor-cross {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 24px; height: 24px;
}

#cursor-cross::before,
#cursor-cross::after {
  content: '';
  position: absolute;
  background: var(--neon-cyan);
  opacity: 0.8;
  box-shadow: 0 0 6px var(--neon-cyan);
}

/* Horizontal bar */
#cursor-cross::before {
  width: 24px; height: 1px;
  top: 50%; left: 0;
  transform: translateY(-50%);
}

/* Vertical bar */
#cursor-cross::after {
  width: 1px; height: 24px;
  left: 50%; top: 0;
  transform: translateX(-50%);
}

/* Pink on hover over buttons */
body.cursor-hover #cursor-dot {
  background: var(--neon-pink);
  box-shadow: 0 0 8px var(--neon-pink), 0 0 20px var(--neon-pink);
}
body.cursor-hover #cursor-cross::before,
body.cursor-hover #cursor-cross::after {
  background: var(--neon-pink);
  box-shadow: 0 0 6px var(--neon-pink);
}
