/* ===== ROOT VARIABLES ===== */
:root {
    --primary: #667eea;
    --primary-hover: #5a67d8;
    --accent: #f093fb;
    --success: #48bb78;
    --warning: #ed8936;
    --danger: #f56565;
    --dark: #2d3748;
    --gray: #718096;
    --light: #a0aec0;
    --bg: #f7fafc;
    --card-bg: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow: 0 4px 6px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== BASE ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    color: var(--dark);
    min-height: 100vh;
    line-height: 1.6;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== HEADER ===== */
header {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}
header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
    border-radius: 50%;
}
header h1 { font-size: 32px; font-weight: 800; position: relative; z-index: 1; }
header h1 a { color: white; text-decoration: none; text-shadow: 0 2px 10px rgba(0,0,0,0.3); }
header p { color: rgba(255,255,255,0.85); margin-top: 10px; font-size: 15px; position: relative; z-index: 1; }

/* ===== STATS ===== */
.stats-section {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius);
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}
.stats-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #edf2f7;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.stats-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
    border-radius: 2px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: linear-gradient(135deg, #f8fafc 0%, #fff 100%);
    padding: 20px;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 2px solid #e2e8f0;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}
.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform: scaleX(0);
    transition: var(--transition);
    transform-origin: left;
}
.stat-card:hover::after { transform: scaleX(1); }
.stat-label { font-size: 13px; color: var(--gray); margin-bottom: 8px; font-weight: 500; }
.stat-value {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== HOT GAMES ===== */
.recent-plays { margin-top: 24px; }
.recent-plays .section-header {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #edf2f7;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.recent-plays .section-header::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, var(--warning), #ed8936);
    border-radius: 2px;
}
.hot-game-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.hot-game-card {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-radius: var(--radius-sm);
    padding: 14px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    border: 1px solid #fcd34d;
    cursor: pointer;
    text-decoration: none;
}
.hot-game-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--warning);
}
.hot-game-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--warning), #ed8936);
    color: white;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(237,137,54,0.3);
}
.hot-game-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-grow: 1;
}
.hot-game-hot {
    font-size: 12px;
    color: var(--danger);
    font-weight: 700;
    flex-shrink: 0;
}

/* ===== ALL GAMES ===== */
.game-section {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}
.game-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #edf2f7;
}
.game-section .section-header > span:first-child {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.game-section .section-header > span:first-child::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, var(--success), #48bb78);
    border-radius: 2px;
}

/* Category Filter */
.category-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.category-btn {
    padding: 6px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: var(--card-bg);
    color: var(--gray);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
}
.category-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #eef2ff;
}
.category-btn.active {
    background: linear-gradient(135deg, var(--primary), #764ba2);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(102,126,234,0.3);
}

/* Search */
.search-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 400px;
}
.search-container input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    background: #f7fafc;
    transition: var(--transition);
    outline: none;
}
.search-container input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
    background: white;
}
.search-btn, .reset-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.search-btn {
    background: linear-gradient(135deg, var(--primary), #764ba2);
    color: white;
    box-shadow: 0 2px 8px rgba(102,126,234,0.3);
}
.search-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.4);
}
.reset-btn {
    background: #f7fafc;
    color: var(--gray);
    border: 1px solid #e2e8f0;
}
.reset-btn:hover {
    background: #fee2e2;
    color: var(--danger);
    border-color: #fecaca;
}

/* Game List */
.game-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}
.game-card {
    background: var(--card-bg);
    padding: 20px 16px;
    text-align: center;
    border-radius: var(--radius);
    border: 1px solid #e2e8f0;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--success));
    transform: scaleX(0);
    transition: var(--transition);
    transform-origin: left;
}
.game-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: #c3dafe;
}
.game-card:hover::before { transform: scaleX(1); }

.game-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 14px;
    object-fit: cover;
    border: 3px solid #e2e8f0;
    transition: var(--transition);
    display: block;
}
.game-card:hover .game-avatar {
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102,126,234,0.2);
}
.game-card h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.game-card > p {
    font-size: 12px;
    color: var(--light);
    line-height: 1.5;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 36px;
}
.game-link {
    display: block;
    background: linear-gradient(135deg, var(--primary), #764ba2);
    color: white;
    text-decoration: none;
    padding: 10px 0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(102,126,234,0.3);
}
.game-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102,126,234,0.4);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
}
.pagination a, .pagination span, .pagination .pagination-btn {
    padding: 8px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--gray);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    min-width: 36px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pagination a:hover, .pagination .pagination-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: #eef2ff;
}
.pagination a.active, .pagination span.current, .pagination .pagination-btn.active {
    background: linear-gradient(135deg, var(--primary), #764ba2);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(102,126,234,0.3);
}
.pagination .pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.pagination .no-result {
    border: none;
    background: none;
    color: var(--light);
    font-size: 14px;
    padding: 20px;
}
.no-result-actions { margin-top: 10px; }
.no-result-reset {
    padding: 6px 16px;
    border: 1px solid var(--primary);
    border-radius: 8px;
    background: none;
    color: var(--primary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}
.no-result-reset:hover {
    background: var(--primary);
    color: white;
}

/* Footer */
footer {
    background: var(--card-bg);
    padding: 40px 20px;
    border-top: 1px solid #e2e8f0;
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: var(--shadow);
    margin-top: 20px;
}
.footer-container { max-width: 1200px; margin: 0 auto; }
.footer-content { text-align: center; }
.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px 28px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}
.footer-links a {
    color: var(--gray);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
}
.footer-links a:hover { color: var(--primary); }
.copyright { color: var(--light); font-size: 13px; line-height: 1.8; }
.copyright a { color: var(--primary); text-decoration: none; }
.copyright a:hover { text-decoration: underline; }

/* About Modal */
.about-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 999;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}
.about-modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 600px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
}
.about-modal-header {
    padding: 18px 24px;
    background: linear-gradient(135deg, var(--primary), #764ba2);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.about-modal-title { font-size: 18px; font-weight: 700; }
.about-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    transition: var(--transition);
}
.about-modal-close:hover { transform: scale(1.2); }
.about-modal-body {
    padding: 24px;
    line-height: 1.7;
    color: var(--gray);
}
.about-section { margin-bottom: 18px; }
.about-section h3 {
    color: var(--dark);
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 700;
}
.about-section p { margin-bottom: 8px; font-size: 14px; }
.about-game-list { padding-left: 20px; margin: 8px 0; }
.about-game-list li { margin-bottom: 5px; font-size: 14px; color: var(--gray); }
.about-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    text-align: right;
}
.about-modal-footer .btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary), #764ba2);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(102,126,234,0.3);
}
.about-modal-footer .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.4);
}
.about-us-btn:hover { text-decoration: underline; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .game-list { grid-template-columns: repeat(3, 1fr); }
    .hot-game-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .container { padding: 16px; }
    header { padding: 30px 16px; }
    header h1 { font-size: 26px; }
    .stats-grid { gap: 10px; }
    .stat-value { font-size: 22px; }
    .game-section .section-header { flex-direction: column; align-items: flex-start; }
    .search-container { max-width: 100%; }
    .game-list { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .game-card { padding: 16px 12px; }
    .game-avatar { width: 64px; height: 64px; }
    .hot-game-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .game-list { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .game-card h3 { font-size: 13px; }
    .category-filter { gap: 6px; }
    .category-btn { padding: 5px 10px; font-size: 12px; }
    .pagination a, .pagination span { padding: 6px 10px; font-size: 12px; }
}
