/* Gems Rush: Divine Teams - Working Core Version */
/* Simplified styling for core functionality with enhanced browser compatibility */

/* Basic reset */
* {
    margin: 0;
    padding: 0;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
  box-sizing: border-box;
}

/* Data-state attribute support for control visibility */
/* Removed problematic data-state rules that were interfering with game initialization */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Georgia', serif;
    /* Fallback background for older browsers */
    background: #1a1a3a;
    background: -webkit-radial-gradient(circle at center, #1a1a3a 0%, #0d0d1a 100%);
    background: -moz-radial-gradient(circle at center, #1a1a3a 0%, #0d0d1a 100%);
    background: radial-gradient(circle at center, #1a1a3a 0%, #0d0d1a 100%);
  min-height: 100vh;
    /* Enhanced flexbox compatibility */
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
  display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -moz-box-orient: vertical;
    -moz-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -moz-box-pack: center;
    -ms-flex-pack: center;
  justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -moz-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    color: #f0f0f0;
    overflow-x: hidden;
  position: relative;
}

/* Enhanced starfield background effect with vendor prefixes */
body::before,
body:before {
  content: '';
    position: fixed;
  top: 0;
  left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        -webkit-radial-gradient(2px 2px at 20px 30px, #fff, transparent),
        -webkit-radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        -webkit-radial-gradient(1px 1px at 90px 40px, #fff, transparent);
    background-image: 
        -moz-radial-gradient(2px 2px at 20px 30px, #fff, transparent),
        -moz-radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        -moz-radial-gradient(1px 1px at 90px 40px, #fff, transparent);
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #fff, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    -webkit-animation: sparkle 20s linear infinite;
    -moz-animation: sparkle 20s linear infinite;
    animation: sparkle 20s linear infinite;
    pointer-events: none;
    z-index: -1;
}

@-webkit-keyframes sparkle {
    from { -webkit-transform: translateY(0px); }
    to { -webkit-transform: translateY(-100px); }
}

@-moz-keyframes sparkle {
    from { -moz-transform: translateY(0px); }
    to { -moz-transform: translateY(-100px); }
}

@keyframes sparkle {
    from { transform: translateY(0px); }
    to { transform: translateY(-100px); }
}

/* NEW: Screen shake animation for big matches */
@keyframes screenShake {
    0%, 100% { transform: translate(0px, 0px); }
    25% { transform: translate(-3px, 3px); }
    50% { transform: translate(3px, -3px); }
    75% { transform: translate(-2px, 2px); }
}

.screen-shake {
    animation: screenShake 0.4s ease-in-out;
}

/* NEW: Floating score animations */
.floating-score {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    pointer-events: none;
    z-index: 100;
    animation: floatUp 1.2s ease-out forwards;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0px) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-30px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.8);
    }
}

/* NEW: Particle effects */
.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 99;
    animation: particleExplode 1s ease-out forwards;
}

.particle.fire { background: radial-gradient(circle, #FF4500, #DC143C); }
.particle.water { background: radial-gradient(circle, #1E90FF, #4169E1); }
.particle.earth { background: radial-gradient(circle, #8B4513, #A0522D); }
.particle.air { background: radial-gradient(circle, #87CEEB, #B0E0E6); }
.particle.lightning { background: radial-gradient(circle, #FFD700, #FFA500); }
.particle.nature { background: radial-gradient(circle, #32CD32, #228B22); }
.particle.magic { background: radial-gradient(circle, #9932CC, #8A2BE2); }

@keyframes particleExplode {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: scale(0) rotate(360deg);
    }
}

/* NEW: Enhanced match animations */
.gem.match-pulse {
    animation: matchPulse 0.3s ease-in-out;
}

.gem.match-fade {
    animation: matchFade 0.5s ease-in-out forwards;
}

@keyframes matchPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); box-shadow: 0 0 20px currentColor; }
}

@keyframes matchFade {
    0% {
        opacity: 1;
        transform: scale(1.15);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.3);
        filter: brightness(2);
    }
    100% {
        opacity: 0;
        transform: scale(0);
    }
}

/* NEW: Hint system styling */
.gem.hint-glow {
    animation: hintGlow 2s ease-in-out infinite;
    position: relative;
}

.gem.hint-glow::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 3px solid #FFD700;
    border-radius: 15px;
    animation: hintPulse 2s ease-in-out infinite;
}

@keyframes hintGlow {
    0%, 100% {
        box-shadow: 0 6px 12px rgba(0,0,0,0.4), 0 0 15px rgba(255,215,0,0.6);
    }
    50% {
        box-shadow: 0 6px 12px rgba(0,0,0,0.4), 0 0 25px rgba(255,215,0,0.9);
    }
}

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

/* NEW: Streak counter styling */
.streak-counter {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(145deg, rgba(255,215,0,0.9), rgba(255,165,0,0.9));
    color: #000;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(255,215,0,0.4);
    z-index: 1000;
    animation: streakBounce 0.5s ease-out;
}

@keyframes streakBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* NEW: Achievement notification */
.achievement-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, rgba(255,215,0,0.95), rgba(255,165,0,0.95));
    color: #000;
    padding: 20px 30px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 18px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(255,215,0,0.5);
    z-index: 1001;
    animation: achievementPop 3s ease-in-out forwards;
}

@keyframes achievementPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    85% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

/* NEW: Timer display for time attack mode */
.timer-display {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(145deg, rgba(255,69,0,0.9), rgba(220,20,60,0.9));
    color: #fff;
    padding: 10px 25px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(255,69,0,0.4);
    z-index: 1000;
}

.timer-warning {
    animation: timerWarning 1s ease-in-out infinite;
}

@keyframes timerWarning {
    0%, 100% { background: linear-gradient(145deg, rgba(255,69,0,0.9), rgba(220,20,60,0.9)); }
    50% { background: linear-gradient(145deg, rgba(255,0,0,1), rgba(139,0,0,1)); }
}

/* NEW: Power-up gem styling */
.gem.power-up {
    position: relative;
    animation: powerUpPulse 2s ease-in-out infinite;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gem.power-up::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 2px solid #FFD700;
    border-radius: 13px;
    animation: powerUpBorder 2s ease-in-out infinite;
}

@keyframes powerUpPulse {
    0%, 100% {
        filter: brightness(1) drop-shadow(0 0 10px currentColor);
    }
    50% {
        filter: brightness(1.3) drop-shadow(0 0 20px currentColor);
    }
}

@keyframes powerUpBorder {
    0%, 100% {
        opacity: 0.7;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* NEW: Daily challenge indicator */
.daily-challenge-badge {
    position: fixed;
    top: 20px;
    left: 85px; /* Moved right to avoid home button */
    background: linear-gradient(145deg, rgba(138,43,226,0.9), rgba(75,0,130,0.9));
    color: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(138,43,226,0.4);
    z-index: 1000;
    cursor: pointer;
    transition: all 0.3s ease;
}

.daily-challenge-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(138,43,226,0.6);
}

/* NEW: Game mode indicators */
.game-mode-indicator {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(145deg, rgba(255,255,255,0.2), rgba(255,255,255,0.1));
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    border: 1px solid rgba(255,255,255,0.3);
    backdrop-filter: blur(10px);
}

.game-mode-indicator.time-attack {
    background: linear-gradient(145deg, rgba(255,69,0,0.3), rgba(220,20,60,0.3));
    border-color: rgba(255,69,0,0.5);
}

.game-mode-indicator.daily-challenge {
    background: linear-gradient(145deg, rgba(138,43,226,0.3), rgba(75,0,130,0.3));
    border-color: rgba(138,43,226,0.5);
}

/* NEW: Combo text display */
.combo-text {
    position: absolute;
    font-size: 32px;
    font-weight: bold;
    color: #FF6347;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.8);
    pointer-events: none;
    z-index: 100;
    animation: comboText 2s ease-out forwards;
}

@keyframes comboText {
    0% {
        opacity: 1;
        transform: scale(0.5) rotate(-10deg);
    }
    25% {
        opacity: 1;
        transform: scale(1.2) rotate(5deg);
    }
    75% {
        opacity: 0.8;
        transform: scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) rotate(5deg);
    }
}

/* NEW: Statistics panel */
.stats-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(145deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    color: #fff;
    padding: 15px 20px;
    border-radius: 15px;
    border: 1px solid rgba(255,255,255,0.3);
    backdrop-filter: blur(15px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    font-size: 12px;
    min-width: 150px;
    z-index: 1000;
}

.stats-panel h4 {
    margin-bottom: 8px;
    color: #FFD700;
    border-bottom: 1px solid rgba(255,215,0,0.3);
    padding-bottom: 4px;
}

.stats-panel .stat-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

/* Game statistics display */
.game-stats {
    display: flex;
    gap: 25px;
    margin-bottom: 25px;
    background: linear-gradient(145deg, rgba(255,255,255,0.18), rgba(255,255,255,0.08));
    padding: 18px 30px;
    border-radius: 20px;
    border: 2px solid rgba(255,255,255,0.35);
    box-shadow: 0 18px 40px rgba(0,0,0,0.45);
    backdrop-filter: blur(20px);
    flex-wrap: wrap;
    justify-content: center;
    position: relative;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.game-stat {
    font-size: 17px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    color: #f5f5f5;
    text-align: center;
    min-width: 110px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.12);
    transition: all 0.3s ease;
}

.game-stat:nth-child(1) { color: #FFD700; border: 1px solid rgba(255,215,0,0.3); }
.game-stat:nth-child(2) { color: #87CEEB; border: 1px solid rgba(135,206,235,0.3); }
.game-stat:nth-child(3) { color: #98FB98; border: 1px solid rgba(152,251,152,0.3); }
.game-stat:nth-child(4) { color: #DDA0DD; border: 1px solid rgba(221,160,221,0.3); }

/* Enhanced Divine Game Board */
.game-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 3px;
    width: min(85vw, 720px);
    height: min(85vw, 720px);
    aspect-ratio: 1;
    margin: 20px auto;
    padding: 15px;
    position: relative;
    overflow: visible;
    
    /* Enhanced glassmorphism divine board */
    background: 
        linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%),
        linear-gradient(225deg, rgba(138, 43, 226, 0.1) 0%, rgba(75, 0, 130, 0.05) 100%);
    border-radius: 30px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(25px) saturate(180%);
    box-shadow: 
        0 30px 60px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset,
        0 0 50px rgba(138, 43, 226, 0.2),
        0 0 100px rgba(255, 215, 0, 0.1);
}

/* Divine energy aura around board */
.game-board::before {
    content: '';
    position: absolute;
    top: -30%;
    left: -30%;
    width: 160%;
    height: 160%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        rgba(255, 215, 0, 0.12) 45deg,    /* Lightning */
        rgba(138, 43, 226, 0.12) 90deg,   /* Magic */
        rgba(30, 144, 255, 0.12) 135deg,  /* Water */
        rgba(50, 205, 50, 0.12) 180deg,   /* Nature */
        rgba(255, 69, 0, 0.12) 225deg,    /* Fire */
        rgba(139, 69, 19, 0.12) 270deg,   /* Earth */
        rgba(135, 206, 235, 0.12) 315deg, /* Air */
        transparent 360deg
    );
    animation: divineRotation 25s linear infinite;
    pointer-events: none;
    z-index: -1;
    border-radius: 50%;
}

/* Subtle inner divine glow */
.game-board::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    bottom: 3px;
    background: radial-gradient(circle at center, 
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.02) 40%,
        transparent 70%);
    border-radius: 26px;
    pointer-events: none;
    z-index: 0;
}

@keyframes divineRotation {
    0% { transform: rotate(0deg) scale(1); opacity: 0.3; }
    25% { transform: rotate(90deg) scale(1.02); opacity: 0.5; }
    50% { transform: rotate(180deg) scale(1.05); opacity: 0.7; }
    75% { transform: rotate(270deg) scale(1.02); opacity: 0.5; }
    100% { transform: rotate(360deg) scale(1); opacity: 0.3; }
}

/* Game board with specific layout styling - used for inline style replacement */
.game-board-layout {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 3px;
    width: min(85vw, 720px);
    height: min(85vw, 720px);
    margin: 0 auto;
}

/* Floating score animation styling */
.floating-score-element {
    position: absolute;
    font-size: 20px;
    font-weight: bold;
    color: #FFD700;
    pointer-events: none;
    z-index: 1000;
    animation: floatUp 1s ease-out forwards;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

/* Enhanced cascade score styling */
.floating-score-element.cascade-score {
    font-size: 24px;
    color: #FF6347;
    text-shadow: 
        2px 2px 4px rgba(0,0,0,0.9),
        0 0 10px rgba(255, 99, 71, 0.6);
    animation: cascadeScoreFloat 1.2s ease-out forwards;
}

@keyframes cascadeScoreFloat {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    20% {
        transform: translateY(-10px) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translateY(-60px) scale(0.8);
        opacity: 0;
    }
}

/* Modern Gem Design - Clean & Minimal */
.gem {
    width: 100%;
    height: 100%;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(22px, 4vw, 34px);
    font-weight: 600;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
    z-index: 1;
    
    /* Clean modern structure */
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.15),
        inset 0 1px 2px rgba(255, 255, 255, 0.3);
    
    /* Clean text styling */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    
    /* Smooth background */
    background-size: cover;
    background-position: center;
}

/* Subtle shine effect */
.gem::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 60%;
    bottom: 60%;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.4) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%);
    border-radius: 8px;
    pointer-events: none;
    z-index: 2;
}

/* Modern Gem Types - Clean & Distinctive */

/* 🔥 Fire Gems - Vibrant Orange-Red */
.gem[data-type="🔥"], .gem.fire {
    background: linear-gradient(145deg, 
        #FF6B35 0%, 
        #FF4500 30%, 
        #E63946 70%, 
        #DC2F02 100%);
    border-color: rgba(255, 107, 53, 0.6);
    color: #FFFFFF;
}

/* 💧 Water Gems - Cool Blue */
.gem[data-type="💧"], .gem.water {
    background: linear-gradient(145deg, 
        #4CC9F0 0%, 
        #219EBC 30%, 
        #023047 70%, 
        #1D3557 100%);
    border-color: rgba(76, 201, 240, 0.6);
    color: #FFFFFF;
}

/* 🌍 Earth Gems - Rich Brown */
.gem[data-type="🌍"], .gem.earth {
    background: linear-gradient(145deg, 
        #D4A574 0%, 
        #B08D57 30%, 
        #8B5A3C 70%, 
        #5D4037 100%);
    border-color: rgba(212, 165, 116, 0.6);
    color: #FFFFFF;
}

/* 💨 Air Gems - Light Cyan */
.gem[data-type="💨"], .gem.air {
    background: linear-gradient(145deg, 
        #B8E6E6 0%, 
        #87CEEB 30%, 
        #6BB6FF 70%, 
        #4A90E2 100%);
    border-color: rgba(184, 230, 230, 0.6);
    color: #1A1A1A;
}

/* ⚡ Lightning Gems - Electric Yellow */
.gem[data-type="⚡"], .gem.lightning {
    background: linear-gradient(145deg, 
        #FFE066 0%, 
        #FFD23F 30%, 
        #FFC107 70%, 
        #FF9500 100%);
    border-color: rgba(255, 224, 102, 0.7);
    color: #1A1A1A;
}

/* 🌿 Nature Gems - Fresh Green */
.gem[data-type="🌿"], .gem.nature {
    background: linear-gradient(145deg, 
        #8BC34A 0%, 
        #4CAF50 30%, 
        #2E7D32 70%, 
        #1B5E20 100%);
    border-color: rgba(139, 195, 74, 0.6);
    color: #FFFFFF;
}

/* 🔮 Magic Gems - Royal Purple */
.gem[data-type="🔮"], .gem.magic {
    background: linear-gradient(145deg, 
        #9C27B0 0%, 
        #673AB7 30%, 
        #3F51B5 70%, 
        #1A237E 100%);
    border-color: rgba(156, 39, 176, 0.6);
    color: #FFFFFF;
}

/* Removed heavy animations for better performance */

/* Clean Gem Interactions */
.gem:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 3px rgba(255, 255, 255, 0.4);
    z-index: 10;
    filter: brightness(1.1);
}

.gem.selected {
    transform: scale(1.08);
    border: 3px solid #FFD700;
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.6),
        0 8px 25px rgba(0, 0, 0, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.5);
    z-index: 15;
    filter: brightness(1.2);
}

.gem.matched {
    animation: simpleMatch 0.5s ease-out forwards;
}

/* Enhanced match animation with better breaking effect */
@keyframes simpleMatch {
    0% {
        transform: scale(1) translateZ(0);
        opacity: 1;
        filter: brightness(1);
        will-change: transform, opacity, filter;
    }
    20% {
        transform: scale(1.15) translateZ(0);
        opacity: 1;
        filter: brightness(1.3);
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    }
    40% {
        transform: scale(1.3) translateZ(0);
        opacity: 0.9;
        filter: brightness(1.6);
        box-shadow: 0 0 25px rgba(255, 255, 255, 0.9);
    }
    70% {
        transform: scale(1.1) rotate(5deg) translateZ(0);
        opacity: 0.5;
        filter: brightness(2);
        box-shadow: 0 0 35px rgba(255, 255, 255, 1);
    }
    90% {
        transform: scale(0.3) rotate(15deg) translateZ(0);
        opacity: 0.2;
        filter: brightness(3);
        box-shadow: 0 0 50px rgba(255, 255, 255, 0.5);
    }
    100% {
        transform: scale(0) rotate(25deg) translateZ(0);
        opacity: 0;
        filter: brightness(0);
        will-change: auto;
    }
}

.gem {
    /* Add hardware acceleration */
    transform: translateZ(0);
    will-change: transform;
    /* Optimize rendering */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* GPU acceleration */
    -webkit-transform: translateZ(0);
    -moz-transform: translateZ(0);
    -ms-transform: translateZ(0);
    -o-transform: translateZ(0);
}

.gem:hover {
    transform: scale(1.05) translateZ(0);
}

.gem.selected {
    transform: scale(1.1) translateZ(0);
}

.gem.matched {
    will-change: transform, opacity, filter;
}

/* Match pulse for gem highlighting before removal */
@keyframes matchPulse {
    0% {
        transform: scale(1);
        filter: brightness(1);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }
    50% {
        transform: scale(1.1);
        filter: brightness(1.4);
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }
}

/* Cascade chain reaction effect */
@keyframes cascadePop {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
        filter: brightness(1.5);
    }
    70% {
        transform: scale(0.8);
        opacity: 0.6;
        filter: brightness(2);
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* Invalid move animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Level completion animation */
@keyframes levelComplete {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

/* Game container styling */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 100vw;
    padding: 20px;
    min-height: 100vh;
    justify-content: center;
}
  
/* Enhanced game title */
  .game-title {
    font-size: 2.8rem;
  font-weight: bold;
    text-align: center;
    background: linear-gradient(45deg, #FFD700, #FF6347, #9932CC, #1E90FF);
  background-size: 400% 400%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.5);
    animation: titleGradient 4s ease-in-out infinite;
    margin-bottom: 10px;
}

@keyframes titleGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.game-subtitle {
    font-size: 1.3rem;
    text-align: center;
    color: #b0b0b0;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* Controls */
.game-controls {
    display: flex;
    gap: 20px;
    margin-top: 25px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.btn-primary {
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    border: 2px solid rgba(255,255,255,0.2);
}

.btn-primary:hover {
    background: linear-gradient(145deg, #764ba2, #667eea);
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
}

.btn-secondary {
    background: linear-gradient(145deg, #f093fb, #f5576c);
  color: white;
    border: 2px solid rgba(255,255,255,0.2);
}

.btn-secondary:hover {
    background: linear-gradient(145deg, #f5576c, #f093fb);
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
}

/* NEW: Enhanced control buttons */
.btn-hint, .btn-undo, .btn-mode {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    margin: 5px;
}

.btn-hint {
    background: linear-gradient(145deg, #FFD700, #FFA500);
    color: #000;
    border: 2px solid rgba(255,215,0,0.3);
}

.btn-hint:hover {
    background: linear-gradient(145deg, #FFA500, #FF8C00);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,215,0,0.4);
}

.btn-hint:disabled {
    background: linear-gradient(145deg, #666, #555);
    color: #999;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.btn-undo {
    background: linear-gradient(145deg, #87CEEB, #4169E1);
    color: #fff;
    border: 2px solid rgba(135,206,235,0.3);
}

.btn-undo:hover {
    background: linear-gradient(145deg, #4169E1, #1E90FF);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(65,105,225,0.4);
}

.btn-undo:disabled {
    background: linear-gradient(145deg, #666, #555);
    color: #999;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.btn-mode {
    background: linear-gradient(145deg, #9932CC, #8A2BE2);
    color: #fff;
    border: 2px solid rgba(153,50,204,0.3);
    font-size: 13px;
    padding: 10px 15px;
}

.btn-mode:hover {
    background: linear-gradient(145deg, #8A2BE2, #9400D3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(153,50,204,0.4);
}

.btn-mode.active {
    background: linear-gradient(145deg, #32CD32, #228B22);
    border-color: rgba(50,205,50,0.5);
    transform: scale(1.05);
}

.game-mode-selection {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* NEW: Swipe gesture indicators for mobile */
.swipe-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,215,0,0.9);
    color: #000;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    pointer-events: none;
    z-index: 200;
    animation: swipeHint 2s ease-in-out;
}

@keyframes swipeHint {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* NEW: Touch feedback for mobile */
.gem.touch-feedback {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

/* NEW: Enhanced responsive design following video player documentation patterns */
/* Medium screen tablet support (64em = 1024px) */
@media screen and (max-width: 64em) {
    .game-container {
        padding: 1rem;
    }
    
    .game-controls {
        height: 1.876rem;
    }
    
    .game-board {
        width: 90%;
        height: auto;
    }
}

/* Smaller tablet and mobile support (42.5em = 680px) */
@media screen and (max-width: 42.5em) {
    .game-controls {
        height: auto;
    }
    
    .game-controls > * {
        display: block;
        width: 16.6667%;
        margin-left: 0;
        height: 2.5rem;
        margin-top: 2.5rem;
    }
    
    .game-board {
        width: 100%;
    }
}

/* Enhanced mobile responsiveness */
@media (max-width: 768px) {
    .main-menu-content {
        width: 95%;
        padding: 15px;
        gap: 15px;
    }
    
    .title-line {
        font-size: 2em;
        letter-spacing: 1px;
    }
    
    .title-subtitle {
        font-size: 1em;
        letter-spacing: 2px;
    }
    
    .main-tagline {
        font-size: 0.8em;
    }
    
    .modes-title {
        font-size: 1.2em;
        margin: 0 0 15px 0;
    }
    
    .modes-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .menu-btn {
        height: 120px;
        padding: 15px;
    }
    
    .btn-icon {
        font-size: 1.8em;
    }
    
    .btn-title {
        font-size: 1em;
    }
    
    .btn-desc {
        font-size: 0.8em;
    }
    
    .info-features {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .feature {
        height: 45px;
        padding: 10px;
    }
    
    .footer-btn {
        padding: 10px 15px;
        font-size: 0.85em;
        height: 40px;
    }
    
    .btn-hint, .btn-undo, .btn-mode {
        font-size: 12px;
        padding: 10px 15px;
        margin: 3px;
    }
    
    .game-mode-selection {
        gap: 5px;
    }
    
    .streak-counter {
        top: 10px;
        right: 10px;
        font-size: 14px;
        padding: 8px 15px;
    }
    
    .daily-challenge-badge {
        top: 10px;
        left: 70px; /* Adjusted for mobile home button */
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .timer-display {
        top: 10px;
        font-size: 16px;
        padding: 8px 20px;
    }
    
    .stats-panel {
        bottom: 10px;
        right: 10px;
        font-size: 11px;
        padding: 10px 15px;
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .main-menu-content {
        width: 98%;
        padding: 10px;
        gap: 12px;
    }
    
    .title-line {
        font-size: 1.6em;
        letter-spacing: 1px;
    }
    
    .title-subtitle {
        font-size: 0.9em;
        letter-spacing: 1px;
    }
    
    .main-tagline {
        font-size: 0.75em;
    }
    
    .modes-title {
        font-size: 1.1em;
        margin: 0 0 12px 0;
    }
    
    .modes-grid {
        gap: 12px;
    }
    
    .menu-btn {
        height: 110px;
        padding: 12px;
    }
    
    .btn-icon {
        font-size: 1.6em;
    }
    
    .btn-title {
        font-size: 0.95em;
    }
    
    .btn-desc {
        font-size: 0.75em;
    }
    
    .info-section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .info-section h3 {
        font-size: 1.1em;
    }
    
    .info-section p {
        font-size: 0.85em;
    }
    
    .feature {
        height: 40px;
        padding: 8px;
        gap: 8px;
    }
    
    .feature-icon {
        font-size: 1.1em;
    }
    
    .feature-text {
        font-size: 0.8em;
    }
    
    .menu-footer {
        gap: 10px;
        margin: 15px 0 0 0;
    }
    
    .footer-btn {
        padding: 8px 12px;
        font-size: 0.8em;
        height: 36px;
        gap: 6px;
    }
    
    .floating-score {
        font-size: 20px;
    }
    
    .combo-text {
        font-size: 28px;
    }
    
    .achievement-notification {
        font-size: 16px;
        padding: 15px 25px;
    }
    
    .game-mode-indicator {
        font-size: 12px;
        padding: 6px 15px;
    }
}

/* Focus states for accessibility */
.gem:focus,
.btn:focus {
    outline: 3px solid #FFD700;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .gem {
        border-width: 3px;
        border-color: white;
    }
    
    .gem.selected {
        border-color: yellow;
        background-color: rgba(255, 255, 0, 0.3) !important;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .gem,
    .btn {
        transition: none;
    }
    
    .gem:hover {
        transform: none;
    }
    
    .gem.selected,
    .gem.lightning,
    .gem.magic {
        animation: none;
    }
    
    .gem.matched {
        animation: none;
        opacity: 0;
  }
}

/* Print styles */
@media print {
    .game-controls {
        display: none;
    }
    
    .game-board {
        filter: grayscale(100%);
    }
}

/* Duplicate CSS block removed to fix layout conflicts */

/* Settings button styling */
.btn-settings {
    background: linear-gradient(145deg, #6c5ce7, #a29bfe);
    color: white;
    border: 2px solid rgba(255,255,255,0.2);
    position: relative;
    overflow: hidden;
}

.btn-settings:hover {
    background: linear-gradient(145deg, #a29bfe, #6c5ce7);
    transform: translateY(-3px) rotate(15deg);
    box-shadow: 0 8px 16px rgba(108, 92, 231, 0.4);
}

.btn-settings::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.2);
  border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.5s ease;
}

.btn-settings:hover::before {
    width: 100px;
    height: 100px;
    opacity: 1;
}

/* Settings Modal Styles */
.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3); /* More transparent overlay */
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px); /* Subtle blur */
}

.settings-content {
    background: linear-gradient(145deg, rgba(26, 26, 58, 0.95), rgba(13, 13, 26, 0.92));
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 20px;
    max-width: 500px; /* Smaller width */
    max-height: 70vh; /* Smaller height */
    width: 90%;
    color: #f0f0f0;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    overflow-y: auto;
    position: relative;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-header h2 {
    margin: 0;
    color: #FFD700;
    font-size: 1.4em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.close-btn {
    background: linear-gradient(145deg, #ff4757, #ff3742);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.close-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.settings-body {
    max-height: 50vh; /* Compact scrollable area */
    overflow-y: auto;
    padding-right: 10px;
}

.settings-section {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-section h3 {
    margin: 0 0 15px 0;
    color: #87CEEB;
    font-size: 1.1em;
    border-bottom: 1px solid rgba(135, 206, 235, 0.3);
    padding-bottom: 8px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px 0;
}

.setting-item label {
    color: #f0f0f0;
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

/* Compact toggle switches */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.toggle-switch:checked {
    background: linear-gradient(145deg, #4CAF50, #45a049);
}

.toggle-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch:checked::before {
    left: 22px;
}

/* Compact sliders */
.volume-slider, .speed-slider {
    width: 80px;
    height: 6px;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb, .speed-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: linear-gradient(145deg, #667eea, #764ba2);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.volume-value, .speed-value {
    color: #FFD700;
    font-size: 12px;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
}

/* Compact select boxes */
.theme-select, .difficulty-select, .size-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #f0f0f0;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    min-width: 120px;
}

.theme-select:focus, .difficulty-select:focus, .size-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

.theme-select option, .difficulty-select option, .size-select option {
    background: #1a1a3a;
    color: #f0f0f0;
}

.settings-footer {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-footer .btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 14px;
    min-height: auto;
}

/* Custom scrollbar for settings modal */
.settings-body::-webkit-scrollbar {
    width: 6px;
}

.settings-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.settings-body::-webkit-scrollbar-thumb {
    background: linear-gradient(145deg, #667eea, #764ba2);
    border-radius: 3px;
}

.settings-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(145deg, #764ba2, #667eea);
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .settings-content {
        max-width: 95%;
        max-height: 80vh;
        padding: 15px;
    }
    
    .settings-header h2 {
        font-size: 1.2em;
    }
    
    .settings-section {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .setting-item label {
        margin-bottom: 5px;
    }
    
    .settings-footer {
        flex-direction: column;
        gap: 10px;
    }
}

/* Accessibility Enhancements */
.setting-item:focus-within {
    outline: 2px solid #FFD700;
    outline-offset: 2px;
  border-radius: 8px;
}

.toggle-switch:focus {
    box-shadow: 0 0 0 3px rgba(255,215,0,0.3);
}

.volume-slider:focus,
.speed-slider:focus {
    box-shadow: 0 0 0 3px rgba(255,215,0,0.3);
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .settings-content {
        border-color: white;
        background: rgba(0,0,0,0.95);
    }
    
    .setting-item {
        border: 1px solid white;
    }
    
    .toggle-switch {
        border-color: white;
    }
    
    .toggle-switch:checked {
        background: #00ff00;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .settings-modal,
    .settings-content,
    .setting-item,
    .toggle-switch,
    .btn-settings {
        animation: none;
        transition: none;
    }
    
    .btn-settings:hover {
        transform: none;
    }
    
    .settings-header .close-btn:hover {
        transform: scale(1.05);
    }
}

/* Board Theme Styles */
.theme-forest {
    background: radial-gradient(circle at center, #1a3a1a 0%, #0d1a0d 100%);
}

.theme-forest::before {
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #90EE90, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(144,238,144,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, #98FB98, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(152,251,152,0.6), transparent);
}

.theme-ocean {
    background: radial-gradient(circle at center, #1a1a3a 0%, #0d0d2a 100%);
}

.theme-ocean::before {
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #87CEEB, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(135,206,235,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, #B0E0E6, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(176,224,230,0.6), transparent);
}

.theme-fire {
    background: radial-gradient(circle at center, #3a1a1a 0%, #2a0d0d 100%);
}

.theme-fire::before {
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #FF4500, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,69,0,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, #FF6347, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,99,71,0.6), transparent);
}

/* Additional CSS classes for settings functionality */
.no-animations * {
    animation: none !important;
    transition: none !important;
}

.high-contrast .gem {
    border-width: 4px !important;
    border-color: white !important;
}

.high-contrast .gem.selected {
    border-color: yellow !important;
    background-color: rgba(255, 255, 0, 0.3) !important;
}

.reduced-motion * {
    animation: none !important;
    transition: none !important;
}

.reduced-motion .gem:hover {
    transform: none !important;
}

/* Settings message animation */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
  }
}

/* Responsive Design for Modern Gems */
@media (max-width: 768px) {
    .game-board {
        width: min(90vw, 550px);
        height: min(90vw, 550px);
        padding: 12px;
        gap: 2px;
        border-radius: 22px;
        border: 3px solid rgba(255, 255, 255, 0.4);
    }

    .gem {
        font-size: clamp(18px, 3.5vw, 26px);
        border-radius: 14px;
        min-height: 45px;
    }
    
    .gem:hover {
        transform: scale(1.03);
    }
    
    .gem.selected {
        transform: scale(1.06);
    }

    .game-stats {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        padding: 12px 20px;
    }

    .game-stat {
        font-size: 14px;
        min-width: auto;
        padding: 6px 12px;
        border-radius: 12px;
    }

    .game-title {
        font-size: 2.2rem;
    }
}

@media (max-width: 480px) {
    .game-board {
        width: min(95vw, 450px);
        height: min(95vw, 450px);
        padding: 8px;
        gap: 1px;
        border-radius: 18px;
        border: 2px solid rgba(255, 255, 255, 0.4);
    }
    
    .gem {
        font-size: clamp(14px, 3vw, 20px);
        border-radius: 12px;
        min-height: 35px;
    }
    
    .gem:hover {
        transform: scale(1.02);
    }
    
    .gem.selected {
        transform: scale(1.04);
    }
    
    .game-title {
        font-size: 1.8rem;
    }

    .game-stats {
        padding: 8px 15px;
        gap: 5px;
    }
    
    .game-stat {
        font-size: 12px;
        padding: 4px 8px;
        border-radius: 8px;
    }
}

/* Accessibility support */
.gem:focus,
.gem:focus-visible {
    outline: 3px solid #FFD700;
    outline-offset: 2px;
    box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.5);
}

@media (prefers-contrast: high) {
    .gem {
        border-width: 3px;
        box-shadow: 0 4px 8px rgba(0,0,0,0.8);
    }
    
    .gem.selected {
        outline: 4px solid #FFFF00;
        outline-offset: 2px;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .gem,
    .gem:hover,
    .gem.selected,
    .settings-modal,
    .instructions,
    .floating-score,
    .combo-text,
    .achievement-notification,
    .particle,
    .streak-counter,
    .timer-display {
        animation: none !important;
        transition: none !important;
    }
    
    .gem.matched {
        animation: none;
        opacity: 0.3;
    }
}

/* Duplicate print styles removed */

/* DIVINE CONQUEST CAMPAIGN STYLES */

/* Campaign Container */
.campaign-container {
        display: none;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #1a1a3a, #2a2a5a, #1a1a3a);
    min-height: 100vh;
    overflow-y: auto;
}

/* Campaign Header */
.campaign-header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 100%;
    max-width: 800px;
}

.campaign-header h2 {
    color: #FFD700;
    margin: 0 0 15px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-size: 2.2em;
}

.campaign-progress {
    display: flex;
    justify-content: space-around;
    margin: 15px 0;
    flex-wrap: wrap;
    gap: 20px;
}

.divine-essence, .total-stars {
    background: rgba(255, 215, 0, 0.2);
    padding: 10px 20px;
    border-radius: 25px;
    border: 2px solid #FFD700;
    color: #FFF;
    font-weight: bold;
    font-size: 1.1em;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn-back {
    margin-top: 15px;
    background: linear-gradient(135deg, #4a4a7a, #6a6a9a);
    border: 2px solid #8a8aba;
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: linear-gradient(135deg, #6a6a9a, #8a8aba);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* Realms Grid */
.realms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    width: 100%;
    max-width: 1000px;
    margin-bottom: 30px;
}

/* Realm Cards */
.realm-card {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.realm-card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-radius: 15px;
    z-index: -1;
}

.realm-card:hover:not(.realm-locked) {
    transform: translateY(-5px) scale(1.02);
    border-color: #FFD700;
    box-shadow: 0 10px 25px rgba(255, 215, 0, 0.3);
}

.realm-locked {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(50%);
}

.realm-symbol {
    font-size: 3em;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: float 3s ease-in-out infinite;
}

.realm-name {
    color: #FFF;
    margin: 10px 0;
    font-size: 1.3em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

.realm-description {
    color: #CCC;
    font-size: 0.9em;
    margin: 10px 0;
    line-height: 1.4;
}

.realm-progress {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.levels-completed, .stars-earned {
    font-size: 0.9em;
    color: #DDD;
    font-weight: bold;
}

.realm-lock {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3em;
    color: #666;
    z-index: 2;
}

/* Campaign Level Selection Modal */
.campaign-level-select {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(10px);
}

.campaign-content {
    background: rgba(20, 20, 40, 0.95);
    border: 2px solid #FFD700;
    border-radius: 20px;
    padding: 30px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    backdrop-filter: blur(15px);
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.campaign-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}

.campaign-header h2 {
    color: #FFD700;
    margin: 0;
    font-size: 2.2em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.campaign-header p {
    color: #CCC;
    margin: 5px 0 0 0;
    font-size: 1.1em;
}

.campaign-body {
    padding: 20px 0;
}

.campaign-progress {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 15px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.progress-item {
    text-align: center;
    color: #FFD700;
    font-weight: bold;
}

.progress-item span:first-child {
    display: block;
    font-size: 0.9em;
    margin-bottom: 5px;
    color: #CCC;
}

.progress-item span:last-child {
    font-size: 1.4em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Level Selection Modal */
.level-select {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
    backdrop-filter: blur(10px);
}

.level-content {
    background: rgba(20, 20, 40, 0.95);
    border: 2px solid #FFD700;
    border-radius: 20px;
    padding: 30px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    backdrop-filter: blur(15px);
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.level-header {
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    text-align: center;
    position: relative;
}

.level-header h3 {
    color: white;
    margin: 0 0 10px 0;
    font-size: 2em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.level-header p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-size: 1.1em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.level-body {
    padding: 20px 0;
}

.level-select-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.level-select-content {
    background: rgba(20, 20, 40, 0.95);
    border: 2px solid #FFD700;
    border-radius: 20px;
    padding: 30px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    backdrop-filter: blur(15px);
    position: relative;
}

.level-select-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}

.level-select-header h3 {
    color: #FFD700;
    margin: 0;
    font-size: 1.8em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.close-btn {
    background: #FF4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #FF6666;
    transform: scale(1.1);
}

/* Levels Grid */
.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

/* Level Cards */
.level-card {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.level-card:hover:not(.level-locked) {
    transform: translateY(-3px);
    border-color: #FFD700;
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.2);
}

.level-locked {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(70%);
}

.level-completed {
    background: rgba(0, 255, 0, 0.1);
    border-color: #4CAF50;
}

.level-number {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 215, 0, 0.8);
    color: #000;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1em;
}

.level-type {
    font-size: 2em;
    margin: 10px 0;
}

.level-objective {
    color: #DDD;
    font-size: 0.9em;
    margin: 10px 0;
    line-height: 1.3;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.level-stars {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 5px;
}

.star {
    font-size: 1.2em;
    transition: all 0.3s ease;
}

.star-earned {
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.star-empty {
    color: #666;
    opacity: 0.5;
}

.level-lock {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2em;
    color: #666;
    z-index: 2;
}

.boss-indicator {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
    transform: rotate(15deg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Campaign Mode Button */
.btn-campaign {
    background: linear-gradient(135deg, #8B4513, #D2691E, #FF8C00);
    border: 2px solid #FFD700;
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn-campaign:hover {
    background: linear-gradient(135deg, #D2691E, #FF8C00, #FFD700);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 140, 0, 0.4);
}

/* Objectives Display */
.objectives-display {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0;
    backdrop-filter: blur(10px);
}

.objectives-display h4 {
    color: #FFD700;
    margin: 0 0 10px 0;
    text-align: center;
    font-size: 1.1em;
}

.objective-item {
    color: #FFF;
    margin: 5px 0;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Level Start Notification */
.level-start-notification {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    cursor: pointer;
}

.notification-content {
    background: linear-gradient(135deg, #1a1a3a, #2a2a5a);
    border: 3px solid #FFD700;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    color: white;
    max-width: 500px;
    transform: scale(0.8);
    animation: levelStartPop 0.5s ease forwards;
}

.notification-content h3 {
    color: #FFD700;
    margin: 0 0 10px 0;
    font-size: 1.8em;
}

.notification-content h4 {
    color: #FFF;
    margin: 10px 0;
    font-size: 1.3em;
}

.notification-content p {
    color: #DDD;
    margin: 15px 0;
    font-size: 1.1em;
}

.notification-close {
    margin-top: 20px;
    color: #FFD700;
    font-style: italic;
    opacity: 0.8;
}

/* Campaign Completion/Failure Modals */
.campaign-completion-modal, .campaign-failure-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.completion-content, .failure-content {
    background: linear-gradient(135deg, #1a1a3a, #2a2a5a);
    border: 3px solid #FFD700;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    color: white;
    max-width: 500px;
    transform: scale(0.8);
    animation: modalPop 0.5s ease forwards;
}

.failure-content {
    border-color: #FF4444;
}

.completion-content h2, .failure-content h2 {
    margin: 0 0 20px 0;
    font-size: 2em;
}

.completion-realm, .failure-realm {
    color: #FFD700;
    font-size: 1.3em;
    margin: 10px 0;
}

.completion-level, .failure-level {
    color: #FFF;
    font-size: 1.1em;
    margin: 5px 0 20px 0;
}

.completion-stars {
    margin: 20px 0;
    font-size: 1.5em;
}

.completion-star {
    margin: 0 3px;
}

.completion-stats, .failure-stats {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
}

.stat {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
    font-size: 1em;
}

.stat-label {
    color: #DDD;
}

.stat-value {
    color: #FFD700;
    font-weight: bold;
}

.completion-buttons, .failure-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
    flex-wrap: wrap;
}

.btn-success {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border: 2px solid #4CAF50;
}

.btn-success:hover {
    background: linear-gradient(135deg, #45a049, #3d8b40);
}

/* Realm Unlock Notification */
.realm-unlock-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #1a1a3a, #2a2a5a);
    border: 3px solid #FFD700;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    color: white;
    z-index: 2000;
    animation: realmUnlockPulse 4s ease forwards;
}

.unlock-content h2 {
    color: #FFD700;
    margin: 0 0 20px 0;
    font-size: 1.8em;
}

.unlock-realm {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin: 15px 0;
}

.unlock-symbol {
    font-size: 3em;
    margin-bottom: 10px;
    animation: float 2s ease-in-out infinite;
}

.unlock-name {
    color: #FFF;
    font-size: 1.3em;
    margin: 10px 0;
    font-weight: bold;
}

.unlock-description {
    color: #DDD;
    font-size: 1em;
    margin: 10px 0;
}

/* Animations */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes levelStartPop {
    to { transform: scale(1); }
}

@keyframes modalPop {
    to { transform: scale(1); }
}

@keyframes realmUnlockPulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
    20% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
    80% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
}

/* Responsive Design for Campaign */
@media (max-width: 768px) {
    .campaign-header {
        padding: 15px;
    }
    
    .campaign-header h2 {
        font-size: 1.8em;
    }
    
    .campaign-progress {
        flex-direction: column;
        gap: 10px;
    }
    
    .realms-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .realm-card {
        padding: 20px;
    }
    
    .levels-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .level-card {
        min-height: 120px;
        padding: 15px;
    }
    
    .level-select-content {
        padding: 20px;
        margin: 20px;
    }
    
    .completion-content, .failure-content {
        padding: 25px;
        margin: 20px;
    }
    
    .completion-buttons, .failure-buttons {
        flex-direction: column;
        gap: 10px;
    }
}

/* MAIN MENU STYLES */

/* Main Menu Container */
.main-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #0f0f23, #1a1a3a, #2a2a5a, #1a1a3a, #0f0f23);
    background-size: 400% 400%;
    animation: menuBackgroundShift 15s ease-in-out infinite;
    overflow: hidden;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-menu-content {
    max-width: 1200px;
    width: 95%;
    height: auto;
    max-height: 95vh;
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    gap: 30px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 25px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Animated Background */
.menu-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.floating-gems {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.floating-gem {
    position: absolute;
    font-size: 2em;
    color: var(--color);
    animation: floatGem 8s ease-in-out infinite;
    animation-delay: var(--delay);
    opacity: 0.6;
    text-shadow: 0 0 20px var(--color);
    pointer-events: none;
}

.floating-gem:nth-child(1) { top: 10%; left: 10%; }
.floating-gem:nth-child(2) { top: 20%; left: 80%; }
.floating-gem:nth-child(3) { top: 40%; left: 15%; }
.floating-gem:nth-child(4) { top: 60%; left: 75%; }
.floating-gem:nth-child(5) { top: 80%; left: 20%; }
.floating-gem:nth-child(6) { top: 70%; left: 85%; }
.floating-gem:nth-child(7) { top: 30%; left: 90%; }

.particle-field {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(2px 2px at 20px 30px, rgba(255, 255, 255, 0.3), transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255, 215, 0, 0.3), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(135, 206, 235, 0.3), transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255, 69, 0, 0.3), transparent),
        radial-gradient(2px 2px at 160px 30px, rgba(50, 205, 50, 0.3), transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: particles 20s linear infinite;
    pointer-events: none;
    z-index: 1;
}

.divine-aura {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60%;
    height: 60%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 215, 0, 0.1) 0%, rgba(255, 69, 0, 0.05) 30%, transparent 70%);
    border-radius: 50%;
    animation: divineAuraPulse 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes divineAuraPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.3; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.1; }
}

/* Enhanced Hero Section */
.menu-hero {
    text-align: center;
    width: 100%;
    flex-shrink: 0;
    position: relative;
    padding: 20px 0;
}

.hero-content {
    position: relative;
    z-index: 10;
}

.main-title-container {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
}

.main-title {
    font-family: 'Georgia', serif;
    font-weight: bold;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 10;
}

.title-line {
    font-size: 3em;
    background: linear-gradient(45deg, #FFD700, #FFA500, #FF6347, #FFD700);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px rgba(255, 215, 0, 0.6);
    animation: titleGlow 3s ease-in-out infinite;
    letter-spacing: 3px;
    text-align: center;
    line-height: 1;
    margin: 0;
    position: relative;
}

.title-subtitle {
    font-size: 1.4em;
    color: #87CEEB;
    text-shadow: 0 0 25px rgba(135, 206, 235, 0.8);
    letter-spacing: 4px;
    font-weight: 300;
    text-align: center;
    margin: 0;
}

.title-effects {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    pointer-events: none;
    z-index: -1;
}

.divine-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 215, 0, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    animation: divineGlowPulse 4s ease-in-out infinite;
}

.power-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 150%;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 50%;
    animation: powerRingsRotate 10s linear infinite;
}

.power-rings::before,
.power-rings::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    border: 1px solid rgba(135, 206, 235, 0.2);
}

.power-rings::before {
    width: 80%;
    height: 80%;
    transform: translate(-50%, -50%);
    animation: powerRingsRotate 8s linear infinite reverse;
}

.power-rings::after {
    width: 60%;
    height: 60%;
    transform: translate(-50%, -50%);
    border-color: rgba(255, 69, 0, 0.2);
    animation: powerRingsRotate 6s linear infinite;
}

.main-tagline {
    color: #DDA0DD;
    font-size: 1em;
    margin: 15px 0 25px 0;
    text-shadow: 0 0 15px rgba(221, 160, 221, 0.6);
    font-style: italic;
    text-align: center;
    max-width: 700px;
    line-height: 1.4;
    font-weight: 300;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.stat-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.stat-preview:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.stat-icon {
    font-size: 1.2em;
    filter: drop-shadow(0 0 5px currentColor);
}

.stat-text {
    color: #f0f0f0;
    font-size: 0.9em;
    font-weight: 500;
    letter-spacing: 0.5px;
}

@keyframes divineGlowPulse {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.1); }
}

@keyframes powerRingsRotate {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Enhanced Game Mode Selection */
.menu-modes {
    text-align: center;
    width: 100%;
    margin: 30px 0;
}

.modes-header {
    margin-bottom: 30px;
}

.modes-title {
    color: #FFD700;
    font-size: 1.6em;
    margin: 0 0 10px 0;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    font-weight: bold;
    position: relative;
    display: inline-block;
}

.modes-icon {
    margin-right: 10px;
    filter: drop-shadow(0 0 10px currentColor);
}

.modes-underline {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #FFD700, transparent);
    animation: underlineGlow 2s ease-in-out infinite;
}

.modes-subtitle {
    color: #87CEEB;
    font-size: 0.95em;
    margin: 10px 0 0 0;
    text-shadow: 0 0 10px rgba(135, 206, 235, 0.4);
    font-style: italic;
    opacity: 0.9;
}

.modes-container {
    position: relative;
}

.modes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

@keyframes underlineGlow {
    0%, 100% { opacity: 0.5; transform: translateX(-50%) scaleX(1); }
    50% { opacity: 1; transform: translateX(-50%) scaleX(1.2); }
}

/* Enhanced Menu Buttons */
.menu-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 0;
    color: #FFF;
    cursor: pointer;
    transition: all 0.4s ease;
    backdrop-filter: blur(15px);
    position: relative;
    overflow: hidden;
    text-align: center;
    height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    z-index: 20;
    box-sizing: border-box;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.menu-btn.featured {
    border-color: rgba(255, 215, 0, 0.4);
    box-shadow: 0 8px 32px rgba(255, 215, 0, 0.1);
}

.btn-badge {
    position: absolute;
    top: -1px;
    right: -1px;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #000;
    font-size: 0.7em;
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 0 18px 0 15px;
    letter-spacing: 0.5px;
    text-shadow: none;
    z-index: 10;
}

.btn-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 25px 20px 20px 20px;
    height: 100%;
    justify-content: center;
    position: relative;
    z-index: 5;
}

.btn-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: 18px;
    pointer-events: none;
}

.btn-difficulty {
    color: #FFD700;
    font-size: 0.85em;
    font-weight: bold;
    margin-top: 5px;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.menu-btn:hover,
.menu-btn-hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(255, 215, 0, 0.6);
    box-shadow: 0 15px 35px rgba(255, 215, 0, 0.4);
    background: rgba(255, 255, 255, 0.12);
}

.menu-btn:hover .btn-glow,
.menu-btn-hover .btn-glow {
    opacity: 1;
}

.menu-btn:hover .btn-icon,
.menu-btn-hover .btn-icon {
    text-shadow: 0 0 20px currentColor;
}

.menu-btn:active {
    transform: translateY(-4px);
}

.btn-icon {
    font-size: 2.8em;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 15px currentColor);
    transition: all 0.3s ease;
}

.menu-btn:hover .btn-icon {
    transform: scale(1.1);
    filter: drop-shadow(0 0 20px currentColor);
}

.btn-title {
    font-size: 1.2em;
    font-weight: bold;
    margin: 0 0 8px 0;
    color: #FFD700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    letter-spacing: 0.8px;
}

.btn-desc {
    font-size: 0.85em;
    color: #E0E0E0;
    line-height: 1.4;
    opacity: 0.95;
    margin: 0;
    max-width: 200px;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.menu-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.menu-btn:hover::before {
    left: 100%;
}

.menu-btn:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: #FFD700;
    box-shadow: 0 15px 35px rgba(255, 215, 0, 0.3);
}

.btn-icon {
    font-size: 2.2em;
    margin: 0;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.5));
    flex-shrink: 0;
}

.btn-title {
    font-size: 1.1em;
    font-weight: bold;
    margin: 0;
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    flex-shrink: 0;
    line-height: 1.2;
}

.btn-desc {
    font-size: 0.85em;
    color: #DDD;
    line-height: 1.3;
    opacity: 0.9;
    margin: 0;
    text-align: center;
    flex-shrink: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Mode-specific styling */
.mode-normal:hover {
    border-color: #87CEEB;
    box-shadow: 0 15px 35px rgba(135, 206, 235, 0.3);
}

.mode-time:hover {
    border-color: #FF6347;
    box-shadow: 0 15px 35px rgba(255, 99, 71, 0.3);
}

.mode-daily:hover {
    border-color: #98FB98;
    box-shadow: 0 15px 35px rgba(152, 251, 152, 0.3);
}

.mode-campaign:hover {
    border-color: #DDA0DD;
    box-shadow: 0 15px 35px rgba(221, 160, 221, 0.3);
}

/* Enhanced Game Information */
.menu-info {
    text-align: center;
    width: 100%;
    margin: 25px 0;
}

.info-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.info-main {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.info-section {
    margin-bottom: 0;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.info-section h3 {
    color: #FFD700;
    font-size: 1.4em;
    margin: 0 0 15px 0;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.info-icon {
    filter: drop-shadow(0 0 10px currentColor);
}

.info-section p {
    color: #DDD;
    line-height: 1.6;
    opacity: 0.95;
    font-size: 1em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    max-width: 700px;
    margin: 0 auto;
}

/* Divine Gems Preview */
.gems-preview {
    margin-top: 20px;
}

.gems-preview h4 {
    color: #9932CC;
    font-size: 1.1em;
    margin: 0 0 15px 0;
    text-shadow: 0 0 15px rgba(153, 50, 204, 0.5);
}

.gems-showcase {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.gem-preview {
    font-size: 2em;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    cursor: pointer;
    filter: drop-shadow(0 0 10px currentColor);
}

.gem-preview:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

.gem-preview.fire:hover { 
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.4); 
    background: linear-gradient(145deg, #FF6B35, #FF4500);
}
.gem-preview.water:hover { 
    box-shadow: 0 8px 25px rgba(76, 201, 240, 0.4); 
    background: linear-gradient(145deg, #4CC9F0, #219EBC);
}
.gem-preview.earth:hover { 
    box-shadow: 0 8px 25px rgba(212, 165, 116, 0.4); 
    background: linear-gradient(145deg, #D4A574, #B08D57);
}
.gem-preview.air:hover { 
    box-shadow: 0 8px 25px rgba(184, 230, 230, 0.4); 
    background: linear-gradient(145deg, #B8E6E6, #87CEEB);
}
.gem-preview.lightning:hover { 
    box-shadow: 0 8px 25px rgba(255, 224, 102, 0.4); 
    background: linear-gradient(145deg, #FFE066, #FFD23F);
}
.gem-preview.nature:hover { 
    box-shadow: 0 8px 25px rgba(139, 195, 74, 0.4); 
    background: linear-gradient(145deg, #8BC34A, #4CAF50);
}
.gem-preview.magic:hover { 
    box-shadow: 0 8px 25px rgba(156, 39, 176, 0.4); 
    background: linear-gradient(145deg, #9C27B0, #673AB7);
}

/* Enhanced Features Grid */
.info-features {
    margin-top: 0;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.feature {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.4s ease;
    backdrop-filter: blur(10px);
    text-align: left;
}

.feature:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.25);
}

.feature-icon {
    font-size: 2.2em;
    opacity: 0.9;
    filter: drop-shadow(0 0 10px currentColor);
    flex-shrink: 0;
}

.feature-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.feature-title {
    color: #FFD700;
    font-size: 1em;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    letter-spacing: 0.5px;
}

.feature-text {
    color: #DDD;
    font-size: 0.9em;
    font-weight: 400;
    opacity: 0.9;
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Enhanced Menu Footer */
.menu-footer {
    margin: 25px 0 0 0;
    width: 100%;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.footer-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 15px 25px;
    color: #FFF;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95em;
    font-weight: 500;
    white-space: nowrap;
    z-index: 20;
    box-sizing: border-box;
    height: 50px;
    min-width: 120px;
}

.footer-btn:hover {
    transform: translateY(-3px);
    border-color: #FFD700;
    box-shadow: 0 10px 25px rgba(255, 215, 0, 0.2);
    background: rgba(255, 255, 255, 0.15);
}

.footer-icon {
    font-size: 1.3em;
    filter: drop-shadow(0 0 8px currentColor);
}

.footer-text {
    font-weight: 500;
    letter-spacing: 0.5px;
}

.footer-version {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8em;
    text-align: center;
    font-style: italic;
    margin-top: 5px;
}

/* Game Interface (hidden initially) */
.game-interface {
    width: 100%;
    height: 100vh;
    overflow-y: auto;
}

/* Animations */
@keyframes menuBackgroundShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes floatGem {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(90deg); }
    50% { transform: translateY(-10px) rotate(180deg); }
    75% { transform: translateY(-25px) rotate(270deg); }
}

@keyframes particles {
    0% { transform: translateX(0px); }
    100% { transform: translateX(-200px); }
}

@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 30px rgba(255, 215, 0, 0.5); }
    50% { text-shadow: 0 0 40px rgba(255, 215, 0, 0.8), 0 0 60px rgba(255, 99, 71, 0.3); }
}

/* Enhanced Responsive Design */
@media (max-height: 700px) {
    .main-menu-content {
        height: 98vh;
        padding: 0.5vh 2vw;
        gap: 0.5vh;
    }
    
    .menu-header {
        max-height: 15vh;
    }
    
    .title-line {
        font-size: clamp(1.2rem, 3.5vw, 1.8em);
    }
    
    .title-subtitle {
        font-size: clamp(0.6rem, 2vw, 0.9em);
    }
    
    .main-tagline {
        font-size: clamp(0.55rem, 1.5vw, 0.75em);
    }
    
    .menu-modes {
        max-height: 40vh;
    }
    
    .modes-title {
        font-size: clamp(0.8rem, 2vw, 1.1em);
        margin: 0 0 0.5vh 0;
    }
    
    .modes-grid {
        max-height: 35vh;
        gap: 0.8vh 1vw;
    }
    
    .menu-btn {
        height: 12vh;
        min-height: 70px;
        max-height: 100px;
        padding: 0.8vh 1vw;
        gap: 0.2vh;
    }
    
    .btn-icon {
        font-size: clamp(1.2em, 3vw, 1.6em);
    }
    
    .btn-title {
        font-size: clamp(0.7rem, 1.8vw, 0.9em);
    }
    
    .btn-desc {
        font-size: clamp(0.6rem, 1.5vw, 0.75em);
    }
    
    .menu-info {
        max-height: 20vh;
    }
    
    .info-features {
        max-height: 12vh;
        gap: 0.5vh 1vw;
    }
    
    .feature {
        min-height: 30px;
        max-height: 35px;
        padding: 0.3vh 0.8vw;
    }
    
    .menu-footer {
        max-height: 6vh;
    }
    
    .footer-btn {
        min-height: 30px;
        max-height: 35px;
        padding: 0.5vh 1vw;
        font-size: clamp(0.6rem, 1.5vw, 0.75em);
    }
}

@media (max-width: 768px) {
    .main-menu-content {
        width: 98%;
        padding: 1vh 2vw;
        gap: 0.8vh;
    }

    .menu-header {
        max-height: 18vh;
    }

    .modes-grid {
        grid-template-columns: 1fr;
        gap: 1vh 1vw;
        max-height: 45vh;
    }

    .menu-btn {
        height: 16vh;
        min-height: 90px;
        max-height: 130px;
        padding: 1vh 1.5vw;
        gap: 0.5vh;
    }

    .btn-icon {
        font-size: clamp(1.6em, 4vw, 2em);
    }

    .btn-title {
        font-size: clamp(0.9rem, 2.5vw, 1.1em);
    }

    .btn-desc {
        font-size: clamp(0.7rem, 2vw, 0.85em);
    }

    .menu-info {
        max-height: 22vh;
    }

    .info-features {
        grid-template-columns: 1fr;
        gap: 0.8vh 1vw;
        max-height: 14vh;
    }

    .feature {
        min-height: 35px;
        max-height: 40px;
    }

    .menu-footer {
        flex-direction: column;
        align-items: center;
        gap: 0.8vh;
        max-height: 10vh;
    }

    .footer-btn {
        width: min(180px, 70vw);
        justify-content: center;
        padding: 1vh 3vw;
        min-height: 35px;
        max-height: 40px;
    }
}

@media (max-width: 480px) {
    .main-menu-content {
        width: 100%;
        padding: 0.5vh 1vw;
        gap: 0.5vh;
    }

    .floating-gem {
        font-size: 1.2em;
    }

    .menu-header {
        max-height: 16vh;
    }

    .title-line {
        font-size: clamp(1.1rem, 3vw, 1.6em);
        line-height: 0.9;
    }

    .title-subtitle {
        font-size: clamp(0.55rem, 1.8vw, 0.8em);
    }

    .main-tagline {
        font-size: clamp(0.5rem, 1.5vw, 0.7em);
    }

    .menu-modes {
        max-height: 50vh;
    }

    .modes-title {
        font-size: clamp(0.7rem, 2vw, 1em);
        margin: 0 0 0.3vh 0;
    }
    
    .modes-grid {
        gap: 0.8vh 1vw;
        max-height: 45vh;
    }
    
    .menu-btn {
        height: 18vh;
        min-height: 100px;
        max-height: 140px;
        padding: 1vh 1vw;
        gap: 0.3vh;
    }

    .btn-icon {
        font-size: clamp(1.4em, 3.5vw, 1.8em);
    }

    .btn-title {
        font-size: clamp(0.8rem, 2.2vw, 1em);
    }

    .btn-desc {
        font-size: clamp(0.65rem, 1.8vw, 0.8em);
    }

    .menu-info {
        max-height: 20vh;
    }

    .info-features {
        grid-template-columns: 1fr;
        gap: 0.5vh 1vw;
        max-height: 12vh;
    }

    .feature {
        padding: 0.4vh 1vw;
        min-height: 32px;
        max-height: 38px;
        flex-direction: row;
        text-align: left;
        gap: 0.5vw;
    }

    .feature-text {
        font-size: clamp(0.6rem, 1.6vw, 0.75em);
    }

    .menu-footer {
        max-height: 8vh;
        gap: 0.5vh;
    }

    .footer-btn {
        width: min(160px, 60vw);
        padding: 0.8vh 2vw;
        min-height: 32px;
        max-height: 36px;
        font-size: clamp(0.6rem, 1.6vw, 0.75em);
    }
}

@media (max-width: 360px) {
    .main-menu-content {
        width: 98%;
        padding: 10px;
        min-height: auto;
    }
    
    .menu-header {
        margin: 15px 0;
    }
    
    .menu-modes {
        margin: 15px 0;
    }
    
    .menu-info {
        margin: 15px 0;
    }
    
    .menu-footer {
        margin: 20px 0 30px 0;
    }
    
    .btn-icon {
        font-size: 2em;
    }
    
    .info-section {
        padding: 15px;
        margin-bottom: 20px;
    }
}

/* Ultra small screens and landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
    .main-menu-content {
        height: 100vh;
        padding: 0.3vh 1vw;
        gap: 0.3vh;
    }
    
    .menu-header {
        max-height: 12vh;
    }
    
    .title-line {
        font-size: clamp(1rem, 2.5vw, 1.4em);
        line-height: 0.8;
    }
    
    .title-subtitle {
        font-size: clamp(0.5rem, 1.5vw, 0.7em);
    }
    
    .main-tagline {
        font-size: clamp(0.45rem, 1.2vw, 0.6em);
    }
    
    .menu-modes {
        max-height: 50vh;
    }
    
    .modes-title {
        font-size: clamp(0.65rem, 1.8vw, 0.9em);
        margin: 0 0 0.2vh 0;
    }
    
    .modes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5vh 1vw;
        max-height: 45vh;
    }
    
    .menu-btn {
        height: 20vh;
        min-height: 70px;
        max-height: 100px;
        padding: 0.5vh 0.8vw;
        gap: 0.2vh;
    }
    
    .btn-icon {
        font-size: clamp(1.2em, 2.5vw, 1.5em);
    }
    
    .btn-title {
        font-size: clamp(0.7rem, 1.8vw, 0.85em);
        line-height: 1;
    }
    
    .btn-desc {
        font-size: clamp(0.55rem, 1.4vw, 0.7em);
        line-height: 1;
        -webkit-line-clamp: 1;
    }
    
    .menu-info {
        max-height: 20vh;
    }
    
    .info-section {
        padding: 0.5vh 1vw;
        margin-bottom: 0.5vh;
    }
    
    .info-features {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.3vh 0.8vw;
        max-height: 12vh;
    }
    
    .feature {
        padding: 0.3vh 0.6vw;
        min-height: 25px;
        max-height: 30px;
        font-size: 0.65rem;
    }
    
    .feature-text {
        font-size: clamp(0.5rem, 1.3vw, 0.65em);
    }
    
    .menu-footer {
        max-height: 8vh;
        gap: 0.3vh;
    }
    
    .footer-btn {
        padding: 0.4vh 1vw;
        font-size: clamp(0.55rem, 1.4vw, 0.7em);
        min-height: 25px;
        max-height: 30px;
    }
}

/* Modal Dialogs */
.game-info-modal,
.credits-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    animation: modalFadeIn 0.3s ease;
}

.modal-content {
    background: linear-gradient(145deg, rgba(26, 26, 58, 0.95), rgba(13, 13, 26, 0.95));
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 20px;
    max-width: 600px;
    max-height: 80vh;
    width: 90%;
    backdrop-filter: blur(15px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
    animation: modalSlideIn 0.4s ease;
    position: relative;
}

.modal-header {
    padding: 25px 30px 15px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #FFD700;
    margin: 0;
    font-size: 1.6em;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.modal-header .close-btn {
    background: #FF4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-header .close-btn:hover {
    background: #FF6666;
    transform: scale(1.1);
}

.modal-body {
    padding: 25px 30px 30px;
    overflow-y: auto;
    max-height: 60vh;
    color: #FFF;
}

.guide-section,
.credits-section {
    margin-bottom: 25px;
}

.guide-section h3,
.credits-section h3 {
    color: #87CEEB;
    font-size: 1.3em;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(135, 206, 235, 0.5);
}

.guide-section ul,
.credits-section ul {
    margin: 10px 0;
    padding-left: 25px;
}

.guide-section li,
.credits-section li {
    margin: 8px 0;
    line-height: 1.5;
    color: #DDD;
}

.guide-section p,
.credits-section p {
    color: #DDD;
    line-height: 1.6;
    margin: 10px 0;
}

.gems-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.gem-info {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.gem-icon {
    font-size: 1.5em;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
}

/* Menu Button for In-Game */
.btn-menu {
    background: linear-gradient(135deg, #6a5acd, #9370db);
    border: 2px solid #9370db;
    color: white;
    font-weight: 500;
}

.btn-menu:hover {
    background: linear-gradient(135deg, #9370db, #dda0dd);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(147, 112, 219, 0.4);
}

/* Modal Animations */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Scrollbar */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #FFA500, #FFD700);
}

/* Responsive Modal Design */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 85vh;
        margin: 20px;
    }
    
    .modal-header {
        padding: 20px 20px 10px;
    }
    
    .modal-header h2 {
        font-size: clamp(1.2rem, 4vw, 1.4em);
    }
    
    .modal-body {
        padding: 20px;
        max-height: 65vh;
    }
    
    .gems-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .gem-info {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 98%;
        margin: 10px;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 15px 15px 10px;
    }
    
    .modal-header h2 {
        font-size: clamp(1.1rem, 5vw, 1.2em);
    }
    
    .modal-body {
        padding: 15px;
        max-height: 70vh;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .game-info-modal,
    .credits-modal {
        padding: 5px;
    }
    
    .modal-content {
        width: 100%;
        height: 100vh;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .modal-body {
        max-height: 80vh;
    }
}

/* HOME BUTTON - Global Navigation */
.home-button {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 50%;
    backdrop-filter: blur(15px);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        inset 0 2px 8px rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.4s ease;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFD700;
    font-size: 1.4em;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    overflow: hidden;
    user-select: none;
}

.home-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 215, 0, 0.1), transparent);
    border-radius: 50%;
    transform: translateX(-100%) rotate(45deg);
    transition: transform 0.6s ease;
}

.home-button:hover::before {
    transform: translateX(100%) rotate(45deg);
}

.home-button:hover {
    transform: translateY(-3px) scale(1.05);
    border-color: rgba(255, 215, 0, 0.6);
    box-shadow: 
        0 12px 35px rgba(255, 215, 0, 0.25),
        0 0 25px rgba(255, 215, 0, 0.4),
        inset 0 2px 8px rgba(255, 255, 255, 0.3);
    text-shadow: 
        0 0 20px rgba(255, 215, 0, 0.8),
        0 0 30px rgba(255, 215, 0, 0.4);
}

.home-button:active {
    transform: translateY(-1px) scale(1.02);
    transition: all 0.1s ease;
}

.home-button .home-icon {
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.4));
    transition: all 0.3s ease;
}

.home-button:hover .home-icon {
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.8));
    animation: homeIconPulse 2s ease-in-out infinite;
}

/* Home button pulse animation */
@keyframes homeIconPulse {
    0%, 100% { 
        transform: scale(1); 
        filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.8));
    }
    50% { 
        transform: scale(1.1); 
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 1));
    }
}

/* Hide home button on main menu screen */
.main-menu .home-button {
    display: none;
}

/* Responsive positioning for home button */
@media (max-width: 768px) {
    .home-button {
        top: 15px;
        left: 15px;
        width: 45px;
        height: 45px;
        font-size: 1.2em;
    }
}

@media (max-width: 480px) {
    .home-button {
        top: 12px;
        left: 12px;
        width: 40px;
        height: 40px;
        font-size: 1.1em;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .home-button {
        top: 10px;
        left: 10px;
        width: 38px;
        height: 38px;
        font-size: 1em;
    }
}

/* Accessibility and focus states */
.home-button:focus {
    outline: none;
    border-color: rgba(255, 215, 0, 0.8);
    box-shadow: 
        0 0 0 3px rgba(255, 215, 0, 0.3),
        0 8px 25px rgba(255, 215, 0, 0.3),
        inset 0 2px 8px rgba(255, 255, 255, 0.2);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .home-button {
        border-color: #FFD700;
        background: rgba(0, 0, 0, 0.8);
        color: #FFD700;
    }
    
    .home-button:hover {
        border-color: #FFFF00;
        color: #FFFF00;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .home-button,
    .home-button::before,
    .home-button .home-icon {
        animation: none !important;
        transition: none !important;
    }
    
    .home-button:hover {
        transform: none;
    }
}

/* Alternative home button for very small screens */
@media (max-width: 360px) {
    .home-button {
        top: 8px;
        left: 8px;
        width: 36px;
        height: 36px;
        font-size: 0.9em;
        border-width: 1px;
    }
}

/* Existing styles start here... */

/* Enhanced Power-Up Styling */
.gem.power-up {
    position: relative;
    animation: powerUpPulse 2s ease-in-out infinite;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gem.power-up::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 2px solid #FFD700;
    border-radius: 13px;
    animation: powerUpBorder 2s ease-in-out infinite;
}

/* Power-Up Base Styling */
.gem.power-up-pulse {
    animation: powerUpPulse 2s ease-in-out infinite, powerUpBorder 2s ease-in-out infinite;
}

/* Lightning Power-Up Specific Styling */
.gem.lightning-power-up {
    background: linear-gradient(45deg, #FFD700, #FFA500, #FF8C00, #FFD700) !important;
    background-size: 400% 400%;
    animation: lightningGradient 1.5s ease infinite, powerUpPulse 2s ease-in-out infinite;
}

.gem.lightning-power-up .power-up-icon {
    font-size: 1.8em;
    position: absolute;
    top: -5px;
    right: -5px;
    animation: lightningIcon 1s ease-in-out infinite;
    text-shadow: 0 0 10px #FFD700;
    z-index: 2;
}

.gem.lightning-power-up .gem-base {
    font-size: 1.2em;
    font-weight: bold;
    color: #000;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 1;
}

/* Bomb Power-Up Specific Styling */
.gem.bomb-power-up {
    background: linear-gradient(45deg, #FF4500, #FF6347, #DC143C, #FF4500) !important;
    background-size: 400% 400%;
    animation: bombGradient 1.8s ease infinite, powerUpPulse 2s ease-in-out infinite;
}

.gem.bomb-power-up .power-up-icon {
    font-size: 1.8em;
    position: absolute;
    top: -5px;
    right: -5px;
    animation: bombIcon 1.2s ease-in-out infinite;
    text-shadow: 0 0 10px #FF4500;
    z-index: 2;
}

.gem.bomb-power-up .gem-base {
    font-size: 1.2em;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 1;
}

/* Rainbow Power-Up Specific Styling */
.gem.rainbow-power-up {
    background: linear-gradient(45deg, #9400D3, #4B0082, #0000FF, #00FF00, #FFFF00, #FF7F00, #FF0000) !important;
    background-size: 700% 700%;
    animation: rainbowGradient 2s ease infinite, powerUpPulse 2s ease-in-out infinite;
}

.gem.rainbow-power-up .power-up-icon {
    font-size: 1.8em;
    position: absolute;
    top: -5px;
    right: -5px;
    animation: rainbowIcon 1.5s ease-in-out infinite;
    text-shadow: 0 0 10px #9400D3;
    z-index: 2;
}

.gem.rainbow-power-up .gem-base {
    font-size: 1.2em;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 1;
}

/* Power-Up Animations */
@keyframes lightningGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes lightningIcon {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: scale(1.2) rotate(-5deg);
        opacity: 0.8;
    }
    75% {
        transform: scale(1.1) rotate(5deg);
        opacity: 0.9;
    }
}

@keyframes bombGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes bombIcon {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    30% {
        transform: scale(1.3) rotate(-3deg);
        opacity: 0.9;
    }
    60% {
        transform: scale(0.9) rotate(3deg);
        opacity: 0.8;
    }
}

@keyframes rainbowGradient {
    0% { background-position: 0% 50%; }
    25% { background-position: 25% 75%; }
    50% { background-position: 100% 50%; }
    75% { background-position: 75% 25%; }
    100% { background-position: 0% 50%; }
}

@keyframes rainbowIcon {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
        filter: hue-rotate(0deg);
    }
    25% {
        transform: scale(1.1) rotate(-2deg);
        opacity: 0.9;
        filter: hue-rotate(90deg);
    }
    50% {
        transform: scale(1.2) rotate(0deg);
        opacity: 0.8;
        filter: hue-rotate(180deg);
    }
    75% {
        transform: scale(1.1) rotate(2deg);
        opacity: 0.9;
        filter: hue-rotate(270deg);
    }
}

/* Power-Up Activation Animation */
@keyframes powerUpActivation {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }
    20% {
        transform: scale(1.3);
        filter: brightness(2);
    }
    40% {
        transform: scale(1.1);
        filter: brightness(1.8);
    }
    60% {
        transform: scale(1.4);
        filter: brightness(2.5);
    }
    80% {
        transform: scale(0.8);
        filter: brightness(1.2);
    }
    100% {
        transform: scale(0);
        filter: brightness(0);
        opacity: 0;
    }
}

.gem.power-up-activating {
    z-index: 100;
    animation: powerUpActivation 0.8s ease-out forwards;
}

/* Lightning Strike Effects */
.lightning-line {
    position: absolute;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #FFD700 20%, 
        #FFFFFF 50%, 
        #FFD700 80%, 
        transparent 100%
    );
    z-index: 50;
    animation: lightningStrike 0.6s ease-out;
    box-shadow: 0 0 20px #FFD700, 0 0 40px #FFD700;
    border-radius: 2px;
}

.lightning-line.lightning-horizontal {
    background: linear-gradient(90deg, 
        transparent 0%, 
        #FFD700 20%, 
        #FFFFFF 50%, 
        #FFD700 80%, 
        transparent 100%
    );
}

.lightning-line.lightning-vertical {
    background: linear-gradient(0deg, 
        transparent 0%, 
        #FFD700 20%, 
        #FFFFFF 50%, 
        #FFD700 80%, 
        transparent 100%
    );
}

@keyframes lightningStrike {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    10% {
        opacity: 1;
        transform: scale(1.2);
    }
    30% {
        opacity: 0.8;
        transform: scale(1);
    }
    60% {
        opacity: 0.9;
        transform: scale(1.1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8);
    }
}

/* Lightning Struck Gem Animation */
.gem.lightning-struck {
    z-index: 40;
}

@keyframes lightningDissolve {
    0% {
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
    }
    20% {
        transform: scale(1.2);
        opacity: 0.9;
        filter: brightness(2) saturate(2);
    }
    40% {
        transform: scale(0.9);
        opacity: 0.7;
        filter: brightness(1.5) hue-rotate(30deg);
    }
    70% {
        transform: scale(1.1);
        opacity: 0.4;
        filter: brightness(3) blur(2px);
    }
    100% {
        transform: scale(0);
        opacity: 0;
        filter: brightness(0) blur(5px);
    }
}

/* Power-Up Message Styling */
.power-up-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, 
        rgba(255, 215, 0, 0.95), 
        rgba(255, 165, 0, 0.95)
    );
    color: #000;
    padding: 20px 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 
        0 10px 30px rgba(255, 215, 0, 0.5),
        inset 0 2px 10px rgba(255, 255, 255, 0.3);
    z-index: 1000;
    animation: powerUpMessageShow 2.5s ease-in-out forwards;
    border: 3px solid #FFD700;
}

.power-up-title {
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    animation: titlePulse 0.5s ease-in-out 3;
}

.power-up-description {
    font-size: 1.1em;
    margin-bottom: 8px;
    opacity: 0.9;
}

.power-up-score {
    font-size: 1.4em;
    font-weight: bold;
    color: #8B4513;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
}

@keyframes powerUpMessageShow {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    85% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

@keyframes titlePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
        color: #FF4500;
    }
}

/* Enhanced Power-Up Hover Effects */
.gem.power-up:hover {
    transform: scale(1.1);
    filter: brightness(1.3);
    transition: all 0.2s ease;
}

.gem.lightning-power-up:hover {
    animation-duration: 0.5s;
    box-shadow: 
        0 0 25px rgba(255, 215, 0, 1), 
        inset 0 0 25px rgba(255, 255, 255, 0.3),
        0 0 50px rgba(255, 215, 0, 0.5);
}

/* Bomb Power-Up Effects */
@keyframes bombExplosion {
    0% {
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
    }
    30% {
        transform: scale(1.5);
        opacity: 0.8;
        filter: brightness(3) saturate(2);
    }
    60% {
        transform: scale(0.8);
        opacity: 0.4;
        filter: brightness(1.5) contrast(2);
    }
    100% {
        transform: scale(0);
        opacity: 0;
        filter: brightness(0);
    }
}

@keyframes explosionBlast {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

/* Rainbow Power-Up Effects */
@keyframes rainbowDissolve {
    0% {
        transform: scale(1);
        opacity: 1;
        filter: brightness(1) hue-rotate(0deg);
    }
    25% {
        transform: scale(1.1);
        opacity: 0.9;
        filter: brightness(1.5) hue-rotate(90deg);
    }
    50% {
        transform: scale(0.9);
        opacity: 0.7;
        filter: brightness(2) hue-rotate(180deg);
    }
    75% {
        transform: scale(1.2);
        opacity: 0.4;
        filter: brightness(2.5) hue-rotate(270deg);
    }
    100% {
        transform: scale(0);
        opacity: 0;
        filter: brightness(0) hue-rotate(360deg);
    }
}

@keyframes rainbowWave {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .lightning-line {
        box-shadow: 0 0 15px #FFD700, 0 0 30px #FFD700;
    }
    
    .power-up-message {
        max-width: 90%;
        padding: 15px 20px;
        font-size: 0.9em;
    }
    
    .power-up-title {
        font-size: 1.5em;
    }
    
    .gem.lightning-power-up .power-up-icon {
        font-size: 1.5em;
        top: -3px;
        right: -3px;
    }
    
    .explosion-effect {
        font-size: 2em !important;
    }
}

/* Touch Device Enhancements */
@media (hover: none) and (pointer: coarse) {
    .gem {
        /* Larger tap targets for mobile */
        min-height: 50px;
        padding: 4px;
    }
    
    .gem:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    .gem.touch-active {
        background: linear-gradient(45deg, 
            rgba(255, 255, 255, 0.2) 0%,
            transparent 50%,
            rgba(255, 255, 255, 0.1) 100%);
        box-shadow: 
            inset 0 2px 4px rgba(0, 0, 0, 0.2),
            0 4px 8px rgba(0, 0, 0, 0.3);
    }
}

/* High-end mobile devices (retina displays) */
@media (min-resolution: 2dppx) {
    .gem::before {
        /* Enhanced crystal effect for high-DPI screens */
        background: linear-gradient(135deg, 
            rgba(255, 255, 255, 0.4) 0%,
            transparent 25%,
            transparent 75%,
            rgba(255, 255, 255, 0.15) 100%);
    }
    
    .game-board::before {
        /* Smoother divine rotation on high-DPI */
        will-change: transform;
        backface-visibility: hidden;
    }
}

/* Very small screens optimization */
@media (max-width: 360px) {
    .game-board {
        width: min(98vw, 360px);
        height: min(98vw, 360px);
        padding: 6px;
        gap: 1px;
        border-radius: 15px;
        border: 2px solid rgba(255, 255, 255, 0.4);
    }
    
    .gem {
        font-size: clamp(12px, 2.5vw, 16px);
        border-radius: 8px;
        min-height: 28px;
        border: 1px solid rgba(255, 255, 255, 0.5);
    }
    
    .gem:hover {
        transform: scale(1.02);
    }
    
    .gem.selected {
        transform: scale(1.04);
    }
}

/* Landscape mobile optimization */
@media (max-height: 500px) and (orientation: landscape) {
    .game-board {
        width: min(70vh, 400px);
        height: min(70vh, 400px);
        margin: 10px auto;
    }
}

/* Stage Map Layout Styles */
.stage-map-section {
    padding: 2rem 1rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.stage-container {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 2rem;
    align-items: center;
    min-height: 500px;
}

/* Left and Right Controls */
.left-controls,
.right-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.control-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 1rem;
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.control-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.control-btn.featured {
    border-color: #FFD700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.1));
}

.control-btn .btn-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.control-btn .btn-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

.control-btn .btn-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #FFD700;
    color: #000;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.6rem;
    font-weight: bold;
}

/* Central Map Area */
.stage-map-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.stage-header {
    text-align: center;
    margin-bottom: 1rem;
}

.stage-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stage-number {
    font-size: 2.2rem;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stage-type {
    font-size: 1rem;
    opacity: 0.8;
    color: #E6E6FA;
}

/* Square Map Display */
.stage-map-display {
    position: relative;
}

.map-container {
    width: 350px;
    height: 350px;
    position: relative;
    perspective: 1000px;
}

.stage-map-visual {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    border: 3px solid rgba(255, 215, 0, 0.3);
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    box-shadow: 
        0 0 30px rgba(255, 215, 0, 0.2),
        inset 0 0 50px rgba(255, 255, 255, 0.1);
    transform-style: preserve-3d;
    animation: mapFloat 4s ease-in-out infinite;
}

@keyframes mapFloat {
    0%, 100% { transform: translateY(0) rotateX(2deg); }
    50% { transform: translateY(-5px) rotateX(-2deg); }
}

.map-background {
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 30% 30%, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(138, 43, 226, 0.1) 0%, transparent 50%);
}

.divine-realm-bg {
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="stars" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="rgba(255,255,255,0.3)"/></pattern></defs><rect width="100" height="100" fill="url(%23stars)"/></svg>') repeat;
    opacity: 0.4;
    animation: starsRotate 20s linear infinite;
}

@keyframes starsRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.map-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255, 215, 0, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 215, 0, 0.1) 1px, transparent 1px);
    background-size: 35px 35px;
    opacity: 0.3;
}

.floating-essence {
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(2px 2px at 20px 30px, rgba(255, 215, 0, 0.8), transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(138, 43, 226, 0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(50, 205, 50, 0.8), transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(30, 144, 255, 0.8), transparent);
    background-repeat: repeat;
    background-size: 150px 150px;
    animation: essenceFloat 8s ease-in-out infinite;
}

@keyframes essenceFloat {
    0%, 100% { opacity: 0.6; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-10px); }
}

/* Current Stage Marker */
.current-stage-marker {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.marker-icon {
    font-size: 3rem;
    animation: markerPulse 2s ease-in-out infinite;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
}

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

.marker-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.3); opacity: 0.8; }
}

.marker-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 50%;
    animation: ringPulse 2s ease-in-out infinite;
}

@keyframes ringPulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* Stage Preview */
.stage-preview {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 10px;
    padding: 1rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.preview-content {
    text-align: center;
    color: white;
}

.preview-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #FFD700;
    margin-bottom: 0.25rem;
}

.preview-target {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.preview-type {
    font-size: 0.8rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Boss Stage Indicator */
.boss-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    background: linear-gradient(135deg, rgba(255, 0, 0, 0.9), rgba(139, 0, 0, 0.9));
    border-radius: 10px;
    padding: 0.75rem;
    text-align: center;
    border: 2px solid #FFD700;
    animation: bossGlow 2s ease-in-out infinite;
}

@keyframes bossGlow {
    0%, 100% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 0 25px rgba(255, 215, 0, 0.8); }
}

.boss-indicator.hidden {
    display: none;
}

.boss-crown {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.boss-text {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    color: #FFD700;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

/* Play Button */
.play-button-container {
    margin-top: 1.5rem;
}

.play-button {
    background: linear-gradient(135deg, #32CD32, #228B22);
    border: 3px solid #FFD700;
    border-radius: 25px;
    padding: 1.25rem 2.5rem;
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 0 6px 20px rgba(50, 205, 50, 0.3);
}

.play-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 35px rgba(50, 205, 50, 0.4);
    border-color: #FFA500;
}

.play-button:active {
    transform: translateY(-1px) scale(1.02);
}

.play-icon {
    font-size: 1.5rem;
    animation: playIconBounce 2s ease-in-out infinite;
}

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

.play-text {
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.play-effects {
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    transform: translateX(-100%);
    animation: playShine 3s ease-in-out infinite;
}

@keyframes playShine {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Stage Progress Section */
.stage-progress-section {
    margin-top: 3rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    color: white;
}

.progress-label {
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
}

.progress-stats {
    font-size: 0.9rem;
    opacity: 0.8;
}

.progress-bar {
    position: relative;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #32CD32, #FFD700);
    border-radius: 6px;
    transition: width 0.8s ease;
    position: relative;
}

.progress-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressGlow 2s ease-in-out infinite;
}

@keyframes progressGlow {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.next-boss-info {
    margin-top: 1rem;
    text-align: center;
    color: #FFD700;
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Responsive Design for Stage Map */
@media (max-width: 1024px) {
    .stage-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .left-controls,
    .right-controls {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .control-group {
        flex-direction: row;
        gap: 1rem;
    }
    
    .map-container {
        width: 300px;
        height: 300px;
    }
}

@media (max-width: 768px) {
    .stage-map-section {
        padding: 1rem 0.5rem;
    }
    
    .control-btn {
        min-height: 60px;
        padding: 0.75rem;
    }
    
    .control-btn .btn-icon {
        font-size: 1.2rem;
    }
    
    .control-btn .btn-label {
        font-size: 0.75rem;
    }
    
    .map-container {
        width: 250px;
        height: 250px;
    }
    
    .stage-title {
        font-size: 1.5rem;
    }
    
    .stage-number {
        font-size: 1.8rem;
    }
    
    .play-button {
        padding: 1rem 2rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .control-group {
        flex-direction: column;
    }
    
    .map-container {
        width: 200px;
        height: 200px;
    }
    
    .stage-progress-section {
        padding: 1rem;
    }
    
    .progress-info {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

/* =================================================================
   DARK MODE STYLES (Auto-applied based on system preference)
================================================================= */
@media (prefers-color-scheme: dark) {
  :root {
    --background-primary: #0a0a14;
    --background-secondary: #1a1a3a;
    --text-primary: #f0f0f0;
    --text-secondary: #c0c0c0;
    --accent-primary: #FFD700;
    --accent-secondary: #32CD32;
    --surface-primary: rgba(26, 26, 58, 0.9);
    --surface-secondary: rgba(13, 13, 26, 0.95);
  }
}

/* =================================================================
   GAME MODE SELECTOR STYLES
================================================================= */

.game-mode-selector {
  position: relative;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.mode-selector-btn {
  /* Remove all overriding styles to match exactly with control-btn */
}

.mode-content {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: center;
  gap: 8px;
}

.mode-arrow-left,
.mode-arrow-right {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.3s ease;
  z-index: 10;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.mode-arrow-left {
  left: 6px;
}

.mode-arrow-right {
  right: 6px;
}

.mode-arrow-left:hover,
.mode-arrow-right:hover {
  color: #FFD700;
  background: rgba(255, 215, 0, 0.2);
  transform: translateY(-50%) scale(1.1);
}

.mode-arrow-left:active,
.mode-arrow-right:active {
  transform: translateY(-50%) scale(0.9);
  background: rgba(255, 215, 0, 0.3);
}

/* Animation for mode selection */
@keyframes modeSelectionPulse {
  0% { 
    transform: scale(1); 
  }
  50% { 
    transform: scale(1.02); 
  }
  100% { 
    transform: scale(1); 
  }
}

/* Animation for mode slide transition */
@keyframes modeSlideIn {
  0% { 
    opacity: 0;
    transform: translateX(10px);
  }
  100% { 
    opacity: 1;
    transform: translateX(0);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .mode-arrow-left,
  .mode-arrow-right {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }
  
  .mode-arrow-left {
    left: 4px;
  }
  
  .mode-arrow-right {
    right: 4px;
  }
}

@media (max-width: 480px) {
  .mode-arrow-left,
  .mode-arrow-right {
    width: 16px;
    height: 16px;
    font-size: 8px;
  }
  
  .mode-arrow-left {
    left: 2px;
  }
  
  .mode-arrow-right {
    right: 2px;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .mode-selector-btn {
    border-width: 3px;
    border-color: #ffffff;
  }
  
  .mode-dropdown {
    border-width: 3px;
    border-color: #ffffff;
  }
  
  .mode-option:hover {
    background: rgba(255, 255, 255, 0.2);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .mode-selector-btn,
  .mode-dropdown,
  .mode-option,
  .mode-dropdown-arrow {
    transition: none;
  }
  
  .mode-selector-btn:hover {
    transform: none;
  }
}

/* Focus styles for accessibility */
.mode-selector-btn:focus,
.mode-option:focus {
  outline: 3px solid #FFD700;
  outline-offset: 2px;
}

/* Dark theme specific adjustments */
@media (prefers-color-scheme: dark) {
  .mode-selector-btn {
    background: linear-gradient(145deg, rgba(15, 15, 30, 0.95), rgba(8, 8, 16, 0.9));
  }
  
  .mode-dropdown {
    background: linear-gradient(145deg, rgba(15, 15, 30, 0.98), rgba(8, 8, 16, 0.95));
  }
}