/* ===================================================
   🐻 Masha and the Bear Theme - Science Platform 🍓
   Designed for Maram Ziad - Grade 3
   =================================================== */

: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;
    
    /* Legacy / Component Mapping */
    --primary-color: #E91E63;
    --primary-light: #FF4081;
    --secondary-color: #4CAF50;
    --secondary-light: #81C784;
    --accent-color: #FFB300;
    --accent-light: #FFD54F;
    --success-color: #2E7D32;
    --danger-color: #D32F2F;
    --background-color: #F8F5EE;
    --shadow-soft: 0 10px 25px rgba(93, 64, 55, 0.12);
    --shadow-hover: 0 16px 32px rgba(233, 30, 99, 0.22);
}

* {
    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.06), transparent 30%),
        radial-gradient(circle at 90% 40%, rgba(255, 179, 0, 0.08), transparent 35%),
        radial-gradient(circle at 50% 85%, rgba(76, 175, 80, 0.06), 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.18;
    animation: gentleFloat 12s infinite ease-in-out;
}

.leaf-1 { top: 10%; left: 6%; animation-delay: 0s; }
.leaf-2 { top: 32%; right: 4%; animation-delay: 2s; }
.leaf-3 { top: 65%; left: 7%; animation-delay: 4s; }
.leaf-4 { top: 82%; right: 6%; animation-delay: 1s; }
.leaf-5 { top: 48%; left: 50%; animation-delay: 3s; }

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

.app-container {
    flex-grow: 1;
    max-width: 1350px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 1;
    padding: 0 1rem;
}

/* ===================================================
   PREMIUM MASHA & THE 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: 1.5rem;
}

.masha-premium-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.08) 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 2rem;
    position: relative;
    z-index: 2;
    gap: 1.2rem;
    flex-wrap: wrap;
}

/* Right Group: Student Profile & Coins */
.nav-right-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.nav-user-badge {
    height: 64px;
    min-width: 215px;
    box-sizing: border-box;
    border-radius: 50px;
    border: 2px solid rgba(255, 215, 79, 0.6);
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0 1.25rem 0 0.4rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-user-badge:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: var(--honey-gold);
    background: rgba(255, 255, 255, 0.22);
    box-shadow: 0 8px 25px rgba(255, 179, 0, 0.35);
}

.nav-avatar-wrap {
    position: relative;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #FFF;
    border: 2px solid #FFFFFF;
    box-shadow: 0 0 0 2px var(--honey-gold), 0 4px 12px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
    overflow: hidden;
    transition: transform 0.25s ease;
}

.nav-user-badge:hover .nav-avatar-wrap {
    transform: scale(1.06) rotate(-2deg);
}

.nav-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 15%;
    border-radius: 50%;
    display: block;
}

.nav-user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.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.1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.nav-sing-tag {
    font-size: 0.75rem;
    font-weight: 800;
    color: #3E2723;
    background: linear-gradient(135deg, var(--sunflower-yellow), var(--honey-gold));
    padding: 2px 8px;
    border-radius: 12px;
    font-family: 'Changa', sans-serif;
    line-height: 1.2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    animation: gentlePulse 2s infinite ease-in-out;
}

/* Honey Coin Counter Badge */
.honey-coin-badge {
    height: 56px;
    padding: 0 1.2rem;
    border-radius: 50px;
    background: linear-gradient(135deg, rgba(255, 179, 0, 0.25), rgba(255, 160, 0, 0.15));
    border: 2px solid var(--honey-gold);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Changa', 'Tajawal', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    color: #FFFDF9;
    box-shadow: 0 4px 15px rgba(255, 179, 0, 0.25);
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.honey-coin-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 179, 0, 0.4);
}

.honey-pot-icon {
    font-size: 1.35rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.coin-label {
    font-size: 0.85rem;
    color: var(--sunflower-yellow);
}

/* 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.4rem;
    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: 2rem;
    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: 3px 14px;
    border-radius: 20px;
    margin-top: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-family: 'Changa', sans-serif;
}

/* Left: Portal Home Button in Upper Corner */
.portal-home-btn {
    position: absolute;
    top: 18px;
    left: 24px;
    z-index: 15;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.08));
    backdrop-filter: blur(10px);
    color: #FFFFFF;
    border: 2px solid rgba(255, 215, 79, 0.55);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.22);
    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;
}

/* Left Group: Navigation Buttons */
.nav-action-left {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 60px;
}

.masha-nav-action-btn {
    height: 52px;
    padding: 0 1.2rem;
    border-radius: 50px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: #FFFFFF;
    font-family: 'Marhey', 'Tajawal', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.masha-nav-action-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--masha-pink), var(--masha-pink-dark));
    border-color: #FFF;
    box-shadow: 0 6px 20px rgba(233, 30, 99, 0.35);
}

.masha-nav-action-btn.achievements-nav-btn {
    border-color: var(--honey-gold);
}

.masha-nav-action-btn.achievements-nav-btn:hover {
    background: linear-gradient(135deg, var(--honey-gold), var(--honey-amber));
    color: #3E2723;
}

.masha-nav-action-btn.play-masha-nav-btn {
    background: linear-gradient(135deg, rgba(233, 30, 99, 0.28), rgba(255, 255, 255, 0.12));
    border: 2px solid rgba(255, 215, 79, 0.65);
    backdrop-filter: blur(10px);
    color: #FFFFFF;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.masha-nav-action-btn.play-masha-nav-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, rgba(233, 30, 99, 0.55), rgba(255, 179, 0, 0.35));
    border-color: var(--sunflower-yellow);
    box-shadow: 0 6px 20px rgba(233, 30, 99, 0.35), 0 0 15px rgba(255, 215, 79, 0.25);
}

.btn-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.badge-berry, .badge-strawberry {
    font-size: 1.15rem;
    animation: gentlePulse 2s infinite ease-in-out;
}

/* Bottom: Hero Welcome Strip */
.header-hero-strip {
    background: rgba(0, 0, 0, 0.22);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.7rem 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;
    text-align: center;
}

.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;
}

/* ===================================================
   MAIN MENU & UNITS GRID
   =================================================== */
.view-title {
    font-family: 'Marhey', 'Changa', sans-serif;
    font-size: 1.8rem;
    color: var(--bear-brown-dark);
    text-align: center;
    margin: 1.5rem 0 1rem;
    position: relative;
}

.masha-units-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
    gap: 2rem !important;
    padding: 1rem 0.5rem 3rem !important;
    max-width: 1350px !important;
    margin: 0 auto !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* The Masha Adventure Unit Card */
.lesson-adventure-card {
    background: #FFFFFF;
    border-radius: var(--radius-xl);
    padding: 1.4rem 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(93, 64, 55, 0.09);
    border: 2px solid #F0EAE4;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-sizing: border-box;
    width: 100%;
}

.lesson-adventure-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 18px 35px rgba(233, 30, 99, 0.2);
}

/* Color themes for cards */
.card-theme-0 { border-top: 6px 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); color: #fff; }

.card-theme-1 { border-top: 6px 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, #FFA000); color: #3E2723; }

.card-theme-2 { border-top: 6px 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); color: #fff; }

.card-theme-3 { border-top: 6px 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); color: #fff; }

.card-theme-4 { border-top: 6px 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); color: #fff; }

.card-header-pill {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 0.6rem;
}

.lesson-status-pill {
    font-size: 0.82rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 20px;
    font-family: 'Changa', sans-serif;
    background: #FFF8E1;
    color: #795548;
    border: 1px solid #FFE082;
}

/* Stage bubble containing Masha illustration */
.card-stage-bubble {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    margin-bottom: 0.8rem;
    overflow: hidden;
    background: #FFF8E1;
}

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

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

.card-info-section {
    width: 100%;
    margin-bottom: 1rem;
}

.unit-icon-badge {
    font-size: 1.8rem;
    margin-bottom: 4px;
}

.card-title {
    font-family: 'Marhey', 'Tajawal', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--bear-brown-dark);
    margin-bottom: 0.4rem;
    line-height: 1.4;
}

.card-chapters-count {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.card-action-btn {
    width: 100%;
    padding: 10px 16px;
    border-radius: 50px;
    font-family: 'Changa', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

/* ===================================================
   MASHA'S FOREST SCIENCE LABORATORY - HERO CARDS
   =================================================== */
.masha-sci-card {
    background: #FFFFFF;
    border-radius: 24px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(93, 64, 55, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
    border: 3px solid #EFE5D8;
    border-top: 5px solid var(--sci-accent, var(--masha-pink));
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
}

.masha-sci-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--sci-accent, var(--masha-pink));
    box-shadow: 0 18px 36px rgba(93, 64, 55, 0.16), 0 0 22px var(--sci-glow, rgba(233, 30, 99, 0.22));
}

/* Specific Scientific Themes */
.masha-sci-card.sci-bio {
    --sci-accent: #4CAF50;
    --sci-glow: rgba(76, 175, 80, 0.3);
}
.masha-sci-card.sci-eco {
    --sci-accent: #00BCD4;
    --sci-glow: rgba(0, 188, 212, 0.3);
}
.masha-sci-card.sci-chem {
    --sci-accent: #AB47BC;
    --sci-glow: rgba(171, 71, 188, 0.3);
}
.masha-sci-card.sci-phys {
    --sci-accent: #FF9800;
    --sci-glow: rgba(255, 152, 0, 0.3);
}
.masha-sci-card.sci-geo {
    --sci-accent: #795548;
    --sci-glow: rgba(121, 85, 72, 0.3);
}

/* Hero Image Frame (Framed Illustration Window) */
.sci-card-hero-frame {
    position: relative;
    width: 100%;
    height: 180px;
    border-radius: 18px;
    overflow: hidden;
    background: #F5EBE6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.sci-hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    display: block;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.masha-sci-card:hover .sci-hero-image {
    transform: scale(1.07);
}

/* Soft Gradient Overlay for Readability */
.sci-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.32) 0%, transparent 45%, rgba(0,0,0,0.45) 100%);
    pointer-events: none;
}

/* Badges Over the Image */
.sci-hero-station-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(46, 26, 17, 0.85);
    backdrop-filter: blur(8px);
    color: #FFF;
    border: 1.5px solid var(--honey-gold);
    border-radius: 20px;
    padding: 4px 12px;
    font-family: 'Changa', sans-serif;
    font-size: 0.82rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    z-index: 2;
}

.sci-hero-topic-chip {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    color: var(--sci-accent, #3E2723);
    border-radius: 20px;
    padding: 4px 12px;
    font-family: 'Changa', sans-serif;
    font-size: 0.82rem;
    font-weight: 800;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sci-hero-tool-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

/* Card Body */
.sci-card-body {
    width: 100%;
    padding: 14px 6px 10px;
    text-align: center;
    box-sizing: border-box;
}

.sci-card-title {
    font-family: 'Marhey', 'Tajawal', sans-serif;
    font-size: 1.22rem;
    font-weight: 700;
    color: var(--bear-brown-dark);
    margin-bottom: 6px;
    line-height: 1.35;
}

.sci-card-summary {
    font-size: 0.86rem;
    color: var(--text-muted);
    font-weight: 600;
    line-height: 1.45;
    margin-bottom: 12px;
    font-family: 'Tajawal', sans-serif;
}

.sci-tools-strip {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.sci-chip {
    font-size: 0.78rem;
    font-weight: 700;
    background: #F5EFE6;
    color: var(--bear-brown);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid #E8DFD3;
    font-family: 'Tajawal', sans-serif;
}

.sci-chip.tool-chip {
    background: #E8F5E9;
    color: var(--forest-green);
    border-color: #C8E6C9;
}

/* Action Button */
.sci-launch-btn {
    width: 100%;
    padding: 11px 16px;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--masha-pink), var(--masha-pink-dark));
    color: #FFFFFF;
    font-family: 'Changa', sans-serif;
    font-size: 0.98rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 2px solid #FFFFFF;
    box-shadow: 0 4px 14px rgba(233, 30, 99, 0.28);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-sizing: border-box;
    margin-top: 8px;
}

.masha-sci-card:hover .sci-launch-btn {
    transform: scale(1.03);
    background: linear-gradient(135deg, var(--honey-gold), var(--honey-amber));
    color: #3E2723;
    box-shadow: 0 6px 18px rgba(255, 179, 0, 0.45);
}

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

.btn-arrow-icon {
    font-size: 1.1rem;
    transition: transform 0.25s ease;
}

.masha-sci-card:hover .btn-arrow-icon {
    transform: translateX(-4px);
}

/* ===================================================
   MODALS (UNIT DETAILS & ACHIEVEMENTS)
   =================================================== */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(46, 26, 17, 0.75);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(6px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.modal-content.masha-modal-wood {
    background: linear-gradient(180deg, #FFFDF9 0%, #F5ECE0 100%);
    color: var(--text-main);
    width: 92%;
    max-width: 820px;
    max-height: 88vh;
    border-radius: 30px;
    padding: 30px 25px;
    position: relative;
    overflow-y: auto;
    box-shadow: 0 18px 45px rgba(62, 39, 35, 0.35);
    border: 5px solid var(--honey-gold);
}

.close-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    background: linear-gradient(135deg, var(--masha-pink), var(--masha-pink-dark));
    color: white;
    border: 2px solid white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
    transition: transform 0.2s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    transform: scale(1.1) rotate(90deg);
}

.unit-modal-header {
    text-align: center;
    margin-bottom: 25px;
}

.unit-modal-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 5px;
}

.unit-modal-header h2 {
    font-family: 'Marhey', sans-serif;
    font-size: 1.8rem;
    background: #FFF;
    display: inline-block;
    padding: 8px 24px;
    border-radius: 30px;
    border: 2px solid var(--honey-gold);
    box-shadow: 0 4px 12px rgba(93, 64, 55, 0.08);
}

/* Chapter block in modal */
.chapter-block {
    background: #FFFFFF;
    border-radius: 20px;
    padding: 18px 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 14px rgba(93, 64, 55, 0.06);
    border-right: 6px solid var(--masha-pink);
    border: 1px solid #EFE8DF;
    border-right-width: 6px;
}

.chapter-block h3 {
    margin-bottom: 14px;
    color: var(--bear-brown);
    font-family: 'Marhey', 'Tajawal', sans-serif;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lessons-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
}

.lesson-item {
    background: linear-gradient(135deg, #FFFDF9, #FBF4E8);
    padding: 14px 12px;
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid #EADBCC;
    box-shadow: 0 4px 10px rgba(93, 64, 55, 0.05);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

.lesson-item:hover {
    transform: translateY(-4px) scale(1.03);
    border-color: var(--honey-gold);
    box-shadow: 0 8px 20px rgba(255, 179, 0, 0.25);
    background: #FFFFFF;
}

.lesson-item .type-icon {
    font-size: 2.2rem;
    display: block;
    margin-bottom: 6px;
}

.lesson-item .lesson-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--bear-brown-dark);
    display: block;
    margin-bottom: 8px;
    line-height: 1.4;
}

.lesson-start-chip {
    font-size: 0.78rem;
    font-weight: 800;
    color: #FFF;
    background: linear-gradient(135deg, var(--forest-green-light), var(--forest-green));
    padding: 3px 12px;
    border-radius: 20px;
    font-family: 'Changa', sans-serif;
    box-shadow: 0 2px 6px rgba(46, 125, 50, 0.2);
}

.star-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--honey-gold);
    color: #3E2723;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid white;
}

/* Achievements Box inside Modal */
.achievements-header-box {
    text-align: center;
    margin-bottom: 20px;
}

.achievements-header-box h2 {
    font-family: 'Marhey', sans-serif;
    color: var(--bear-brown-dark);
    font-size: 1.8rem;
    margin-top: 5px;
}

.achievement-item {
    background: #FFFFFF;
    padding: 14px 20px;
    border-radius: 16px;
    margin-bottom: 10px;
    box-shadow: 0 3px 10px rgba(93, 64, 55, 0.08);
    font-weight: 700;
    color: var(--bear-brown-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-right: 5px solid var(--honey-gold);
    border: 1px solid #EFE8DF;
    border-right-width: 5px;
    transition: transform 0.2s;
}

.achievement-item:hover {
    transform: scale(1.02);
}

/* ===================================================
   LESSON SCREEN & TABS
   =================================================== */
.screen { display: none; }
.screen.active { display: block; width: 100%; max-width: 900px; margin: 0 auto; }

/* Hide the main header and corner portal button when inside any lesson */
body.in-lesson-view .masha-premium-header,
body.in-lesson-view .portal-home-btn {
    display: none !important;
}

body.in-lesson-view #lesson-screen {
    margin-top: 10px;
}

.masha-lesson-bar {
    background: linear-gradient(135deg, #4E342E, #5D4037);
    color: #FFFDF9;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 6px 20px rgba(62, 39, 35, 0.2);
    position: sticky;
    top: 0;
    z-index: 20;
    border-radius: 24px 24px 0 0;
    margin-top: 15px;
    border-bottom: 4px solid var(--honey-gold);
}

.masha-back-btn {
    padding: 8px 18px;
    border-radius: 50px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
    cursor: pointer;
    font-family: 'Changa', sans-serif;
    font-weight: 800;
    color: #FFFDF9;
    transition: 0.25s;
    font-size: 0.95rem;
}

.masha-back-btn:hover {
    background: linear-gradient(135deg, var(--masha-pink), var(--masha-pink-dark));
    border-color: #FFF;
    transform: scale(1.05);
}

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

.masha-title-icon {
    font-size: 1.8rem;
}

#lesson-title-display {
    font-family: 'Marhey', 'Tajawal', sans-serif;
    font-size: 1.5rem;
    color: var(--sunflower-yellow);
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Tabs Bar */
.masha-tabs-bar {
    display: flex;
    justify-content: space-around;
    padding: 10px 8px;
    background: #FFFDF9;
    border-left: 2px solid #EADBCC;
    border-right: 2px solid #EADBCC;
    border-bottom: 2px solid #EADBCC;
    box-shadow: 0 4px 15px rgba(93, 64, 55, 0.08);
    position: sticky;
    top: 65px;
    z-index: 19;
    overflow-x: auto;
    gap: 6px;
}

.tab-btn {
    flex: 1;
    border: none;
    background: #F5EFE6;
    padding: 12px 10px;
    font-family: 'Changa', 'Tajawal', sans-serif;
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    border-radius: 14px;
    border: 2px solid transparent;
}

.tab-btn.active {
    color: #FFF;
    background: linear-gradient(135deg, var(--masha-pink), var(--masha-fuchsia));
    border-color: #FF80AB;
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
    transform: translateY(-2px);
}

.tab-btn:hover:not(.active) {
    background: #ECE5DC;
    color: var(--bear-brown-dark);
}

.tab-pane { display: none; animation: fadeIn 0.35s ease forwards; }
.tab-pane.active { display: block; }

.content-area {
    padding: 24px;
    line-height: 1.8;
    background: #FFFDF9;
    border-radius: 0 0 24px 24px;
    box-shadow: 0 10px 30px rgba(93, 64, 55, 0.1);
    border: 2px solid #EADBCC;
    border-top: none;
    margin-bottom: 3rem;
}

/* ===================================================
   TAB 1: IDEA & VOCAB BUBBLES
   =================================================== */
.main-idea-box {
    background: linear-gradient(135deg, #FFF8E1, #FFF3E0);
    border-right: 6px solid var(--honey-gold);
    border-left: 1px solid #FFE082;
    border-top: 1px solid #FFE082;
    border-bottom: 1px solid #FFE082;
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 25px;
    box-shadow: 0 6px 18px rgba(255, 179, 0, 0.12);
    cursor: pointer;
    transition: transform 0.2s;
}

.main-idea-box:hover {
    transform: translateY(-3px);
}

.main-idea-box h4 {
    font-family: 'Marhey', 'Tajawal', sans-serif;
    color: var(--bear-brown-dark);
    font-size: 1.3rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.main-idea-box p {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.8;
}

/* Vocab Bubble Game Container */
.bubble-container {
    position: relative;
    width: 100%;
    height: 320px;
    background: linear-gradient(180deg, #E8F5E9 0%, #C8E6C9 100%);
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-top: 20px;
    border: 3px solid #81C784;
    box-shadow: inset 0 0 25px rgba(76, 175, 80, 0.2), 0 8px 20px rgba(0,0,0,0.08);
}

.vocab-bubble-wrapper {
    position: absolute;
    bottom: -80px;
    animation: floatUp linear infinite forwards;
}

.vocab-bubble {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.95), rgba(255, 64, 129, 0.45));
    border: 2px solid rgba(255,255,255,0.9);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(233, 30, 99, 0.25), inset 0 0 15px rgba(255,255,255,0.8);
    transition: transform 0.15s;
}

.vocab-bubble span {
    display: none;
    font-weight: 800;
    font-family: 'Changa', sans-serif;
    color: #FFF;
    text-shadow: 1px 2px 4px rgba(0,0,0,0.5);
    font-size: 1.1rem;
    pointer-events: none;
    padding: 0 10px;
    text-align: center;
}

.vocab-bubble.popped {
    animation: popBubble 2s forwards !important;
}

.vocab-bubble.popped span {
    display: block;
}

@keyframes floatUp {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    50% { transform: translateY(-200px) scale(1.1); }
    100% { transform: translateY(-460px) scale(1); opacity: 0; }
}

@keyframes popBubble {
    0% { transform: scale(1); opacity: 1; background: var(--masha-pink); border: none; }
    10% { transform: scale(1.4); opacity: 0.95; background: var(--masha-pink); }
    80% { transform: scale(1.4); opacity: 0.95; background: var(--masha-pink); }
    100% { transform: scale(2); opacity: 0; display: none; }
}

/* ===================================================
   TAB 2: RPG DIALOG WITH MASHA
   =================================================== */
.rpg-dialog-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 15px;
}

.avatar-character {
    width: 130px;
    height: 130px;
    position: relative;
    z-index: 2;
    margin-bottom: -25px;
    animation: bounceMasha 2.5s infinite ease-in-out;
}

.masha-dialog-avatar {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 6px 12px rgba(93, 64, 55, 0.25));
}

@keyframes bounceMasha {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px) rotate(-2deg); }
}

.dialog-box {
    background: #FFFFFF;
    border: 4px solid var(--honey-gold);
    border-radius: 28px;
    padding: 35px 25px 30px;
    width: 95%;
    min-height: 160px;
    box-shadow: 0 10px 30px rgba(93, 64, 55, 0.12);
    position: relative;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--bear-brown-dark);
    line-height: 1.7;
    text-align: center;
    font-family: 'Tajawal', sans-serif;
}

.dialog-next-btn {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--masha-pink), var(--masha-pink-dark));
    color: white;
    border: 2px solid white;
    border-radius: 50px;
    padding: 10px 32px;
    font-size: 1.15rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(233, 30, 99, 0.35);
    transition: all 0.25s ease;
    font-family: 'Changa', sans-serif;
    white-space: nowrap;
}

.dialog-next-btn:hover {
    transform: translateX(-50%) scale(1.08);
    background: linear-gradient(135deg, var(--masha-pink-light), var(--masha-pink));
}

.lesson-section-img {
    width: 100%;
    max-width: 280px;
    display: block;
    margin: 25px auto 10px;
    border-radius: 20px;
    box-shadow: 0 8px 22px rgba(93, 64, 55, 0.15);
    border: 4px solid #FFF;
}

/* ===================================================
   TAB 3: FLIP CARDS
   =================================================== */
.flip-cards-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
}

.flip-card {
    background-color: transparent;
    width: 100%;
    max-width: 280px;
    height: 200px;
    perspective: 1000px;
    cursor: pointer;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    box-shadow: 0 8px 20px rgba(93, 64, 55, 0.12);
    border-radius: 22px;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-weight: 700;
    font-size: 1.15rem;
    flex-direction: column;
    font-family: 'Tajawal', sans-serif;
    line-height: 1.6;
}

.flip-card-front {
    background: linear-gradient(135deg, #FFF8E1, #FFECB3);
    color: var(--bear-brown-dark);
    border: 3px solid var(--honey-gold);
}

.flip-card-back {
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
    color: var(--forest-green);
    transform: rotateY(180deg);
    border: 3px solid var(--forest-green-light);
}

/* ===================================================
   TAB 4: MINI GAMES MENU & CONTAINERS
   =================================================== */
.games-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
    gap: 1.2rem !important;
}

.quiz-container {
    background: #FFFFFF;
    padding: 25px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(93, 64, 55, 0.1);
    margin-top: 20px;
    border: 3px solid #F0EAE4;
    color: var(--bear-brown-dark);
}

.quiz-container h3 {
    color: var(--masha-pink);
    font-family: 'Marhey', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

/* Game 1: Treasure Chests */
.treasure-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.treasure-chest {
    width: 120px;
    height: 120px;
    background: url('https://img.icons8.com/color/200/treasure-chest.png') no-repeat center/contain;
    cursor: pointer;
    transition: transform 0.25s;
    position: relative;
}

.treasure-chest:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 0 12px var(--honey-gold));
}

.treasure-chest.open {
    background: url('https://img.icons8.com/color/200/open-box.png') no-repeat center/contain;
    animation: flashGold 1s forwards;
}

.chest-label {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: #FFF;
    color: var(--bear-brown-dark);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    width: 160px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 2px solid var(--honey-gold);
    pointer-events: none;
    z-index: 5;
}

@keyframes flashGold {
    0% { filter: drop-shadow(0 0 0px #FFD700); }
    50% { filter: drop-shadow(0 0 25px #FFD700); }
    100% { filter: drop-shadow(0 0 15px #FFD700); }
}

/* Game 2: Star Catcher */
.star-catcher-sky {
    position: relative;
    height: 350px;
    background: radial-gradient(circle at top, #4E342E, #2E1A11);
    border-radius: 24px;
    overflow: hidden;
    border: 3px solid var(--honey-gold);
    margin-top: 15px;
}

.falling-star {
    position: absolute;
    width: 65px;
    height: 65px;
    background: url('https://img.icons8.com/color/200/star--v1.png') no-repeat center/contain;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 8px #FFD700);
}

.falling-star span {
    background: #FFF;
    color: #3E2723;
    font-weight: 700;
    font-size: 0.78rem;
    padding: 4px 8px;
    border-radius: 10px;
    transform: translateY(48px);
    pointer-events: none;
    white-space: normal;
    width: 130px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    border: 1px solid var(--honey-gold);
    z-index: 5;
}

@keyframes fallDown { from { top: -60px; } to { top: 360px; } }

/* Game 3: Magic Cauldron */
.cauldron-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    position: relative;
    margin-top: 20px;
}

.cauldron {
    width: 140px;
    height: 140px;
    background: url('https://img.icons8.com/color/200/cauldron.png') no-repeat center/contain;
    position: relative;
}

.potions-row {
    display: flex;
    gap: 60px;
    justify-content: center;
    flex-wrap: wrap;
}

.potion-bottle {
    width: 60px;
    height: 80px;
    background: url('https://img.icons8.com/color/200/potion.png') no-repeat center/contain;
    cursor: pointer;
    transition: transform 0.3s;
    position: relative;
}

.potion-bottle:hover {
    transform: scale(1.2) rotate(8deg);
    filter: drop-shadow(0 0 12px var(--masha-pink));
}

.potion-label {
    position: absolute;
    bottom: -45px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    font-weight: 700;
    background: #FFF;
    color: var(--bear-brown-dark);
    padding: 4px 8px;
    border-radius: 10px;
    white-space: normal;
    width: 130px;
    text-align: center;
    border: 2px solid var(--masha-pink);
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
    pointer-events: none;
    z-index: 5;
}

/* Game 4: Magic Frog Jumps */
.pond-container {
    position: relative;
    height: 220px;
    background: linear-gradient(to bottom, #81D4FA, #29B6F6);
    border-radius: 24px;
    margin-top: 30px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 20px;
    border: 4px solid #4FC3F7;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
}

.lily-pad {
    width: 85px;
    height: 65px;
    background: url('https://img.icons8.com/color/200/leaf.png') no-repeat center/contain;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s;
}

.lily-pad:hover {
    transform: scale(1.15);
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.3));
}

.lily-label {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: var(--bear-brown-dark);
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    white-space: normal;
    width: 130px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    border: 2px solid var(--forest-green-light);
    pointer-events: none;
    z-index: 5;
}

.frog {
    position: absolute;
    width: 60px;
    height: 60px;
    background: url('https://img.icons8.com/color/200/frog.png') no-repeat center/contain;
    top: 80px;
    left: -10px;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 10;
    filter: drop-shadow(0 5px 6px rgba(0,0,0,0.3));
}

/* Completion Button */
.lesson-completion-box {
    margin-top: 30px;
    padding: 20px;
    text-align: center;
}

#complete-lesson-btn {
    background: linear-gradient(135deg, var(--forest-green-light), var(--forest-green)) !important;
    color: white !important;
    font-size: 1.2rem !important;
    font-family: 'Marhey', 'Changa', sans-serif !important;
    padding: 14px 35px !important;
    border-radius: 50px !important;
    border: 3px solid #FFF !important;
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.35) !important;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

#complete-lesson-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 8px 25px rgba(46, 125, 50, 0.5) !important;
}

/* ===================================================
   TOASTS, COINS, ANIMATIONS
   =================================================== */
.toast-message {
    position: fixed;
    bottom: -70px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--masha-pink), var(--honey-gold));
    color: white;
    padding: 16px 36px;
    border-radius: 50px;
    font-family: 'Marhey', 'Changa', sans-serif;
    font-weight: bold;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2000;
    font-size: 1.15rem;
    border: 3px solid #FFF;
    text-align: center;
}

.toast-message.show { bottom: 35px; }

@keyframes flyCoin {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(0.5); opacity: 0; }
}

.flying-coin {
    position: fixed;
    font-size: 2.2rem;
    z-index: 9999;
    pointer-events: none;
    animation: flyCoin 1s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    filter: drop-shadow(0 0 10px var(--honey-gold));
}

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

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

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

/* ===================================================
   FOOTER
   =================================================== */
.masha-footer {
    text-align: center;
    padding: 22px 20px;
    font-weight: bold;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #4E342E, #3E2723);
    color: #FFFDF9;
    margin-top: auto;
    border-top: 4px solid var(--honey-gold);
    font-family: 'Tajawal', sans-serif;
    position: relative;
    z-index: 10;
}

.masha-footer a {
    color: var(--sunflower-yellow);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 22px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 215, 79, 0.35);
    backdrop-filter: blur(8px);
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .portal-home-btn {
        top: 12px;
        left: 14px;
        width: 42px;
        height: 42px;
    }
    .portal-home-btn .btn-icon {
        font-size: 1.25rem;
    }
    .nav-action-left {
        margin-left: 0;
    }
    .header-nav-bar {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        padding-top: 2.8rem; /* Room for upper corner home button */
    }
    .nav-right-group, .nav-action-left {
        justify-content: center;
    }
    .nav-user-badge {
        min-width: 180px;
    }
    .masha-units-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
        gap: 1.2rem !important;
    }
    .modal-content.masha-modal-wood {
        padding: 20px 15px;
        width: 96%;
        max-height: 94vh;
    }
}

/* ===================================================
   CUTE TALKING & SINGING BEAR (الدب المتكلم المغني)
   =================================================== */
/* Singing Bear Modal Content */
.singing-bear-content {
    max-width: 480px !important;
    padding: 26px 20px 20px !important;
    text-align: center;
    background: radial-gradient(circle at 50% 10%, #FFFDF8 0%, #FFF5E6 45%, #FFECB3 100%) !important;
    border: 4px solid var(--honey-gold) !important;
    border-radius: 32px !important;
    box-shadow: 0 25px 60px rgba(62, 39, 35, 0.45), 0 0 35px rgba(255, 179, 0, 0.4) !important;
    position: relative;
    overflow: hidden;
}

.singing-bear-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    width: 100%;
}

/* Floating musical notes */
.bear-music-notes {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
}

.bear-music-notes .note {
    position: absolute;
    font-size: 1.5rem;
    animation: floatNote 3s infinite ease-in-out;
    opacity: 0;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.2));
}

.bear-music-notes .n1 { top: 12%; left: 8%; animation-delay: 0s; }
.bear-music-notes .n2 { top: 8%; right: 10%; animation-delay: 0.8s; font-size: 1.8rem; }
.bear-music-notes .n3 { top: 40%; left: 4%; animation-delay: 1.4s; }
.bear-music-notes .n4 { top: 42%; right: 5%; animation-delay: 2.1s; }
.bear-music-notes .n5 { top: 25%; right: 20%; animation-delay: 2.6s; font-size: 1.6rem; }

@keyframes floatNote {
    0% { transform: translateY(20px) scale(0.6) rotate(0deg); opacity: 0; }
    30% { opacity: 0.95; }
    80% { opacity: 0.95; }
    100% { transform: translateY(-45px) scale(1.25) rotate(22deg); opacity: 0; }
}

/* Speech Bubble above bear */
.bear-speech-bubble {
    background: #FFFFFF;
    border: 3px solid var(--honey-gold);
    border-radius: 22px;
    padding: 14px 18px;
    box-shadow: 0 8px 24px rgba(93, 64, 55, 0.14);
    margin-bottom: 16px;
    position: relative;
    width: 95%;
    max-width: 420px;
    box-sizing: border-box;
}

.bear-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -13px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 14px 14px 0;
    border-style: solid;
    border-color: #FFFFFF transparent;
    display: block;
    width: 0;
}

.bear-speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -17px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 16px 16px 0;
    border-style: solid;
    border-color: var(--honey-gold) transparent;
    display: block;
    width: 0;
}

.bear-sound-waves {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 18px;
    margin-bottom: 6px;
}

.bear-sound-waves .bar {
    width: 4px;
    height: 8px;
    background: linear-gradient(180deg, var(--masha-pink), var(--honey-gold));
    border-radius: 4px;
    animation: wavePulse 0.8s infinite ease-in-out alternate;
}

.bear-sound-waves .bar:nth-child(1) { animation-delay: 0.1s; height: 10px; }
.bear-sound-waves .bar:nth-child(2) { animation-delay: 0.35s; height: 17px; }
.bear-sound-waves .bar:nth-child(3) { animation-delay: 0.2s; height: 12px; }
.bear-sound-waves .bar:nth-child(4) { animation-delay: 0.45s; height: 18px; }
.bear-sound-waves .bar:nth-child(5) { animation-delay: 0.15s; height: 9px; }

@keyframes wavePulse {
    0% { transform: scaleY(0.4); }
    100% { transform: scaleY(1.3); }
}

.bear-lyrics {
    font-family: 'Marhey', 'Tajawal', sans-serif;
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--bear-brown-dark);
    line-height: 1.6;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Bear Avatar Stage */
.bear-avatar-container {
    position: relative;
    width: 210px;
    height: 210px;
    border-radius: 50%;
    margin-bottom: 16px;
    border: 5px solid var(--honey-gold);
    box-shadow: 0 10px 30px rgba(93, 64, 55, 0.25), inset 0 0 20px rgba(255, 255, 255, 0.8);
    overflow: hidden;
    background: #FFF8E1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.singing-bear-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 15%;
    transition: transform 0.3s ease;
}

.bear-avatar-container.is-singing .singing-bear-img {
    animation: bearGroove 1s infinite alternate ease-in-out;
}

@keyframes bearGroove {
    0% { transform: scale(1.03) rotate(-3deg) translateY(0); }
    50% { transform: scale(1.07) rotate(0deg) translateY(-5px); }
    100% { transform: scale(1.03) rotate(3deg) translateY(0); }
}

.bear-mic-badge {
    position: absolute;
    bottom: 8px;
    right: 15px;
    background: linear-gradient(135deg, var(--masha-pink), var(--masha-pink-dark));
    color: #FFF;
    border: 3px solid #FFFFFF;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    animation: micBob 1.5s infinite ease-in-out alternate;
}

@keyframes micBob {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-4px) scale(1.1); }
}

/* Modal Actions */
.bear-modal-actions {
    display: flex;
    gap: 12px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.bear-action-btn {
    padding: 10px 20px;
    border-radius: 50px;
    font-family: 'Changa', sans-serif;
    font-size: 0.98rem;
    font-weight: 800;
    cursor: pointer;
    border: 2px solid #FFF;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bear-action-btn.sing-btn {
    background: linear-gradient(135deg, var(--honey-gold), var(--honey-amber));
    color: #3E2723;
    box-shadow: 0 4px 14px rgba(255, 179, 0, 0.4);
}

.bear-action-btn.sing-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 179, 0, 0.55);
}

.bear-action-btn.done-btn {
    background: linear-gradient(135deg, var(--masha-pink), var(--masha-pink-dark));
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(233, 30, 99, 0.35);
}

.bear-action-btn.done-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(233, 30, 99, 0.5);
}
