/* =========================================================================
   adventure-style.css - Math Adventure: Primary & Secondary Mathematics Mastery
   Harmonized with Math Adventure Core Plugin v25.3.9
   FEATURES: Ultra-Luxury Full-Width Learning Path, Holographic HUD Sidebar, 
             Cyber Compass Capsule, Precision Milestone Lasers, High-Contrast Glows,
             Mobile Ultra-Responsive Zero-Overflow Engine, Centered Floating Cards
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800;900&family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
    --fma-font-heading: 'Plus Jakarta Sans', sans-serif;
    --fma-font-body: 'Nunito', sans-serif;
    
    /* PALETTE: Ultra-Luxury Cyber EdTech */
    --c-bg: #060911;                  /* Deep Stellar Void */
    --c-bg-surface: #0b1120;          /* Deep Cyber Slate */
    --c-bg-subtle: #131c2e;           /* Elevated Surface Layer */
    --c-primary: #38bdf8;             /* Bright Electric Cyan */
    --c-primary-dark: #0284c7;        /* Ocean Laser Blue */
    --c-primary-glow: rgba(56, 189, 248, 0.45);
    --c-secondary: #818cf8;           /* Cyber Violet / Indigo */
    --c-accent: #f43f5e;              /* Neon Rose */
    --c-success: #10b981;             /* Emerald Quantum */
    --c-warning: #f59e0b;             /* Solar Gold */
    --c-info: #0ea5e9;                /* Sky Plasma */
    
    /* Luxury Glassmorphism & Surface Tokens */
    --c-card: rgba(19, 28, 47, 0.88);
    --c-card-solid: #131d30;          
    --c-card-hover: rgba(26, 38, 64, 0.96);
    --c-input-bg: #080d1a;
    
    /* High-Contrast Typography */
    --c-text-dark: #ffffff;           /* Pure White Heading */
    --c-text-mid: #cbd5e1;            /* Bright Slate Body */
    --c-text-light: #94a3b8;          /* Crisp Secondary Muted */
    
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    /* Holographic Glows & Shadows */
    --shadow-soft: 0 16px 45px -10px rgba(0, 0, 0, 0.75);
    --shadow-card: 0 12px 35px rgba(0, 0, 0, 0.5);
    --shadow-cyan-glow: 0 0 25px rgba(56, 189, 248, 0.35);
    --shadow-gold-glow: 0 0 25px rgba(245, 158, 11, 0.4);
    --shadow-emerald-glow: 0 0 25px rgba(16, 185, 129, 0.4);
    
    --glass-border: 1px solid rgba(255, 255, 255, 0.12);
    --glass-border-subtle: 1px solid rgba(255, 255, 255, 0.06);

    /* Safe Clearance for Portal & Dashboard Pages */
    --fma-header-clearance: 125px;
    --fma-header-clearance-mobile: 105px;
}

/* =========================================================================
   GLOBAL RESET & ZERO-SHIFT LAYOUT STABILIZATION
   ========================================================================= */

* { 
    box-sizing: border-box; 
}

html {
    overflow-y: scroll;               
    scrollbar-gutter: stable;         
    overflow-x: hidden !important;
    margin: 0;
    padding: 0;
}

body { 
    margin: 0; 
    padding: 0; 
    background-color: var(--c-bg); 
    color: var(--c-text-dark);
    font-family: var(--fma-font-body);
    overflow-x: hidden !important;
    width: 100%;
    -webkit-font-smoothing: antialiased;
}

/* WordPress Admin Bar Sync */
body.admin-bar .ma-header-container {
    top: 52px !important;
}
@media (max-width: 782px) {
    body.admin-bar .ma-header-container {
        top: 66px !important;
    }
}

/* =========================================================================
   FULL-WIDTH IMMERSIVE LEARNING PATH MAIN WRAPPER (PRESTIGE EDITION)
   ========================================================================= */

.adventure-game-wrapper {
    font-family: var(--fma-font-body);
    color: var(--c-text-dark);
    padding: 28px 3.5% 70px 3.5% !important;
    min-height: 100vh;
    display: grid;
    gap: 36px;
    background-color: var(--c-bg);
    background-image: 
        radial-gradient(circle at 10% 15%, rgba(56, 189, 248, 0.14) 0%, transparent 40%),
        radial-gradient(circle at 90% 85%, rgba(129, 140, 248, 0.14) 0%, transparent 40%),
        linear-gradient(to bottom, #060911 0%, #0c1322 100%);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
}

@media (min-width: 1200px) {
    .adventure-game-wrapper {
        grid-template-columns: minmax(0, 1fr) 390px;
        padding: 30px 4% 80px 4% !important;
        gap: 42px;
    }
    .adventure-sidebar { 
        order: 2; 
        position: sticky; 
        top: 24px; 
        align-self: start; 
        z-index: 10; 
    }
    .main-content { 
        order: 1; 
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 1199px) and (min-width: 840px) {
    .adventure-game-wrapper { 
        grid-template-columns: minmax(0, 1fr) 350px;
        padding: 24px 3% 60px 3% !important; 
        gap: 30px; 
    }
    .adventure-sidebar { 
        order: 2; 
        position: sticky; 
        top: 20px; 
    }
    .main-content { 
        order: 1; 
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 839px) {
    .adventure-game-wrapper { 
        padding: 16px 12px 45px 12px !important; 
        gap: 20px; 
        grid-template-columns: 100% !important; 
        width: 100% !important;
        max-width: 100vw !important;
    }
    .adventure-sidebar { 
        order: 2; 
        margin-top: 15px; 
        width: 100% !important;
        min-width: 0 !important;
    }
    .main-content { 
        order: 1; 
        width: 100% !important; 
        min-width: 0 !important;
    }
    .path-step { 
        gap: 12px !important; 
        padding-bottom: 26px !important; 
        width: 100% !important;
    } 
    .step-marker { 
        width: 38px !important; 
        height: 38px !important; 
        font-size: 0.95rem !important; 
    }
    .step-marker-wrapper { 
        width: 40px !important; 
    }
    .step-line {
        top: 38px !important;
    }
}

/* =========================================================================
   MODERN CYBER COMPASS / CURRICULUM MAP BUTTON
   ========================================================================= */

.fma-back-btn, .fma-return-btn {
    display: inline-flex !important; 
    align-items: center !important; 
    gap: 10px !important; 
    background: linear-gradient(135deg, rgba(19, 28, 47, 0.95), rgba(11, 17, 32, 0.98)) !important; 
    color: #f8fafc !important;
    padding: 12px 24px !important; 
    border-radius: 50px !important; 
    font-weight: 800 !important; 
    text-decoration: none !important; 
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 15px rgba(56, 189, 248, 0.15) !important;
    border: 1.5px solid rgba(56, 189, 248, 0.4) !important; 
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important; 
    font-size: 0.92rem !important; 
    font-family: var(--fma-font-heading) !important;
    letter-spacing: 0.4px !important;
    backdrop-filter: blur(16px) !important;
    margin-bottom: 20px !important;
}

.fma-back-btn::before {
    content: "🧭";
    font-size: 1.2rem;
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.8));
    transition: transform 0.4s ease;
}

.fma-back-btn:hover, .fma-return-btn:hover { 
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.35), rgba(15, 23, 42, 0.98)) !important; 
    color: #38bdf8 !important; 
    border-color: #38bdf8 !important;
    transform: translateY(-2px) scale(1.02) !important; 
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(56, 189, 248, 0.45) !important;
}

.fma-back-btn:hover::before {
    transform: rotate(45deg);
}

/* =========================================================================
   PRECISE CONTINUOUS LEARNING PATH & STAGES
   ========================================================================= */

.path-container { 
    margin-bottom: 35px; 
    position: relative;
    width: 100%;
}

.path-step { 
    display: flex; 
    gap: 26px; 
    margin-bottom: 0; 
    padding-bottom: 36px; 
    align-items: stretch; 
    position: relative; 
    width: 100%;
}

.step-marker-wrapper { 
    width: 56px; 
    flex-shrink: 0; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    position: relative; 
}

.step-marker {
    width: 50px; 
    height: 50px; 
    background: #131c2e; 
    border: 2.5px solid #334460; 
    border-radius: 50%;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: 900; 
    font-size: 1.2rem;
    color: var(--c-text-light); 
    box-shadow: 0 8px 24px rgba(0,0,0,0.55); 
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    z-index: 5; 
    flex-shrink: 0;
    font-family: var(--fma-font-heading);
    position: relative;
}

.step-line { 
    position: absolute;
    top: 50px;          
    bottom: -36px;      
    left: 50%;
    width: 3.5px; 
    transform: translateX(-50%);
    background: #24324d; 
    z-index: 1; 
    border-radius: 3px;
    transition: all 0.3s ease;
}

.path-step:last-child .step-line { display: none; }
.path-step:last-child { padding-bottom: 0; }

.path-step.step-completed .step-marker { 
    background: #064e3b; 
    border-color: var(--c-success); 
    color: #ffffff; 
    box-shadow: 0 0 22px rgba(16, 185, 129, 0.5); 
}
.path-step.step-completed .step-line { 
    background: var(--c-success); 
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.5); 
}

.step-details {
    background: var(--c-card); 
    border-radius: var(--radius-xl); 
    padding: 28px 32px; 
    box-shadow: var(--shadow-soft);
    flex: 1; 
    transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease; 
    align-self: flex-start; 
    width: 100%;
    min-width: 0;
    border: var(--glass-border); 
    border-left: 6px solid #334460;
    backdrop-filter: blur(18px);
    overflow-wrap: break-word;
}
.path-step.step-completed .step-details { border-left-color: var(--c-success); }
.step-details:hover { 
    transform: translateY(-2px); 
    background: var(--c-card-hover); 
    border-color: rgba(56, 189, 248, 0.25);
}

.step-details h4 { 
    font-family: var(--fma-font-heading); 
    font-size: 1.3rem; 
    font-weight: 800; 
    color: #ffffff; 
    margin: 0 0 20px; 
    border-bottom: 1px solid rgba(255,255,255,0.08); 
    padding-bottom: 15px;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.step-details ul { 
    list-style: none; 
    padding: 0; 
    margin: 0; 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); 
    gap: 16px; 
    width: 100%;
}

/* EXERCISE BUTTONS & NODES (LUXURY CARDS) */
.step-details li {
    margin: 0;
    padding: 0;
    min-width: 0;
}

.step-details li a {
    display: flex; 
    align-items: center; 
    gap: 12px; 
    padding: 16px 22px; 
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.9), rgba(11, 17, 32, 0.95)); 
    border-radius: var(--radius-lg);
    text-decoration: none; 
    font-weight: 700; 
    font-size: 0.96rem; 
    color: var(--c-text-mid); 
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    border: 1.5px solid rgba(255,255,255,0.08);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
    overflow: hidden;
    text-overflow: ellipsis;
}
.step-details li a:hover { 
    background: linear-gradient(145deg, rgba(56, 189, 248, 0.18), rgba(15, 23, 42, 0.95)); 
    color: #ffffff; 
    transform: translateY(-3px); 
    border-color: rgba(56, 189, 248, 0.5); 
    box-shadow: 0 10px 25px rgba(0,0,0,0.4), 0 0 16px rgba(56, 189, 248, 0.25);
}

.step-details li.locked .locked-item-content {
    display: flex; 
    align-items: center; 
    gap: 12px; 
    padding: 16px 22px; 
    background: rgba(11, 17, 32, 0.5); 
    border-radius: var(--radius-lg);
    font-weight: 600; 
    font-size: 0.95rem; 
    color: #64748b; 
    border: 1px dashed #24324d; 
    cursor: not-allowed; 
    opacity: 0.75;
}

.step-details li.done a { 
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.15), rgba(11, 17, 32, 0.95)); 
    color: #34d399; 
    border-color: rgba(16, 185, 129, 0.4); 
    border-left: 4.5px solid var(--c-success); 
}

.step-details li.current a,
.step-details li.viewing a {
    background: linear-gradient(145deg, rgba(245, 158, 11, 0.2), rgba(15, 23, 42, 0.95)) !important; 
    color: #fbbf24 !important; 
    border: 1.5px solid #f59e0b !important;
    border-left: 4.5px solid #f59e0b !important;
    box-shadow: 0 0 22px rgba(245, 158, 11, 0.35) !important;
    animation: fmaPulse 2.5s infinite;
}

/* =========================================================================
   SIDEBAR (RIGHT) - Student Profile & HUD Card
   ========================================================================= */

.char-card {
    background: var(--c-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 34px 28px;
    text-align: center;
    box-shadow: var(--shadow-soft);
    margin-top: 45px;
    position: relative;
    border: var(--glass-border);
    overflow: visible;
}

.char-avatar-wrapper {
    width: 124px !important;
    height: 124px !important;
    margin: -80px auto 18px;
    background: linear-gradient(135deg, #0284c7, #38bdf8);
    border-radius: 50%;
    padding: 5px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.55), 0 0 0 6px rgba(11, 17, 32, 0.95);
    border: 3px solid #ffffff;
    position: relative;
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
}

.char-avatar { 
    width: 100% !important; 
    height: 100% !important; 
    border-radius: 50% !important; 
    object-fit: cover !important; 
    animation: floatHead 3.5s ease-in-out infinite; 
    display: block !important;
    background: #0f172a;
}

.level-title { 
    font-family: var(--fma-font-heading); 
    font-size: 1.35rem; 
    font-weight: 800; 
    margin: 8px 0 18px; 
    color: #ffffff; 
    letter-spacing: 0.3px;
    line-height: 1.35;
}

/* Progress Bar */
.progress-bar-container { 
    background: rgba(11, 17, 32, 0.85); 
    padding: 16px 18px; 
    border-radius: var(--radius-md); 
    margin: 18px 0; 
    border: var(--glass-border-subtle); 
}
.progress-header { 
    display: flex; 
    justify-content: space-between; 
    font-weight: 800; 
    margin-bottom: 8px; 
    font-size: 0.82rem; 
    color: var(--c-primary); 
    text-transform: uppercase; 
    font-family: var(--fma-font-heading); 
    letter-spacing: 0.8px;
}
.progress-track { 
    height: 11px; 
    background: #080d1a; 
    border-radius: 20px; 
    overflow: hidden; 
    border: 1px solid #24324d; 
}
.progress-fill { 
    height: 100%; 
    background: linear-gradient(90deg, #0284c7, #38bdf8); 
    border-radius: 20px;
    transition: width 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

/* Stats Row */
.stats-row { 
    display: flex; 
    justify-content: center; 
    gap: 12px; 
    margin: 18px 0; 
    flex-wrap: wrap; 
}
.stat-pill {
    background: rgba(11, 17, 32, 0.9); 
    padding: 11px 18px; 
    border-radius: var(--radius-sm); 
    font-weight: 800; 
    font-size: 0.94rem; 
    box-shadow: 0 4px 14px rgba(0,0,0,0.35); 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    transition: transform 0.25s ease;
    border: var(--glass-border-subtle); 
    color: var(--c-text-dark);
    font-family: var(--fma-font-heading);
}
.stat-pill span { font-variant-numeric: tabular-nums; }
.stat-pill:hover { transform: translateY(-2px); }
.coin-pill { color: var(--c-warning); border-color: rgba(245, 158, 11, 0.4); }
.streak-pill { color: #fb923c; border-color: rgba(251, 146, 60, 0.4); }

/* Mission Goal Box */
.mission-box {
    background: rgba(11, 17, 32, 0.8); 
    border-radius: var(--radius-md); 
    padding: 16px 18px; 
    margin: 18px 0; 
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-left: 4.5px solid var(--c-primary);
    text-align: left;
}
.mission-icon { 
    font-size: 0.98rem; 
    font-weight: 800; 
    margin-bottom: 4px; 
    color: var(--c-primary); 
    font-family: var(--fma-font-heading);
    letter-spacing: 0.5px;
}
.mission-text { 
    font-weight: 600; 
    font-size: 0.94rem; 
    color: var(--c-text-mid); 
    line-height: 1.5;
}

/* Badges Section */
.fma-badges-section { 
    background: rgba(11, 17, 32, 0.6); 
    border-radius: var(--radius-lg); 
    padding: 18px 16px; 
    margin: 22px 0 10px; 
    border: var(--glass-border-subtle); 
}
.fma-badges-title { 
    font-family: var(--fma-font-heading); 
    font-size: 0.88rem; 
    font-weight: 800; 
    text-align: center; 
    margin-bottom: 14px; 
    color: var(--c-text-mid); 
    letter-spacing: 1.2px; 
    text-transform: uppercase;
}
.fma-badges-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; justify-items: center; }
.fma-badge {
    width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
    font-size: 1.45rem; background: rgba(11, 17, 32, 0.85); border-radius: var(--radius-sm); opacity: 0.25; filter: grayscale(100%); transition: all 0.4s ease;
    border: 1px solid #24324d;
}
.fma-badge.unlocked {
    background: rgba(56, 189, 248, 0.15); opacity: 1; filter: grayscale(0%);
    border: 1px solid var(--c-primary); box-shadow: 0 4px 14px rgba(56, 189, 248, 0.25);
    transform: scale(1.05);
}

/* Daily Workout Card */
.daily-promo {
    background: linear-gradient(135deg, rgba(24, 34, 53, 0.95), rgba(11, 17, 32, 0.98));
    border-radius: var(--radius-lg); 
    padding: 24px 20px; 
    text-align: center; 
    border: 1px solid rgba(129, 140, 248, 0.4); 
    margin-top: 24px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}
.daily-icon { font-size: 2.5rem; margin-bottom: 6px; animation: bounce 3s infinite; }
.daily-promo h4 { font-family: var(--fma-font-heading); font-size: 1.18rem; color: #ffffff; margin: 0 0 5px; font-weight: 800;}
.daily-promo p { font-size: 0.9rem; color: var(--c-text-mid); margin-bottom: 16px; line-height: 1.45; }

/* =========================================================================
   UNIT VICTORY HERO CARD & CERTIFICATE STYLING
   ========================================================================= */
.fma-victory-wrapper {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(15, 23, 42, 0.96) 100%) !important;
    border: 2px solid #10b981 !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(16, 185, 129, 0.35) !important;
    border-radius: var(--radius-xl) !important;
    padding: 35px 30px !important;
    margin-bottom: 35px !important;
    text-align: center !important;
    backdrop-filter: blur(16px) !important;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.victory-icon {
    font-size: 4.5rem !important;
    margin-bottom: 10px !important;
    animation: bounce 2.5s infinite;
}
.victory-content h2 {
    font-family: var(--fma-font-heading) !important;
    font-size: 1.85rem !important;
    font-weight: 900 !important;
    color: #ffffff !important;
    margin: 0 0 10px 0 !important;
}
.victory-content p {
    color: #cbd5e1 !important;
    font-size: 1.05rem !important;
    max-width: 650px !important;
    margin: 0 auto 25px auto !important;
    line-height: 1.6 !important;
}
.btn-certificate {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    box-shadow: 0 4px 18px rgba(245, 158, 11, 0.45) !important;
    font-size: 1rem !important;
    padding: 14px 28px !important;
}

/* =========================================================================
   ULTRA-RESPONSIVE CENTERED LOCKED BARRIER CARD (FOR GUEST USERS)
   ========================================================================= */
.fma-locked-barrier-wrapper {
    background: linear-gradient(145deg, rgba(19, 28, 47, 0.96), rgba(11, 17, 32, 0.98)) !important;
    border: 1.5px solid rgba(245, 158, 11, 0.45) !important;
    border-radius: var(--radius-xl) !important;
    padding: 48px 36px !important;
    margin: max(50px, 12vh) auto !important; /* Perfect Center Placement */
    max-width: 580px !important;
    width: 90% !important;
    text-align: center !important;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7), 0 0 40px rgba(245, 158, 11, 0.18) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    position: relative !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

.fma-locked-barrier-wrapper > div:first-child {
    font-size: 3.8rem !important;
    line-height: 1 !important;
    margin-bottom: 18px !important;
    filter: drop-shadow(0 0 22px rgba(245, 158, 11, 0.65)) !important;
    animation: bounce 3s ease-in-out infinite !important;
}

.fma-locked-barrier-wrapper h2 {
    font-family: var(--fma-font-heading) !important;
    font-size: clamp(1.4rem, 4vw, 1.85rem) !important;
    font-weight: 900 !important;
    color: #ffffff !important;
    margin: 0 0 14px 0 !important;
    letter-spacing: -0.3px !important;
    line-height: 1.3 !important;
    text-shadow: 0 2px 12px rgba(0,0,0,0.6) !important;
}

.fma-locked-barrier-wrapper p {
    color: var(--c-text-mid) !important;
    font-size: clamp(0.92rem, 2.5vw, 1.02rem) !important;
    line-height: 1.65 !important;
    margin: 0 auto 28px auto !important;
    max-width: 480px !important;
}

.fma-locked-barrier-wrapper p strong {
    color: var(--c-primary) !important;
    font-weight: 800 !important;
}

.fma-locked-barrier-wrapper > div:last-child {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 14px !important;
    flex-wrap: wrap !important;
    width: 100% !important;
}

.fma-locked-barrier-wrapper .fma-3d-btn {
    min-height: 48px !important;
    padding: 13px 26px !important;
    font-size: 0.95rem !important;
    letter-spacing: 0.3px !important;
    border-radius: var(--radius-md) !important;
    font-weight: 800 !important;
}

/* =========================================================================
   FUTURISTIC KEYFRAME ANIMATIONS
   ========================================================================= */

@keyframes fmaPulse { 
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6); } 
    70% { transform: scale(1.03); box-shadow: 0 0 0 12px rgba(245, 158, 11, 0); } 
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); } 
}

@keyframes fmaShake { 
    10%, 90% { transform: translateX(-1px); } 
    20%, 80% { transform: translateX(2px); } 
    30%, 50%, 70% { transform: translateX(-4px); } 
    40%, 60% { transform: translateX(4px); } 
}

@keyframes floatHead {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes bounce { 
    0%, 100% { transform: translateY(0); } 
    50% { transform: translateY(-6px); } 
}

@keyframes starSpin {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.15) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

.fma-active-pulse { animation: fmaPulse 2.5s infinite; position: relative; }
.shake-element { animation: fmaShake 0.5s cubic-bezier(.36,.07,.19,.97) both; }

/* =========================================================================
   FLOATING STAR REWARDS ANIMATION
   ========================================================================= */
.fma-floating-coins {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2147483647;
    pointer-events: none;
    animation: floatUpFade 2.4s ease-out forwards;
    text-align: center;
    width: 300px;
    height: 300px;
}

.fma-floating-coins .coin-visual {
    font-size: 5.8rem;
    line-height: 1;
    filter: drop-shadow(0 0 25px rgba(245, 158, 11, 0.85));
    margin-bottom: 8px;
    display: block;
    animation: starSpin 1.8s ease-in-out infinite;
}

.fma-floating-coins .coin-amount {
    font-family: var(--fma-font-heading);
    font-size: 2.7rem;
    font-weight: 900;
    color: var(--c-warning);
    text-shadow: 0 4px 18px rgba(245, 158, 11, 0.6);
    margin-top: -6px;
    display: block;
    letter-spacing: 1px;
}

@keyframes floatUpFade { 
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } 
    25% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 
    100% { transform: translate(-50%, -150px) scale(1); opacity: 0; } 
}

/* =========================================================================
   3D ACTION BUTTONS
   ========================================================================= */

.fma-3d-btn {
    font-family: var(--fma-font-heading); 
    font-weight: 800; 
    padding: 13px 30px; 
    border: none;
    border-radius: var(--radius-md); 
    font-size: 0.94rem; 
    color: white; 
    cursor: pointer; 
    position: relative; 
    transition: all 0.2s ease; 
    box-shadow: 0 4px 14px rgba(0,0,0,0.25); 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none !important;
}
.fma-3d-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.3); }
.fma-3d-btn:active:not(:disabled) { transform: translateY(1px); }

.fma-3d-btn.btn-orange { background: linear-gradient(135deg, #f59e0b, #d97706); color: #ffffff; }
.fma-3d-btn.btn-purple { background: linear-gradient(135deg, #6366f1, #4f46e5); color: #ffffff; }
.fma-3d-btn.btn-locked { background: #334155; color: #94a3b8; cursor: not-allowed; opacity: 0.75; }
#quiz-submit { background: linear-gradient(135deg, #0284c7, #0369a1); }

/* =========================================================================
   BRAIN TEASER: LOGIC CHALLENGE
   ========================================================================= */

.fma-quiz-container {
    background: var(--c-card); 
    border-radius: var(--radius-xl); 
    padding: 34px; 
    color: var(--c-text-dark);
    text-align: center; 
    margin: 32px auto; 
    width: 100%; 
    box-shadow: var(--shadow-soft); 
    border: 1px solid rgba(129, 140, 248, 0.35);
    position: relative;
}

.fma-quiz-header { 
    font-family: var(--fma-font-heading); font-size: 1.35rem; font-weight: 800; margin: 0 0 18px;
    color: var(--c-secondary); letter-spacing: 0.5px;
}

.fma-quiz-question { 
    font-size: 1.1rem; line-height: 1.6; background: rgba(11, 17, 32, 0.85); padding: 24px; 
    border-radius: var(--radius-md); margin-bottom: 24px; border: 1px solid rgba(255,255,255,0.06);
    color: #f8fafc; text-align: left;
}

.fma-quiz-input-group { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-bottom: 15px; }
#quiz-answer { 
    padding: 14px 22px; border-radius: var(--radius-sm); border: 2px solid #334460; background: #080d1a; 
    color: #ffffff; font-size: 1.08rem; width: 290px; max-width: 100%; text-align: center; 
    outline: none; font-family: var(--fma-font-heading); font-weight: 700;
}
#quiz-answer:focus { border-color: var(--c-primary); box-shadow: 0 0 12px rgba(56, 189, 248, 0.3); }
#quiz-feedback { font-size: 1.08rem; font-weight: 800; min-height: 28px; margin: 15px 0; font-family: var(--fma-font-heading); }
#quiz-explanation { background: rgba(16, 185, 129, 0.12); color: #a7f3d0; padding: 20px; border-radius: var(--radius-sm); margin-top: 15px; display: none; font-size: 0.96rem; line-height: 1.6; border: 1px solid rgba(16, 185, 129, 0.35); text-align: left; }

/* =========================================================================
   MASTER GRADES HUB PORTAL STYLING ([fma_grades_portal])
   ========================================================================= */
.fma-portal-wrapper {
    max-width: 980px !important;
    margin: 0 auto !important;
    padding: var(--fma-header-clearance) 20px 80px 20px !important;
    color: var(--c-text-dark) !important;
    box-sizing: border-box !important;
}

.fma-portal-hero {
    text-align: center;
    margin-bottom: 45px;
}

.fma-portal-badge {
    display: inline-block;
    padding: 6px 18px;
    border-radius: 50px;
    background: rgba(56, 189, 248, 0.15);
    border: 1.5px solid rgba(56, 189, 248, 0.4);
    color: var(--c-primary);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 15px;
    font-family: var(--fma-font-heading);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

.fma-portal-hero h2 {
    font-family: var(--fma-font-heading) !important;
    font-size: 2.35rem !important;
    font-weight: 900 !important;
    color: #ffffff !important;
    margin: 0 0 12px 0 !important;
    letter-spacing: -0.5px !important;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.6) !important;
}

.fma-portal-hero p {
    font-size: 1.05rem !important;
    color: var(--c-text-mid) !important;
    max-width: 640px !important;
    margin: 0 auto !important;
    line-height: 1.6 !important;
}

.fma-portal-timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.fma-portal-node {
    display: flex;
    gap: 20px;
    position: relative;
}

.fma-portal-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 60px;
    position: relative;
}

.indicator-icon {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #131c2e;
    border: 3px solid var(--node-color, #38bdf8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    z-index: 5;
    transition: transform 0.3s;
}

.fma-portal-node.completed .indicator-icon {
    border-color: var(--c-success);
    background: #064e3b;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.45);
}

.fma-portal-node.locked .indicator-icon {
    border-color: #475569;
    background: #0b1120;
    opacity: 0.65;
    font-size: 1.2rem;
}

.indicator-line {
    position: absolute;
    top: 50px;
    bottom: -35px;
    left: 50%;
    width: 4px;
    transform: translateX(-50%);
    background: #24324d;
    z-index: 1;
    border-radius: 2px;
}
.fma-portal-node:last-child .indicator-line { display: none; }
.fma-portal-node.completed .indicator-line { background: var(--c-success); }

/* Portal Card */
.fma-portal-card {
    flex: 1;
    background: var(--c-card);
    border-radius: var(--radius-xl);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-left: 6px solid var(--node-color, #38bdf8);
    padding: 26px 28px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
    transition: transform 0.3s, box-shadow 0.3s;
}
.fma-portal-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.fma-portal-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.fma-portal-pill {
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 800;
    font-family: var(--fma-font-heading);
    letter-spacing: 0.5px;
}

.fma-portal-status-badge {
    font-size: 0.78rem;
    font-weight: 800;
    font-family: var(--fma-font-heading);
    padding: 4px 12px;
    border-radius: 20px;
}
.badge-done { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid #10b981; }
.badge-active { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid #f59e0b; }

.fma-portal-card h3 {
    font-family: var(--fma-font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 8px 0;
}

.fma-portal-card p {
    font-size: 0.95rem;
    color: var(--c-text-mid);
    line-height: 1.5;
    margin: 0 0 18px 0;
}

.fma-portal-prog-track {
    height: 8px;
    background: #0b1120;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 18px;
    border: 1px solid #24324d;
}
.fma-portal-prog-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s;
}

.btn-portal-launch {
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

/* =========================================================================
   STUDENT LOGIN SCREEN & DASHBOARD OVERHAUL
   ========================================================================= */
.fma-dashboard-wrapper { 
    max-width: 1180px !important; 
    margin: 0 auto !important; 
    padding: var(--fma-header-clearance) 20px 80px 20px !important; 
    width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
}

.fma-login-wrapper {
    display: flex; 
    justify-content: center; 
    align-items: center; 
    padding: var(--fma-header-clearance) 20px 50px 20px !important; 
    min-height: 80vh;
    width: 100%;
}

.fma-login-card {
    background: var(--c-card) !important; 
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    padding: 45px 35px !important; 
    border-radius: var(--radius-xl) !important; 
    text-align: center !important; 
    max-width: 440px !important; 
    width: 100% !important; 
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.65), 0 0 25px rgba(56, 189, 248, 0.15) !important; 
    border: var(--glass-border) !important; 
    color: var(--c-text-dark) !important;
}

.fma-login-card h2,
.fma-login-container h2 {
    font-family: var(--fma-font-heading) !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    font-size: 1.75rem !important;
    letter-spacing: 0.3px !important;
    margin: 0 0 10px 0 !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5) !important;
}

.fma-login-card p,
.fma-login-container p {
    color: var(--c-text-mid) !important;
    font-size: 0.95rem !important;
    line-height: 1.55 !important;
    margin: 0 0 26px 0 !important;
}

.fma-login-card input[type="text"] {
    width: 100% !important; 
    padding: 16px !important; 
    font-size: 1.35rem !important; 
    text-align: center !important; 
    text-transform: uppercase !important; 
    letter-spacing: 4px !important; 
    border-radius: var(--radius-md) !important; 
    border: 2px solid #24324d !important; 
    background: #080d1a !important; 
    color: var(--c-primary) !important; 
    font-weight: 800 !important; 
    outline: none !important; 
    margin-bottom: 22px !important; 
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.5) !important;
    transition: all 0.25s ease !important;
    font-family: var(--fma-font-heading) !important;
}

.fma-login-card input[type="text"]:focus { 
    border-color: var(--c-primary) !important; 
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.25), inset 0 2px 6px rgba(0,0,0,0.5) !important; 
}

.fma-open-reg-modal {
    color: var(--c-primary) !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    font-size: 0.92rem !important;
    display: inline-block !important;
    transition: all 0.2s ease !important;
}

.fma-open-reg-modal:hover {
    color: #7dd3fc !important;
    text-decoration: underline !important;
}

/* =========================================================================
   GUEST HUD BANNER (CONTRAST & FULL-RESPONSIVE FIX)
   ========================================================================= */
.fma-guest-banner {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.15) 0%, rgba(11, 17, 32, 0.95) 100%) !important;
    border: 1.5px solid rgba(56, 189, 248, 0.45) !important;
    border-radius: var(--radius-lg) !important;
    padding: 20px 26px !important;
    margin-bottom: 25px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 18px !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.fma-guest-banner-left {
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    flex: 1 1 300px !important;
}

.fma-guest-banner-icon {
    font-size: 2.2rem !important;
    line-height: 1 !important;
    filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.6)) !important;
    flex-shrink: 0 !important;
}

.fma-guest-banner-text h4 {
    font-family: var(--fma-font-heading) !important;
    font-size: 1.1rem !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    margin: 0 0 4px 0 !important;
    letter-spacing: 0.2px !important;
}

.fma-guest-banner-text p {
    font-size: 0.92rem !important;
    color: #cbd5e1 !important;
    margin: 0 !important;
    line-height: 1.45 !important;
}

.fma-guest-banner-action {
    display: flex !important;
    align-items: center !important;
}

.fma-guest-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: #ffffff !important;
    font-family: var(--fma-font-heading) !important;
    font-weight: 800 !important;
    font-size: 0.95rem !important;
    padding: 13px 24px !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    box-shadow: 0 4px 18px rgba(245, 158, 11, 0.45) !important;
    transition: all 0.25s ease !important;
    white-space: nowrap !important;
    text-decoration: none !important;
    outline: none !important;
}

.fma-guest-btn, 
.fma-guest-btn * {
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6) !important;
}

.fma-guest-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.65) !important;
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%) !important;
}

.fma-guest-btn:active {
    transform: translateY(1px) !important;
}

/* --- STUDENT PROFILE CARD HEADER --- */
.fma-dash-header {
    background: linear-gradient(145deg, #182438 0%, #0d1527 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-top: 3.5px solid var(--c-primary) !important;
    border-radius: var(--radius-xl) !important;
    padding: 28px 32px !important; 
    color: white !important; 
    margin-bottom: 24px !important; 
    display: flex !important; 
    justify-content: space-between !important; 
    align-items: center !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5) !important; 
    flex-wrap: wrap !important; 
    gap: 20px !important;
}

.fma-dash-profile { 
    display: flex !important; 
    align-items: center !important; 
    gap: 22px !important; 
}

.fma-dash-avatar {
    width: 88px !important;
    height: 88px !important;
    min-width: 88px !important;
    min-height: 88px !important;
    border-radius: 50% !important;
    position: relative !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 3px !important;
    background: linear-gradient(135deg, #0284c7, #38bdf8) !important;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.35) !important;
}

.fma-dash-avatar img { 
    width: 100% !important; 
    height: 100% !important; 
    border-radius: 50% !important; 
    background: #0f172a !important; 
    object-fit: cover !important; 
    display: block !important;
    border: 2px solid #0f172a !important;
}

.fma-pet-badge {
    position: absolute !important;
    bottom: -4px !important;
    right: -4px !important;
    font-size: 22px !important;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5)) !important;
}

.fma-dash-welcome h3 { 
    font-family: var(--fma-font-heading) !important; 
    font-size: 1.65rem !important; 
    font-weight: 800 !important; 
    margin: 0 0 8px 0 !important; 
    color: #ffffff !important; 
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.fma-user-title-badge { 
    display: inline-block !important; 
    background: rgba(56, 189, 248, 0.15) !important; 
    color: var(--c-primary) !important;
    border: 1px solid rgba(56, 189, 248, 0.35) !important;
    padding: 5px 14px !important; 
    border-radius: 20px !important; 
    font-size: 0.85rem !important; 
    font-weight: 800 !important; 
    font-family: var(--fma-font-heading) !important;
}

.fma-dash-rank-card { 
    background: rgba(11, 17, 32, 0.85) !important; 
    padding: 16px 28px !important; 
    border-radius: var(--radius-lg) !important; 
    text-align: center !important; 
    border: 1px solid rgba(56, 189, 248, 0.25) !important; 
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.6) !important;
}
.fma-dash-rank-card .label { 
    font-size: 0.78rem !important; 
    color: var(--c-text-light) !important; 
    display: block !important; 
    font-weight: 800 !important; 
    text-transform: uppercase !important;
    letter-spacing: 1.2px !important;
    margin-bottom: 2px !important;
}
.fma-dash-rank-card .value { 
    font-family: var(--fma-font-heading) !important; 
    font-size: 2rem !important; 
    font-weight: 900 !important; 
    color: var(--c-primary) !important; 
    text-shadow: 0 0 12px rgba(56, 189, 248, 0.4) !important; 
}

/* --- STATISTICS GRID --- */
.fma-dash-grid { 
    display: grid !important; 
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important; 
    gap: 18px !important; 
    margin-bottom: 30px !important; 
}

.fma-stat-card {
    background: var(--c-card) !important; 
    border-radius: var(--radius-lg) !important; 
    padding: 22px 24px !important; 
    display: flex !important; 
    align-items: center !important; 
    gap: 18px !important; 
    box-shadow: var(--shadow-card) !important; 
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(12px) !important;
    transition: transform 0.25s ease, border-color 0.25s ease !important;
}
.fma-stat-card:hover {
    transform: translateY(-3px) !important;
    border-color: rgba(56, 189, 248, 0.3) !important;
}
.fma-stat-card .icon { 
    font-size: 2.6rem !important; 
    line-height: 1 !important;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.4)) !important;
}
.fma-stat-card .info {
    display: flex !important;
    flex-direction: column !important;
}
.fma-stat-card .num { 
    font-family: var(--fma-font-heading) !important; 
    font-size: 2rem !important; 
    font-weight: 900 !important; 
    color: #ffffff !important; 
    line-height: 1.1 !important;
}
.fma-stat-card .txt { 
    font-size: 0.9rem !important; 
    color: var(--c-text-mid) !important; 
    display: block !important; 
    font-weight: 700 !important; 
    margin-top: 4px !important;
}

/* =========================================================================
   DASHBOARD SEGMENTED TABS (FIXED ZERO-CLIPPING & FULL GLOW)
   ========================================================================= */
.fma-dash-tabs { 
    display: flex !important; 
    gap: 12px !important; 
    margin: 10px 0 25px 0 !important; 
    padding: 10px 6px 16px 6px !important;
    border-bottom: 2px solid #24324d !important; 
    overflow-x: auto !important;
    overflow-y: visible !important;
    scrollbar-width: none !important;
    align-items: center !important;
}
.fma-dash-tabs::-webkit-scrollbar { display: none; }

.fma-tab-btn {
    background: #131c2e !important; 
    border: 1.5px solid #2d3f5e !important; 
    padding: 12px 22px !important; 
    font-weight: 800 !important; 
    color: #cbd5e1 !important;
    cursor: pointer !important; 
    font-size: 0.95rem !important; 
    font-family: var(--fma-font-heading) !important; 
    border-radius: 14px !important;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1) !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    outline: none !important;
    position: relative !important;
    margin: 0 !important;
}

.fma-tab-btn:hover { 
    color: #ffffff !important; 
    background: #1e293b !important; 
    border-color: #475569 !important;
    transform: translateY(-2px) !important;
}

.fma-tab-btn.active { 
    color: #ffffff !important; 
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.45) 0%, rgba(56, 189, 248, 0.18) 100%) !important; 
    border-color: var(--c-primary) !important;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
    transform: translateY(-1px) !important;
}

.fma-tab-content {
    animation: fmaTabFade 0.25s ease-in-out !important;
    width: 100% !important;
    box-sizing: border-box !important;
}
@keyframes fmaTabFade {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================================================
   REWARD SHOP & LEADERBOARD PANELS (MAX CONTRAST & NO-CLIP)
   ========================================================================= */
.fma-shop-header {
    background: linear-gradient(135deg, rgba(24, 34, 53, 0.95), rgba(11, 17, 32, 0.98)) !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
    color: var(--c-text-dark) !important;
    padding: 16px 24px !important;
    border-radius: var(--radius-lg) !important;
    margin-bottom: 24px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
}

.fma-shop-header strong {
    color: var(--c-warning) !important;
    font-family: var(--fma-font-heading) !important;
}

.fma-leaderboard-panel, .fma-badges-panel { 
    background: var(--c-card) !important; 
    border-radius: var(--radius-xl) !important; 
    padding: 28px 24px !important; 
    border: var(--glass-border) !important; 
    box-shadow: var(--shadow-soft) !important;
}

.fma-shop-grid { 
    display: grid !important; 
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)) !important; 
    gap: 18px !important; 
}

.fma-shop-item {
    background: #111827 !important; 
    border: 1px solid #22324e !important; 
    border-radius: var(--radius-lg) !important; 
    padding: 24px 18px 18px 18px !important; 
    text-align: center !important;
    display: flex !important; 
    flex-direction: column !important; 
    justify-content: space-between !important; 
    position: relative !important; 
    overflow: visible !important;
    transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s !important;
}
.fma-shop-item:hover {
    transform: translateY(-4px) !important;
    border-color: var(--c-primary) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(56, 189, 248, 0.2) !important;
}

.tier-badge { 
    position: absolute; top: 0; left: 0; padding: 4px 12px; font-size: 0.72rem; 
    font-weight: 800; color: #fff; border-top-left-radius: var(--radius-lg); border-bottom-right-radius: var(--radius-sm); 
    font-family: var(--fma-font-heading); letter-spacing: 0.6px;
}
.tier-common .tier-badge { background: #64748b; }
.tier-rare .tier-badge { background: #0284c7; }
.tier-epic .tier-badge { background: #8b5cf6; }
.tier-legendary .tier-badge { background: #f59e0b; color: #070a12; font-weight: 900; }
.tier-godly .tier-badge { background: #ef4444; }

.shop-item-visual img { width: 72px !important; height: 72px !important; border-radius: 50% !important; margin: 12px auto !important; display: block !important; border: 2px solid #475569 !important; background: #0b1120 !important; }
.fma-shop-item h4 { font-family: var(--fma-font-heading) !important; font-size: 1.1rem !important; font-weight: 800 !important; color: #ffffff !important; margin: 6px 0 !important; }
.fma-shop-item p { font-size: 0.86rem !important; color: var(--c-text-mid) !important; margin-bottom: 16px !important; min-height: 38px !important; line-height: 1.4 !important; }

/* Shop Action Buttons */
.fma-btn-buy, .fma-btn-equip { 
    font-family: var(--fma-font-heading) !important; 
    font-weight: 800 !important; 
    padding: 12px 0 !important; 
    border-radius: var(--radius-md) !important; 
    width: 100% !important; 
    border: none !important; 
    cursor: pointer !important; 
    font-size: 0.92rem !important; 
    transition: all 0.2s ease !important; 
    display: inline-block !important;
}
.fma-btn-buy { 
    background: linear-gradient(135deg, #f59e0b, #d97706) !important; 
    color: #ffffff !important; 
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35) !important; 
}
.fma-btn-buy:hover:not(:disabled) {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.5) !important;
}
.fma-btn-buy:disabled { opacity: 0.45 !important; cursor: not-allowed !important; box-shadow: none !important; }

.fma-btn-equip { 
    background: linear-gradient(135deg, #10b981, #059669) !important; 
    color: #ffffff !important; 
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important; 
}
.fma-btn-equip:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.5) !important;
}

/* Leaderboard Rows */
.fma-lb-table { 
    display: flex !important; 
    flex-direction: column !important; 
    gap: 10px !important; 
}
.fma-lb-row { 
    display: flex !important; 
    align-items: center !important; 
    gap: 18px !important; 
    padding: 14px 20px !important; 
    background: rgba(11, 17, 32, 0.8) !important; 
    border-radius: var(--radius-md) !important; 
    border: 1px solid rgba(255, 255, 255, 0.05) !important; 
    transition: transform 0.2s ease, background 0.2s ease !important;
}
.fma-lb-row:hover {
    transform: translateX(4px) !important;
    background: rgba(22, 32, 54, 0.95) !important;
}
.fma-lb-row.is-me { 
    border-left: 4px solid var(--c-primary) !important; 
    background: rgba(56, 189, 248, 0.12) !important; 
    border-color: rgba(56, 189, 248, 0.3) !important;
}
.lb-pos { 
    font-family: var(--fma-font-heading) !important; 
    font-size: 1.25rem !important; 
    font-weight: 900 !important; 
    width: 34px !important; 
    text-align: center !important; 
    color: var(--c-text-light) !important;
}
.fma-lb-row:nth-child(1) .lb-pos { color: #fbbf24 !important; text-shadow: 0 0 10px rgba(251, 191, 36, 0.5); }
.fma-lb-row:nth-child(2) .lb-pos { color: #94a3b8 !important; }
.fma-lb-row:nth-child(3) .lb-pos { color: #d97706 !important; }

.lb-user { 
    display: flex !important; 
    align-items: center !important; 
    gap: 14px !important; 
    flex: 1 !important; 
}
.lb-avatar { 
    width: 42px !important; 
    height: 42px !important; 
    border-radius: 50% !important; 
    background: #0f172a !important; 
    border: 2px solid #334155 !important;
}
.lb-name { 
    font-weight: 800 !important; 
    font-size: 1rem !important; 
    color: #ffffff !important; 
    font-family: var(--fma-font-heading) !important;
}
.me-badge { 
    background: var(--c-primary) !important; 
    color: #0b0f19 !important; 
    padding: 3px 8px !important; 
    border-radius: 6px !important; 
    font-size: 0.72rem !important; 
    font-weight: 900 !important; 
    margin-left: 6px !important;
}
.lb-score { 
    font-family: var(--fma-font-heading) !important; 
    font-weight: 900 !important; 
    font-size: 1.15rem !important;
    color: var(--c-warning) !important; 
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
}

/* Badge Gallery in Dashboard */
.fma-badges-grid-dash { 
    display: grid !important; 
    grid-template-columns: repeat(auto-fill, minmax(115px, 1fr)) !important; 
    gap: 16px !important; 
}
.fma-dash-badge { 
    text-align: center !important; 
    background: rgba(11, 17, 32, 0.8) !important; 
    padding: 18px 12px !important; 
    border-radius: var(--radius-md) !important; 
    border: 1px solid #24324d !important; 
    transition: transform 0.2s !important;
}
.fma-dash-badge:hover { transform: translateY(-3px) !important; border-color: var(--c-primary) !important; }
.fma-dash-badge .badge-emoji { font-size: 2.3rem !important; display: block !important; margin-bottom: 8px !important; }
.fma-dash-badge.locked .badge-emoji { filter: grayscale(100%) !important; opacity: 0.3 !important; }
.fma-dash-badge .badge-name { font-size: 0.82rem !important; font-weight: 700 !important; color: var(--c-text-mid) !important; line-height: 1.3 !important; }

/* =========================================================================
   WORLD MAP STYLING (DUAL DESKTOP & MOBILE NODE LABELS)
   ========================================================================= */
.fma-grand-map {
    position: relative; 
    width: 100vw;
    max-width: 100vw;
    left: 50%;
    transform: translateX(-50%);
    min-height: 100vh;
    overflow: hidden;
    background: #090d16;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(2, 132, 199, 0.15), transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(129, 140, 248, 0.15), transparent 50%),
        linear-gradient(to bottom, #060911 0%, #0f172a 100%);
    box-shadow: inset 0 0 100px rgba(0,0,0,0.8);
    display: block;
    padding-top: var(--fma-header-clearance);
    margin-top: 0;
}

.map-grid-pattern {
    position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}

.biome-island { position: absolute; border-radius: 50%; filter: blur(40px); transform: translate(-50%, -50%); pointer-events: none; }
.fma-map-svg { position: absolute; top:0; left:0; width:100%; height:100%; z-index: 5; pointer-events:none; }

.path-line-glow { 
    fill: none; 
    stroke: rgba(56, 189, 248, 0.35); 
    stroke-width: 5px; 
    filter: blur(3px); 
}

.path-line-fg { 
    fill: none; 
    stroke: #38bdf8; 
    stroke-width: 2.5px; 
    stroke-dasharray: 6, 8; 
    stroke-linecap: round; 
    animation: dashSlow 60s linear infinite; 
    filter: drop-shadow(0 0 6px #38bdf8);
}
@keyframes dashSlow { to { stroke-dashoffset: -400; } }

.node-wrapper { 
    position: absolute; 
    transform: translate(-50%, -50%); 
    z-index: 10; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    text-decoration: none !important; 
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    width: max-content; 
}

.node-icon-box { 
    width: 64px; 
    height: 64px; 
    background: #131c2e; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 26px; 
    box-shadow: 0 8px 20px rgba(0,0,0,0.5); 
    border: 3px solid #38bdf8; 
    position: relative; 
    transition: all 0.3s;
}

.node-label { 
    background: rgba(11, 17, 32, 0.92); 
    color: #f8fafc; 
    padding: 6px 14px; 
    border-radius: 20px; 
    font-size: 12px; 
    font-weight: 800; 
    margin-top: 10px; 
    border: 1px solid rgba(56, 189, 248, 0.3); 
    white-space: nowrap; 
    box-shadow: 0 6px 16px rgba(0,0,0,0.6); 
    font-family: var(--fma-font-heading); 
    letter-spacing: 0.5px;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fma-node-name-desktop {
    display: inline-block;
}
.fma-node-num-mobile {
    display: none;
}

.node-wrapper.locked { opacity: 0.8; }
.node-wrapper.locked .node-icon-box { border-color: #475569; background: #0b1120; }
.node-wrapper.locked .node-label { color: #94a3b8; border-color: #24324d; }

.mini-lock-indicator {
    position: absolute; bottom: -2px; right: -2px; width: 22px; height: 22px; background: #ef4444; color: #fff; 
    border-radius: 50%; font-size: 11px; display: flex; align-items: center; justify-content: center; border: 2px solid #0f172a;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.mini-done-indicator {
    position: absolute; bottom: -2px; right: -2px; width: 22px; height: 22px; background: #10b981; color: #fff; 
    border-radius: 50%; font-size: 11px; font-weight: 900; display: flex; align-items: center; justify-content: center; border: 2px solid #0f172a;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.node-wrapper.current .node-icon-box { 
    border-color: var(--c-warning); transform: scale(1.08); box-shadow: 0 0 25px rgba(245, 158, 11, 0.5); 
    animation: fmaPulse 2.5s infinite; 
}
.node-wrapper.current .node-label { background: var(--c-warning); color: #0f172a; border-color: var(--c-warning); font-weight: 900; }

.node-wrapper.completed .node-icon-box { border-color: var(--c-success); }
.node-wrapper.unlocked:hover { transform: translate(-50%, -55%) scale(1.1); z-index: 25; }

/* Map Title Header */
.fma-map-title-overlay {
    position: absolute; 
    top: 110px; 
    left: 50%; 
    transform: translateX(-50%); 
    z-index: 20;
    background: rgba(11, 17, 32, 0.92); 
    backdrop-filter: blur(16px); 
    padding: 12px 35px; 
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.15); 
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); 
    text-align: center;
}
.fma-map-title-overlay span { 
    font-size: 0.75rem; 
    letter-spacing: 2px; 
    text-transform: uppercase; 
    color: var(--c-primary); 
    font-weight: 800; 
    font-family: var(--fma-font-heading); 
    display: block; 
    margin-bottom: 2px; 
}
.fma-map-title-overlay h2 { 
    margin: 0; 
    font-size: 1.35rem; 
    font-family: var(--fma-font-heading); 
    font-weight: 800; 
    color: #ffffff; 
}

/* =========================================================================
   COMPREHENSIVE MOBILE RESPONSIVE OPTIMIZATIONS (SMARTPHONES)
   ========================================================================= */
@media (max-width: 768px) {
    .fma-portal-wrapper {
        padding: var(--fma-header-clearance-mobile) 14px 60px 14px !important;
        width: 100% !important;
    }

    .fma-dashboard-wrapper { 
        padding: var(--fma-header-clearance-mobile) 14px 70px 14px !important; 
        width: 100% !important;
    }

    .fma-login-wrapper {
        padding: var(--fma-header-clearance-mobile) 14px 40px 14px !important;
        width: 100% !important;
    }

    /* FIX 1: Map Node Labels on Smartphone (Sequential Numbers 1, 2, 3...) */
    .fma-node-name-desktop {
        display: none !important;
    }
    .fma-node-num-mobile {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        font-size: 12px !important;
        font-weight: 900 !important;
        line-height: 1 !important;
    }
    .node-label {
        min-width: 24px !important;
        height: 22px !important;
        padding: 0 6px !important;
        border-radius: 12px !important;
        margin-top: 6px !important;
        box-shadow: 0 4px 10px rgba(0,0,0,0.6) !important;
    }
    .node-icon-box { 
        width: 48px !important; 
        height: 48px !important; 
        font-size: 20px !important; 
        border-width: 2.5px !important; 
    }

    /* FIX 2: Learning Path Full Screen Responsiveness (Zero Overflow) */
    .adventure-game-wrapper {
        padding: 14px 10px 50px 10px !important;
        gap: 16px !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
    .step-details {
        padding: 18px 14px !important;
        border-radius: 16px !important;
        border-left-width: 4.5px !important;
    }
    .step-details h4 {
        font-size: 1.12rem !important;
        margin-bottom: 14px !important;
        padding-bottom: 10px !important;
    }
    .step-details ul {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    .step-details li a,
    .step-details li.locked .locked-item-content {
        padding: 12px 14px !important;
        font-size: 0.88rem !important;
        border-radius: 12px !important;
    }
    .fma-back-btn, .fma-return-btn {
        padding: 10px 18px !important;
        font-size: 0.85rem !important;
        margin-bottom: 14px !important;
    }

    /* FIX 3: Locked Barrier Card - Centered Floating Modal Feel on Mobile */
    .fma-locked-barrier-wrapper {
        padding: 32px 20px !important;
        margin: 8vh auto 40px auto !important;
        border-radius: 20px !important;
        width: calc(100% - 36px) !important;
        max-width: 390px !important; /* Prevents stretching to full width */
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 25px rgba(245, 158, 11, 0.15) !important;
    }
    .fma-locked-barrier-wrapper > div:first-child {
        font-size: 3.2rem !important;
        margin-bottom: 14px !important;
    }
    .fma-locked-barrier-wrapper h2 {
        font-size: 1.35rem !important;
        margin-bottom: 10px !important;
        line-height: 1.35 !important;
    }
    .fma-locked-barrier-wrapper p {
        font-size: 0.92rem !important;
        margin-bottom: 24px !important;
        line-height: 1.55 !important;
    }
    .fma-locked-barrier-wrapper > div:last-child {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }
    .fma-locked-barrier-wrapper .fma-3d-btn {
        width: 100% !important;
        padding: 14px 16px !important;
        font-size: 0.92rem !important;
        text-align: center !important;
    }

    /* FIX 4: Dashboard Guest Banner & Action Button Stacking */
    .fma-guest-banner {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 16px 14px !important;
        gap: 14px !important;
        width: 100% !important;
    }
    .fma-guest-banner-left {
        flex: 1 1 100% !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }
    .fma-guest-banner-icon {
        font-size: 1.8rem !important;
    }
    .fma-guest-banner-action {
        width: 100% !important;
        display: flex !important;
    }
    .fma-guest-btn {
        width: 100% !important;
        white-space: normal !important;
        text-align: center !important;
        padding: 12px 14px !important;
        font-size: 0.88rem !important;
        line-height: 1.35 !important;
    }

    /* Compact Header on Mobile */
    .fma-dash-header { 
        padding: 22px 16px !important; 
        flex-direction: column !important; 
        text-align: center !important; 
        gap: 14px !important;
        border-radius: 18px !important;
    }
    .fma-dash-profile { 
        flex-direction: column !important; 
        text-align: center !important; 
        gap: 10px !important;
    }
    .fma-dash-avatar {
        width: 74px !important;
        height: 74px !important;
        min-width: 74px !important;
        min-height: 74px !important;
    }
    .fma-dash-welcome h3 {
        font-size: 1.3rem !important;
        justify-content: center !important;
    }
    .fma-dash-rank-card { 
        width: 100% !important; 
        padding: 12px 16px !important;
    }

    /* Stat Cards */
    .fma-dash-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        margin-bottom: 18px !important;
    }
    .fma-stat-card {
        padding: 16px 18px !important;
        border-radius: 12px !important;
    }

    /* Mobile Segmented Tab Bar */
    .fma-dash-tabs {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
        padding: 6px 0 12px 0 !important;
    }
    .fma-tab-btn {
        padding: 10px 4px !important;
        font-size: 0.8rem !important;
        border-radius: 10px !important;
        text-align: center !important;
        justify-content: center !important;
    }

    /* Mobile Shop Balance HUD */
    .fma-shop-header {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        padding: 12px 14px !important;
        gap: 6px !important;
    }

    /* Mobile Reward Shop Grid */
    .fma-shop-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    .fma-shop-item {
        padding: 18px 10px 12px 10px !important;
        border-radius: 12px !important;
    }
    .shop-item-visual img {
        width: 50px !important;
        height: 50px !important;
    }
    .fma-shop-item h4 {
        font-size: 0.9rem !important;
    }
    .fma-shop-item p {
        font-size: 0.76rem !important;
        min-height: 40px !important;
        margin-bottom: 10px !important;
    }
    .fma-btn-buy, .fma-btn-equip {
        padding: 9px 4px !important;
        font-size: 0.8rem !important;
    }

    /* Mobile Badge Grid */
    .fma-badges-grid-dash {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }
    .fma-dash-badge {
        padding: 12px 6px !important;
    }
    .fma-dash-badge .badge-emoji {
        font-size: 1.6rem !important;
    }
    .fma-dash-badge .badge-name {
        font-size: 0.72rem !important;
    }

    /* Map & Portal Mobile Tweaks */
    .fma-grand-map { min-height: 850px; }
    .fma-map-title-overlay { 
        top: 110px !important;
        width: 90% !important; 
        max-width: 350px !important;
        padding: 8px 16px !important; 
        border-radius: 20px !important;
    }
    .fma-portal-hero h2 { font-size: 1.6rem !important; }
    .fma-portal-card { padding: 18px 14px; border-radius: 16px; }
    .fma-portal-card h3 { font-size: 1.15rem; }
}

@media (max-width: 380px) {
    .fma-locked-barrier-wrapper {
        width: calc(100% - 24px) !important;
        padding: 24px 16px !important;
    }
    .fma-shop-grid {
        grid-template-columns: 1fr !important;
    }
    .fma-badges-grid-dash {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* =========================================================================
   CLEANUP & UTILITY OVERRIDES
   ========================================================================= */
.elegantexam-front-wrap .fma-bottom-nav,
.elegantexam-front-wrap .fma-return-btn,
.elegantexam-results-container .fma-bottom-nav,
.daily-explanation .fma-bottom-nav,
.daily-explanation .fma-return-btn,
.quiz-explanation .fma-return-btn,
.benquiz-popup .fma-bottom-nav,
.benquiz-popup .fma-return-btn,
.elegantexam-popup .fma-bottom-nav,
.elegantexam-popup .fma-return-btn {
    display: none !important;
}

body > .adventure-game-wrapper .fma-bottom-nav,
.main-content > .fma-bottom-nav {
    display: flex !important;
    justify-content: center;
    width: 100%;
}