/* ========== Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #0f0f1a;
    color: #e0e0e8;
    line-height: 1.6;
    min-height: 100vh;
}
a { color: #7c8aff; text-decoration: none; }
a:hover { color: #a0b0ff; }
img { max-width: 100%; height: auto; display: block; }

/* ========== Header ========== */
.header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-bottom: 1px solid #2a2a4a;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}
.logo span { color: #7c8aff; }
.nav { display: flex; gap: 24px; }
.nav a {
    font-size: 0.92rem;
    color: #a0a0c0;
    font-weight: 500;
    transition: color 0.2s;
}
.nav a:hover, .nav a.active { color: #fff; }
.search-box {
    display: flex;
    align-items: center;
    background: #1e1e3a;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 6px 14px;
    gap: 8px;
}
.search-box input {
    background: none;
    border: none;
    color: #e0e0e8;
    font-size: 0.9rem;
    width: 160px;
    outline: none;
}
.search-box input::placeholder { color: #5a5a7a; }
.search-box svg { width: 16px; height: 16px; fill: #5a5a7a; flex-shrink: 0; }

/* ========== Hero ========== */
.hero {
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1040 50%, #0f0f1a 100%);
    padding: 80px 20px;
    text-align: center;
    border-bottom: 1px solid #2a2a4a;
}
.hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #7c8aff, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero p {
    font-size: 1.1rem;
    color: #8888aa;
    max-width: 600px;
    margin: 0 auto 32px;
}
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    flex-wrap: wrap;
}
.hero-stat { text-align: center; }
.hero-stat .num {
    font-size: 2rem;
    font-weight: 700;
    color: #a78bfa;
}
.hero-stat .label { font-size: 0.85rem; color: #5a5a7a; margin-top: 4px; }

/* ========== Section ========== */
.section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 20px;
}
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #2a2a4a;
}

/* ========== Category Cards ========== */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}
.cat-card {
    background: linear-gradient(135deg, #1a1a2e, #1e1e3a);
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    padding: 24px 16px;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
    cursor: pointer;
}
.cat-card:hover {
    transform: translateY(-3px);
    border-color: #7c8aff;
}
.cat-icon { font-size: 2.2rem; margin-bottom: 10px; }
.cat-name { font-size: 0.95rem; font-weight: 600; color: #d0d0e0; }
.cat-count { font-size: 0.8rem; color: #5a5a7a; margin-top: 4px; }

/* ========== Game Cards ========== */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}
.game-card {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
}
.game-card:hover {
    transform: translateY(-4px);
    border-color: #7c8aff;
}
.game-thumb {
    width: 100%;
    aspect-ratio: 16/10;
    background: linear-gradient(135deg, #1e1e3a, #2a1a4a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    position: relative;
}
.game-thumb .play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.game-card:hover .play-overlay { opacity: 1; }
.play-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #7c8aff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.game-info { padding: 16px; }
.game-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #e0e0e8;
}
.game-meta {
    font-size: 0.8rem;
    color: #5a5a7a;
    display: flex;
    gap: 12px;
}
.game-rating { color: #f0c040; }

/* ========== Blog / Content Section ========== */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}
.content-card {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    padding: 24px;
    transition: border-color 0.2s;
}
.content-card:hover { border-color: #5a5a7a; }
.content-card h3 {
    font-size: 1.05rem;
    margin-bottom: 8px;
    color: #d0d0e0;
}
.content-card p {
    font-size: 0.88rem;
    color: #7777aa;
    line-height: 1.6;
}
.content-card .read-more {
    display: inline-block;
    margin-top: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ========== Game Page ========== */
.game-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}
.game-frame-wrapper {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 32px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}
.game-frame {
    width: 100%;
    aspect-ratio: 16/10;
    border: none;
    background: #111;
}
.game-title { font-size: 1.8rem; margin-bottom: 8px; }
.game-desc { color: #8888aa; margin-bottom: 24px; line-height: 1.7; }
.how-to-play {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}
.how-to-play h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: #a78bfa;
}
.how-to-play p {
    color: #9999bb;
    margin-bottom: 8px;
    line-height: 1.6;
}
.how-to-play strong {
    color: #c0c0e0;
}

.game-tips {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}
.game-tips h3 { font-size: 1.1rem; margin-bottom: 12px; color: #a78bfa; }
.game-tips ul { padding-left: 20px; color: #9999bb; }
.game-tips li { margin-bottom: 6px; }
.related-games { margin-top: 48px; }

/* ========== Footer ========== */
.footer {
    background: #0a0a14;
    border-top: 1px solid #2a2a4a;
    padding: 40px 20px;
    text-align: center;
    color: #5a5a7a;
    font-size: 0.85rem;
}
.footer-links { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; margin-bottom: 16px; }

/* ========== Mobile ========== */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.8rem; }
    .hero p { font-size: 0.95rem; }
    .hero-stats { gap: 24px; }
    .hero-stat .num { font-size: 1.5rem; }
    .nav { display: none; }
    .search-box input { width: 120px; }
    .cat-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .game-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .content-grid { grid-template-columns: 1fr; }
}

/* ========== Breadcrumb ========== */
.breadcrumb {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px;
    font-size: 0.85rem;
    color: #5a5a7a;
}
.breadcrumb a { color: #7c8aff; }

/* ========== Pagination ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}
.pagination a, .pagination span {
    padding: 8px 14px;
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #a0a0c0;
}
.pagination a:hover { border-color: #7c8aff; }
.pagination .current { background: #7c8aff; color: #fff; border-color: #7c8aff; }

/* ========== Leaderboard ========== */
#leaderboard-section .section-title {
    text-align: center;
    font-size: 1.6rem;
    margin-bottom: 24px;
}
.leaderboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.lb-card {
    background: #12122a;
    border: 1px solid #2a2a4a;
    border-radius: 16px;
    padding: 20px 24px;
}
.lb-title {
    font-size: 1.1rem;
    margin-bottom: 14px;
    color: #e0e0ff;
    letter-spacing: 0.02em;
}
.lb-popular .lb-title {
    color: #f472b6;
}
.lb-rated .lb-title {
    color: #a78bfa;
}
.lb-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: none;
}
.lb-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #1e1e3a;
    font-size: 0.92rem;
}
.lb-list li:last-child { border-bottom: none; }
.lb-list li a {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    color: #c0c0e0;
    text-decoration: none;
    transition: color 0.2s;
}
.lb-list li a:hover { color: #fff; }
.lb-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #1e1e3a;
    font-size: 0.75rem;
    font-weight: 700;
    color: #7c8aff;
    flex-shrink: 0;
}
.lb-list li:nth-child(1) .lb-rank { background: #f472b6; color: #fff; }
.lb-list li:nth-child(2) .lb-rank { background: #a78bfa; color: #fff; }
.lb-list li:nth-child(3) .lb-rank { background: #7c8aff; color: #fff; }
.lb-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lb-stat {
    font-size: 0.8rem;
    color: #6a6a8a;
    flex-shrink: 0;
}
.lb-stars {
    color: #fbbf24;
    font-size: 0.85rem;
}
.lb-loading, .lb-empty {
    color: #5a5a7a;
    font-style: italic;
    padding: 12px 0;
}

/* Mobile: stack vertically */
@media (max-width: 768px) {
    .leaderboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .lb-card { padding: 16px; }
}
