@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Share+Tech+Mono&display=swap');

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

body {
  background: #000;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  font-family: 'Orbitron', monospace;
  cursor: default;
}

#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  touch-action: none;
}

#game-canvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  touch-action: none;
}

#ui {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  pointer-events: none;
}

#score-box, #best-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.label {
  font-size: 10px;
  letter-spacing: 3px;
  color: rgba(100, 200, 255, 0.5);
  font-family: 'Share Tech Mono', monospace;
}

#score-val, #best-val {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
  text-shadow: 0 0 12px rgba(100, 200, 255, 0.8);
  font-family: 'Share Tech Mono', monospace;
  min-width: 60px;
  text-align: center;
}

#title-text {
  font-size: 11px;
  letter-spacing: 6px;
  color: rgba(100,200,255,0.3);
  text-align: center;
}

#overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

#overlay.visible {
  opacity: 1;
  pointer-events: all;
}

#overlay-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

#overlay-title {
  font-size: clamp(28px, 6vw, 56px);
  font-weight: 900;
  letter-spacing: 8px;
  color: #fff;
  text-shadow: 0 0 30px rgba(100,200,255,0.9), 0 0 60px rgba(100,200,255,0.4);
}

#overlay-sub {
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 1px;
  line-height: 1.8;
}

#score-display {
  font-size: 48px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 20px rgba(100,200,255,0.8);
  letter-spacing: 4px;
  font-family: 'Share Tech Mono', monospace;
  display: none;
}

#score-display.show { display: block; }

#new-best-badge {
  font-size: 12px;
  letter-spacing: 4px;
  color: #7df;
  text-shadow: 0 0 12px rgba(100,255,200,0.9);
  display: none;
}
#new-best-badge.show { display: block; }

#start-btn {
  margin-top: 8px;
  padding: 14px 48px;
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 6px;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(100,200,255,0.6);
  cursor: pointer;
  transition: all 0.2s;
  text-shadow: 0 0 10px rgba(100,200,255,0.8);
  box-shadow: 0 0 20px rgba(100,200,255,0.1), inset 0 0 20px rgba(100,200,255,0.05);
}

#start-btn:hover {
  background: rgba(100,200,255,0.1);
  border-color: rgba(100,200,255,1);
  box-shadow: 0 0 30px rgba(100,200,255,0.3), inset 0 0 30px rgba(100,200,255,0.1);
}

#start-btn:active {
  transform: scale(0.97);
}

#learn-btn {
  background: none;
  border: none;
  color: rgba(100,200,255,0.4);
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 3px;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(100,200,255,0.2);
  transition: color 0.2s;
}
#learn-btn:hover { color: rgba(100,200,255,0.85); }
#learn-btn.hidden { display: none; }

/* ── Tutorial modal ── */
#tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#tutorial-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

#tutorial-inner {
  position: relative;
  width: min(380px, 92vw);
  border: 1px solid rgba(100,200,255,0.2);
  background: rgba(2,1,15,0.9);
  box-shadow: 0 0 40px rgba(100,200,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

#tutorial-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: rgba(100,200,255,0.4);
  font-size: 16px;
  cursor: pointer;
  z-index: 1;
  transition: color 0.2s;
  font-family: 'Share Tech Mono', monospace;
}
#tutorial-close:hover { color: rgba(100,200,255,0.9); }

#tutorial-slides {
  width: 100%;
}

.tutorial-slide {
  display: none;
  flex-direction: column;
  align-items: center;
}
.tutorial-slide.active { display: flex; }

.tutorial-slide svg {
  width: 100%;
  height: auto;
  display: block;
  background: #02010f;
}

.slide-title {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 5px;
  color: #fff;
  text-shadow: 0 0 18px rgba(100,200,255,0.7);
  margin: 18px 24px 8px;
  text-align: center;
}

.slide-desc {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.5px;
  line-height: 1.7;
  text-align: center;
  margin: 0 24px 20px;
}
.slide-desc strong { color: rgba(100,200,255,0.9); }

#tutorial-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(100,200,255,0.1);
}

#tutorial-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tutorial-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(100,200,255,0.2);
  transition: background 0.25s, box-shadow 0.25s;
}
.tutorial-dot.active {
  background: rgba(100,200,255,0.9);
  box-shadow: 0 0 8px rgba(100,200,255,0.7);
}

#tutorial-next {
  background: transparent;
  border: 1px solid rgba(100,200,255,0.5);
  color: #fff;
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 4px;
  padding: 10px 22px;
  cursor: pointer;
  transition: all 0.2s;
  text-shadow: 0 0 8px rgba(100,200,255,0.6);
}
#tutorial-next:hover {
  background: rgba(100,200,255,0.1);
  border-color: rgba(100,200,255,0.9);
}

#power-box {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  cursor: default;
}

#power-box.nova-ready {
  cursor: pointer;
}

#power-track {
  width: 220px;
  height: 3px;
  background: rgba(100, 200, 255, 0.12);
  border: 1px solid rgba(100, 200, 255, 0.18);
  overflow: hidden;
}

#power-fill {
  height: 100%;
  width: 0%;
  background: rgba(100, 200, 255, 0.85);
  box-shadow: 0 0 10px rgba(100, 200, 255, 0.7);
}

#power-fill.ready {
  background: #fff;
  box-shadow: 0 0 16px rgba(100, 200, 255, 1), 0 0 32px rgba(100, 200, 255, 0.5);
  animation: power-pulse 0.7s ease-in-out infinite alternate;
}

#power-label {
  font-size: 9px;
  letter-spacing: 5px;
  color: rgba(100, 200, 255, 0.35);
  font-family: 'Share Tech Mono', monospace;
  transition: color 0.3s, text-shadow 0.3s;
}

#power-label.ready {
  color: rgba(100, 200, 255, 0.95);
  text-shadow: 0 0 10px rgba(100, 200, 255, 0.9);
  animation: power-pulse-text 0.7s ease-in-out infinite alternate;
}

@keyframes power-pulse {
  from { box-shadow: 0 0 10px rgba(100, 200, 255, 0.6); }
  to   { box-shadow: 0 0 24px rgba(100, 200, 255, 1), 0 0 48px rgba(100, 200, 255, 0.4); }
}

@keyframes power-pulse-text {
  from { opacity: 0.7; }
  to   { opacity: 1; }
}
