/* TapFlow Game Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: white;
    overflow-x: hidden;
    position: relative;
}

/* Animated background particles */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(255, 255, 255, 0.06) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(30px, -30px); }
    66% { transform: translate(-20px, 20px); }
}

.container {
    max-width: 100vw;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
}

.game-title {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.8rem;
    font-weight: 700;
    text-shadow: 
        0 0 10px rgba(255, 255, 255, 0.5),
        0 0 20px rgba(255, 255, 255, 0.3),
        3px 3px 6px rgba(0,0,0,0.4);
    animation: titlePulse 3s ease-in-out infinite;
    background: linear-gradient(45deg, #fff, #f0f0f0, #fff);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    letter-spacing: 1px;
}

@keyframes titlePulse {
    0%, 100% { 
        transform: scale(1);
        filter: brightness(1);
    }
    50% { 
        transform: scale(1.02);
        filter: brightness(1.1);
    }
}

.menu-screen, .game-screen, .result-screen {
    text-align: center;
    width: 100%;
    max-width: 500px;
}

.menu-screen {
    background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    padding: 30px;
    border-radius: 30px;
    backdrop-filter: blur(15px);
    box-shadow: 
        0 8px 32px rgba(0,0,0,0.2),
        0 0 0 1px rgba(255,255,255,0.2) inset,
        0 0 60px rgba(255,255,255,0.1);
    max-width: 400px;
    border: 2px solid rgba(255,255,255,0.2);
    animation: menuFloat 6s ease-in-out infinite;
    position: relative;
}

.menu-screen::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        rgba(255,255,255,0.3) 0%, 
        transparent 30%, 
        transparent 70%, 
        rgba(255,255,255,0.3) 100%);
    border-radius: 30px;
    animation: borderGlow 3s linear infinite;
    z-index: -1;
}

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

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

.game-info-section, .mode-section, .layout-section, .color-section, .animation-section {
    margin-bottom: 20px;
}

.section-title {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 
        0 0 10px rgba(255,255,255,0.5),
        2px 2px 4px rgba(0,0,0,0.3);
    position: relative;
    padding-bottom: 8px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #fff, transparent);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
}

.option-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 8px;
    justify-content: center;
}

/* Game description styles */
.game-description {
    background: rgba(255,255,255,0.05);
    padding: 12px;
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.4;
    opacity: 0.9;
}

.time-info {
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.3;
    opacity: 0.9;
}

.time-info p {
    margin: 4px 0;
}

.mode-section .option-buttons,
.layout-section .option-buttons,
.color-section .option-buttons,
.animation-section .option-buttons {
    grid-template-columns: repeat(2, 1fr);
}

#timeOptions .option-buttons {
    grid-template-columns: repeat(2, 1fr);
}

.option-btn {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(135deg, rgba(255,255,255,0.25), rgba(255,255,255,0.1));
    border: 2px solid rgba(255,255,255,0.4);
    color: white;
    padding: 10px 15px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 70px;
    text-align: center;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    letter-spacing: 0.5px;
}

.option-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.option-btn:hover::before {
    width: 300px;
    height: 300px;
}

.option-btn:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.35), rgba(255,255,255,0.15));
    border-color: rgba(255,255,255,0.8);
    transform: translateY(-3px) scale(1.03);
    box-shadow: 
        0 6px 20px rgba(0,0,0,0.3),
        0 0 20px rgba(255,255,255,0.2);
}

.option-btn.selected {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    border-color: #fff;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 6px 25px rgba(238, 90, 36, 0.5),
        0 0 30px rgba(255, 107, 107, 0.3),
        0 0 0 3px rgba(255,255,255,0.3);
    animation: selectedPulse 2s ease-in-out infinite;
}

@keyframes selectedPulse {
    0%, 100% { 
        box-shadow: 
            0 6px 25px rgba(238, 90, 36, 0.5),
            0 0 30px rgba(255, 107, 107, 0.3),
            0 0 0 3px rgba(255,255,255,0.3);
    }
    50% { 
        box-shadow: 
            0 6px 25px rgba(238, 90, 36, 0.7),
            0 0 40px rgba(255, 107, 107, 0.5),
            0 0 0 3px rgba(255,255,255,0.5);
    }
}

.start-btn {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 50%, #ff6b6b 100%);
    background-size: 200% 200%;
    border: 3px solid #fff;
    color: white;
    padding: 15px 40px;
    font-size: 1.4rem;
    font-weight: 700;
    border-radius: 35px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 25px;
    width: 100%;
    max-width: 250px;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 
        0 8px 25px rgba(238, 90, 36, 0.4),
        0 0 40px rgba(255, 107, 107, 0.3),
        0 0 0 4px rgba(255,255,255,0.2);
    animation: startBtnGlow 2s ease-in-out infinite;
    position: relative;
    overflow: hidden;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.start-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: rotate(45deg);
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

@keyframes startBtnGlow {
    0%, 100% { 
        background-position: 0% 50%;
        box-shadow: 
            0 8px 25px rgba(238, 90, 36, 0.4),
            0 0 40px rgba(255, 107, 107, 0.3),
            0 0 0 4px rgba(255,255,255,0.2);
    }
    50% { 
        background-position: 100% 50%;
        box-shadow: 
            0 10px 35px rgba(238, 90, 36, 0.6),
            0 0 50px rgba(255, 107, 107, 0.5),
            0 0 0 4px rgba(255,255,255,0.4);
    }
}

.start-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 
        0 12px 40px rgba(238, 90, 36, 0.6),
        0 0 60px rgba(255, 107, 107, 0.5),
        0 0 0 5px rgba(255,255,255,0.4);
}

.start-btn:active {
    transform: translateY(-2px) scale(1.02);
}

/* Menu Actions Container */
.menu-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
}

/* Help Button */
.help-btn {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    border: 3px solid #fff;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 6px 20px rgba(78, 205, 196, 0.4),
        0 0 30px rgba(78, 205, 196, 0.3),
        0 0 0 3px rgba(255, 255, 255, 0.2);
    animation: helpPulse 3s ease-in-out infinite;
    position: relative;
    overflow: hidden;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: rotate(45deg);
    animation: shimmer 4s linear infinite;
}

@keyframes helpPulse {
    0%, 100% { 
        box-shadow: 
            0 6px 20px rgba(78, 205, 196, 0.4),
            0 0 30px rgba(78, 205, 196, 0.3),
            0 0 0 3px rgba(255, 255, 255, 0.2);
    }
    50% { 
        box-shadow: 
            0 8px 25px rgba(78, 205, 196, 0.6),
            0 0 40px rgba(78, 205, 196, 0.5),
            0 0 0 3px rgba(255, 255, 255, 0.4);
    }
}

.help-btn:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 
        0 8px 25px rgba(78, 205, 196, 0.6),
        0 0 40px rgba(78, 205, 196, 0.5),
        0 0 0 4px rgba(255, 255, 255, 0.4);
}

.help-btn:active {
    transform: translateY(-1px) scale(1.05);
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    background: rgba(0,0,0,0.2);
    padding: 12px 16px;
    border-radius: 12px;
    flex-wrap: nowrap;
    gap: 8px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.info-label {
    font-family: 'Nunito', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0.8;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.info-value {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
}

.timer {
    color: #ff6b6b;
    font-size: 1.2rem !important;
}

.numbers-container {
    position: relative;
    width: 100%;
    height: 60vh;
    margin: 20px 0;
    background: 
        linear-gradient(135deg, rgba(102, 126, 234, 0.3) 0%, rgba(118, 75, 162, 0.3) 100%),
        radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
    border-radius: 20px;
    overflow: visible; /* Changed from hidden to visible for effects */
    box-shadow: 
        inset 0 0 60px rgba(255, 255, 255, 0.1),
        inset 0 0 20px rgba(255, 255, 255, 0.05),
        0 8px 32px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.15);
}

/* Water ripple effect */
.numbers-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 25%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.08) 0%, transparent 25%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.06) 0%, transparent 30%);
    animation: waterRipple 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

/* Animated ripple effect */
.numbers-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 40% 40%, rgba(255, 255, 255, 0.15) 0%, transparent 40%),
        radial-gradient(ellipse at 60% 60%, rgba(255, 255, 255, 0.1) 0%, transparent 40%);
    animation: waterRipple2 10s ease-in-out infinite reverse;
    pointer-events: none;
    z-index: 0;
}

@keyframes waterRipple {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 0.6;
    }
    25% {
        transform: scale(1.05) rotate(2deg);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.1) rotate(0deg);
        opacity: 0.6;
    }
    75% {
        transform: scale(1.05) rotate(-2deg);
        opacity: 0.8;
    }
}

@keyframes waterRipple2 {
    0%, 100% {
        transform: scale(0.95) translateX(0);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.08) translateX(10px);
        opacity: 0.7;
    }
}

.number-btn {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    position: absolute;
    width: 50px;
    height: 50px;
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
    border: none;
    border-radius: 50%;
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    animation: floatOnWater 4s ease-in-out infinite;
    position: absolute;
}

/* Reflection effect under buttons */
.number-btn::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 10%;
    right: 10%;
    height: 8px;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(3px);
    z-index: -1;
    animation: reflectionPulse 4s ease-in-out infinite;
}

@keyframes floatOnWater {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-3px) rotate(1deg);
    }
    50% {
        transform: translateY(-1px) rotate(0deg);
    }
    75% {
        transform: translateY(-4px) rotate(-1deg);
    }
}

@keyframes reflectionPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.1);
    }
}

.number-btn:hover {
    z-index: 3;
    transform: translateY(-8px) scale(1.08);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 0 2px rgba(255, 255, 255, 0.6) inset;
    animation: floatOnWater 4s ease-in-out infinite, hoverBounce 0.5s ease;
}

@keyframes hoverBounce {
    0% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.1); }
    100% { transform: translateY(-8px) scale(1.08); }
}

/* Enhanced mobile press feedback */
.number-btn:active {
    transform: translateY(2px) scale(0.95);
    box-shadow: 1px 1px 3px rgba(0,0,0,0.4);
    transition: all 0.1s ease;
}

/* Press animation class for mobile */
.number-btn.pressing {
    transform: translateY(4px) scale(0.92);
    box-shadow: 
        0 1px 5px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.3) inset;
    filter: brightness(0.9);
    transition: all 0.15s ease-out;
    animation: none; /* Stop float animation when pressing */
}

/* Release animation */
.number-btn.releasing {
    transform: translateY(-6px) scale(1.05);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        0 5px 15px rgba(0, 0, 0, 0.2),
        0 0 0 2px rgba(255, 255, 255, 0.7) inset;
    filter: brightness(1.15);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.number-btn.found {
    background: linear-gradient(145deg, #4ecdc4, #44a08d);
    color: white;
    opacity: 0.6;
    cursor: not-allowed;
}

.number-btn.paused {
    color: transparent !important;
    text-shadow: none !important;
}

/* Enhanced press effects for multi-color buttons */
.number-btn.color-1.pressing,
.number-btn.color-2.pressing,
.number-btn.color-3.pressing,
.number-btn.color-4.pressing,
.number-btn.color-5.pressing,
.number-btn.color-6.pressing,
.number-btn.color-7.pressing,
.number-btn.color-8.pressing,
.number-btn.color-9.pressing,
.number-btn.color-10.pressing {
    filter: brightness(0.8) saturate(1.2);
}

.number-btn.color-1.releasing,
.number-btn.color-2.releasing,
.number-btn.color-3.releasing,
.number-btn.color-4.releasing,
.number-btn.color-5.releasing,
.number-btn.color-6.releasing,
.number-btn.color-7.releasing,
.number-btn.color-8.releasing,
.number-btn.color-9.releasing,
.number-btn.color-10.releasing {
    filter: brightness(1.15) saturate(1.1);
}

/* Multi-color number buttons with white text */
.number-btn.color-1 { 
    background: linear-gradient(145deg, #e74c3c, #c0392b); 
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    box-shadow: 
        0 4px 15px rgba(231, 76, 60, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}
.number-btn.color-2 { 
    background: linear-gradient(145deg, #1abc9c, #16a085); 
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    box-shadow: 
        0 4px 15px rgba(26, 188, 156, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}
.number-btn.color-3 { 
    background: linear-gradient(145deg, #3498db, #2980b9); 
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    box-shadow: 
        0 4px 15px rgba(52, 152, 219, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}
.number-btn.color-4 { 
    background: linear-gradient(145deg, #27ae60, #229954); 
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    box-shadow: 
        0 4px 15px rgba(39, 174, 96, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}
.number-btn.color-5 { 
    background: linear-gradient(145deg, #f39c12, #d68910); 
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    box-shadow: 
        0 4px 15px rgba(243, 156, 18, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}
.number-btn.color-6 { 
    background: linear-gradient(145deg, #e91e63, #ad1457); 
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    box-shadow: 
        0 4px 15px rgba(233, 30, 99, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}
.number-btn.color-7 { 
    background: linear-gradient(145deg, #9b59b6, #8e44ad); 
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    box-shadow: 
        0 4px 15px rgba(155, 89, 182, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}
.number-btn.color-8 { 
    background: linear-gradient(145deg, #34495e, #2c3e50); 
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    box-shadow: 
        0 4px 15px rgba(52, 73, 94, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}
.number-btn.color-9 { 
    background: linear-gradient(145deg, #17a2b8, #138496); 
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    box-shadow: 
        0 4px 15px rgba(23, 162, 184, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}
.number-btn.color-10 { 
    background: linear-gradient(145deg, #fd7e14, #e8590c); 
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    box-shadow: 
        0 4px 15px rgba(253, 126, 20, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}

.game-controls {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.control-btn {
    font-family: 'Nunito', sans-serif;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

.control-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.result-screen {
    background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    padding: 40px;
    border-radius: 30px;
    backdrop-filter: blur(15px);
    box-shadow: 
        0 8px 32px rgba(0,0,0,0.2),
        0 0 0 1px rgba(255,255,255,0.2) inset,
        0 0 60px rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    animation: resultFadeIn 0.5s ease-out;
}

@keyframes resultFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.result-title {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-size: 2.8rem;
    margin-bottom: 25px;
    font-weight: 700;
    animation: resultTitlePop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    text-shadow: 0 0 20px currentColor;
    letter-spacing: 1px;
}

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

.result-title.win {
    color: #4ecdc4;
    text-shadow: 
        0 0 20px #4ecdc4,
        0 0 40px #4ecdc4,
        3px 3px 6px rgba(0,0,0,0.4);
    animation: resultTitlePop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55), winGlow 2s ease-in-out infinite;
}

.result-title.lose {
    color: #ff6b6b;
    text-shadow: 
        0 0 20px #ff6b6b,
        0 0 40px #ff6b6b,
        3px 3px 6px rgba(0,0,0,0.4);
    animation: resultTitlePop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55), loseShake 0.5s ease-in-out;
}

@keyframes winGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

@keyframes loseShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.result-stats {
    font-family: 'Nunito', sans-serif;
    margin-bottom: 30px;
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

/* Help Modal */
.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalFadeIn 0.3s ease-out;
}

.help-content {
    background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    border-radius: 25px;
    backdrop-filter: blur(20px);
    box-shadow: 
        0 20px 60px rgba(0,0,0,0.3),
        0 0 0 1px rgba(255,255,255,0.2) inset,
        0 0 80px rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.help-title {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    margin: 0;
    text-shadow: 0 0 20px rgba(255,255,255,0.5);
}

.help-close {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 700;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-close:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.help-body {
    padding: 25px 30px;
}

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

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h3 {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    margin: 0 0 12px 0;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
}

.help-section p {
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255,255,255,0.9);
    line-height: 1.6;
    margin: 0 0 15px 0;
}

.help-section ul {
    margin: 0;
    padding-left: 20px;
}

.help-section li {
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255,255,255,0.9);
    line-height: 1.6;
    margin-bottom: 8px;
}

.help-section strong {
    color: #4ecdc4;
    font-weight: 700;
}

.help-footer {
    padding: 20px 30px 25px;
    border-top: 1px solid rgba(255,255,255,0.2);
    text-align: center;
}

.help-ok-btn {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    border: 3px solid #fff;
    color: white;
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 6px 20px rgba(78, 205, 196, 0.4),
        0 0 30px rgba(78, 205, 196, 0.3),
        0 0 0 3px rgba(255, 255, 255, 0.2);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 0.5px;
}

.help-ok-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 8px 25px rgba(78, 205, 196, 0.6),
        0 0 40px rgba(78, 205, 196, 0.5),
        0 0 0 3px rgba(255, 255, 255, 0.4);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Enhanced mobile touch styles */
@media (hover: none) and (pointer: coarse) {
    .number-btn {
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    .number-btn:hover {
        transform: none;
        box-shadow: 3px 3px 6px rgba(0,0,0,0.2);
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .game-title {
        font-size: 2rem;
        margin-bottom: 20px;
    }

    .menu-screen {
        padding: 20px;
        max-width: 350px;
    }

    .section-title {
        font-size: 1rem;
        margin-bottom: 12px;
        letter-spacing: 0.5px;
    }
    
    .section-title::after {
        width: 50px;
        height: 2px;
    }

    .option-buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .option-btn {
        padding: 8px 10px;
        font-size: 0.8rem;
        min-width: 60px;
        border-radius: 18px;
    }

    .start-btn {
        padding: 12px 30px;
        font-size: 1.1rem;
        margin-top: 20px;
        letter-spacing: 1px;
    }

    .numbers-container {
        height: 50vh;
    }

    .game-info {
        padding: 10px 12px;
        margin-bottom: 12px;
        gap: 6px;
    }

    .info-item {
        gap: 1px;
    }

    .info-label {
        font-size: 0.7rem;
    }

    .info-value {
        font-size: 0.9rem;
    }

    .timer {
        font-size: 1rem !important;
    }
}

@media (max-width: 480px) {
    .menu-screen {
        padding: 18px;
        max-width: 320px;
    }

    .game-title {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }

    .section-title {
        font-size: 0.95rem;
        margin-bottom: 10px;
        letter-spacing: 0.5px;
    }
    
    .section-title::after {
        width: 40px;
        height: 2px;
    }

    .difficulty-section, .mode-section, .layout-section {
        margin-bottom: 15px;
    }

    .option-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 5px;
    }

    .option-btn {
        padding: 7px 8px;
        font-size: 0.75rem;
        min-width: 50px;
        border-radius: 15px;
    }

    .start-btn {
        padding: 10px 25px;
        font-size: 1rem;
        margin-top: 18px;
        letter-spacing: 1px;
    }
    
    .menu-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .help-btn {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
    
    .help-content {
        max-width: 90vw;
        margin: 10px;
    }
    
    .help-header {
        padding: 20px 25px 15px;
    }
    
    .help-title {
        font-size: 1.5rem;
    }
    
    .help-body {
        padding: 20px 25px;
    }
    
    .help-section {
        margin-bottom: 20px;
    }
    
    .help-section h3 {
        font-size: 1.1rem;
    }
    
    .help-section p,
    .help-section li {
        font-size: 0.9rem;
    }
    
    .help-footer {
        padding: 15px 25px 20px;
    }
    
    .help-ok-btn {
        padding: 10px 25px;
        font-size: 1rem;
    }

    .game-info {
        padding: 8px 10px;
        margin-bottom: 10px;
        gap: 4px;
        border-radius: 10px;
    }

    .info-label {
        font-size: 0.65rem;
    }

    .info-value {
        font-size: 0.85rem;
    }

    .timer {
        font-size: 0.9rem !important;
    }

    .numbers-container {
        height: 45vh;
    }
}

/* Animation for number shuffle */
.number-btn.shuffling {
    animation: shuffle 0.5s ease-in-out;
}

@keyframes shuffle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.9) rotate(5deg); }
}

/* Pulse animation for timer */
.timer.warning {
    animation: pulse 1s infinite;
}

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

/* Wiggle animation for numbers */
@keyframes wiggle {
    0%, 100% { 
        transform: translateX(0) translateY(0) rotate(0deg);
    }
    25% { 
        transform: translateX(1px) translateY(-1px) rotate(0.5deg);
    }
    50% { 
        transform: translateX(-1px) translateY(1px) rotate(-0.5deg);
    }
    75% { 
        transform: translateX(1px) translateY(1px) rotate(0.3deg);
    }
}

@keyframes wiggle-alt {
    0%, 100% { 
        transform: translateX(0) translateY(0) rotate(0deg);
    }
    20% { 
        transform: translateX(-1px) translateY(1px) rotate(-0.3deg);
    }
    40% { 
        transform: translateX(1px) translateY(-1px) rotate(0.4deg);
    }
    60% { 
        transform: translateX(-1px) translateY(-1px) rotate(-0.2deg);
    }
    80% { 
        transform: translateX(1px) translateY(1px) rotate(0.3deg);
    }
}

/* Apply wiggle animation to numbers */
.number-btn.wiggle-1 {
    animation: wiggle 3s infinite ease-in-out;
    animation-delay: 0s;
}

.number-btn.wiggle-2 {
    animation: wiggle-alt 3.5s infinite ease-in-out;
    animation-delay: 0.5s;
}

.number-btn.wiggle-3 {
    animation: wiggle 4s infinite ease-in-out;
    animation-delay: 1s;
}

.number-btn.wiggle-4 {
    animation: wiggle-alt 3.2s infinite ease-in-out;
    animation-delay: 1.5s;
}

.number-btn.wiggle-5 {
    animation: wiggle 3.8s infinite ease-in-out;
    animation-delay: 2s;
}

/* Pause wiggle animation when game is paused */
.number-btn.paused {
    animation-play-state: paused !important;
    pointer-events: none;
}

/* Prevent press effects when paused */
.number-btn.paused.pressing,
.number-btn.paused.releasing {
    transform: none !important;
    filter: none !important;
    box-shadow: none !important;
}

/* Trick hint animation - shake wrong number to deceive player */
.number-btn.trick-hint {
    animation: trickShake 0.8s ease-in-out infinite, floatOnWater 4s ease-in-out infinite !important;
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.6),
        0 4px 15px rgba(255, 215, 0, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.15),
        0 0 0 2px rgba(255, 215, 0, 0.4) inset !important;
    filter: brightness(1.15) saturate(1.2);
    z-index: 4 !important;
}

/* Sunburst rays effect on touch - like sun rays */
.ripple-rays {
    position: absolute;
    pointer-events: none;
    z-index: 10;
}

.ripple-ray {
    position: absolute;
    width: 3px;
    height: 0;
    background: linear-gradient(to top, 
        rgba(255, 215, 0, 0),
        rgba(255, 215, 0, 0.9),
        rgba(255, 255, 200, 0.9),
        rgba(255, 215, 0, 0.9),
        rgba(255, 215, 0, 0)
    );
    border-radius: 1.5px;
    transform-origin: bottom center;
    animation: sunRayBurst 0.8s cubic-bezier(0.22, 0.61, 0.36, 1) forwards !important;
    filter: blur(0.8px);
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.6);
}

/* Stagger animation for different rays */
.ripple-ray:nth-child(1) { animation-delay: 0s; }
.ripple-ray:nth-child(2) { animation-delay: 0.03s; }
.ripple-ray:nth-child(3) { animation-delay: 0.06s; }
.ripple-ray:nth-child(4) { animation-delay: 0.02s; }
.ripple-ray:nth-child(5) { animation-delay: 0.05s; }
.ripple-ray:nth-child(6) { animation-delay: 0.01s; }
.ripple-ray:nth-child(7) { animation-delay: 0.04s; }
.ripple-ray:nth-child(8) { animation-delay: 0.07s; }
.ripple-ray:nth-child(9) { animation-delay: 0.035s; }
.ripple-ray:nth-child(10) { animation-delay: 0.065s; }
.ripple-ray:nth-child(11) { animation-delay: 0.015s; }
.ripple-ray:nth-child(12) { animation-delay: 0.045s; }

@keyframes sunRayBurst {
    0% {
        height: 0;
        opacity: 0;
        transform: scaleY(0) translateY(0);
    }
    10% {
        opacity: 1;
    }
    50% {
        height: 50px;
        opacity: 0.9;
        transform: scaleY(1.2) translateY(-25px);
    }
    100% {
        height: 70px;
        opacity: 0;
        transform: scaleY(1) translateY(-50px);
    }
}

/* Glow circle effect */
.ripple-circle {
    position: absolute;
    background: radial-gradient(
        circle,
        rgba(255, 215, 0, 0.4) 0%,
        rgba(255, 215, 0, 0.2) 30%,
        transparent 70%
    );
    border: 2px solid rgba(255, 215, 0, 0.6);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9;
    width: 0;
    height: 0;
    animation: glowExpand 0.8s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.4),
        inset 0 0 20px rgba(255, 215, 0, 0.2);
}

@keyframes glowExpand {
    0% {
        width: 0;
        height: 0;
        margin-left: 0;
        margin-top: 0;
        opacity: 1;
    }
    50% {
        width: 100px;
        height: 100px;
        margin-left: -50px;
        margin-top: -50px;
        opacity: 0.8;
    }
    100% {
        width: 120px;
        height: 120px;
        margin-left: -60px;
        margin-top: -60px;
        opacity: 0;
    }
}

/* Particle burst effect - small sparkles */
.ripple-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: radial-gradient(
        circle,
        rgba(255, 215, 0, 0.9),
        rgba(255, 215, 0, 0.5)
    );
    border-radius: 50%;
    pointer-events: none;
    z-index: 8;
    animation: particleBurst 0.6s ease-out forwards;
    box-shadow: 0 0 4px rgba(255, 215, 0, 0.6);
}

@keyframes particleBurst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0.8;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0.2);
        opacity: 0;
    }
}

/* Simplified ripple effect for better performance at high levels */
.ripple-circle-simple {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,0,0.8) 0%, rgba(255,255,0,0) 70%);
    transform: translate(-50%, -50%);
    animation: simpleRipple 0.3s ease-out;
    pointer-events: none;
    z-index: 1000;
}

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

/* Performance mode optimizations - disable animations for high levels */
.performance-mode * {
    animation: none !important;
    transition: none !important;
}

.performance-mode .number-btn {
    animation: none !important;
}

.performance-mode .wiggle-1,
.performance-mode .wiggle-2,
.performance-mode .wiggle-3,
.performance-mode .wiggle-4,
.performance-mode .wiggle-5 {
    animation: none !important;
    transform: none !important;
}

@keyframes trickShake {
    0%, 100% { 
        transform: translateX(0) translateY(0) rotate(0deg) scale(1);
    }
    10% { 
        transform: translateX(-3px) translateY(-2px) rotate(-2deg) scale(1.05);
    }
    20% { 
        transform: translateX(3px) translateY(2px) rotate(2deg) scale(1.05);
    }
    30% { 
        transform: translateX(-3px) translateY(-1px) rotate(-1deg) scale(1.05);
    }
    40% { 
        transform: translateX(3px) translateY(1px) rotate(1deg) scale(1.05);
    }
    50% { 
        transform: translateX(-2px) translateY(-2px) rotate(-2deg) scale(1.05);
    }
    60% { 
        transform: translateX(2px) translateY(2px) rotate(2deg) scale(1.05);
    }
    70% { 
        transform: translateX(-1px) translateY(-1px) rotate(-1deg) scale(1.05);
    }
    80% { 
        transform: translateX(1px) translateY(1px) rotate(1deg) scale(1.05);
    }
    90% { 
        transform: translateX(0) translateY(0) rotate(0deg) scale(1.02);
    }
}
