/* ==========================================================================
   Cyber Bounce: Neon Pinball Rogue - Mobile-First Cyberpunk Stylesheet
   ========================================================================== */

:root {
  --bg-void: #060813;
  --bg-surface: rgba(13, 17, 38, 0.85);
  --bg-card: rgba(20, 27, 58, 0.9);
  --border-neon: rgba(0, 243, 255, 0.35);
  --border-glow: 0 0 15px rgba(0, 243, 255, 0.3);
  
  --cyan-core: #00f3ff;
  --amber-target: #ff9900;
  --magenta-mult: #e024c3;
  --emerald-power: #00ff88;
  --crimson-hazard: #ff2a55;
  --gold-jackpot: #ffd700;
  
  --font-display: 'Orbitron', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-ui: 'Rajdhani', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-void);
  font-family: var(--font-ui);
  color: #fff;
  touch-action: none; /* Prevents mobile pull-to-refresh & pinch zoom */
}

/* App Viewport Container */
#game-app {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at 50% 30%, #101633 0%, #060813 100%);
}

/* Responsive Arcade Cabinet Wrapper */
#canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: 100%;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.9), 0 0 30px rgba(0, 243, 255, 0.15);
  border-left: 1px solid rgba(0, 243, 255, 0.15);
  border-right: 1px solid rgba(0, 243, 255, 0.15);
  overflow: hidden;
}

@media (min-width: 900px) {
  #canvas-wrapper {
    height: 96vh;
    border-radius: 18px;
    border: 1px solid rgba(0, 243, 255, 0.3);
  }
}

/* High-DPI Canvas */
#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

/* ==========================================================================
   Micro HUD (Top Floating Bar)
   ========================================================================== */
#hud-top {
  position: absolute;
  top: env(safe-area-inset-top, 10px);
  left: 12px;
  right: 12px;
  height: 52px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

.hud-pill {
  pointer-events: auto;
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-neon);
  border-radius: 26px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--border-glow);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
}

.hud-btn {
  background: rgba(0, 243, 255, 0.1);
  border: 1px solid var(--border-neon);
  color: var(--cyan-core);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  pointer-events: auto;
  font-size: 16px;
  transition: all 0.2s ease;
}

.hud-btn:hover, .hud-btn:active {
  background: var(--cyan-core);
  color: #000;
  box-shadow: 0 0 15px var(--cyan-core);
  transform: scale(1.08);
}

/* Active Relic Mini-Shelf */
#relic-hud-shelf {
  position: absolute;
  top: calc(env(safe-area-inset-top, 10px) + 58px);
  left: 14px;
  display: flex;
  gap: 6px;
  pointer-events: auto;
  z-index: 10;
}

.relic-shelf-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-neon);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 15px;
  box-shadow: var(--border-glow);
  animation: badgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes badgePop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Target Indicators */
#target-tracker {
  display: flex;
  align-items: center;
  gap: 5px;
}

.target-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber-target);
  box-shadow: 0 0 8px var(--amber-target);
  transition: all 0.3s ease;
}

.target-dot.cleared {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: none;
}

/* Score & Multiplier */
#score-display {
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 243, 255, 0.7);
}

#multiplier-badge {
  color: var(--magenta-mult);
  font-size: 11px;
  padding: 2px 6px;
  background: rgba(224, 36, 195, 0.15);
  border-radius: 10px;
  border: 1px solid rgba(224, 36, 195, 0.4);
}

/* ==========================================================================
   Bottom Controls & Ball Tube (Thumb Zone)
   ========================================================================== */
#hud-bottom {
  position: absolute;
  bottom: env(safe-area-inset-bottom, 12px);
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 10;
}

/* Ball Reserve Tube */
#ball-tube {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-surface);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-neon);
  border-radius: 16px;
  padding: 8px 10px;
  box-shadow: var(--border-glow);
  gap: 4px;
}

.ball-indicator-count {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--cyan-core);
  text-shadow: 0 0 8px var(--cyan-core);
}

.ball-pip-row {
  display: flex;
  gap: 4px;
}

.ball-pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan-core);
  box-shadow: 0 0 6px var(--cyan-core);
}

/* Speed 2X Toggle */
#speed-toggle-btn {
  pointer-events: auto;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 20px;
  background: var(--bg-surface);
  color: var(--emerald-power);
  border: 1px solid var(--emerald-power);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.25);
  cursor: pointer;
  transition: all 0.2s ease;
}

#speed-toggle-btn.active {
  background: var(--emerald-power);
  color: #000;
  box-shadow: 0 0 18px var(--emerald-power);
}

/* Launch Button (For Non-Slingshot Mode) */
#launch-btn {
  pointer-events: auto;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 12px 28px;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--cyan-core) 0%, #0088ff 100%);
  color: #000;
  border: none;
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.6);
  cursor: pointer;
  transition: all 0.15s ease;
}

#launch-btn:hover, #launch-btn:active {
  transform: scale(1.05);
  box-shadow: 0 0 30px var(--cyan-core);
}

#launch-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ==========================================================================
   Modals & Overlay Menus (Glassmorphic Cards)
   ========================================================================== */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(6, 8, 19, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-content {
  width: 90%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-neon);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 0 40px rgba(0, 243, 255, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  color: var(--cyan-core);
  text-shadow: 0 0 15px var(--cyan-core);
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.modal-subtitle {
  font-size: 14px;
  color: #a0aec0;
  margin-bottom: 20px;
}

/* Relic Cards Grid */
.relic-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-bottom: 16px;
}

.relic-card {
  background: rgba(13, 17, 38, 0.95);
  border: 1px solid rgba(0, 243, 255, 0.25);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.relic-card:hover, .relic-card:active {
  border-color: var(--cyan-core);
  background: rgba(0, 243, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.3);
}

.relic-icon {
  font-size: 32px;
  width: 48px;
  height: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.relic-info {
  flex: 1;
}

.relic-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 3px;
}

.relic-desc {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.3;
}

.relic-rarity {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.rarity-common { color: var(--cyan-core); }
.rarity-rare { color: var(--magenta-mult); }
.rarity-legendary { color: var(--gold-jackpot); }

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 14px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--cyan-core) 0%, #0088ff 100%);
  color: #000;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  border: none;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.5);
  margin-top: 10px;
  transition: all 0.2s ease;
}

.btn-primary:hover, .btn-primary:active {
  transform: scale(1.03);
  box-shadow: 0 0 30px var(--cyan-core);
}

.btn-secondary {
  width: 100%;
  padding: 12px;
  border-radius: 24px;
  background: transparent;
  color: #fff;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.2s ease;
}

.btn-secondary:hover, .btn-secondary:active {
  background: rgba(255, 255, 255, 0.1);
  border-color: #fff;
}

/* Emergency Overcharge Modal Specifics */
.overcharge-countdown {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 900;
  color: var(--amber-target);
  text-shadow: 0 0 25px var(--amber-target);
  margin: 12px 0;
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.1); }
}

/* Extreme Fever HUD Banner */
#fever-banner {
  position: absolute;
  top: 25%;
  left: 0;
  width: 100%;
  text-align: center;
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--gold-jackpot);
  text-shadow: 0 0 30px var(--gold-jackpot), 0 0 60px #ff9900;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 50;
}

#fever-banner.active {
  opacity: 1;
  transform: scale(1);
}
