/* Singularity Sling: Deep Space Neon Glassmorphism & High-Performance HUD */
:root {
  --bg-dark: #04060f;
  --cyan-neon: #00f5ff;
  --cyan-glow: rgba(0, 245, 255, 0.45);
  --gold-neon: #ffd166;
  --gold-glow: rgba(255, 209, 102, 0.45);
  --magenta-neon: #ff007f;
  --magenta-glow: rgba(255, 0, 127, 0.45);
  --purple-neon: #9d4edd;
  --green-neon: #06d6a0;
  --hud-bg: rgba(6, 10, 24, 0.85);
  --card-bg: rgba(10, 16, 36, 0.92);
  --font-cyber: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', Consolas, Monaco, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: #e0f2fe;
  font-family: var(--font-cyber);
  touch-action: none;
  overscroll-behavior: none;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at center, #081028 0%, #04060f 85%);
}

canvas#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* TOP STATUS HUD */
#top-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  z-index: 10;
}

.speed-bar-container {
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 8px;
  padding: 7px 12px;
  border: 1px solid rgba(0, 245, 255, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.speed-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  font-family: var(--font-mono);
}

.speed-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--cyan-neon);
  display: flex;
  align-items: center;
  gap: 6px;
}

.speed-mach-val {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

.speed-mach-val.hyper {
  color: var(--gold-neon);
  text-shadow: 0 0 10px var(--gold-glow);
}

.speed-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.speed-fill {
  width: 20%;
  height: 100%;
  background: linear-gradient(90deg, #00f5ff, #ffd166);
  box-shadow: 0 0 10px var(--cyan-glow);
  transition: width 0.1s linear;
}

.speed-fill.hyper {
  background: linear-gradient(90deg, #ffd166, #ff007f);
  box-shadow: 0 0 14px var(--magenta-glow);
}

.hud-chips-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  font-family: var(--font-mono);
}

.hud-chip {
  background: var(--hud-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 5px 12px;
  border-radius: 16px;
  border: 1px solid rgba(0, 245, 255, 0.25);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-chip.sector {
  color: var(--gold-neon);
  border-color: var(--gold-glow);
}

.hud-chip.crystals {
  color: var(--cyan-neon);
  border-color: var(--cyan-glow);
}

.hud-chip.combo {
  color: var(--magenta-neon);
  border-color: var(--magenta-glow);
}

/* TOP RIGHT AUDIO & RESTART BUTTONS */
.hud-btn-group {
  position: absolute;
  top: 12px;
  right: 18px;
  display: flex;
  gap: 8px;
  z-index: 12;
  pointer-events: auto;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--hud-bg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #94a3b8;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  transition: all 0.2s;
}

.icon-btn:hover, .icon-btn:active {
  color: var(--cyan-neon);
  border-color: var(--cyan-neon);
  box-shadow: 0 0 12px var(--cyan-glow);
}

/* TOUCH HINT OVERLAY */
#touch-hint {
  position: absolute;
  bottom: 24px;
  width: 100%;
  text-align: center;
  font-size: 13px;
  color: rgba(0, 245, 255, 0.7);
  letter-spacing: 1px;
  pointer-events: none;
  font-family: var(--font-mono);
  animation: pulseHint 2s infinite ease-in-out;
}

@keyframes pulseHint {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

/* MODAL OVERLAYS */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 6, 15, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-out;
  padding: 16px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--card-bg);
  border: 1.5px solid rgba(0, 245, 255, 0.35);
  border-radius: 22px;
  padding: 30px 24px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 245, 255, 0.15);
  animation: modalScale 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.2);
}

@keyframes modalScale {
  0% { transform: scale(0.9) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 8px;
  background: linear-gradient(120deg, #fff, var(--cyan-neon), var(--gold-neon));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-subtitle {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 22px;
  line-height: 1.5;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 18px 0;
  font-family: var(--font-mono);
}

.stat-box {
  background: rgba(255, 255, 255, 0.04);
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-label {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 4px;
}

.stat-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--cyan-neon);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #00f5ff, #0077ff);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 245, 255, 0.4);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover, .btn-primary:active {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 245, 255, 0.6);
}

.controls-hint {
  font-size: 11px;
  color: #64748b;
  margin-top: 14px;
  line-height: 1.6;
}

@media (max-width: 600px) {
  .modal-content {
    padding: 24px 18px;
  }
  .modal-title {
    font-size: 24px;
  }
}
