/* ============================================
   🎮 KIDS GAME - MAIN STYLES
   Modern, High-Quality Game UI
   ============================================ */

/* CSS Variables - Global Theme */
:root {
    /* Core Colors */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    
    /* Background */
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-accent: #0f3460;
    
    /* Text */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --text-muted: rgba(255, 255, 255, 0.6);
    
    /* Shadows */
    --shadow-small: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 10px 40px rgba(0, 0, 0, 0.2);
    --shadow-large: 0 20px 60px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 30px rgba(255, 255, 255, 0.1);
    
    /* Fonts */
    --font-primary: 'Fredoka', sans-serif;
    --font-display: 'Bubblegum Sans', cursive;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 2rem;
    --spacing-xl: 4rem;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 50%;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    --transition-bounce: 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Selection */
::selection {
    background: rgba(255, 107, 157, 0.3);
    color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #764ba2, #667eea);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
}

/* Buttons Base */
button {
    font-family: var(--font-primary);
    cursor: pointer;
    border: none;
    outline: none;
    background: none;
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 3px;
}

/* Links */
a {
    color: inherit;
    text-decoration: none;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-lg);
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #667eea;
    border-right-color: #764ba2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-title {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.loading-bar {
    width: 200px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin: 0 auto;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
    border-radius: 4px;
    animation: loading 2s ease-in-out forwards;
}

@keyframes loading {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Particles Container */
.particles-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

/* Celebration Overlay */
.celebration-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
}

.confetti-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

/* Audio Controls */
.audio-controls {
    position: fixed;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    display: flex;
    gap: var(--spacing-sm);
    z-index: 100;
}

.audio-btn {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.audio-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.audio-btn.muted {
    opacity: 0.5;
}

.audio-btn.muted::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 30px;
    background: #ff4757;
    transform: rotate(45deg);
    border-radius: 2px;
}

.audio-icon {
    font-size: 1.5rem;
}

/* Responsive Base */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    .audio-controls {
        bottom: var(--spacing-md);
        right: var(--spacing-md);
    }
    
    .audio-btn {
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 12px;
    }
}

/* Prevent text selection on game elements */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Touch-friendly tap areas */
@media (hover: none) and (pointer: coarse) {
    button, .character-card {
        min-height: 44px;
    }
}

/* ============================================
   🎬 WORLD MASCOT ANIMATION CONTAINER
   Lottie animated mascots in world pages
   ============================================ */

.world-mascot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 120px;
    height: 120px;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.world-mascot-animation {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.world-mascot-fallback {
    font-size: 5rem;
    animation: mascotBounce 2s ease-in-out infinite;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
    z-index: 1;
}

@keyframes mascotBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.world-mascot-container::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 20px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    z-index: 0;
    animation: mascotShadow 2s ease-in-out infinite;
}

@keyframes mascotShadow {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.15; }
    50% { transform: translateX(-50%) scale(0.7); opacity: 0.1; }
}

.world-mascot-container:hover {
    transform: scale(1.1);
}

.world-mascot-container:active {
    transform: scale(0.95);
}
