* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body {
    background: linear-gradient(-45deg, #0f172a, #1e1b4b, #020617, #064e3b);
    background-size: 400% 400%;
    animation: gradientBG 20s ease infinite;
    color: #f8fafc;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar Styling - Ultimate Premium Glassmorphism */
/* --- ENTRANCE ANIMATIONS --- */
@keyframes slideInLeft {
    0% { transform: translateX(-50px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes zoomIn {
    0% { transform: scale(0.95); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes staggerFade {
    0% { transform: translateX(-20px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 15px 0 30px rgba(0, 0, 0, 0.3);
    z-index: 10;
    animation: slideInLeft 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    opacity: 0;
    animation: staggerFade 0.6s ease forwards 0.2s;
}

.sidebar-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #38bdf8, #f43f5e, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0px 5px 15px rgba(0,0,0,0.3);
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.2)); }
    to { filter: drop-shadow(0 0 15px rgba(244, 63, 94, 0.5)); }
}

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

.nav-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    color: #94a3b8;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    opacity: 0;
    animation: staggerFade 0.5s ease forwards;
}

.nav-btn:nth-child(1) { animation-delay: 0.3s; }
.nav-btn:nth-child(2) { animation-delay: 0.4s; }
.nav-btn:nth-child(3) { animation-delay: 0.5s; }
.nav-btn:nth-child(4) { animation-delay: 0.6s; }
.nav-btn:nth-child(5) { animation-delay: 0.7s; }
.nav-btn:nth-child(6) { animation-delay: 0.8s; }
.nav-btn:nth-child(7) { animation-delay: 0.9s; }
.nav-btn:nth-child(8) { animation-delay: 1.0s; }
.nav-btn:nth-child(9) { animation-delay: 1.1s; }

.nav-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
    transition: left 0.6s ease;
}

.nav-btn:hover::before {
    left: 100%;
}

.nav-btn .icon {
    font-size: 1.6rem;
    margin-right: 15px;
    transition: transform 0.3s ease;
}

.nav-btn:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    border-color: rgba(255, 255, 255, 0.15);
}

.nav-btn:hover:not(.disabled) .icon {
    transform: scale(1.2) rotate(5deg);
}

.nav-btn.active {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(168, 85, 247, 0.15));
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #fff;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    padding: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.iframe-container {
    width: 100%;
    height: 100%;
    background: transparent;
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 50px rgba(0,0,0,0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    opacity: 0;
    animation: zoomIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.4s;
}

/* Edge-to-edge full-screen iframe when active */
body.game-active .main-content {
    padding: 0;
}
body.game-active .iframe-container {
    border-radius: 0;
    border: none;
    box-shadow: none;
}

#gameFrame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: transparent;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Dashboard Styling */
.dashboard-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 30px;
    overflow-y: auto;
    padding: 20px;
    animation: zoomIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 10px;
}

.dashboard-header h2 {
    font-size: 2.2rem;
    font-weight: 800;
    color: #f8fafc;
    margin-bottom: 10px;
    text-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.dashboard-header p {
    color: #94a3b8;
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    padding: 10px 5px;
    width: 100%;
}

.game-card {
    background: rgba(30, 41, 59, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 24px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.05), transparent 70%);
    pointer-events: none;
}

.game-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 25px rgba(56, 189, 248, 0.15);
    background: rgba(30, 41, 59, 0.45);
}

.card-icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 2.5rem;
    position: relative;
    transition: transform 0.3s ease;
}

.game-card:hover .card-icon-wrapper {
    transform: scale(1.1) rotate(5deg);
}

/* Individual Card Themes using glowing gradients */
.card-icon-wrapper.penalty-kick {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(59, 130, 246, 0.4));
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.card-icon-wrapper.puzzle-block {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(239, 68, 68, 0.4));
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.25);
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.card-icon-wrapper.domino-merge {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(236, 72, 153, 0.4));
    box-shadow: 0 8px 20px rgba(236, 72, 153, 0.2);
    border: 1px solid rgba(249, 115, 22, 0.3);
}
.card-icon-wrapper.bubble-shooter {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(168, 85, 247, 0.4));
    box-shadow: 0 8px 20px rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(6, 182, 212, 0.3);
}
.card-icon-wrapper.fruit-cutting {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(239, 68, 68, 0.4));
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.3);
}
.card-icon-wrapper.snake {
    background: linear-gradient(135deg, rgba(57, 255, 20, 0.2), rgba(0, 240, 255, 0.4));
    box-shadow: 0 8px 20px rgba(57, 255, 20, 0.2);
    border: 1px solid rgba(57, 255, 20, 0.3);
}
.card-icon-wrapper.space-shooter {
    background: linear-gradient(135deg, rgba(0, 242, 254, 0.2), rgba(243, 85, 255, 0.4));
    box-shadow: 0 8px 20px rgba(243, 85, 255, 0.25);
    border: 1px solid rgba(0, 242, 254, 0.3);
}
.card-icon-wrapper.apple {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.4));
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.card-icon-wrapper.tic-tac-toe {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.2), rgba(244, 63, 94, 0.4));
    box-shadow: 0 8px 20px rgba(244, 63, 94, 0.2);
    border: 1px solid rgba(244, 63, 94, 0.3);
}
.card-icon-wrapper.connect-4 {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(239, 68, 68, 0.4));
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.card-icon-wrapper.checkers {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.2));
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.card-icon-wrapper.gomoku {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(56, 189, 248, 0.4));
    box-shadow: 0 8px 20px rgba(56, 189, 248, 0.2);
    border: 1px solid rgba(56, 189, 248, 0.3);
}
.card-icon-wrapper.dots-boxes {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(168, 85, 247, 0.4));
    box-shadow: 0 8px 20px rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.3);
}
.card-icon-wrapper.reversi {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.2), rgba(15, 23, 42, 0.6));
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.3);
}
.card-icon-wrapper.battleship {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(6, 182, 212, 0.4));
    box-shadow: 0 8px 20px rgba(6, 182, 212, 0.2);
    border: 1px solid rgba(6, 182, 212, 0.3);
}
.card-icon-wrapper.chess {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(236, 72, 153, 0.4));
    box-shadow: 0 8px 20px rgba(236, 72, 153, 0.2);
    border: 1px solid rgba(236, 72, 153, 0.3);
}
.card-icon-wrapper.neon-rider {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.2), rgba(168, 85, 247, 0.4));
    box-shadow: 0 8px 20px rgba(168, 85, 247, 0.3);
    border: 1px solid rgba(244, 63, 94, 0.4);
}
.card-icon-wrapper.neon-overdrive {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(234, 179, 8, 0.4));
    box-shadow: 0 8px 20px rgba(6, 182, 212, 0.3);
    border: 1px solid rgba(234, 179, 8, 0.4);
}

.game-card h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 10px;
}

.game-card p {
    font-size: 0.9rem;
    color: #94a3b8;
    line-height: 1.5;
    margin-bottom: 20px;
    flex-grow: 1;
}

.play-btn {
    font-size: 0.95rem;
    font-weight: 600;
    color: #38bdf8;
    transition: color 0.3s ease, transform 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.game-card:hover .play-btn {
    color: #f43f5e;
    transform: translateX(5px);
}

/* Back Button inside Frame Container */
.back-home-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    padding: 8px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    z-index: 100;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.back-home-btn:hover {
    background: rgba(244, 63, 94, 0.2);
    border-color: rgba(244, 63, 94, 0.4);
    color: #fff;
    transform: translateY(-2px);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        overflow: hidden;
    }
    .sidebar {
        width: 100%;
        height: auto;
        padding: 10px 15px;
        flex-direction: row;
        align-items: center;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    }
    .sidebar-header {
        margin-bottom: 0;
        margin-right: 15px;
    }
    .sidebar-header h1 {
        font-size: 1.4rem;
    }
    .game-nav {
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        gap: 10px;
        flex-grow: 1;
        overflow: hidden;
    }
    .nav-btn {
        flex: 0 0 auto;
        width: auto;
        padding: 8px 16px;
        font-size: 0.9rem;
        border-radius: 50px; /* Pill shape on mobile */
    }
    .nav-btn .icon {
        margin-right: 6px;
        font-size: 1.1rem;
    }
    .nav-btn:hover:not(.disabled) {
        transform: translateY(-2px);
    }
    .main-content {
        padding: 10px;
        flex-grow: 1;
        height: 0;
        overflow-y: auto;
    }
    .iframe-container {
        border-radius: 12px;
        border: none;
        box-shadow: inset 0 20px 20px -20px rgba(0,0,0,0.5);
        height: 100%;
    }
    
    /* Dashboard specific mobile styles */
    .dashboard-container {
        padding: 10px 5px;
        gap: 20px;
    }
    
    .dashboard-header h2 {
        font-size: 1.5rem;
    }
    
    .dashboard-header p {
        font-size: 0.85rem;
    }
    
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        padding: 10px 0;
    }
    
    .game-card {
        padding: 12px 6px;
        border-radius: 16px;
    }
    
    .card-icon-wrapper {
        width: 55px;
        height: 55px;
        border-radius: 14px;
        font-size: 1.8rem;
        margin-bottom: 8px;
    }
    
    .game-card h3 {
        font-size: 0.82rem;
        font-weight: 600;
        margin-bottom: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
    }
    
    .game-card p {
        display: none;
    }
    
    .play-btn {
        display: none;
    }
    
    .back-home-btn {
        top: 10px;
        left: 10px;
        padding: 6px 12px;
        font-size: 0.85rem;
        border-radius: 8px;
    }
}
