/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7);
    background-size: 400% 400%;
    animation: gradientShift 3s ease infinite;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    height: 100vh;
    position: relative;
    touch-action: pan-y pinch-zoom;
}

/* Allow scrolling when game-over screen is visible */
body:has(.game-over-screen:not(.hidden)) {
    overflow: visible !important;
    touch-action: auto !important;
}

/* Fallback for browsers that don't support :has() */
@supports not (selector(:has(*))) {
    body.game-over-active {
        overflow: visible !important;
        touch-action: auto !important;
    }
}

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

/* Game Container */
.game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header Styles */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    z-index: 100;
    flex-wrap: wrap;
    gap: 10px;
}

/* Header Timer */
.header-timer {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 15px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.header-timer .timer-bar {
    width: 100px;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

.header-timer .timer-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #ffeb3b, #f44336);
    border-radius: 3px;
    transition: width 0.1s linear;
}

.header-timer .timer-text {
    color: white;
    font-weight: bold;
    font-size: 14px;
    min-width: 25px;
    text-align: center;
}

.score-container {
    display: flex;
    gap: 20px;
}

.score, .streak {
    text-align: center;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.score-label, .streak-label {
    display: block;
    font-size: 12px;
    font-weight: bold;
    opacity: 0.8;
}

.score-value, .streak-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
    margin-top: -2px;
}

.combo-multiplier {
    font-size: 28px;
    font-weight: bold;
    color: #ffeb3b;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    animation: pulse 0.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}

/* Game Area */
.game-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

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

.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

/* Start Screen */
.start-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    z-index: 250;
    background: rgba(0, 0, 0, 0.3);
    padding: 25px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    max-height: 85vh;
    overflow-y: auto;
}

.game-title {
    font-size: 2.2rem;
    margin-bottom: 8px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7);
    animation: titleBounce 2s ease-in-out infinite;
}

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

.title-emoji {
    display: inline-block;
    animation: spin 3s linear infinite;
}

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

.game-subtitle {
    font-size: 1rem;
    margin-bottom: 15px;
    opacity: 0.9;
}

.button-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
    z-index: 210;
    position: relative;
}

.start-btn, .restart-btn, .share-btn, .help-btn, .back-btn, .settings-btn {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.start-btn:hover, .restart-btn:hover, .share-btn:hover, .help-btn:hover, .back-btn:hover, .settings-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.instructions {
    margin-top: 15px;
    font-size: 0.85rem;
    line-height: 1.4;
}

.instructions p {
    margin: 3px 0;
    opacity: 0.8;
}

/* Button Container */
.button-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
}

.leaderboard-btn, .screenshot-btn {
    background: linear-gradient(45deg, #9c27b0, #673ab7);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.leaderboard-btn:hover, .screenshot-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.settings-btn {
    background: linear-gradient(45deg, #ff9800, #e91e63) !important;
}

/* Leaderboard Screen */
.leaderboard-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    color: white;
    z-index: 200;
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    box-sizing: border-box;
}

/* Visible scrollbars for mobile */
.leaderboard-screen::-webkit-scrollbar {
    width: 8px;
}

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

.leaderboard-screen::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.leaderboard-screen::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.leaderboard-screen .leaderboard-content {
    background: rgba(0, 0, 0, 0.4);
    padding: 30px;
    border-radius: 20px;
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 90%;
    max-width: 600px;
    margin: 20px auto;
    min-height: auto;
    flex-shrink: 0;
}

.leaderboard-title {
    font-size: 2rem;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7);
    color: #ffeb3b;
}

.leaderboard-position {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: #4ecdc4;
    margin: 15px 0;
    padding: 10px;
    background: rgba(78, 205, 196, 0.2);
    border-radius: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.mini-leaderboard {
    margin: 20px 0;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #ffeb3b;
}

.mini-leaderboard h4 {
    text-align: center;
    margin-bottom: 15px;
    color: #ffeb3b;
    font-size: 1.1rem;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.leaderboard-item .rank {
    font-weight: bold;
    min-width: 60px;
}

.leaderboard-item .score {
    font-weight: bold;
    color: #ffeb3b;
    flex: 1;
    text-align: center;
}

.leaderboard-item .date {
    font-size: 0.8rem;
    opacity: 0.7;
    min-width: 80px;
    text-align: right;
}

/* Full leaderboard specific styles */
.full-leaderboard .leaderboard-item {
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.full-leaderboard .leaderboard-item .details {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 2px;
}

.full-leaderboard .leaderboard-item .score {
    font-size: 1.1rem;
    text-align: left;
}

.full-leaderboard .leaderboard-item .streak {
    font-size: 0.9rem;
    color: #4ecdc4;
}

.full-leaderboard .leaderboard-item .datetime {
    font-size: 0.8rem;
    opacity: 0.7;
}

.empty-leaderboard {
    text-align: center;
    padding: 40px 20px;
    font-size: 1.1rem;
    color: #4ecdc4;
    background: rgba(78, 205, 196, 0.1);
    border-radius: 10px;
    border: 2px dashed rgba(78, 205, 196, 0.3);
}

/* Mobile touch optimization for all interactive elements */
button, .emoji, .power-up {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

/* Game Over Screen */
.game-over-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    color: white;
    text-align: center;
    z-index: 1000;
    overflow-y: scroll !important;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    box-sizing: border-box;
    min-height: 100vh;
    padding-bottom: 50px;
    touch-action: auto !important;
}

/* Visible scrollbars for mobile */
.game-over-screen::-webkit-scrollbar {
    width: 8px;
}

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

.game-over-screen::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.game-over-screen::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.game-over-content {
    background: rgba(0, 0, 0, 0.4);
    padding: 40px;
    border-radius: 20px;
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    margin: 20px auto;
    max-width: 500px;
    width: 100%;
    box-sizing: border-box;
    min-height: auto;
    flex-shrink: 0;
}

.game-over-title {
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7);
}

.final-stats {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
    gap: 20px;
}

.final-score, .max-streak {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 14px;
    opacity: 0.8;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #ffeb3b;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.achievement {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 235, 59, 0.2);
    border-radius: 10px;
    font-weight: bold;
    font-size: 1.1rem;
}

/* Help Screen Styles */
.help-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    color: white;
    z-index: 200;
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    box-sizing: border-box;
}

/* Visible scrollbars for mobile */
.help-screen::-webkit-scrollbar {
    width: 8px;
}

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

.help-screen::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.help-screen::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.help-screen .help-content-wrapper {
    background: rgba(0, 0, 0, 0.4);
    padding: 30px;
    border-radius: 20px;
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 90%;
    max-width: 600px;
    margin: 20px auto;
    min-height: auto;
    flex-shrink: 0;
}

.help-title {
    font-size: 2rem;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7);
    color: #ffeb3b;
}

.help-content {
    text-align: left;
}

.help-section {
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border-left: 4px solid #ff6b6b;
}

.help-section h3 {
    color: #4ecdc4;
    margin-bottom: 10px;
    font-size: 1.3rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.help-section p {
    margin: 8px 0;
    line-height: 1.4;
    font-size: 0.95rem;
}

.common-emoji {
    color: #ffffff;
    font-weight: bold;
}

.rare-emoji {
    color: #ffeb3b;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 235, 59, 0.5);
}

.legendary-emoji {
    color: #ff6b6b;
    font-weight: bold;
    text-shadow: 0 0 15px rgba(255, 107, 107, 0.8);
}

.rainbow-text {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
}

.freeze-text {
    color: #87ceeb;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(135, 206, 235, 0.6);
}

/* Game UI */
.game-ui {
    position: fixed;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: none; /* Hidden by default, shown during game */
    flex-direction: row;
    align-items: center;
    gap: 15px;
    z-index: 150; /* Higher z-index to stay above emojis */
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 16px;
    border-radius: 20px;
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.game-ui.active {
    display: flex;
}



.power-ups {
    display: flex;
    gap: 15px;
}

.power-up {
    background: rgba(255, 255, 255, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 15px;
    padding: 12px 18px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 60px;
    min-height: 70px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 160; /* Even higher z-index for power-up buttons */
}

.power-up:hover, .power-up.active {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.power-up-emoji {
    font-size: 24px;
}

.power-up-text {
    font-size: 12px;
    font-weight: bold;
}

/* Sound Toggle */
.sound-toggle {
    position: absolute;
    top: 80px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 18px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    color: white;
    transition: all 0.3s ease;
    z-index: 150;
}

.sound-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Emoji Styles */
.emoji {
    position: absolute;
    font-size: 40px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    animation: emojiFloat 2s ease-in-out infinite;
    z-index: 10;
    transition: all 0.1s ease;
    touch-action: manipulation;
}

.emoji:hover {
    transform: scale(1.2);
}

.emoji.clicked {
    animation: emojiPop 0.3s ease-out forwards;
    pointer-events: none;
}

.emoji.rare {
    font-size: 50px;
    animation: emojiFloat 1.5s ease-in-out infinite, rarePulse 1s ease-in-out infinite;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

.emoji.legendary {
    font-size: 60px;
    animation: emojiFloat 1s ease-in-out infinite, legendaryGlow 0.5s ease-in-out infinite;
    text-shadow: 0 0 30px rgba(255, 0, 255, 1);
}

@keyframes emojiFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(-5deg); }
    75% { transform: translateY(-5px) rotate(5deg); }
}

@keyframes emojiPop {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.8; }
    100% { transform: scale(0); opacity: 0; }
}

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

@keyframes legendaryGlow {
    0%, 100% { text-shadow: 0 0 30px rgba(255, 0, 255, 1); }
    50% { text-shadow: 0 0 40px rgba(255, 0, 255, 1), 0 0 50px rgba(255, 215, 0, 0.8); }
}

/* Particle Effects */
.particle {
    position: absolute;
    pointer-events: none;
    font-size: 20px;
    animation: particleFloat 1s ease-out forwards;
    z-index: 40;
}

.chaos-particle {
    position: absolute;
    pointer-events: none;
    font-size: 24px;
    z-index: 45;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(0.5);
    }
}

/* Screen Effects */
.screen-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.8);
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
}

.screen-flash.active {
    animation: flash 0.2s ease-out;
}

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

/* Screen Shake */
.shake {
    animation: shake 0.5s ease-in-out;
}

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

/* Rainbow Mode */
.rainbow-mode-active {
    animation: rainbowBackground 0.5s ease-in-out infinite !important;
}

@keyframes rainbowBackground {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .game-title {
        font-size: 1.8rem;
    }
    
    .start-screen {
        padding: 15px;
        margin: 15px;
        width: calc(100% - 30px);
        max-height: 90vh;
    }
    
    .game-over-screen {
        padding: 15px;
        padding-bottom: 60px;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .game-over-content {
        padding: 25px;
        margin: 10px auto;
        width: calc(100% - 20px);
        max-width: none;
    }
    
    .name-input-section {
        margin: 15px 0;
        padding: 15px;
    }
    
    .name-input-section h3 {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    
    #playerNameInput {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 8px;
        margin-bottom: 12px;
    }
    
    .submit-score-btn {
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    .button-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .sound-toggle {
        top: 70px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .emoji {
        font-size: 35px;
    }
    
    .emoji.rare {
        font-size: 45px;
    }
    
    .emoji.legendary {
        font-size: 55px;
    }
    
    .timer-bar {
        width: 150px;
    }
    
    .game-ui {
        bottom: 10px;
        gap: 15px;
    }
    
    .power-ups {
        flex-direction: row;
        gap: 10px;
    }
    
    .power-up {
        padding: 8px 12px;
    }
    
    .power-up-emoji {
        font-size: 20px;
    }
    
    .final-stats {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .game-header {
        padding: 10px 15px;
    }
    
    .score-container {
        gap: 15px;
    }
    
    .score-value, .streak-value {
        font-size: 20px;
    }
    
    .combo-multiplier {
        font-size: 24px;
    }
    
    .sound-toggle {
        top: 60px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .game-title {
        font-size: 1.6rem;
    }
    
    .button-container {
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }
    
    .start-btn, .restart-btn, .share-btn, .help-btn, .back-btn, .leaderboard-btn, .screenshot-btn, .submit-score-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        width: 100%;
        max-width: 280px;
    }
    
    .game-over-screen {
        padding: 10px;
        padding-bottom: 80px;
    }
    
    .game-over-content {
        padding: 20px;
        margin: 5px auto;
        width: calc(100% - 10px);
    }
    
    .game-over-title {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }
    
    .name-input-section {
        margin: 10px 0;
        padding: 12px;
    }
    
    .name-input-section h3 {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }
    
    #playerNameInput {
        padding: 10px;
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .leaderboard-screen {
        padding: 20px;
        margin: 10px;
        width: calc(100% - 20px);
        max-height: 85vh;
    }
    
    .leaderboard-title {
        font-size: 1.5rem;
    }
    
    .leaderboard-item {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .full-leaderboard .leaderboard-item .details {
        gap: 4px;
    }
    
    .emoji {
        font-size: 30px;
    }
    
    .emoji.rare {
        font-size: 40px;
    }
    
    .emoji.legendary {
        font-size: 50px;
    }
    
    .game-ui {
        bottom: 20px;
        gap: 20px;
        padding: 16px 24px;
        background: rgba(0, 0, 0, 0.6);
        border-radius: 25px;
        max-width: 90vw;
        border: 3px solid rgba(255, 255, 255, 0.3);
        z-index: 200; /* Maximum z-index for mobile */
    }
    
    .power-ups {
        gap: 25px;
    }
    
    .power-up {
        padding: 16px 22px;
        min-height: 85px;
        min-width: 75px;
        background: rgba(255, 255, 255, 0.4);
        border: 3px solid rgba(255, 255, 255, 0.8);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
        z-index: 210; /* Maximum z-index for mobile power-ups */
        position: relative;
    }
    
    .power-up-emoji {
        font-size: 28px;
    }
    
    .power-up-text {
        font-size: 12px;
        font-weight: bold;
    }
    
    .help-screen {
        padding: 20px;
        margin: 10px;
        width: calc(100% - 20px);
        max-height: 85vh;
    }
    
    .help-title {
        font-size: 1.5rem;
    }
    
    .help-section h3 {
        font-size: 1.1rem;
    }
    
    .help-section p {
        font-size: 0.85rem;
    }
    
    /* Mobile sharing menu */
    .sharing-content {
        padding: 20px;
        margin: 10px;
        max-width: calc(100vw - 20px);
    }
    
    .sharing-content h3 {
        font-size: 1.2rem;
        margin-bottom: 20px;
    }
    
    .sharing-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 20px;
    }
    
    /* Force mobile scrolling and input accessibility - ENTIRE SCREEN */
    .game-over-screen {
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: auto !important;
    }
    
    .game-over-content {
        touch-action: auto !important;
    }
    
    .name-input-section {
        touch-action: auto !important;
        -webkit-touch-callout: default !important;
    }
    
    #playerNameInput {
        touch-action: auto !important;
        -webkit-touch-callout: default !important;
        user-select: text !important;
        -webkit-user-select: text !important;
        pointer-events: auto !important;
    }
    
    .share-platform-btn {
        padding: 10px 8px;
        font-size: 11px;
        min-height: 50px;
    }
}

/* Sharing Menu Styles */
.sharing-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sharing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.sharing-content {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    max-width: 400px;
    width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

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

.sharing-content h3 {
    color: white;
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.sharing-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 25px;
}

.share-platform-btn {
    border: none;
    border-radius: 12px;
    padding: 15px 20px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 50px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.share-platform-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Platform-specific colors */
.facebook-btn {
    background: linear-gradient(135deg, #1877f2, #42a5f5);
}

.twitter-btn {
    background: linear-gradient(135deg, #000000, #333333);
}

.whatsapp-btn {
    background: linear-gradient(135deg, #25d366, #4caf50);
}

.tiktok-btn {
    background: linear-gradient(135deg, #ff0050, #ff4081);
}

.instagram-btn {
    background: linear-gradient(135deg, #e4405f, #fd5949, #fccc63);
}

.other-btn {
    background: linear-gradient(135deg, #9c27b0, #673ab7);
}

.telegram-btn {
    background: linear-gradient(135deg, #0088cc, #42a5f5);
}

.copy-btn {
    background: linear-gradient(135deg, #607d8b, #90a4ae);
}

.reddit-btn {
    background: linear-gradient(135deg, #ff4500, #ff6b35);
}

.discord-btn {
    background: linear-gradient(135deg, #7289da, #99aab5);
}

.linkedin-btn {
    background: linear-gradient(135deg, #0077b5, #42a5f5);
}

.email-btn {
    background: linear-gradient(135deg, #ea4335, #ff7043);
}

.close-sharing, .back-sharing {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    padding: 10px 20px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    font-weight: bold;
    margin: 5px;
}

.close-sharing:hover, .back-sharing:hover {
    background: rgba(255, 255, 255, 0.3);
}

.back-sharing {
    width: calc(50% - 10px);
    display: inline-block;
}

.close-sharing {
    width: calc(50% - 10px);
    display: inline-block;
}

/* Performance Optimizations */
.emoji, .particle {
    will-change: transform, opacity;
}

.game-area {
    will-change: transform;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Settings Menu */
.settings-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(10px);
}

.settings-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    animation: slideUp 0.3s ease-out;
}

.settings-title {
    color: white;
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.settings-section {
    margin-bottom: 25px;
}

.settings-section h3 {
    color: white;
    margin-bottom: 15px;
    font-size: 18px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.settings-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.pack-btn, .theme-btn, .setting-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 12px 15px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 14px;
    text-align: center;
    backdrop-filter: blur(10px);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.pack-btn:hover, .theme-btn:hover, .setting-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.pack-btn.active, .theme-btn.active {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
}

.pack-btn[data-pack="sexy"] {
    background: linear-gradient(45deg, #ff1744, #e91e63, #9c27b0);
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.pack-btn[data-pack="sexy"]:hover {
    background: linear-gradient(45deg, #ff1744, #e91e63, #9c27b0, #673ab7);
    box-shadow: 0 0 15px rgba(255, 23, 68, 0.6);
}

.pack-btn[data-pack="sexy"].active {
    background: linear-gradient(45deg, #ff1744, #e91e63, #9c27b0);
    box-shadow: 0 0 25px rgba(255, 23, 68, 0.8);
    transform: scale(1.05);
}

.blur {
    filter: blur(5px);
    pointer-events: none;
}

/* Theme Styles */
.theme-neon {
    background: linear-gradient(45deg, #00ffff, #ff00ff, #ffff00) !important;
    background-size: 400% 400% !important;
    animation: neonGradient 3s ease infinite !important;
}

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

.theme-retro {
    background: linear-gradient(45deg, #ff6b6b, #ffd93d, #6bcf7f, #4d79ff) !important;
    background-size: 400% 400% !important;
    animation: retroGradient 4s ease infinite !important;
}

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

.theme-nature {
    background: linear-gradient(45deg, #2ecc71, #27ae60, #16a085, #1abc9c) !important;
    background-size: 300% 300% !important;
    animation: natureGradient 6s ease infinite !important;
}

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

/* Vibration Toggle */
.vibration-toggle {
    right: 80px !important;
}

/* Name Input Section */
.name-input-section {
    margin: 20px 0;
    padding: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.1);
    touch-action: auto !important;
    z-index: 1001;
    position: relative;
}

.name-input-section h3 {
    margin-bottom: 15px;
    color: #4ecdc4;
    font-size: 1.2rem;
}

#playerNameInput {
    width: 100%;
    padding: 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 16px; /* Prevents zoom on iOS */
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    z-index: 1001;
    position: relative;
    touch-action: auto !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    -webkit-touch-callout: default !important;
}

#playerNameInput::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#playerNameInput:focus {
    outline: none;
    border-color: #4ecdc4;
    box-shadow: 0 0 15px rgba(78, 205, 196, 0.3);
    background: rgba(255, 255, 255, 0.2);
}

/* Ensure input is clickable on mobile */
#playerNameInput:active,
#playerNameInput:focus-visible {
    border-color: #4ecdc4 !important;
    background: rgba(255, 255, 255, 0.2) !important;
}

.submit-score-btn {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    width: 100%;
    z-index: 1002;
    position: relative;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.submit-score-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.submit-score-btn:active {
    transform: translateY(0);
}

.submit-score-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.submit-score-btn:disabled {
    background: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
    transform: none;
}

/* Leaderboard entry with player names */
.leaderboard-entry .player-name {
    font-weight: bold;
    color: #4ecdc4;
    min-width: 100px;
    text-align: center;
}
