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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

/* 头部样式 */
.header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: white;
    font-size: 1.8rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stats {
    display: flex;
    gap: 1rem;
}

.stat {
    color: white;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    font-size: 0.9rem;
}

/* 主内容区域 */
.main {
    padding: 2rem 0;
    flex: 1;
}

/* 介绍部分 */
.intro-section {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

.intro-section h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.intro-section p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 800px;
    margin: 0 auto 2rem;
}

/* 搜索和筛选功能 */
.search-filter-section {
    max-width: 800px;
    margin: 0 auto 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

/* 头部控制区域 */
.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-container {
    position: relative;
}

.search-input {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    width: 200px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.search-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.2rem;
    font-size: 1rem;
}

/* 网站特性展示 */
.features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: white;
    opacity: 0.9;
}

.feature-icon {
    font-size: 2rem;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

/* 筛选标签部分 */
.filter-section {
    margin-bottom: 3rem;
}

.filter-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-tab {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.filter-tab:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.filter-tab.active {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* 难度容器样式 */
.difficulty-container {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.difficulty-container label {
    color: #666;
    font-weight: 500;
}

.search-box {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 1rem 3rem 1rem 1rem;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: #666;
}

.filter-tags {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    justify-content: center;
}

.tag-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.tag-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.tag-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* 游戏网格 - 一行4个 */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* 在大屏幕上强制4列布局 */
@media (min-width: 1200px) {
    .games-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

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

@media (min-width: 480px) and (max-width: 767px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.game-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 320px;
}

.game-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 1);
}

.game-card.hidden {
    display: none;
}

.game-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.2));
}

.game-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
    color: #333;
}

.game-card p {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.4;
    font-size: 0.9rem;
    flex-grow: 1;
}

/* 游戏标签 */
.game-tags {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.tag {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

/* 游戏统计 */
.game-stats {
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(103, 126, 234, 0.1);
    border-radius: 8px;
    font-size: 0.8rem;
    color: #555;
}

/* 难度选择器 */
.difficulty-selector {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.difficulty-selector label {
    color: #666;
    font-weight: 500;
}

.difficulty-select {
    padding: 0.4rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(103, 126, 234, 0.2);
}

.play-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(103, 126, 234, 0.3);
    margin-top: auto;
}

.play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(103, 126, 234, 0.4);
    background: linear-gradient(45deg, #5a6fd8, #6a42a0);
}

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

/* 模态框样式 - 增大尺寸 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5vh auto;
    border-radius: 15px;
    width: 80vw;
    height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.modal-header {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    flex: 1;
}

.game-controls {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.control-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.control-btn:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

.control-btn.hidden {
    display: none;
}

.difficulty-indicator {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-right: 1rem;
}

.close {
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #ddd;
}

.modal-body {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#gameContainer {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 10px;
    min-height: 60vh;
    padding: 1rem; /* 在游戏容器内添加一些内边距 */
}

#gameContainer canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px; /* 匹配容器的圆角风格 */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); /* 添加细微阴影以突出 */
}

/* 底部样式 */
.footer {
    background: rgba(0, 0, 0, 0.2);
    color: white;
    padding: 2rem 0;
    text-align: center;
    margin-top: auto;
}

.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.links {
    display: flex;
    gap: 2rem;
}

.links a {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.links a:hover {
    color: #ddd;
}

/* 统计菜单样式 */
.stats-menu {
    position: relative;
}

.stats-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stats-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.stats-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    padding: 0.5rem 0;
    min-width: 150px;
    z-index: 1000;
}

.stats-dropdown a {
    display: block;
    padding: 0.8rem 1rem;
    color: #333;
    text-decoration: none;
    transition: background 0.3s ease;
}

.stats-dropdown a:hover {
    background: #f8f9fa;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .stats {
        gap: 0.8rem;
    }
    
    .stat {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .intro-section h2 {
        font-size: 2rem;
    }
    
    .intro-section p {
        font-size: 1rem;
    }
    
    .search-filter-section {
        gap: 1rem;
    }
    
    .filter-tags {
        gap: 0.5rem;
    }
    
    .tag-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .game-card {
        padding: 1.2rem;
        min-height: 280px;
    }
    
    .game-icon {
        font-size: 2.5rem;
    }
    
    .footer .container {
        flex-direction: column;
        text-align: center;
    }
    
    .modal-content {
        width: 98%;
        margin: 2% auto;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    #gameContainer {
        min-height: 400px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .game-card {
        padding: 1rem;
        min-height: 250px;
    }
    
    .game-icon {
        font-size: 2rem;
    }
    
    .play-btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .modal-header {
        padding: 0.8rem 1rem;
    }
    
    .modal-header h3 {
        font-size: 1.2rem;
    }
    
    .close {
        font-size: 1.5rem;
    }
}

/* 平板端适配 */
@media (min-width: 768px) and (max-width: 1024px) {
    .modal-content {
        width: 90%;
        max-width: 800px;
    }
    
    #gameContainer {
        min-height: 450px;
    }
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}