:root {
    --primary-color: #E23636; /* Spidey Red */
    --primary-light: #F46464; /* Light Red */
    --secondary-color: #508CDB; /* Spidey Blue */
    --secondary-light: #82B2F4; /* Light Blue */
    --accent-color: #111111; /* Web Black */
    --accent-light: #333333; 
    --primary: #E23636;
    --secondary: #508CDB;
    --success-color: #2ECC71;
    --danger-color: #E23636;
    --background-color: #1a2b4c; /* City Night Blue */
    --card-bg: #f5f5f5; /* Web White */
    --text-main: #111111; /* Dark Text */
    --text-muted: #4a4a4a;
    --shadow-soft: 4px 4px 0px rgba(0, 0, 0, 0.5);
    --shadow-hover: 6px 6px 0px rgba(0, 0, 0, 0.6);
    --border-radius: 12px;
    --transition-speed: 0.2s;
    
    /* Reading Specific Extensions */
    --primary-bg: #1a2b4c; 
    --accent-glow: 0 0 15px rgba(226, 54, 54, 0.4);
    --star-gold: #FFD700;
    --radius-xl: 20px;
    --radius-lg: 15px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', 'Cairo', sans-serif;
    background: var(--background-color);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    direction: rtl;
    border-top: 20px solid var(--primary-color);
    text-shadow: none;
}

.view {
    display: none;
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.view.active-view {
    display: block;
    animation: viewEnter 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes viewEnter {
    from { opacity: 0; transform: scale(0.98) translateY(20px); filter: blur(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}

.app-header {
    background: white;
    color: var(--text-main);
    padding: 1.5rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft), var(--accent-glow);
    border: 2px solid var(--primary-light);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 2;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.4);
    padding: 0.5rem 1rem 0.5rem 0.5rem;
    border-radius: 30px;
    box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.user-profile {
    font-size: 1.8rem;
    background: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.user-name {
    font-weight: 800;
    color: #2D1500;
    font-size: 1.1rem;
}

.header-spacer { width: 150px; }

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}
.logo h1 { font-size: 2.2rem; font-weight: 800; color: #2D1500; margin: 0; }

.user-stats {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.4);
    padding: 0.5rem 1rem;
    border-radius: 30px;
    box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 800;
    color: #2D1500;
}

.progress-container {
    margin-top: 1.5rem;
    position: relative;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.progress-branch {
    position: absolute;
    left: 10px;
    right: 10px;
    height: 8px;
    background: #8B5A2B;
    border-radius: 4px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.3);
}
.butterfly-indicator {
    position: absolute;
    right: 10px;
    font-size: 2rem;
    transition: right 1s ease-in-out;
    filter: drop-shadow(0 0 10px #DCD0FF);
    z-index: 2;
    transform: scaleX(-1);
}
.lantern-end {
    position: absolute;
    left: 10px;
    font-size: 2rem;
    z-index: 2;
    filter: drop-shadow(0 0 15px #FFD700);
}

.lesson-path-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    padding: 2rem 0;
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.lesson-path-container::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    border-left: 4px dashed #FFD700;
    transform: translateX(-50%);
    filter: drop-shadow(0 0 8px #FFD700);
    z-index: 0;
}

.wavy-lesson-item {
    position: relative;
    z-index: 1;
    width: 250px;
}

.wavy-lesson-item:nth-child(odd) { transform: translateX(120px); }
.wavy-lesson-item:nth-child(even) { transform: translateX(-120px); }

.lesson-card {
    background: linear-gradient(145deg, #E23636, #B02020);
    border-radius: 10px 25px 25px 10px;
    padding: 2rem; text-align: center;
    cursor: pointer; box-shadow: -5px 10px 20px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(255,255,255,0.1);
    transition: all var(--transition-speed);
    border: none; border-right: 15px solid #508CDB; border-left: 8px solid #2962A5;
    min-height: 200px; display: flex; flex-direction: column; justify-content: center;
    position: relative;
}
.lesson-card::after {
    content: ''; position: absolute; bottom: -20px; left: -15px; right: -25px; height: 15px;
    background: linear-gradient(to right, #2962A5, #153D70); border-radius: 5px;
    box-shadow: 0 8px 15px rgba(0,0,0,0.6); z-index: -1;
}
.lesson-card:hover { transform: translateY(-10px) scale(1.02); box-shadow: -5px 15px 30px rgba(80, 140, 219, 0.4), inset 0 0 15px rgba(255,255,255,0.3); border-right-color: #E23636; }
.lesson-card h3 { font-size: 1.8rem; margin-bottom: 0.5rem; color: #fff; font-weight: 800; text-shadow: 2px 2px 0px #000; }
.lesson-card .meta { color: #f0f0f0; font-weight: 700; text-shadow: 1px 1px 0px #000; }
.lesson-card .icon { font-size: 4rem; margin-bottom: 1rem; display: block; filter: drop-shadow(0 5px 5px rgba(0,0,0,0.5)); transition: transform 0.3s; }
.lesson-card:hover .icon { transform: scale(1.1) rotate(5deg); }
.lesson-number {
    position: absolute;
    top: -15px;
    left: -15px;
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.2rem;
    box-shadow: 0 5px 10px rgba(0,0,0,0.5);
    border: 2px solid #FFD700;
    z-index: 2;
}

/* --- Lesson View Navigation --- */
.lesson-header-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 2rem;
    background: rgba(255,255,255,0.03);
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.back-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    width: auto;
    padding: 0 15px;
    height: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    transition: 0.3s;
    white-space: nowrap;
}

.back-btn:hover { background: rgba(255,255,255,0.1); transform: translateX(5px); }

#lesson-title-display {
    flex-grow: 1;
    font-size: 1.5rem;
}

.lesson-tabs {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.tab-trigger {
    padding: 0.8rem 1.8rem;
    border: 2px solid #e2e8f0;
    border-radius: 30px;
    background: #f8fafc;
    color: var(--text-main);
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    font-size: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.tab-trigger:hover { 
    background: #e2e8f0; 
    transform: translateY(-2px);
}

.tab-trigger.active {
    background: var(--accent-glow);
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

/* --- Tab Content Switching --- */
.lesson-body {
    position: relative;
}

.tab-content {
    display: none; /* All tabs hidden by default */
    animation: tabSlideIn 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.tab-content.active {
    display: block;
}

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

.text-display {
    background: rgba(255, 255, 255, 0.95);
    color: #1e293b;
    padding: 3rem;
    border-radius: var(--radius-xl);
    font-size: 2.2rem;
    line-height: 2.5;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    text-align: center;
    border: 8px solid rgba(255,255,255,0.05);
}

.reading-line {
    display: inline-block;
    padding: 0 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    margin: 5px;
    border: 2px solid transparent;
}

.reading-line:hover { 
    background: rgba(80, 140, 219, 0.15); /* Soft Spidey Blue */
    border-color: #E23636; /* Spidey Red */
    color: #E23636;
}

.reading-line.playing { 
    background: linear-gradient(135deg, #E23636, #B02020); /* Spidey Red */
    color: white; 
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(226, 54, 54, 0.4);
    border-color: transparent;
}

/* --- Vocabulary --- */
.vocab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.vocab-item {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
    transition: 0.4s;
    cursor: pointer;
}

.vocab-item:hover { 
    transform: rotateY(10deg); 
    border-color: #a855f7;
}

.vocab-word {
    font-size: 2.2rem;
    font-weight: 900;
    color: #a855f7;
    margin-bottom: 1rem;
}

.vocab-meaning {
    color: var(--text-dim);
    font-size: 1.3rem;
    opacity: 0;
    transform: translateY(10px);
    transition: 0.4s;
}

/* --- Voice Corrector Styles --- */
.mic-btn {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border: none;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
}

.mic-btn:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 15px 25px rgba(79, 70, 229, 0.4);
}

.mic-btn.listening {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    animation: micPulse 1.5s infinite;
    box-shadow: 0 10px 20px rgba(231, 76, 60, 0.4);
}

@keyframes micPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 20px rgba(231, 76, 60, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

.voice-sub-btn {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-main);
    white-space: nowrap;
    padding: 8px 15px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.voice-sub-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-light);
}

.voice-sub-btn.active {
    background: var(--primary-light);
    color: white;
    border-color: var(--primary);
}

.vocab-item.flipped .vocab-meaning {
    opacity: 1;
    transform: translateY(0);
}

/* --- Game - Sentence Ordering & Memo --- */
.game-board, .memo-game {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: var(--radius-xl);
    text-align: center;
}

.slots-container, .memo-lines {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 2rem;
    min-height: 50px;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-lg);
}

.drop-slot {
    min-width: 80px;
    height: 45px;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.3s;
}

.drop-slot.filled {
    border-style: solid;
    background: var(--accent-glow);
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.words-bank, .memo-words {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: 1rem;
}

.memo-word, .order-word {
    padding: 10px 20px;
    background: #f8fafc;
    color: #1e293b;
    border-radius: 15px;
    cursor: grab;
    user-select: none;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: 0.3s;
    border: 2px solid transparent;
}

.memo-word:hover, .order-word:hover {
    transform: scale(1.1);
    background: #fff;
    border-color: #6366f1;
}

.memo-word.selected, .order-word.active {
    background: #6366f1;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

/* --- Writing Canvas --- */
.writing-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    min-width: 300px; /* Prevent collapsing to a line */
    background: rgba(255, 255, 255, 0.03);
    padding: 2rem;
    border-radius: var(--radius-xl);
}

#write-canvas {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 4px solid #6366f1;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    cursor: crosshair;
    width: 100%; /* Responsive display */
    max-width: 900px;
    height: 400px;
    display: block;
}

.canvas-controls {
    display: flex;
    gap: 15px;
}

.check-btn {
    background: var(--accent-glow);
    color: white;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(236, 72, 153, 0.4);
    margin-top: 2rem;
    transition: 0.3s;
}

.check-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(236, 72, 153, 0.6);
}

.hidden { display: none !important; }

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

.modal-content {
    background: var(--primary-bg);
    border: 2px solid #a855f7;
    border-radius: var(--radius-xl);
    padding: 3rem;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 0 50px rgba(168, 85, 247, 0.4);
    animation: modalPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.celebration-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: float 2s infinite ease-in-out;
}

.reward-stars {
    font-size: 2rem;
    letter-spacing: 5px;
    margin: 1.5rem 0;
}

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

.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: 0.3s;
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(168, 85, 247, 0.4);
}

/* --- Checklist Styles --- */
.checklist-item {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: 0.3s;
    cursor: pointer;
}

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

.checklist-item.completed {
    background: rgba(46, 204, 113, 0.15);
    border-color: #2ecc71;
}

.checklist-item.completed .checklist-title {
    color: #2ecc71;
    text-decoration: line-through;
    opacity: 0.8;
}

.checklist-checkbox {
    width: 25px;
    height: 25px;
    margin-left: 15px;
    cursor: pointer;
    accent-color: #2ecc71;
}

.checklist-title {
    font-size: 1.2rem;
    font-weight: bold;
    flex-grow: 1;
    transition: 0.3s;
}

.completed-badge {
    position: absolute;
    top: -15px;
    left: -15px;
    background: #2ecc71;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 3;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

.top-buttons-container {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    z-index: 100;
}

.top-left-btn, .top-right-btn {
    padding: 0.6rem 1.2rem;
    font-size: 1.1rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.top-left-btn {
    background-color: #6C5CE7;
}

/* --- Responsiveness Media Queries --- */

/* Tablets and small desktops */
@media (max-width: 1024px) {
    .view {
        padding: 1rem;
    }
    
    .main-header {
        padding: 3rem 1rem;
    }
    
    .text-display {
        font-size: 1.8rem;
        padding: 2rem;
    }
}

/* Mobile Devices */
@media (max-width: 768px) {
    .home-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 1rem;
    }
    
    .header-actions {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    
    .portal-btn {
        width: 100%;
        margin: 0;
    }

    .header-content h1 {
        font-size: 2.5rem;
    }
    
    .header-content p {
        font-size: 1rem;
    }
    
    .lessons-container {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1.5rem;
    }
    
    .lesson-card {
        padding: 1.5rem 1rem;
    }
    
    .lesson-card .icon {
        font-size: 3.5rem;
    }
    
    .text-display {
        font-size: 1.5rem;
        padding: 1.5rem;
        line-height: 2;
    }
    
    .lesson-tabs {
        gap: 8px;
    }
    
    .tab-trigger {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .vocab-word {
        font-size: 1.8rem;
    }
    
    .vocab-meaning {
        font-size: 1.1rem;
    }
    
    #write-canvas {
        height: 300px;
    }
}

/* Very small screens (Phones) */
@media (max-width: 480px) {
    .main-header {
        padding: 2rem 0.5rem;
    }
    
    .header-content h1 {
        font-size: 2rem;
    }
    
    .user-stats {
        padding: 0.5rem 1rem;
    }
    
    .stat-item {
        font-size: 1.2rem;
    }
    
    .lesson-header-bar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .back-btn {
        width: auto;
        padding: 0 10px;
        height: 40px;
        font-size: 1rem;
    }
    
    .text-display {
        font-size: 1.3rem;
        padding: 1rem;
        border-width: 4px;
    }
    
    .reading-line {
        padding: 0 8px;
        margin: 3px;
    }
    
    .tab-trigger {
        flex-grow: 1;
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
    
    .celebration-icon {
        font-size: 3.5rem;
    }
    
    #write-canvas {
        height: 250px;
    }
    .top-buttons-container {
        top: 10px;
        left: 10px;
        right: 10px;
    }
    
    .top-left-btn, .top-right-btn {
        padding: 0.5rem 0.6rem;
        font-size: 0.85rem;
    }
}

/* --- Kinetic Games CSS --- */
.game-menu h3 { text-align: center; color: #FFD700; font-size: 2rem; margin-bottom: 2rem; }
.game-options-grid { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; }
.game-card-btn { background: var(--card-bg); border: 2px solid var(--primary-light); border-radius: 20px; padding: 2rem; width: 200px; cursor: pointer; transition: 0.3s; box-shadow: var(--shadow-soft); display: flex; flex-direction: column; align-items: center; gap: 1rem; color: var(--text-main); }
.game-card-btn:hover { transform: translateY(-10px); border-color: var(--primary-color); box-shadow: 0 10px 25px rgba(108, 92, 231, 0.4); }
.game-icon { font-size: 4rem; display: block; }
.game-card-btn h4 { font-size: 1.2rem; font-family: 'Cairo'; margin: 0; }
.game-arena { background: rgba(0,0,0,0.2); border-radius: 20px; padding: 3rem 2rem 2rem 2rem; border: 2px solid var(--border-color); position: relative; overflow: hidden; min-height: 400px; margin-top: 1rem; }

.mini-btn { background: var(--primary-color); color: white; border: none; border-radius: 20px; padding: 0.5rem 1rem; font-size: 1rem; font-weight: bold; cursor: pointer; box-shadow: 0 4px 6px rgba(0,0,0,0.3); transition: 0.3s; position: absolute; top: 10px; right: 10px; z-index: 10; }
.mini-btn:hover { background: var(--primary-light); transform: translateY(-2px); }

/* Shared Game Arena */
.game-hud { position: absolute; top: 15px; left: 20px; right: 170px; display: flex; justify-content: space-between; font-size: 1.2rem; font-weight: bold; color: white; z-index: 10; pointer-events: none; }
.game-question { position: absolute; top: 50px; width: 100%; text-align: center; color: #FFD700; font-size: 1.8rem; z-index: 10; pointer-events: none; text-shadow: 2px 2px 4px rgba(0,0,0,0.5); }

/* Catcher Game */
.catcher-area { position: absolute; bottom: 0; left: 0; width: 100%; height: 100%; overflow: hidden; touch-action: none; background: linear-gradient(to bottom, #595959, #333333); }
#catcher-basket { position: absolute; bottom: 20px; left: 50%; width: 80px; height: 80px; font-size: 4rem; transform: translateX(-50%); z-index: 5; text-align: center; transition: none; pointer-events: none; filter: drop-shadow(0 5px 5px rgba(0,0,0,0.3)); }
.falling-word { position: absolute; background: #604029; color: #fff; padding: 10px 20px; border-radius: 5px; font-weight: bold; font-size: 1.2rem; box-shadow: inset 2px 2px 0px rgba(255,255,255,0.2), inset -2px -2px 0px rgba(0,0,0,0.4); border: 2px solid #3d2616; text-align: center; pointer-events: none; text-shadow: none !important; -webkit-text-stroke: 0 !important; }

/* Balloon Game */
.balloon-area { position: absolute; bottom: 0; left: 0; width: 100%; height: 100%; overflow: hidden; cursor: crosshair; background: linear-gradient(to top, #300000 0%, #700000 100%); }
.flying-balloon { position: absolute; background: #55FF55; color: #000; padding: 15px 20px; border-radius: 5px; font-weight: bold; font-size: 1.1rem; cursor: crosshair; box-shadow: inset 4px 4px 0px rgba(255,255,255,0.4), inset -4px -4px 0px rgba(0,0,0,0.4); border: 3px solid #000; text-align: center; min-width: 80px; min-height: 80px; display: flex; align-items: center; justify-content: center; text-shadow: none !important; -webkit-text-stroke: 0 !important; }
.flying-balloon::after { display: none; }

/* Runner Game */
.runner-area { position: absolute; bottom: 0; left: 0; width: 100%; height: 100%; overflow: hidden; cursor: pointer; background: linear-gradient(to bottom, #74b9ff, #81ecec); border-bottom: 50px solid #5E8934; }
#runner-player { position: absolute; bottom: 50px; left: 20%; font-size: 4rem; z-index: 5; transform: scaleX(-1); pointer-events: none; }
#runner-player.running { animation: runnerRun 0.2s infinite alternate; }
@keyframes runnerRun { from { transform: scaleX(-1) translateY(0); } to { transform: scaleX(-1) translateY(-10px); } }
#runner-player.jumping { animation: runnerJumpAnim 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
@keyframes runnerJumpAnim { 0% { bottom: 50px; } 50% { bottom: 200px; } 100% { bottom: 50px; } }
.runner-obstacle { position: absolute; bottom: 50px; right: -150px; background: #00AA00; color: #fff; padding: 10px 20px; border-radius: 5px; font-weight: bold; font-size: 1.2rem; border: 3px solid #005500; box-shadow: inset 4px 4px 0px rgba(255,255,255,0.4), inset -4px -4px 0px rgba(0,0,0,0.4); pointer-events: none; max-width: 150px; text-align: center; word-wrap: break-word; white-space: normal; text-shadow: none !important; -webkit-text-stroke: 0 !important; }

/* --- Math Theme UI --- */
.circuit-progress-container {
    width: 100%;
    margin-bottom: 3rem;
    padding: 0 1rem;
    position: relative;
}

.circuit-progress-bar {
    width: 100%;
    height: 15px;
    background-color: var(--primary-light);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    background-image: linear-gradient(90deg, transparent 50%, rgba(255, 255, 255, 0.5) 50%);
    background-size: 20px 20px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

.circuit-progress-fill {
    height: 100%;
    background-color: var(--accent);
    box-shadow: 0 0 15px var(--accent);
    transition: width 0.5s ease-in-out;
}

.books-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    padding: 2rem;
    position: relative;
    background: rgba(2, 132, 199, 0.03);
    border-radius: var(--radius-xl);
    border: 2px solid var(--primary-light);
}

.books-grid::before {
    content: '';
    position: absolute;
    top: 2rem;
    bottom: 2rem;
    left: 50%;
    width: 6px;
    background-image: linear-gradient(to bottom, var(--secondary) 50%, transparent 50%);
    background-size: 6px 20px;
    background-repeat: repeat-y;
    z-index: 0;
    transform: translateX(-50%);
}

.book-btn {
    width: 280px;
    height: 180px;
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
    outline: none;
    color: #fff;
    z-index: 1;
    overflow: hidden;
    background: rgba(26, 43, 76, 0.4);
    backdrop-filter: blur(10px);
}

.card-bg-image {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-size: cover;
    background-position: center;
    z-index: -2;
    transition: transform 0.6s ease;
}

.card-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top, rgba(17, 17, 17, 0.95), rgba(226, 54, 54, 0.3));
    z-index: -1;
}

.book-btn:nth-child(odd) {
    align-self: flex-start;
    margin-right: 15%;
}

.book-btn:nth-child(even) {
    align-self: flex-end;
    margin-left: 15%;
}

.book-btn:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 20px 40px rgba(226, 54, 54, 0.4), inset 0 0 15px rgba(80, 140, 219, 0.5);
    border-color: rgba(226, 54, 54, 0.5);
}

.book-btn:hover .card-bg-image {
    transform: scale(1.15);
}

.book-content-wrapper {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.book-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.5));
}

.book-title {
    color: #fff;
    font-size: 1.4rem;
    font-weight: 800;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    line-height: 1.2;
    font-family: 'Cairo', sans-serif;
}

.book-meta {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    background: rgba(226, 54, 54, 0.8);
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.book-check {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 40px;
    height: 40px;
    background: #2ECC71;
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.5);
    z-index: 5;
}

.btn-speaker {
    position: absolute;
    bottom: 10px;
    left: 10px;
    font-size: 1.8rem;
    color: #fff;
    opacity: 0.8;
    transition: all 0.3s;
    background: rgba(80, 140, 219, 0.8);
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.book-btn:hover .btn-speaker {
    transform: scale(1.1);
    opacity: 1;
}

.btn-speaker.playing {
    background: #E23636 !important;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(226, 54, 54, 0.7); }
    70% { transform: scale(1.2); box-shadow: 0 0 0 15px rgba(226, 54, 54, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(226, 54, 54, 0); }
}

/* --- New Header UI --- */
.home-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right;
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 4rem;
    color: #1e293b;
}

.header-user-icon {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-direction: column;
}

.user-avatar {
    width: 60px;
    height: 60px;
    background: #e0f2fe;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #0ea5e9;
    font-size: 2.5rem;
}

.user-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: #0f172a;
    background: #e0f2fe;
    padding: 0.5rem 1rem;
    border-radius: 10px;
}

.header-content h1 {
    font-size: 2.2rem;
    margin-bottom: 0.2rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.portal-btn {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 1rem 1.5rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.portal-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
}

/* --- Spider-Man Premium UI Overrides --- */
body {
    background: linear-gradient(135deg, #1a2b4c 0%, #111111 100%) !important;
    background-attachment: fixed !important;
}

/* Glassmorphism Panels */
.app-header, .home-header, .lesson-header-bar, .modal-content, .text-display, .game-arena {
    background: rgba(255, 255, 255, 0.03) !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4) !important;
    color: #fff !important;
}

.portal-btn, .primary-btn, .tab-trigger, .game-card-btn, .mini-btn, .back-btn, .voice-sub-btn {
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(5px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    border-radius: 30px !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3) !important;
    font-weight: 800 !important;
    transition: all 0.3s ease !important;
}

.portal-btn:hover, .primary-btn:hover, .tab-trigger:hover, .game-card-btn:hover, .mini-btn:hover, .back-btn:hover {
    background: rgba(226, 54, 54, 0.8) !important; /* Red highlight on hover */
    transform: translateY(-5px) !important;
    box-shadow: 0 15px 30px rgba(226, 54, 54, 0.4) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}

/* Specific glowing elements */
h1, h2, h3, h4 {
    color: #fff !important;
    text-shadow: 0 0 15px rgba(80, 140, 219, 0.8) !important;
}

.user-avatar {
    border: 3px solid #E23636 !important;
    background: rgba(255,255,255,0.1) !important;
    box-shadow: 0 0 15px rgba(226, 54, 54, 0.5) !important;
}

/* World Buttons */
.world-btn {
    padding: 12px 25px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.3s;
}

.world-btn:hover {
    background: rgba(80, 140, 219, 0.4);
    transform: translateY(-3px);
}

.world-btn.active {
    background: #E23636;
    border-color: #fff;
    box-shadow: 0 0 20px rgba(226, 54, 54, 0.6);
}

.books-grid {
    border: none !important;
}
.books-grid::before {
    display: none !important;
}

