/**
 * GAMOZY RUSH - Styling & Responsive Cyber-Arcade UI
 */

* {
  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: #050814;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #f0f4f8;
  touch-action: none;
}

#game-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

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

/* ==========================================================================
   HUD Overlay
   ========================================================================== */
#game-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
}

.hud-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}

.hud-stats-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #00d5f5;
  text-shadow: 0 0 8px rgba(0, 213, 245, 0.6);
  text-transform: uppercase;
}

.hud-stat-box {
  background: rgba(10, 16, 35, 0.75);
  border: 1px solid rgba(0, 213, 245, 0.3);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 6px 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  color: #7b93b2;
  letter-spacing: 1px;
}

.stat-value {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 6px rgba(0, 213, 245, 0.4);
}

.stat-value.gold {
  color: #ffd700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.hud-actions-group {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.hud-icon-btn {
  background: rgba(10, 16, 35, 0.75);
  border: 1px solid rgba(0, 213, 245, 0.4);
  color: #ffffff;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.hud-icon-btn:hover {
  background: rgba(0, 213, 245, 0.2);
  border-color: #00d5f5;
  transform: scale(1.05);
}

.hud-icon-btn:active {
  transform: scale(0.95);
}

/* Power-Up Status Pill Badges */
#hud-powerups {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
}

.hud-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  animation: pulseBadge 1.2s infinite ease-in-out;
}

.hud-badge.shield {
  background: rgba(0, 229, 255, 0.25);
  border: 1px solid #00e5ff;
  color: #00e5ff;
}

.hud-badge.magnet {
  background: rgba(255, 51, 102, 0.25);
  border: 1px solid #ff3366;
  color: #ff3366;
}

.hud-badge.boost {
  background: rgba(255, 234, 0, 0.25);
  border: 1px solid #ffea00;
  color: #ffea00;
}

@keyframes pulseBadge {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* ==========================================================================
   Modals & Overlays
   ========================================================================== */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 8, 20, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 20px;
  transition: opacity 0.2s ease;
}

.modal-content,
.modal-card {
  background: linear-gradient(145deg, rgba(16, 24, 48, 0.95), rgba(8, 12, 24, 0.98));
  border: 1px solid rgba(0, 213, 245, 0.4);
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(0, 213, 245, 0.2);
}

.start-card {
  max-width: 440px;
}

.help-card {
  max-width: 440px;
}

.brand-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #00d5f5;
  text-transform: uppercase;
  margin-bottom: 6px;
  text-shadow: 0 0 12px rgba(0, 213, 245, 0.7);
}

.modal-title {
  font-size: 32px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 4px;
  text-shadow: 0 0 16px rgba(0, 213, 245, 0.6);
}

.modal-subtitle {
  font-size: 13px;
  color: #00d5f5;
  letter-spacing: 1.5px;
  font-weight: 600;
  margin-bottom: 20px;
  text-transform: uppercase;
}

/* Hero Selection Grid */
.hero-select-section {
  margin-bottom: 20px;
}

.hero-section-heading {
  font-size: 12px;
  font-weight: 700;
  color: #8c9bb0;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
  text-align: left;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.hero-select-card {
  background: rgba(11, 16, 32, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  text-align: center;
}

.hero-select-card:hover {
  border-color: rgba(0, 213, 245, 0.5);
  background: rgba(14, 22, 44, 0.9);
}

.hero-select-card.selected {
  border-color: #00d5f5;
  background: rgba(0, 213, 245, 0.12);
  box-shadow: 0 0 15px rgba(0, 213, 245, 0.35);
}

.hero-avatar-preview {
  width: 48px;
  height: 48px;
  margin: 0 auto 8px auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 2px solid #00d5f5;
}

.hero-select-card[data-hero-id="GAMOZY_MALE_01"] .hero-avatar-preview {
  background: #121418;
  border-color: #00d5f5;
}

.hero-select-card[data-hero-id="GAMOZY_FEMALE_01"] .hero-avatar-preview {
  background: #181a20;
  border-color: #ff2d95;
  filter: grayscale(0.5);
}

.hero-card-name {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.hero-card-status {
  font-size: 10px;
  font-weight: 600;
  color: #00d5f5;
  letter-spacing: 0.5px;
}

.hero-select-card[data-hero-id="GAMOZY_FEMALE_01"] .hero-card-status {
  color: #e070a0;
}

.hero-select-card.coming-soon {
  opacity: 0.72;
}

.hero-select-card.coming-soon:hover {
  border-color: rgba(255, 45, 149, 0.4);
}

/* Controls Info & Rows */
.controls-guide {
  background: rgba(5, 8, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 20px;
  font-size: 11px;
  color: #a0aec0;
  line-height: 1.5;
}

.control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.control-row:last-child {
  border-bottom: none;
}

.control-key {
  font-weight: 800;
  color: #00d5f5;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.control-desc {
  color: #cad5e2;
  font-size: 12px;
}

.controls-guide strong {
  color: #00d5f5;
}

/* Primary CTA Button */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(90deg, #00d5f5 0%, #098df3 100%);
  border: none;
  border-radius: 10px;
  color: #050814;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 18px rgba(0, 213, 245, 0.4);
}

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

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

.btn-play {
  font-size: 18px;
  padding: 16px;
  letter-spacing: 2px;
  box-shadow: 0 6px 22px rgba(0, 213, 245, 0.5);
}

.btn-text {
  background: transparent;
  border: none;
  color: #7b93b2;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px;
  margin-top: 8px;
  cursor: pointer;
  transition: color 0.15s ease;
  width: 100%;
}

.btn-text:hover {
  color: #00d5f5;
  text-decoration: underline;
}

.btn-secondary {
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #f0f4f8;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* In-Game First Run Tutorial Banner */
.hud-tutorial {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 16, 35, 0.9);
  border: 1px solid rgba(0, 213, 245, 0.7);
  border-radius: 12px;
  padding: 10px 24px;
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 0 25px rgba(0, 213, 245, 0.45);
  animation: tutorialBounce 1.6s infinite ease-in-out;
  pointer-events: none;
  z-index: 15;
  white-space: nowrap;
}

@keyframes tutorialBounce {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -6px); }
}

.tutorial-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #ffd700;
  text-transform: uppercase;
  margin-bottom: 4px;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.6);
}

.tutorial-text {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(0, 213, 245, 0.8);
}

/* Countdown Overlay */
#countdown-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  pointer-events: none;
  z-index: 25;
}

#countdown-text {
  font-size: 96px;
  font-weight: 900;
  color: #00d5f5;
  text-shadow: 0 0 30px rgba(0, 213, 245, 0.9), 0 0 60px rgba(9, 141, 243, 0.7);
  animation: countPulse 0.55s ease-out forwards;
}

@keyframes countPulse {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1.0); opacity: 1; }
}

/* Game Over Stats Readout */
.go-stats-panel {
  background: rgba(8, 12, 24, 0.8);
  border: 1px solid rgba(0, 213, 245, 0.2);
  border-radius: 10px;
  padding: 14px;
  margin: 16px 0;
}

.go-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.go-stat-row:last-child {
  border-bottom: none;
}

.go-stat-row .label {
  color: #8c9bb0;
}

.go-stat-row .val {
  font-weight: 800;
  color: #ffffff;
}

.go-new-record-pill {
  background: linear-gradient(90deg, #ffea00, #ff8c00);
  color: #050814;
  font-size: 12px;
  font-weight: 900;
  padding: 4px 12px;
  border-radius: 12px;
  display: inline-block;
  margin-bottom: 12px;
  letter-spacing: 1px;
  animation: pulseBadge 1s infinite;
}

/* Dev Debug */
#debug-overlay {
  position: absolute;
  top: 70px;
  left: 16px;
  z-index: 50;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Mobile Responsive Adjustments
   ========================================================================== */
@media (max-width: 480px) {
  #game-hud {
    padding: 10px;
  }
  
  .stat-value {
    font-size: 15px;
  }
  
  .stat-label {
    font-size: 9px;
  }

  .hud-stat-box {
    padding: 4px 8px;
  }

  .modal-content {
    padding: 20px 16px;
  }

  .modal-title {
    font-size: 26px;
  }

  #countdown-text {
    font-size: 72px;
  }
}
