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

/* Screen Reader Only - Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    font-family: 'Open Sans', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.home-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.home-btn:hover {
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.home-btn:active {
    transform: translateY(0) scale(1.05);
}

.header h1 {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5rem;
    color: #4a5568;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.logo {
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.logo:hover {
    color: #667eea;
    transform: scale(1.05);
    text-shadow: 2px 2px 8px rgba(102, 126, 234, 0.3);
}

.logo:active {
    transform: scale(0.98);
}

.score-display {
    display: flex;
    gap: 20px;
    font-weight: 600;
    font-size: 1.1rem;
}

.score, .streak {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: block;
}

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

/* Main Menu Styles */
.welcome-section {
    text-align: center;
    margin-bottom: 40px;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.welcome-section h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 2.2rem;
    color: #4a5568;
    margin-bottom: 10px;
}

.welcome-section p {
    font-size: 1.2rem;
    color: #666;
}

/* Custom Range Section */
.custom-range-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
}

.custom-range-section h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.4rem;
    color: #4a5568;
    margin-bottom: 10px;
}

.range-description {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    font-style: italic;
}


.range-inputs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.range-input-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.range-input-group label {
    font-family: 'Fredoka One', cursive;
    font-weight: 600;
    color: #4a5568;
    font-size: 1.2rem;
    margin-bottom: 0;
    white-space: nowrap;
}

.range-input {
    width: 150px;
    padding: 18px 20px;
    border: 3px solid #e2e8f0;
    border-radius: 15px;
    text-align: center;
    font-family: 'Fredoka One', cursive;
    font-size: 1.4rem;
    font-weight: 600;
    color: #4a5568;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.range-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}


.range-preview {
    font-family: 'Fredoka One', cursive;
    font-size: 0.9rem;
    color: #4a5568;
    font-weight: 600;
    background: rgba(102, 126, 234, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-block;
}

.game-modes {
    margin-bottom: 40px;
}

.game-modes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.mode-btn {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    border: none;
    border-radius: 20px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    text-align: center;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px;
    min-width: 44px;
}

.mode-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.mode-btn:active {
    transform: translateY(-2px);
}

.mode-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.mode-btn .emoji {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
}

.mode-btn .title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    color: #4a5568;
    display: block;
    margin-bottom: 5px;
}

.mode-btn .description {
    font-size: 0.9rem;
    color: #666;
    display: block;
}

/* Difficulty Section */
.difficulty-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
}

.difficulty-section h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    color: #4a5568;
    margin-bottom: 10px;
}

.difficulty-info {
    font-size: 1rem;
    color: #666;
    margin-bottom: 20px;
    font-style: italic;
}

/* Show/Hide Classes */

@media (max-width: 768px) {
    
    
    .custom-range-section {
        padding: 20px 15px;
        margin-bottom: 25px;
    }
    
    .custom-range-section h3 {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }
    
    
    .range-inputs {
        flex-direction: row;
        gap: 15px;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .range-input-group {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 8px;
        width: auto;
        max-width: none;
    }
    
    .range-input-group label {
        font-size: 1rem;
        min-width: 40px;
        margin-bottom: 0;
    }
    
    .range-input {
        width: 120px;
        font-size: 1.2rem;
        padding: 15px 12px;
    }
    
    
    .range-preview {
        font-size: 0.8rem;
        padding: 6px 12px;
        margin-top: 8px;
    }
    
    .milestone-celebration {
        position: fixed;
        top: 50%;
        left: 50%;
        font-size: 1.6rem;
        padding: 18px 25px;
        min-width: 280px;
        max-width: 88vw;
        z-index: 9999;
        animation: rainbow 2s ease infinite, milestonePop 0.8s ease, milestoneFloat 2s ease infinite;
    }
}









.difficulty-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.difficulty-btn {
    background: #e2e8f0;
    border: none;
    border-radius: 25px;
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #4a5568;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 150px;
    gap: 8px;
}

/* Easy button - Green */
.easy-btn {
    background: linear-gradient(45deg, #10b981, #059669);
    color: white;
}

.easy-btn:hover {
    background: linear-gradient(45deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3);
}

/* Medium button - Yellow/Orange */
.medium-btn {
    background: linear-gradient(45deg, #f59e0b, #d97706);
    color: white;
}

.medium-btn:hover {
    background: linear-gradient(45deg, #d97706, #b45309);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 158, 11, 0.3);
}

/* Hard button - Red */
.hard-btn {
    background: linear-gradient(45deg, #ef4444, #dc2626);
    color: white;
}

.hard-btn:hover {
    background: linear-gradient(45deg, #dc2626, #b91c1c);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3);
}

/* Active state - Enhanced styling for selected button */
.difficulty-btn.active {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    border: 3px solid #ffffff;
    animation: selectedPulse 2s ease-in-out infinite;
}

/* Easy button active state */
.easy-btn.active {
    background: linear-gradient(45deg, #10b981, #059669);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
    border: 3px solid #ffffff;
}

/* Medium button active state */
.medium-btn.active {
    background: linear-gradient(45deg, #f59e0b, #d97706);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
    border: 3px solid #ffffff;
}

/* Hard button active state */
.hard-btn.active {
    background: linear-gradient(45deg, #ef4444, #dc2626);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
    border: 3px solid #ffffff;
}

/* Pulse animation for selected button */
@keyframes selectedPulse {
    0%, 100% { 
        box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    }
    50% { 
        box-shadow: 0 12px 35px rgba(0,0,0,0.4);
    }
}

.difficulty-title {
    font-family: 'Fredoka One', cursive;
    font-size: 2.2rem;
    font-weight: 600;
    display: block;
}

.difficulty-desc {
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.3;
    opacity: 0.9;
    display: block;
}


/* Game Screen Styles */
.game-header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}


.game-title-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

#game-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    color: #4a5568;
    margin: 0;
}

.game-range {
    font-family: 'Fredoka One', cursive;
    font-size: 1rem;
    color: #718096;
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    background: #e2e8f0;
    border-radius: 10px;
    height: 10px;
    width: 200px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    background: linear-gradient(45deg, #4ade80, #22c55e);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

.questions-left {
    font-family: 'Fredoka One', cursive;
    font-size: 1.2rem;
    color: #4a5568;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 8px;
    min-width: 40px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Question Container */
.question-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
}

.question {
    font-family: 'Fredoka One', cursive;
    font-size: 3rem;
    color: #4a5568;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.answer-input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.answer-label {
    font-family: 'Fredoka One', cursive;
    font-size: 1.2rem;
    color: #4a5568;
    font-weight: 600;
    margin-bottom: 5px;
}

.answer-input-row {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

#answer-input {
    font-size: 2rem;
    padding: 15px 20px;
    border: 3px solid #e2e8f0;
    border-radius: 15px;
    text-align: center;
    width: 200px;
    transition: all 0.3s ease;
    font-family: 'Fredoka One', cursive;
}

#answer-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: scale(1.05);
}

.submit-btn {
    background: linear-gradient(45deg, #4ade80, #22c55e);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(74, 222, 128, 0.3);
}

/* Feedback */
.feedback-container {
    margin-bottom: 30px;
    text-align: center;
}

.feedback {
    font-size: 1.5rem;
    font-weight: 600;
    padding: 20px;
    border-radius: 15px;
    display: none;
    animation: bounceIn 0.5s ease;
}

.feedback.correct {
    background: linear-gradient(45deg, #4ade80, #22c55e);
    color: white;
    display: block;
}

.feedback.incorrect {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    color: white;
    display: block;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

/* Game Stats */
.game-stats {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    color: #4a5568;
}

/* Results Screen */

.results-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.results-container h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5rem;
    color: #4a5568;
    margin-bottom: 30px;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.result-stat {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 20px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.result-emoji {
    font-size: 2rem;
}

.result-label {
    font-size: 0.9rem;
    color: #666;
}

.result-value {
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    color: #4a5568;
}

.performance-message {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 30px;
    padding: 15px;
    border-radius: 10px;
}

.performance-message.perfect {
    background: linear-gradient(45deg, #ffd700, #ffed4e, #ffd700, #ff6b6b, #4ade80, #3b82f6, #8b5cf6);
    background-size: 400% 400%;
    animation: rainbow 3s ease infinite, bounce 0.6s ease;
    color: white;
    font-weight: 700;
    font-size: 1.3rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    border: 3px solid #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.performance-message.excellent {
    background: linear-gradient(45deg, #4ade80, #22c55e);
    color: white;
}

.performance-message.good {
    background: linear-gradient(45deg, #fbbf24, #f59e0b);
    color: white;
}

.performance-message.needs-improvement {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    color: white;
}

.results-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn.primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.action-btn.secondary {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    color: white;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Mobile-First Responsive Design */
@media (max-width: 1024px) {
    .app-container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2.2rem;
    }
    
    .game-modes-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .mode-btn {
        padding: 20px 12px;
        min-height: 110px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    .mode-btn .emoji {
        font-size: 2.5rem;
    }
    
    .mode-btn .title {
        font-size: 1.3rem;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .header h1 {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }
    
    .home-btn {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    .header-right {
        flex-direction: row;
        justify-content: center;
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .score-display {
        flex-direction: row;
        gap: 10px;
        align-items: center;
        flex-wrap: nowrap;
    }
    
    .score, .streak {
        padding: 6px 12px;
        font-size: 0.9rem;
        min-width: 90px;
        width: auto;
        flex: 1;
        text-align: center;
    }
    
    .home-btn {
        flex-shrink: 0;
    }
    
    @media (max-width: 480px) {
        .header-right {
            gap: 8px;
        }
        
        .score-display {
            gap: 8px;
        }
        
        .score, .streak {
            padding: 5px 8px;
            font-size: 0.8rem;
            min-width: 80px;
            width: auto;
        }
        
    .home-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .custom-range-section {
        padding: 15px 10px;
        margin-bottom: 20px;
    }
    
    .custom-range-section h3 {
        font-size: 1.1rem;
        margin-bottom: 6px;
    }
    
    
    .range-inputs {
        gap: 12px;
        flex-wrap: wrap;
    }
    
    .range-input-group {
        gap: 6px;
        max-width: none;
        width: auto;
    }
    
    .range-input-group label {
        font-size: 0.9rem;
        min-width: 35px;
        margin-bottom: 0;
    }
    
    .range-input {
        width: 110px;
        font-size: 1.1rem;
        padding: 12px 10px;
    }
    
    
    .range-preview {
        font-size: 0.75rem;
        padding: 5px 10px;
        margin-top: 6px;
    }
}

/* Extra small mobile screens */
@media (max-width: 360px) {
    .custom-range-section {
        padding: 12px 8px;
        margin-bottom: 15px;
    }
    
    .custom-range-section h3 {
        font-size: 1rem;
        margin-bottom: 5px;
    }
    
    
    .range-input-group {
        max-width: none;
        width: auto;
        gap: 4px;
    }
    
    .range-input-group label {
        font-size: 0.8rem;
        min-width: 30px;
        margin-bottom: 0;
    }
    
    .range-input {
        width: 100px;
        font-size: 1rem;
        padding: 10px 8px;
    }
    
    
    .range-preview {
        font-size: 0.7rem;
        padding: 4px 8px;
        margin-top: 5px;
    }
    
    .score-display {
        gap: 6px;
    }
    
    .score, .streak {
        padding: 4px 6px;
        font-size: 0.75rem;
        min-width: 75px;
        width: auto;
    }
    
    .game-range {
        font-size: 0.8rem;
        padding: 3px 10px;
    }
    
    .progress-bar {
        max-width: 250px;
        height: 10px;
    }
    
    .game-stats {
        flex-direction: row;
        gap: 8px;
        padding: 12px;
    }
    
    .stat {
        min-width: 70px;
        flex: 1;
    }
    
    .stat-value {
        font-size: 1.1rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
        margin-bottom: 2px;
    }
    
    .milestone-celebration {
        position: fixed;
        top: 50%;
        left: 50%;
        font-size: 1.4rem;
        padding: 15px 20px;
        min-width: 250px;
        max-width: 85vw;
        z-index: 9999;
        animation: rainbow 2s ease infinite, milestonePop 0.8s ease, milestoneFloat 2s ease infinite;
    }
}
    
    .welcome-section {
        padding: 20px;
        margin-bottom: 30px;
    }
    
    .welcome-section h2 {
        font-size: 1.8rem;
    }
    
    .welcome-section p {
        font-size: 1rem;
    }
    
    .game-modes-grid {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    .mode-btn {
        padding: 20px 15px;
        border-radius: 15px;
        min-height: 120px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    .mode-btn .emoji {
        font-size: 2.2rem;
        margin-bottom: 8px;
    }
    
    .mode-btn .title {
        font-size: 1.2rem;
        margin-bottom: 4px;
        text-align: center;
    }
    
    .mode-btn .description {
        font-size: 0.8rem;
        text-align: center;
        line-height: 1.2;
    }
    
    .difficulty-section {
        padding: 20px;
    }
    
    .difficulty-section h3 {
        font-size: 1.3rem;
        margin-bottom: 8px;
    }
    
    .difficulty-info {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }
    
    .difficulty-buttons {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .difficulty-btn {
        width: 100%;
        max-width: 280px;
        padding: 18px 15px;
        min-width: auto;
    }
    
    .difficulty-title {
        font-size: 1.6rem;
    }
    
    .difficulty-desc {
        font-size: 0.9rem;
    }
    
    
    .game-header {
        padding: 15px;
        margin-bottom: 20px;
        flex-direction: column;
        gap: 12px;
        text-align: center;
        align-items: center;
    }
    
    
    .game-title-section {
        align-items: center;
        text-align: center;
    }
    
    #game-title {
        font-size: 1.5rem;
    }
    
    .game-range {
        font-size: 0.9rem;
        color: #4a5568;
        font-weight: 600;
        background: linear-gradient(45deg, #e2e8f0, #cbd5e0);
        padding: 4px 12px;
        border-radius: 15px;
        margin-top: 4px;
    }
    
    .progress-section {
        flex-direction: row;
        gap: 8px;
        width: 100%;
        justify-content: center;
    }
    
    .progress-bar {
        width: 100%;
        max-width: 300px;
        height: 12px;
    }
    
    .question-container {
        padding: 25px 20px;
        margin-bottom: 20px;
    }
    
    .question {
        font-size: 2.2rem;
        margin-bottom: 25px;
    }
    
    .answer-input-container {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    #answer-input {
        width: 100%;
        max-width: 200px;
        font-size: 1.8rem;
        padding: 12px 16px;
    }
    
    .submit-btn {
        padding: 12px 25px;
        font-size: 1.1rem;
        width: 100%;
        max-width: 200px;
    }
    
    .feedback {
        font-size: 1.3rem;
        padding: 15px;
    }
    
    .game-stats {
        flex-direction: row;
        align-items: center;
        justify-content: space-around;
        gap: 10px;
        padding: 15px;
    }
    
    .stat {
        min-width: 80px;
        flex: 1;
        text-align: center;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
        margin-bottom: 3px;
    }
    
    .results-actions {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .action-btn {
        width: 100%;
        max-width: 280px;
        padding: 12px 25px;
        font-size: 1rem;
    }
    
    .results-container {
        padding: 25px 20px;
        margin: 0 10px;
    }
    
    .results-container h2 {
        font-size: 2rem;
        margin-bottom: 20px;
    }
    
    .results-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-bottom: 25px;
    }
    
    .result-stat {
        padding: 15px;
    }
    
    .result-emoji {
        font-size: 1.5rem;
    }
    
    .result-value {
        font-size: 1.3rem;
    }
    
    .performance-message {
        font-size: 1rem;
        padding: 12px;
        margin-bottom: 25px;
    }
    
    /* Table screen mobile optimizations */
    .table-top-bar {
        padding: 12px 15px;
        margin-bottom: 15px;
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .table-top-title {
        font-size: 1.5rem;
    }
    
    .table-header {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .table-header h2 {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }
    
    .table-subtitle {
        font-size: 1rem;
    }
    
    .table-container {
        padding: 10px;
        margin-bottom: 20px;
        border-radius: 15px;
    }
    
    .multiplication-table {
        grid-template-columns: repeat(11, 1fr);
        gap: 1px;
        min-width: 500px;
    }
    
    .table-cell {
        padding: 8px 4px;
        font-size: 0.75rem;
        min-height: 40px;
        border-radius: 4px;
    }
    
    .table-cell.header {
        font-size: 0.8rem;
        font-weight: 700;
        min-height: 35px;
    }
    
    .table-actions {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .action-btn {
        width: 100%;
        max-width: 280px;
    }
    
    
    .number-buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .number-btn {
        padding: 12px 8px;
        font-size: 1.3rem;
        min-height: 45px;
    }
    
    .single-table-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .single-table-item {
        padding: 12px;
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 8px;
    }
    
    .header h1 {
        font-size: 1.6rem;
    }
    
    .welcome-section h2 {
        font-size: 1.6rem;
    }
    
    .question {
        font-size: 1.8rem;
    }
    
    #answer-input {
        font-size: 1.6rem;
        padding: 10px 14px;
    }
    
    .multiplication-table {
        grid-template-columns: repeat(11, 1fr);
        min-width: 450px;
    }
    
    .table-cell {
        padding: 6px 3px;
        font-size: 0.7rem;
        min-height: 35px;
    }
    
    .table-cell.header {
        font-size: 0.75rem;
        min-height: 30px;
    }
    
    .results-stats {
        grid-template-columns: 1fr;
    }
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 0.5s ease-in-out;
}

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

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes milestonePop {
    0% { 
        transform: translate(-50%, -50%) scale(0.5) rotate(-10deg); 
        opacity: 0; 
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.1) rotate(5deg); 
        opacity: 1; 
    }
    100% { 
        transform: translate(-50%, -50%) scale(1) rotate(0deg); 
        opacity: 1; 
    }
}

@keyframes milestoneFloat {
    0% { transform: translate(-50%, -50%) translateY(0px); }
    50% { transform: translate(-50%, -50%) translateY(-20px); }
    100% { transform: translate(-50%, -50%) translateY(0px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

.milestone-celebration {
    position: fixed;
    top: 50%;
    left: 50%;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57);
    background-size: 400% 400%;
    animation: rainbow 2s ease infinite, milestonePop 0.8s ease, milestoneFloat 2s ease infinite;
    color: white;
    font-size: 1.8rem;
    font-weight: 800;
    padding: 20px 30px;
    border-radius: 20px;
    text-align: center;
    z-index: 9999;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border: 4px solid #ffd700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    min-width: 300px;
    max-width: 90vw;
    pointer-events: none;
}


/* Multiplication Table Screen */
.table-top-bar {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.table-top-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    color: #4a5568;
    margin: 0;
}

.table-header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
}

.table-header h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 2.2rem;
    color: #4a5568;
    margin-bottom: 10px;
}

.table-subtitle {
    font-size: 1.1rem;
    color: #666;
    font-style: italic;
}

.table-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-scroll-hint {
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    padding: 8px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    font-style: italic;
    display: none;
}

.multiplication-table {
    display: grid;
    grid-template-columns: repeat(11, 1fr);
    gap: 2px;
    max-width: 100%;
    margin: 0 auto;
    min-width: 600px;
}

.table-cell {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    padding: 12px 8px;
    text-align: center;
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
    color: #4a5568;
    transition: all 0.3s ease;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-cell.header {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
}

.table-cell:hover:not(.header) {
    background: linear-gradient(45deg, #4ade80, #22c55e);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(74, 222, 128, 0.3);
}

/* Row and column highlighting */
.table-cell.highlight-row {
    background: linear-gradient(45deg, #fbbf24, #f59e0b) !important;
    color: white !important;
    transform: scale(1.02);
    box-shadow: 0 2px 10px rgba(251, 191, 36, 0.4);
}

.table-cell.highlight-column {
    background: linear-gradient(45deg, #3b82f6, #1d4ed8) !important;
    color: white !important;
    transform: scale(1.02);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.4);
}

.table-cell.highlight-intersection {
    background: linear-gradient(45deg, #8b5cf6, #7c3aed) !important;
    color: white !important;
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.6);
    z-index: 10;
    position: relative;
}


.single-number-selector {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
}

.single-number-selector h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.3rem;
    color: #4a5568;
    margin-bottom: 10px;
}

.mobile-instruction {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    padding: 8px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    font-style: italic;
}

.number-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
}

.number-btn {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px solid #cbd5e0;
    border-radius: 12px;
    padding: 15px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    color: #4a5568;
    font-weight: 600;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.number-btn:hover,
.number-btn.active {
    background: linear-gradient(45deg, #4ade80, #22c55e);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(74, 222, 128, 0.3);
    border-color: #22c55e;
}

.single-table-display {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
}

.single-table-title {
    font-family: 'Fredoka One', cursive;
    font-size: 2rem;
    color: #4a5568;
    margin-bottom: 20px;
}

.single-table-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    max-width: 300px;
    margin: 0 auto;
}

.single-table-item {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px solid #cbd5e0;
    border-radius: 12px;
    padding: 15px;
    font-family: 'Fredoka One', cursive;
    font-size: 1.2rem;
    color: #4a5568;
    transition: all 0.3s ease;
}

.single-table-item:hover {
    background: linear-gradient(45deg, #4ade80, #22c55e);
    color: white;
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(74, 222, 128, 0.3);
}

.table-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Responsive table */
@media (max-width: 768px) {
    .multiplication-table {
        grid-template-columns: repeat(6, 1fr);
        gap: 1px;
    }
    
    .table-cell {
        padding: 8px 4px;
        font-size: 0.9rem;
        min-height: 40px;
    }
    
    .table-cell.header {
        font-size: 1rem;
    }
    
    .table-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .action-btn {
        width: 100%;
        max-width: 300px;
    }
}
