:root { --primary: #0054a6; }

body { 
    font-family: 'Hanuman', sans-serif; 
    background: #f0f4f8; 
    
    /* ដោះស្រាយបញ្ហា Safari/Chrome Bottom Bar នៅលើទូរស័ព្ទ */
    min-height: 100dvh; 
    
    margin: 0; 
    padding: 0; 
    overflow-x: hidden; 
    
    /* លុបពណ៌រំខានពេលចុចលើទូរស័ព្ទ (Android/iOS) */
    -webkit-tap-highlight-color: transparent;
    
    /* ការពារកុំឱ្យកប់ចូលថ្ងាសឆក (Notch) និងគែមរបស់ iPhone */
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
}

.kh-moul { font-family: 'Moul', cursive; }

/* Background Animation - ធ្វើអោយមានលំនឹង (Static) ដើម្បីកុំអោយស៊ី CPU/GPU ម៉ាស៊ីន */
.bg-animate { 
    position: fixed; 
    top: 0; left: 0; width: 100%; height: 100%; z-index: -1; 
    background: radial-gradient(circle at 10% 20%, #e0e7ff 0%, transparent 40%), 
                radial-gradient(circle at 90% 80%, #dcfce7 0%, transparent 40%), 
                radial-gradient(circle at 50% 50%, #fef3c7 0%, transparent 50%); 
}

/* Accessibility: Reduce motion if preferred by user OS */
@media (prefers-reduced-motion: reduce) {
    .card-3d, .skeleton-pulse, .toast-enter, .toast-exit { transition: none !important; animation: none !important; }
    .card-3d:hover, .card-3d:focus-visible { transform: none !important; }
    .card-entrance { animation: none !important; opacity: 1 !important; transform: none !important; }
    .hover-float-icon, .group:hover .hover-float-icon { transition: none !important; transform: none !important; }
}

/* 3D Card Hover & Focus - លុប Effect បង្វិល 3D ចេញ ទុកតែការងើបឡើងលើបន្តិច (Optimized) */
.card-3d { 
    background: rgba(255, 255, 255, 0.95); 
    border: 1px solid rgba(255, 255, 255, 0.6); 
    border-radius: 1.5rem; 
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease; 
    cursor: pointer; 
    display: flex;
    text-decoration: none;
    will-change: transform;
}
.card-3d:hover { 
    transform: translateY(-5px); 
    background: rgba(255, 255, 255, 1); 
    box-shadow: 0 10px 20px rgba(0, 84, 166, 0.1),
                0 4px 10px rgba(0, 0, 0, 0.05); 
}
.card-3d:focus-visible {
    transform: translateY(-5px); 
    background: rgba(255, 255, 255, 1);
    outline: 3px solid var(--primary);
    outline-offset: 3px;
    box-shadow: 0 10px 20px rgba(0, 84, 166, 0.12); 
}

/* App Card Entrance Animation */
.card-entrance {
    opacity: 0;
    transform: translateY(20px);
    animation: slideUpScale 0.4s ease-out forwards;
}
@keyframes slideUpScale {
    to { opacity: 1; transform: translateY(0); }
}

/* Hover Float Icon Animation */
.hover-float-icon {
    transition: transform 0.3s ease;
}
.group:hover .hover-float-icon {
    transform: translateY(-5px) scale(1.1);
}

.app-icon-container { width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; border-radius: 1.25rem; }

/* Glowing Auth Box - លុប Filter Blur & Conic Animation ដែលស៊ី RAM ខ្លាំងបំផុតចេញ (Optimized) */
.glowing-wrapper {
    position: relative; padding: 2px; border-radius: 1.3rem; overflow: hidden; 
    /* ប្រើ Gradient សាមញ្ញរត់ទៅមក ជំនួសការប្រើ Blur effect */
    background: linear-gradient(135deg, #4facfe, #ff2d75, #0054a6, #4facfe);
    background-size: 300% 300%;
    animation: simpleGradient 6s ease infinite;
}
@keyframes simpleGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.glowing-inner { position: relative; background-color: white; border-radius: 1.25rem; z-index: 10; width: 100%; height: 100%; }

.auth-tab.active { border-bottom: 3px solid #0054a6; color: #0054a6; font-weight: 700; }

/* Utilities */
#page-loader { 
    position: fixed; inset: 0; background: white; z-index: 9999; 
    display: flex; flex-direction: column; justify-content: center; align-items: center; 
    transition: opacity 0.4s ease, transform 0.4s ease; 
}
#page-loader.hidden {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
}

@keyframes slideInUp { from { transform: translateY(50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeOutSlide { from { transform: translateY(0); opacity: 1; } to { transform: translateY(15px); opacity: 0; } }

.toast-enter { animation: slideInUp 0.3s ease-out forwards; }
.toast-exit { animation: fadeOutSlide 0.2s ease-in forwards; }

.skeleton-pulse { 
    animation: pulse 1.5s ease-in-out infinite; 
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* --- New Animations for Running Text & Icons --- */
.marquee-container {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    display: flex;
    align-items: center;
    border-radius: 0.75rem;
}
.marquee-content {
    display: inline-flex;
    animation: marquee 25s linear infinite;
    padding-left: 100%;
    will-change: transform;
}
.marquee-content:hover {
    animation-play-state: paused;
}
@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

.animate-float {
    animation: floatIcon 4s ease-in-out infinite;
}
.animate-float-delayed {
    animation: floatIcon 4s ease-in-out infinite;
    animation-delay: 2s;
}
@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.animate-wiggle {
    animation: wiggle 3s ease-in-out infinite;
}
@keyframes wiggle {
    0%, 10%, 20%, 100% { transform: rotate(0deg); }
    5% { transform: rotate(-10deg); }
    15% { transform: rotate(10deg); }
}

/* ជួសជុលបញ្ហាកាត់ក្បាល និងជើងអក្សរខ្មែរពេលប្រើ background-clip (Gradient Text Fix) */
.animate-gradient-text {
    padding-top: 0.15em;
    padding-bottom: 0.25em;
    line-height: 1.4;
}

/* --- EYE BLINK ANIMATION (Lightweight) --- */
.eye-blink {
    transform-box: fill-box;
    transform-origin: center;
    animation: blink 3s infinite;
}
@keyframes blink {
    0%, 90%, 94%, 100% { transform: scaleY(1); }
    92%, 96% { transform: scaleY(0.1); }
}

/* --- FACE POP ANIMATION (Lightweight) --- */
.face-group:not(.hidden) {
    animation: popFace 0.3s ease-out forwards;
}
@keyframes popFace {
    0% { transform: translateY(10px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* --- SHEPHERD JS CUSTOM STYLES --- */
.shepherd-has-title .shepherd-content { border-radius: 1rem; }
.dark .shepherd-element { background: #1f2937; color: #f3f4f6; border: 1px solid #374151; }
.dark .shepherd-header { background: #111827; border-bottom: 1px solid #374151; }
.dark .shepherd-text { color: #d1d5db; }
.shepherd-button { background: #0054a6; color: white; border-radius: 0.5rem; transition: background 0.3s; }
.shepherd-button:hover { background: #003d7a; }
.shepherd-button-secondary { background: #f3f4f6; color: #374151; }
.dark .shepherd-button-secondary { background: #374151; color: #f3f4f6; }

/* --- PREMIUM USER STYLES --- */
.premium-text {
    background: linear-gradient(to right, #9333ea, #4f46e5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}
.dark .premium-text {
    background: linear-gradient(to right, #c084fc, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.premium-border {
    border-color: #a855f7 !important;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}
.premium-crown {
    color: #eab308;
    filter: drop-shadow(0 0 5px rgba(234, 179, 8, 0.6));
    animation: floatIcon 3s ease-in-out infinite;
}