@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&family=Fredoka:wght@500;700;800&family=Alexandria:wght@400;700;900&family=Orbitron:wght@700;900&display=swap');

:root {
    /* Cute Floral Rose Color Palette 🌸👑 */
    --primary: #f43f5e;
    /* Cute Rose */
    --primary-dark: #be123c;
    --primary-light: #ff758c;
    --secondary: #fb7185;
    --secondary-dark: #e11d48;
    --accent: #ff7eb3;
    --accent-glow: #f59e0b;
    --accent-cyan: #ff758c;
    --dark: #fff5f8;

    --card-bg: rgba(255, 255, 255, 0.94);
    --card-border: rgba(254, 205, 211, 0.85);
    --card-border-hover: #f43f5e;

    --text-main: #334155;
    --text-light: #475569;
    --text-muted: #64748b;
    --white: #ffffff;
    --success: #10b981;
    --warning: #f59e0b;

    --fairy-glow: 0 0 25px rgba(244, 63, 94, 0.3), 0 0 45px rgba(255, 117, 140, 0.2);
    --gold-glow: 0 0 25px rgba(245, 158, 11, 0.35);
    --shadow: 0 15px 35px rgba(244, 63, 94, 0.1);
    --shadow-hover: 0 18px 45px rgba(244, 63, 94, 0.25);
    --radius: 26px;

    --font-ar: 'Tajawal', 'Cairo', sans-serif;
    --font-en: 'Fredoka', 'Nunito', sans-serif;
    --font-digital: 'Changa', 'Courier New', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-ar);
    background-color: #fff5f8;
    color: var(--text-main);
    line-height: 1.6;
    background-image:
        radial-gradient(circle at 10% 15%, rgba(255, 117, 140, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 85%, rgba(255, 126, 179, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(254, 205, 211, 0.12) 0%, transparent 60%),
        linear-gradient(135deg, #fff5f7 0%, #fff0f5 50%, #fdf2f8 100%);
    min-height: 100vh;
    overflow-x: hidden;
    direction: rtl;
}

@keyframes breathingBackground {
    0% {
        background-position: 0% 0%, 0% 0%, 0 0;
    }

    100% {
        background-position: 5% 5%, -5% 5%, 0 50px;
    }
}

/* =========================================================
   Spider-Man Hero Scouter & Web HUD Bar
========================================================= */
.scouter-hud-bar,
.fairy-hud-bar {
    width: 95%;
    max-width: 1200px;
    margin: 10px auto 0 auto;
    background: linear-gradient(135deg, rgba(20, 10, 36, 0.94), rgba(7, 10, 20, 0.98));
    border: 2px solid var(--primary);
    border-radius: 24px;
    padding: 8px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 0 25px rgba(230, 0, 38, 0.4), inset 0 0 15px rgba(0, 210, 255, 0.2);
    backdrop-filter: blur(14px);
    position: relative;
    overflow: hidden;
}

.scouter-hud-bar::before,
.fairy-hud-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(0, 210, 255, 0.25) 50%, transparent 100%);
    animation: fairyScanLine 3.5s infinite linear;
    pointer-events: none;
}

@keyframes fairyScanLine {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.scouter-readout,
.fairy-readout {
    display: flex;
    align-items: center;
    gap: 15px;
    font-family: var(--font-digital);
    color: var(--accent-cyan);
    font-size: 1rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.8);
}

.scouter-power-badge,
.fairy-power-badge {
    background: rgba(230, 0, 38, 0.25);
    border: 1.5px solid var(--primary);
    padding: 4px 14px;
    border-radius: 14px;
    color: #ffffff;
    font-weight: 900;
    letter-spacing: 1px;
    animation: fairyPulse 1.8s infinite ease-in-out alternate;
}

@keyframes fairyPulse {
    0% {
        text-shadow: 0 0 5px var(--accent-cyan);
        border-color: var(--accent-cyan);
    }

    100% {
        text-shadow: 0 0 18px var(--primary), 0 0 30px var(--accent-cyan);
        border-color: var(--primary);
        color: #ffffff;
    }
}

.scouter-scan-btn,
.fairy-scan-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: 1.5px solid var(--accent-cyan);
    color: #ffffff !important;
    padding: 6px 18px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 15px rgba(230, 0, 38, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.scouter-scan-btn:hover,
.fairy-scan-btn:hover {
    background: linear-gradient(135deg, var(--accent-cyan), var(--primary));
    color: #070a14 !important;
    box-shadow: 0 0 25px rgba(0, 210, 255, 0.8);
    transform: translateY(-2px) scale(1.05);
}

/* ========================================================
   🌸 BACKGROUND FLOATING WATERMARKS & PETALS 🌸
   ======================================================== */
.bg-decorations {
    position: fixed !important;
    inset: 0 !important;
    pointer-events: none !important;
    z-index: 0 !important;
    overflow: hidden !important;
}

.floral-watermark {
    position: absolute !important;
    color: #fbcfe8 !important;
    opacity: 0.18 !important;
    font-size: 110px !important;
    user-select: none !important;
    filter: blur(1px) !important;
}

.floral-watermark.wm-1 {
    top: 40px !important;
    left: -20px !important;
    transform: rotate(-15deg) !important;
}

.floral-watermark.wm-2 {
    bottom: 60px !important;
    right: -20px !important;
    transform: rotate(20deg) !important;
    font-size: 130px !important;
}

.floral-watermark.wm-3 {
    top: 50% !important;
    left: -30px !important;
    transform: rotate(10deg) !important;
    font-size: 90px !important;
}

.floating-petal {
    position: absolute !important;
    font-size: 24px !important;
    opacity: 0.55 !important;
    user-select: none !important;
    animation: royalFloatPetal 12s infinite ease-in-out alternate !important;
}

.floating-petal.p-1 { top: 12%; right: 10%; animation-delay: 0s; }
.floating-petal.p-2 { top: 25%; left: 8%; animation-delay: 1.5s; font-size: 20px; }
.floating-petal.p-3 { top: 75%; left: 15%; animation-delay: 3s; }
.floating-petal.p-4 { top: 80%; right: 18%; animation-delay: 4.5s; }
.floating-petal.p-5 { top: 45%; right: 4%; animation-delay: 2s; font-size: 22px; }

@keyframes royalFloatPetal {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(15deg); }
    100% { transform: translateY(-8px) rotate(-10deg); }
}

/* =========================================================
   🌸 UNIFIED COMPACT ROYAL HEADER FOR PRINCESS MALAK 🌸
========================================================= */
.main-header.compact-pro-header,
.fairy-header,
.app-header {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1.5px solid #fbcfe8 !important;
    border-radius: 20px !important;
    box-shadow: 0 4px 18px rgba(244, 63, 94, 0.08) !important;
    padding: 8px 22px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    position: sticky !important;
    top: 10px !important;
    z-index: 100 !important;
    min-height: 56px !important;
    box-sizing: border-box !important;
    max-width: 1200px !important;
    width: calc(100% - 32px) !important;
    margin: 10px auto 1.2rem auto !important;
}

.hero-profile-compact {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    flex-shrink: 0 !important;
}

.compact-avatar-wrap {
    position: relative !important;
    width: 44px !important;
    height: 44px !important;
    background: linear-gradient(135deg, #fff0f5, #ffe4e6) !important;
    border: 2px solid #fbcfe8 !important;
    box-shadow: 0 2px 10px rgba(244, 63, 94, 0.2) !important;
    border-radius: 50% !important;
    padding: 2px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: transform 0.2s ease !important;
    flex-shrink: 0 !important;
}

.compact-avatar-wrap:hover {
    transform: scale(1.08) !important;
}

.compact-avatar-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    display: block !important;
}

.compact-crown {
    position: absolute !important;
    top: -8px !important;
    right: -5px !important;
    font-size: 15px !important;
    filter: drop-shadow(0 1px 3px rgba(245, 158, 11, 0.5)) !important;
}

.compact-title-wrap {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
}

.compact-name-row {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
}

.compact-student-name {
    font-family: 'Changa', 'Tajawal', sans-serif !important;
    font-size: 1.35rem !important;
    font-weight: 900 !important;
    color: #be123c !important;
    margin: 0 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
}

.compact-subject-badge {
    font-family: 'Tajawal', sans-serif !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    color: #9d174d !important;
    background: #fce7f3 !important;
    border: 1px solid #fbcfe8 !important;
    padding: 3px 12px !important;
    border-radius: 14px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
}

.header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
}

.stat-badge-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 6px 14px !important;
    background: #ffffff !important;
    border: 1.5px solid #fbcfe8 !important;
    border-radius: 20px !important;
    color: #be123c !important;
    font-family: 'Tajawal', sans-serif !important;
    font-size: 0.88rem !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    box-shadow: 0 2px 8px rgba(236, 72, 153, 0.1) !important;
    transition: all 0.25s ease !important;
    cursor: pointer !important;
    outline: none !important;
    white-space: nowrap !important;
}

.stat-badge-link:hover {
    background: linear-gradient(135deg, #fdf2f8, #fce7f3) !important;
    border-color: #f43f5e !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.2) !important;
    color: #831843 !important;
}

.stat-badge-link.games-link {
    background: linear-gradient(135deg, #fffbeb, #fef3c7) !important;
    border-color: #fde68a !important;
    color: #b45309 !important;
}

.stat-badge-link.hidden,
.header-actions .hidden,
#homeBtn.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .main-header.compact-pro-header {
        padding: 6px 14px !important;
        gap: 8px !important;
    }
    .compact-student-name {
        font-size: 1.15rem !important;
    }
    .compact-subject-badge {
        font-size: 0.76rem !important;
        padding: 2px 8px !important;
    }
    .stat-badge-link {
        padding: 5px 11px !important;
        font-size: 0.82rem !important;
    }
}

@media (max-width: 600px) {
    .main-header.compact-pro-header {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        padding: 8px 10px !important;
        width: calc(100% - 16px) !important;
        margin: 6px auto 0.8rem auto !important;
    }
    .hero-profile-compact {
        width: 100% !important;
        justify-content: center !important;
        gap: 8px !important;
    }
    .compact-avatar-wrap {
        width: 38px !important;
        height: 38px !important;
    }
    .header-actions {
        width: 100% !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    .stat-badge-link {
        padding: 4px 10px !important;
        font-size: 0.78rem !important;
    }
}

/* Lesson Mode Header (Compact header inside Lessons: keeps only Profile, Return to Chapters/Units, and Home) */
.fairy-header.lesson-mode-header,
.main-header.compact-pro-header.lesson-mode-header {
    padding: 0.45rem 1.5rem !important;
    justify-content: space-between !important;
}

.btn-header-back-chapters {
    background: linear-gradient(135deg, #fff0f5 0%, #ffe4e6 100%) !important;
    border: 1.5px solid #fbcfe8 !important;
    color: #be123c !important;
    padding: 6px 18px;
    border-radius: 16px;
    font-size: 0.9rem;
    font-weight: 900;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(244, 63, 94, 0.1);
    transition: all 0.25s ease;
    font-family: 'Alexandria', 'Cairo', sans-serif;
    text-decoration: none;
}

.btn-header-back-chapters:hover {
    background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%) !important;
    color: #831843 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.2);
}

/* 1. Student Profile */
.user-profile-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar-glow {
    position: relative;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: radial-gradient(circle, #e60026 0%, #003399 100%);
    border: 2px solid #00d2ff;
    box-shadow: 0 0 15px rgba(230, 0, 38, 0.7), 0 0 20px rgba(0, 210, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
}

.user-avatar-glow:hover {
    transform: scale(1.08);
    box-shadow: 0 0 25px rgba(230, 0, 38, 1);
}

.user-profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.avatar-fairy-badge {
    position: absolute;
    bottom: -3px;
    left: -3px;
    background: #e60026;
    border: 1.5px solid #ffd700;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.user-info-text {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.student-name {
    font-size: 1.25rem;
    font-weight: 900;
    color: #FFFFFF;
    text-shadow: 0 0 10px rgba(230, 0, 38, 0.8);
    margin: 0;
    line-height: 1.2;
}

.student-grade-pill {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 800;
    color: #ffd700;
    background: rgba(0, 102, 255, 0.45);
    border: 1px solid rgba(0, 210, 255, 0.5);
    border-radius: 20px;
    padding: 2px 8px;
    margin-top: 3px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* 2. Center Magical Title */
.fairy-header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
}

.magical-title {
    font-size: clamp(1.25rem, 2.2vw, 1.8rem);
    margin: 0;
    background: linear-gradient(135deg, #ffffff 0%, #00d2ff 45%, #ffd700 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(230, 0, 38, 0.35);
    font-weight: 900;
    line-height: 1.2;
}

.magical-subtitle {
    font-size: 0.8rem;
    color: #00d2ff;
    margin: 3px 0 0 0;
    font-weight: 600;
}

/* 3. Actions / Buttons */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.btn-play-fairies,
.dragon-game-btn,
.btn-play-fairies {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: linear-gradient(135deg, #f43f5e 0%, #be123c 100%) !important;
    color: #FFFFFF !important;
    text-decoration: none !important;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.92rem;
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.25);
    border: 1.5px solid #fda4af;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.btn-play-fairies:hover,
.dragon-game-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.35);
    background: linear-gradient(135deg, #fb7185 0%, #e11d48 100%) !important;
}

.fairy-btn-icon {
    font-size: 1.25rem;
    animation: gentleWiggle 2s infinite ease-in-out;
}

@keyframes gentleWiggle {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-10deg);
    }

    75% {
        transform: rotate(10deg);
    }
}

.fairy-sparkle-star {
    font-size: 0.85rem;
    animation: pulseStar 1.5s infinite alternate;
}

@keyframes pulseStar {
    0% {
        transform: scale(0.8);
        opacity: 0.6;
    }

    100% {
        transform: scale(1.2);
        opacity: 1;
        filter: drop-shadow(0 0 6px #ffd700);
    }
}

.btn-magical-back,
.back-to-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF !important;
    text-decoration: none !important;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.95rem;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.home-btn,
.back-btn,
.btn-magical-back,
.back-to-main {
    background: linear-gradient(135deg, #fff0f5 0%, #ffe4e6 100%) !important;
    color: #be123c !important;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 0.92rem;
    border: 1.5px solid #fbcfe8 !important;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.1) !important;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.home-btn:hover,
.back-btn:hover,
.btn-magical-back:hover,
.back-to-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(244, 63, 94, 0.2) !important;
    background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%) !important;
    color: #831843 !important;
}

/* =========================================================
   7-Second Profile Magic Effects & Lighting
========================================================= */
.magic-glow-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    box-shadow: inset 0 0 100px rgba(230, 0, 38, 0.7), inset 0 0 160px rgba(0, 102, 255, 0.5), inset 0 0 200px rgba(0, 210, 255, 0.4);
    animation: magicalAuraPulse 1.2s ease-in-out infinite alternate;
    transition: opacity 0.8s ease;
}

@keyframes magicalAuraPulse {
    0% {
        box-shadow: inset 0 0 90px rgba(230, 0, 38, 0.8), inset 0 0 160px rgba(0, 102, 255, 0.6);
        background: radial-gradient(circle at 50% 10%, rgba(230, 0, 38, 0.18), transparent 70%);
    }

    50% {
        box-shadow: inset 0 0 130px rgba(0, 210, 255, 0.8), inset 0 0 190px rgba(255, 215, 0, 0.7);
        background: radial-gradient(circle at 50% 50%, rgba(0, 210, 255, 0.22), transparent 75%);
    }

    100% {
        box-shadow: inset 0 0 110px rgba(255, 215, 0, 0.8), inset 0 0 170px rgba(230, 0, 38, 0.7);
        background: radial-gradient(circle at 50% 90%, rgba(0, 102, 255, 0.2), transparent 70%);
    }
}

.user-avatar-glow.magic-active {
    animation: royalFairyGlow 1.2s ease-in-out infinite alternate !important;
}

@keyframes royalFairyGlow {
    0% {
        transform: scale(1.18) rotate(0deg);
        box-shadow: 0 0 35px #fee440, 0 0 60px #f72585, 0 0 90px #4cc9f0;
    }

    100% {
        transform: scale(1.26) rotate(6deg);
        box-shadow: 0 0 50px #f72585, 0 0 80px #fee440, 0 0 120px #ff70a6;
    }
}

.magic-platform-dancing {
    animation: cutePlatformDance 1.4s ease-in-out infinite alternate;
}

@keyframes cutePlatformDance {
    0% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-6px) scale(1.008);
    }

    100% {
        transform: translateY(4px) scale(1);
    }
}

.magic-sparkle-card {
    animation: cardMagicSparkle 1.2s ease-in-out infinite alternate !important;
}

@keyframes cardMagicSparkle {
    0% {
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 25px rgba(247, 37, 133, 0.6);
        transform: translateY(-4px);
    }

    100% {
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 45px rgba(254, 228, 64, 0.85);
        transform: translateY(-10px) scale(1.03);
    }
}

.magic-floating-sprite {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    font-size: 2.2rem;
    filter: drop-shadow(0 0 15px rgba(254, 228, 64, 0.9));
    animation: floatSpriteUp 2.5s ease-out forwards;
}

@keyframes floatSpriteUp {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.5) rotate(0deg);
    }

    20% {
        opacity: 1;
        transform: translateY(0px) scale(1.35) rotate(-15deg);
    }

    80% {
        opacity: 0.9;
        transform: translateY(-90px) scale(1.1) rotate(20deg);
    }

    100% {
        opacity: 0;
        transform: translateY(-160px) scale(0.4) rotate(45deg);
    }
}

/* =========================================================
   Main Containers & Views
========================================================= */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.view {
    display: none;
    animation: fairyFadeIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.view.active {
    display: block;
}

.hidden {
    display: none !important;
}

@keyframes fairyFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.view-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 2rem;
    background: #ffffff !important;
    padding: 16px 26px;
    border-radius: 24px;
    border: 1.5px solid #fbcfe8 !important;
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.08) !important;
    position: relative;
}

.view-header h2 {
    font-size: 1.8rem;
    color: #831843 !important;
    text-shadow: none !important;
    font-weight: 900;
}

/* Titles */
.main-title {
    text-align: center;
    font-size: clamp(2rem, 4vw, 3rem);
    color: #831843 !important;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #831843 0%, #be123c 50%, #f43f5e 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none !important;
    font-weight: 900;
    letter-spacing: 0.5px;
}

.subtitle {
    text-align: center;
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 2.5rem;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

/* =========================================================
   Princess Malak Royal Book Cards & Dashboard
========================================================= */
.book-selection-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 35px;
    max-width: 950px;
    margin: 0 auto;
}

.book-card,
.royal-book-card {
    background: #ffffff !important;
    border: 2px solid #fbcfe8 !important;
    border-radius: 28px !important;
    padding: 24px 20px !important;
    text-align: center !important;
    cursor: pointer !important;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    box-shadow: 0 10px 30px rgba(244, 63, 94, 0.1) !important;
    position: relative !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: 420px !important;
}

.book-card:hover,
.royal-book-card:hover {
    transform: translateY(-8px) scale(1.02) !important;
    border-color: #f43f5e !important;
    box-shadow: 0 16px 40px rgba(244, 63, 94, 0.22) !important;
    background: #ffffff !important;
}

.royal-card-tag {
    background: #fff0f5 !important;
    color: #be123c !important;
    border: 1px solid #fbcfe8 !important;
    padding: 4px 14px !important;
    border-radius: 14px !important;
    font-size: 0.85rem !important;
    font-weight: 800 !important;
    display: inline-block !important;
}

.book-img-wrapper {
    width: 100% !important;
    height: 200px !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    margin: 0 auto 14px auto !important;
    border: 2px solid #fbcfe8 !important;
    background: linear-gradient(135deg, #fff0f5, #ffe4e6) !important;
    position: relative !important;
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.1) !important;
}

.book-thumb-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    transition: transform 0.4s ease !important;
}

.book-card:hover .book-thumb-img {
    transform: scale(1.06) !important;
}

.book-corner-badge {
    position: absolute !important;
    bottom: 8px !important;
    right: 8px !important;
    background: #ffffff !important;
    border: 1.5px solid #fbcfe8 !important;
    border-radius: 50% !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1rem !important;
    box-shadow: 0 2px 8px rgba(244, 63, 94, 0.15) !important;
}

.book-card h2 {
    font-size: 1.8rem !important;
    color: #831843 !important;
    margin: 8px 0 4px 0 !important;
    font-weight: 900 !important;
    text-shadow: none !important;
    font-family: var(--font-en) !important;
}

.book-card p {
    font-size: 1.05rem !important;
    color: #9d174d !important;
    margin: 0 0 12px 0 !important;
    font-weight: 700 !important;
}

.book-card-btn-pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 8px 24px !important;
    background: linear-gradient(135deg, #f43f5e 0%, #be123c 100%) !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    font-size: 0.95rem !important;
    border-radius: 20px !important;
    border: 1.5px solid #fda4af !important;
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.28) !important;
    transition: all 0.3s ease !important;
}

.book-card:hover .book-card-btn-pill {
    background: linear-gradient(135deg, #fb7185 0%, #e11d48 100%) !important;
    transform: scale(1.05) !important;
    box-shadow: 0 6px 18px rgba(244, 63, 94, 0.38) !important;
}

/* =========================================================
   Princess Malak Units & Lessons Grid
========================================================= */
.units-container,
.lessons-grid-container {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)) !important;
    gap: 28px !important;
    margin-top: 15px !important;
}

.unit-card,
.lesson-car-btn {
    background: #ffffff !important;
    border: 2px solid #fbcfe8 !important;
    border-radius: 26px !important;
    padding: 24px 20px !important;
    cursor: pointer !important;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    box-shadow: 0 8px 24px rgba(244, 63, 94, 0.08) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    position: relative !important;
    color: #1f2937 !important;
}

.unit-card:hover,
.lesson-car-btn:hover {
    transform: translateY(-8px) scale(1.03) !important;
    border-color: #f43f5e !important;
    box-shadow: 0 16px 36px rgba(244, 63, 94, 0.2) !important;
    background: #ffffff !important;
}

.unit-card:hover .unit-hero-thumb-wrapper img,
.lesson-car-btn:hover .lesson-hero-thumb-wrapper img {
    transform: scale(1.08) !important;
}

.unit-title {
    font-size: 1.35rem !important;
    color: #831843 !important;
    font-weight: 800 !important;
    margin-top: 10px !important;
    text-shadow: none !important;
}

/* =========================================================
   Lesson Content & Section Boxes
========================================================= */
.lesson-content {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.section-box {
    background: #ffffff !important;
    border: 2px solid #fbcfe8 !important;
    border-radius: 26px !important;
    padding: 28px !important;
    box-shadow: 0 8px 24px rgba(244, 63, 94, 0.08) !important;
    color: #1f2937 !important;
}

.section-title {
    font-size: 1.6rem !important;
    color: #831843 !important;
    margin-bottom: 22px !important;
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
    border-bottom: 2px dashed #fbcfe8 !important;
    padding-bottom: 14px !important;
    font-weight: 900 !important;
    text-shadow: none !important;
}

.section-description {
    color: #475569 !important;
    font-size: 1.15rem !important;
    margin-bottom: 22px !important;
    font-weight: 600 !important;
}

.en-text {
    font-family: var(--font-en);
    direction: ltr;
    display: inline-block;
    font-size: 1em;
    color: var(--accent);
    letter-spacing: 0.5px;
}

/* Dialogue & Characters */
.characters-grid {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.char-card {
    background: rgba(36, 0, 70, 0.75);
    border: 2px solid var(--primary);
    border-radius: 22px;
    padding: 22px;
    display: flex;
    gap: 22px;
    align-items: center;
    box-shadow: 0 6px 20px rgba(114, 9, 183, 0.35);
    backdrop-filter: blur(16px);
}

.char-avatar {
    flex-shrink: 0;
}

.char-bubble {
    flex: 1;
    background: rgba(60, 9, 108, 0.85);
    border: 1.5px solid var(--accent);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(254, 228, 64, 0.2);
}

.char-text,
.clickable-text {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--accent) !important;
    line-height: 1.65;
    text-shadow: 0 0 8px rgba(254, 228, 64, 0.4);
    font-family: var(--font-en);
    cursor: pointer;
    transition: color 0.2s ease;
}

.char-text:hover,
.clickable-text:hover {
    color: var(--primary-light) !important;
    text-shadow: 0 0 12px var(--primary);
}

.inline-ar-trans {
    color: #ffffff !important;
    font-size: 1.18rem !important;
    font-weight: 900 !important;
    margin-top: 10px !important;
    text-shadow: none;
    font-family: var(--font-ar);
}

/* Vocabulary Grid */
.vocab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 22px;
}

.vocab-card,
.vocab-item {
    background: linear-gradient(135deg, rgba(60, 9, 108, 0.85), rgba(36, 0, 70, 0.95));
    border: 2px solid var(--primary);
    border-radius: 22px;
    padding: 20px 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 6px 20px rgba(247, 37, 133, 0.25);
    position: relative;
}

.vocab-card:hover,
.vocab-item:hover {
    transform: translateY(-5px) scale(1.04);
    border-color: var(--accent);
    box-shadow: 0 10px 30px rgba(254, 228, 64, 0.55);
    background: linear-gradient(135deg, rgba(114, 9, 183, 0.9), rgba(60, 9, 108, 0.98));
}

.vocab-en {
    font-size: 1.45rem;
    font-weight: 900;
    color: var(--accent);
    margin-bottom: 6px;
    font-family: var(--font-en);
}

.vocab-ar {
    font-size: 1.15rem;
    color: #ffffff;
    font-weight: bold;
}

/* Grammar Tables */
.grammar-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 22px;
    background: rgba(36, 0, 70, 0.85);
    border-radius: 20px;
    overflow: hidden;
    border: 2px solid var(--primary);
}

.grammar-table th {
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    color: white;
    padding: 16px;
    font-weight: 900;
    font-size: 1.2rem;
}

.grammar-table td {
    padding: 16px;
    border-bottom: 1px solid rgba(247, 37, 133, 0.2);
    color: var(--text-light);
    font-size: 1.1rem;
}

.grammar-example {
    background: rgba(60, 9, 108, 0.85);
    border: 1.5px solid var(--accent);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 14px;
    color: #ffffff;
    font-weight: bold;
}

/* Quiz Section */
.quiz-question {
    background: linear-gradient(135deg, rgba(46, 0, 85, 0.9) 0%, rgba(20, 0, 48, 0.95) 100%);
    border: 2px solid var(--primary);
    border-radius: 24px;
    padding: 22px;
    margin-bottom: 22px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.q-text {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--accent);
    margin-bottom: 18px;
}

.q-option,
.quiz-option-btn {
    background: rgba(60, 9, 108, 0.85);
    border: 2px solid rgba(254, 228, 64, 0.4);
    color: #ffffff !important;
    padding: 15px 22px;
    border-radius: 18px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.25s ease;
    margin: 8px 0;
    width: 100%;
    text-align: right;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.q-option:hover,
.quiz-option-btn:hover {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 8px 25px rgba(247, 37, 133, 0.5);
    transform: translateY(-2px);
}

.q-option.correct,
.quiz-option-btn.correct {
    background: linear-gradient(135deg, #4cc9f0, #0077b6) !important;
    border-color: #fee440 !important;
    color: #000000 !important;
    font-weight: 900;
}

.q-option.wrong,
.quiz-option-btn.wrong {
    background: linear-gradient(135deg, #f72585, #7209b7) !important;
    border-color: #ff5252 !important;
    color: #ffffff !important;
}

/* Play & Learn Big Action Button */
.butterfly-play-learn-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 18px 42px;
    background: linear-gradient(135deg, #f72585 0%, #7209b7 50%, #fee440 100%);
    color: #ffffff !important;
    font-size: 1.7rem;
    font-weight: 900;
    font-family: var(--font-ar);
    border: 3px solid #fee440;
    border-radius: 50px;
    box-shadow: 0 10px 35px rgba(247, 37, 133, 0.6), 0 0 25px rgba(254, 228, 64, 0.8);
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.butterfly-play-learn-btn:hover {
    transform: translateY(-6px) scale(1.06);
    box-shadow: 0 15px 45px rgba(254, 228, 64, 0.9), 0 0 35px rgba(247, 37, 133, 0.9);
}

/* =========================================================
   Fairy Crystal Ball Translator Bot UI
========================================================= */
#translator-bot-container {
    position: fixed;
    bottom: 25px;
    left: 25px;
    z-index: 1000;
}

#translator-fab {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: 3.5px solid var(--accent);
    box-shadow: 0 8px 30px rgba(247, 37, 133, 0.6), 0 0 20px rgba(254, 228, 64, 0.7);
    color: white;
    font-size: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#translator-fab:hover {
    transform: scale(1.15) rotate(12deg);
    box-shadow: 0 12px 40px rgba(254, 228, 64, 0.9), 0 0 30px rgba(76, 201, 240, 0.8);
}

#translator-chat-window {
    position: fixed;
    bottom: 105px;
    left: 25px;
    width: 360px;
    max-width: 90vw;
    height: 500px;
    background: rgba(30, 0, 60, 0.95);
    border: 3px solid var(--accent);
    border-radius: 28px;
    box-shadow: 0 12px 40px rgba(114, 9, 183, 0.6), 0 0 25px rgba(247, 37, 133, 0.5);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    padding: 16px;
    color: white;
    font-weight: 900;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--accent);
}

.chat-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-message {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 85%;
    font-size: 1rem;
    line-height: 1.45;
}

.bot-message {
    background: rgba(60, 9, 108, 0.9);
    border: 1px solid var(--accent);
    color: #ffffff;
    align-self: flex-start;
}

.user-message {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    align-self: flex-end;
    font-weight: bold;
}

.chat-input-area {
    padding: 14px;
    background: rgba(20, 0, 42, 0.95);
    display: flex;
    gap: 10px;
    border-top: 1px solid rgba(247, 37, 133, 0.4);
}

.chat-input-area input {
    flex: 1;
    background: rgba(60, 9, 108, 0.9);
    border: 1.5px solid var(--primary);
    border-radius: 14px;
    padding: 12px;
    color: #ffffff;
    outline: none;
    font-size: 1rem;
}

.chat-input-area button {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #000;
    font-weight: bold;
    border-radius: 14px;
    padding: 10px 18px;
    border: none;
    cursor: pointer;
}

/* Toast */
.toast {
    position: fixed;
    top: 105px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 14px 35px;
    border-radius: 30px;
    font-weight: 900;
    font-size: 1.25rem;
    box-shadow: 0 10px 35px rgba(247, 37, 133, 0.6), 0 0 25px rgba(254, 228, 64, 0.8);
    border: 2px solid var(--accent);
    z-index: 2000;
    animation: fairySlideDown 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fairySlideDown {
    from {
        transform: translate(-50%, -25px);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Story Maker & Challenges */
.story-maker-container {
    background: linear-gradient(135deg, rgba(60, 9, 108, 0.85), rgba(36, 0, 70, 0.95));
    border: 2.5px solid var(--accent);
    border-radius: 28px;
    padding: 28px;
    text-align: center;
    box-shadow: var(--shadow);
    margin-top: 22px;
}

.story-toggle-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-weight: 900;
    font-size: 1.35rem;
    padding: 16px 32px;
    border-radius: 22px;
    border: 2px solid var(--accent);
    box-shadow: 0 8px 25px rgba(247, 37, 133, 0.4);
    cursor: pointer;
}

.story-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(254, 228, 64, 0.7);
}

.story-output {
    background: rgba(36, 0, 70, 0.95);
    border: 2px solid var(--accent);
    border-radius: 22px;
    padding: 22px;
    margin-top: 22px;
    color: #ffffff;
    font-size: 1.25rem;
    line-height: 1.85;
}

/* =========================================================
   Games Area & Mechanics (Fairy Garden Edition)
========================================================= */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 22px;
}

.game-card {
    background: linear-gradient(135deg, rgba(60, 9, 108, 0.88), rgba(36, 0, 70, 0.95));
    border: 2.5px solid rgba(254, 228, 64, 0.4);
    border-radius: 24px;
    padding: 22px;
    text-align: center;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.game-card:hover {
    transform: translateY(-7px) scale(1.04);
    border-color: var(--accent);
    box-shadow: 0 12px 35px rgba(254, 228, 64, 0.6), 0 0 25px rgba(247, 37, 133, 0.4);
    background: linear-gradient(135deg, rgba(114, 9, 183, 0.92), rgba(60, 9, 108, 0.98));
}

.game-card .icon {
    font-size: 3.2rem;
    margin-bottom: 12px;
    filter: drop-shadow(0 0 14px rgba(254, 228, 64, 0.8));
}

.game-area {
    background: linear-gradient(135deg, rgba(46, 0, 85, 0.92), rgba(20, 0, 48, 0.96));
    border: 3px solid var(--accent);
    border-radius: 28px;
    padding: 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    margin-top: 15px;
}

.game-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 12px 20px;
    background: rgba(36, 0, 70, 0.9);
    border: 2px solid var(--accent);
    border-radius: 22px;
    box-shadow: 0 4px 20px rgba(254, 228, 64, 0.3);
}

.game-hearts {
    font-size: 1.6rem;
    filter: drop-shadow(0 0 10px #ff70a6);
}

.game-diamonds {
    font-size: 1.6rem;
    filter: drop-shadow(0 0 10px #fee440);
}

.game-question {
    font-size: 1.65rem;
    font-weight: 900;
    color: var(--accent);
    text-align: center;
    margin: 16px 0;
    cursor: pointer;
    text-shadow: 0 0 12px rgba(254, 228, 64, 0.5);
    line-height: 1.5;
}

.question-translation {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-top: 8px;
    font-family: var(--font-ar);
    font-weight: bold;
}

.action-btn-go {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #12002b !important;
    border: 2px solid #ffffff;
    border-radius: 28px;
    padding: 15px 38px;
    font-size: 1.35rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(247, 37, 133, 0.5);
    transition: all 0.25s ease;
    margin-top: 15px;
}

.action-btn-go:hover {
    transform: scale(1.07);
    box-shadow: 0 12px 40px rgba(254, 228, 64, 0.8);
    border-color: var(--accent);
}

.timing-bar {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 55px;
    background: rgba(36, 0, 70, 0.9);
    border: 2.5px solid var(--accent);
    border-radius: 25px;
    display: flex;
    overflow: hidden;
    margin: 15px 0;
}

.timing-zone {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
    border-right: 1px dashed rgba(254, 228, 64, 0.4);
}

.timing-needle {
    position: absolute;
    top: 0;
    width: 12px;
    height: 100%;
    background: #fee440;
    box-shadow: 0 0 20px #fee440, 0 0 35px #f72585;
    border-radius: 6px;
}

.striking-game {
    position: relative;
    width: 100%;
    max-width: 500px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

.goals-row {
    display: flex;
    justify-content: space-around;
    width: 100%;
    gap: 10px;
}

.strike-goal {
    background: rgba(60, 9, 108, 0.9);
    border: 2px solid var(--primary);
    border-radius: 20px;
    padding: 16px 20px;
    color: white;
    font-weight: bold;
    font-size: 1.25rem;
    flex: 1;
    text-align: center;
}

.crosshair {
    position: relative;
    font-size: 2.7rem;
    filter: drop-shadow(0 0 15px #fee440);
    margin: 20px 0;
}

.bouncing-game {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: radial-gradient(circle at center, rgba(60, 9, 108, 0.95), rgba(20, 0, 48, 0.98));
    border-radius: 24px;
    border: 2.5px solid var(--primary);
}

.bouncing-ball {
    position: absolute;
    bottom: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: 2px solid #ffffff;
    color: #12002b;
    padding: 14px 26px;
    border-radius: 28px;
    font-weight: 900;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(247, 37, 133, 0.5);
    animation: fairyBounce 2.2s infinite ease-in-out alternate;
}

@keyframes fairyBounce {
    0% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-130px) scale(1.1);
    }

    100% {
        transform: translateY(0) scale(1);
    }
}

.dodge-game {
    position: relative;
    width: 100%;
    max-width: 520px;
    min-height: 240px;
    background: radial-gradient(circle at center, rgba(60, 9, 108, 0.95), rgba(20, 0, 48, 0.98));
    border: 3px solid var(--accent);
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 20px 15px;
}

.scrolling-road {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: repeating-linear-gradient(0deg, transparent, transparent 20px, rgba(247, 37, 133, 0.25) 20px, rgba(247, 37, 133, 0.25) 40px);
    animation: fairyRoad 0.8s infinite linear;
    pointer-events: none;
}

@keyframes fairyRoad {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 0 40px;
    }
}

.enemies-row {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-around;
    width: 100%;
    gap: 12px;
    margin-top: 10px;
}

.enemy-obstacle {
    background: rgba(60, 9, 108, 0.9);
    border: 2.5px solid var(--accent);
    border-radius: 20px;
    padding: 15px 20px;
    color: white;
    font-weight: 900;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(247, 37, 133, 0.3);
    animation: fairyFloat 2s infinite ease-in-out alternate;
    transition: transform 0.2s ease, border-color 0.2s ease;
    text-align: center;
    flex: 1;
}

@keyframes fairyFloat {
    0% {
        transform: translateY(0px) scale(1);
        filter: drop-shadow(0 0 8px #f72585);
    }

    50% {
        transform: translateY(-30px) scale(1.1);
        filter: drop-shadow(0 0 20px #fee440);
    }

    100% {
        transform: translateY(0px) scale(1);
        filter: drop-shadow(0 0 8px #f72585);
    }
}

.enemy-obstacle:hover {
    transform: scale(1.12) !important;
    border-color: #ffffff;
    box-shadow: 0 10px 35px rgba(254, 228, 64, 0.8);
}

.smash-game {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.smash-crate {
    background: rgba(60, 9, 108, 0.9);
    border: 2.5px solid var(--accent);
    border-radius: 22px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s ease;
    min-width: 135px;
    box-shadow: 0 8px 25px rgba(247, 37, 133, 0.3);
}

.crate-box {
    font-size: 3rem;
    margin-top: 10px;
    filter: drop-shadow(0 0 14px #fee440);
}

.crate-label {
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
}

.drag-drop-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    width: 100%;
}

.drag-items {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.drag-item {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: 2px solid var(--accent);
    color: white;
    padding: 14px 24px;
    border-radius: 22px;
    font-weight: bold;
    font-size: 1.2rem;
    cursor: grab;
    box-shadow: 0 8px 25px rgba(247, 37, 133, 0.4);
}

.drop-zone {
    width: 100%;
    max-width: 480px;
    padding: 32px;
    border: 3px dashed var(--accent);
    border-radius: 28px;
    background: rgba(60, 9, 108, 0.9);
    color: var(--accent);
    font-weight: 900;
    font-size: 1.35rem;
    text-align: center;
    box-shadow: 0 8px 30px rgba(254, 228, 64, 0.35);
}

/* =========================================================
   Responsive Breakpoints
========================================================= */
@media (max-width: 860px) {
    .fairy-header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 10px;
    }

    .fairy-header-center {
        order: 3;
        width: 100%;
        margin-top: 4px;
    }

    .user-profile-header {
        order: 1;
    }

    .header-actions {
        order: 2;
    }

    .user-avatar-glow {
        width: 52px;
        height: 52px;
    }

    .student-name {
        font-size: 1.1rem;
    }

    .btn-play-fairies {
        padding: 6px 12px;
        font-size: 0.82rem;
    }

    .btn-magical-back {
        padding: 6px 12px;
        font-size: 0.82rem;
    }
}

/* =========================================================
   Dancing Flowers Magic Particle System & Profile Magic
========================================================= */
.magic-glow-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    box-shadow: inset 0 0 100px rgba(247, 37, 133, 0.7), inset 0 0 160px rgba(254, 228, 64, 0.5), inset 0 0 200px rgba(76, 201, 240, 0.4);
    animation: magicalAuraPulse 1.2s ease-in-out infinite alternate;
    transition: opacity 0.8s ease;
}

@keyframes magicalAuraPulse {
    0% {
        box-shadow: inset 0 0 90px rgba(247, 37, 133, 0.8), inset 0 0 160px rgba(254, 228, 64, 0.6);
        background: radial-gradient(circle at 50% 10%, rgba(247, 37, 133, 0.18), transparent 70%);
    }

    50% {
        box-shadow: inset 0 0 130px rgba(76, 201, 240, 0.8), inset 0 0 190px rgba(254, 228, 64, 0.7);
        background: radial-gradient(circle at 50% 50%, rgba(76, 201, 240, 0.22), transparent 75%);
    }

    100% {
        box-shadow: inset 0 0 110px rgba(254, 228, 64, 0.8), inset 0 0 170px rgba(247, 37, 133, 0.7);
        background: radial-gradient(circle at 50% 90%, rgba(254, 228, 64, 0.2), transparent 70%);
    }
}

/* Avatar Royal Halo during Magic */
.user-avatar-glow.magic-active {
    animation: royalFairyGlow 1.1s ease-in-out infinite alternate !important;
}

@keyframes royalFairyGlow {
    0% {
        transform: scale(1.22) rotate(0deg);
        box-shadow: 0 0 35px #fee440, 0 0 65px #f72585, 0 0 95px #4cc9f0;
    }

    100% {
        transform: scale(1.3) rotate(8deg);
        box-shadow: 0 0 55px #f72585, 0 0 85px #fee440, 0 0 125px #ff70a6;
    }
}

/* Platform Dancing & Bobbing */
.magic-platform-dancing {
    animation: cutePlatformDance 1.4s ease-in-out infinite alternate;
}

@keyframes cutePlatformDance {
    0% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-8px) scale(1.008);
    }

    100% {
        transform: translateY(5px) scale(1);
    }
}

.magic-sparkle-card {
    animation: cardMagicSparkle 1.2s ease-in-out infinite alternate !important;
}

@keyframes cardMagicSparkle {
    0% {
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 25px rgba(247, 37, 133, 0.6);
        transform: translateY(-4px);
    }

    100% {
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 45px rgba(254, 228, 64, 0.85);
        transform: translateY(-10px) scale(1.03);
    }
}

/* Dancing Flowers & Musical Notes Particle */
.dancing-flower-particle {
    position: fixed;
    pointer-events: none;
    z-index: 10001;
    user-select: none;
    filter: drop-shadow(0 0 12px rgba(255, 112, 166, 0.9)) drop-shadow(0 0 6px rgba(254, 228, 64, 0.8));
    animation: danceFlowerScatter 3.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes danceFlowerScatter {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0.3) rotate(0deg);
    }

    15% {
        opacity: 1;
        transform: translate(var(--tx, 0), var(--ty, 0)) scale(var(--scale, 1.3)) rotate(var(--rot, 45deg));
    }

    50% {
        opacity: 0.95;
        transform: translate(calc(var(--tx, 0) + var(--sway, 25px)), calc(var(--ty, 0) + 80px)) scale(var(--scale, 1.1)) rotate(calc(var(--rot, 45deg) + 180deg));
    }

    85% {
        opacity: 0.8;
        transform: translate(calc(var(--tx, 0) - var(--sway, 25px)), calc(var(--ty, 0) + 200px)) scale(calc(var(--scale, 1) * 0.9)) rotate(calc(var(--rot, 45deg) + 360deg));
    }

    100% {
        opacity: 0;
        transform: translate(calc(var(--tx, 0) + 15px), calc(var(--ty, 0) + 360px)) scale(0.35) rotate(calc(var(--rot, 45deg) + 540deg));
    }
}

/* ==========================================================================
   SPIDER-MAN MINI PUZZLE GAME (لعبة بازل تجميع بطاقات سبايدرمان الخارقة)
   ========================================================================== */
.spider-puzzle-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 2, 18, 0.92);
    backdrop-filter: blur(14px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    box-sizing: border-box;
    animation: puzzleFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    user-select: none;
    font-family: 'Alexandria', 'Cairo', sans-serif;
    direction: rtl;
}

.spider-puzzle-overlay.modal-closing {
    animation: puzzleFadeOut 0.3s forwards ease-in;
}

@keyframes puzzleFadeIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes puzzleFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.92);
    }
}

.spider-puzzle-card {
    background: linear-gradient(135deg, #fff5f8 0%, #ffffff 100%);
    border: 2.5px solid #fda4af;
    border-radius: 28px;
    width: 100%;
    max-width: 680px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(244, 63, 94, 0.2), 0 0 35px rgba(244, 63, 94, 0.2);
    overflow: hidden;
    position: relative;
}

/* Header */
.puzzle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(255, 240, 245, 0.8);
    border-bottom: 1.5px solid #fecdd3;
}

.puzzle-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.puzzle-hero-badge {
    background: linear-gradient(135deg, #f43f5e, #fb7185);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 900;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid #fda4af;
    letter-spacing: 0.5px;
}

.puzzle-main-title {
    font-size: 1.2rem;
    font-weight: 900;
    color: #1e293b;
    margin: 0;
    text-shadow: 0 0 10px #e60026;
}

.puzzle-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.puzzle-close-btn:hover {
    background: #e60026;
    border-color: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 0 15px #e60026;
}

/* Mode Tabs */
.puzzle-tabs-row {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 14px;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.puzzle-tab-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
    padding: 8px 14px;
    border-radius: 14px;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: 'Alexandria', 'Cairo', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.puzzle-tab-btn.active {
    background: linear-gradient(135deg, #e60026 0%, #0066ff 100%);
    color: #ffffff;
    border-color: #00d2ff;
    box-shadow: 0 0 15px rgba(230, 0, 38, 0.6);
}

/* Stats HUD */
.puzzle-stats-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 18px;
    background: rgba(0, 0, 0, 0.5);
    flex-wrap: wrap;
    gap: 10px;
}

.puzzle-stat-box {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 900;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.puzzle-stat-box b {
    color: #ffd700;
    font-family: 'Orbitron', monospace;
    font-size: 1.05rem;
}

.puzzle-actions-tools {
    display: flex;
    gap: 8px;
}

.tool-action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Alexandria', 'Cairo', sans-serif;
}

.tool-action-btn:hover {
    background: rgba(0, 210, 255, 0.3);
    border-color: #00d2ff;
}

.tool-action-btn.highlight {
    background: linear-gradient(135deg, #00d2ff, #0066ff);
    border-color: #ffd700;
    color: #ffffff;
}

/* Viewport & 3x3 Board */
.puzzle-viewport {
    padding: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    overflow-y: auto;
}

.photocard-puzzle-board {
    display: grid;
    grid-template-columns: repeat(3, 105px);
    grid-template-rows: repeat(3, 105px);
    gap: 6px;
    background: #000000;
    padding: 10px;
    border-radius: 20px;
    border: 2px solid #00d2ff;
    box-shadow: 0 0 25px rgba(0, 210, 255, 0.5), inset 0 0 15px rgba(230, 0, 38, 0.4);
}

.puzzle-tile {
    width: 105px;
    height: 105px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background-repeat: no-repeat;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s, box-shadow 0.2s;
}

.puzzle-tile:hover {
    transform: scale(1.04);
    border-color: #ffd700;
    box-shadow: 0 0 15px #ffd700;
    z-index: 5;
}

.puzzle-tile.selected {
    border: 3px solid #e60026 !important;
    box-shadow: 0 0 20px #e60026 !important;
    transform: scale(1.08);
    z-index: 10;
    animation: tileSelectedPulse 0.8s infinite alternate;
}

@keyframes tileSelectedPulse {
    from {
        box-shadow: 0 0 15px #e60026;
    }

    to {
        box-shadow: 0 0 25px #00d2ff;
    }
}

.puzzle-tile-num {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.75);
    color: #ffd700;
    font-size: 0.72rem;
    font-weight: 900;
    font-family: 'Orbitron', monospace;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ffd700;
    pointer-events: none;
}

/* Word Match Mode Grid */
.word-puzzle-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(130px, 1fr));
    gap: 12px;
    width: 100%;
    max-width: 500px;
}

.word-puzzle-card {
    background: linear-gradient(135deg, rgba(14, 22, 50, 0.9) 0%, rgba(7, 10, 25, 0.95) 100%);
    border: 2px solid rgba(0, 210, 255, 0.4);
    border-radius: 16px;
    padding: 14px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.6);
}

.word-puzzle-card:hover {
    transform: translateY(-4px) scale(1.03);
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.word-puzzle-card.selected {
    border-color: #e60026;
    box-shadow: 0 0 20px #e60026;
    background: linear-gradient(135deg, #e60026 0%, #0066ff 100%);
}

.word-puzzle-card.matched {
    border-color: #00d2ff;
    background: linear-gradient(135deg, rgba(0, 210, 255, 0.3) 0%, rgba(0, 102, 255, 0.4) 100%);
    opacity: 0.7;
    cursor: default;
    pointer-events: none;
}

.puzzle-en-word {
    font-size: 1.15rem;
    font-weight: 900;
    color: #ffffff;
    margin: 0 0 4px 0;
    font-family: 'Fredoka', 'Cairo', sans-serif;
}

.puzzle-icon-symbol {
    font-size: 2rem;
    display: block;
    margin-bottom: 4px;
}

.puzzle-ar-hint {
    font-size: 0.75rem;
    color: #ffd700;
    font-weight: 700;
}

/* Footer Controls */
.puzzle-footer-controls {
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-puzzle-reset {
    background: linear-gradient(135deg, #e60026 0%, #00d2ff 100%);
    border: 1.5px solid #ffd700;
    color: #070a14;
    font-size: 0.95rem;
    font-weight: 900;
    padding: 8px 24px;
    border-radius: 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 0 15px rgba(230, 0, 38, 0.6);
    transition: all 0.2s ease;
    font-family: 'Alexandria', 'Cairo', sans-serif;
}

.btn-puzzle-reset:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(0, 210, 255, 0.9);
}

/* Preview Popover */
.puzzle-preview-popover {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 40;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.popover-content {
    background: #0e162c;
    border: 2px solid #ffd700;
    border-radius: 20px;
    padding: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.popover-content img {
    width: 220px;
    height: 220px;
    object-fit: cover;
    border-radius: 14px;
    border: 2px solid #00d2ff;
}

.preview-caption {
    font-size: 0.85rem;
    color: #e2e8f0;
    font-weight: 700;
}

.btn-close-popover {
    background: #e60026;
    border: none;
    color: #ffffff;
    padding: 6px 20px;
    border-radius: 12px;
    font-weight: 900;
    cursor: pointer;
}

/* Victory Overlay */
.puzzle-victory-overlay {
    position: absolute;
    inset: 0;
    background: rgba(7, 10, 20, 0.95);
    z-index: 50;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: puzzleFadeIn 0.3s ease-out;
}

.victory-card-modal {
    text-align: center;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.victory-stars {
    font-size: 2.2rem;
    filter: drop-shadow(0 0 10px #ffd700);
}

.victory-card-modal h2 {
    font-size: 1.4rem;
    font-weight: 900;
    color: #ffffff;
    margin: 0;
    text-shadow: 0 0 15px #e60026;
}

.victory-card-modal p {
    font-size: 0.92rem;
    color: #cbd5e1;
    margin: 0;
}

.victory-card-showcase {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 18px;
    background: linear-gradient(135deg, #ffd700, #e60026, #00d2ff);
    padding: 3px;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
    margin: 8px 0;
}

.victory-card-showcase img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
    display: block;
}

.victory-foil-badge {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    background: #000000;
    border: 1px solid #ffd700;
    color: #ffd700;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 2px 10px;
    border-radius: 10px;
    white-space: nowrap;
}

.victory-btns-row {
    display: flex;
    gap: 12px;
    margin-top: 6px;
}

.btn-victory-next {
    background: linear-gradient(135deg, #e60026, #00d2ff);
    border: 2px solid #ffd700;
    color: #070a14;
    font-size: 0.95rem;
    font-weight: 900;
    padding: 8px 22px;
    border-radius: 16px;
    cursor: pointer;
    font-family: 'Alexandria', 'Cairo', sans-serif;
}

.btn-victory-close {
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 900;
    padding: 8px 18px;
    border-radius: 16px;
    cursor: pointer;
    font-family: 'Alexandria', 'Cairo', sans-serif;
}

@media (max-width: 500px) {
    .photocard-puzzle-board {
        grid-template-columns: repeat(3, 85px);
        grid-template-rows: repeat(3, 85px);
    }

    .puzzle-tile {
        width: 85px;
        height: 85px;
    }
}