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

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

/* 头部样式 */
.header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
    gap: 1rem;
}

.logo {
    flex-shrink: 0;
    min-width: 120px;
}

.logo h1 {
    color: #2c3e50;
    font-size: 2rem;
    font-weight: bold;
}

.logo a {
    text-decoration: none;
    color: inherit;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: #666;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    background: #3498db;
    color: #fff;
}

/* 主体内容样式 */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 140px);
}

.search-section {
    margin-bottom: 2rem;
    text-align: center;
}

.search-input {
    width: 100%;
    max-width: 500px;
    padding: 12px 20px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 25px;
    outline: none;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    border-color: #3498db;
}

.section-title {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

/* 游戏网格样式 */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.game-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

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

.game-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(45deg, #3498db, #2980b9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
}

.game-content {
    padding: 1.5rem;
}

.game-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.game-rating {
    color: #e67e22;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.game-clicks {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.game-description {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.game-tags {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag {
    background: #ecf0f1;
    color: #2c3e50;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
}

/* 详情页样式 */
.detail-section {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.detail-header {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.detail-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    background: linear-gradient(45deg, #3498db, #2980b9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
}

.detail-info h2 {
    color: #2c3e50;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.detail-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.detail-meta div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-description {
    color: #666;
    line-height: 1.7;
}

.detail-actions {
    margin-top: 1.5rem;
}

.play-button {
    display: inline-block;
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: #fff;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
    border: none;
    cursor: pointer;
}

.play-button:hover {
    background: linear-gradient(45deg, #c0392b, #a93226);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
    color: #fff;
}

.play-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(231, 76, 60, 0.3);
}

.like-section {
    margin-top: 2rem;
}

.like-section h3 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

/* 广告位样式 */
.advertisement {
    background: #ecf0f1;
    text-align: center;
    padding: 2rem;
    margin: 2rem 0;
    border-radius: 8px;
    color: #666;
    font-style: italic;
}

/* 底部样式 */
.footer {
    background: #2c3e50;
    color: #fff;
    text-align: center;
    padding: 1.5rem 0;
}

.footer-links {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #34495e;
}

.footer-link {
    color: #bdc3c7;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #3498db;
    text-decoration: underline;
}

/* 移动端优化 */
/* 触摸友好的按钮和链接 */
.nav-link, .game-card {
    -webkit-tap-highlight-color: rgba(52, 152, 219, 0.3);
    touch-action: manipulation;
}

/* 移动端汉堡菜单 */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #2c3e50;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.mobile-menu-toggle:hover {
    background-color: #ecf0f1;
}

.mobile-menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #2c3e50;
    margin: 5px 0;
    transition: 0.3s;
}

/* 桌面端导航样式 */
@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none;
    }
    
    .nav {
        position: relative;
        transform: none;
        opacity: 1;
        visibility: visible;
        background: transparent;
        box-shadow: none;
        overflow-x: auto;
        overflow-y: hidden;
        max-width: calc(100% - 200px); /* 为logo和间距预留空间 */
        flex-shrink: 1;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
        padding: 0 1rem;
        margin: 0 -1rem;
    }
    
    /* 滚动渐变提示 */
    .nav::before,
    .nav::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        width: 20px;
        pointer-events: none;
        z-index: 1;
    }
    
    .nav::before {
        left: 0;
        background: linear-gradient(to right, rgba(255,255,255,0.9), transparent);
    }
    
    .nav::after {
        right: 0;
        background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
    }
    
    .nav::-webkit-scrollbar {
        display: none; /* Chrome, Safari and Opera */
    }
    
    .nav-list {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.5rem;
        padding: 0.5rem 0;
        align-items: center;
        min-width: max-content;
    }
    
    .nav-link {
        padding: 0.5rem 1rem;
        border-radius: 20px;
        border-bottom: none;
        text-align: center;
        font-size: 0.9rem;
        min-height: auto;
        display: inline-block;
        white-space: nowrap;
        flex-shrink: 0;
        transition: all 0.3s ease;
        border: 1px solid #e0e0e0;
        background: #f8f9fa;
    }
    
    .nav-link:hover {
        background: #3498db;
        color: #fff;
        border-color: #3498db;
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
    }
    
    .nav-link.active {
        background: #2980b9;
        color: #fff;
        border-color: #2980b9;
        box-shadow: 0 2px 8px rgba(41, 128, 185, 0.4);
    }
}

/* 移动端导航样式 */
@media (max-width: 768px) {
    .header .container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 99;
    }
    
    .nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-list {
        flex-direction: column;
        padding: 1rem 0;
        gap: 0;
    }
    
    .nav-link {
        display: block;
        padding: 1rem 2rem;
        border-radius: 0;
        border-bottom: 1px solid #ecf0f1;
        text-align: center;
        font-size: 1.1rem;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .nav-link:last-child {
        border-bottom: none;
    }
    
    .search-input {
        font-size: 16px; /* 防止iOS缩放 */
        padding: 15px 20px;
        max-width: 100%;
    }
    
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
    
    .game-card {
        min-height: 48px; /* 触摸友好的最小尺寸 */
    }
    
    .detail-header {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .main {
        padding: 1.5rem 0;
    }
    
    .section-title {
        font-size: 1.3rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .game-content {
        padding: 1rem;
    }
    
    .detail-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .detail-info h2 {
        font-size: 1.5rem;
    }
    
    .search-input {
        margin: 0 10px;
    }
    
    .container {
        padding: 0 10px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 360px) {
    .game-tags {
        flex-wrap: wrap;
    }
    
    .tag {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
    }
    
    .nav-link {
        font-size: 1rem;
        padding: 0.8rem 1.5rem;
    }
}