:root {
    /* --- Masha and the Bear Theme Colors --- */
    --masha-pink: #E91E63;
    --masha-pink-dark: #C2185B;
    --masha-pink-light: #FF4081;
    --masha-fuchsia: #D81B60;
    
    --bear-brown: #5D4037;
    --bear-brown-dark: #3E2723;
    --bear-brown-light: #8D6E63;
    --wood-bark: #4E342E;
    
    --forest-green: #2E7D32;
    --forest-green-light: #4CAF50;
    --forest-mint: #E8F5E9;
    
    --honey-gold: #FFB300;
    --honey-amber: #FFA000;
    --honey-light: #FFF8E1;
    --sunflower-yellow: #FFD54F;
    
    --card-bg: #FFFFFF;
    --text-main: #3E2723;
    --text-muted: #6D4C41;
    --text-dim: #795548;
    
    --border-radius: 20px;
    --radius-xl: 28px;
    --radius-lg: 18px;
}

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

body {
    font-family: 'Tajawal', 'Changa', 'Cairo', sans-serif;
    background-color: #F8F5EE;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(233, 30, 99, 0.05), transparent 30%),
        radial-gradient(circle at 90% 40%, rgba(255, 179, 0, 0.07), transparent 35%),
        linear-gradient(180deg, #FFFDF9 0%, #F5EFE6 100%);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    direction: rtl;
    position: relative;
}

/* Floating subtle background elements */
.floating-forest-bg {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.forest-leaf {
    position: absolute;
    font-size: 2rem;
    opacity: 0.15;
    animation: gentleFloat 12s infinite ease-in-out;
}

.leaf-1 { top: 12%; left: 6%; }
.leaf-2 { top: 35%; right: 4%; }
.leaf-3 { top: 65%; left: 8%; }
.leaf-4 { top: 82%; right: 7%; }
.leaf-5 { top: 48%; left: 50%; }

@keyframes gentleFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
}

.view {
    display: none;
    padding: 1rem;
    max-width: 1350px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 1;
}

.view.active-view {
    display: block;
    animation: viewEnter 0.4s ease-out;
}

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

/* --- Premium Masha & Bear Header --- */
.masha-premium-header {
    background: linear-gradient(135deg, #4E342E 0%, #5D4037 45%, #3E2723 100%);
    color: #FFFDF9;
    border-radius: 0 0 35px 35px;
    box-shadow: 0 10px 30px rgba(62, 39, 35, 0.25);
    border-bottom: 5px solid var(--honey-gold);
    position: relative;
    overflow: hidden;
    margin-bottom: 1rem;
}

.masha-premium-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
}

/* Top Navbar Layer */
.header-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 2.5rem;
    position: relative;
    z-index: 2;
    gap: 1.5rem;
}

/* Right: Student Profile & Game Action Group */
.nav-right-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Identical Dimensions & Box Model for both Buttons */
.nav-user-badge, .play-masha-btn {
    height: 62px;
    min-width: 215px;
    box-sizing: border-box;
    border-radius: 50px;
    border: 2px solid rgba(255, 215, 79, 0.45);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.nav-user-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    padding: 0 1.2rem 0 0.55rem;
    cursor: pointer;
}

.nav-user-badge:hover {
    transform: translateY(-2px);
    border-color: var(--honey-gold);
    box-shadow: 0 6px 20px rgba(255, 179, 0, 0.25);
}

.nav-avatar-wrap {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #FFF;
    border: 3px solid var(--honey-gold);
    box-shadow: 0 0 12px rgba(255, 179, 0, 0.5);
    flex-shrink: 0;
}

.nav-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-star-badge {
    position: absolute;
    bottom: -4px;
    left: -4px;
    font-size: 1rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.nav-user-details {
    display: flex;
    align-items: center;
}

.nav-user-name {
    font-size: 1.15rem;
    font-weight: 800;
    color: #FFFFFF;
    font-family: 'Marhey', 'Tajawal', sans-serif;
    letter-spacing: 0.3px;
    line-height: 1;
}

/* Center: Platform Logo & Title */
.nav-title-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.nav-title-capsule {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.nav-emoji-cluster {
    font-size: 1.3rem;
    margin-bottom: 2px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    animation: gentleBob 3s infinite ease-in-out;
}

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

.nav-title-capsule h1 {
    font-family: 'Marhey', 'Changa', sans-serif;
    font-size: 2.1rem;
    font-weight: 700;
    color: #FFFFFF;
    text-shadow: 0 2px 0 var(--masha-pink-dark), 0 0 20px rgba(233, 30, 99, 0.4);
    margin: 0;
    line-height: 1.2;
}

.nav-subject-tag {
    font-size: 0.85rem;
    font-weight: 800;
    color: #3E2723;
    background: linear-gradient(135deg, var(--honey-gold), var(--sunflower-yellow));
    padding: 2px 14px;
    border-radius: 20px;
    margin-top: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-family: 'Changa', sans-serif;
}

/* Play with Masha Button - Exactly same size as Profile Badge */
.play-masha-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #FFFFFF;
    padding: 0 1.4rem;
    font-family: 'Marhey', 'Tajawal', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1;
}

.play-masha-btn:hover {
    transform: translateY(-2px);
    background: rgba(255, 215, 79, 0.2);
    border-color: var(--honey-gold);
    color: var(--sunflower-yellow);
    box-shadow: 0 6px 20px rgba(255, 179, 0, 0.35);
}

.play-masha-btn .btn-icon {
    font-size: 1.35rem;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.play-masha-btn .btn-badge {
    font-size: 1.15rem;
    line-height: 1;
}

/* Left: Portal Home Button in Upper Corner */
.nav-action-left {
    position: absolute;
    top: 18px;
    left: 24px;
    z-index: 10;
    display: flex;
    align-items: center;
}

.portal-home-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08));
    backdrop-filter: blur(10px);
    color: #FFFFFF;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.portal-home-btn:hover {
    transform: translateY(-2px) scale(1.12);
    background: linear-gradient(135deg, var(--masha-pink), var(--masha-pink-dark));
    border-color: #FFFFFF;
    box-shadow: 0 6px 20px rgba(233, 30, 99, 0.45);
}

.portal-home-btn .btn-icon {
    font-size: 1.45rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Bottom: Hero Welcome Strip */
.header-hero-strip {
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.65rem 1.5rem;
    position: relative;
    z-index: 2;
}

.hero-strip-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.98rem;
    font-family: 'Tajawal', sans-serif;
}

.hero-bear-greeting {
    color: var(--sunflower-yellow);
    font-weight: 800;
}

.hero-divider {
    color: rgba(255, 255, 255, 0.4);
}

.hero-subtitle {
    color: #F5EBE6;
    font-weight: 600;
}

/* --- Multi-Column Lesson Adventure Grid --- */
.lesson-path-container {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    gap: 1.2rem !important;
    padding: 2.5rem 1rem !important;
    max-width: 1350px !important;
    margin: 0 auto !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.lesson-adventure-card {
    background: #FFFFFF;
    border-radius: 20px;
    padding: 1rem 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(93, 64, 55, 0.08);
    border: 2px solid #F0EAE4;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-sizing: border-box;
    width: 100%;
}

.lesson-adventure-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 14px 28px rgba(233, 30, 99, 0.18);
}

/* Themes */
.card-theme-0 { border-top: 5px solid #FF4081; }
.card-theme-0:hover { border-color: #FF80AB; }
.card-theme-0 .card-stage-bubble { background: linear-gradient(135deg, #FCE4EC, #F8BBD0); border-color: #FF80AB; }
.card-theme-0 .card-action-btn { background: linear-gradient(135deg, #E91E63, #C2185B); }

.card-theme-1 { border-top: 5px solid #FFB300; }
.card-theme-1:hover { border-color: #FFD54F; }
.card-theme-1 .card-stage-bubble { background: linear-gradient(135deg, #FFF8E1, #FFECB3); border-color: #FFD54F; }
.card-theme-1 .card-action-btn { background: linear-gradient(135deg, #FFB300, #FF8F00); color: #3E2723; }

.card-theme-2 { border-top: 5px solid #4CAF50; }
.card-theme-2:hover { border-color: #81C784; }
.card-theme-2 .card-stage-bubble { background: linear-gradient(135deg, #E8F5E9, #C8E6C9); border-color: #81C784; }
.card-theme-2 .card-action-btn { background: linear-gradient(135deg, #4CAF50, #2E7D32); }

.card-theme-3 { border-top: 5px solid #00BCD4; }
.card-theme-3:hover { border-color: #4DD0E1; }
.card-theme-3 .card-stage-bubble { background: linear-gradient(135deg, #E0F7FA, #B2EBF2); border-color: #4DD0E1; }
.card-theme-3 .card-action-btn { background: linear-gradient(135deg, #00BCD4, #00838F); }

.card-theme-4 { border-top: 5px solid #AB47BC; }
.card-theme-4:hover { border-color: #CE93D8; }
.card-theme-4 .card-stage-bubble { background: linear-gradient(135deg, #F3E5F5, #E1BEE7); border-color: #CE93D8; }
.card-theme-4 .card-action-btn { background: linear-gradient(135deg, #AB47BC, #6A1B9A); }

/* Header inside card */
.card-header-pill {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 0.4rem;
}

.lesson-status-pill {
    font-size: 0.78rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 20px;
    font-family: 'Changa', sans-serif;
}

.lesson-status-pill.new {
    background: #FFF8E1;
    color: #795548;
    border: 1px solid #FFE082;
}

.lesson-status-pill.completed {
    background: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #A5D6A7;
}

/* Character Bubble Stage */
.card-stage-bubble {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0.2rem 0 0.6rem 0;
    position: relative;
    border: 3px solid #FFFFFF;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.lesson-adventure-card:hover .card-stage-bubble {
    transform: translateY(-5px) scale(1.06);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

.card-masha-img {
    width: 85px;
    height: 85px;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.12));
    transition: transform 0.35s ease;
}

.lesson-adventure-card:hover .card-masha-img {
    transform: scale(1.1) rotate(4deg);
}

/* Info Section */
.card-info-section {
    width: 100%;
    margin-bottom: 0.8rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--bear-brown-dark);
    margin-bottom: 0.3rem;
    font-family: 'Changa', 'Tajawal', sans-serif;
    line-height: 1.35;
    min-height: 2.7em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-type-chip {
    font-size: 0.75rem;
    font-weight: 700;
    color: #8D6E63;
    background: #F5EFEA;
    padding: 2px 10px;
    border-radius: 12px;
}

/* Action Button inside card */
.card-action-btn {
    width: 100%;
    padding: 0.6rem 0.8rem;
    color: #FFFFFF;
    border-radius: 50px;
    font-weight: 800;
    font-family: 'Changa', 'Tajawal', sans-serif;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.25s ease;
    border: 2px solid rgba(255,255,255,0.4);
}

.lesson-adventure-card:hover .card-action-btn {
    transform: scale(1.03);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.action-icon {
    transition: transform 0.3s ease;
}

.lesson-adventure-card:hover .action-icon {
    transform: translateX(-4px) scale(1.2);
}

/* --- Lesson View Navigation --- */
.lesson-header-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 1.5rem;
    background: #FFFFFF;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 6px 18px rgba(93, 64, 55, 0.08);
    border: 2px solid #EFEBE9;
    border-right: 6px solid var(--masha-pink);
}

.back-btn {
    background: linear-gradient(135deg, #795548, #5D4037);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 800;
    font-family: 'Changa', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 10px rgba(93, 64, 55, 0.2);
    white-space: nowrap;
}

.back-btn:hover {
    transform: translateX(3px);
    background: linear-gradient(135deg, var(--masha-pink), var(--masha-pink-dark));
}

.lesson-title-box {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-grow: 1;
}

.lesson-bear-icon {
    font-size: 1.8rem;
}

#lesson-title-display {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--bear-brown-dark);
    font-family: 'Changa', 'Tajawal', sans-serif;
}

.progress-bar-container {
    width: 100px;
    height: 8px;
    background: #EFEBE9;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--forest-green-light), var(--honey-gold));
    border-radius: 10px;
    transition: width 0.3s;
}

/* --- Tabs --- */
.lesson-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 1.8rem;
    flex-wrap: wrap;
}

.tab-trigger {
    padding: 0.7rem 1.5rem;
    border: 2px solid #E0D6CD;
    border-radius: 50px;
    background: #FFFFFF;
    color: var(--bear-brown);
    font-weight: 800;
    font-family: 'Changa', 'Tajawal', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 1rem;
    box-shadow: 0 3px 8px rgba(93, 64, 55, 0.05);
}

.tab-trigger:hover {
    transform: translateY(-2px);
    border-color: var(--masha-pink-light);
    color: var(--masha-pink);
}

.tab-trigger.active {
    background: linear-gradient(135deg, var(--masha-pink), var(--masha-pink-dark));
    color: #FFFFFF;
    border-color: var(--masha-pink-dark);
    box-shadow: 0 6px 16px rgba(233, 30, 99, 0.3);
}

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

.tab-content {
    display: none;
    animation: tabSlideIn 0.35s cubic-bezier(0.23, 1, 0.32, 1);
}

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

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

/* --- Lesson Banner Illustration --- */
.lesson-cover-banner {
    margin-bottom: 1.5rem;
    width: 100%;
}

.lesson-banner-card {
    background: #FFFFFF;
    border-radius: var(--radius-lg);
    border: 2px solid #EFEBE9;
    box-shadow: 0 6px 18px rgba(93, 64, 55, 0.08);
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1rem 1.5rem;
    background-image: linear-gradient(135deg, #FFFDFB 60%, #FCE4EC 100%);
}

.lesson-banner-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 16px;
    border: 2px solid var(--honey-gold);
    flex-shrink: 0;
}

.lesson-banner-caption h3 {
    font-size: 1.3rem;
    color: var(--bear-brown-dark);
    font-family: 'Changa', sans-serif;
    font-weight: 800;
    margin: 3px 0;
}

.lesson-banner-caption p {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
}

.banner-badge {
    background: var(--honey-gold);
    color: #3E2723;
    font-size: 0.8rem;
    font-weight: 800;
    padding: 2px 10px;
    border-radius: 20px;
    display: inline-block;
}

/* --- Reader Tab --- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 10px;
}

.section-header h3 {
    font-size: 1.3rem;
    color: var(--bear-brown-dark);
    font-family: 'Changa', sans-serif;
    font-weight: 800;
}

.info-bubble {
    background: #FFF8E1;
    color: #795548;
    border: 1px solid #FFE082;
    padding: 0.8rem 1.2rem;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
}

.text-display {
    background: #FFFFFF;
    color: #2D1A12;
    padding: 2.8rem 2rem;
    border-radius: var(--radius-xl);
    font-size: 2.1rem;
    line-height: 2.4;
    box-shadow: 0 10px 30px rgba(93, 64, 55, 0.08);
    text-align: center;
    border: 3px solid #EFEBE9;
    border-top: 6px solid var(--masha-pink);
    font-family: 'Tajawal', sans-serif;
}

.reading-line {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    margin: 3px 2px;
    border: 2px solid transparent;
}

.reading-line:hover {
    background: #FCE4EC;
    border-color: #F8BBD0;
    color: var(--masha-pink-dark);
}

.reading-line.playing {
    background: linear-gradient(135deg, var(--masha-pink), var(--masha-pink-dark));
    color: #FFFFFF;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(233, 30, 99, 0.3);
}

/* --- Vocabulary --- */
.vocab-header-info h3 {
    font-size: 1.3rem;
    color: var(--bear-brown-dark);
    margin-bottom: 1.2rem;
    font-family: 'Changa', sans-serif;
}

.vocab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.4rem;
}

.vocab-item {
    background: #FFFFFF;
    border: 2px solid #EFEBE9;
    border-top: 4px solid var(--honey-gold);
    padding: 1.8rem 1.2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    position: relative;
}

.vocab-item::before {
    content: '🍯';
    font-size: 1.6rem;
    display: block;
    margin-bottom: 0.4rem;
}

.vocab-item:hover {
    transform: translateY(-5px);
    border-color: var(--honey-gold);
    box-shadow: 0 10px 20px rgba(255, 179, 0, 0.2);
}

.vocab-word {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--bear-brown-dark);
    margin-bottom: 0.6rem;
    font-family: 'Changa', 'Tajawal', sans-serif;
}

.vocab-meaning {
    color: #5D4037;
    font-size: 1.15rem;
    font-weight: 700;
    background: #FFF8E1;
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px dashed #FFD54F;
    opacity: 0;
    transform: translateY(6px);
    transition: all 0.25s ease;
}

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

/* --- Masha Themed Games --- */
.game-menu h3 {
    text-align: center;
    color: var(--bear-brown-dark);
    font-size: 1.6rem;
    font-weight: 800;
    font-family: 'Changa', sans-serif;
    margin-bottom: 1.5rem;
}

.game-options-grid {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.game-card-btn {
    background: #FFFFFF;
    border: 2px solid #EFEBE9;
    border-radius: var(--radius-lg);
    padding: 1.8rem 1.2rem;
    width: 220px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    color: var(--bear-brown-dark);
    text-align: center;
}

.game-card-racing { border-top: 5px solid var(--forest-green-light); }
.game-card-shooting { border-top: 5px solid var(--masha-pink); }
.game-card-jumping { border-top: 5px solid var(--honey-gold); }

.game-card-btn:hover {
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 12px 24px rgba(233, 30, 99, 0.18);
}

.game-card-btn .game-icon {
    font-size: 3.2rem;
    display: block;
}

.game-card-btn h4 {
    font-size: 1.2rem;
    font-family: 'Changa', sans-serif;
    font-weight: 800;
    color: var(--bear-brown-dark);
}

.game-card-btn p {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 600;
}

.game-arena {
    background: #FFFFFF;
    border-radius: var(--radius-xl);
    padding: 2rem 1.5rem 1.5rem 1.5rem;
    border: 2px solid #EFEBE9;
    border-top: 5px solid var(--masha-pink);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
    min-height: 380px;
    margin-top: 1rem;
}

.game-arena-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.game-badge {
    background: #FFF8E1;
    color: var(--bear-brown);
    padding: 5px 14px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 0.95rem;
    border: 1px solid #FFE082;
}

.mini-btn {
    background: linear-gradient(135deg, var(--masha-pink), var(--masha-pink-dark));
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0.55rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 800;
    font-family: 'Changa', sans-serif;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(233, 30, 99, 0.25);
    transition: all 0.25s ease;
}

.mini-btn:hover {
    transform: translateY(-2px);
}

/* Racing Game */
.timer-bar {
    width: 100%;
    height: 8px;
    background: #EFEBE9;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.timer-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #81C784);
}

.racing-track {
    width: 100%;
    height: 140px;
    border-bottom: 5px solid #8D6E63;
    position: relative;
    margin-bottom: 1.5rem;
    background: linear-gradient(180deg, #E8F5E9 0%, #C8E6C9 100%);
    border-radius: 14px 14px 0 0;
}

.runner-character {
    position: absolute;
    bottom: 6px;
    right: 12px;
    font-size: 3rem;
    transition: right 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), bottom 0.3s;
    z-index: 2;
}

.runner-character.jumping {
    bottom: 60px;
}

.bear-finish-house {
    position: absolute;
    bottom: 4px;
    left: 12px;
    font-size: 3rem;
    z-index: 1;
}

.obstacle {
    position: absolute;
    bottom: 15px;
    left: 22%;
    background: #FFFFFF;
    padding: 0.8rem 1.4rem;
    border-radius: 14px;
    border: 2px solid var(--honey-gold);
    font-weight: 800;
    color: var(--bear-brown-dark);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 3;
    min-width: 160px;
    text-align: center;
    font-size: 1.1rem;
}

.racing-answers {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.racing-ans-btn {
    padding: 0.8rem 1.6rem;
    font-size: 1.1rem;
    font-weight: 800;
    font-family: 'Tajawal', sans-serif;
    background: #FFFFFF;
    color: var(--bear-brown-dark);
    border: 2px solid #D7CCC8;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.racing-ans-btn:hover {
    background: #FFF8E1;
    border-color: var(--honey-gold);
    transform: scale(1.03);
}

/* Shooting Game */
.shooting-title {
    text-align: center;
    color: var(--bear-brown-dark);
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    font-weight: 800;
    font-family: 'Changa', sans-serif;
}

.shooting-area {
    position: relative;
    width: 100%;
    height: 340px;
    background: linear-gradient(180deg, #FCE4EC 0%, #FFF8E1 100%);
    border-radius: var(--radius-lg);
    border: 2px solid #F8BBD0;
    overflow: hidden;
}

.moving-target {
    position: absolute;
    padding: 0.8rem 1.4rem;
    background: linear-gradient(135deg, var(--masha-pink), var(--masha-pink-dark));
    color: white;
    font-weight: 800;
    font-size: 1.15rem;
    border-radius: 50px;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 4px 14px rgba(233, 30, 99, 0.3);
    border: 2px solid #FFFFFF;
    transition: all 0.25s ease;
    font-family: 'Tajawal', sans-serif;
}

.moving-target::before {
    content: '🍓 ';
}

.moving-target.hit {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

/* Jumping Game */
.jumping-title {
    text-align: center;
    color: var(--bear-brown-dark);
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    font-weight: 800;
    font-family: 'Changa', sans-serif;
}

.jumping-sky {
    position: relative;
    width: 100%;
    height: 360px;
    background: linear-gradient(180deg, #E8F5E9 0%, #E1F5FE 100%);
    border-radius: var(--radius-lg);
    border: 2px solid #B2DFDB;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 1.5rem;
    overflow: hidden;
}

.jumper-character {
    font-size: 3rem;
    position: absolute;
    bottom: 15px;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2;
}

.bear-at-top {
    position: absolute;
    top: 12px;
    font-size: 2.8rem;
    z-index: 1;
}

.clouds-container {
    width: 100%;
    display: flex;
    justify-content: space-around;
    position: absolute;
    bottom: 95px;
    z-index: 3;
    flex-wrap: wrap;
    gap: 8px;
}

.cloud-platform {
    background: #FFFFFF;
    color: var(--bear-brown-dark);
    padding: 0.7rem 1.4rem;
    border-radius: 50px;
    font-weight: 800;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border: 2px solid #8D6E63;
    transition: all 0.25s ease;
    font-family: 'Tajawal', sans-serif;
}

.cloud-platform::before {
    content: '🪵 ';
}

.cloud-platform:hover {
    transform: translateY(-3px);
    border-color: var(--masha-pink);
}

/* --- Writing Canvas --- */
.writing-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    min-width: 300px;
    background: #FFFFFF;
    padding: 1.8rem;
    border-radius: var(--radius-xl);
    border: 2px solid #EFEBE9;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

#write-canvas {
    background: #FFFDF9;
    border-radius: var(--radius-lg);
    border: 5px solid #6D4C41;
    cursor: crosshair;
    width: 100%;
    max-width: 900px;
    height: 380px;
    display: block;
}

.secondary-btn {
    background: linear-gradient(135deg, #795548, #5D4037);
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    font-size: 0.95rem;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Changa', sans-serif;
    font-weight: 700;
    transition: 0.25s ease;
}

/* --- Quiz Tab --- */
.quiz-card {
    background: #FFFFFF;
    border-radius: var(--radius-xl);
    padding: 2.5rem 1.8rem;
    border: 2px solid #EFEBE9;
    border-top: 6px solid var(--honey-gold);
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    text-align: center;
    max-width: 750px;
    margin: 0 auto;
}

.quiz-card h3 {
    font-size: 1.6rem;
    color: var(--bear-brown-dark);
    margin-bottom: 1.6rem;
    font-family: 'Changa', 'Tajawal', sans-serif;
    font-weight: 800;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 550px;
    margin: 0 auto;
}

.option-btn {
    width: 100%;
    text-align: right;
    font-size: 1.15rem;
    padding: 0.9rem 1.5rem;
    border-radius: 16px;
    border: 2px solid #EFEBE9;
    background: #FAF8F5;
    color: var(--bear-brown-dark);
    transition: all 0.25s ease;
}

.option-btn:hover {
    background: #FFF8E1;
    border-color: var(--honey-gold);
}

/* --- Modals --- */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(62, 39, 35, 0.65);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #FFFFFF;
    border: 3px solid var(--honey-gold);
    border-radius: var(--radius-xl);
    padding: 2.2rem;
    text-align: center;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.celebration-icon {
    font-size: 4rem;
    margin-bottom: 0.6rem;
}

.celebration-content h2 {
    font-size: 1.6rem;
    font-family: 'Marhey', 'Changa', sans-serif;
    color: var(--masha-pink-dark);
    margin-bottom: 0.4rem;
}

.celebration-content p {
    font-size: 1.05rem;
    color: var(--text-muted);
    font-weight: 700;
}

.reward-stars {
    font-size: 2.2rem;
    margin: 1.2rem 0;
}

.primary-btn {
    background: linear-gradient(135deg, var(--masha-pink), var(--masha-pink-dark));
    color: white;
    border: none;
    padding: 0.85rem 2.2rem;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Changa', sans-serif;
    font-weight: 800;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(233, 30, 99, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
}

/* --- Checklist Items --- */
.checklist-item {
    display: flex;
    align-items: center;
    background: #FAF8F5;
    padding: 12px 16px;
    border-radius: 14px;
    border: 2px solid #EFEBE9;
    cursor: pointer;
}

.checklist-item.completed {
    background: #E8F5E9;
    border-color: #81C784;
}

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

.checklist-checkbox {
    width: 22px;
    height: 22px;
    margin-left: 12px;
    accent-color: #4CAF50;
}

.checklist-title {
    font-size: 1.05rem;
    font-weight: 800;
    flex-grow: 1;
    color: var(--bear-brown-dark);
}

/* --- Footer --- */
.app-footer {
    text-align: center;
    padding: 1.8rem 1rem;
    margin-top: auto;
    width: 100%;
    position: relative;
    z-index: 2;
}

.footer-link {
    text-decoration: none;
    color: var(--bear-brown);
    font-weight: 800;
    font-size: 1rem;
    opacity: 0.85;
    transition: 0.3s;
}

.footer-link:hover {
    opacity: 1;
    color: var(--masha-pink);
}

/* --- Drawing Studio Modal (Profile Click) --- */
.drawing-studio-content {
    max-width: 800px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.6rem;
    border-radius: 28px;
    background: #FFFFFF;
    border: 4px solid var(--honey-gold);
    box-shadow: 0 20px 60px rgba(62, 39, 35, 0.35);
}

.studio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 2px solid #F5EBE6;
    padding-bottom: 0.6rem;
}

.studio-title-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.studio-title-box h2 {
    font-size: 1.5rem;
    font-family: 'Marhey', 'Changa', sans-serif;
    color: var(--bear-brown-dark);
}

.close-studio-btn {
    background: #F5EBE6;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #795548;
    transition: all 0.2s ease;
}

.close-studio-btn:hover {
    background: var(--masha-pink);
    color: white;
    transform: rotate(90deg);
}

.drawing-challenge-banner {
    background: linear-gradient(135deg, #FFF8E1, #FCE4EC);
    border: 2px solid #FFD54F;
    border-radius: 18px;
    padding: 0.8rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 1rem;
}

.reference-masha-img {
    width: 75px;
    height: 75px;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.15));
    border-radius: 50%;
    background: #FFF;
    border: 2px solid var(--honey-gold);
    padding: 2px;
}

.challenge-text h3 {
    font-size: 1.15rem;
    color: var(--masha-pink-dark);
    font-family: 'Changa', sans-serif;
    font-weight: 800;
    margin-bottom: 2px;
}

.challenge-text p {
    font-size: 0.92rem;
    color: #5D4037;
    font-weight: 600;
}

.studio-canvas-wrap {
    width: 100%;
    border: 4px solid #5D4037;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 1rem;
    background: #FFFFFF;
}

#masha-draw-canvas {
    width: 100%;
    height: 360px;
    display: block;
    cursor: crosshair;
    background: #FFFFFF;
}

.studio-tools-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
    background: #FAF8F5;
    padding: 0.7rem 1.2rem;
    border-radius: 16px;
    border: 1px solid #EFEBE9;
}

.color-palette {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.color-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid #FFFFFF;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.color-btn:hover {
    transform: scale(1.18);
}

.color-btn.active {
    transform: scale(1.25);
    border-color: #3E2723;
    box-shadow: 0 0 0 2px #FFB300;
}

.color-btn.eraser-btn {
    background: #FFFFFF;
    border: 2px dashed #9E9E9E;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.brush-size-picker {
    display: flex;
    gap: 6px;
    align-items: center;
}

.size-btn {
    padding: 5px 12px;
    font-size: 0.85rem;
    border-radius: 12px;
    border: 1px solid #D7CCC8;
    background: #FFF;
    cursor: pointer;
    font-weight: 700;
    font-family: 'Changa', sans-serif;
    color: #5D4037;
    transition: all 0.2s ease;
}

.size-btn:hover {
    background: #FFF8E1;
}

.size-btn.active {
    background: #5D4037;
    color: white;
    border-color: #5D4037;
}

.studio-actions-footer {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    flex-wrap: wrap;
}

/* --- Clickable Profile Cursor --- */
.nav-user-badge {
    cursor: pointer;
}

.hidden { display: none !important; }

/* --- Responsive Media Queries --- */
@media (max-width: 900px) {
    .header-nav-bar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
        padding: 1.2rem 1rem;
    }
    
    .nav-title-center {
        order: -1;
        width: 100%;
        margin-bottom: 0.2rem;
    }

    .lesson-path-container {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
        gap: 1rem !important;
        padding: 1.5rem 0.8rem !important;
    }
}

@media (max-width: 600px) {
    .nav-title-capsule h1 {
        font-size: 1.7rem;
    }

    .nav-user-name {
        font-size: 1rem;
    }

    .nav-right-group {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-user-badge, .play-masha-btn {
        height: 52px;
        min-width: 160px;
        padding: 0 0.9rem;
    }

    .nav-avatar-wrap {
        width: 38px;
        height: 38px;
    }

    .nav-user-name, .play-masha-btn {
        font-size: 0.95rem;
    }

    .play-masha-btn .btn-icon {
        font-size: 1.15rem;
    }

    .portal-home-btn {
        width: 38px;
        height: 38px;
        padding: 0;
    }

    .portal-home-btn .btn-icon {
        font-size: 1.25rem;
    }

    .lesson-path-container {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.8rem !important;
        padding: 1.2rem 0.4rem !important;
    }
    
    .card-stage-bubble {
        width: 80px;
        height: 80px;
    }
    
    .card-masha-img {
        width: 65px;
        height: 65px;
    }
    
    .card-title {
        font-size: 0.95rem;
        min-height: 2.4em;
    }
    
    .card-action-btn {
        font-size: 0.82rem;
        padding: 0.45rem 0.4rem;
    }
    
    .text-display {
        font-size: 1.5rem;
        padding: 1.8rem 1rem;
    }
}
