/* 移动端优先首页样式 - 深色主题游戏平台 */

/* 主内容区域 */
.main-content {
    padding: 1rem;
    padding-bottom: calc(4rem + 80px); /* 为底部导航留出空间 */
    background: #0a0a0a;
    min-height: 100vh;
}

/* 轮播展示区 */
.hero-carousel {
    margin-bottom: 3rem;
    position: relative;
}

.carousel-container {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    width: 100%;
    height: 600px;
    margin-bottom: 2rem;
    aspect-ratio: 16/9;
}

.carousel-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 250ms ease-out;
    z-index: 1;
}

.carousel-slide.active {
    opacity: 1;
    z-index: 2;
}

.slide-content {
    display: flex;
    flex-direction: row;
    background: #1e1e1e;
    border: 1px solid #333333;
    border-radius: 1rem;
    overflow: hidden;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
}

.slide-image {
    position: relative;
    width: 60%;
    height: 100%;
    overflow: hidden;
    flex-shrink: 0;
}

.slide-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 300ms ease-out;
}

.slide-image:hover img {
    transform: scale(1.05);
}

/* 占位符图片样式 */
.placeholder-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    z-index: 1;
}

.placeholder-icon {
    font-size: 3rem;
    opacity: 0.8;
}

.placeholder-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* 不同游戏的占位符背景 */
.epic-adventure {
    background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
}

.space-explorer {
    background: linear-gradient(135deg, #ff6b35 0%, #f59e0b 100%);
}

.mystery-quest {
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
}

.puzzle-master {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
}

.racing-champ {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
}

.zombie-survival {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
}

.magic-spells {
    background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
}

.ocean-explorer {
    background: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%);
}

.rank-1 {
    background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
}

.rank-2 {
    background: linear-gradient(135deg, #ff6b35 0%, #f59e0b 100%);
}

.rank-3 {
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
}

.rank-4 {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
}

.rank-5 {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
}

.featured-1 {
    background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
}

.featured-2 {
    background: linear-gradient(135deg, #ff6b35 0%, #f59e0b 100%);
}

.slide-image .placeholder-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 250ms ease-out;
}

.slide-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.25rem 1rem;
    background: linear-gradient(135deg, #ef4444 0%, #ff8a80 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 9999px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

.slide-info {
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 40%;
    height: 100%;
    position: relative;
    z-index: 3;
    overflow: visible;
}

.slide-info h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 1rem;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.slide-info p {
    font-size: 0.875rem;
    color: #a3a3a3;
    margin-bottom: 1rem;
    line-height: 1.75;
}

.slide-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.stars {
    color: #f59e0b;
    font-size: 0.875rem;
}

.rating-text {
    font-size: 0.75rem;
    color: #737373;
}

.play-now-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 250ms ease-out;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    text-decoration: none;
    display: inline-block;
    text-align: center;
    position: relative;
    z-index: 4;
    /* margin-top: auto; */
    flex-shrink: 0;
}

.play-now-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 212, 255, 0.3);
}

.carousel-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    z-index: 15;
    position: absolute;
    bottom: 1.5rem;
    top: 50%;
    height: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 2rem;
    width: fit-content;
    pointer-events: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 300ms ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.dot::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: transparent;
    transition: all 300ms ease-out;
}

.dot:hover {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.2);
}

.dot:hover::before {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.5);
}

.dot.active {
    background: #00d4ff;
    border-color: #00d4ff;
    transform: scale(1.3);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

.dot.active::before {
    background: rgba(0, 212, 255, 0.2);
    transform: scale(1.8);
}

.carousel-prev,
.carousel-next {
    position: absolute;
    top: 30%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #ffffff;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 250ms ease-out;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: auto;
}

.carousel-container:hover .carousel-prev,
.carousel-container:hover .carousel-next {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) scale(1.05);
}

.carousel-prev:hover,
.carousel-next:hover {
    background: rgba(0, 212, 255, 0.8);
    border-color: rgba(0, 212, 255, 0.6);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.carousel-prev {
    left: 1.5rem;
}

.carousel-next {
    right: 1.5rem;
}

.carousel-prev:hover,
.carousel-next:hover {
    background: #00d4ff;
    color: #000000;
    transform: translateY(-50%) scale(1.1);
}

/* 个性化推荐 */
.recommendations-section {
    margin-bottom: 3rem;
}

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

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.see-all-btn {
    padding: 0.5rem 1rem;
    background: #1e1e1e;
    border: 1px solid #333333;
    border-radius: 0.75rem;
    color: #00d4ff;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 150ms ease-out;
}

.see-all-btn:hover {
    background: #00d4ff;
    color: #000000;
    transform: translateY(-1px);
}

.recommendations-scroll {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #00d4ff #111111;
}

.recommendations-scroll::-webkit-scrollbar {
    height: 4px;
}

.recommendations-scroll::-webkit-scrollbar-track {
    background: #111111;
    border-radius: 2px;
}

.recommendations-scroll::-webkit-scrollbar-thumb {
    background: #00d4ff;
    border-radius: 2px;
}

.recommendation-card {
    flex: 0 0 180px;
    background: #1e1e1e;
    border: 1px solid #333333;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all 250ms ease-out;
    scroll-snap-align: start;
    position: relative;
}

.recommendation-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    border-color: #00d4ff;
}

.recommendation-card .card-image {
    position: relative;
    height: 100px;
    overflow: hidden;
}

.card-image .placeholder-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 250ms ease-out;
}

.recommendation-card:hover .card-image .placeholder-image {
    transform: scale(1.1);
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.3) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 250ms ease-out;
}

.recommendation-card:hover .card-overlay {
    opacity: 1;
}

.play-btn {
    padding: 0.5rem 1rem;
    background: #00d4ff;
    color: white;
    border: none;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 250ms ease-out;
}

.play-btn:hover {
    background: #0099cc;
    transform: scale(1.05);
}

.card-content {
    padding: 1rem;
}

.card-content h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.25rem;
}

.card-content p {
    font-size: 0.75rem;
    color: #a3a3a3;
    margin-bottom: 0.5rem;
}

.card-rating {
    font-size: 0.75rem;
    color: #f59e0b;
    font-weight: 500;
}

/* 全球排行榜 */
.rankings-section {
    margin-bottom: 3rem;
}

.ranking-tabs {
    display: flex;
    gap: 0.5rem;
}

.tab-btn {
    padding: 0.25rem 1rem;
    background: #1e1e1e;
    border: 1px solid #333333;
    border-radius: 0.75rem;
    color: #a3a3a3;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 150ms ease-out;
}

.tab-btn.active {
    background: #00d4ff;
    color: #000000;
    border-color: #00d4ff;
}

.rankings-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #1e1e1e;
    border: 1px solid #333333;
    border-radius: 0.75rem;
    transition: all 250ms ease-out;
}

.ranking-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    border-color: #00d4ff;
}

.rank-number {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.875rem;
    font-weight: 700;
    flex-shrink: 0;
}

.rank-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.rank-image {
    width: 50px;
    height: 50px;
    border-radius: 0.5rem;
    overflow: hidden;
    flex-shrink: 0;
}

.rank-image .placeholder-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rank-details h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.25rem;
}

.rank-details p {
    font-size: 0.75rem;
    color: #a3a3a3;
    margin: 0;
}

.rank-score {
    font-size: 0.875rem;
    font-weight: 700;
    color: #00d4ff;
}

/* 游戏分类 */
.categories-section {
    margin-bottom: 3rem;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.category-card {
    background: #1e1e1e;
    border: 1px solid #333333;
    border-radius: 0.75rem;
    padding: 1rem;
    text-align: center;
    transition: all 250ms ease-out;
    cursor: pointer;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    border-color: #00d4ff;
}

.category-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.category-card h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.25rem;
}

.category-card p {
    font-size: 0.75rem;
    color: #a3a3a3;
    margin: 0;
}

/* 特色游戏 */
.featured-section {
    margin-bottom: 3rem;
}

.featured-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.featured-card {
    background: #1e1e1e;
    border: 1px solid #333333;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all 250ms ease-out;
}

.featured-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    border-color: #00d4ff;
}

.featured-card .card-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.featured-card .card-image .placeholder-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 250ms ease-out;
}

.featured-card:hover .card-image .placeholder-image {
    transform: scale(1.05);
}

.card-badges {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.featured {
    background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
    color: white;
}

.badge.hot {
    background: linear-gradient(135deg, #ef4444 0%, #ff8a80 100%);
    color: white;
}

.badge.free {
    background: linear-gradient(135deg, #10b981 0%, #4ade80 100%);
    color: white;
}

.badge.trending {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    color: white;
}

.featured-card .card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.3) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 250ms ease-out;
}

.featured-card:hover .card-overlay {
    opacity: 1;
}

.featured-card .card-content {
    padding: 1.5rem;
}

.featured-card .card-content h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

.featured-card .card-content p {
    font-size: 0.875rem;
    color: #a3a3a3;
    margin-bottom: 1rem;
    line-height: 1.75;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

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

.card-category {
    font-size: 0.75rem;
    color: #737373;
    background: #111111;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.play-btn-primary {
    flex: 1;
    padding: 1rem 1.5rem;
    background: #00d4ff;
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 250ms ease-out;
}

.play-btn-primary:hover {
    background: #0099cc;
    transform: translateY(-1px);
}

.favorite-btn {
    width: 48px;
    height: 48px;
    background: #111111;
    border: 1px solid #333333;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a3a3a3;
    cursor: pointer;
    transition: all 250ms ease-out;
    font-size: 1.125rem;
}

.favorite-btn:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.1);
}

/* 响应式设计 */
@media (min-width: 768px) {
    .main-content {
        padding: 2rem 1rem;
    }
    
    .slide-content {
        flex-direction: row;
    }
    
    .slide-image {
        height: 300px;
        min-height: 300px;
        flex: 1;
    }
    
    .slide-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .recommendations-scroll {
        gap: 1.5rem;
    }
    
    .recommendation-card {
        flex: 0 0 250px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .featured-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

@media (min-width: 1024px) {
    .main-content {
        padding: 3rem 1rem;
    }
    
    .slide-image {
        height: 400px;
        min-height: 400px;
    }
    
    .recommendation-card {
        flex: 0 0 280px;
    }
    
    .featured-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* PC端控制器优化 */
@media (min-width: 769px) {
    .carousel-prev,
    .carousel-next {
        width: 55px;
        height: 55px;
        font-size: 1.5rem;
    }
    
    .carousel-dots {
        top: auto;
        bottom: 2rem;
        padding: 1rem 2rem;
    }
    
    .dot {
        width: 16px;
        height: 16px;
    }
}

/* 确保轮播图控件在所有设备上都可见 */
@media (max-width: 768px) {
    .carousel-container {
        height: 570px;
    }
    
    .carousel-track {
        height: 100%;
    }
    
    .slide-content {
        flex-direction: column;
        height: 100%;
    }
    
    .slide-image {
        width: 100%;
        height: 60%;
    }
    
    .slide-info {
        width: 100%;
        /* height: 40%; */
        padding: 1rem;
    }
    
    .slide-info h2 {
        font-size: 1.25rem;
    }
    
    .slide-info p {
        font-size: 0.8rem;
    }
    
    .carousel-prev,
    .carousel-next {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .carousel-prev {
        left: 0.5rem;
    }
    
    .carousel-next {
        right: 0.5rem;
    }
    
    .carousel-dots {
        bottom: 0.75rem;
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }
    
    .dot {
        width: 10px;
        height: 10px;
    }
    
    .dot.active {
        transform: scale(1.2);
    }
}

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
    .carousel-prev,
    .carousel-next {
        display: flex;
        opacity: 0;
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
        visibility: visible;
        background: rgba(0, 0, 0, 0.7);
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
    
    .carousel-prev:active,
    .carousel-next:active {
        opacity: 1;
        transform: translateY(-50%) scale(0.95);
        background: rgba(0, 212, 255, 0.9);
        border-color: rgba(0, 212, 255, 0.9);
    }
    
    .dot {
        width: 14px;
        height: 14px;
        margin: 0 2px;
    }
    
    .carousel-dots {
        bottom: 0.75rem;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }
    
    .carousel-container:hover .carousel-prev,
    .carousel-container:hover .carousel-next {
        opacity: 0.9;
        visibility: visible;
    }
    
    /* 确保在移动端按钮始终可见 */
    .carousel-container .carousel-prev,
    .carousel-container .carousel-next {
        opacity: 0.9;
        visibility: visible;
    }
    
    .recommendation-card:hover,
    .featured-card:hover,
    .category-card:hover,
    .ranking-item:hover {
        transform: none;
    }
    
    .play-btn:hover,
    .play-btn-primary:hover,
    .favorite-btn:hover {
        transform: none;
    }
}

/* 性能优化 */
.card-image .placeholder-image,
.slide-image .placeholder-image,
.rank-image .placeholder-image {
    will-change: transform;
}

.carousel-track {
    will-change: transform;
}

.recommendations-scroll {
    will-change: scroll-position;
}

/* 动画性能优化 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}