/* Nova Survivor: Cyberpunk Glassmorphism & High-Tech HUD */
:root {
  --bg-dark: #060913;
  --cyan-neon: #00f5ff;
  --cyan-glow: rgba(0, 245, 255, 0.4);
  --magenta-neon: #ff007f;
  --magenta-glow: rgba(255, 0, 127, 0.4);
  --gold-neon: #ffd166;
  --gold-glow: rgba(255, 209, 102, 0.4);
  --purple-neon: #9d4edd;
  --green-neon: #06d6a0;
  --hud-bg: rgba(10, 15, 30, 0.75);
  --card-bg: rgba(14, 21, 42, 0.85);
  --font-cyber: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 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, #0a1128 0%, #060913 100%);
}

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

/* TOP 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;
}

.exp-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(0, 245, 255, 0.2);
}

.exp-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #00f5ff, #06d6a0);
  box-shadow: 0 0 10px var(--cyan-glow);
  transition: width 0.2s cubic-bezier(0.1, 0.9, 0.2, 1);
}

.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  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;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-chip.timer {
  font-size: 16px;
  color: var(--gold-neon);
  border-color: var(--gold-glow);
  box-shadow: 0 0 8px rgba(255, 209, 102, 0.2);
}

.hud-chip.level {
  color: var(--cyan-neon);
}

.hud-chip.kills {
  color: #ff6b6b;
}

/* BOTTOM HUD & DASH BUTTON */
#bottom-hud {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 15;
}

.dash-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(0, 245, 255, 0.3), rgba(10, 20, 45, 0.9));
  border: 2px solid var(--cyan-neon);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: 0 0 16px var(--cyan-glow);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: transform 0.1s, box-shadow 0.1s;
  touch-action: manipulation;
  pointer-events: auto;
}

.dash-btn:active {
  transform: scale(0.92);
  box-shadow: 0 0 25px var(--cyan-neon);
}

.dash-btn.cooldown {
  opacity: 0.45;
  border-color: #64748b;
  box-shadow: none;
  cursor: not-allowed;
}

.dash-subtext {
  font-size: 9px;
  color: var(--cyan-neon);
  opacity: 0.8;
}

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

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--hud-bg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #94a3b8;
  font-size: 14px;
  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 10px var(--cyan-glow);
}

/* VIRTUAL JOYSTICK */
#touch-joystick {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 2px solid rgba(0, 245, 255, 0.35);
  background: radial-gradient(circle, rgba(0, 245, 255, 0.05) 0%, rgba(10, 20, 40, 0.25) 100%);
  pointer-events: none;
  display: none;
  transform: translate(-50%, -50%);
  z-index: 20;
}

#joystick-thumb {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle, #00f5ff, #0088cc);
  box-shadow: 0 0 12px var(--cyan-glow);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: transform 0.04s ease-out;
}

/* MODAL OVERLAYS (START, LEVEL UP, VICTORY, GAME OVER) */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 7, 18, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  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: 1px solid rgba(0, 245, 255, 0.3);
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7), 0 0 25px rgba(0, 245, 255, 0.15);
  animation: modalPop 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.2);
}

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

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

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

/* LEVEL UP CARDS */
.cards-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 18px 0;
}

.upgrade-card {
  background: rgba(18, 28, 54, 0.75);
  border: 1.5px solid rgba(0, 245, 255, 0.25);
  border-radius: 14px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.upgrade-card:hover, .upgrade-card:active {
  background: rgba(24, 40, 78, 0.95);
  border-color: var(--cyan-neon);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px var(--cyan-glow);
}

.upgrade-card.rare {
  border-color: rgba(255, 0, 127, 0.4);
}
.upgrade-card.rare:hover {
  border-color: var(--magenta-neon);
  box-shadow: 0 6px 20px var(--magenta-glow);
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(0, 245, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 245, 255, 0.2);
}

.card-info {
  flex: 1;
}

.card-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 245, 255, 0.2);
  color: var(--cyan-neon);
  font-family: var(--font-mono);
}

.card-desc {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}

/* BUTTONS */
.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);
}

.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: 16px;
  font-weight: 700;
  color: var(--cyan-neon);
}

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

@media (max-width: 600px) {
  .modal-content {
    padding: 22px 18px;
  }
  .modal-title {
    font-size: 22px;
  }
  .card-icon {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }
}
