/* ===== СБРОС И БАЗОВЫЕ СТИЛИ ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #0f172a;
    --darker: #020617;
    --light: #f8fafc;
    --gray: #64748b;
    --gray-light: #e2e8f0;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--darker) 0%, var(--dark) 100%);
    color: var(--light);
    line-height: 1.6;
    min-height: 100vh;
}

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

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

/* ===== ШАПКА ===== */
.main-header {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(99, 102, 241, 0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s;
}

.logo-link:hover {
    transform: scale(1.02);
}

.logo-icon {
    font-size: 2.5em;
    color: var(--primary);
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.logo-text h1 {
    font-size: 1.8em;
    font-weight: 800;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 4px;
}

.logo-text p {
    font-size: 0.9em;
    color: var(--gray);
}

/* Статистика в шапке */
.header-stats {
    display: flex;
    gap: 25px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gray);
    font-size: 0.95em;
    transition: color 0.3s;
}

.stat-item:hover {
    color: var(--light);
}

.stat-item i {
    color: var(--primary);
}

/* Панель пользователя */
.user-panel {
    position: relative;
}

.auth-buttons {
    display: flex;
    gap: 15px;
}

.btn-login, .btn-register {
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: all 0.3s;
}

.btn-login {
    background: rgba(255, 255, 255, 0.1);
    color: var(--light);
    border: 1px solid var(--gray);
}

.btn-login:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary);
}

.btn-register {
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-register:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    position: relative;
}

.user-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    transition: transform 0.3s;
}

.user-avatar:hover img {
    transform: scale(1.1);
}

.username {
    font-weight: 600;
    color: var(--light);
}

.dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 10px 0;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s;
    box-shadow: var(--shadow-lg);
}

.user-menu:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown a {
    display: block;
    padding: 10px 20px;
    color: var(--gray);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropdown a:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--light);
    padding-left: 25px;
}

.dropdown .logout {
    color: var(--danger);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 10px;
}

/* Навигация */
.main-nav {
    display: flex;
    gap: 2px;
    margin-top: 15px;
    padding-bottom: 15px;
    overflow-x: auto;
}

.main-nav a {
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    color: var(--gray);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    white-space: nowrap;
}

.main-nav a:hover, .main-nav a.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.admin-link {
    margin-left: auto;
    background: rgba(239, 68, 68, 0.1) !important;
    color: var(--danger) !important;
}

.admin-link:hover {
    background: rgba(239, 68, 68, 0.2) !important;
}

/* ===== ПОИСК ===== */
.search-section {
    padding: 30px 0;
}

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

.search-box i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    font-size: 1.2em;
}

.search-box input {
    width: 100%;
    padding: 18px 60px 18px 50px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    color: var(--light);
    font-size: 1em;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.search-box button {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: var(--radius-sm);
    transition: all 0.3s;
}

.search-box button:hover {
    transform: translateY(-50%) scale(1.1);
}

/* ===== ГЕРОЙ СЕКЦИЯ ===== */
.hero {
    text-align: center;
    padding: 60px 0;
    margin-bottom: 40px;
}

.hero-content h2 {
    font-size: 3em;
    margin-bottom: 20px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-content p {
    font-size: 1.2em;
    color: var(--gray);
    max-width: 600px;
    margin: 0 auto 30px;
}

.hero-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

.btn-primary, .btn-secondary {
    padding: 16px 32px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1.1em;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary {
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--light);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary);
}

.btn-large {
    min-width: 200px;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 60px;
    flex-wrap: wrap;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 30px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 180px;
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
}

.stat-card i {
    font-size: 2em;
    color: var(--primary);
    margin-bottom: 15px;
}

.stat-card h3 {
    font-size: 2em;
    margin-bottom: 5px;
}

.stat-card p {
    color: var(--gray);
    font-size: 0.9em;
}

/* ===== КАТАЛОГ ИГР ===== */
.games-section {
    margin: 60px 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.section-header h2 {
    font-size: 2em;
    display: flex;
    align-items: center;
    gap: 15px;
}

.sort-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

#sort-select, .btn-filter {
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--light);
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
}

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

#sort-select:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.btn-filter:hover {
    background: rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
}

/* Сетка игр */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.game-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.game-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.game-badges {
    position: absolute;
    top: 15px;
    left: 15px;
    display: flex;
    gap: 8px;
    z-index: 2;
}

.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.badge.new {
    background: linear-gradient(90deg, var(--success), #059669);
    color: white;
}

.badge.top {
    background: linear-gradient(90deg, #f59e0b, #d97706);
    color: white;
}

.badge.beta {
    background: linear-gradient(90deg, #f59e0b, #d97706);
    color: white;
}

.game-preview {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.game-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.game-card:hover .game-preview img {
    transform: scale(1.05);
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.game-card:hover .game-overlay {
    opacity: 1;
}

.btn-play {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    color: var(--dark);
    transition: all 0.3s;
}

.btn-play:hover {
    background: white;
    transform: scale(1.1);
}

/* Информация об игре */
.game-info {
    padding: 25px;
}

.game-title {
    font-size: 1.3em;
    margin-bottom: 10px;
    color: var(--light);
}

.game-description {
    color: var(--gray);
    font-size: 0.95em;
    margin-bottom: 20px;
    line-height: 1.5;
    height: 45px;
    overflow: hidden;
}

.game-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--gray);
    font-size: 0.9em;
}

.meta-item i {
    color: var(--primary);
}

.game-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.tag {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    transition: all 0.3s;
}

.tag:hover {
    background: rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

/* Кнопки действий */
.game-actions {
    display: flex;
    gap: 10px;
}

.btn-play-full {
    flex: 1;
    padding: 12px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-play-full:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

.btn-favorite, .btn-rate {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--gray);
    font-size: 1.2em;
    transition: all 0.3s;
}

.btn-favorite:hover, .btn-rate:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--light);
    border-color: var(--primary);
}

/* Состояние без игр */
.no-games {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius);
    border: 2px dashed rgba(255, 255, 255, 0.1);
}

.no-games i {
    margin-bottom: 20px;
    color: var(--gray);
}

.no-games h3 {
    margin-bottom: 10px;
    color: var(--light);
}

.no-games p {
    color: var(--gray);
    margin-bottom: 30px;
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-top: 40px;
}

.btn-prev, .btn-next {
    width: 50px;
    height: 50px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--light);
    font-size: 1.2em;
    transition: all 0.3s;
}

.btn-prev:hover:not(:disabled), .btn-next:hover:not(:disabled) {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.1);
}

.btn-prev:disabled, .btn-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-info {
    font-weight: 600;
    color: var(--gray);
}

/* ===== КАТЕГОРИИ ===== */
.categories-section {
    margin: 80px 0;
}

.categories-section h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2em;
}

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

.category-card {
    padding: 30px;
    border-radius: var(--radius);
    color: white;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.category-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.category-card i {
    font-size: 2.5em;
    margin-bottom: 15px;
}

.category-card h3 {
    font-size: 1.3em;
    margin-bottom: 8px;
}

.category-card p {
    opacity: 0.9;
    font-size: 0.9em;
}

/* ===== ТОП ИГРОКОВ ===== */
.leaderboard-section {
    margin: 80px 0;
}

.leaderboard-section h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2em;
}

.leaderboard {
    max-width: 600px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.rank {
    font-size: 1.5em;
    font-weight: 800;
    min-width: 40px;
}

.leaderboard-item.gold .rank {
    color: #ffd700;
}

.leaderboard-item.silver .rank {
    color: #c0c0c0;
}

.leaderboard-item.bronze .rank {
    color: #cd7f32;
}

.leaderboard-item img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid currentColor;
}

.player-info {
    flex: 1;
}

.player-info h4 {
    font-size: 1.1em;
    margin-bottom: 4px;
}

.player-info p {
    color: var(--gray);
    font-size: 0.9em;
}

.leaderboard-item .badge {
    font-size: 1.5em;
}

/* ===== ПОДВАЛ ===== */
.main-footer {
    background: rgba(15, 23, 42, 0.9);
    border-top: 2px solid rgba(99, 102, 241, 0.2);
    margin-top: 80px;
    padding: 60px 0 30px;
}

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

.footer-section h3 {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: var(--light);
}

.footer-section p {
    color: var(--gray);
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 0.95em;
}

/* Стили для ссылок в футере (кроме социальных иконок) */
.footer-section a:not(.social-links a) {
    display: block;
    color: var(--gray);
    margin-bottom: 10px;
    transition: all 0.3s;
    font-size: 0.95em;
}

.footer-section a:not(.social-links a):hover {
    color: var(--primary);
    padding-left: 5px;
}

/* Стили только для социальных иконок */
.social-links {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.social-links a {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    transition: all 0.3s;
    color: var(--light);
}

.social-links a:hover {
    background: var(--primary);
    transform: translateY(-3px);
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--gray);
    font-size: 0.9em;
}

.footer-bottom p {
    margin-bottom: 10px;
}

/* ===== АНИМАЦИИ ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-card.animate, .category-card.animate {
    animation: fadeInUp 0.6s ease forwards;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .header-stats {
        order: 3;
        justify-content: center;
    }
    
    .main-nav {
        justify-content: center;
    }
    
    .hero-content h2 {
        font-size: 2em;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-large {
        width: 100%;
        max-width: 300px;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 30px;
    }
    
    .social-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .header-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 20px;
    }
    
    .game-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .sort-controls {
        flex-direction: column;
        width: 100%;
    }
    
    #sort-select, .btn-filter {
        width: 100%;
    }
}

/* Дополнительные стили для элементов сортировки */
.select-wrapper {
    position: relative;
    display: inline-block;
}

.select-wrapper::after {
    content: "▼";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    pointer-events: none;
    font-size: 12px;
}

#sort-select option {
    background: var(--dark);
    color: var(--light);
    padding: 12px;
}

/* Стиль для активной опции сортировки */
#sort-select option:checked {
    background: rgba(99, 102, 241, 0.3);
    color: var(--primary);
}