@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Comic+Neue:wght@400;700&display=swap');

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

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a1f2e;
    --accent: #4CAF50;
    --accent-hover: #45a049;
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --border: rgba(255,255,255,0.06);
    --glow: rgba(76,175,80,0.4);
}

body {
    font-family: 'Comic Neue', cursive;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(76,175,80,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(76,175,80,0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ===== 导航栏 ===== */
.nav-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    height: 64px;
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.nav-logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 22px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent), #8BC34A);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

.nav-user {
    color: var(--accent);
    font-weight: 700;
    padding: 8px 12px;
    font-size: 15px;
}

.nav-logout {
    color: #ef4444 !important;
}

/* ===== 登录遮罩 ===== */
.auth-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.auth-overlay.hidden {
    display: none;
}

.auth-modal {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-modal h2 {
    font-family: 'Orbitron', sans-serif;
    text-align: center;
    margin-bottom: 28px;
    font-size: 24px;
    color: var(--text-primary);
}

.auth-modal input {
    width: 100%;
    padding: 14px 18px;
    margin: 10px 0;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: 'Comic Neue', cursive;
    transition: border 0.2s, box-shadow 0.2s;
}

.auth-modal input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--glow);
}

.auth-modal button[type="button"],
.auth-modal button:not(.auth-close) {
    width: 100%;
    padding: 14px;
    margin-top: 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.auth-modal button[type="button"]:hover,
.auth-modal button:not(.auth-close):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--glow);
}

.auth-switch {
    text-align: center;
    margin-top: 18px;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-switch a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
}

.auth-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px; height: 32px;
    background: rgba(255,255,255,0.05);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.message {
    text-align: center;
    margin-top: 12px;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
}

.message.success {
    color: var(--accent);
    background: rgba(76,175,80,0.1);
}

.message.error {
    color: #ef4444;
    background: rgba(239,68,68,0.1);
}

/* ===== 主内容 ===== */
.main-content {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

/* ===== Hero ===== */
.hero {
    text-align: center;
    padding: 40px 0 20px;
}

.hero-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 42px;
    font-weight: 900;
    background: linear-gradient(135deg, #fff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 17px;
    letter-spacing: 1px;
}

/* ===== 游戏卡片网格 ===== */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 40px;
}

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

.game-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.4);
    border-color: rgba(76,175,80,0.3);
}

.card-cover {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.card-cover-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #1a1f2e, #263040);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.card-body {
    padding: 20px;
}

.card-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.card-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 18px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
}

.card-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--glow);
}

/* ===== 骨架屏加载态 ===== */
.loading-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    grid-column: 1 / -1;
}

.card-skeleton {
    height: 320px;
    background: var(--bg-card);
    border-radius: 18px;
    animation: shimmer 1.5s ease-in-out infinite;
    background: linear-gradient(90deg, var(--bg-card) 25%, rgba(255,255,255,0.03) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== 弹窗 ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 560px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: modalIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
}

.modal-close {
    width: 32px; height: 32px;
    background: rgba(255,255,255,0.05);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
}

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

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.loading-text {
    text-align: center;
    color: var(--text-secondary);
    padding: 30px;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.leaderboard-rank {
    width: 40px;
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 900;
    color: var(--text-secondary);
    text-align: center;
}

.leaderboard-rank.gold { color: #fbbf24; }
.leaderboard-rank.silver { color: #9ca3af; }
.leaderboard-rank.bronze { color: #d97706; }

.leaderboard-name {
    flex: 1;
    font-weight: 700;
}

.leaderboard-score {
    font-family: 'Orbitron', sans-serif;
    color: var(--accent);
    font-weight: 700;
    margin: 0 16px;
}

.leaderboard-games {
    font-size: 13px;
    color: var(--text-secondary);
}

.profile-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.profile-stat:last-child { border-bottom: none; }

.profile-stat-label {
    color: var(--text-secondary);
    font-size: 15px;
}

.profile-stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

/* ===== 空状态 ===== */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state-text {
    font-size: 16px;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .nav-bar { padding: 0 20px; }
    .hero-title { font-size: 30px; }
    .games-grid { grid-template-columns: 1fr; }
    .auth-modal { width: 90%; padding: 28px; }
    .modal-content { width: 90%; }
}
