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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

header {
    background-color: #2c3e50;
    color: white;
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.ad-container {
    text-align: center;
    padding-top: 10px;
}

.ad-label {
    color: #000;
}

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

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

.logo-link {
    text-decoration: none;
    color: white;
}

.language-switcher button {
    background-color: transparent;
    color: white;
    border: 1px solid white;
    padding: 8px 16px;
    margin-left: 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.language-switcher button.active {
    background-color: #3498db;
    border-color: #3498db;
}

.language-switcher button:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.1);
}

h1 {
    font-size: 2rem;
}

h2 {
    margin: 30px 0 20px;
    font-size: 1.8rem;
    color: #2c3e50;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.featured-games-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .featured-games-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

.game-card {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

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

.game-info {
    padding: 15px;
}

.game-title {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-description {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
    width: 100%;
    overflow: hidden; 
    -webkit-line-clamp: 2; 
    display: -webkit-box !important; 
    -webkit-box-orient: vertical; 
    text-overflow: ellipsis; 
}

.game-category {
    display: inline-block;
    background-color: #3498db;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.play-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.play-btn:hover {
    background-color: #219a52;
}

.play-btn.primary {
    font-size: 1.2rem;
    padding: 12px;
    margin-top: 20px;
}

.categories-container {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px 0 20px;
    margin-bottom: 30px;
}

.category-card {
    background-color: white;
    border-radius: 8px;
    padding: 15px 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background-color: #f8f9fa;
}

.category-name {
    font-weight: 500;
    color: #2c3e50;
}

footer {
    background-color: #2c3e50;
    color: white;
    padding: 20px 0;
    margin-top: 50px;
}

/* 分类页特定样式 */
.section-title {
    font-size: 1.4rem;
    color: #2c3e50;
    margin-bottom: 20px;
    font-weight: 600;
}

/* 分类容器样式优化 */
.categories-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 15px 0;
    margin-bottom: 30px;
    scrollbar-width: thin;
    scrollbar-color: #3498db #ecf0f1;
}

.categories-container::-webkit-scrollbar {
    height: 6px;
}

.categories-container::-webkit-scrollbar-track {
    background: #ecf0f1;
    border-radius: 3px;
}

.categories-container::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 3px;
}

.category-card {
    background-color: white;
    border-radius: 8px;
    padding: 12px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
    text-align: center;
    flex-shrink: 0;
    border: 2px solid transparent;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background-color: #f8f9fa;
}

.category-card.active {
    border-color: #3498db;
    background-color: #e3f2fd;
    font-weight: 500;
}

.category-name {
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.95rem;
}

/* 分类页游戏网格响应式优化 */
#category-games-grid.game-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

@media (max-width: 768px) {
    #category-games-grid.game-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .category-card {
        min-width: 85px;
        padding: 10px 15px;
    }
    
    .category-name {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    #category-games-grid.game-grid {
        grid-template-columns: 1fr;
    }
}

/* 详情页样式 */
.game-detail {
    margin-top: 30px;
}

.back-button-container {
    margin-bottom: 20px;
}

.back-button {
    background-color: #34495e;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.back-button:hover {
    background-color: #2c3e50;
}

.game-main-info {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    margin-bottom: 40px;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.game-detail-description {
    font-size: 1.1rem;
    line-height: 1.7;
    margin: 15px 0;
}

.game-details-section {
    margin-bottom: 40px;
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.game-details-section h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.4rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.game-instructions {
    line-height: 1.7;
    white-space: pre-line;
}

.game-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.game-tag {
    background-color: #ecf0f1;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.9rem;
    color: #2c3e50;
}

.no-related-games {
    text-align: center;
    color: #7f8c8d;
    padding: 20px;
    width: 100%;
}

.error-container {
    text-align: center;
    padding: 60px 20px;
    margin-top: 40px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.error-container h2 {
    color: #e74c3c;
    margin-bottom: 15px;
}

.error-container p {
    margin-bottom: 25px;
    color: #7f8c8d;
}

@media (max-width: 768px) {
    .game-main-info {
        grid-template-columns: 1fr;
    }
    
    .game-cover img {
        height: 300px;
    }
    
    .game-details-section {
        padding: 20px;
    }
}

footer p {
    text-align: center;
}

@media (max-width: 768px) {
    header .container {
        gap: 15px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    /* 保持Featured Games模块的现有样式 */
    .featured-section .game-card {
        display: block;
    }
    
    .featured-section .game-card .game-description,
    .featured-section .game-card .play-btn {
        display: block;
    }
    
    .featured-section .game-card img {
        height: 200px;
    }
    
    /* All Games模块手机端样式 */
    #all-games-grid.game-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    #all-games-grid.game-grid .game-card {
        text-align: center;
    }
    
    #all-games-grid.game-grid .game-card img {
        width: 100%;
        height: auto;
        max-height: 100px;
        object-fit: contain;
    }
    
    #all-games-grid.game-grid .game-info {
        padding: 8px 0;
    }
    
    #all-games-grid.game-grid .game-title {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }

    #all-games-grid .game-description {
        display: none !important;
    }
    
    #all-games-grid.game-grid .game-description,
    #all-games-grid.game-grid .play-btn {
        display: none;
    }
}

/* Skeleton loader styles */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

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

.skeleton-img {
    height: 200px;
    border-radius: 8px 8px 0 0;
}

.skeleton-text {
    height: 16px;
    margin: 10px 0;
    border-radius: 4px;
}

.skeleton-text.small {
    width: 60%;
    height: 12px;
}

.skeleton-text.medium {
    width: 80%;
}

.skeleton-text.large {
    width: 100%;
    height: 20px;
}

/* 加载指示器样式 */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-container p {
    color: #666;
    font-size: 1rem;
    margin: 0;
}

/* 下拉菜单样式 */
.dropdown-menu {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    background-color: transparent;
    color: white;
    border: 1px solid white;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 120px;
}

.dropdown-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.dropdown-arrow {
    font-size: 0.8rem;
    margin-left: 5px;
    transition: transform 0.3s ease;
}

.dropdown-menu.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 5px;
    background-color: #fff;
    min-width: 120px;
    border-radius: 4px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    overflow: hidden;
}

.dropdown-menu.active .dropdown-content {
    display: block;
}

.dropdown-content button {
    width: 100%;
    padding: 10px 15px;
    text-align: left;
    background-color: transparent;
    border: none;
    cursor: pointer;
    color: #333;
    transition: background-color 0.3s ease;
}

.dropdown-content button:hover {
    background-color: #f1f1f1;
}

.dropdown-content button.active {
    background-color: #3498db;
    color: white;
}

/* 推荐游戏模块样式 */
.spotlight-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 0;
    margin-bottom: 20px;
    border-radius: 8px;
}

.spotlight-section .section-header h2 {
    color: white;
    font-size: 1.6rem;
    margin-bottom: 5px;
}

.spotlight-section .section-description {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
}

.spotlight-games-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.spotlight-game-card {
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.spotlight-game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    background-color: rgba(255, 255, 255, 0.15);
}

.spotlight-game-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.spotlight-game-info {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.spotlight-game-title {
    font-size: 1.3rem;
    margin-bottom: 8px;
    color: white;
    font-weight: 600;
}

.spotlight-game-description {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 15px;
    flex: 1;
    line-height: 1.5;
}

.spotlight-play-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.spotlight-play-btn:hover {
    background-color: #219a52;
    transform: scale(1.02);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .spotlight-section {
        padding: 15px 0;
    }
    
    .spotlight-section .section-header h2 {
        font-size: 1.4rem;
    }
    
    .spotlight-section .section-description {
        font-size: 0.9rem;
    }
    
    .spotlight-games-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-top: 10px;
    }
    
    .spotlight-game-card img {
        height: 100px;
    }
    
    .spotlight-game-info {
        padding: 8px;
    }
    
    .spotlight-game-title {
        font-size: 1rem;
        margin-bottom: 4px;
        line-height: 1.3;
    }
    
    .spotlight-game-description {
        font-size: 0.8rem;
        margin-bottom: 8px;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .spotlight-play-btn {
        padding: 6px;
        font-size: 0.8rem;
    }
}