/* ==========================================================================
   Bubble Shooter Deluxe - Premium Fantasy Arcade Design System
   Visual Identity: Magical / Tactile / Crystalline / Polished / Dimensional
   ========================================================================== */

:root {
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Color Palette */
  --bg-primary: #090d16;
  --bg-surface: rgba(15, 23, 42, 0.75);
  --bg-surface-elevated: rgba(30, 41, 59, 0.85);

  --accent-gold: #fef08a;
  --accent-gold-dark: #ca8a04;
  --accent-ruby: #f43f5e;
  --accent-sapphire: #38bdf8;
  --accent-emerald: #4ade80;
  --accent-amethyst: #a855f7;

  --border-gold: rgba(254, 240, 138, 0.35);
  --border-glass: rgba(255, 255, 255, 0.12);

  --shadow-card: 0 12px 32px -4px rgba(0, 0, 0, 0.65);
  --shadow-glow: 0 0 24px rgba(234, 179, 8, 0.25);
}

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

body {
  background-color: var(--bg-primary);
  color: #f8fafc;
  font-family: var(--font-body);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
}

#game-app {
  position: relative;
  width: 100%;
  max-width: 440px;
  height: 100vh;
  max-height: 860px;
  background: #000000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
}

/* ==========================================================================
   Top HUD Bar (Clean Hierarchy)
   ========================================================================== */

#game-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 20;
  background: linear-gradient(180deg, rgba(9, 13, 22, 0.92) 0%, rgba(9, 13, 22, 0.5) 75%, transparent 100%);
  pointer-events: none;
}

#game-hud > * {
  pointer-events: auto;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(12px);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
  min-height: 40px;
}

.hud-pill.highlight {
  border-color: var(--border-gold);
  background: rgba(30, 41, 59, 0.85);
}

.hud-score-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.5px;
}

.btn-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(12px);
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-gold);
  transform: scale(1.05);
}

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

.btn-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* ==========================================================================
   Interactive Game Canvas
   ========================================================================== */

#canvas-container {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  touch-action: none;
  cursor: crosshair;
}

/* ==========================================================================
   Bottom Booster Control Deck
   ========================================================================== */

#booster-deck {
  position: absolute;
  bottom: 12px;
  left: 0;
  width: 100%;
  padding: 0 16px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 20;
  pointer-events: none;
}

#booster-deck > * {
  pointer-events: auto;
}

.booster-btn {
  position: relative;
  width: 54px;
  height: 54px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid var(--border-glass);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.booster-btn:hover:not(:disabled) {
  transform: translateY(-4px) scale(1.08);
  border-color: var(--accent-gold);
  box-shadow: 0 8px 20px rgba(234, 179, 8, 0.35);
}

.booster-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.96);
}

.booster-btn.active {
  border-color: var(--accent-gold);
  background: rgba(234, 179, 8, 0.25);
  box-shadow: 0 0 16px rgba(234, 179, 8, 0.6);
  animation: boosterPulse 1.5s infinite alternate;
}

@keyframes boosterPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); }
}

.booster-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.8);
}

.booster-btn svg {
  width: 26px;
  height: 26px;
}

.booster-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
  color: #0f172a;
  font-size: 11px;
  font-weight: 800;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #0f172a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Modals & Glassmorphic Overlays
   ========================================================================== */

.modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(14px);
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(160deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 1.5px solid var(--border-gold);
  border-radius: 24px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  position: relative;
}

.modal-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent-gold);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.modal-subtitle {
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.btn-primary {
  width: 100%;
  min-height: 50px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fef08a 0%, #eab308 50%, #ca8a04 100%);
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 18px rgba(234, 179, 8, 0.35);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(234, 179, 8, 0.5);
}

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

.btn-secondary {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-glass);
  color: #f8fafc;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(51, 65, 85, 0.85);
  border-color: var(--border-gold);
}

/* ==========================================================================
   Stages Grid View
   ========================================================================== */

.stages-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
}

.stage-card {
  height: 84px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stage-card.unlocked {
  border-color: var(--border-gold);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
}

.stage-card.unlocked:hover {
  transform: scale(1.06);
  border-color: var(--accent-gold);
  box-shadow: 0 4px 14px rgba(234, 179, 8, 0.3);
}

.stage-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.stage-card.boss-stage {
  border-color: var(--accent-ruby);
}

.stage-num {
  font-size: 20px;
  font-weight: 800;
  color: #f8fafc;
}

.stage-label {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stars-earned {
  color: var(--accent-gold);
  font-size: 10px;
  letter-spacing: 1px;
}

/* ==========================================================================
   Lucky Wheel Container
   ========================================================================== */

#wheel-wrapper {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 0 auto 20px auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

#wheel-canvas {
  width: 100%;
  height: 100%;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 480px) {
  #game-app {
    max-height: 100vh;
    border-radius: 0;
  }

  .hud-pill {
    padding: 4px 8px;
    font-size: 12px;
    min-height: 36px;
  }

  .booster-btn {
    width: 48px;
    height: 48px;
  }
}
