:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-card: #1a1a3e;
    --bg-card-hover: #222255;
    --text-primary: #e8e8f0;
    --text-secondary: #a0a0c0;
    --text-muted: #606080;
    --accent: #7c3aed;
    --accent-light: #a78bfa;
    --accent-glow: rgba(124, 58, 237, 0.3);
    --gradient-1: linear-gradient(135deg, #7c3aed, #3b82f6);
    --gradient-2: linear-gradient(135deg, #f43f5e, #f97316);
    --gradient-3: linear-gradient(135deg, #06b6d4, #10b981);
    --gradient-4: linear-gradient(135deg, #8b5cf6, #ec4899);
    --gradient-5: linear-gradient(135deg, #f59e0b, #ef4444);
    --border: rgba(255, 255, 255, 0.06);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 8px 40px rgba(124, 58, 237, 0.25);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== Background Effects ===== */
.bg-decoration {
    position: fixed;
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
}

.bg-circle-1 {
    top: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.15), transparent 70%);
    border-radius: 50%;
}

.bg-circle-2 {
    bottom: -15%;
    left: -8%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.12), transparent 70%);
    border-radius: 50%;
}

.bg-circle-3 {
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 400px;
    background: radial-gradient(ellipse, rgba(139, 92, 246, 0.06), transparent 70%);
    border-radius: 50%;
}

/* ===== Header ===== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
}

.header-inner {
    max-width: 1320px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    flex-shrink: 0;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-text span {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: var(--transition);
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
    background: rgba(124, 58, 237, 0.15);
}

/* ===== Hero Section ===== */
.hero {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 60px 24px 40px;
    max-width: 800px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: 50px;
    padding: 6px 16px;
    font-size: 0.85rem;
    color: var(--accent-light);
    margin-bottom: 20px;
}

.hero-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
    letter-spacing: -1px;
}

.hero h1 span {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 500px;
    margin: 0 auto;
}

/* ===== Search ===== */
.search-wrapper {
    position: relative;
    z-index: 1;
    max-width: 560px;
    margin: 0 auto 32px;
    padding: 0 24px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 4px 6px 4px 20px;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.search-icon {
    color: var(--text-muted);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1rem;
    padding: 12px 12px;
    font-family: inherit;
}

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

.search-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px 10px;
    font-size: 1rem;
    border-radius: 50%;
    transition: var(--transition);
    display: none;
    flex-shrink: 0;
}

.search-clear.visible { display: block; }
.search-clear:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.search-btn {
    background: var(--gradient-1);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    font-family: inherit;
}

.search-btn:hover {
    box-shadow: 0 4px 20px var(--accent-glow);
    transform: translateY(-1px);
}

/* ===== Stats Bar ===== */
.stats-bar {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 0 24px 24px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== Category Filters ===== */
.categories {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 24px 32px;
    max-width: 900px;
    margin: 0 auto;
}

.cat-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

.cat-btn:hover {
    border-color: rgba(124, 58, 237, 0.4);
    color: var(--text-primary);
}

.cat-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.cat-count {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* ===== Main Content ===== */
.main-content {
    position: relative;
    z-index: 1;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 24px 40px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 22px;
    background: var(--gradient-1);
    border-radius: 4px;
}

.result-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.sort-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.sort-select:focus {
    border-color: var(--accent);
}

/* ===== Game Grid ===== */
.game-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.game-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    text-decoration: none;
    color: inherit;
    display: block;
}

.game-card:hover {
    transform: translateY(-4px);
    border-color: rgba(124, 58, 237, 0.3);
    box-shadow: var(--shadow-hover);
}

.game-card:active {
    transform: translateY(-1px);
}

.game-thumb {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
}

.game-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.4) 0%, transparent 50%);
}

.game-thumb.grad-1 { background: linear-gradient(135deg, #1e1b4b, #312e81); }
.game-thumb.grad-2 { background: linear-gradient(135deg, #1a1a2e, #16213e); }
.game-thumb.grad-3 { background: linear-gradient(135deg, #1b2838, #1a3a4a); }
.game-thumb.grad-4 { background: linear-gradient(135deg, #2d1b3d, #4a1942); }
.game-thumb.grad-5 { background: linear-gradient(135deg, #1a2a1a, #1a3a2a); }
.game-thumb.grad-6 { background: linear-gradient(135deg, #2a1a1a, #3a1a1a); }
.game-thumb.grad-7 { background: linear-gradient(135deg, #1a1a2a, #2a1a3a); }
.game-thumb.grad-8 { background: linear-gradient(135deg, #1a2a2a, #1a2a3a); }

.game-thumb .emoji {
    position: relative;
    z-index: 1;
}

.game-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.game-badge.hot {
    background: rgba(244, 63, 94, 0.2);
    color: #fda4af;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.game-badge.new {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.game-badge.popular {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.game-info {
    padding: 14px 16px;
}

.game-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.game-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.game-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.game-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #f59e0b;
}

.game-players {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.game-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    background: rgba(124, 58, 237, 0.15);
    color: var(--accent-light);
}

/* ===== No Results ===== */
.no-results {
    text-align: center;
    padding: 60px 20px;
    grid-column: 1 / -1;
}

.no-results .icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-results h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.no-results p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Load More ===== */
.load-more-wrapper {
    text-align: center;
    margin-top: 32px;
}

.load-more-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 12px 36px;
    border-radius: 50px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.load-more-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

/* ===== Footer ===== */
.footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--border);
    padding: 32px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--accent-light);
}

/* ===== Back to Top ===== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    box-shadow: 0 4px 16px var(--accent-glow);
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255,255,255,0.05);
    border: none;
    color: var(--text-muted);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.1);
}

.modal .emoji-lg {
    font-size: 4rem;
    margin-bottom: 16px;
}

.modal h2 {
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.modal .desc {
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.modal .meta-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.modal .play-btn {
    display: inline-block;
    background: var(--gradient-1);
    color: #fff;
    text-decoration: none;
    padding: 12px 40px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
}

.modal .play-btn:hover {
    box-shadow: 0 4px 24px var(--accent-glow);
    transform: translateY(-2px);
}

/* ===== Mobile Menu ===== */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .game-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .header { padding: 0 16px; }
    .header-inner { height: 56px; }

    .nav-links { display: none; }
    .mobile-menu-btn { display: block; }

    .nav-links.mobile-open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(10, 10, 26, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border);
        padding: 12px 16px;
        gap: 4px;
    }

    .hero { padding: 40px 16px 28px; }
    .hero h1 { font-size: 1.8rem; }

    .search-wrapper { padding: 0 16px; margin-bottom: 24px; }

    .categories { padding: 0 16px 24px; gap: 6px; }
    .cat-btn { padding: 6px 14px; font-size: 0.82rem; }

    .game-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .game-thumb { font-size: 2.8rem; }
    .game-info { padding: 10px 12px; }
    .game-name { font-size: 0.85rem; }
    .game-desc { font-size: 0.75rem; -webkit-line-clamp: 1; }

    .stats-bar { gap: 24px; }
    .stat-value { font-size: 1.3rem; }

    .main-content { padding: 0 16px 32px; }
    .section-title { font-size: 1.1rem; }

    .back-to-top { bottom: 20px; right: 16px; width: 40px; height: 40px; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.5rem; }
    .hero p { font-size: 0.9rem; }

    .cat-btn { padding: 5px 10px; font-size: 0.78rem; gap: 3px; }
    .cat-count { display: none; }

    .game-grid { gap: 10px; }
    .game-thumb { font-size: 2.2rem; aspect-ratio: 4/3; }
    .game-info { padding: 8px 10px; }
    .game-name { font-size: 0.8rem; }
    .game-meta { font-size: 0.7rem; }
    .game-badge { font-size: 0.65rem; padding: 2px 8px; top: 6px; right: 6px; }
}
