/**
 * Game Layout Styles (shared between homepage and game pages)
 * 
 * Contains: game-card, sidebars, video container, sound cards, trending section, etc.
 * Used by: HomePage.astro (via additionalStyles), GameLayout.astro (direct link)
 * 
 * NOTE: Despite the filename "homepage.css", these styles are shared across the site.
 * TODO: Consider renaming to game-layout.css in a future cleanup.
 * 
 * Requirements: 3.2
 */

/* Import CSS Variables */
@import url('/styles/variables.css');

/* ===========================================
 * VIDEO CONTAINER
 * =========================================== */
.video-container {
    margin: var(--spacing-2xl, 30px) auto 0;
    border: 3px solid var(--color-primary, #ff6b9d);
    border-radius: var(--radius-lg, 16px);
    display: flex;
    gap: var(--spacing-xl, 20px);
    padding: var(--spacing-lg, 16px);
    background: var(--color-bg-card, #111111);
    box-shadow: var(--shadow-glow-sm, 0 0 15px rgba(255, 107, 157, 0.3));
}

.video-container iframe {
    flex: 1 1 0;
    min-width: 0;
    aspect-ratio: var(--aspect-ratio-video, 16/9);
    height: auto;
    min-height: 280px;
    max-height: 400px;
    border-radius: var(--radius-md, 12px);
    border: none;
}

/* Clear float helper - hide in video-container as we're using flex now */
.video-container .clear-both {
    display: none;
}

/* ===========================================
 * AUDIO ELEMENTS
 * =========================================== */
audio {
    width: 210px;
}

/* ===========================================
 * HOMEPAGE GAME CARD - FLEX LAYOUT
 * =========================================== */
.game-card {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-lg, 16px);
}

/* ===========================================
 * SIDEBAR - GLASSMORPHISM FLOATING CARDS
 * =========================================== */
.game-card .game-iframe-pop,
.game-card .game-iframe-new {
    flex: 0 0 140px;
    min-width: 120px;
    max-width: 160px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md, 12px);
}

/* Sidebar section header */
.game-card .game-iframe-pop h3,
.game-card .game-iframe-new h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--color-text-muted, #888);
    margin: 0 0 var(--spacing-sm, 8px) 0;
    padding-bottom: var(--spacing-xs, 4px);
    border-bottom: 1px solid rgba(255, 107, 157, 0.2);
    text-align: center;
}

/* Sidebar list reset */
.game-card .game-iframe-pop ul,
.game-card .game-iframe-new ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md, 12px);
}

/* Glass card container */
.game-card .game-iframe-pop li,
.game-card .game-iframe-new li {
    position: relative;
}

/* Glass card link */
.game-card .game-iframe-pop li a,
.game-card .game-iframe-new li a {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg, 16px);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* P1: 侧边栏卡片可点击 */
    cursor: pointer;
}

/* P1: 增强侧边栏卡片 Hover 效果 */
.game-card .game-iframe-pop li a:hover,
.game-card .game-iframe-new li a:hover {
    transform: translateY(-4px) scale(1.02);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 107, 157, 0.5);
    box-shadow: 
        0 8px 32px rgba(255, 107, 157, 0.2),
        0 0 30px rgba(255, 107, 157, 0.15);
}

/* P1: 侧边栏卡片 Hover 时标题颜色变化 */
.game-card .game-iframe-pop li a:hover .title,
.game-card .game-iframe-new li a:hover .title {
    color: var(--color-primary, #ff6b9d);
}

/* Sidebar thumbnail - 16:9 aspect ratio (全站统一)
 * Using higher specificity to avoid !important */
.game-card .game-iframe-pop li a img,
.game-card .game-iframe-new li a img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: brightness(0.9);
}

.game-card .game-iframe-pop li a:hover img,
.game-card .game-iframe-new li a:hover img {
    transform: scale(1.05);
    filter: brightness(1);
}

/* Sidebar card title - 全站统一居中显示 */
.game-card .game-iframe-pop .title,
.game-card .game-iframe-new .title {
    padding: var(--spacing-sm, 8px) var(--spacing-md, 12px);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-white, #fff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    text-align: center;
}

/* Card separator dots */
.game-card .game-iframe-pop li:not(:last-child)::after,
.game-card .game-iframe-new li:not(:last-child)::after {
    content: '·';
    display: block;
    text-align: center;
    color: rgba(255, 107, 157, 0.3);
    font-size: 20px;
    line-height: 1;
    margin-top: var(--spacing-sm, 8px);
}

/* Main iframe area - HERO FOCUS with SAFE AREA */
.game-card .game-iframe-sprunki {
    flex: 1;
    min-width: 0;
    width: 100%;
    aspect-ratio: var(--aspect-ratio-game, 16/9);
    /* 不设置min-height，让aspect-ratio自然控制比例 */
    max-height: 70vh;
    background-color: var(--color-bg-card, #111111);
    position: relative;
    background-image: linear-gradient(rgba(10, 10, 10, 0.85), rgba(10, 10, 10, 0.7)), var(--bg-image, url(/tw.jpg));
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    /* Neon glow border to highlight main game */
    border: 2px solid var(--color-primary, #ff6b9d);
    border-radius: var(--radius-xl, 20px);
    box-shadow:
        0 0 20px var(--glow-color-40),
        0 0 40px var(--glow-color-20),
        inset 0 0 60px rgba(255, 107, 157, 0.05);
    /* Simplified animation for better performance */
    animation: heroGlow 3s ease-in-out infinite;
    will-change: opacity;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 修复: 确保边框包含在宽度内，避免移动端溢出偏移 */
    box-sizing: border-box;
}

/* Game info section - Welcome message above game area */
.game-card .game-info {
    width: 100%;
    order: -1; /* Show at top */
    text-align: center;
    padding: var(--spacing-md, 12px) var(--spacing-lg, 16px);
    margin-bottom: var(--spacing-md, 12px);
    /* 修复: 确保 padding 包含在 width 内，避免溢出 */
    box-sizing: border-box;
}

.game-card .game-info h2 {
    font-size: var(--font-size-xl, 24px);
    font-weight: var(--font-weight-bold, 700);
    color: var(--color-text-white, #fff);
    margin: 0 0 var(--spacing-xs, 4px) 0;
}

.game-card .game-info p {
    font-size: var(--font-size-sm, 14px);
    color: var(--color-text-muted, #aaa);
    margin: 0;
    line-height: 1.5;
}

/* ===========================================
 * COMPACT GAME CARDS (HOMEPAGE / TRENDING)
 * =========================================== */
.game--compact {
    padding: 0;
}

.game--compact > a {
    display: block;
    width: 100%;
}

.game__title--ellipsis {
    font-size: 14px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 100%;
    padding: 0 var(--spacing-sm);
}

/* Two-line ellipsis for longer titles */
.game__title--multiline {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    line-height: 1.4;
    max-height: 2.8em;
}

.game--mod img {
    max-height: 150px;
    border-top-right-radius: 10px;
    border-top-left-radius: 10px;
}

/* ===========================================
 * FEATURED GAME CARD (TRENDING SECTION)
 * =========================================== */
.game-grid--featured {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--grid-min-card, 240px), 1fr));
    gap: var(--grid-gap, 20px);
}

.game--featured {
    grid-column: span 2;
    grid-row: span 2;
    position: relative;
}

.game--featured .game-logo {
    height: 100%;
    min-height: 300px;
}

.game--featured .game-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: auto;
}

.game--featured .game__title--ellipsis {
    font-size: 18px;
    font-weight: var(--font-weight-bold, 700);
    padding: var(--spacing-md, 12px) 0;
}

.game__badge {
    position: absolute;
    top: var(--spacing-md, 12px);
    left: var(--spacing-md, 12px);
    background: linear-gradient(135deg, var(--color-primary, #ff6b9d), var(--color-primary-dark, #e64e82));
    color: var(--color-text-white, #fff);
    padding: var(--spacing-xs, 4px) var(--spacing-md, 12px);
    border-radius: var(--radius-full, 9999px);
    font-size: var(--font-size-sm, 14px);
    font-weight: var(--font-weight-semibold, 600);
    z-index: 2;
    box-shadow: var(--shadow-glow-sm);
    /* P0: Badge 使用 flexbox 对齐 SVG 图标 */
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* P0: Badge 内 SVG 图标样式 */
.game__badge .badge-icon {
    flex-shrink: 0;
}

/* Featured card glow effect */
.game--featured:hover {
    box-shadow: var(--shadow-glow-md);
}

/* P3: Featured 卡片彩虹边框光晕 */
.game--featured {
    position: relative;
}

.game--featured::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: var(--gradient-featured, linear-gradient(135deg, #ff6b9d, #9966ff, #00ccff, #ff6b9d));
    background-size: 300% 300%;
    animation: gradientShift 4s ease infinite;
    z-index: -1;
    opacity: 0;
    filter: blur(12px);
    transition: opacity 0.3s ease;
}

.game--featured:hover::before {
    opacity: 0.7;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* P3: 游戏类型专属徽章颜色 */
.game__badge--action {
    background: linear-gradient(135deg, var(--game-color-action, #ff4444), #cc2222);
}

.game__badge--puzzle {
    background: linear-gradient(135deg, var(--game-color-puzzle, #00ccff), #0099cc);
}

.game__badge--music {
    background: linear-gradient(135deg, var(--game-color-music, #9966ff), #7733cc);
}

.game__badge--new {
    background: linear-gradient(135deg, var(--game-color-new, #66ff66), #44cc44);
}

.game__badge--hot {
    background: linear-gradient(135deg, var(--game-color-hot, #ffcc00), #ff9900);
}

/* Responsive: featured card */
@media screen and (max-width: 768px) {
    .game--featured {
        grid-column: span 2;
        grid-row: span 1;
    }

    .game--featured .game-logo {
        min-height: 200px;
    }
}

@media screen and (max-width: 480px) {
    .game--featured {
        grid-column: span 2;
    }
}

/* ===========================================
 * SOUND EXPLORER SECTION
 * =========================================== */
.sound-explorer-section {
    padding: var(--spacing-2xl, 30px) 0;
    --audio-player-btn-opacity: 0.8;
}

.sound-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--spacing-lg, 16px);
}

.sound-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--color-bg-card, #111);
    border: 1px solid var(--color-border, #222);
    border-radius: var(--radius-lg, 16px);
    padding: var(--spacing-lg, 16px);
    transition: transform var(--transition-fast, 0.2s ease), box-shadow var(--transition-fast, 0.2s ease);
}

.sound-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow-sm);
}

.sound-card__image {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-md, 12px);
    overflow: hidden;
    margin-bottom: var(--spacing-md, 12px);
}

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

.sound-card__title {
    font-weight: var(--font-weight-semibold, 600);
    margin-bottom: var(--spacing-sm, 8px);
    color: var(--color-text-white, #fff);
}

/* ===========================================
 * ANIMATIONS - Hero Glow & Pulse
 * Optimized: Use GPU-accelerated properties, respect prefers-reduced-motion
 * =========================================== */
@keyframes heroGlow {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
}

@keyframes playPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05);
    }
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    .game-card .game-iframe-sprunki,
    .game-card .game-iframe-sprunki #playButton,
    .game--featured::before,
    .game-card .game-iframe-pop::before,
    .game-card .game-iframe-pop::after,
    .game-card .game-iframe-new::before,
    .game-card .game-iframe-new::after {
        animation: none !important;
    }
}

/* Hero Play Button Enhancement */
.game-card .game-iframe-sprunki #playButton {
    animation: playPulse 2s ease-in-out infinite;
    font-size: 1.25rem;
    padding: var(--spacing-md, 12px) var(--spacing-2xl, 32px);
    border-radius: var(--radius-full, 50px);
    background: linear-gradient(135deg, var(--color-primary, #ff6b9d), #e91e63);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: var(--font-weight-bold, 700);
    color: white;
    text-decoration: none;
    display: inline-block;
    /* 居中定位 - 相对于游戏区域 */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.game-card .game-iframe-sprunki #playButton:hover {
    animation: none;
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow:
        0 0 30px var(--glow-color-80),
        0 0 60px var(--glow-color-40),
        0 0 90px var(--glow-color-20);
    background: linear-gradient(135deg, #ff8cb2, #ff6b9d);
}

/* ===========================================
 * RESPONSIVE STYLES
 * =========================================== */
@media screen and (max-width: 980px) {
    .game-card {
        flex-direction: column;
        flex-wrap: nowrap; /* 修复：防止侧边栏被推到右侧 */
    }

    /* Both sidebars visible on tablet/mobile - horizontal scroll */
    /* Both below the game iframe */
    .game-card .game-iframe-pop,
    .game-card .game-iframe-new {
        display: block;
        flex: 1 1 100%;
        max-width: none;
    }
    
    /* Order: Welcome(-1) -> Game iframe(0) -> Popular(1) -> New(2) */
    .game-card .game-iframe-sprunki {
        order: 0;
    }
    
    .game-card .game-iframe-pop {
        order: 1;
    }
    
    .game-card .game-iframe-new {
        order: 2;
    }

    .game-card .game-iframe-pop h3,
    .game-card .game-iframe-new h3 {
        /* 修复: 移动端标题居中 */
        text-align: center;
        padding-left: 0;
    }

    /* 水平滚动容器 - 带高级滑动指示器 */
    .game-card .game-iframe-pop,
    .game-card .game-iframe-new {
        position: relative;
    }
    
    /* 左侧滑动指示器 */
    .game-card .game-iframe-pop::before,
    .game-card .game-iframe-new::before {
        content: '';
        position: absolute;
        left: -8px;
        top: 50%;
        transform: translateY(-50%);
        width: 32px;
        height: 32px;
        background: linear-gradient(135deg, rgba(255, 107, 157, 0.15), rgba(255, 107, 157, 0.05));
        border: 1px solid rgba(255, 107, 157, 0.3);
        border-radius: 50%;
        z-index: 10;
        pointer-events: none;
        opacity: 0.9;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    }
    
    /* 左箭头 SVG */
    .game-card .game-iframe-pop::before,
    .game-card .game-iframe-new::before {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ff6b9d'%3E%3Cpath d='M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: center;
        background-size: 20px;
    }
    
    /* 右侧滑动指示器 */
    .game-card .game-iframe-pop::after,
    .game-card .game-iframe-new::after {
        content: '';
        position: absolute;
        right: -8px;
        top: 50%;
        transform: translateY(-50%);
        width: 32px;
        height: 32px;
        background: linear-gradient(135deg, rgba(255, 107, 157, 0.15), rgba(255, 107, 157, 0.05));
        border: 1px solid rgba(255, 107, 157, 0.3);
        border-radius: 50%;
        z-index: 10;
        pointer-events: none;
        opacity: 0.9;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
        /* 右箭头 SVG */
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ff6b9d'%3E%3Cpath d='M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: center;
        background-size: 20px;
        animation: scrollArrowPulse 2s ease-in-out infinite;
    }
    
    @keyframes scrollArrowPulse {
        0%, 100% { 
            opacity: 0.7;
            transform: translateY(-50%) translateX(0);
        }
        50% { 
            opacity: 1;
            transform: translateY(-50%) translateX(3px);
        }
    }
    
    /* 左箭头反向动画 */
    .game-card .game-iframe-pop::before,
    .game-card .game-iframe-new::before {
        animation: scrollArrowPulseLeft 2s ease-in-out infinite;
    }
    
    @keyframes scrollArrowPulseLeft {
        0%, 100% { 
            opacity: 0.7;
            transform: translateY(-50%) translateX(0);
        }
        50% { 
            opacity: 1;
            transform: translateY(-50%) translateX(-3px);
        }
    }

    .game-card .game-iframe-pop ul,
    .game-card .game-iframe-new ul {
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        padding-bottom: var(--spacing-sm, 8px);
        gap: var(--spacing-md, 12px);
        /* Hide scrollbar but keep swipe functionality */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
        margin: 0;
        padding-left: 0;
        /* 右侧 padding 确保最后一个卡片不被渐变完全遮挡 */
        padding-right: 24px;
    }

    .game-card .game-iframe-pop ul::-webkit-scrollbar,
    .game-card .game-iframe-new ul::-webkit-scrollbar {
        display: none; /* Chrome/Safari/Opera */
    }

    .game-card .game-iframe-pop li,
    .game-card .game-iframe-new li {
        flex: 0 0 140px;
        scroll-snap-align: start;
        /* 固定卡片高度，确保跨语言一致性 */
        height: 130px;
        min-height: 130px;
        max-height: 130px;
    }
    
    /* 强制卡片内链接填满固定高度 */
    .game-card .game-iframe-pop li a,
    .game-card .game-iframe-new li a {
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    /* 标题区域固定为单行省略，确保一致性 */
    .game-card .game-iframe-pop .title,
    .game-card .game-iframe-new .title {
        flex: 0 0 auto;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        padding: 6px 8px;
        font-size: 11px;
    }

    .game-card .game-iframe-pop li:not(:last-child)::after,
    .game-card .game-iframe-new li:not(:last-child)::after {
        content: none;
        display: none;
    }

    /* 平板端标题居中 */
    .game-card .game-iframe-pop .title,
    .game-card .game-iframe-new .title {
        display: block;
        text-align: center;
    }

    .game-card .game-iframe-sprunki {
        /* 平板强制16:9 */
        flex: 0 0 auto;
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        min-height: unset;
        max-height: unset;
        --game-safe-padding: 8%;
    }
}

@media screen and (max-width: 768px) {
    audio {
        width: 120px;
    }

    .game-card {
        flex-direction: column;
        flex-wrap: nowrap;
        min-height: auto;
        height: auto;
        /* 修复: 移动端垂直布局时，子元素拉伸填满宽度，避免居中导致的偏移 */
        align-items: stretch;
    }

    .game-card .game-iframe-pop,
    .game-card .game-iframe-new {
        flex: 0 0 auto;
    }

    .game-card .game-iframe-sprunki {
        --game-safe-padding: 5%;
    }
    
    /* 移动端Play按钮 - 更小尺寸，居中 */
    .game-card .game-iframe-sprunki #playButton {
        font-size: 0.875rem;
        padding: 10px 20px;
        letter-spacing: 1px;
    }
    
    .video-container {
        flex-direction: column;
    }
    
    .video-container iframe {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
        min-height: 200px;
    }
    
    /* Welcome message - visible on mobile */
    .game-card .game-info {
        display: block;
        order: -1;
        padding: var(--spacing-sm, 8px) var(--spacing-md, 12px);
        margin-bottom: var(--spacing-sm, 8px);
    }
    
    .game-card .game-info h2 {
        font-size: var(--font-size-lg, 18px);
    }
    
    .game-card .game-info p {
        font-size: var(--font-size-xs, 12px);
    }
    
    footer .container {
        display: block;
    }

    /* Featured card mobile */
    .game--featured {
        grid-column: span 2;
        grid-row: span 1;
    }

    .game--featured .game-logo {
        min-height: 200px;
    }

    /* ===========================================
     * SOUND EXPLORER - 移动端重新设计
     * 播放按钮居中覆盖在角色图片上
     * =========================================== */
    
    /* 修复溢出: 确保 section 和容器不超出屏幕 */
    .sound-explorer-section {
        overflow-x: hidden;
        width: 100%;
        box-sizing: border-box;
    }
    
    .sound-explorer-section .container {
        overflow-x: hidden;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* 移除滑动指示器 */
    .sound-explorer-section::before,
    .sound-explorer-section::after {
        display: none;
    }
    
    /* 紧凑网格布局 - 2列显示所有音效，防止溢出 */
    .sound-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 0;
        margin: 0;
        overflow: visible;
        width: 100%;
        box-sizing: border-box;
    }

    /* 卡片容器 - 作为定位参考 */
    .sound-card {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 16px 12px 12px;
        gap: 8px;
        border-radius: 16px;
        text-align: center;
        background: rgba(17, 17, 17, 0.9);
        border: 1px solid rgba(255, 107, 157, 0.15);
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
        min-width: 0; /* 防止 grid 子元素溢出 */
        overflow: hidden;
    }
    
    .sound-card:active {
        border-color: rgba(255, 107, 157, 0.5);
        box-shadow: 0 0 16px rgba(255, 107, 157, 0.2);
    }
    
    /* 图片容器 - 作为播放按钮的定位锚点 */
    .sound-card__image {
        position: relative;
        width: 80px;
        height: 80px;
        min-width: 80px;
        margin-bottom: 0;
        border-radius: 50%;
        overflow: hidden;
        /* 浅色渐变背景，让透明背景的角色图片更清晰 */
        background: linear-gradient(145deg, #2a2a3a 0%, #1a1a2a 100%);
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.4),
            inset 0 0 30px rgba(255, 107, 157, 0.08),
            0 0 0 2px rgba(255, 107, 157, 0.15);
    }
    
    .sound-card__image img {
        width: 100%;
        height: 100%;
        object-fit: contain; /* 保持角色完整显示，不裁切 */
        transition: transform 0.3s ease, filter 0.3s ease;
        /* 稍微提亮图片 */
        filter: brightness(1.1) contrast(1.05);
    }
    
    /* 标题样式 */
    .sound-card__title {
        font-size: 12px;
        font-weight: 600;
        margin: 0;
        line-height: 1.3;
        color: var(--color-text-white, #fff);
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        order: 2; /* 确保在播放器之后 */
    }
    
    /* 播放器重新定位 - 覆盖在图片中央 */
    .sound-card .audio-player {
        position: absolute !important;
        top: 16px !important; /* 对应卡片 padding-top */
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 80px !important;
        height: 80px !important;
        min-width: unset !important;
        max-width: unset !important;
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        z-index: 2;
    }
    
    /* 播放按钮 - 居中在图片上，半透明背景 */
    .sound-card .audio-player__btn {
        width: 44px;
        height: 44px;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        border: 2px solid rgba(255, 107, 157, 0.8);
        box-shadow: 
            0 4px 16px rgba(0, 0, 0, 0.4),
            0 0 20px rgba(255, 107, 157, 0.3);
        transition: all 0.2s ease;
    }
    
    .sound-card .audio-player__btn:active {
        transform: scale(0.92);
        background: rgba(255, 107, 157, 0.8);
    }
    
    /* 播放中状态 - 更亮的按钮 */
    .sound-card .audio-player.is-playing .audio-player__btn {
        background: var(--color-primary, #ff6b9d);
        border-color: var(--color-primary, #ff6b9d);
        box-shadow: 
            0 4px 16px rgba(255, 107, 157, 0.6),
            0 0 30px rgba(255, 107, 157, 0.4);
    }
    
    .sound-card .audio-player__btn svg {
        width: 18px;
        height: 18px;
    }
    
    /* 隐藏进度条和时间 - 移动端简化 */
    .sound-card .audio-player__progress,
    .sound-card .audio-player__time {
        display: none;
    }
    
    /* Hover 效果简化 (触摸设备主要用 active) */
    .sound-card:hover {
        transform: none;
    }
    
    /* ===========================================
     * SOUND-GRID .game 版本 (非英文语言使用 SoundCard 组件)
     * SoundCard 输出 .game 类，需要相同的样式
     * =========================================== */
    
    /* .game 卡片容器 - 与 .sound-card 保持一致 */
    .sound-explorer-section .sound-grid .game {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 16px 12px 12px;
        gap: 8px;
        border-radius: 16px;
        text-align: center;
        background: rgba(17, 17, 17, 0.9);
        border: 1px solid rgba(255, 107, 157, 0.15);
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
        min-width: 0;
        overflow: hidden;
    }
    
    .sound-explorer-section .sound-grid .game:active {
        border-color: rgba(255, 107, 157, 0.5);
        box-shadow: 0 0 16px rgba(255, 107, 157, 0.2);
    }
    
    .sound-explorer-section .sound-grid .game:hover {
        transform: none;
        box-shadow: none;
    }
    
    /* 图片容器 - 圆形头像风格 */
    .sound-explorer-section .sound-grid .game .game-logo {
        position: relative;
        width: 80px;
        height: 80px;
        min-width: 80px;
        margin-bottom: 0;
        border-radius: 50%;
        overflow: hidden;
        background: linear-gradient(145deg, #2a2a3a 0%, #1a1a2a 100%);
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.4),
            inset 0 0 30px rgba(255, 107, 157, 0.08),
            0 0 0 2px rgba(255, 107, 157, 0.15);
    }
    
    .sound-explorer-section .sound-grid .game .game-logo img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        border-radius: 50%;
        filter: brightness(1.1) contrast(1.05);
    }
    
    /* 标题样式 */
    .sound-explorer-section .sound-grid .game > p {
        font-size: 12px;
        font-weight: 600;
        margin: 0;
        line-height: 1.3;
        color: var(--color-text-white, #fff);
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        order: 2;
    }
    
    /* 播放器重新定位 - 覆盖在图片中央 */
    .sound-explorer-section .sound-grid .game .audio-player {
        position: absolute !important;
        top: 16px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 80px !important;
        height: 80px !important;
        min-width: unset !important;
        max-width: unset !important;
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        z-index: 2;
    }
    
    /* 播放按钮样式 */
    .sound-explorer-section .sound-grid .game .audio-player__btn {
        width: 44px;
        height: 44px;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        border: 2px solid rgba(255, 107, 157, 0.8);
        box-shadow: 
            0 4px 16px rgba(0, 0, 0, 0.4),
            0 0 20px rgba(255, 107, 157, 0.3);
        transition: all 0.2s ease;
    }
    
    .sound-explorer-section .sound-grid .game .audio-player__btn:active {
        transform: scale(0.92);
        background: rgba(255, 107, 157, 0.8);
    }
    
    .sound-explorer-section .sound-grid .game .audio-player.is-playing .audio-player__btn {
        background: var(--color-primary, #ff6b9d);
        border-color: var(--color-primary, #ff6b9d);
        box-shadow: 
            0 4px 16px rgba(255, 107, 157, 0.6),
            0 0 30px rgba(255, 107, 157, 0.4);
    }
    
    .sound-explorer-section .sound-grid .game .audio-player__btn svg {
        width: 18px;
        height: 18px;
    }
    
    /* 隐藏进度条和时间 */
    .sound-explorer-section .sound-grid .game .audio-player__progress,
    .sound-explorer-section .sound-grid .game .audio-player__time {
        display: none;
    }
}

@media screen and (max-width: 480px) {
    .game--featured {
        grid-column: span 2;
    }

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

    /* P0: 移动端触摸目标优化 - 增大卡片尺寸确保 >= 44px */
    .game-card .game-iframe-pop li,
    .game-card .game-iframe-new li {
        flex: 0 0 160px; /* 从 140px 增加到 160px */
        /* 固定卡片高度，确保跨语言一致性 */
        height: 140px;
        min-height: 140px;
        max-height: 140px;
    }
    
    /* 增大卡片间距，便于触摸 */
    .game-card .game-iframe-pop ul,
    .game-card .game-iframe-new ul {
        gap: var(--spacing-lg, 16px); /* 从 12px 增加到 16px */
    }

    /* 卡片标题两行显示，避免截断 */
    .game__title--ellipsis {
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        white-space: normal;
        font-size: 13px;
        line-height: 1.3;
    }
}
