:root {
    /* Modern Vibrant Mario Colors */
    --primary: #FF2B2B;      /* Bright Mario Red */
    --primary-dark: #cc0000;
    --secondary: #28D84D;    /* Bright Luigi Green */
    --secondary-dark: #1b9c35;
    --accent: #FFD230;       /* Golden Coin/Block Yellow */
    --accent-dark: #d6a715;
    --success: #66BB6A;
    --rose: #3E8BFE;         /* Changed to Sky Blue */
    --text: #333333;
    --white: #ffffff;
    --shadow: 0 8px 0 rgba(0,0,0,0.2), 0 15px 20px rgba(0,0,0,0.3); 
    --border-dark: 2px solid rgba(255, 255, 255, 0.4);
    
    --bg-color: #3E8BFE;
    --block-border: #8B4513;
}

/* Mario Theme Global Styles */
body {
    background: linear-gradient(135deg, var(--bg-color) 0%, #1a5ac4 100%);
    background-attachment: fixed;
    margin: 0;
    font-family: 'Baloo Bhaijaan 2', sans-serif;
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 24px;
    line-height: 1.8;
}

/* --- Mario Header Scene --- */
.mario-scene {
    position: relative;
    width: 100%;
    height: 350px;
    background: linear-gradient(180deg, var(--bg-color) 0%, #a2d6f9 100%);
    border: 6px solid #222;
    border-radius: 20px 20px 0 0;
    box-shadow: var(--shadow);
    margin-bottom: 40px;
    overflow: hidden;
}
.mario-sky { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }
.mario-cloud { position: absolute; opacity: 0.9; filter: drop-shadow(0 10px 10px rgba(0,0,0,0.1)); }
.cloud-1 { top: 30px; left: -100px; animation: moveClouds 40s linear infinite; }
.cloud-2 { top: 80px; left: -150px; animation: moveClouds 60s linear infinite 15s; }
@keyframes moveClouds { 0% { left: -150px; } 100% { left: 110%; } }
.header-content {
    position: relative; z-index: 10; text-align: center; padding-top: 25px; color: white; pointer-events: none;
}
.header-content h1 {
    font-size: 3.2rem; font-weight: 900; margin-bottom: 5px; color: #fff;
    -webkit-text-stroke: 2px #000; text-shadow: 0 5px 0 var(--primary-dark), 0 10px 10px rgba(0,0,0,0.4);
    letter-spacing: 2px; transform: rotate(-2deg); line-height: 1.2;
}
.mario-ground-level { position: absolute; bottom: 24px; left: 0; width: 100%; height: 80px; z-index: 2; }
.mario-ground-blocks {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 24px;
    background-color: #D89820; border-top: 4px solid #000;
    background-image: linear-gradient(90deg, #000 4px, transparent 4px), linear-gradient(180deg, #000 4px, transparent 4px);
    background-size: 24px 24px;
}
.mario-character { position: absolute; bottom: 0; filter: drop-shadow(4px 4px 0px #000); }
.mario { left: 20%; animation: jump 2s infinite ease-in-out; }
@keyframes jump { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-30px); } }
.peach { right: 20%; transform: scaleX(-1); }
.mushroom { left: 45%; bottom: 0; animation: bounce 1s infinite alternate; }
@keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-10px); } }
.koopa { right: 40%; bottom: 0; animation: koopaMove 10s infinite linear; }
@keyframes koopaMove {
    0% { transform: translateX(0); }
    50% { transform: translateX(100px); }
    51% { transform: translateX(100px) scaleX(-1); }
    99% { transform: translateX(0) scaleX(-1); }
    100% { transform: translateX(0); }
}
.mario-pipe { position: absolute; bottom: 0; right: 5%; filter: drop-shadow(4px 4px 0px #000); z-index: 2; }

/* Hit Animation for Characters */
.mario-character.hit {
    animation: hitEffect 1.5s ease-out !important;
    pointer-events: none;
}
@keyframes hitEffect {
    0% { filter: brightness(2) sepia(1) hue-rotate(-50deg) saturate(5); transform: translateY(0) scale(1); }
    10% { filter: brightness(2) sepia(1) hue-rotate(-50deg) saturate(5); transform: translateX(-5px) rotate(-5deg); }
    20% { filter: brightness(2) sepia(1) hue-rotate(-50deg) saturate(5); transform: translateX(5px) rotate(5deg); }
    30% { filter: brightness(2) sepia(1) hue-rotate(-50deg) saturate(5); transform: translateY(-40px) rotate(15deg) scale(1.2); }
    80% { filter: none; transform: translateY(200px) rotate(180deg) scale(0); opacity: 0; }
    99% { filter: none; transform: translateY(200px); opacity: 0; }
    100% { filter: none; transform: translateY(0) rotate(0) scale(1); opacity: 1; }
}

/* نص متوهج تفاعلي وتفاعل حسي */
.glowing-text {
    animation: goldGlow 0.8s ease-in-out infinite alternate !important;
    color: #FFCA28 !important;
}
@keyframes goldGlow {
    from { text-shadow: 0 0 10px #FFD54F, 0 0 20px #FFD54F; transform: scale(1.1); }
    to { text-shadow: 0 0 20px #FFC107, 0 0 30px #FFB300; transform: scale(1.25); }
}

.pop-on-click {
    animation: popGrow 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}
@keyframes popGrow {
    0% { transform: scale(1); }
    50% { transform: scale(1.3) rotate(5deg); }
    100% { transform: scale(1); }
}

/* إدارة الشاشات */
.view { display: none; animation: slideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.view.active-view { display: block; }
@keyframes slideIn { from{ opacity: 0; transform: scale(0.9) translateY(30px); } to{ opacity: 1; transform: scale(1) translateY(0); } }

/* ===== HEADER ===== (Replaced by mario-scene) */

/* ===== LESSONS GRID ===== */
.lessons-path {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
    display: block; 
}
.user-stats {
    background: white;
    padding: 10px 22px;
    border-radius: 30px;
    box-shadow: var(--shadow);
    display: inline-block;
    margin-bottom: 10px;
    border: var(--border-dark);
}

.stars-badge {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--accent-dark);
    display: flex;
    align-items: center;
    gap: 5px;
    text-shadow: 1px 1px 0px #2f3542;
}

/* زر مستكشف الأحرف (Explorer Letters Button) */
.explorer-letters-btn {
    background: var(--primary);
    color: var(--white);
    padding: 15px 40px;
    font-size: 2.2rem;
    border-radius: 50px; /* Rounded pill shape */
    border: 6px solid var(--secondary);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2), inset 0 -5px 15px rgba(0,0,0,0.1);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 15px;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.2);
    font-family: inherit;
    font-weight: 800;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-top: 20px;
}
.explorer-letters-btn:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 15px 25px rgba(0,0,0,0.3), inset 0 -5px 15px rgba(0,0,0,0.1);
    background: var(--success);
    border-color: var(--white);
}

/* تخطيط خريطة الاستكشاف (Exploration Map Layout) */
.map-container {
    background-color: var(--secondary); /* لون التضاريس العشبية لماريو */
    background-image: 
        radial-gradient(circle at 15% 25%, rgba(255,255,255,0.2) 0%, transparent 20%),
        radial-gradient(circle at 85% 65%, rgba(255,255,255,0.2) 0%, transparent 20%),
        radial-gradient(circle at 40% 85%, rgba(255,255,255,0.2) 0%, transparent 30%);
    background-size: 100% 1200px;
    border-radius: 30px;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.15), 0 15px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    margin: 0 auto;
    max-width: 1200px;
    border: 8px solid var(--block-border); /* إطار خشبي ماريو */
}

#base-camp, #treasure-chest {
    text-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.branch-wrapper {
    position: absolute;
    width: 180px;
    height: 180px;
    transform: translate(-50%, 0); /* Center horizontally based on left % */
    z-index: 10;
}

/* ===== LESSON CARD (MARIO BLOCK STYLE) ===== */
.lesson-node {
    margin-top: 0;
    transform-origin: center center;
    background-color: var(--accent) !important;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 6px solid var(--block-border) !important;
    border-radius: 12px !important;
    box-shadow: inset -5px -5px 0px rgba(0,0,0,0.2), inset 5px 5px 0px rgba(255,255,255,0.5), var(--shadow) !important;
    position: relative;
    width: 180px;
    height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

/* Question Mark inside Block */
.lesson-node::before {
    content: '?';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8rem;
    font-weight: 900;
    color: rgba(0,0,0,0.05);
    z-index: 0;
    pointer-events: none;
}

.lesson-node:hover {
    transform: translateY(-10px) scale(1.02);
    background-color: #ffde59 !important;
    box-shadow: inset -5px -5px 0px rgba(0,0,0,0.2), inset 5px 5px 0px rgba(255,255,255,0.6), 0 20px 25px rgba(0,0,0,0.4) !important;
}

.lesson-node:active {
    transform: translateY(5px);
    box-shadow: inset -5px -5px 0px rgba(0,0,0,0.2), inset 5px 5px 0px rgba(255,255,255,0.4), 0 5px 10px rgba(0,0,0,0.2) !important;
}

/* Completed Block */
.lesson-node.completed {
    background-color: #f1c40f !important;
    border-color: #b8860b !important;
    box-shadow: inset -5px -5px 0px rgba(0,0,0,0.3), inset 5px 5px 0px rgba(255,255,255,0.4), var(--shadow) !important;
}
.lesson-node.completed::after {
    background: #fffde7;
    border-color: #f1c40f;
}
.lesson-num { font-size: 1.1rem; color: #555; font-weight: bold; margin-bottom: 5px; }
.lesson-name { font-size: 1.6rem; color: #3E2723; font-weight: 800; margin-bottom: auto; text-shadow: none; }
.lesson-emoji { font-size: 3.5rem; margin-bottom: 10px; }

.rainbow-play-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #ff4757, #ffa502, #2ed573, #1e90ff, #9b59b6, #ff4757);
    border: 4px solid white;
    color: white;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s;
    margin-top: auto;
}
.rainbow-play-btn:hover {
    transform: scale(1.1) rotate(10deg);
}

@keyframes gentleSwing {
    0% { transform: rotate(-6deg); }
    100% { transform: rotate(6deg); }
}

.lesson-node:hover {
    animation-play-state: paused;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255,105,180,0.6), inset 0 0 20px rgba(255, 215, 0, 0.4);
}

.lesson-node.completed {
    background-color: #f1c40f !important;
    border-color: #b8860b !important;
    box-shadow: inset -5px -5px 0px rgba(0,0,0,0.3), inset 5px 5px 0px rgba(255,255,255,0.4), var(--shadow) !important;
}
.lesson-node.completed::after {
    content: '✅';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 1.8rem;
    background: white;
    border-radius: 50%;
    border: 2px solid #2ecc71;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* الدرس الداخلي - الكتاب المفتوح */
#lesson-view { max-width: 950px; margin: 2rem auto; background: transparent; padding: 0; border: none; box-shadow: none; }
.lesson-header-top { display: flex; justify-content: flex-start; align-items: center; margin-bottom: 10px; padding: 0 20px; }
.back-btn { padding: 12px 25px; font-size: 1.2rem; font-family: 'Baloo Bhaijaan 2', sans-serif; font-weight: bold; border: 4px solid var(--block-border); border-radius: 10px; background: var(--secondary); color: white; cursor: pointer; transition: all 0.2s; box-shadow: 0 6px 0 var(--secondary-dark), 0 10px 10px rgba(0,0,0,0.2); }
.back-btn:hover { background: #28a745; transform: translateY(2px); box-shadow: 0 4px 0 var(--secondary-dark), 0 6px 6px rgba(0,0,0,0.2); }
.back-btn:active { transform: translateY(6px); box-shadow: 0 0 0 transparent; }
.lesson-title { text-align: center; font-size: 3.5rem; color: #fff; margin-top: 0; -webkit-text-stroke: 2px #000; text-shadow: 0 5px 0 var(--primary-dark), 0 10px 10px rgba(0,0,0,0.4); font-weight: 900; }

/* أدوات المستكشف (Explorer Tools) بدلاً من الشجرة */
.lesson-tabs { 
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px; 
    max-width: 800px;
    margin: 0 auto 30px; 
    position: relative; 
    z-index: 10; 
}

/* الأزرار بطابع ماريو */
.tab-btn { 
    background-color: var(--secondary); 
    color: white; 
    border: 4px solid var(--block-border); 
    border-radius: 12px; 
    padding: 15px 30px; 
    font-size: 1.3rem; 
    font-weight: bold; 
    font-family: inherit; 
    cursor: pointer; 
    box-shadow: 0 8px 0 var(--secondary-dark), 0 15px 20px rgba(0,0,0,0.2); 
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5); 
    transition: 0.1s; 
    margin: 0; 
}
.tab-btn:hover { 
    background-color: #55c45a; 
    transform: translateY(2px); 
    box-shadow: 0 6px 0 var(--secondary-dark), 0 10px 15px rgba(0,0,0,0.2); 
}
.tab-btn.active { 
    background-color: var(--primary); 
    border-color: var(--block-border); 
    box-shadow: 0 0 0 transparent; 
    transform: translateY(8px); 
}

/* صفحات الكتاب */
.tab-content { display: none; text-align: center; padding: 3rem 2rem; background: var(--white); border-radius: 15px; min-height: 450px; border: 6px solid var(--block-border); box-shadow: inset -5px -5px 0 rgba(0,0,0,0.05), var(--shadow); position: relative; z-index: 5; }
.tab-content.active-tab { display: block; animation: fadeIn 0.4s; }
.instruction-text { font-size: 1.5rem; color: #3e2723; margin-bottom: 25px; font-weight: bold; background: var(--accent); display: inline-block; padding: 10px 30px; border-radius: 10px; border: 3px solid var(--block-border); box-shadow: inset -3px -3px 0 rgba(0,0,0,0.1), 0 4px 0 var(--block-border); text-shadow: none; }

/* قسم الاستماع */
.listen-zone { display: flex; flex-direction: column; align-items: center; gap: 30px; }
.big-letter { font-size: 8rem; font-weight: bold; color: #4e342e; background: #FFD230; width: 200px; height: 200px; border-radius: 15px; display: flex; align-items: center; justify-content: center; box-shadow: inset -5px -5px 0 rgba(0,0,0,0.2), inset 5px 5px 0 rgba(255,255,255,0.4), 0 10px 0 var(--block-border); cursor: pointer; border: 6px solid var(--block-border); }
.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0% { transform: scale(1) rotate(0deg); } 50% { transform: scale(1.05) rotate(3deg); } 100% { transform: scale(1) rotate(0deg); } }

/* أزرار تفاعلية */
.action-btn { background: var(--primary); color: #fff; border: 4px solid var(--block-border); padding: 10px 30px; border-radius: 12px; font-size: 1.5rem; font-weight: bold; cursor: pointer; font-family: inherit; transition: all 0.2s; box-shadow: inset -3px -3px 0 rgba(0,0,0,0.2), inset 3px 3px 0 rgba(255,255,255,0.4), 0 6px 0 var(--block-border); }
.action-btn:active { transform: translateY(6px); box-shadow: inset -3px -3px 0 rgba(0,0,0,0.2), inset 3px 3px 0 rgba(255,255,255,0.4), 0 0 0 transparent; }
.bouncy:hover { animation: bouncy 0.5s; }
@keyframes bouncy { 0%, 100%{ transform: translateY(0); } 50%{ transform: translateY(-10px) rotate(-5deg); } }

/* قسم الحركات (قطع خشبية سحرية) */
.harakat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 15px; padding: 10px; }
.haraka-card { background: var(--accent); border: 4px solid var(--block-border); border-radius: 12px; padding: 15px; text-align: center; cursor: pointer; transition: all 0.2s; box-shadow: inset -3px -3px 0 rgba(0,0,0,0.2), inset 3px 3px 0 rgba(255,255,255,0.4), 0 6px 0 var(--block-border); color: #3e2723; }
.haraka-card:hover { transform: scale(1.05) translateY(-3px); box-shadow: inset -3px -3px 0 rgba(0,0,0,0.2), inset 3px 3px 0 rgba(255,255,255,0.4), 0 10px 0 var(--block-border); }
.haraka-display { font-size: 4rem; font-weight: bold; color: #3e2723; line-height: 1.2; text-shadow: 2px 2px 0 #fff; }
.haraka-name { font-size: 1.2rem; color: #3e2723; margin-top: 5px; font-weight: bold; }

/* قسم المد */
.mad-machine { display: flex; justify-content: center; gap: 15px; align-items: flex-start; flex-wrap: wrap; padding: 10px; }
.mad-block { background: var(--accent); border: 4px solid var(--block-border); border-radius: 12px; padding: 20px 15px; width: 160px; text-align: center; cursor: pointer; transition: 0.2s; box-shadow: inset -3px -3px 0 rgba(0,0,0,0.2), inset 3px 3px 0 rgba(255,255,255,0.4), 0 6px 0 var(--block-border); }
.mad-block:hover { transform: scale(1.05) translateY(-3px); box-shadow: inset -3px -3px 0 rgba(0,0,0,0.2), inset 3px 3px 0 rgba(255,255,255,0.4), 0 10px 0 var(--block-border); }
.mad-label { font-size: 1.1rem; color: #3e2723; margin-bottom: 8px; font-weight: bold; text-shadow: 1px 1px 0 #fff; }
.mad-letters { font-size: 4rem; color: #3E2723; display: block; margin-bottom: 10px; text-shadow: 2px 2px 0px #fff; }
.mad-block:hover .mad-letters { color: #3E2723; }
.mad-block button { display: block; margin: 10px auto 0; font-family: inherit; font-size: 1.1rem; padding: 8px 18px; background: var(--primary); color: #fff; border-radius: 8px; border: 3px solid var(--block-border); font-weight: bold; cursor: pointer; box-shadow: 0 4px 0 var(--block-border); }

/* تبويبات الكتابة الداخلية */
.draw-sub-tabs { display: flex; justify-content: center; gap: 15px; margin-bottom: 15px; flex-wrap: wrap; }
.draw-sub-btn { background: white; border: var(--border-dark); color: var(--text); padding: 12px 25px; border-radius: 20px; font-size: 1.3rem; font-weight: bold; cursor: pointer; font-family: inherit; transition: all 0.1s; box-shadow: 3px 4px 0px #2f3542; display: flex; align-items: center; justify-content: center; gap: 10px; }
.draw-sub-btn.active, .draw-sub-btn:hover { background: var(--primary); color: white; transform: translateY(-3px); box-shadow: 4px 6px 0px #2f3542; }
.draw-hint { font-size: 1.2rem; color: #888; margin: 5px 0 12px; font-style: italic; }

/* لوحة الكتابة (السبورة الخشبية) */
.drawing-zone { display: block; width: 100%; position: relative; background: #5d4037; padding: 15px; border-radius: 15px; box-shadow: 0 10px 20px rgba(0,0,0,0.4); border: 4px solid #3e2723; }
canvas { background: #f4f1ea; border: 3px solid #8d6e63; border-radius: 5px; cursor: crosshair; box-shadow: inset 0 0 15px rgba(0,0,0,0.1); display: block; width: 100%; }
.tools { margin-top: 15px; display: flex; justify-content: center; gap: 15px; }

/* اللعبة (كلمات ورونية) */
.game-zone { min-height: 280px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.game-card { border: 4px solid var(--block-border); box-shadow: inset -3px -3px 0 rgba(0,0,0,0.2), inset 3px 3px 0 rgba(255,255,255,0.4), 0 8px 0 var(--block-border), 0 10px 15px rgba(0,0,0,0.2) !important; transition: all 0.2s; }
.game-card:hover { transform: translateY(-5px); box-shadow: inset -3px -3px 0 rgba(0,0,0,0.2), inset 3px 3px 0 rgba(255,255,255,0.4), 0 12px 0 var(--block-border), 0 15px 20px rgba(0,0,0,0.2) !important; }
.syllable-draggable { background: #FFD230; color: #3E2723; padding: 20px 30px; border-radius: 10px; font-size: 3rem; font-weight: bold; box-shadow: inset -3px -3px 0 rgba(0,0,0,0.2), inset 3px 3px 0 rgba(255,255,255,0.4), 0 8px 0 var(--block-border), 0 15px 20px rgba(0,0,0,0.1); cursor: pointer; transition: all 0.1s; min-width: 100px; text-align: center; border: 4px solid var(--block-border); text-shadow: 2px 2px 0 rgba(255,255,255,0.8); }
.syllable-draggable:hover { transform: translateY(-5px); box-shadow: inset -3px -3px 0 rgba(0,0,0,0.2), inset 3px 3px 0 rgba(255,255,255,0.4), 0 12px 0 var(--block-border), 0 20px 30px rgba(0,0,0,0.2); background: #ffdb4d; }
.syllable-draggable:active { transform: translateY(8px); box-shadow: 0 0 0 transparent; }
.wrong-shake { animation: shake 0.5s; background: #e74c3c !important; border-color: #8B0000 !important; box-shadow: 0 8px 0 #8B0000 !important; color: white !important; text-shadow: none !important; }
.game-result { font-size: 3.5rem; margin-top: 20px; color: #fff; text-shadow: 2px 2px 0px #000, 4px 4px 10px rgba(0,0,0,0.2); text-align: center; line-height: 1.4; background: var(--secondary); padding: 20px; border-radius: 15px; border: 4px solid var(--block-border); transform: rotate(-2deg); box-shadow: inset -3px -3px 0 rgba(0,0,0,0.2), inset 3px 3px 0 rgba(255,255,255,0.4), 0 10px 0 var(--block-border), 0 15px 25px rgba(0,0,0,0.2); }

/* أين الحرف (البطاقات على شكل أوراق شجر) */
.find-zone { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; margin-top: 30px; }
.find-card { background: #FFF8E7; border: 4px solid var(--block-border); border-radius: 15px; padding: 22px 15px; text-align: center; cursor: pointer; transition: 0.2s; width: 150px; font-size: 1.8rem; box-shadow: inset -3px -3px 0 rgba(0,0,0,0.1), inset 3px 3px 0 rgba(255,255,255,0.4), 0 8px 0 var(--block-border), 0 10px 20px rgba(0,0,0,0.1); color: #3e2723; font-weight: bold; }
.find-card:hover { transform: translateY(-10px); background: #fff; box-shadow: inset -3px -3px 0 rgba(0,0,0,0.1), inset 3px 3px 0 rgba(255,255,255,0.4), 0 12px 0 var(--block-border), 0 15px 30px rgba(0,0,0,0.2); }
.find-card.correct { background: var(--secondary); border-color: var(--secondary-dark); color: white; animation: pulse 0.5s; pointer-events: none; box-shadow: inset -3px -3px 0 rgba(0,0,0,0.2), inset 3px 3px 0 rgba(255,255,255,0.4), 0 5px 0 var(--secondary-dark); }
.find-card .emoji { font-size: 4rem; display: block; margin-bottom: 15px; text-shadow: 2px 2px 5px rgba(0,0,0,0.1); }

/* نجمة طائرة */
.flying-star {
    position: fixed;
    font-size: 3rem;
    z-index: 9999;
    pointer-events: none;
    animation: flystar 1s ease-out forwards;
}
@keyframes flystar {
    0%   { transform: translate(-50%, -50%) scale(0.5) rotate(0deg); opacity: 1; }
    60%  { transform: translate(-50%, -140%) scale(1.4) rotate(180deg); opacity: 1; }
    100% { transform: translate(-50%, -260%) scale(0.8) rotate(360deg); opacity: 0; }
}

/* ألعاب ماريو المخصصة */
.mario-mystery-box {
    background: #FFD230;
    border: 4px solid var(--block-border);
    border-radius: 8px;
    width: 140px;
    height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: inset -3px -3px 0 rgba(0,0,0,0.2), inset 3px 3px 0 rgba(255,255,255,0.4), 0 8px 0 var(--block-border);
    font-size: 3.5rem;
    font-weight: 900;
    color: #c0392b;
    text-shadow: 2px 2px 0 #fff;
    position: relative;
    transition: 0.1s;
}
.mario-mystery-box:hover {
    transform: translateY(-5px);
    background: #ffeaa7;
}
.mario-mystery-box:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 transparent;
}
.mario-mystery-box.hit {
    background: #8B4513;
    color: #8B4513;
    text-shadow: none;
    box-shadow: inset 3px 3px 0 rgba(0,0,0,0.4), inset -3px -3px 0 rgba(255,255,255,0.1), 0 8px 0 var(--block-border);
    pointer-events: none;
    transform: translateY(-10px);
}
.mario-mystery-box.wrong {
    animation: shake 0.5s;
}
.mario-mystery-box .box-word {
    font-size: 1.6rem;
    color: #3e2723;
    text-shadow: none;
    margin-top: 5px;
    display: block;
}

.mario-pop-item {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.5rem;
    pointer-events: none;
    opacity: 0;
    z-index: 10;
}
.mario-pop-anim {
    animation: popUpItem 1s forwards;
}
@keyframes popUpItem {
    0% { opacity: 1; top: 50%; }
    50% { opacity: 1; top: -60px; }
    100% { opacity: 0; top: -100px; }
}

.mario-jump-stage {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 15px;
    margin: 40px 0;
    position: relative;
    min-height: 120px;
    padding-left: 100px; /* Space for starting player */
}
.mario-player {
    position: absolute;
    bottom: 0;
    left: 10px;
    font-size: 4.5rem;
    transition: left 0.4s ease-in-out;
    z-index: 20;
    transform-origin: bottom center;
}
.mario-player.jumping {
    animation: playerJump 0.4s ease-out;
}
@keyframes playerJump {
    0% { bottom: 0; }
    50% { bottom: 100px; transform: scale(1.1) rotate(10deg); }
    100% { bottom: 140px; transform: scale(1) rotate(0deg); } /* lands on top of the block */
}

@keyframes fadeIn { from{ opacity:0; } to{ opacity:1; } }
@keyframes shake { 0%,100%{ transform: translateX(0); } 25%{ transform: translateX(-10px) rotate(-5deg); } 75%{ transform: translateX(10px) rotate(5deg); } }

/* صندوق تسجيل الدخول */
.login-box {
    background: white;
    max-width: 400px;
    margin: 3rem auto;
    padding: 2.5rem;
    border-radius: 25px;
    box-shadow: var(--shadow);
    text-align: center;
    border: var(--border-dark);
    position: relative;
    z-index: 10;
}
.login-box input {
    width: 80%;
    padding: 15px;
    margin-bottom: 20px;
    border: var(--border-dark);
    border-radius: 12px;
    font-size: 1.5rem;
    font-family: inherit;
    text-align: center;
    color: var(--text);
    transition: 0.3s;
}
.login-box input:focus {
    border-color: var(--secondary);
    outline: none;
    transform: scale(1.05) rotate(1deg);
}

/* تنسيق النص الكامل للدرس التفاعلي */
.lesson-full-text {
    direction: rtl;
    line-height: 2.2;
    font-size: 32px;
    color: #3E2723;
    background: #FFF8E7;
    border-radius: 15px;
    border: 4px solid var(--block-border);
    padding: 35px;
    margin: 25px auto;
    max-width: 800px;
    text-align: center;
    box-shadow: inset -5px -5px 0 rgba(0,0,0,0.05), 0 8px 0 var(--block-border);
}

.lesson-line {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
}

.word-clickable {
    cursor: pointer;
    padding: 2px 12px;
    border-radius: 15px;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-block;
    color: #3e2723;
    font-weight: 800;
    border: 3px solid transparent;
    position: relative;
}

.word-clickable:hover {
    background: var(--accent);
    color: #3e2723;
    transform: scale(1.15) translateY(-3px) rotate(-3deg);
    border: 3px solid var(--block-border);
}

.word-clickable.speaking {
    background: var(--primary) !important;
    color: white !important;
    transform: scale(1.22) translateY(-5px) rotate(3deg);
    box-shadow: inset -3px -3px 0 rgba(0,0,0,0.2), 0 6px 0 var(--block-border);
    border: 4px solid var(--block-border) !important;
}

.word-clickable.speaking::before {
    content: '🍄';
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2.5rem;
    animation: floatMushroom 0.4s infinite alternate;
    pointer-events: none;
}

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

/* التجاوب مع جميع أحجام الشاشات */
@media screen and (max-width: 768px) {
    .app-header h1 { font-size: 2.2rem; }
    .app-header p { font-size: 1.2rem; }
    
    .lessons-path {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 0 10px;
    }

    .lesson-node {
        width: 140px;
        height: 140px;
        padding: 10px;
        font-size: 1rem;
    }
    
    #lesson-view {
        margin: 1rem;
        padding: 1rem;
        border-radius: 20px;
    }

    .lesson-title { font-size: 2rem; }

    .lesson-tabs { max-width: 100%; padding: 10px 0 40px; }
    
    .tab-btn {
        padding: 10px 15px;
        font-size: 1.1rem;
        min-height: auto;
    }
    .tab-btn .speaker-icon {
        font-size: 1.2rem;
        padding: 5px;
    }

    .tab-content { padding: 1rem; min-height: auto; }
    
    .lesson-full-text {
        font-size: 2.2rem;
        padding: 20px;
        line-height: 2;
    }
    
    .big-letter {
        width: 150px;
        height: 150px;
        font-size: 6rem;
    }

    .haraka-display { font-size: 3rem; }
    .haraka-card { padding: 10px; }
    
    .mad-block { width: 120px; padding: 15px 10px; }
    .mad-letters { font-size: 3rem; }

    .action-btn { padding: 10px 25px; font-size: 1.2rem; border-radius: 20px; }

    .game-result { font-size: 2.2rem; }
    .syllable-draggable { padding: 10px 15px; font-size: 1.8rem; }
    
    .login-box {
        margin: 2rem 1rem;
        padding: 1.5rem;
    }
    
    .login-box input {
        width: 100%;
        box-sizing: border-box;
        padding: 12px;
        font-size: 1.2rem;
    }
    
    .draw-sub-btn {
        padding: 15px 25px;
        font-size: 1.4rem;
        min-height: 65px;
        width: 100%;
        max-width: 250px;
        gap: 15px;
    }
}

@media screen and (max-width: 480px) {
    .app-header h1 { font-size: 1.8rem; }
    .tab-btn { flex: 1 1 calc(50% - 10px); font-size: 1rem; padding: 8px 5px; }
    .big-letter { width: 120px; height: 120px; font-size: 5rem; }
    .harakat-grid { grid-template-columns: repeat(2, 1fr); }
    .lesson-tabs { gap: 10px 5px; }
    .lesson-full-text { font-size: 1.8rem; padding: 15px; line-height: 1.8; }
}

/* التبويب 7: المصحح الصوتي */
.mic-btn {
    background: var(--primary);
    color: white;
    font-size: 4rem;
    border: none;
    border-radius: 50%;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(255, 71, 87, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
}
.mic-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 25px rgba(255, 71, 87, 0.5);
}
.mic-btn:active {
    transform: translateY(5px) scale(0.95);
    box-shadow: 0 5px 10px rgba(255, 71, 87, 0.4);
}
.mic-btn.listening {
    background: var(--success, #2ecc71);
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
    animation: micPulse 1.5s infinite;
}
@keyframes micPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 30px rgba(46, 204, 113, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

/* تبويب الإملاء */
@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    80% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
.dictation-answer {
    text-align: center;
    background: var(--bg-color);
    padding: 10px;
    border-radius: 15px;
    border: 2px dashed var(--primary);
}

/* مستكشف الأحرف */
.letter-form-card {
    background: #fff;
    border: 4px solid #8B4513;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    width: 100%;
    box-shadow: inset -4px -4px 0px rgba(0,0,0,0.1), 0 6px 0 #8B4513;
    transition: transform 0.3s;
}
.letter-form-card:hover {
    transform: translateY(-5px);
}
.letter-form-card .form-title {
    font-size: 1.2rem;
    color: #7f8c8d;
    margin-bottom: 15px;
    font-weight: bold;
}
.letter-form-card .form-char {
    font-size: 5rem;
    color: var(--primary);
    font-weight: bold;
    margin-bottom: 15px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.letter-btn {
    background: #FFD230;
    border: 4px solid #8B4513;
    border-radius: 10px;
    font-size: 3.5rem;
    font-weight: 900;
    color: #3E2723;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin: 10px;
    box-shadow: inset -5px -5px 0px rgba(0,0,0,0.2), inset 5px 5px 0px rgba(255,255,255,0.4), 0 5px 0 #8B4513, 0 10px 10px rgba(0,0,0,0.3);
    z-index: 2;
}

.letter-btn:nth-child(even) {
    background: #FF2B2B;
    border-color: #8B0000;
    color: white;
    box-shadow: inset -5px -5px 0px rgba(0,0,0,0.2), inset 5px 5px 0px rgba(255,255,255,0.4), 0 5px 0 #8B0000, 0 10px 10px rgba(0,0,0,0.3);
}

.letter-btn:nth-child(3n) {
    background: #28D84D;
    border-color: #006400;
    color: white;
    box-shadow: inset -5px -5px 0px rgba(0,0,0,0.2), inset 5px 5px 0px rgba(255,255,255,0.4), 0 5px 0 #006400, 0 10px 10px rgba(0,0,0,0.3);
}

.letter-btn:hover {
    transform: scale(1.1) translateY(-10px);
    background: #ffdb4d;
    color: #3E2723;
}

.letter-btn:nth-child(even):hover {
    background: #ff4d4d;
    color: white;
}

.letter-btn:nth-child(3n):hover {
    background: #4dff70;
    color: white;
}


/* شريط التقدم */
.progress-container {
    width: 100%;
    max-width: 600px;
    background-color: #E0E0E0;
    border-radius: 20px;
    margin: 15px auto;
    height: 25px;
    overflow: hidden;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}
.progress-bar {
    height: 100%;
    background-color: var(--success);
    width: 0%;
    border-radius: 20px;
    transition: width 0.5s ease-in-out;
    background-image: linear-gradient(45deg, rgba(255,255,255,0.2) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.2) 75%, transparent 75%, transparent);
    background-size: 30px 30px;
    animation: moveStripes 1s linear infinite;
}
@keyframes moveStripes {
    0% { background-position: 0 0; }
    100% { background-position: 30px 0; }
}

/* المستكشف الصغير (المرشد) */
.little-explorer-mascot {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 80px;
    height: 80px;
    background: white;
    border: 3px solid var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    box-shadow: 0 5px 15px rgba(33, 150, 243, 0.4);
    z-index: 10000;
    transition: top 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), left 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}
.mascot-bubble {
    position: absolute;
    bottom: 90px;
    left: 0;
    background: white;
    padding: 15px 20px;
    border-radius: 20px 20px 20px 0;
    border: 2px solid var(--primary);
    font-size: 1.2rem;
    color: var(--text);
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
    pointer-events: none;
}
.mascot-bubble.show {
    opacity: 1;
    transform: scale(1);
}
@keyframes floatMascot {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* أنابيب ماريو (لعبة المطابقة) */
.mario-pipe {
    width: 140px;
    height: 160px;
    background: linear-gradient(to right, #2ecc71, #27ae60, #2ecc71);
    border: 6px solid #000;
    position: relative;
    box-shadow: inset -10px 0 20px rgba(0,0,0,0.3), 0 10px 20px rgba(0,0,0,0.3);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 30px;
    color: white;
    font-size: 3rem;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
}
.mario-pipe::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -10px;
    right: -10px;
    height: 40px;
    background: linear-gradient(to right, #2ecc71, #27ae60, #2ecc71);
    border: 6px solid #000;
    border-radius: 5px;
}

/* قوالب ماريو (لعبة البرج) */
.mario-brick {
    background: #c0392b;
    background-image: 
        linear-gradient(335deg, rgba(255,255,255,0.1) 15px, transparent 15px),
        linear-gradient(155deg, rgba(255,255,255,0.1) 15px, transparent 15px),
        linear-gradient(335deg, rgba(255,255,255,0.1) 15px, transparent 15px),
        linear-gradient(155deg, rgba(255,255,255,0.1) 15px, transparent 15px);
    background-size: 30px 30px;
    background-position: 0px 0px, 15px 15px, 15px 15px, 0px 0px;
    border: 3px solid #000;
    border-bottom-width: 6px;
    color: white;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
    box-shadow: inset 2px 2px 5px rgba(255,255,255,0.3);
}

/* قلعة باوزر (لعبة الفرز) */
.mario-castle-belt {
    background: #333;
    border-top: 10px solid #8B0000;
    border-bottom: 10px solid #8B0000;
    box-shadow: inset 0 0 20px #ff0000;
}
.mario-sorter-item {
    background: #ffdb4d;
    border: 4px solid #3E2723;
    border-radius: 10px !important;
    box-shadow: inset -3px -3px 0 rgba(0,0,0,0.2), 0 5px 0 #3E2723 !important;
}

/* غابة ماريو (لعبة البحث) */
.mario-forest-bg {
    background: linear-gradient(to bottom, #5c94fc 0%, #87CEEB 100%);
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    border: 6px solid var(--block-border);
}
.mario-bush {
    position: absolute;
    bottom: 0;
    font-size: 6rem;
    z-index: 5;
    text-shadow: 0 5px 0 rgba(0,0,0,0.2);
}
.mario-cloud {
    position: absolute;
    font-size: 5rem;
    z-index: 1;
    opacity: 0.9;
}
