/* 前端公共样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --text: #2d3748;
    --text-light: #718096;
    --bg: #f7fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
}

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

/* 头部 */
.site-header {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo img {
    height: 36px;
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.main-nav {
    flex: 1;
    margin: 0 30px;
    overflow: hidden;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-list::-webkit-scrollbar {
    display: none;
}

.nav-link {
    display: block;
    padding: 8px 16px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 20px;
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

.nav-link:hover {
    color: var(--primary);
    background: rgba(102, 126, 234, 0.08);
}

.nav-link.nav-highlight {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.nav-link.nav-highlight:hover {
    opacity: 0.9;
    color: white;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    font-size: 14px;
}
.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
}

.message-badge {
    display: inline-block;
    background: #ff4757;
    color: white;
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    margin-left: 4px;
    padding: 0 4px;
}.btn {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-align: center;
}

.btn-small {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: var(--transition);
}

/* 主体内容 */
.site-main {
    min-height: calc(100vh - 64px - 60px);
    padding: 30px 0;
}

/* 分类区块 */
.category-section {
    margin-bottom: 40px;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 4px;
}

.category-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-title::before {
    content: '';
    display: block;
    width: 4px;
    height: 22px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 2px;
}

.category-more {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.category-more:hover {
    color: var(--secondary);
}

/* 游戏卡片网格 */
.games-grid {
    display: grid;
    gap: 20px;
}

/* 默认电脑端 4列，通过JS动态调整 */
.games-grid {
    grid-template-columns: repeat(var(--cards-per-row, 4), 1fr);
}

/* 游戏卡片 */
.game-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
}

.game-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}

.game-card:hover .card-cover img {
    transform: scale(1.08);
}

.card-cover {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
}

.card-cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
}

.card-badge.points {
    background: rgba(255, 255, 255, 0.95);
    color: #ff4757;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.card-badge.free {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
}

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

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}

.card-heat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.card-heat-icon {
    font-size: 14px;
}

.card-points {
    font-weight: 700;
    color: #ff4757;
    font-size: 14px;
}

.card-points.free-text {
    color: #48bb78;
}

/* 页脚 */
.site-footer {
    background: white;
    border-top: 1px solid var(--border);
    padding: 30px 0;
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
}

/* 响应式 */
@media (max-width: 1024px) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

    .main-nav {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        background: white;
        margin: 0;
        padding: 15px;
        box-shadow: var(--shadow);
        transform: translateY(-150%);
        transition: transform 0.3s ease;
        z-index: 99;
    }

    .main-nav.open {
        transform: translateY(0);
    }

    .nav-list {
        flex-direction: column;
        gap: 4px;
    }

    .nav-link {
        padding: 10px 14px;
        border-radius: 8px;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .header-actions {
        gap: 6px;
    }

    .btn-small {
        padding: 5px 10px;
        font-size: 12px;
    }

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

    .site-main {
        padding: 16px 0;
    }

    .category-title {
        font-size: 18px;
    }

    .card-info {
        padding: 10px 12px;
    }

    .card-title {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .games-grid {
        grid-template-columns: repeat(var(--cards-per-row-mobile, 2), 1fr);
        gap: 10px;
    }

    .container {
        padding: 0 12px;
    }
}

/* 游戏详情页 */
.game-detail {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.detail-header {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 30px;
    padding: 30px;
}

.detail-cover {
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
}

.detail-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-info h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.detail-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-light);
}

.detail-meta-item .label {
    font-weight: 500;
    color: var(--text);
}

.detail-meta-item .heat-value {
    font-weight: 600;
}

.detail-desc {
    color: var(--text-light);
    line-height: 1.8;
    padding: 0 30px 24px;
    border-bottom: 1px solid var(--border);
}

.detail-desc p {
    margin-bottom: 12px;
}

.detail-desc img {
    max-width: 100%;
    border-radius: var(--radius);
}

.detail-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-large {
    padding: 14px 36px;
    font-size: 16px;
    border-radius: 8px;
}

.btn-download {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.btn-download:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

.btn-buy {
    background: linear-gradient(135deg, #ff4757 0%, #ee3742 100%);
    color: white;
}

.btn-buy:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
}

.btn-disabled {
    background: #e2e8f0;
    color: #a0aec0;
    cursor: not-allowed;
}

/* 留言区域 */
.comments-section {
    padding: 30px;
    border-top: 1px solid var(--border);
}

.comments-section h2 {
    font-size: 20px;
    margin-bottom: 20px;
}

.comment-form {
    margin-bottom: 30px;
}

.comment-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    font-size: 14px;
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
}

.comment-author {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.comment-time {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 6px;
}

.comment-content {
    font-size: 14px;
    color: var(--text);
    line-height: 1.6;
}

.login-tip {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.login-tip a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* 响应式详情页 */
@media (max-width: 768px) {
    .detail-header {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .detail-info h1 {
        font-size: 22px;
    }

    .comments-section {
        padding: 20px;
    }
}

/* 登录/注册页 */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 64px - 60px);
    padding: 40px 20px;
}

.auth-box {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.auth-box h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.auth-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.auth-form .btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-light);
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* 用户中心 */
.user-center {
    max-width: 900px;
    margin: 0 auto;
}

.user-profile-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
}

.user-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
}

.user-profile-info h2 {
    font-size: 22px;
    margin-bottom: 8px;
}

.user-stats {
    display: flex;
    gap: 24px;
    margin-top: 12px;
}

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

.user-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.user-stat-label {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

.rank-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    color: #744210;
    margin-top: 8px;
}

/* 投稿页 */
.submit-form {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
    max-width: 700px;
    margin: 0 auto;
}

.submit-form h2 {
    margin-bottom: 24px;
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.game-card {
    animation: fadeIn 0.4s ease forwards;
}

.category-section:nth-child(1) .game-card { animation-delay: 0s; }
.category-section:nth-child(2) .game-card { animation-delay: 0.05s; }
.category-section:nth-child(3) .game-card { animation-delay: 0.1s; }
