/* Critical CSS - Load first for above-the-fold content */
:root {
    --primary-color: #00d4ff;
    --secondary-color: #4ecdc4;
    --accent-color: #ffd700;
    --bg-dark: #0a0a0a;
    --bg-darker: #000000;
    --text-light: #ffffff;
    --text-gray: #b0b0b0;
    --border-color: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
    color: var(--text-light);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Performance optimization: Use will-change for animated elements */
.game-card,
.game-tile,
.top-game-item,
.btn-control,
.btn-play {
    will-change: transform;
}

/* Optimize animations for performance */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes slideIn {
    from { 
        transform: translateX(-100%); 
    }
    to { 
        transform: translateX(0); 
    }
}

/* Use transform instead of margin/padding for animations */
.game-card:hover,
.game-tile:hover {
    transform: translateY(-5px);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 15px 0;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.logo h1 {
    font-size: 2rem;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.nav {
    display: flex;
    gap: 30px;
}

.nav-link {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 8px 15px;
    border: 1px solid var(--border-color);
}

.search-box input {
    background: none;
    border: none;
    color: var(--text-light);
    outline: none;
    width: 200px;
    font-size: 0.9rem;
}

.search-box input::placeholder {
    color: var(--text-gray);
}

.search-box button {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1.1rem;
    margin-left: 10px;
}

/* Breadcrumb */
.breadcrumb {
    background: rgba(255, 255, 255, 0.02);
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb a:hover {
    color: var(--secondary-color);
}

.breadcrumb span {
    color: var(--text-gray);
}

/* Main Layout */
.main-layout {
    padding: 30px 0;
}

.main-layout .container {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    gap: 30px;
    align-items: start;
}

/* Left Sidebar */
.left-sidebar {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    position: sticky;
    top: 100px;
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.category-list {
    list-style: none;
}

.category-item {
    display: block;
    color: var(--text-light);
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin-bottom: 5px;
}

.category-item:hover,
.category-item.active {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    transform: translateX(5px);
}

.top-games {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.top-game-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.top-game-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.top-game-item img {
    width: 60px;
    height: 40px;
    border-radius: 5px;
    object-fit: cover;
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.game-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.game-rating {
    font-size: 0.8rem;
    color: var(--accent-color);
}

/* Main Game Area */
.game-area {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

.game-header {
    margin-bottom: 20px;
}

.game-title h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.game-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.rating {
    color: var(--accent-color);
    font-weight: 600;
}

.btn-favorite,
.btn-fullscreen {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-light);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-favorite:hover,
.btn-fullscreen:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Game Frame */
#gameFrame {
    width: 100%;
    height: 500px;
    border: none;
    border-radius: 10px;
    background: #000;
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    gap: 20px;
}

.controls-left {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.controls-right {
    display: flex;
    gap: 10px;
}

.btn-control {
    background: linear-gradient(45deg, var(--primary-color), #0099cc);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.btn-control:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

.btn-share {
    background: linear-gradient(45deg, var(--secondary-color), #44a08d);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
}

.btn-share:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.4);
}

.share-dropdown {
    position: relative;
}

.share-dropdown-content {
    display: none;
    position: absolute;
    background: #1a1a1a;
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.6);
    border-radius: 10px;
    z-index: 1000;
    top: 100%;
    left: 0;
    margin-top: 5px;
    border: 1px solid #333;
}

.share-dropdown-content.show {
    display: block;
    animation: fadeInDown 0.3s ease;
}

.share-dropdown-content a {
    color: white;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: all 0.3s ease;
    border-radius: 8px;
    margin: 2px;
}

.share-dropdown-content a:hover {
    background: linear-gradient(45deg, var(--secondary-color), #44a08d);
    transform: translateX(5px);
}

.share-dropdown-content a:first-child {
    border-radius: 8px 8px 0 0;
}

.share-dropdown-content a:last-child {
    border-radius: 0 0 8px 8px;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Game Description */
.game-description {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.game-description h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.game-description p {
    margin-bottom: 10px;
    color: #e0e0e0;
    line-height: 1.6;
}

/* Right Sidebar */
.right-sidebar {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

.related-games {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.game-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

.game-card img {
    width: 100%;
    height: 80px;
    object-fit: cover;
}

.card-content {
    padding: 15px;
}

.card-content h4 {
    font-size: 1rem;
    margin-bottom: 5px;
    color: var(--text-light);
}

.card-content p {
    font-size: 0.8rem;
    color: var(--text-gray);
    margin-bottom: 10px;
}

.btn-play {
    background: linear-gradient(45deg, var(--secondary-color), #44a08d);
    border: none;
    color: var(--text-light);
    padding: 8px 15px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-play:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(78, 205, 196, 0.3);
}

/* Ad Banner */
.ad-banner {
    margin-top: 30px;
}

.ad-banner p {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 10px;
    text-align: center;
}

/* Bottom Games Section */
.bottom-games {
    padding: 50px 0;
    background: rgba(255, 255, 255, 0.02);
    margin-top: 50px;
}

.bottom-games h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2rem;
    color: var(--primary-color);
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.game-tile {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.game-tile:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

.game-tile img {
    width: 100%;
    height: 100px;
    object-fit: cover;
}

.game-tile h4 {
    padding: 15px 15px 5px;
    font-size: 1rem;
    color: var(--text-light);
}

.game-tile p {
    padding: 0 15px 15px;
    color: var(--accent-color);
    font-size: 0.9rem;
}

/* Footer */
.footer {
    background: rgba(26, 26, 46, 0.95);
    border-top: 1px solid var(--border-color);
    padding: 40px 0 20px;
    margin-top: 50px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.footer-section a {
    display: block;
    color: var(--text-gray);
    text-decoration: none;
    margin-bottom: 8px;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-gray);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-layout .container {
        grid-template-columns: 200px 1fr 250px;
        gap: 20px;
    }
}

@media (max-width: 992px) {
    .main-layout .container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .left-sidebar,
    .right-sidebar {
        order: 2;
    }
    
    .game-area {
        order: 1;
    }
    
    .nav {
        display: none;
    }
    
    .header .container {
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .game-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .game-controls {
        justify-content: center;
    }
    
    .btn-control {
        flex: 1;
        min-width: 120px;
    }
    
    .games-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .game-area {
        padding: 15px;
    }
    
    .game-title h1 {
        font-size: 1.5rem;
    }
    
    .btn-control {
        padding: 10px 15px;
        font-size: 0.8rem;
    }
    
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

/* Hover Effects */
.game-card:hover img,
.game-tile:hover img {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

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

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, var(--secondary-color), var(--primary-color));
}

/* Game Instructions */
.game-instructions {
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.game-instructions h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.4rem;
}

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

.instruction-section {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.instruction-section h4 {
    color: var(--accent-color);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.instruction-section ul {
    list-style: none;
    padding: 0;
}

.instruction-section li {
    padding: 5px 0;
    color: var(--text-gray);
    position: relative;
    padding-left: 20px;
}

.instruction-section li::before {
    content: '▶';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-size: 0.8rem;
} 