/* Learn with Fun - Professional Design System */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Primary Colors - Professional Green Palette */
    --primary: #2563EB;
    --primary-dark: #1E40AF;
    --primary-light: #3B82F6;
    --secondary: #10B981;
    --accent: #06B6D4;
    
    /* Semantic Colors */
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --error: #EF4444;
    --error-light: #FEE2E2;
    --info: #3B82F6;
    --info-light: #DBEAFE;
    
    /* Neutral Colors */
    --light: #F8FAFC;
    --light-gray: #F1F5F9;
    --gray: #64748B;
    --dark: #0F172A;
    --white: #FFFFFF;
    --text: #1E293B;
    --text-light: #64748B;
    --text-muted: #94A3B8;
    
    /* Shadows - Professional Depth */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-2xl: 2rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Assistant', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 50%, #E2E8F0 100%);
    min-height: 100vh;
    color: var(--text);
    direction: rtl;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.navbar {
    background: linear-gradient(135deg, var(--white) 0%, var(--light) 100%);
    padding: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    border-bottom: 3px solid var(--primary);
}

.navbar.navbar-visible {
    opacity: 1;
    transform: translateY(0);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

.nav-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.logo {
    color: var(--primary);
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.nav-subtitle {
    font-size: 0.75rem;
    color: var(--text);
    opacity: 0.7;
    margin-top: 0.2rem;
    font-weight: 400;
}

/* Alternative blue theme - uncomment to use blue instead of green */
/*
body {
    background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 50%, #90CAF9 100%);
}
:root {
    --primary: #1976D2;
    --secondary: #42A5F5;
    --accent: #64B5F6;
    --success: #4CAF50;
}
*/

.nav-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    font-size: 0.95rem;
    background: transparent;
    border: 2px solid transparent;
}

.nav-link:hover {
    background: var(--light);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.15);
    border-color: var(--accent);
}

.nav-link:active {
    transform: translateY(0);
}

.nav-icon {
    font-size: 1.2rem;
    display: inline-block;
}

.nav-text {
    display: inline-block;
}

.nav-divider {
    width: 1px;
    height: 30px;
    background: var(--accent);
    margin: 0 0.5rem;
    opacity: 0.5;
}

.nav-user-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-right: 0.5rem;
    border-right: 2px solid var(--light);
}

.nav-user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--light);
    border-radius: 25px;
    font-weight: 600;
    color: var(--primary);
}

.user-avatar {
    font-size: 1.2rem;
    background: var(--primary);
    color: var(--white);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-name {
    font-size: 0.9rem;
}

.nav-admin {
    background: linear-gradient(135deg, var(--warning), #e53935);
    color: var(--white);
    border-color: var(--warning);
}

.nav-admin:hover {
    background: linear-gradient(135deg, #e53935, var(--warning));
    color: var(--white);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

.nav-logout {
    background: var(--light);
    color: var(--text);
}

.nav-logout:hover {
    background: var(--accent);
    color: var(--white);
}

.section {
    display: none;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section.active {
    display: block;
}

.container {
    background: var(--white);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-top: 2rem;
}

/* Auth Section */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.auth-box {
    background: var(--white);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.auth-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.tab-btn {
    flex: 1;
    padding: 0.8rem;
    border: none;
    background: var(--light);
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn.active {
    background: var(--primary);
    color: var(--white);
}

.tab-btn:hover {
    background: var(--accent);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form input {
    padding: 1rem;
    border: 2px solid var(--light);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--light);
}

.btn-primary {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--secondary), var(--accent));
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4);
}


/* Welcome Banner */
.welcome-banner {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 20px;
    color: var(--white);
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.2);
}

.stats-cards {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-top: 2rem;
}

.stat-card {
    background: rgba(255,255,255,0.2);
    padding: 1.5rem 2rem;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
}

/* Action Grid */
.quick-actions h3 {
    margin-bottom: 1.5rem;
    color: var(--text);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.action-card, .game-card {
    background: linear-gradient(135deg, var(--white), var(--light));
    border: 2px solid var(--accent);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.1);
}

.action-card:hover, .game-card:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(46, 125, 50, 0.3);
    background: linear-gradient(135deg, var(--light), var(--white));
}

.action-icon, .game-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.action-card h4, .game-card h3 {
    color: var(--text);
    margin-bottom: 0.5rem;
}

.action-card p, .game-card p {
    color: var(--text);
    opacity: 0.8;
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* Professional Modal System */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    animation: fadeIn var(--transition-base);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--white);
    padding: var(--spacing-2xl);
    border-radius: var(--radius-xl);
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-2xl);
    transform: scale(0.95);
    transition: transform var(--transition-base);
    border: 1px solid var(--light-gray);
}

.modal.active .modal-content {
    transform: scale(1);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(20px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.close {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--light);
    transition: all 0.3s;
}

.close:hover {
    background: var(--warning);
    color: var(--white);
}

/* Game Styles */
.game-container {
    text-align: center;
    padding: 2rem;
}

.game-score {
    font-size: 2rem;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 1rem;
}

.game-question {
    font-size: 1.5rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--light);
    border-radius: 10px;
}

.game-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.game-option {
    padding: 1.5rem;
    background: var(--white);
    border: 3px solid var(--accent);
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 600;
    transition: all 0.3s;
    color: var(--text);
}

.game-option:hover {
    transform: scale(1.05);
    border-color: var(--primary);
    background: var(--light);
}

.game-option.correct {
    background: var(--success);
    border-color: var(--success);
}

.game-option.wrong {
    background: var(--warning);
    border-color: var(--warning);
}

/* Stories List */
.stories-list, .words-list {
    display: grid;
    gap: 1.5rem;
    margin-top: 2rem;
}

.story-card, .word-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 15px;
    border-right: 5px solid var(--primary);
    border: 2px solid var(--light);
    transition: all 0.3s;
}

.story-card:hover, .word-card:hover {
    transform: translateX(-5px);
    box-shadow: 0 5px 15px rgba(46, 125, 50, 0.2);
    border-color: var(--accent);
    background: var(--light);
}

.story-card h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

/* Reading Interface */
.reading-container {
    max-width: 800px;
    margin: 0 auto;
}

.reading-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: 1rem;
    background: var(--light);
    border-radius: 10px;
}

.reading-controls label {
    font-weight: 600;
    color: var(--text);
}

.reading-controls input[type="range"] {
    width: 200px;
    cursor: pointer;
}

.reading-controls #speedValue {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.2rem;
    min-width: 30px;
    text-align: center;
}

.reading-text {
    font-size: 1.3rem;
    line-height: 2;
    padding: 2rem;
    background: var(--light);
    border-radius: 15px;
    margin: 2rem 0;
    max-height: 60vh;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.word-highlight {
    background: var(--light);
    border: 1px solid var(--accent);
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.word-highlight:hover {
    background: var(--accent);
    color: var(--white);
    border-color: var(--primary);
}

.word-highlight.active {
    background: var(--primary);
    color: var(--white);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.translation-popup {
    position: absolute;
    background: var(--info);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    font-size: 0.9rem;
}

/* Progress Charts */
.progress-item {
    background: var(--light);
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 1rem;
    border-right: 5px solid var(--secondary);
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: var(--light);
    border-radius: 15px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.5s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(46, 125, 50, 0.3);
}

/* Challenges */
.challenges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.challenge-card {
    background: linear-gradient(135deg, var(--white), var(--light));
    border: 2px solid var(--accent);
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.1);
}

.challenge-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(46, 125, 50, 0.3);
}

.challenge-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.challenge-card h4 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.challenge-info {
    display: flex;
    justify-content: space-around;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--light);
    font-size: 0.9rem;
    color: var(--text);
}

.challenge-info .bonus {
    color: var(--primary);
    font-weight: 600;
}

/* Math Section */
.math-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.math-category-card {
    background: linear-gradient(135deg, var(--white), var(--light));
    border: 2px solid var(--accent);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.1);
}

.math-category-card:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(46, 125, 50, 0.3);
    background: linear-gradient(135deg, var(--light), var(--white));
}

.math-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.math-category-card h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.math-category-card p {
    color: var(--text);
    opacity: 0.8;
    font-size: 1rem;
}

/* Physics Game */
.physics-game-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.physics-game-header {
    text-align: center;
    margin-bottom: 2rem;
}

.physics-game-header h2 {
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.physics-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.physics-stat-item {
    background: var(--light);
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
}

.physics-stat-item .stat-label {
    font-size: 0.9rem;
    color: var(--text);
    opacity: 0.8;
    margin-bottom: 0.3rem;
}

.physics-stat-item .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.physics-stat-item.streak .stat-value {
    color: var(--warning);
    animation: pulse 1s infinite;
}

.physics-question-container {
    background: linear-gradient(135deg, var(--light), var(--white));
    padding: 3rem;
    border-radius: 20px;
    margin: 2rem 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.physics-question {
    text-align: center;
}

.physics-question h3 {
    color: var(--text);
    font-size: 1.8rem;
    font-weight: 600;
    line-height: 1.6;
}

.physics-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.physics-option-btn {
    padding: 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    background: var(--white);
    border: 3px solid var(--accent);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    text-align: center;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.physics-option-btn:hover:not(:disabled) {
    transform: scale(1.05);
    border-color: var(--primary);
    background: var(--light);
    box-shadow: 0 6px 15px rgba(46, 125, 50, 0.3);
}

.physics-option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.physics-option-btn.correct {
    background: var(--success);
    border-color: var(--success);
    color: var(--white);
    animation: correctPulse 0.5s;
}

.physics-option-btn.wrong {
    background: var(--warning);
    border-color: var(--warning);
    color: var(--white);
    animation: wrongShake 0.5s;
}

.physics-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.physics-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Math Game */
.math-game-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.math-game-header {
    text-align: center;
    margin-bottom: 2rem;
}

.math-game-header h2 {
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.math-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.math-stat-item {
    background: var(--light);
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
}

.math-stat-item .stat-label {
    font-size: 0.9rem;
    color: var(--text);
    opacity: 0.8;
    margin-bottom: 0.3rem;
}

.math-stat-item .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.math-stat-item.streak .stat-value {
    color: var(--warning);
    animation: pulse 1s infinite;
}

.math-question-container {
    background: linear-gradient(135deg, var(--light), var(--white));
    padding: 3rem;
    border-radius: 20px;
    margin: 2rem 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.math-question {
    text-align: center;
}

.math-question h3 {
    color: var(--text);
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.math-problem {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    flex-wrap: wrap;
    direction: ltr;
    unicode-bidi: embed;
}

.math-expression {
    background: var(--white);
    padding: 1rem 2rem;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    direction: ltr;
    unicode-bidi: embed;
    font-family: 'Courier New', monospace;
}

.math-equals {
    font-size: 2.5rem;
    color: var(--text);
    direction: ltr;
    unicode-bidi: embed;
}

.math-question-mark {
    direction: ltr;
    unicode-bidi: embed;
}

/* English words should be LTR */
[dir="ltr"] {
    direction: ltr;
    text-align: left;
    unicode-bidi: embed;
}

.math-question-mark {
    background: var(--info);
    color: var(--white);
    padding: 1rem 2rem;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    animation: pulse 2s infinite;
}

.math-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.math-option-btn {
    padding: 2rem;
    font-size: 2rem;
    font-weight: 700;
    background: var(--white);
    border: 3px solid var(--accent);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.math-option-btn:hover:not(:disabled) {
    transform: scale(1.05);
    border-color: var(--primary);
    background: var(--light);
    box-shadow: 0 6px 15px rgba(46, 125, 50, 0.3);
}

.math-option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.math-option-btn.correct {
    background: var(--success);
    border-color: var(--success);
    color: var(--white);
    animation: correctPulse 0.5s;
}

.math-option-btn.wrong {
    background: var(--warning);
    border-color: var(--warning);
    color: var(--white);
    animation: wrongShake 0.5s;
}

@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.math-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.math-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Subjects Section */
.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.subject-card {
    background: linear-gradient(135deg, var(--white), var(--light));
    border: 2px solid var(--accent);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.1);
}

.subject-card:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(46, 125, 50, 0.3);
    background: linear-gradient(135deg, var(--light), var(--white));
}

.subject-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.subject-card h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.subject-card p {
    color: var(--text);
    opacity: 0.8;
    margin-bottom: 1rem;
}

.subject-games-count {
    background: var(--primary);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    display: inline-block;
    margin-top: 0.5rem;
}

/* Admin Panel */
.admin-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--white), var(--light));
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.admin-header h2 {
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.admin-subtitle {
    color: var(--text);
    font-size: 1.2rem;
    opacity: 0.8;
}

.admin-info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.admin-info-card {
    background: linear-gradient(135deg, var(--white), var(--light));
    border: 2px solid var(--accent);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.admin-info-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(46, 125, 50, 0.3);
}

.admin-info-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.admin-info-card h3 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.admin-info-card p {
    color: var(--text);
    opacity: 0.8;
    line-height: 1.6;
    font-size: 1rem;
}

.admin-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--light);
    flex-wrap: wrap;
}

.admin-tab-btn {
    padding: 1rem 2rem;
    border: none;
    background: transparent;
    border-bottom: 3px solid transparent;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-tab-btn .tab-icon {
    font-size: 1.3rem;
}

.admin-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--light);
}

.admin-tab-btn:hover {
    color: var(--primary);
    background: var(--light);
}

.admin-tab-content {
    padding: 2rem 0;
}

.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--light);
    border-radius: 10px;
    border-right: 4px solid var(--primary);
}

.admin-section-header h3 {
    color: var(--primary);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.admin-section-desc {
    color: var(--text);
    opacity: 0.8;
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
}

.admin-item-card {
    background: var(--white);
    border: 2px solid var(--light);
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 1.5rem;
    transition: all 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.admin-item-card:hover {
    border-color: var(--primary);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.2);
    transform: translateY(-2px);
}

.admin-item-header {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    flex: 1;
}

.admin-item-icon {
    font-size: 3rem;
    background: var(--light);
    width: 70px;
    height: 70px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-item-content {
    flex: 1;
}

.admin-item-content h4 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.admin-item-description {
    color: var(--text);
    opacity: 0.8;
    margin-bottom: 1rem;
    line-height: 1.6;
    font-size: 1rem;
}

.admin-item-meta {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.admin-meta-badge {
    background: var(--light);
    color: var(--primary);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--accent);
}

.admin-item-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.admin-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--light);
    border-radius: 15px;
    border: 2px dashed var(--accent);
}

.admin-empty-state h3 {
    color: var(--primary);
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.admin-empty-state p {
    color: var(--text);
    opacity: 0.8;
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

/* Help System */
.help-icon {
    display: inline-block;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--info);
    margin-right: 0.5rem;
    transition: all 0.3s;
    vertical-align: middle;
}

.help-icon:hover {
    transform: scale(1.2);
    color: var(--primary);
}

.help-icon-small {
    display: inline-block;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--info);
    margin-right: 0.3rem;
    transition: all 0.3s;
    vertical-align: middle;
}

.help-icon-small:hover {
    transform: scale(1.2);
    color: var(--primary);
}

.help-icon-tiny {
    display: inline-block;
    cursor: pointer;
    font-size: 0.7rem;
    color: var(--info);
    margin-right: 0.2rem;
    transition: all 0.3s;
    vertical-align: middle;
}

.help-icon-tiny:hover {
    transform: scale(1.2);
    color: var(--primary);
}

.help-modal-content {
    max-width: 600px;
    padding: 2rem;
}

.help-modal-content h2 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.help-explanation {
    background: var(--light);
    padding: 1.5rem;
    border-radius: 10px;
    border-right: 4px solid var(--primary);
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text);
    margin-bottom: 1rem;
}

.help-explanation p {
    margin: 0;
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: var(--spacing-xl);
    left: var(--spacing-xl);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    pointer-events: none;
}

.toast {
    background: var(--white);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    min-width: 320px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    border-right: 4px solid var(--primary);
    pointer-events: auto;
    transform: translateX(-100px);
    opacity: 0;
    animation: slideInToast var(--transition-slow) forwards;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    transform: scaleX(0);
    transform-origin: right;
    animation: progressBar 5s linear forwards;
}

@keyframes slideInToast {
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutToast {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100px);
        opacity: 0;
    }
}

@keyframes progressBar {
    to {
        transform: scaleX(1);
    }
}

.toast.success {
    border-right-color: var(--success);
}

.toast.success::before {
    background: var(--success);
}

.toast.error {
    border-right-color: var(--error);
}

.toast.error::before {
    background: var(--error);
}

.toast.warning {
    border-right-color: var(--warning);
}

.toast.warning::before {
    background: var(--warning);
}

.toast.info {
    border-right-color: var(--info);
}

.toast.info::before {
    background: var(--info);
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: var(--success);
}

.toast.error .toast-icon {
    color: var(--error);
}

.toast.warning .toast-icon {
    color: var(--warning);
}

.toast.info .toast-icon {
    color: var(--info);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--spacing-xs);
    font-size: 0.95rem;
}

.toast-message {
    color: var(--text-light);
    font-size: 0.875rem;
    line-height: 1.5;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    padding: var(--spacing-xs);
    line-height: 1;
    transition: color var(--transition-fast);
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--text);
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 4000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--light-gray);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-brand {
        width: 100%;
        text-align: center;
        align-items: center;
    }
    
    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .nav-link {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    .nav-text {
        display: none;
    }
    
    .nav-icon {
        font-size: 1.4rem;
    }
    
    .nav-user-section {
        border-right: none;
        border-top: 2px solid var(--light);
        padding-top: 0.5rem;
        padding-right: 0;
        width: 100%;
        justify-content: center;
    }
    
    .nav-divider {
        display: none;
    }
    
    .stats-cards {
        flex-direction: column;
    }
    
    .action-grid, .games-grid, .challenges-grid, .math-categories {
        grid-template-columns: 1fr;
    }
    
    .math-problem {
        font-size: 2rem;
    }
    
    .math-options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .math-option-btn {
        font-size: 1.5rem;
        padding: 1.5rem;
    }
    
    .math-stats {
        gap: 1rem;
    }
}

/* ============================================
   MOBILE APP-LIKE DESIGN
   ============================================ */

/* Safe area for iOS */
@supports (padding: max(0px)) {
    body {
        padding-top: max(0px, env(safe-area-inset-top));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--light-gray);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.5rem 0 max(0.5rem, env(safe-area-inset-bottom));
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--text-light);
    transition: all 0.2s ease;
    flex: 1;
    min-width: 0;
    border-radius: 12px;
    margin: 0 0.25rem;
}

.mobile-nav-item i {
    font-size: 1.5rem;
    transition: all 0.2s ease;
}

.mobile-nav-item span {
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.mobile-nav-item.active {
    color: var(--primary);
    background: var(--primary-light);
    background: rgba(37, 99, 235, 0.1);
}

.mobile-nav-item.active i {
    transform: scale(1.1);
}

.mobile-nav-item:active {
    transform: scale(0.95);
}

/* Mobile Header */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--light-gray);
    z-index: 999;
    padding-top: max(0px, env(safe-area-inset-top));
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.mobile-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    height: 60px;
}

.mobile-menu-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text);
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.mobile-menu-btn:active {
    background: var(--light-gray);
    transform: scale(0.95);
}

.mobile-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    flex: 1;
    text-align: center;
}

.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 80%;
    max-width: 320px;
    background: var(--white);
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    padding-top: max(60px, calc(60px + env(safe-area-inset-top)));
    padding-bottom: max(80px, calc(80px + env(safe-area-inset-bottom)));
}

.mobile-menu-overlay.active .mobile-menu {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--light-gray);
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    width: 80%;
    max-width: 320px;
    background: var(--white);
    z-index: 1;
    padding-top: max(1.5rem, calc(1.5rem + env(safe-area-inset-top)));
}

.mobile-menu-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text);
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text);
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.mobile-menu-close:active {
    background: var(--light-gray);
    transform: scale(0.95);
}

.mobile-menu-content {
    padding: 1rem 0;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--light-gray);
}

.mobile-menu-item i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    color: var(--primary);
}

.mobile-menu-item:active {
    background: var(--light-gray);
    transform: translateX(-5px);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    /* Hide desktop navbar on mobile */
    .navbar {
        display: none !important;
    }
    
    /* Show mobile navigation */
    .mobile-bottom-nav,
    .mobile-header {
        display: flex !important;
    }
    
    /* Full screen sections */
    .section {
        padding-top: calc(60px + max(0px, env(safe-area-inset-top)));
        padding-bottom: calc(80px + max(0px, env(safe-area-inset-bottom)));
        min-height: 100vh;
        min-height: 100dvh; /* Dynamic viewport height */
    }
    
    /* Larger touch targets */
    .btn-primary,
    .btn-secondary {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        min-height: 48px;
        touch-action: manipulation;
    }
    
    /* Larger cards */
    .action-card,
    .game-card,
    .subject-card {
        padding: 1.5rem;
        min-height: 120px;
    }
    
    .action-icon,
    .game-icon {
        font-size: 3rem;
    }
    
    /* Better spacing */
    .container {
        padding: 1rem;
    }
    
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-icon {
        font-size: 2rem;
    }
    
    .stat-value {
        font-size: 1.75rem;
    }
    
    /* Action grid */
    .action-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Subjects grid */
    .subjects-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Games grid */
    .games-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Typography */
    h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    /* Game modals */
    .game-modal {
        padding: 1rem;
    }
    
    .game-content {
        padding: 1rem;
    }
    
    /* Math game */
    .math-options-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .math-option-btn {
        padding: 1.25rem;
        font-size: 1.25rem;
        min-height: 60px;
    }
    
    /* Physics/Biology game */
    .physics-options-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .physics-option-btn {
        padding: 1rem;
        font-size: 1rem;
        min-height: 56px;
    }
    
    /* Typing lessons */
    .lessons-grid {
        grid-template-columns: 1fr;
    }
    
    .typing-text-display {
        font-size: 1.25rem;
        padding: 1.5rem;
    }
    
    .typing-input {
        font-size: 1.25rem;
        padding: 1rem;
    }
    
    /* Exams */
    .exam-options {
        grid-template-columns: 1fr;
    }
    
    .exam-option-btn {
        padding: 1.25rem;
        font-size: 1rem;
        min-height: 56px;
    }
    
    /* Progress items */
    .progress-item {
        padding: 1rem;
    }
    
    /* Toast notifications */
    .toast-container {
        bottom: calc(80px + max(0px, env(safe-area-inset-bottom)));
        left: 1rem;
        right: 1rem;
    }
    
    .toast {
        padding: 1rem;
        font-size: 0.95rem;
    }
    
    /* Welcome banner */
    .welcome-banner {
        padding: 1.5rem 1rem;
    }
    
    /* Auth container */
    .auth-container {
        padding: 1rem;
    }
    
    .auth-box {
        padding: 1.5rem;
    }
    
    /* Admin panel */
    .admin-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .admin-tab-btn {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .mobile-logo {
        font-size: 1rem;
    }
    
    .mobile-nav-item span {
        font-size: 0.7rem;
    }
    
    .mobile-nav-item i {
        font-size: 1.25rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}

/* Landscape orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-bottom-nav {
        padding: 0.25rem 0 max(0.25rem, env(safe-area-inset-bottom));
    }
    
    .mobile-nav-item {
        padding: 0.25rem 0.5rem;
    }
    
    .mobile-nav-item i {
        font-size: 1.25rem;
    }
    
    .mobile-nav-item span {
        font-size: 0.65rem;
    }
}

/* Prevent text selection on buttons for better app feel */
.btn-primary,
.btn-secondary,
.mobile-nav-item,
.mobile-menu-item,
.action-card,
.game-card {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* App-like transitions */
.section {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading spinner for mobile */
.loading-overlay {
    z-index: 3000;
}

/* Game modal for mobile */
@media (max-width: 768px) {
    .game-modal {
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .game-modal.active {
        animation: slideUp 0.3s ease;
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
}

/* ============================================
   TYPING LESSONS STYLES
   ============================================ */
.typing-intro {
    background: var(--white);
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.lessons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.lesson-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.lesson-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.lesson-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.level-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.lesson-keys {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--light-gray);
}

.keys-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.key-badge {
    background: var(--primary);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
}

.typing-game-container {
    background: var(--white);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
}

.typing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.typing-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--light-gray);
    border-radius: 10px;
}

.typing-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.typing-stat .stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.typing-stat .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.typing-text-container {
    margin-bottom: 2rem;
}

.typing-text-display {
    background: var(--light-gray);
    padding: 2rem;
    border-radius: 10px;
    font-size: 1.5rem;
    line-height: 2;
    min-height: 150px;
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
    direction: rtl;
}

.typing-char {
    padding: 2px;
}

.typing-char.correct {
    background: var(--success-light);
    color: var(--success);
}

.typing-char.incorrect {
    background: var(--error-light);
    color: var(--error);
    text-decoration: underline;
}

.typing-char.current {
    background: var(--primary-light);
    color: var(--white);
    border-radius: 3px;
}

.typing-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.5rem;
    border: 2px solid var(--light-gray);
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    direction: rtl;
}

.typing-input:focus {
    outline: none;
    border-color: var(--primary);
}

.typing-instructions {
    background: var(--info-light);
    padding: 1rem;
    border-radius: 10px;
    border-right: 4px solid var(--info);
}

.typing-result {
    background: var(--white);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.result-stat {
    background: var(--light-gray);
    padding: 1rem;
    border-radius: 10px;
}

.result-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.result-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* ============================================
   EXAMS STYLES
   ============================================ */
.exams-intro {
    background: var(--white);
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.exam-options {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: var(--white);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-md);
}

.exam-option-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.exam-select {
    padding: 0.75rem;
    border: 2px solid var(--light-gray);
    border-radius: 8px;
    font-size: 1rem;
    direction: rtl;
}

.exam-container {
    background: var(--white);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
}

.exam-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light-gray);
}

.exam-progress {
    margin-top: 1rem;
}

.exam-question {
    margin: 2rem 0;
}

.exam-question h4 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.exam-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.exam-option-btn {
    padding: 1rem;
    background: var(--light-gray);
    border: 2px solid var(--light-gray);
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: right;
}

.exam-option-btn:hover {
    background: var(--primary-light);
    color: var(--white);
    border-color: var(--primary);
}

.exam-navigation {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 2px solid var(--light-gray);
}

.exam-results {
    background: var(--white);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.result-card {
    background: var(--light-gray);
    padding: 1.5rem;
    border-radius: 10px;
}

.result-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.summary-section {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 10px;
    margin-top: 1rem;
    box-shadow: var(--shadow-sm);
}

.summary-section p {
    margin: 0.75rem 0;
    font-size: 1.1rem;
}

.summary-section strong {
    color: var(--primary);
}

