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

:root {
    --primary: #6c5ce7;
    --primary-dark: #5b4cdb;
    --secondary: #00cec9;
    --accent: #fd79a8;
    --bg-dark: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #222240;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --border: #2d2d44;
    --shadow: rgba(0, 0, 0, 0.3);
    --gradient-1: linear-gradient(135deg, #6c5ce7, #a855f7);
    --gradient-2: linear-gradient(135deg, #00cec9, #0984e3);
    --gradient-3: linear-gradient(135deg, #fd79a8, #e84393);
    --gradient-4: linear-gradient(135deg, #fdcb6e, #f39c12);
    --gradient-5: linear-gradient(135deg, #55efc4, #00b894);
    --gradient-6: linear-gradient(135deg, #74b9ff, #0984e3);
    --gradient-7: linear-gradient(135deg, #ff7675, #d63031);
    --gradient-8: linear-gradient(135deg, #dfe6e9, #b2bec3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.header {
    background: linear-gradient(180deg, #16162a 0%, var(--bg-dark) 100%);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.logo-icon {
    font-size: 2.5rem;
}

.logo h1 {
    font-size: 2rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.search-bar {
    display: flex;
    gap: 10px;
}

.header-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.lang-selector select {
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.3s;
    appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a0a0b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.lang-selector select:focus {
    outline: none;
    border-color: var(--primary);
}

.lang-selector select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.search-bar input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.3s;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-bar input::placeholder {
    color: var(--text-secondary);
}

.search-bar button {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    background: var(--gradient-1);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.search-bar button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

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

.cat-btn {
    padding: 8px 20px;
    border: 2px solid var(--border);
    border-radius: 25px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
}

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

.cat-btn.active {
    background: var(--gradient-1);
    border-color: transparent;
    color: white;
}

.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 24px;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.game-card {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid var(--border);
}

.game-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px var(--shadow);
}

.game-card-image {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    position: relative;
    overflow: hidden;
}

.game-card-image::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.9;
}

.game-card-image span {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.game-card-info {
    padding: 20px;
}

.game-card-info h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.game-card-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 12px;
    line-height: 1.4;
}

.game-card-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    background: rgba(108, 92, 231, 0.2);
    color: var(--primary);
    border: 1px solid rgba(108, 92, 231, 0.3);
}

.tag.puzzle { background: rgba(0, 206, 201, 0.2); color: var(--secondary); border-color: rgba(0, 206, 201, 0.3); }
.tag.action { background: rgba(253, 121, 168, 0.2); color: var(--accent); border-color: rgba(253, 121, 168, 0.3); }
.tag.classic { background: rgba(253, 203, 110, 0.2); color: #fdcb6e; border-color: rgba(253, 203, 110, 0.3); }
.tag.casual { background: rgba(85, 239, 196, 0.2); color: #55efc4; border-color: rgba(85, 239, 196, 0.3); }

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.game-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.game-modal.active {
    display: block;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1000px;
    height: 85vh;
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(180deg, #1e1e36 0%, var(--bg-card) 100%);
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.3rem;
}

.close-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(253, 121, 168, 0.3);
}

.modal-body {
    height: calc(100% - 80px);
}

.modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

@media (max-width: 768px) {
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .logo-icon {
        font-size: 2rem;
    }
    
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }
    
    .modal-content {
        width: 95%;
        height: 90vh;
    }
}

@media (max-width: 480px) {
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    .header-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .categories {
        gap: 6px;
    }
    
    .cat-btn {
        padding: 6px 14px;
        font-size: 0.85rem;
    }
    
    .lang-selector select {
        width: 100%;
    }
}
