:root {
    --bg-dark: #050508;
    --sidebar-bg: rgba(15, 15, 20, 0.90);
    --card-bg: rgba(30, 32, 45, 0.6);
    --primary: #7d5fff;
    --primary-glow: rgba(125, 95, 255, 0.6);
    --accent: #00f2ea;
    --danger: #ff4757;
    --text: #f1f2f6;
    --text-muted: #a4b0be;
    --border-color: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text);
    font-family: 'Rajdhani', sans-serif;
    margin: 0;
    overflow: hidden;
}

/* --- ANIMATED BACKGROUND --- */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background:
        radial-gradient(circle at 15% 50%, rgba(125, 95, 255, 0.06) 0%, transparent 35%),
        radial-gradient(circle at 85% 30%, rgba(0, 242, 234, 0.06) 0%, transparent 35%);
    z-index: -1;
}

/* --- SCROLLBAR --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #2f3542;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.app-container {
    display: flex;
    height: 100vh;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    display: flex;
    flex-direction: column;
    padding: 30px 25px;
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 900;
    color: white;
    margin-bottom: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    letter-spacing: 2px;
    text-shadow: 0 0 15px var(--primary-glow);
}

.close-sidebar-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

.nav-links {
    flex-grow: 1;
    overflow-y: auto;
}

.nav-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    margin-top: 30px;
    margin-bottom: 15px;
    letter-spacing: 2px;
    opacity: 0.6;
}

.nav-btn {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    text-align: left;
    padding: 14px 18px;
    margin-bottom: 12px;
    cursor: pointer;
    border-radius: 12px;
    font-size: 1.1rem;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-btn i {
    width: 24px;
    margin-right: 12px;
    font-size: 1.1rem;
}

.nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
    padding-left: 22px;
}

.nav-btn.active {
    background: linear-gradient(90deg, rgba(125, 95, 255, 0.2), transparent);
    color: var(--primary);
    border-left: 3px solid var(--primary);
    text-shadow: 0 0 15px var(--primary-glow);
}

.counter {
    font-size: 0.8rem;
    background: #2f3542;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-top: 25px;
    border-top: 1px solid var(--border-color);
}

.avatar {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px var(--primary-glow);
    font-size: 1.4rem;
    position: relative;
    flex-shrink: 0;
}

.avatar::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: #2ecc71;
    border: 2px solid var(--bg-dark);
    border-radius: 50%;
}

.user-info {
    min-width: 0;
}

.user-info span {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.edit-profile {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.9rem;
    transition: 0.2s;
    font-weight: 600;
}

/* --- MAIN CONTENT --- */
.main-content {
    flex-grow: 1;
    padding: 40px 60px;
    overflow-y: auto;
    position: relative;
}

/* --- HEADER --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 50px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-grow: 1;
}

.search-bar {
    background: rgba(255, 255, 255, 0.03);
    padding: 0 25px;
    height: 55px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 500px;
    border: 1px solid var(--border-color);
    transition: 0.3s;
    backdrop-filter: blur(10px);
}

.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 25px rgba(125, 95, 255, 0.2);
    background: rgba(30, 32, 45, 0.8);
}

.search-bar input {
    background: none;
    border: none;
    outline: none;
    color: white;
    margin-left: 15px;
    width: 100%;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    font-weight: 500;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: white;
    width: 55px;
    height: 55px;
    border-radius: 16px;
    cursor: pointer;
    transition: 0.3s;
    margin-left: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.icon-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 5px 20px var(--primary-glow);
    transform: translateY(-3px);
}

/* --- HERO SECTION --- */
#hero-section {
    width: 100%;
    height: 400px;
    border-radius: 24px;
    position: relative;
    margin-bottom: 60px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-color);
    transition: 0.5s;
}

.hero-hidden {
    display: none;
}

.hero-bg {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 10s ease;
}

#hero-section:hover .hero-bg {
    transform: scale(1.05);
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #050508 0%, rgba(5, 5, 8, 0.9) 35%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 80px;
}

.hero-badge {
    background: var(--accent);
    color: #000;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 800;
    text-transform: uppercase;
    width: fit-content;
    margin-bottom: 20px;
    box-shadow: 0 0 20px rgba(0, 242, 234, 0.5);
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.hero-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 4rem;
    margin: 0;
    line-height: 1.1;
    margin-bottom: 20px;
    text-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
    max-width: 800px;
}

.hero-desc {
    max-width: 600px;
    color: #a4b0be;
    font-size: 1.2rem;
    margin-bottom: 40px;
    line-height: 1.6;
}

/* --- GAME STAGE --- */
.game-stage.hidden {
    display: none;
}

.game-stage {
    animation: slideDown 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    margin-bottom: 60px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.screen-wrapper {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 24px 24px 0 0;
    position: relative;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
    z-index: 10;
    overflow: hidden;
    border: 1px solid #333;
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.control-bar {
    background: #13141c;
    padding: 25px 40px;
    border-radius: 0 0 24px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
    border-top: none;
    position: relative;
    z-index: 10;
}

.btn-primary {
    padding: 14px 35px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    background: var(--primary);
    color: white;
    box-shadow: 0 0 25px rgba(125, 95, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: 0.3s;
}

.btn-primary:hover {
    background: #6c5ce7;
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(125, 95, 255, 0.6);
}

.btn-secondary {
    padding: 12px 25px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    margin-right: 15px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    transition: 0.2s;
    font-size: 1rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* --- CATALOGUE --- */
.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

#section-title {
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 2px;
    margin: 0;
    color: white;
    font-size: 2rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 40px;
    padding-bottom: 80px;
}

.game-card {
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
}

.game-card:hover {
    transform: translateY(-12px);
    border-color: var(--primary);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(125, 95, 255, 0.2);
}

/* SEO CHANGE: Container for IMG tag instead of background-image */
.card-img-container {
    height: 200px;
    position: relative;
    overflow: hidden;
}

/* SEO CHANGE: Proper IMG tag styling */
.card-img-content {
    width: 100%;
    height: 100%;
    object-fit:cover;
    transition: transform 0.5s;
}

.game-card:hover .card-img-content {
    transform: scale(1.1);
}

.card-overlay-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80%;
    background: linear-gradient(to bottom, transparent, rgba(30, 32, 45, 1));
    pointer-events: none;
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 8, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: 0.3s;
    backdrop-filter: blur(3px);
    z-index: 3;
}

.play-overlay i {
    font-size: 3.5rem;
    color: white;
    filter: drop-shadow(0 0 15px var(--primary));
    transform: scale(0.8);
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.game-card:hover .play-overlay {
    opacity: 1;
}

.game-card:hover .play-overlay i {
    transform: scale(1);
}

.card-content {
    padding: 25px;
    position: relative;
    z-index: 2;
}

.card-content h4 {
    margin: 0 0 8px 0;
    font-size: 1.4rem;
    color: white;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
}

.card-content small {
    color: var(--accent);
    font-size: 0.9rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1.2px;
}

.fav-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 5;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    font-size: 1.1rem;
}

.fav-btn:hover,
.fav-btn.active {
    background: var(--danger);
    color: white;
    box-shadow: 0 0 20px rgba(255, 71, 87, 0.6);
}

/* --- TOAST --- */
#toast-container {
    position: fixed;
    bottom: 40px;
    right: 40px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.toast {
    background: rgba(20, 20, 25, 0.95);
    backdrop-filter: blur(15px);
    border-left: 5px solid var(--primary);
    padding: 18px 30px;
    border-radius: 10px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    color: white;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    min-width: 300px;
    animation: slideInRight 0.4s ease forwards;
    display: flex;
    align-items: center;
    gap: 15px;
}

.toast.closing {
    animation: slideOutRight 0.4s ease forwards;
}

.toast i {
    color: var(--primary);
    font-size: 1.4rem;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* --- CINEMA MODE --- */
#cinema-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    transition: 0.8s;
}

body.cinema-active #cinema-overlay {
    opacity: 0.98;
    pointer-events: auto;
}

body.cinema-active .sidebar,
body.cinema-active header,
body.cinema-active .catalog,
body.cinema-active #hero-section {
    filter: blur(15px);
    opacity: 0.1;
    transition: 0.8s;
}

/* --- MOBILE --- */
@media (max-width: 1024px) {
    .main-content {
        padding: 30px;
    }

    .games-grid {
        gap: 30px;
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .hero-title {
        font-size: 3rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -300px;
        height: 100%;
        width: 280px;
    }

    .sidebar.open {
        left: 0;
    }

    .close-sidebar-btn,
    .hamburger-btn {
        display: block;
    }

    .main-content {
        padding: 20px;
    }

    #hero-section {
        height: 450px;
    }

    .hero-overlay {
        padding: 30px;
        background: linear-gradient(0deg, #050508 0%, rgba(5, 5, 8, 0.8) 100%);
        justify-content: flex-end;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-desc {
        font-size: 1rem;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .search-bar {
        max-width: 100%;
    }

    header {
        gap: 15px;
    }

    .header-actions {
        display: none;
    }
}