/* ==========================================================================
   PEARL QUEST - PHILIPPINE ROYAL BURGUNDY & GOLD FIESTA STYLING
   Inspired by the Pearl of the Orient Seas & Vibrant Philippine Fiesta Luxury
   ========================================================================== */

/* Design Tokens & Aesthetic Palette */
:root {
  /* Philippine Royal Red & Gold Palette */
  --royal-burgundy-dark: #260308;
  --royal-burgundy: #4a0610;
  --royal-crimson: #7c0d1c;
  --royal-ruby: #9f1226;
  --royal-gold-light: #fff3a8;
  --royal-gold: #ffd23f;
  --royal-amber: #f59e0b;
  --royal-bronze: #b45309;
  --tropical-cyan: #00f0ff;
  --emerald-accent: #10b981;

  /* Glassmorphic High-Contrast Burgundy Tokens */
  --glass-bg: rgba(22, 2, 6, 0.94);
  --glass-bg-hover: rgba(42, 4, 10, 0.96);
  --glass-card: rgba(26, 3, 7, 0.92);
  --glass-border: rgba(255, 215, 0, 0.45);
  --glass-border-glow: rgba(255, 215, 0, 0.7);
  --glass-highlight: rgba(255, 240, 180, 0.25);
  --glass-shadow: 0 12px 36px 0 rgba(0, 0, 0, 0.85);
  --glass-shadow-sm: 0 4px 18px 0 rgba(0, 0, 0, 0.65);

  /* Gradients */
  --grad-gold: linear-gradient(135deg, #fffbeb 0%, #ffd23f 50%, #d97706 100%);
  --grad-primary: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
  --grad-ruby: linear-gradient(135deg, #9f1226 0%, #dc2626 50%, #ffd23f 100%);
  --grad-fiesta: linear-gradient(135deg, #ffd23f 0%, #e11d48 50%, #7c0d1c 100%);
  --grad-card-bg: linear-gradient(145deg, rgba(38, 4, 10, 0.93) 0%, rgba(18, 2, 5, 0.95) 100%);

  /* High-Contrast Typography */
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-white: #ffffff;
  --text-gold: #ffd23f;
  --text-subtle: #fef08a; /* High-contrast bright warm gold */
  --text-muted: #fde047;

  /* Transitions */
  --trans-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --trans-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Box Sizing */
*, *::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%;
  height: 100%;
  overflow: hidden;
  background-color: var(--royal-burgundy-dark);
  font-family: var(--font-main);
  color: var(--text-white);
  line-height: 1.4;
}

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

/* Ambient Festive Atmospheric Glow */
.ambient-glow { display: none; }
.glow-top {
  top: -120px;
  right: -60px;
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, var(--royal-gold), transparent 70%);
}
.glow-bottom {
  bottom: -120px;
  left: -60px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, var(--royal-crimson), transparent 70%);
}

/* Mobile-First Root Container (max-width: 480px, horizontally centered) */
#app-container {
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: 960px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.95);
  background: linear-gradient(180deg, rgba(20, 2, 5, 0.72) 0%, rgba(26, 3, 7, 0.65) 50%, rgba(18, 1, 4, 0.78) 100%), url('bg.jpg') center/cover no-repeat;
}

@media (min-width: 481px) {
  #app-container {
    height: 94vh;
    border-radius: 28px;
    border: 1.5px solid var(--glass-border);
  }
}

/* Screen Transitions & Universal High-Contrast Page Background */
.app-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.32s var(--trans-smooth), transform 0.32s var(--trans-smooth);
  z-index: 10;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  background: linear-gradient(180deg, rgba(14, 1, 3, 0.88) 0%, rgba(20, 2, 5, 0.82) 40%, rgba(14, 1, 3, 0.92) 100%), url('bg.jpg') center/cover no-repeat;
}

#welcome-screen,
#home-screen,
#levels-screen,
#shop-screen,
#achievements-screen,
#game-screen {
  background: linear-gradient(180deg, rgba(14, 1, 3, 0.88) 0%, rgba(20, 2, 5, 0.82) 40%, rgba(14, 1, 3, 0.92) 100%), url('bg.jpg') center/cover no-repeat;
}

.app-screen.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(0.98);
  z-index: 1;
}

/* Minimalist Scrollbars */
.app-screen::-webkit-scrollbar,
.levels-container::-webkit-scrollbar,
.achievements-container::-webkit-scrollbar,
.shop-content::-webkit-scrollbar {
  width: 5px;
}
.app-screen::-webkit-scrollbar-thumb,
.levels-container::-webkit-scrollbar-thumb,
.achievements-container::-webkit-scrollbar-thumb,
.shop-content::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 0, 0.25);
  border-radius: 10px;
}

/* Glassmorphic Base Classes */
.glass-panel {
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow-sm);
}

.glass-card {
  background: var(--grad-card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--glass-shadow);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.5), transparent);
}

/* 3D Gold Gradient Text */
.gradient-text {
  background: var(--grad-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  font-weight: 800;
  text-shadow: 0 2px 10px rgba(255, 215, 0, 0.25);
}
.text-amber {
  color: var(--royal-gold);
}
.font-bold {
  font-weight: 700;
}

/* Buttons */
.btn {
  border: none;
  outline: none;
  cursor: pointer;
  font-family: var(--font-main);
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 14px;
  transition: transform 0.18s var(--trans-spring), box-shadow 0.18s ease, filter 0.18s ease;
  color: #2b0408;
  padding: 12px 20px;
  font-size: 0.95rem;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--grad-primary);
  color: #2b0408;
  box-shadow: 0 4px 20px rgba(255, 174, 0, 0.5);
  border: 1px solid rgba(255, 240, 160, 0.6);
}

.btn-large {
  padding: 16px 28px;
  font-size: 1.1rem;
  border-radius: 16px;
  width: 100%;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid var(--glass-border);
}
.btn-secondary:hover {
  background: rgba(255, 215, 0, 0.18);
  border-color: rgba(255, 215, 0, 0.4);
}

.btn-danger-ghost {
  background: rgba(220, 38, 38, 0.2);
  border: 1px solid rgba(220, 38, 38, 0.5);
  color: #fca5a5;
}

.glow-btn {
  position: relative;
  overflow: hidden;
}
.glow-btn::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.glow-btn:hover::after {
  opacity: 1;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: var(--royal-gold);
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.btn-icon:active {
  transform: scale(0.92);
}

.btn-pill-small {
  background: rgba(48, 5, 12, 0.85);
  border: 1px solid var(--glass-border);
  color: var(--royal-gold);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-pill-small:hover, .btn-pill-small:active {
  background: rgba(255, 215, 0, 0.25);
  border-color: var(--royal-gold);
}

.btn-pill-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: var(--text-subtle);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-pill-toggle.active {
  background: rgba(255, 215, 0, 0.22);
  border-color: var(--royal-gold);
  color: #ffffff;
}

/* ==========================================================================
   1. WELCOME SCREEN
   ========================================================================== */
#welcome-screen {
  align-items: center;
  justify-content: flex-start;
  padding: 12px 12px 28px 12px;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.welcome-card {
  width: 100%;
  max-width: 400px;
  margin: auto 0;
  padding: 16px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-color: rgba(255, 215, 0, 0.4);
  touch-action: pan-y;
  flex-shrink: 0;
}

.logo-wrapper {
  width: 76px;
  height: 76px;
  margin-bottom: 8px;
  position: relative;
}

.brand-logo {
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
  box-shadow: 0 6px 20px rgba(255, 174, 0, 0.45);
}

.pulse-glow {
  animation: pulseGlow 3.5s ease-in-out infinite alternate;
}

@keyframes pulseGlow { 0% { transform: scale(1); } 100% { transform: scale(1.03); } }
  100% { transform: scale(1.04); box-shadow: 0 10px 30px rgba(220, 38, 38, 0.55); }
}

.game-title {
  font-size: 1.55rem;
  letter-spacing: 1.5px;
  margin-bottom: 2px;
}

.game-tagline {
  color: var(--royal-gold);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.feature-pills {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  margin-bottom: 14px;
  text-align: left;
}

.feature-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 215, 0, 0.18);
  border-radius: 10px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.feature-icon {
  font-size: 1.25rem;
  min-width: 24px;
}

.feature-item strong {
  font-size: 0.84rem;
  display: block;
  color: var(--royal-gold-light);
}

.feature-item p {
  font-size: 0.72rem;
  color: var(--text-subtle);
  margin-top: 1px;
  line-height: 1.25;
}

@media (max-height: 600px) {
  #welcome-screen {
    padding: 8px 8px 20px 8px;
  }
  .welcome-card {
    padding: 12px 10px;
  }
  .logo-wrapper {
    width: 64px;
    height: 64px;
    margin-bottom: 4px;
  }
  .game-title {
    font-size: 1.35rem;
  }
  .game-tagline {
    font-size: 0.7rem;
    margin-bottom: 8px;
  }
  .feature-pills {
    gap: 4px;
    margin-bottom: 10px;
  }
  .feature-item {
    padding: 5px 8px;
  }
  .btn-large {
    padding: 10px 16px;
    font-size: 0.9rem;
  }
}

/* ==========================================================================
   2. HOME SCREEN
   ========================================================================== */
.home-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: rgba(20, 2, 5, 0.94);
  border-bottom: 1.5px solid rgba(255, 215, 0, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.75);
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mini-logo {
  width: 44px;
  height: 44px;
  border-radius: 0;
  box-shadow: 0 4px 12px rgba(255, 174, 0, 0.35);
}

.header-title {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.1;
}

.badge-subtitle {
  font-size: 0.72rem;
  color: var(--royal-gold);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 700;
}

.stat-bubble {
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid var(--glass-border);
  padding: 6px 14px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--royal-gold);
}

.home-body {
  padding: 18px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: rgba(22, 2, 6, 0.9);
  margin: 12px 14px 20px;
  border-radius: 20px;
  border: 1.5px solid rgba(255, 215, 0, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9);
}

.hero-card {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(74, 6, 16, 0.9) 0%, rgba(42, 4, 10, 0.85) 100%);
  border: 1px solid rgba(255, 215, 0, 0.4);
  box-shadow: 0 8px 30px rgba(255, 174, 0, 0.22);
}

.hero-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 1.5px;
  color: var(--royal-gold);
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.hero-content h2 {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 3px 0;
  color: #ffffff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95);
}

.hero-content p {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fef08a;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}

.play-hero-btn {
  padding: 12px 18px;
  font-size: 0.95rem;
  border-radius: 14px;
  flex-shrink: 0;
}

.play-icon {
  font-size: 0.85rem;
}

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

.menu-tile {
  background: var(--grad-card-bg);
  border: 1.5px solid var(--glass-border);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s var(--trans-spring), border-color 0.2s ease, background 0.2s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75);
}

.menu-tile:active {
  transform: scale(0.97);
}

.menu-tile:hover {
  border-color: rgba(255, 215, 0, 0.75);
  background: var(--glass-bg-hover);
}

.tile-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 1.35rem;
}

.bg-gold { background: linear-gradient(135deg, rgba(255, 215, 0, 0.35), rgba(217, 119, 6, 0.35)); border: 1.5px solid rgba(255, 215, 0, 0.6); }
.bg-ruby { background: linear-gradient(135deg, rgba(220, 38, 38, 0.35), rgba(124, 13, 28, 0.35)); border: 1.5px solid rgba(220, 38, 38, 0.6); }
.bg-purple { background: linear-gradient(135deg, rgba(168, 85, 247, 0.35), rgba(126, 34, 206, 0.35)); border: 1.5px solid rgba(168, 85, 247, 0.6); }
.bg-emerald { background: linear-gradient(135deg, rgba(16, 185, 129, 0.35), rgba(5, 150, 105, 0.35)); border: 1.5px solid rgba(16, 185, 129, 0.6); }

.tile-info h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 2px;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.95);
}
.tile-info p {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fef08a;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}

.tile-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 215, 0, 0.5);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--royal-gold);
  text-shadow: 0 1px 3px #000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.tile-arrow {
  position: absolute;
  top: 14px;
  right: 16px;
  color: var(--royal-gold);
  font-size: 1.3rem;
  line-height: 1;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* Stats Overview */
.stats-overview-card {
  padding: 18px;
}

.stats-overview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.stats-overview-header h4 {
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  color: var(--royal-gold-light);
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--grad-gold);
  border-radius: 8px;
  transition: width 0.6s var(--trans-smooth);
}

.stats-mini-row {
  display: flex;
  justify-content: space-between;
  text-align: center;
}
.mini-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-subtle);
  margin-bottom: 2px;
}
.stats-mini-row strong {
  font-size: 0.95rem;
  color: var(--royal-gold);
}

/* ==========================================================================
   3. SUB-SCREENS SHARED HEADER (Levels, Shop, Achievements)
   ========================================================================== */
.sub-screen-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: rgba(20, 2, 5, 0.94);
  border-bottom: 1.5px solid rgba(255, 215, 0, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.75);
}

.header-center {
  text-align: center;
}
.header-center h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95);
  line-height: 1.2;
}
.sub-counter {
  font-size: 0.82rem;
  color: var(--royal-gold);
  font-weight: 800;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
  letter-spacing: 0.5px;
}

.header-spacer {
  width: 40px;
}

/* Chapter Navigation Tabs */
.chapter-tabs {
  display: flex;
  padding: 12px 18px 10px;
  gap: 10px;
  flex-shrink: 0;
  background: rgba(22, 2, 6, 0.96);
  border-bottom: 2px solid rgba(255, 215, 0, 0.45);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.8);
  z-index: 15;
}

.chapter-tab {
  flex: 1;
  background: #2b0409 !important;
  border: 1.5px solid rgba(255, 215, 0, 0.65) !important;
  padding: 10px 4px;
  border-radius: 12px;
  color: #ffffff !important;
  font-size: 0.82rem;
  font-weight: 800;
  text-shadow: 0 2px 4px #000;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
}

.chapter-tab.active {
  background: var(--grad-primary) !important;
  border-color: #fff4b8 !important;
  color: #240206 !important;
  font-weight: 900;
  text-shadow: none;
  box-shadow: 0 4px 18px rgba(255, 174, 0, 0.65);
}

/* Levels Screen Grid Container with High Contrast Panel */
.levels-container {
  flex: 1;
  padding: 18px 14px 24px;
  overflow-y: auto;
  background: rgba(22, 2, 6, 0.9);
  margin: 12px 14px 20px;
  border-radius: 20px;
  border: 1.5px solid rgba(255, 215, 0, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9);
}

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

.level-node {
  aspect-ratio: 1 / 1;
  background: #2e040a;
  border: 1.5px solid rgba(255, 215, 0, 0.45);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s var(--trans-spring), box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.85);
}

.level-node:active:not(.locked) {
  transform: scale(0.92);
}

.level-node.unlocked {
  background: linear-gradient(135deg, #4d0712 0%, #2b040a 100%);
  border: 2px solid #ffd23f;
  box-shadow: 0 6px 20px rgba(255, 174, 0, 0.45);
}

.level-node.current {
  border: 2.5px solid #fff275;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.85);
  animation: currentPulse 1.8s infinite alternate;
}

.level-node.locked {
  opacity: 0.95;
  background: #1c0205;
  border: 1.5px solid rgba(255, 215, 0, 0.25);
  cursor: not-allowed;
  filter: none;
}

.level-num {
  font-size: 1.25rem;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 2px 5px #000;
  line-height: 1;
}

.level-node.locked .level-num {
  font-size: 1.15rem;
  color: #fef08a; /* High-contrast bright gold-cream */
  text-shadow: 0 2px 4px #000;
}

.level-stars {
  font-size: 0.72rem;
  margin-top: 4px;
  letter-spacing: -1px;
  color: #ffd23f;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
}

.level-node.locked .level-stars {
  font-size: 0.85rem;
  color: #ffd23f;
  opacity: 1;
}

/* ==========================================================================
   4. SHOP / PEARL VAULT SCREEN
   ========================================================================== */
.shop-content {
  flex: 1;
  padding: 18px 14px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: rgba(22, 2, 6, 0.9);
  margin: 12px 14px 20px;
  border-radius: 20px;
  border: 1.5px solid rgba(255, 215, 0, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9);
}

.current-orb-preview {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(74, 6, 16, 0.95) 0%, rgba(42, 4, 10, 0.95) 100%);
  border: 1.5px solid rgba(255, 215, 0, 0.5);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75);
}

#skinPreviewCanvas {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.25), transparent 70%);
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.35);
}

.preview-badge {
  font-size: 0.65rem;
  letter-spacing: 1.2px;
  color: var(--royal-gold);
  font-weight: 800;
  text-shadow: 0 1px 3px #000;
  display: block;
}

.preview-details h3 {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 2px 0 4px;
  color: #fff;
  text-shadow: 0 2px 5px #000;
}

.preview-details p {
  font-size: 0.82rem;
  color: #fef08a;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  line-height: 1.3;
}

.skins-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.skin-card {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  background: linear-gradient(145deg, rgba(38, 4, 10, 0.94) 0%, rgba(18, 2, 5, 0.96) 100%);
  border: 1.5px solid rgba(255, 215, 0, 0.4);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8);
}

.skin-card-canvas {
  width: 64px;
  height: 64px;
  border-radius: 50%;
}

.skin-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 4px #000;
}

.skin-price {
  font-size: 0.85rem;
  color: var(--royal-gold);
  font-weight: 800;
  text-shadow: 0 1px 3px #000;
}

.skin-action-btn {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.8rem;
  border-radius: 12px;
}

.skin-action-btn.equipped {
  background: rgba(16, 185, 129, 0.35);
  border: 1.5px solid var(--emerald-accent);
  color: #a7f3d0;
  font-weight: 800;
  text-shadow: 0 1px 2px #000;
  cursor: default;
}

/* ==========================================================================
   5. ACHIEVEMENTS SCREEN
   ========================================================================== */
.achievements-container {
  flex: 1;
  padding: 18px 14px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(22, 2, 6, 0.9);
  margin: 12px 14px 20px;
  border-radius: 20px;
  border: 1.5px solid rgba(255, 215, 0, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9);
}

.achievement-card {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(145deg, rgba(38, 4, 10, 0.94) 0%, rgba(18, 2, 5, 0.96) 100%);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.85);
}

.achievement-card.locked {
  opacity: 1;
  background: linear-gradient(145deg, rgba(28, 3, 7, 0.93) 0%, rgba(14, 1, 3, 0.96) 100%);
  border-color: rgba(255, 215, 0, 0.25);
}

.achievement-card.locked .achieve-icon-wrap {
  opacity: 0.75;
  filter: grayscale(0.5);
  background: rgba(0, 0, 0, 0.55);
}

.achievement-card.unlocked {
  border-color: rgba(255, 215, 0, 0.75);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.85), 0 0 16px rgba(255, 200, 55, 0.25);
  background: linear-gradient(145deg, rgba(52, 5, 14, 0.95) 0%, rgba(26, 3, 7, 0.97) 100%);
}

.achieve-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 215, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.achievement-card.unlocked .achieve-icon-wrap {
  background: var(--grad-gold);
}

.achieve-info {
  flex: 1;
}

.achieve-info h4 {
  font-size: 0.98rem;
  font-weight: 800;
  margin-bottom: 3px;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.95), 0 1px 2px #000;
  letter-spacing: 0.3px;
}

.achieve-info p {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fef08a; /* High contrast bright gold-cream */
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  line-height: 1.3;
}

.achieve-status-badge {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 5px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 215, 0, 0.45);
  color: var(--royal-gold);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  flex-shrink: 0;
}

.achievement-card.unlocked .achieve-status-badge {
  background: rgba(255, 215, 0, 0.25);
  border-color: var(--royal-gold);
  color: #fffbeb;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

/* ==========================================================================
   6. GAMEPLAY SCREEN
   ========================================================================== */
#game-screen {
  overflow: hidden;
}

.game-hud {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 20;
}

.hud-btn {
  width: 36px;
  height: 36px;
  font-size: 1rem;
}

.hud-center {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hud-level-tag {
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--royal-gold);
  letter-spacing: 0.5px;
}

.hud-pearls-track {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.25);
  padding: 4px 10px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--royal-gold);
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
}

.canvas-wrapper {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  overflow: hidden;
  background: url('bg.jpg') center/cover no-repeat;
}

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

/* Virtual Joystick / Stick */
.virtual-controller {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  z-index: 15;
  transition: opacity 0.3s ease;
}

.virtual-stick-base {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(48, 5, 12, 0.55);
  border: 2px solid rgba(255, 215, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  touch-action: none;
}

.virtual-stick-knob {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--grad-primary);
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.8);
  pointer-events: none;
  transform: translate(0px, 0px);
  transition: transform 0.05s ease-out;
}

.controller-tip {
  font-size: 0.68rem;
  color: rgba(255, 240, 180, 0.7);
  letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.game-floating-controls {
  position: absolute;
  top: 12px;
  right: 14px;
  display: flex;
  gap: 6px;
  z-index: 15;
}

/* ==========================================================================
   MODALS (Pause, Victory, Fail, Settings)
   ========================================================================== */
.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(22, 2, 6, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.25s ease;
}

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

.modal-card {
  width: 100%;
  padding: 28px 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-color: rgba(255, 215, 0, 0.4);
  animation: modalPop 0.3s var(--trans-spring);
}

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

.modal-title {
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.modal-subtitle {
  color: var(--text-subtle);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.modal-quick-settings {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  justify-content: center;
}

/* Victory Modal Extras */
.victory-header-icon {
  font-size: 3.2rem;
  margin-bottom: 6px;
  animation: floatBounce 2s ease-in-out infinite;
}

@keyframes floatBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.victory-stars {
  display: flex;
  gap: 8px;
  font-size: 2.2rem;
  margin-bottom: 18px;
}

.vstar {
  filter: grayscale(1);
  opacity: 0.35;
  transition: all 0.4s var(--trans-spring);
}
.vstar.earned {
  filter: grayscale(0);
  opacity: 1;
  transform: scale(1.15);
  text-shadow: 0 0 18px rgba(255, 215, 0, 0.9);
}

.victory-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-bottom: 22px;
}

.vstat-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 6px;
}

.vstat-label {
  display: block;
  font-size: 0.68rem;
  color: var(--text-subtle);
  margin-bottom: 3px;
}
.vstat-box strong {
  font-size: 0.95rem;
  color: var(--royal-gold);
}

/* Settings Modal Elements */
.settings-card {
  text-align: left;
  align-items: stretch;
}

.settings-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

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

.setting-row strong {
  font-size: 0.92rem;
  display: block;
  color: var(--royal-gold-light);
}
.setting-row p {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.setting-row-vertical {
  padding: 14px 0 8px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.85rem;
}
.slider-header span {
  color: var(--royal-gold);
  font-weight: 700;
}

.range-slider {
  width: 100%;
  accent-color: var(--royal-gold);
  height: 6px;
  border-radius: 4px;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: 0.3s;
  border-radius: 26px;
  border: 1px solid var(--glass-border);
}
.slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}
input:checked + .slider {
  background: var(--grad-primary);
}
input:checked + .slider::before {
  transform: translateX(22px);
}

.settings-divider {
  height: 1px;
  background: rgba(255, 215, 0, 0.15);
  margin: 14px 0;
}

.settings-instructions h4 {
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--royal-gold);
}
.settings-instructions ul {
  list-style: none;
  font-size: 0.78rem;
  color: var(--text-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 18px;
}
