/* ==========================================================================
   VELVET HATCH - Premium Mobile Arcade Game Stylesheet
   Theme: Velvet Indigo, Cyber Neon Violet, Radiant Gold, Glassmorphism
   Mobile-First Architecture (Max 480px)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

:root {
  /* Color Palette */
  --bg-deep: #090514;
  --bg-gradient: radial-gradient(circle at 50% 20%, #200e3b 0%, #0d061c 65%, #05020a 100%);
  --velvet-primary: #a855f7;
  --velvet-primary-glow: rgba(168, 85, 247, 0.45);
  --velvet-secondary: #c084fc;
  --velvet-accent: #06b6d4;
  --velvet-accent-glow: rgba(6, 182, 212, 0.45);
  --gold-accent: #fbbf24;
  --gold-glow: rgba(251, 191, 36, 0.5);
  --rose-accent: #f43f5e;
  --emerald-accent: #10b981;

  /* Glassmorphism Tokens */
  --glass-surface: rgba(22, 12, 42, 0.72);
  --glass-surface-card: rgba(28, 16, 56, 0.68);
  --glass-surface-active: rgba(45, 24, 90, 0.85);
  --glass-border: rgba(192, 132, 252, 0.22);
  --glass-border-highlight: rgba(255, 255, 255, 0.28);
  --glass-blur: blur(16px);
  --card-shadow: 0 12px 36px -8px rgba(0, 0, 0, 0.65), 0 0 20px -2px rgba(168, 85, 247, 0.15);
  --glow-shadow: 0 0 25px rgba(168, 85, 247, 0.4);

  /* Typography */
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Transitions */
  --transition-fast: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-bounce: 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   RESET & MOBILE-FIRST BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  background-color: var(--bg-deep);
  font-family: var(--font-body);
  color: #f8fafc;
  line-height: 1.4;
  touch-action: manipulation;
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
  background: url('bg.jpg') center/cover no-repeat fixed;
  position: relative;
}

/* Atmospheric subtle vignette that never blackouts the background art */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, rgba(13, 6, 28, 0.25) 0%, rgba(9, 5, 20, 0.7) 100%);
  pointer-events: none;
  z-index: 0;
}

/* ==========================================================================
   APP CONTAINER (Mobile-First 480px max)
   ========================================================================== */
.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.85);
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(14, 8, 30, 0.75);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.brand-logo-img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid var(--gold-accent);
  box-shadow: 0 0 12px var(--gold-glow);
  object-fit: cover;
}

.brand-text {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 10%, #fbbf24 60%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.brand-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: #fff;
  -webkit-text-fill-color: #fff;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.header-currencies {
  display: flex;
  align-items: center;
  gap: 8px;
}

.currency-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(30, 18, 60, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.currency-pill.gems {
  border-color: rgba(6, 182, 212, 0.4);
  color: #67e8f9;
}

.currency-pill.coins {
  border-color: rgba(251, 191, 36, 0.4);
  color: #fde047;
}

.currency-icon {
  font-size: 14px;
  filter: drop-shadow(0 0 4px currentColor);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(35, 20, 70, 0.7);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #e2e8f0;
  cursor: pointer;
  transition: var(--transition-fast);
  outline: none;
}

.icon-btn:active {
  transform: scale(0.92);
  background: var(--glass-surface-active);
  border-color: var(--velvet-primary);
}

/* ==========================================================================
   MAIN CONTENT & SCREENS CONTAINER
   ========================================================================== */
.screens-viewport {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 76px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.screen-view {
  display: none;
  flex-direction: column;
  padding: 16px;
  width: 100%;
  animation: fadeInScreen 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.screen-view.active {
  display: flex;
}

@keyframes fadeInScreen {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   GLASSMORPHIC CARDS & SECTIONS
   ========================================================================== */
.glass-panel {
  background: var(--glass-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
}

.glass-panel::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-border-highlight), transparent);
}

.section-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title span.badge {
  font-size: 11px;
  font-weight: 700;
  background: rgba(168, 85, 247, 0.2);
  color: var(--velvet-secondary);
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

/* ==========================================================================
   HOME SCREEN
   ========================================================================== */
.hero-card {
  text-align: center;
  padding: 24px 18px 20px;
  background: linear-gradient(180deg, rgba(46, 20, 88, 0.75) 0%, rgba(20, 10, 42, 0.85) 100%);
  border: 1px solid rgba(192, 132, 252, 0.35);
  border-radius: 24px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.18) 0%, transparent 60%);
  pointer-events: none;
}

.hero-egg-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 14px;
}

.hero-egg-img {
  width: 104px;
  height: 104px;
  border-radius: 28px;
  border: 2px solid var(--gold-accent);
  box-shadow: 0 0 30px var(--gold-glow);
  animation: eggFloat 3.5s ease-in-out infinite;
}

@keyframes eggFloat {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-8px) rotate(1.5deg);
  }
}

.hero-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #ffffff, #fef08a 50%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 13px;
  color: #cbd5e1;
  margin-bottom: 18px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.hero-play-btn {
  width: 100%;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, #a855f7 0%, #ec4899 50%, #f59e0b 100%);
  border: none;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(168, 85, 247, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.4);
  transition: var(--transition-fast);
}

.hero-play-btn:active {
  transform: scale(0.97);
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4);
}

/* Quick Stats Bar */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-box {
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 12px 8px;
  text-align: center;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.stat-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

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

/* Daily Reward Calendar (4 columns, strictly responsive, zero overflow) */
.daily-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.daily-card {
  background: rgba(32, 18, 62, 0.7);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 105px;
  position: relative;
  transition: var(--transition-fast);
}

.daily-card.claimed {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.5);
}

.daily-card.ready {
  background: rgba(251, 191, 36, 0.18);
  border-color: var(--gold-accent);
  box-shadow: 0 0 16px var(--gold-glow);
  animation: pulseCard 2s infinite ease-in-out;
  cursor: pointer;
}

@keyframes pulseCard {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

.daily-card.locked {
  opacity: 0.55;
  filter: grayscale(0.2);
}

.daily-day-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  color: #cbd5e1;
  text-transform: uppercase;
}

.daily-reward-icon {
  font-size: 24px;
  margin: 4px 0;
}

.daily-amount {
  font-size: 12px;
  font-weight: 800;
  color: #fde047;
}

.daily-status-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
  text-transform: uppercase;
}

.daily-card.claimed .daily-status-badge {
  background: #10b981;
  color: #fff;
}

.daily-card.ready .daily-status-badge {
  background: var(--gold-accent);
  color: #000;
  font-weight: 800;
}

.daily-card.locked .daily-status-badge {
  background: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

.daily-timer-notice {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #a78bfa;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ==========================================================================
   GAME SCREEN & PHYSICS BOARD
   ========================================================================== */
.game-header-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.hud-item {
  background: rgba(28, 14, 56, 0.85);
  border: 1px solid var(--glass-border);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hud-stars {
  display: flex;
  gap: 3px;
}

.hud-star {
  color: #475569;
  font-size: 14px;
}

.hud-star.active {
  color: #fbbf24;
  filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.8));
}

.maze-stage-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 440px;
  margin: 0 auto 12px;
  perspective: 900px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.maze-board-container {
  width: 100%;
  height: 100%;
  border-radius: 24px;
  background: radial-gradient(circle at center, #1b0e36 0%, #0c061a 100%);
  border: 2px solid var(--velvet-primary);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(168, 85, 247, 0.35);
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 0.08s ease-out;
  touch-action: none;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Tilt indicator & Controls Pad */
.game-controls-tray {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

.control-mode-tabs {
  display: flex;
  background: rgba(22, 12, 42, 0.85);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 3px;
  gap: 4px;
}

.mode-tab-btn {
  flex: 1;
  padding: 8px 4px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.mode-tab-btn.active {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: #fff;
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4);
}

/* Virtual Joystick Area */
.joystick-pad {
  height: 110px;
  border-radius: 20px;
  background: rgba(25, 14, 50, 0.7);
  border: 1px dashed rgba(168, 85, 247, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  touch-action: none;
  overflow: hidden;
}

.joystick-knob {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle, #c084fc 0%, #7e22ce 100%);
  border: 2px solid #fff;
  box-shadow: 0 0 20px rgba(192, 132, 252, 0.6);
  position: absolute;
  pointer-events: none;
  transition: transform 0.05s ease-out;
}

.joystick-hint {
  font-size: 12px;
  font-weight: 600;
  color: rgba(203, 213, 225, 0.6);
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   LEVELS SCREEN (30 Levels Grid with Tiers)
   ========================================================================== */
.tier-header {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: #cbd5e1;
  margin: 14px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tier-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

.levels-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.level-tile {
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  background: rgba(30, 16, 58, 0.75);
  border: 1.5px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition-fast);
  padding: 4px;
}

.level-tile:active {
  transform: scale(0.92);
}

.level-tile.unlocked {
  background: linear-gradient(145deg, rgba(45, 24, 88, 0.8), rgba(24, 12, 48, 0.9));
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.level-tile.current {
  border-color: var(--gold-accent);
  box-shadow: 0 0 18px var(--gold-glow);
  animation: pulseCard 2s infinite ease-in-out;
}

.level-tile.locked {
  opacity: 0.45;
  filter: grayscale(0.5);
  cursor: not-allowed;
}

.level-num {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.level-stars-mini {
  display: flex;
  gap: 1px;
  margin-top: 4px;
  font-size: 9px;
  color: #64748b;
}

.level-stars-mini .star.lit {
  color: #fbbf24;
  filter: drop-shadow(0 0 3px rgba(251, 191, 36, 0.8));
}

/* ==========================================================================
   SKIN SHOP SCREEN
   ========================================================================== */
.shop-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.shop-tab {
  flex: 1;
  padding: 10px;
  background: rgba(28, 14, 56, 0.75);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
  cursor: pointer;
  text-align: center;
  transition: var(--transition-fast);
}

.shop-tab.active {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.35);
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.shop-card {
  background: var(--glass-surface-card);
  border: 1.5px solid var(--glass-border);
  border-radius: 20px;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transition: var(--transition-fast);
}

.shop-card.equipped {
  border-color: var(--emerald-accent);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
}

.skin-preview-sphere {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  margin: 8px 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  position: relative;
  font-size: 28px;
}

.skin-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 2px;
}

.skin-perk {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 12px;
}

.skin-action-btn {
  width: 100%;
  padding: 9px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.skin-action-btn.buy {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #000;
}

.skin-action-btn.equip {
  background: rgba(168, 85, 247, 0.3);
  border: 1px solid var(--velvet-primary);
  color: #fff;
}

.skin-action-btn.equipped {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--emerald-accent);
  color: #34d399;
  cursor: default;
}

.skin-action-btn:active:not(.equipped) {
  transform: scale(0.95);
}

/* ==========================================================================
   ACHIEVEMENTS SCREEN
   ========================================================================== */
.achieve-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.achieve-card {
  background: var(--glass-surface-card);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.achieve-icon-box {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(45, 24, 88, 0.7);
  border: 1px solid rgba(192, 132, 252, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.achieve-content {
  flex: 1;
  min-width: 0;
}

.achieve-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 2px;
}

.achieve-desc {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 6px;
  line-height: 1.25;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #a855f7, #06b6d4);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.achieve-action-box {
  flex-shrink: 0;
}

.claim-reward-btn {
  padding: 8px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border: none;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.35);
  animation: pulseCard 1.8s infinite;
}

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

.claimed-badge {
  font-size: 12px;
  font-weight: 700;
  color: #34d399;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   FIXED BOTTOM NAVIGATION BAR
   ========================================================================== */
.bottom-nav-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(env(safe-area-inset-bottom, 0px) + 68px);
  padding: 6px 12px calc(env(safe-area-inset-bottom, 0px) + 8px);
  background: rgba(14, 8, 30, 0.88);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 60;
}

.nav-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  flex: 1;
  height: 100%;
  transition: var(--transition-fast);
  outline: none;
}

.nav-tab-item .nav-icon {
  font-size: 20px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-tab-item .nav-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.nav-tab-item.active {
  color: #c084fc;
}

.nav-tab-item.active .nav-icon {
  transform: translateY(-2px) scale(1.15);
  filter: drop-shadow(0 0 8px rgba(192, 132, 252, 0.7));
}

.nav-tab-item:active {
  transform: scale(0.92);
}

/* Floating Play Center Button */
.nav-tab-item.hero-play-tab .nav-icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  box-shadow: 0 4px 18px rgba(168, 85, 247, 0.6), inset 0 1px 2px rgba(255, 255, 255, 0.5);
  margin-top: -16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: var(--transition-bounce);
}

.nav-tab-item.hero-play-tab:active .nav-icon-circle {
  transform: scale(0.9);
}

/* ==========================================================================
   MODALS & BOTTOM SHEETS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 2, 10, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.bottom-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  max-height: 88dvh;
  background: linear-gradient(180deg, #1b0e36 0%, #0d061c 100%);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  border: 1px solid var(--glass-border);
  border-bottom: none;
  box-shadow: 0 -15px 40px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-overlay.active .bottom-sheet {
  transform: translateY(0);
}

.sheet-drag-handle {
  width: 42px;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  margin: 10px auto 4px;
}

.sheet-header {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--glass-border);
}

.sheet-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  color: #fff;
}

.sheet-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #cbd5e1;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sheet-body {
  padding: 18px 20px calc(env(safe-area-inset-bottom, 0px) + 24px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Settings List */
.settings-group {
  margin-bottom: 20px;
}

.settings-group-label {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  padding-left: 4px;
}

.settings-item {
  background: rgba(28, 14, 56, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.settings-item:active {
  background: rgba(45, 24, 90, 0.7);
}

.settings-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-item-icon {
  font-size: 20px;
}

.settings-item-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
}

.settings-item-subtitle {
  font-size: 11px;
  color: #94a3b8;
}

/* Toggle Switch */
.switch-input {
  display: none;
}

.switch-track {
  width: 46px;
  height: 26px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 13px;
  position: relative;
  cursor: pointer;
  transition: background 0.25s ease;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.switch-input:checked + .switch-track {
  background: linear-gradient(135deg, #a855f7, #6366f1);
}

.switch-input:checked + .switch-track::after {
  transform: translateX(20px);
}

/* Legal text modal */
.legal-scroll-box {
  background: rgba(12, 6, 24, 0.8);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px;
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.6;
  max-height: 50vh;
  overflow-y: auto;
}

.legal-scroll-box h3 {
  font-family: var(--font-display);
  font-size: 14px;
  color: #fff;
  margin: 12px 0 6px;
}

.legal-scroll-box p {
  margin-bottom: 8px;
}

/* Win / Defeat Overlay */
.game-result-card {
  text-align: center;
  padding: 24px 18px;
}

.result-stars-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 16px 0;
  font-size: 38px;
}

.result-star {
  color: #334155;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-star.earned {
  color: #fbbf24;
  filter: drop-shadow(0 0 12px rgba(251, 191, 36, 0.8));
  transform: scale(1.15);
}

.result-stats-table {
  background: rgba(28, 14, 56, 0.7);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 20px;
}

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

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

.result-actions-row {
  display: flex;
  gap: 10px;
}

.btn-secondary {
  flex: 1;
  height: 48px;
  border-radius: 14px;
  background: rgba(45, 24, 88, 0.6);
  border: 1px solid var(--glass-border);
  color: #fff;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  flex: 1;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #a855f7, #6366f1);
  border: none;
  color: #fff;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
}

.btn-primary:active, .btn-secondary:active {
  transform: scale(0.97);
}

/* ==========================================================================
   WELCOME ONBOARDING MODAL
   ========================================================================== */
.welcome-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 3, 14, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.welcome-card {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, #231247 0%, #100724 100%);
  border: 1.5px solid rgba(192, 132, 252, 0.4);
  border-radius: 28px;
  padding: 28px 22px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 35px rgba(168, 85, 247, 0.3);
  position: relative;
  overflow: hidden;
}

.welcome-features {
  text-align: left;
  margin: 18px 0 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.welcome-feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(35, 18, 70, 0.5);
  border: 1px solid var(--glass-border);
  padding: 10px 14px;
  border-radius: 14px;
}

.welcome-feature-icon {
  font-size: 22px;
}

.welcome-feature-text strong {
  display: block;
  font-family: var(--font-display);
  font-size: 13px;
  color: #fff;
}

.welcome-feature-text span {
  font-size: 11px;
  color: #94a3b8;
}

/* Rating Stars inside Rating Dialog */
.rating-stars {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 16px 0;
  font-size: 32px;
  cursor: pointer;
}

.rate-star {
  color: #475569;
  transition: transform 0.2s ease, color 0.2s ease;
}

.rate-star.hovered, .rate-star.selected {
  color: #fbbf24;
  transform: scale(1.2);
  filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.8));
}
