/**
 * 公共样式文件
 * 包含导航、按钮、响应式布局等通用样式
 */

/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90e2;
    --secondary-color: #50c878;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --dark-bg: #1a1a2e;
    --light-bg: #16213e;
    --card-bg: #0f3460;
    --text-primary: #ffffff;
    --text-secondary: #d0d0d0;
    --border-color: #2a3f5f;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 6px 12px rgba(0, 0, 0, 0.4);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--light-bg) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* 导航栏 */
.navbar {
    background: rgba(15, 52, 96, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-nav {
    display: flex;
    gap: 1rem;
    list-style: none;
    align-items: center;
}

.navbar-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.navbar-nav a:hover {
    color: var(--text-primary);
    background: rgba(74, 144, 226, 0.2);
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    background: var(--primary-color);
    color: var(--text-primary);
    box-shadow: var(--shadow);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn:active {
    transform: translateY(0);
}

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

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

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 卡片样式 */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

/* 游戏卡片 */
.game-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

.game-card-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.game-card-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.game-card-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    flex-grow: 1;
}

.game-card-score {
    font-size: 0.875rem;
    color: var(--secondary-color);
    font-weight: 500;
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.container-fluid {
    width: 100%;
    padding: 2rem;
}

/* 网格布局 */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-1 { grid-template-columns: repeat(1, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* 响应式设计 */
@media (max-width: 767px) {
    /* 头部：第一行品牌+头像，第二行导航按钮 */
    .navbar {
        padding: 0.5rem 0.75rem;
        flex-wrap: wrap;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-nav {
        width: 100%;
        flex-wrap: nowrap;
        gap: 0.35rem;
        justify-content: center;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border-color);
    }
    
    .navbar-nav a {
        font-size: 0.75rem;
        padding: 0.35rem 0.65rem;
        white-space: nowrap;
    }
    
    .navbar-nav li {
        flex: 1;
        text-align: center;
    }
    
    .navbar-nav li a {
        display: block;
        width: 100%;
    }
    
    .container {
        padding: 0.75rem 0.5rem;
    }
    
    /* 游戏卡片 4 列紧凑布局 */
    .grid-4,
    .grid-3 {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .games-grid {
        gap: 0.4rem;
        margin-bottom: 1.5rem;
    }
    
    /* 缩小游戏卡片 */
    .game-card {
        padding: 0.5rem 0.2rem;
        border-radius: 8px;
        gap: 0.15rem;
        border: 1px solid var(--border-color);
    }
    
    .game-card:hover {
        transform: translateY(-1px);
        box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    }
    
    .game-card-icon {
        font-size: 1.5rem;
        margin-bottom: 0;
    }
    
    .game-card-title {
        font-size: 0.65rem;
        margin-bottom: 0;
        line-height: 1.2;
    }
    
    .game-card-description {
        display: none;
    }
    
    .game-card-score {
        font-size: 0.6rem;
        line-height: 1.1;
    }
    
    /* 隐藏音效控制区 */
    .controls-section {
        display: none;
    }
    
    /* 统计一行三列紧凑 */
    .stats-section {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.4rem;
        margin-bottom: 1rem;
    }
    
    .stat-card {
        padding: 0.5rem 0.25rem;
        border-radius: 8px;
    }
    
    .stat-value {
        font-size: 1.1rem;
        margin-bottom: 0.1rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    /* Hero 区域缩小 */
    .hero-section {
        padding: 1.5rem 0.5rem;
        margin-bottom: 1.5rem;
        border-radius: 8px;
    }
    
    .hero-title {
        font-size: 1.25rem;
        margin-bottom: 0.3rem;
    }
    
    .hero-subtitle {
        font-size: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* 用户信息区缩小 */
    .user-info {
        font-size: 0.8rem;
        gap: 0.3rem;
    }
    
    .user-avatar,
    .user-avatar-placeholder {
        width: 28px;
        height: 28px;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 工具类 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.hidden { display: none; }
.visible { display: block; }

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-hover);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: bold;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(231, 76, 60, 0.2);
    color: var(--danger-color);
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--text-primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

