/* ==========================================================
   ثيم البطلة فدك عباس - رياضيات كورومي الوردي 🎀 (Kuromi Pink Edition)
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Baloo+Bhaijaan+2:wght@400;600;800&family=Tajawal:wght@500;700;800;900&display=swap');

:root {
    --bg-color: #fdf2f8;
    --bg-color-top: #fdf2f8;
    --bg-color-bottom: #f3e8ff;
    --primary: #ec4899;
    --primary-color: #ec4899;
    --primary-dark: #be185d;
    --secondary: #9333ea;
    --secondary-dark: #7e22ce;
    --accent: #f472b6;
    --accent-dark: #db2777;
    --success: #10b981;
    --rose: #f43f5e;
    --text: #2e1065;
    --text-color: #2e1065;
    --text-light: #86198f;
    --text-dark: #1a0b2e;
    --white: #ffffff;
    --shadow: 0 8px 30px rgba(236, 72, 153, 0.2);
    --shadow-soft: 0 10px 30px -10px rgba(236, 72, 153, 0.3);
    --border-dark: 2px solid rgba(244, 114, 182, 0.3);
    --car-red: #ec4899;
    --car-blue: #c084fc;
    --car-green: #34d399;
    --car-purple: #a855f7;
    --card-bg: rgba(255, 255, 255, 0.94);

    /* Legacy color compatibility */
    --candy-purple: #a855f7;
    --candy-blue: #38bdf8;
    --candy-pink: #ec4899;
    --candy-green: #10b981;
    --candy-orange: #fbbf24;
    --shadow-pink: rgba(236, 72, 153, 0.4);
    --shadow-blue: rgba(192, 132, 252, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Baloo Bhaijaan 2', 'Tajawal', sans-serif;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    background: radial-gradient(circle at 15% 15%, #fdf2f8 0%, #fce7f3 45%, #f3e8ff 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text);
    overflow-x: hidden;
    padding-bottom: 120px;
    position: relative;
    font-size: 26px;
    line-height: 1.8;
}

/* ================== خلفية كورومي الطافية ================== */
.enchanted-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.magic-sparkle {
    position: absolute;
    filter: drop-shadow(0 4px 10px rgba(236, 72, 153, 0.3));
    transition: transform 0.3s;
}

@keyframes floatSlow1 {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(-20px) rotate(6deg); }
}

@keyframes floatSlow2 {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(20px) rotate(-6deg); }
}

/* ================== العناوين والنصوص ================== */
.welcome-msg h2, .sosawy-logo, .lesson-overlay h2 {
    color: var(--primary-dark);
    font-size: 4rem;
    font-weight: 900;
    text-align: center;
    text-shadow: 0 0 15px rgba(236, 72, 153, 0.3), 2px 2px 0 #ffffff;
    margin: 20px 0;
    animation: float-wave 3s ease-in-out infinite alternate;
    position: relative;
    z-index: 10;
}

/* ================== الهيدر العلوي بنمط احترافي مدمج وبسيط ================== */
.app-header {
    width: 100%;
    max-width: 1050px;
    margin: 8px auto 16px;
    padding: 0.35rem 1.2rem;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 18px;
    border: 1px solid rgba(236, 72, 153, 0.18);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    position: relative;
    direction: rtl;
    transition: all 0.25s ease;
    z-index: 50;
    box-sizing: border-box;
}

.app-header.hidden {
    display: none !important;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 20%;
    border: 1.5px solid #f472b6;
    box-shadow: 0 1px 4px rgba(236, 72, 153, 0.2);
    flex-shrink: 0;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.student-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: #be185d;
    white-space: nowrap;
}

.subject-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: #7e22ce;
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.header-nav-box {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-nav-btn {
    text-decoration: none;
    padding: 5px 12px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    white-space: nowrap;
    border: 1px solid transparent;
}

.header-nav-btn.home-btn {
    background: #fdf2f8;
    color: #be185d;
    border-color: #fbcfe8;
}

.header-nav-btn.home-btn:hover {
    background: #fce7f3;
    transform: translateY(-1px);
}

.header-nav-btn.game-btn {
    background: linear-gradient(135deg, #a855f7, #9333ea);
    color: white;
    box-shadow: 0 2px 6px rgba(168, 85, 247, 0.25);
}

.header-nav-btn.game-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(168, 85, 247, 0.35);
}

@media screen and (max-width: 480px) {
    .app-header {
        padding: 0.25rem 0.6rem !important;
    }
    .student-name {
        font-size: 0.95rem !important;
    }
    .subject-badge {
        font-size: 0.7rem !important;
        padding: 1px 6px !important;
    }
    .header-nav-btn {
        padding: 4px 8px !important;
        font-size: 0.78rem !important;
    }
    .header-avatar {
        width: 32px !important;
        height: 32px !important;
    }
}

/* ================== بطاقات الفصول والدروس الورديّة ================== */
.sosawy-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

.sosawy-grid, .sosawy-lesson-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
    padding: 20px 0;
}

/* بطاقة الفصل المستديرة بنمط كورومي الوردي */
.chapter-card, .lesson-card, .mode-card {
    background: linear-gradient(135deg, #ffffff 0%, #fdf2f8 50%, #fce7f3 100%);
    border: 5px solid var(--accent);
    border-radius: 45px;
    padding: 24px 20px;
    text-align: center;
    box-shadow: 0 12px 25px rgba(236, 72, 153, 0.2), 0 6px 0 #f472b6;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 270px;
    height: 270px;
    margin: 0 auto;
    z-index: 2;
}

.chapter-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
}

.chapter-icon img {
    width: 120px !important;
    height: 120px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 4px solid var(--accent) !important;
    box-shadow: 0 8px 18px rgba(236, 72, 153, 0.25) !important;
    background: #ffffff !important;
    transition: transform 0.3s;
}

.chapter-card:hover .chapter-icon img {
    transform: scale(1.1) rotate(5deg);
}

.chapter-card h3, .lesson-card h3 { 
    font-size: 1.6rem; 
    font-weight: 900; 
    margin-bottom: 5px;
    color: var(--primary-dark);
}

.chapter-card p, .lesson-card p { 
    font-size: 1.2rem; 
    font-weight: 800; 
    color: var(--secondary); 
    opacity: 0.95;
}

.chapter-card:hover, .lesson-card:hover, .mode-card:hover {
    transform: translateY(-8px) scale(1.05);
    border-color: var(--primary);
    box-shadow: 0 20px 35px rgba(236, 72, 153, 0.35), 0 8px 0 var(--primary-dark);
}

.chapter-card:active, .lesson-card:active, .mode-card:active {
    transform: translateY(2px);
    box-shadow: 0 4px 10px rgba(236, 72, 153, 0.2);
}

/* ================== أزرار التفاعل والإجراءات ================== */
.btn-action {
    background: linear-gradient(135deg, var(--primary), var(--secondary)); 
    color: var(--white); 
    border: 4px solid #ffffff; 
    border-radius: 35px; 
    padding: 15px 40px;
    font-size: 2rem;
    font-weight: 900;
    box-shadow: 0 8px 20px rgba(236, 72, 153, 0.35), 0 4px 0 #be185d; 
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.btn-action:hover {
    transform: translateY(-4px) scale(1.04);
    box-shadow: 0 12px 25px rgba(236, 72, 153, 0.45), 0 6px 0 #be185d;
}

.btn-action:active {
    transform: translateY(2px);
    box-shadow: 0 2px 5px rgba(236, 72, 153, 0.3);
}

/* ================== Overlay الدروس بنمط كورومي ================== */
.sosawy-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(46, 16, 101, 0.5);
    backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px;
    overflow-y: auto;
}

.sosawy-overlay.hidden {
    display: none;
}

.close-btn {
    background: linear-gradient(135deg, #ec4899, #db2777);
    color: var(--white);
    border: 3px solid var(--white);
    border-radius: 50%;
    width: 65px;
    height: 65px;
    font-size: 2.2rem;
    font-weight: 900;
    box-shadow: 0 6px 15px rgba(236, 72, 153, 0.4);
    cursor: pointer;
    align-self: flex-start;
    margin-bottom: 15px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover { 
    transform: scale(1.12) rotate(8deg); 
    box-shadow: 0 10px 25px rgba(236, 72, 153, 0.6); 
}

/* ================== الفوتر ================== */
.platform-footer,
.sosawy-footer {
    text-align: center;
    padding: 25px 15px 35px;
    margin-top: 40px;
    width: 100%;
    position: relative;
    z-index: 10;
    box-sizing: border-box;
}

.platform-footer .platform-footer-link,
.sosawy-footer a {
    color: #9d174d;
    text-decoration: none;
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 800;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2.5px solid #f472b6;
    padding: 10px 24px;
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.2);
    font-family: inherit;
    max-width: 90%;
    word-break: break-word;
}

.platform-footer .platform-footer-link:hover,
.sosawy-footer a:hover {
    color: #db2777;
    border-color: #ec4899;
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 8px 22px rgba(236, 72, 153, 0.35);
    background: #ffffff;
}

@media (max-width: 880px) {
    .app-header {
        margin: 12px auto 25px;
        padding: 1rem 1.2rem;
        border-radius: 25px;
    }
    .header-content {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        gap: 12px !important;
    }
    .header-profile-box {
        width: 100%;
        justify-content: center;
        gap: 10px;
    }
    .user-profile-icon {
        width: 62px;
        height: 62px;
    }
    .header-title-container {
        width: 100%;
        align-items: center;
        text-align: center;
    }
    .header-title-row {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    .header-title {
        font-size: clamp(1.3rem, 4.8vw, 1.85rem) !important;
        text-align: center;
    }
    .header-subtitle {
        font-size: clamp(0.85rem, 3vw, 1.05rem);
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }
    .header-nav-btn {
        font-size: 1rem;
        padding: 8px 18px;
        box-shadow: 0 4px 0 var(--primary-dark), 0 6px 12px rgba(236, 72, 153, 0.25);
    }
    .chapter-card, .lesson-card, .mode-card { width: 220px; height: 220px; }
    .chapter-icon img { width: 95px !important; height: 95px !important; }
    
    .chapter-header-bar {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        gap: 12px !important;
        padding: 12px 16px !important;
    }
    .chapter-header-bar h2 {
        font-size: clamp(1.2rem, 4.5vw, 1.7rem) !important;
        justify-content: center !important;
    }
    .chapter-header-bar div[style*="width: 80px"],
    .chapter-header-bar div[style*="width:80px"] {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 0.8rem;
        margin: 8px auto 16px;
    }
    .user-profile-icon {
        width: 52px;
        height: 52px;
    }
    .header-kuromi-sticker {
        width: 42px !important;
        height: 42px !important;
    }
    .header-title {
        font-size: 1.25rem !important;
    }
    .speaker-icon-btn {
        width: 36px;
        height: 36px;
    }
    .speaker-icon-btn svg {
        width: 18px;
        height: 18px;
    }
}



/* ==========================================================================
   UPGRADED 3D KUROMI BUTTONS FOR MATHEMATICS
   ========================================================================== */
.chapter-card.kuromi-chapter-btn {
    width: 100% !important;
    max-width: 320px !important;
    height: auto !important;
    min-height: 290px !important;
    background: linear-gradient(150deg, #ffffff 0%, #fff0f7 100%) !important;
    border: 3.5px solid #f472b6 !important;
    border-bottom: 9px solid #db2777 !important;
    border-radius: 32px !important;
    padding: 22px 18px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-shadow: 0 10px 0 #be185d, 0 15px 30px rgba(236, 72, 153, 0.22) !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    cursor: pointer !important;
}

.chapter-card.kuromi-chapter-btn:hover {
    transform: translateY(-8px) scale(1.03) !important;
    border-color: #ec4899 !important;
    box-shadow: 0 16px 0 #be185d, 0 22px 35px rgba(236, 72, 153, 0.35) !important;
}

.chapter-card.kuromi-chapter-btn:active {
    transform: translateY(4px) scale(0.98) !important;
    border-bottom-width: 4px !important;
    box-shadow: 0 4px 0 #be185d, 0 8px 15px rgba(236, 72, 153, 0.2) !important;
}

.chapter-mascot-cameo {
    position: relative;
    width: 105px;
    height: 105px;
    border-radius: 50%;
    background: #ffffff;
    border: 3.5px solid #f472b6;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(236, 72, 153, 0.25);
    margin-bottom: 12px;
    transition: transform 0.3s ease;
}

.chapter-card.kuromi-chapter-btn:hover .chapter-mascot-cameo {
    transform: scale(1.1) rotate(6deg);
}

.chapter-mascot-cameo img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.chapter-mini-badge {
    position: absolute;
    bottom: -6px;
    right: -6px;
    background: white;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    border: 2px solid #ec4899;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.chapter-title-text {
    font-size: 1.6rem !important;
    font-weight: 900 !important;
    color: #be185d !important;
    margin: 0 0 5px !important;
    text-align: center;
}

.chapter-desc-text {
    font-size: 1rem !important;
    color: #64748b !important;
    font-weight: 700 !important;
    margin: 0 !important;
}

.chapter-btn-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 14px;
}

.chapter-start-pill {
    background: linear-gradient(135deg, #ec4899, #db2777);
    color: white;
    padding: 8px 22px;
    border-radius: 25px;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(236, 72, 153, 0.3);
    border: 1.5px solid white;
}

.kuromi-math-lesson-card {
    width: 100% !important;
    max-width: 290px !important;
    height: auto !important;
    min-height: 250px !important;
    background: linear-gradient(150deg, #ffffff 0%, #fff0f7 100%) !important;
    border: 3.5px solid #f472b6 !important;
    border-bottom: 8px solid #db2777 !important;
    border-radius: 28px !important;
    padding: 20px 16px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-shadow: 0 8px 0 #be185d, 0 12px 25px rgba(236, 72, 153, 0.2) !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    cursor: pointer !important;
}

.kuromi-math-lesson-card:hover {
    transform: translateY(-8px) scale(1.03) !important;
    box-shadow: 0 14px 0 #be185d, 0 20px 30px rgba(236, 72, 153, 0.32) !important;
    border-color: #ec4899 !important;
}

.kuromi-math-lesson-card:active {
    transform: translateY(4px) scale(0.98) !important;
    border-bottom-width: 3px !important;
    box-shadow: 0 3px 0 #be185d, 0 6px 12px rgba(236, 72, 153, 0.2) !important;
}

.math-lesson-cameo {
    position: relative;
    width: 85px;
    height: 85px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #f472b6;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 15px rgba(236, 72, 153, 0.2);
    margin-bottom: 10px;
}

.math-lesson-cameo img {
    width: 65px;
    height: 65px;
    object-fit: contain;
}

.math-lesson-badge {
    position: absolute;
    bottom: -6px;
    right: -8px;
    background: linear-gradient(135deg, #ec4899, #c084fc);
    color: white;
    font-size: 0.8rem;
    font-weight: 800;
    padding: 2px 10px;
    border-radius: 15px;
    border: 1.5px solid white;
    white-space: nowrap;
}

.math-lesson-title {
    font-size: 1.3rem !important;
    font-weight: 900 !important;
    color: #be185d !important;
    margin: 5px 0 !important;
    text-align: center;
    line-height: 1.3;
}

.math-lesson-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.math-action-pill {
    background: linear-gradient(135deg, #ec4899, #db2777);
    color: white;
    padding: 6px 18px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 1rem;
    box-shadow: 0 3px 8px rgba(236, 72, 153, 0.3);
    border: 1.5px solid white;
}

.speaker-icon-btn.mini-speak {
    width: 36px !important;
    height: 36px !important;
    font-size: 1rem !important;
}



/* ==========================================================================
   🎮 3D ARCADE BUTTONS FOR MATH - أزرار الرياضيات المجسمة ثلاثية الأبعاد
   دمج حقيقي واحترافي لشخصية كورومي داخل هيكل الزر كعنصر مجسم متكامل
   ========================================================================== */

/* أزرار فصول الرياضيات (3D Arcade Chapter Buttons) */
.kuromi-figure-button {
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: space-between !important;
    cursor: pointer !important;
    position: relative !important;
    box-sizing: border-box !important;
    user-select: none !important;

    /* جسم الزر المجسم 3D */
    width: 250px !important;
    min-height: 260px !important;
    padding: 18px 16px 14px !important;
    border-radius: 32px !important;
    
    /* خلفية متدرجة فخمة للرياضيات مع لمسات كورومي */
    background: linear-gradient(180deg, #ffffff 0%, #faf5ff 40%, #f3e8ff 100%) !important;
    
    /* حدود ثلاثية الأبعاد بارزة مع عمق سفلي بنفسجي ملكي */
    border: 3.5px solid #c084fc !important;
    border-bottom: 9px solid #9333ea !important;
    
    /* تأثيرات اللمعان والظلال ثلاثية الأبعاد */
    box-shadow: 
        inset 0 4px 0 rgba(255, 255, 255, 0.9),
        inset 0 -3px 0 rgba(147, 51, 234, 0.15),
        0 8px 0 #7e22ce,
        0 16px 25px rgba(168, 85, 247, 0.28) !important;
        
    transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

/* أزرار الدروس الداخلية في الرياضيات (3D Arcade Math Lessons) */
.kuromi-figure-button.math-lesson-figure-btn {
    width: 220px !important;
    min-height: 225px !important;
    padding: 14px 12px 12px !important;
    border-radius: 28px !important;
    border-width: 3px !important;
    border-bottom-width: 7px !important;
    box-shadow: 
        inset 0 3px 0 rgba(255, 255, 255, 0.9),
        0 6px 0 #7e22ce,
        0 12px 20px rgba(168, 85, 247, 0.22) !important;
}

/* الدرس المكتمل */
.kuromi-figure-button.math-lesson-figure-btn.completed {
    border-color: #34d399 !important;
    border-bottom-color: #059669 !important;
    background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 40%, #dcfce7 100%) !important;
    box-shadow: 
        inset 0 3px 0 rgba(255, 255, 255, 0.9),
        0 6px 0 #047857,
        0 12px 20px rgba(16, 185, 129, 0.25) !important;
}

/* قبة عرض صورة كورومي داخل الزر */
.figure-avatar-holder {
    position: relative !important;
    width: 135px !important;
    height: 135px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: radial-gradient(circle, #ffffff 50%, #f3e8ff 100%) !important;
    border: 3px solid #ffffff !important;
    box-shadow: 
        inset 0 3px 8px rgba(168, 85, 247, 0.2),
        0 4px 12px rgba(147, 51, 234, 0.2) !important;
    margin-bottom: 12px !important;
    transition: transform 0.25s ease !important;
}

.math-lesson-figure-btn .figure-avatar-holder {
    width: 110px !important;
    height: 110px !important;
    margin-bottom: 10px !important;
}

/* صورة كورومي المدمجة داخل القبة */
.figure-mascot-img {
    width: 100px !important;
    height: 100px !important;
    max-width: 100px !important;
    max-height: 100px !important;
    object-fit: contain !important;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15)) !important;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.math-lesson-figure-btn .figure-mascot-img {
    width: 80px !important;
    height: 80px !important;
    max-width: 80px !important;
    max-height: 80px !important;
}

/* شارة الفصل أو الدرس المدمجة بالقبة */
.figure-badge-pill {
    position: absolute !important;
    top: -6px !important;
    right: -6px !important;
    background: linear-gradient(135deg, #a855f7, #7e22ce) !important;
    color: white !important;
    font-size: 1.1rem !important;
    font-weight: 900 !important;
    padding: 3px 12px !important;
    border-radius: 16px !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2) !important;
    z-index: 4 !important;
}

.completed .figure-badge-pill {
    background: linear-gradient(135deg, #10b981, #059669) !important;
}

/* شريط العنوان التفاعلي داخل الزر - يلتف بأناقة ولا يخرج أبداً */
.figure-pedestal-ribbon {
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    background: linear-gradient(135deg, #a855f7, #7e22ce) !important;
    color: #ffffff !important;
    padding: 8px 10px !important;
    border-radius: 20px !important;
    border: 2px solid #ffffff !important;
    border-bottom: 4px solid #581c87 !important;
    box-shadow: 
        inset 0 2px 0 rgba(255, 255, 255, 0.5),
        0 4px 10px rgba(126, 34, 206, 0.3) !important;
    font-weight: 900 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    white-space: normal !important;
    text-align: center !important;
    min-height: 42px !important;
    z-index: 3 !important;
    transition: all 0.18s ease !important;
    overflow: hidden !important;
}

.math-lesson-figure-btn .figure-pedestal-ribbon {
    padding: 6px 8px !important;
    min-height: 38px !important;
    border-bottom-width: 3.5px !important;
}

.completed .figure-pedestal-ribbon {
    background: linear-gradient(135deg, #059669, #047857) !important;
    border-bottom-color: #064e3b !important;
}

.figure-title {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25) !important;
    font-weight: 900 !important;
    font-size: clamp(0.95rem, 2.6vw, 1.25rem) !important;
    line-height: 1.25 !important;
    text-align: center !important;
    flex: 1 1 auto !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
}

.math-lesson-figure-btn .figure-title {
    font-size: clamp(0.85rem, 2.3vw, 1.15rem) !important;
}

/* تفاعل التحويم (Hover) */
.kuromi-figure-button:hover {
    transform: translateY(-6px) !important;
    border-bottom-width: 12px !important;
    box-shadow: 
        inset 0 4px 0 rgba(255, 255, 255, 0.95),
        0 10px 0 #7e22ce,
        0 22px 35px rgba(168, 85, 247, 0.42) !important;
}

.kuromi-figure-button.math-lesson-figure-btn:hover {
    transform: translateY(-5px) !important;
    border-bottom-width: 10px !important;
    box-shadow: 
        inset 0 3px 0 rgba(255, 255, 255, 0.95),
        0 8px 0 #7e22ce,
        0 18px 25px rgba(168, 85, 247, 0.35) !important;
}

.kuromi-figure-button:hover .figure-avatar-holder {
    transform: scale(1.06) !important;
    border-color: #f3e8ff !important;
}

.kuromi-figure-button:hover .figure-mascot-img {
    transform: scale(1.1) rotate(4deg) !important;
}

.kuromi-figure-button:hover .figure-pedestal-ribbon {
    background: linear-gradient(135deg, #c084fc, #9333ea) !important;
    transform: scale(1.02) !important;
}

/* تفاعل الضغط الحقيقي (3D Active Click / Press) */
.kuromi-figure-button:active {
    transform: translateY(6px) !important;
    border-bottom-width: 3px !important;
    box-shadow: 
        inset 0 2px 0 rgba(255, 255, 255, 0.5),
        0 2px 0 #7e22ce,
        0 6px 12px rgba(168, 85, 247, 0.2) !important;
}

.kuromi-figure-button.math-lesson-figure-btn:active {
    transform: translateY(5px) !important;
    border-bottom-width: 2.5px !important;
}

.kuromi-figure-button:active .figure-pedestal-ribbon {
    border-bottom-width: 2px !important;
    transform: scale(0.98) !important;
}

/* زر الصوت الصغير التفاعلي */
.mini-speaker-btn,
.speaker-icon-btn.mini-speaker-btn {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.95rem !important;
    background: rgba(255, 255, 255, 0.28) !important;
    border: 1.5px solid #ffffff !important;
    border-radius: 50% !important;
    color: #ffffff !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15) !important;
    transition: transform 0.2s, background 0.2s !important;
}

.mini-speaker-btn:hover,
.speaker-icon-btn.mini-speaker-btn:hover {
    background: rgba(255, 255, 255, 0.5) !important;
    transform: scale(1.18) !important;
}

/* تجاوب إضافي للشاشات الصغيرة لتجنب خروج النصوص */
@media screen and (max-width: 600px) {
    .kuromi-figure-button {
        width: 100% !important;
        max-width: 230px !important;
        min-height: 220px !important;
        padding: 12px 10px 10px !important;
    }
    
    .figure-avatar-holder {
        width: 115px !important;
        height: 115px !important;
    }
    
    .figure-mascot-img {
        width: 85px !important;
        height: 85px !important;
        max-width: 85px !important;
        max-height: 85px !important;
    }

    .kuromi-figure-button.math-lesson-figure-btn {
        width: 100% !important;
        max-width: 190px !important;
        min-height: 200px !important;
        padding: 10px 8px 8px !important;
    }

    .math-lesson-figure-btn .figure-avatar-holder {
        width: 95px !important;
        height: 95px !important;
    }

    .math-lesson-figure-btn .figure-mascot-img {
        width: 70px !important;
        height: 70px !important;
    }
    
    .figure-title {
        font-size: 0.95rem !important;
    }

    .sosawy-grid,
    .sosawy-lesson-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
        gap: 14px !important;
    }
}

.sosawy-grid,
.sosawy-lesson-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
    gap: 22px !important;
    direction: rtl !important;
    justify-items: center !important;
    padding: 15px 0 !important;
}
