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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --accent: #ec4899;
    --success: #10b981;
    --border: #334155;
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

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

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

.logo svg {
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--primary);
}

/* Hero Section */
.hero {
    padding: 6rem 0 4rem;
    background: linear-gradient(135deg, var(--background) 0%, #1a1f3a 100%);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    animation: pulse 15s ease-in-out infinite;
}

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

.hero-content {
    text-align: center;
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
}

.search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

#searchInput {
    width: 100%;
    padding: 1rem 1rem 1rem 3.5rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 1rem;
    transition: all 0.3s;
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#searchInput::placeholder {
    color: var(--text-secondary);
}

/* Games Section */
.games-section {
    padding: 4rem 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
}

.header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Dropdown Menu */
.dropdown-container {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
    white-space: nowrap;
}

.dropdown-toggle:hover {
    border-color: var(--primary);
    background: var(--surface-light);
}

.dropdown-toggle.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.dropdown-toggle.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-arrow {
    transition: transform 0.3s;
    flex-shrink: 0;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    min-width: 320px;
    max-width: 400px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideDown 0.3s ease-out;
}

.dropdown-menu.active {
    display: block;
}

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

.dropdown-category {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.dropdown-category:last-child {
    border-bottom: none;
}

.dropdown-category-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
}

.dropdown-game-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text);
}

.dropdown-game-item:hover {
    background: var(--surface-light);
    transform: translateX(4px);
}

.dropdown-game-item:active {
    transform: translateX(2px);
}

.dropdown-game-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    border-radius: 10px;
    background: var(--background);
    border: 2px solid var(--border);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

.dropdown-game-item:hover .dropdown-game-icon {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dropdown-game-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.15) 50%, transparent 70%);
    animation: shimmer 3s infinite;
    pointer-events: none;
}

.dropdown-game-info {
    flex-grow: 1;
    min-width: 0;
}

.dropdown-game-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-game-description {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.filter-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1.25rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.games-grid {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.game-section {
    margin-bottom: 2rem;
}

.game-section-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
    text-transform: capitalize;
}

.games-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.game-card {
    background: var(--surface);
    border-radius: 12px;
    transition: all 0.3s;
    cursor: pointer;
    border: 2px solid var(--border);
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 1rem 1.25rem;
    gap: 1.25rem;
}

.game-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px var(--shadow);
    border-color: var(--primary);
    background: var(--surface-light);
}

.game-card.hidden {
    display: none;
}

.game-image {
    width: 60px;
    height: 60px;
    min-width: 60px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.game-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.game-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.game-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text);
}

.game-description {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.game-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.game-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.game-tag {
    padding: 0.2rem 0.6rem;
    background: var(--surface-light);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.game-rating {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.8rem;
}

.game-votes {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    margin-left: auto;
    flex-shrink: 0;
}

.vote-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.6rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.75rem;
    font-weight: 500;
}

.vote-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.vote-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.vote-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.vote-btn.vote-up.active {
    background: var(--success);
    border-color: var(--success);
}

.vote-btn.vote-down.active {
    background: #ef4444;
    border-color: #ef4444;
}

.vote-btn svg {
    flex-shrink: 0;
}

.vote-count {
    font-weight: 600;
    min-width: 1.2rem;
    text-align: center;
}

/* About Section */
.about-section {
    padding: 4rem 0;
    background: var(--surface);
    margin-top: 4rem;
}

.about-section h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.about-section > p {
    text-align: center;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 3rem;
    font-size: 1.1rem;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.feature {
    text-align: center;
    padding: 2rem;
    background: var(--background);
    border-radius: 12px;
    border: 2px solid var(--border);
    transition: all 0.3s;
}

.feature:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.feature p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Footer */
.footer {
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

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

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

.modal-content {
    background: var(--surface);
    border-radius: 20px;
    padding: 2rem;
    max-width: 1400px;
    width: 95%;
    max-height: 95vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s;
    border: 2px solid var(--border);
}

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

.close-modal {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 2rem;
    font-weight: 300;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--surface-light);
}

.close-modal:hover {
    color: var(--text);
    background: var(--surface);
}

.modal-body h2 {
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

#modalGameFrame {
    width: 100%;
    height: 700px;
    min-height: 600px;
    background: var(--background);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 2px solid var(--border);
    overflow: hidden;
}

#modalGameFrame iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.modal-votes {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
    justify-content: center;
}

.modal-votes .vote-btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
}

.modal-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    display: inline-block;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .hero {
        padding: 4rem 0 3rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .game-section-title {
        font-size: 1.5rem;
    }
    
    .game-card {
        padding: 0.875rem 1rem;
        gap: 1rem;
    }
    
    .game-image {
        width: 50px;
        height: 50px;
        min-width: 50px;
        font-size: 1.5rem;
    }
    
    .game-title {
        font-size: 1rem;
    }
    
    .game-description {
        font-size: 0.8rem;
    }
    
    .game-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .game-votes {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-controls {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    
    .dropdown-menu {
        right: auto;
        left: 0;
        min-width: 100%;
        max-width: 100%;
    }

    .nav-links {
        gap: 1rem;
    }

    .modal-content {
        padding: 1.5rem;
        width: 98%;
        max-width: 98%;
    }

    #modalGameFrame {
        height: 500px;
        min-height: 400px;
    }
}

/* Game Page Styles */
.game-header {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.game-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
    text-decoration: none;
}

.back-button:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    transform: translateX(-2px);
}

.back-button svg {
    flex-shrink: 0;
}

.game-header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-grow: 1;
    min-width: 0;
}

.game-header-icon {
    width: 56px;
    height: 56px;
    min-width: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border-radius: 12px;
    background: var(--surface);
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.game-header-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
    color: var(--text);
}

.game-header-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.game-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.game-header-actions .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.game-main {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
}

.game-container {
    width: 100%;
    max-width: 100%;
    height: calc(100vh - 200px);
    min-height: 600px;
    position: relative;
    background: var(--background);
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

#gameFrame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    object-fit: contain;
}

.game-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: var(--background);
    color: var(--text-secondary);
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.game-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 3rem;
    text-align: center;
    color: var(--text-secondary);
    min-height: 400px;
}

.game-error svg {
    color: var(--accent);
}

.game-error h2 {
    font-size: 1.5rem;
    color: var(--text);
    margin: 0;
}

.game-error p {
    font-size: 1rem;
    margin: 0;
}

/* Responsive Game Page */
@media (max-width: 768px) {
    .game-header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .game-header-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .game-header-icon {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }
    
    .game-header-title {
        font-size: 1.25rem;
    }
    
    .game-header-description {
        font-size: 0.85rem;
    }
    
    .game-header-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .game-container {
        height: calc(100vh - 250px);
        min-height: 500px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .game-main {
        padding: 0;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--surface-light);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

