/* ============ CSS VARIABLES & THEMES ============ */
:root {
    --accent: #00ff88;
    --accent-hover: #00cc6a;
    --accent-glow: rgba(0, 255, 136, 0.35);
    --accent-soft: rgba(0, 255, 136, 0.12);
    --bg-glass: rgba(15, 23, 42, 0.65);
    --bg-glass-light: rgba(30, 41, 59, 0.5);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-light: rgba(255, 255, 255, 0.12);
    --glass-shine: rgba(255, 255, 255, 0.05);
    --text: #f1f5f9;
    --text-dim: rgba(241, 245, 249, 0.7);
    --text-muted: rgba(241, 245, 249, 0.4);
    --sky-top: #0a0f1a;
    --sky-mid: #141b2e;
    --sky-bottom: #1e2d4a;
    --cloud-color: rgba(0, 255, 136, 0.06);
    --moon-color: #00ff88;
    --sidebar-width: 280px;
}

[data-theme="purple"] {
    --accent: #a78bfa;
    --accent-hover: #8b5cf6;
    --accent-glow: rgba(167, 139, 250, 0.35);
    --accent-soft: rgba(167, 139, 250, 0.12);
    --sky-top: #0f0a1a;
    --sky-mid: #1a1030;
    --sky-bottom: #2d1f4a;
    --cloud-color: rgba(167, 139, 250, 0.06);
    --moon-color: #a78bfa;
}

[data-theme="blue"] {
    --accent: #60a5fa;
    --accent-hover: #3b82f6;
    --accent-glow: rgba(96, 165, 250, 0.35);
    --accent-soft: rgba(96, 165, 250, 0.12);
    --sky-top: #0c1222;
    --sky-mid: #162033;
    --sky-bottom: #1e3a5f;
    --cloud-color: rgba(96, 165, 250, 0.06);
    --moon-color: #60a5fa;
}

[data-theme="green"] {
    --accent: #34d399;
    --accent-hover: #10b981;
    --accent-glow: rgba(52, 211, 153, 0.35);
    --accent-soft: rgba(52, 211, 153, 0.12);
    --sky-top: #061210;
    --sky-mid: #0c1f18;
    --sky-bottom: #153528;
    --cloud-color: rgba(52, 211, 153, 0.06);
    --moon-color: #34d399;
}

[data-theme="sunset"] {
    --accent: #fb7185;
    --accent-hover: #f43f5e;
    --accent-glow: rgba(251, 113, 133, 0.35);
    --accent-soft: rgba(251, 113, 133, 0.12);
    --sky-top: #150a0d;
    --sky-mid: #251218;
    --sky-bottom: #3d1f28;
    --cloud-color: rgba(251, 113, 133, 0.06);
    --moon-color: #fb7185;
}

/* ============ RESET & BASE ============ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 50%, var(--sky-bottom) 100%);
    color: var(--text);
    line-height: 1.5;
}

/* ============ SPLASH SCREEN ============ */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #000000, #1a1a2e);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.splash-screen.active {
    opacity: 1;
    pointer-events: all;
    animation: fadeInOut 3s ease-in-out forwards;
}

.splash-logo {
    max-width: 600px;
    width: 80%;
    animation: logoScale 3s ease-in-out forwards;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes logoScale {
    0% { transform: scale(0.8); opacity: 0; }
    20% { transform: scale(1); opacity: 1; }
    80% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.1); opacity: 0; }
}

/* ============ NIGHT SKY BACKGROUND ============ */
.sky-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.sky-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 50%, var(--sky-bottom) 100%);
    animation: skyPulse 20s ease-in-out infinite;
}

@keyframes skyPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.92; }
}

.stars-container {
    position: absolute;
    inset: 0;
    animation: starsFloat 120s linear infinite;
}

@keyframes starsFloat {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(0.5deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

.star {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    animation: starPulse 4s ease-in-out infinite;
}

.star.twinkle {
    animation: twinkle 2s ease-in-out infinite, starGlow 4s ease-in-out infinite;
}

.star.accent {
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent-glow);
    animation: accentPulse 3s ease-in-out infinite;
}

@keyframes starPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; }
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.1); }
}

@keyframes starGlow {
    0%, 100% { box-shadow: 0 0 2px rgba(255,255,255,0.5); }
    50% { box-shadow: 0 0 8px rgba(255,255,255,0.8), 0 0 16px rgba(255,255,255,0.4); }
}

@keyframes accentPulse {
    0%, 100% { box-shadow: 0 0 6px var(--accent-glow); transform: scale(1); }
    50% { box-shadow: 0 0 12px var(--accent-glow), 0 0 24px var(--accent-soft); transform: scale(1.3); }
}

.moon {
    position: absolute;
    top: 8%;
    right: 15%;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.95) 0%, var(--moon-color) 100%);
    border-radius: 50%;
    box-shadow:
        0 0 30px var(--accent-glow),
        0 0 60px var(--accent-soft),
        0 0 100px var(--accent-soft);
    animation: moonGlow 8s ease-in-out infinite, moonFloat 20s ease-in-out infinite;
}

@keyframes moonGlow {
    0%, 100% {
        box-shadow: 0 0 30px var(--accent-glow), 0 0 60px var(--accent-soft), 0 0 100px var(--accent-soft);
        filter: brightness(1);
    }
    50% {
        box-shadow: 0 0 50px var(--accent-glow), 0 0 100px var(--accent-soft), 0 0 150px var(--accent-soft);
        filter: brightness(1.1);
    }
}

@keyframes moonFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(2deg); }
    75% { transform: translateY(8px) rotate(-2deg); }
}

.clouds-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.cloud {
    position: absolute;
    background: linear-gradient(180deg, var(--cloud-color) 0%, transparent 100%);
    border-radius: 100px;
    filter: blur(30px);
    opacity: 0.8;
}

.cloud-1 { width: 500px; height: 100px; top: 10%; animation: drift1 60s linear infinite; filter: blur(40px); }
.cloud-2 { width: 400px; height: 80px; top: 25%; animation: drift2 80s linear infinite; }
.cloud-3 { width: 600px; height: 120px; top: 40%; animation: drift1 70s linear infinite; animation-delay: -20s; }
.cloud-4 { width: 450px; height: 90px; top: 55%; animation: drift2 55s linear infinite; animation-delay: -10s; }
.cloud-5 { width: 350px; height: 70px; top: 70%; animation: drift1 90s linear infinite; animation-delay: -35s; filter: blur(25px); }
.cloud-6 { width: 550px; height: 110px; top: 80%; animation: drift2 65s linear infinite; animation-delay: -45s; }

@keyframes drift1 {
    0% { left: -600px; transform: translateY(0); }
    50% { transform: translateY(-15px); }
    100% { left: calc(100vw + 100px); transform: translateY(0); }
}

@keyframes drift2 {
    0% { left: calc(100vw + 100px); transform: translateY(0); }
    50% { transform: translateY(15px); }
    100% { left: -600px; transform: translateY(0); }
}

/* ============ MAIN APP ============ */
.main-app {
    display: flex;
    height: 100vh;
    position: relative;
    z-index: 1;
    opacity: 0;
    animation: fadeIn 0.5s ease 3s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* ============ GLASSMORPHISM ============ */
.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* ============ SIDEBAR ============ */
.sidebar {
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    border-radius: 0 20px 20px 0;
    margin: 20px 0 20px 0;
}

.sidebar-header {
    margin-bottom: 40px;
    text-align: center;
}

.sidebar-logo {
    width: 100%;
    max-width: 200px;
    height: auto;
    filter: drop-shadow(0 0 20px var(--accent-glow));
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-footer {
    margin-top: auto;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
}

.nav-btn:hover {
    background: var(--bg-glass-light);
    color: var(--text);
    border-color: var(--glass-border-light);
}

.nav-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent-glow);
    box-shadow: 0 0 20px var(--accent-soft);
}

.nav-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    position: relative;
}

.main-content::-webkit-scrollbar {
    width: 10px;
}

.main-content::-webkit-scrollbar-track {
    background: transparent;
}

.main-content::-webkit-scrollbar-thumb {
    background: var(--bg-glass-light);
    border-radius: 10px;
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: var(--glass-border-light);
}

/* ============ PAGE MANAGEMENT ============ */
.page {
    display: none;
    animation: pageSlideIn 0.4s ease;
}

.page.active {
    display: block;
}

@keyframes pageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--accent);
    text-shadow: 0 0 30px var(--accent-glow);
}

/* ============ HOME PAGE ============ */
.welcome-section {
    max-width: 1200px;
}

.welcome-card {
    padding: 60px;
    margin-bottom: 40px;
    text-align: center;
    border-radius: 24px;
}

.welcome-title {
    font-size: 56px;
    font-weight: 800;
    margin-bottom: 20px;
    text-shadow: 0 0 40px var(--accent-glow);
}

.lime-text {
    color: var(--accent);
}

.welcome-subtitle {
    font-size: 24px;
    color: var(--text-dim);
    margin-bottom: 40px;
}

.welcome-stats {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-bottom: 40px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 48px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 10px;
    text-shadow: 0 0 20px var(--accent-glow);
}

.stat-label {
    font-size: 16px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 18px 40px;
    background: var(--accent);
    color: var(--sky-top);
    font-size: 18px;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.section-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--text);
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.featured-card {
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 20px;
}

.featured-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 0 30px var(--accent-soft);
}

.featured-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.featured-card h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--text);
}

.featured-card p {
    color: var(--text-dim);
    font-size: 14px;
}

/* ============ GAMES PAGE ============ */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.game-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 20px;
}

.game-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 0 30px var(--accent-soft);
}

.game-icon {
    font-size: 48px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass-light);
    border-radius: 16px;
    flex-shrink: 0;
    border: 1px solid var(--glass-border);
}

.game-info h3 {
    font-size: 20px;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text);
}

.game-info p {
    color: var(--text-dim);
    font-size: 14px;
}

/* ============ SETTINGS PAGE ============ */
.settings-container {
    max-width: 800px;
}

.settings-section {
    padding: 30px;
    margin-bottom: 25px;
    border-radius: 20px;
}

.settings-section h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--accent);
}

.settings-section p {
    color: var(--text-dim);
    margin-bottom: 10px;
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.theme-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: var(--bg-glass-light);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-btn:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 0 20px var(--accent-soft);
}

.theme-btn.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 25px var(--accent-soft);
}

.theme-preview {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    border: 2px solid var(--glass-border-light);
}

.dark-preview {
    background: linear-gradient(135deg, #0a0f1a, #1e2d4a);
}

.purple-preview {
    background: linear-gradient(135deg, #0f0a1a, #2d1f4a);
}

.blue-preview {
    background: linear-gradient(135deg, #0c1222, #1e3a5f);
}

.green-preview {
    background: linear-gradient(135deg, #061210, #153528);
}

.sunset-preview {
    background: linear-gradient(135deg, #150a0d, #3d1f28);
}

/* ============ GAME PREVIEW BAR ============ */
.game-preview {
    position: fixed;
    bottom: -200px;
    left: var(--sidebar-width);
    right: 0;
    padding: 25px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: bottom 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    margin: 20px;
    border-radius: 24px;
}

.game-preview.active {
    bottom: 0;
}

.preview-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.preview-icon {
    font-size: 56px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass-light);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

.preview-info h3 {
    font-size: 24px;
    margin-bottom: 5px;
    color: var(--text);
}

.preview-info p {
    color: var(--text-dim);
    font-size: 14px;
}

.preview-actions {
    display: flex;
    gap: 15px;
}

.preview-btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cancel-btn {
    background: var(--bg-glass-light);
    color: var(--text);
    border: 1px solid var(--glass-border);
}

.cancel-btn:hover {
    background: var(--bg-glass);
    border-color: var(--glass-border-light);
}

.launch-btn {
    background: var(--accent);
    color: var(--sky-top);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.launch-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px var(--accent-glow);
}

/* ============ GAME MODAL ============ */
.game-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    padding: 20px;
    animation: modalFadeIn 0.3s ease;
}

.game-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.game-modal-content {
    width: 95%;
    height: 95%;
    max-width: 1400px;
    max-height: 900px;
    padding: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    animation: modalSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.exit-game-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(255, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.exit-game-btn:hover {
    background: rgba(255, 0, 0, 1);
    transform: translateX(-3px);
}

.game-container-inner {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 60px;
    overflow: hidden;
    border-radius: 20px;
}

/* ============ RESPONSIVE DESIGN ============ */
@media (max-width: 768px) {
    .sidebar {
        width: 80px;
        padding: 20px 10px;
    }

    .sidebar-logo {
        display: none;
    }

    .nav-btn span {
        display: none;
    }

    .nav-btn {
        justify-content: center;
        padding: 12px;
    }

    .main-content {
        padding: 20px;
    }

    .welcome-card {
        padding: 30px;
    }

    .welcome-title {
        font-size: 36px;
    }

    .welcome-stats {
        flex-direction: column;
        gap: 20px;
    }

    .page-title {
        font-size: 32px;
    }

    .games-grid {
        grid-template-columns: 1fr;
    }

    .game-preview {
        left: 80px;
        margin: 10px;
        padding: 15px;
        flex-direction: column;
        gap: 15px;
    }

    .preview-actions {
        width: 100%;
        justify-content: stretch;
    }

    .preview-btn {
        flex: 1;
    }
}

/* ============ UTILITY CLASSES ============ */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }