/* ===================================================
   CYBER RUSH: NEON HIGHWAY - STYLESHEET
   Futuristic Cyberpunk UI with Glassmorphism & Neon Glow
   =================================================== */

:root {
  --neon-cyan: #00f3ff;
  --neon-pink: #ff007f;
  --neon-purple: #9900ff;
  --neon-amber: #ffb700;
  --bg-dark: #070913;
  --card-bg: rgba(13, 17, 34, 0.88);
  --card-border: rgba(0, 243, 255, 0.4);
  --font-cyber: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, sans-serif;
  --font-mono: 'Consolas', 'Courier New', monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-cyber);
  color: #fff;
  position: fixed;
}

#game-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#game-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ---------------- HUD (In-Game Overlay) ---------------- */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10;
  padding: 16px 20px;
  pointer-events: none;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  max-width: 1100px;
  margin: 0 auto;
}

.stat-box {
  background: rgba(7, 10, 26, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 243, 255, 0.3);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(0, 243, 255, 0.1);
  border-radius: 8px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
}

.stat-box .label {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: #8fa0c0;
  font-weight: 700;
}

.stat-box .value {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 10px var(--neon-cyan);
}

.cores-box .value {
  color: var(--neon-amber);
  text-shadow: 0 0 10px var(--neon-amber);
}

.hud-btn {
  pointer-events: auto;
  background: rgba(13, 20, 45, 0.85);
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  font-size: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.3);
}

.hud-btn:hover {
  background: var(--neon-cyan);
  color: #000;
  box-shadow: 0 0 20px var(--neon-cyan);
}

/* Powerup Bar */
#powerup-bar-container {
  margin: 14px auto 0;
  max-width: 320px;
  background: rgba(10, 14, 30, 0.8);
  border: 1px solid var(--neon-amber);
  border-radius: 20px;
  padding: 6px 14px;
  box-shadow: 0 0 15px rgba(255, 183, 0, 0.4);
  animation: pulse-border 1.5s infinite alternate;
}

.powerup-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--neon-amber);
  margin-bottom: 4px;
}

.powerup-progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
}

#powerup-progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--neon-pink), var(--neon-amber));
  transition: width 0.1s linear;
}

/* Shield Active Badge */
#shield-indicator {
  margin-top: 10px;
  text-align: center;
}

.shield-badge {
  display: inline-block;
  background: rgba(0, 243, 255, 0.2);
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 4px 12px;
  border-radius: 20px;
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
}

/* ---------------- Overlay Screens (Start, Pause, GameOver) ---------------- */
.overlay-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 18, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 20px;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cyber-card {
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  box-shadow: 0 0 35px rgba(0, 243, 255, 0.25), inset 0 0 25px rgba(0, 243, 255, 0.05);
  border-radius: 16px;
  padding: 30px 24px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  position: relative;
  animation: slide-up 0.4s ease-out;
}

.cyber-card.compact {
  max-width: 340px;
  padding: 24px;
}

.glitch-logo {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 0 20px var(--neon-cyan), 0 0 40px var(--neon-cyan);
  margin-bottom: 2px;
  position: relative;
}

.subtitle {
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--neon-pink);
  font-weight: 700;
  margin-bottom: 24px;
  text-shadow: 0 0 10px var(--neon-pink);
}

.instructions-panel {
  display: flex;
  gap: 12px;
  background: rgba(5, 8, 20, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 20px;
  text-align: left;
}

.instruction-group {
  flex: 1;
}

.instruction-group .ctrl-type {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--neon-cyan);
  letter-spacing: 1px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(0, 243, 255, 0.3);
  padding-bottom: 4px;
}

.instruction-group p {
  font-size: 12px;
  color: #c0cde5;
  margin-bottom: 6px;
  line-height: 1.3;
}

.instruction-group p span {
  display: block;
  font-weight: 700;
  color: #ffffff;
}

.high-score-display {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #9eb5d8;
  margin-bottom: 20px;
}

.high-score-display span {
  color: var(--neon-cyan);
  font-size: 16px;
}

/* Cyber Buttons */
.cyber-btn {
  display: block;
  width: 100%;
  padding: 15px 20px;
  font-family: var(--font-cyber);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 10px;
}

.primary-btn {
  background: linear-gradient(135deg, var(--neon-cyan), #0088ff);
  color: #050713;
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.4);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(0, 243, 255, 0.7);
}

.primary-btn:active {
  transform: translateY(1px);
}

.secondary-btn {
  background: rgba(18, 25, 52, 0.9);
  color: #fff;
  border: 1px solid var(--neon-pink);
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.25);
}

.secondary-btn:hover {
  background: rgba(255, 0, 127, 0.2);
  border-color: #fff;
}

.app-install-prompt {
  margin-top: 14px;
}

/* Game Over Card */
.gameover-title {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--neon-pink);
  text-shadow: 0 0 20px var(--neon-pink);
  margin-bottom: 4px;
}

.gameover-reason {
  font-size: 13px;
  color: #a0b2d0;
  margin-bottom: 22px;
}

.final-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.stat-cell {
  background: rgba(7, 10, 25, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px 10px;
}

.stat-cell.highlight {
  grid-column: span 2;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
}

.stat-label {
  display: block;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: #8c9eb9;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-val {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 900;
  color: #fff;
}

.stat-cell.highlight .stat-val {
  color: var(--neon-cyan);
  font-size: 28px;
}

/* ---------------- Mobile Touch Virtual Buttons ---------------- */
#mobile-controls {
  position: absolute;
  bottom: 20px;
  left: 0;
  width: 100%;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.touch-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  pointer-events: auto;
}

.touch-row.middle {
  gap: 16px;
}

.touch-btn {
  width: 66px;
  height: 60px;
  border-radius: 12px;
  background: rgba(13, 20, 45, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid rgba(0, 243, 255, 0.5);
  color: var(--neon-cyan);
  font-size: 16px;
  font-weight: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  touch-action: none;
}

.touch-btn small {
  font-size: 9px;
  letter-spacing: 1px;
  margin-top: 4px;
  color: #b3c5e8;
}

.touch-btn:active {
  background: var(--neon-cyan);
  color: #000;
  transform: scale(0.92);
}

.hidden {
  display: none !important;
}

/* Keyframe Animations */
@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(25px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pulse-border {
  from { box-shadow: 0 0 10px rgba(255, 183, 0, 0.3); }
  to { box-shadow: 0 0 25px rgba(255, 183, 0, 0.8); }
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .instructions-panel {
    flex-direction: column;
    gap: 8px;
  }
  .glitch-logo {
    font-size: 32px;
  }
  .stat-box {
    padding: 4px 10px;
  }
  .stat-box .value {
    font-size: 15px;
  }
  .hud-btn {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
}

@media (min-width: 768px) {
  /* On PC/Tablets, swipe or keyboard is primary; keep virtual buttons unobtrusive or hide */
  #mobile-controls {
    display: none;
  }
}
