/* 全局变量与样式复位 */
:root {
    --bg-main: #0b0f19;
    --bg-card: #151d30;
    --bg-sidebar: #111827;
    --bg-header: rgba(17, 24, 39, 0.95);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #ec4899;
    --accent-hover: #db2777;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --border-color: #1f2937;
    --card-border: #374151;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --glow-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部导航 */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.8rem 1.5rem;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.logo-icon {
    font-size: 1.8rem;
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary));
}

.brand-title {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #a5b4fc, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: block;
}

.brand-subtitle {
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
}

/* 搜索框 */
.search-box {
    position: relative;
    flex: 1;
    max-width: 500px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-box input {
    width: 100%;
    padding: 0.65rem 2.5rem 0.65rem 2.8rem;
    background: #1f2937;
    border: 1px solid var(--card-border);
    border-radius: 20px;
    color: #fff;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    background: #111827;
}

.clear-btn {
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
}

.clear-btn:hover {
    color: #fff;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* 按钮规范 */
.btn {
    padding: 0.6rem 1.1rem;
    border-radius: 20px;
    border: none;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-gradient {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(236, 72, 153, 0.4);
}

.btn-outline {
    background: #1f2937;
    border: 1px solid var(--card-border);
    color: var(--text-primary);
}

.btn-outline:hover, .btn-outline.active {
    border-color: var(--primary);
    color: var(--primary);
    background: #111827;
}

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

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

.text-danger {
    color: #ef4444;
}

/* 主内容布局 */
.main-container {
    max-width: 1400px;
    margin: 1.5rem auto;
    padding: 0 1.5rem;
    display: flex;
    gap: 1.8rem;
    flex: 1;
    width: 100%;
}

/* 侧边栏 */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 0.8rem;
    height: fit-content;
}

.sidebar-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 0.75rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.cat-item {
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.cat-item i {
    width: 22px;
    text-align: center;
    font-size: 1rem;
    margin-right: 0.4rem;
}

.cat-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.cat-item.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
}

.sidebar-banner {
    margin-top: 1.5rem;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(99, 102, 241, 0.15));
    border: 1px dashed #22c55e;
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
}

.banner-icon {
    font-size: 1.8rem;
    color: #22c55e;
    margin-bottom: 0.4rem;
}

.sidebar-banner h4 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.sidebar-banner p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* 内容区 */
.content-area {
    flex: 1;
    min-width: 0;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.section-heading h2 {
    font-size: 1.4rem;
    font-weight: 700;
}

.sub-info {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
    display: block;
}

.sort-wrapper select {
    background: #1f2937;
    color: var(--text-primary);
    border: 1px solid var(--card-border);
    padding: 0.45rem 0.8rem;
    border-radius: 8px;
    font-size: 0.88rem;
    cursor: pointer;
}

/* 游戏网格 */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.25rem;
}

/* 游戏卡片 */
.game-card {
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.25s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
}

.game-card:hover {
    transform: translateY(-6px);
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4), 0 0 12px rgba(99, 102, 241, 0.2);
}

.card-thumb {
    height: 125px;
    background: #0d1322;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.card-emoji {
    font-size: 3.5rem;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5));
}

.game-card:hover .card-emoji {
    transform: scale(1.15) rotate(5deg);
}

.play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.game-card:hover .play-overlay {
    opacity: 1;
}

.play-btn-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 0 15px var(--primary);
}

.fav-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    border: none;
    color: #9ca3af;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 5;
}

.fav-badge.active, .fav-badge:hover {
    color: #ef4444;
    background: rgba(0,0,0,0.8);
}

.card-body {
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
}

.card-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.3;
    height: 2.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 0.6rem;
}

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

.card-cat-tag {
    background: #1f2937;
    color: #a5b4fc;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

.card-rating {
    color: #f59e0b;
    font-weight: 600;
}

/* 无结果空状态 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    font-size: 3.5rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* 页脚 */
.footer {
    margin-top: auto;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* 试玩弹窗 Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 860px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

.modal-header {
    padding: 1rem 1.25rem;
    background: #111827;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-icon {
    font-size: 2rem;
}

.modal-title-wrap h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-tags {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.icon-btn {
    background: #1f2937;
    border: 1px solid var(--card-border);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    text-decoration: none;
}

.icon-btn:hover {
    background: var(--primary);
    color: #fff;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0 0.5rem;
    line-height: 1;
}

.close-btn:hover {
    color: #fff;
}

.game-viewport {
    width: 100%;
    height: 520px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.game-viewport canvas {
    max-width: 100%;
    max-height: 100%;
}

.game-viewport iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.modal-footer {
    padding: 1rem 1.25rem;
    background: #111827;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

.modal-controls-hint {
    background: #1f2937;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    color: #a5b4fc;
}

.hidden {
    display: none !important;
}

/* 响应式适配 */
@media (max-width: 900px) {
    .main-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
    }
    .category-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
    .sidebar-banner {
        display: none;
    }
}
