/* ========================================
   NOVA AI GAMES - Base Styles
   Variables, Reset & Typography
   ======================================== */

/* CSS Variables - Dark Theme */
:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: rgba(30, 30, 45, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.05);

    /* Accent Colors */
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
    --accent-glow: rgba(99, 102, 241, 0.4);

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);

    /* Status Colors */
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    /* Difficulty Colors */
    --easy: #22c55e;
    --medium: #f59e0b;
    --hard: #ef4444;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 50%;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Safe Areas */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Reset & Base Styles */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

#app {
    min-height: 100vh;
    position: relative;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    flex-direction: column;
    padding-bottom: 80px;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Screen */
#loading-screen {
    justify-content: center;
    align-items: center;
    background: radial-gradient(ellipse at center, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.loader-container {
    text-align: center;
}

.brain-icon {
    font-size: 64px;
    animation: pulse 2s ease infinite;
}

.loader-ring {
    width: 100px;
    height: 100px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    margin: 20px auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.loader-container h2 {
    font-size: 24px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.loader-container p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Responsive Adjustments */

/* Small phones */
@media (max-width: 360px) {
    :root {
        --spacing-lg: 16px;
        --spacing-xl: 24px;
    }

    .app-header {
        padding: var(--spacing-md);
    }

    .stat-item {
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .stat-value {
        font-size: 12px;
    }

    .profile-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }

    .profile-stat-value {
        font-size: 16px;
    }

    .your-rank-stats {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }

    .rank-stat-value {
        font-size: 16px;
    }

    .top-players {
        gap: var(--spacing-sm);
        padding: var(--spacing-md) 0;
    }

    .top-player .player-name {
        font-size: 12px;
        max-width: 70px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .bonus-ads-card {
        flex-direction: column;
        text-align: center;
    }

    .bonus-ads-btn {
        width: 100%;
    }
}

/* Regular phones */
@media (max-width: 480px) {
    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .leaderboard-tabs {
        gap: var(--spacing-xs);
    }

    .tab-btn {
        padding: var(--spacing-sm);
        font-size: 12px;
    }

    .your-rank-name {
        font-size: 16px;
    }

    .player-avatar-img {
        width: 40px;
        height: 40px;
    }

    .top-player.first .player-avatar-img {
        width: 56px;
        height: 56px;
    }
}

/* Tablets and larger */
@media (min-width: 768px) {
    .games-grid {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .game-card {
        flex: 1 1 calc(50% - var(--spacing-md));
    }

    .profile-stats-grid {
        gap: var(--spacing-lg);
    }

    .achievements-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .your-rank-card {
        flex-direction: row;
        justify-content: space-between;
    }
}