/* =============================================
   PlayJoy - Warm Minimal / 暖色极简排版
   与旧版：布局结构完全不同
   - 卡片从 Grid 6列 → 3列大卡片
   - 标题从图片覆盖层 → 图片下方独立区域
   - 搜索框从右侧小框 → 顶部全宽横幅
   - 导航从标签页 → 胶囊按钮组
   - detail页从居中竖排 → 左右双栏
   ============================================= */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    min-height: 100%;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #faf8f5;
    color: #2d2a26;
    line-height: 1.6;
    letter-spacing: -0.01em;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

/* ============= Page Wrapper ============= */
.page-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
}

/* ============= Header ============= */
.site-header {
    background: #ffffff;
    border-bottom: 1px solid #e8e4df;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    gap: 32px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.logo img {
    height: 34px;
    width: auto;
    object-fit: contain;
}

/* ============= Search - Full-width banner style ============= */
.search-box {
    display: flex;
    align-items: center;
    background: #f3f0eb;
    border: 2px solid transparent;
    border-radius: 14px;
    overflow: hidden;
    width: 100%;
    max-width: 520px;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
    background: #fff;
    border-color: #e8734a;
    box-shadow: 0 0 0 4px rgba(232, 115, 74, 0.1);
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    padding: 14px 20px;
    font-size: 15px;
    color: #2d2a26;
    background: transparent;
    font-family: inherit;
}

.search-box input::placeholder {
    color: #b0a99e;
}

.search-box button {
    border: none;
    background: #e8734a;
    color: #fff;
    width: 52px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    border-radius: 10px;
    margin: 4px;
    transition: background 0.2s, transform 0.1s;
}

.search-box button:hover {
    background: #d15e35;
}

.search-box button:active {
    transform: scale(0.95);
}

/* ============= Navigation - Pill buttons ============= */
.main-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 20px 18px;
    background: #ffffff;
}

.main-nav a {
    display: inline-block;
    padding: 9px 20px;
    color: #6b6560;
    font-weight: 600;
    font-size: 13px;
    border-radius: 100px;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
    letter-spacing: -0.2px;
    border: none !important;
}

.main-nav a:hover {
    background: #f3f0eb;
    color: #2d2a26;
}

.main-nav a.active {
    background: #e8734a;
    color: #ffffff;
}

.main-nav a::after {
    display: none !important;
}

/* ============= Main Content ============= */
.site-main {
    padding: 40px 0 80px;
}

/* ============= Section Header ============= */
.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 28px;
    padding: 0 4px;
}

.section-title {
    font-size: 22px;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title .icon {
    font-size: 26px;
}

.view-all {
    color: #e8734a;
    font-weight: 700;
    font-size: 14px;
    transition: color 0.2s;
}

.view-all:hover {
    color: #d15e35;
}

/* ============= Games Grid - 3列大卡片 ============= */
.games-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* ============= Game Card - 图片在上，标题在下 ============= */
.game-card {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e8e4df;
    transition: transform 0.25s, box-shadow 0.25s;
    cursor: pointer;
    /* 移除 aspect-ratio，让内容自然撑开 */
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.08);
    border-color: #d5cec5;
}

.game-card a {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.game-card img {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    background: #f3f0eb;
    transition: transform 0.4s;
}

.game-card:hover img {
    transform: scale(1.04);
}

.game-card .game-title {
    position: static; /* 不再覆盖在图片上 */
    padding: 14px 18px 18px;
    color: #2d2a26;
    font-size: 15px;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.2px;
    background: #ffffff;
    background-image: none;
    border-top: 1px solid #f3f0eb;
}

/* ============= Load More Button ============= */
.load-more {
    text-align: center;
    margin-top: 48px;
}

.load-more button {
    background: #ffffff;
    color: #e8734a;
    border: 2px solid #e8734a;
    padding: 14px 56px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 100px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    letter-spacing: -0.2px;
}

.load-more button:hover {
    background: #e8734a;
    color: #fff;
    box-shadow: 0 4px 20px rgba(232, 115, 74, 0.25);
}

.load-more button:disabled {
    background: #f3f0eb;
    color: #b0a99e;
    border-color: #e8e4df;
    cursor: not-allowed;
    box-shadow: none;
}

/* ============= Footer - 三栏布局 ============= */
.site-footer {
    background: #ffffff;
    border-top: 1px solid #e8e4df;
    color: #6b6560;
    padding: 48px 0;
}

.site-footer .page-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 32px;
}

.site-footer .footer-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 0;
}

.site-footer .footer-links a {
    font-weight: 600;
    font-size: 14px;
    color: #6b6560;
    padding: 6px 0;
    border-radius: 0;
    transition: color 0.2s;
}

.site-footer .footer-links a:hover {
    color: #e8734a;
    background: none;
}

.site-footer p {
    margin: 4px 0;
    font-size: 13px;
    color: #b0a99e;
}

/* ============= Back To Top ============= */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    background: #ffffff;
    color: #e8734a;
    border: 2px solid #e8e4df;
    border-radius: 50%;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    z-index: 90;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.back-to-top.show {
    display: flex;
}

.back-to-top:hover {
    background: #e8734a;
    color: #fff;
    border-color: #e8734a;
    box-shadow: 0 4px 20px rgba(232, 115, 74, 0.3);
    transform: translateY(-2px);
}

/* ============= Loading ============= */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(250, 248, 245, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 100001;
    transition: opacity 0.3s;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #e8734a;
    animation: bounce 0.6s infinite alternate;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
    background: #d15e35;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
    background: #e8734a;
    opacity: 0.6;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-16px); }
}

/* ============= Category Title ============= */
.category-title {
    font-size: 36px;
    font-weight: 900;
    color: #1a1a1a;
    margin-bottom: 36px;
    text-align: left;
    letter-spacing: -1px;
    padding: 0 4px;
}

/* ============= No Results ============= */
.no-results {
    text-align: center;
    padding: 80px 20px;
    color: #b0a99e;
    font-size: 17px;
}

.no-results-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.4;
}

/* =================================================================
   DETAIL PAGE - 左右双栏布局
   ================================================================= */

.game {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 32px 80px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

/* Preview - 左栏 */
.game-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: none;
    background: #f3f0eb;
    border: 1px solid #e8e4df;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.04);
}

.game-preview-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    text-align: center;
    z-index: 2;
}

.game-preview-icon {
    position: relative;
    display: inline-block;
}

.game-preview-icon img {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    object-fit: cover;
    border: 3px solid #ffffff;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

.game-preview-title {
    color: #2d2a26;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    max-width: 90%;
    line-height: 1.2;
}

.play-game-btn {
    border: none;
    background: #e8734a;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    padding: 14px 52px;
    border-radius: 100px;
    cursor: pointer;
    letter-spacing: -0.2px;
    box-shadow: 0 4px 18px rgba(232, 115, 74, 0.25);
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.play-game-btn:hover {
    background: #d15e35;
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(232, 115, 74, 0.35);
}

/* Game iframe */
.game-iframe-wrap {
    position: absolute;
    inset: 0;
    z-index: 3;
    background: #000;
    border-radius: 20px;
    overflow: hidden;
}

.game-iframe-wrap iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.game-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    color: #2d2a26;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: background 0.2s;
}

.game-close-btn:hover {
    background: #fff;
}

/* 右栏 - 按钮和介绍 */
.game-actions-bar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: none;
    margin: 0;
    padding: 0;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #ffffff;
    border: 1px solid #e8e4df;
    border-radius: 14px;
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 600;
    color: #2d2a26;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    letter-spacing: -0.2px;
}

.action-btn:hover {
    background: #faf8f5;
    border-color: #e8734a;
    box-shadow: 0 2px 12px rgba(232, 115, 74, 0.1);
}

.action-btn .icon {
    font-size: 18px;
}

.game-intro {
    background: #ffffff;
    border: 1px solid #e8e4df;
    border-radius: 14px;
    padding: 24px 28px;
    max-width: none;
    margin: 0;
}

.game-intro h2 {
    font-size: 18px;
    font-weight: 800;
    color: #1a1a1a;
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.game-intro p {
    font-size: 14px;
    color: #6b6560;
    line-height: 1.7;
}

/* 右栏包装 - 把 action bar + intro 包起来 */
.game-detail-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Install button (mobile) */
.install-btn {
    display: none;
}

.game .game-actions-bar + .game-intro {
    margin-top: 0;
}

/* Similar Games - 横跨全宽 */
.game > .similar-games-section {
    grid-column: 1 / -1;
    margin-top: 40px;
    max-width: none;
    padding: 0;
}

/* ============= Similar Games ============= */
.similar-games-section {
    max-width: 1200px;
    margin: 56px auto 0;
    padding: 0 32px;
}

.similar-games-section .section-title {
    font-size: 22px;
    font-weight: 800;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.similar-games-section .section-title .icon {
    font-size: 26px;
}

.similar-games-scroll-wrap {
    position: relative;
}

.similar-games-scroll {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 4px 24px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #d5cec5 transparent;
}

.similar-games-scroll::-webkit-scrollbar {
    height: 6px;
}

.similar-games-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.similar-games-scroll::-webkit-scrollbar-thumb {
    background: #d5cec5;
    border-radius: 10px;
}

.similar-games-scroll::-webkit-scrollbar-thumb:hover {
    background: #b0a99e;
}

.similar-game-card {
    flex: 0 0 auto;
    width: 170px;
    background: #ffffff;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e8e4df;
    transition: transform 0.25s, box-shadow 0.25s;
}

.similar-game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.07);
    border-color: #d5cec5;
}

.similar-game-card a {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.similar-game-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #f3f0eb;
    transition: transform 0.3s;
}

.similar-game-card:hover img {
    transform: scale(1.03);
}

.similar-game-card .game-title {
    position: static;
    padding: 10px 12px 14px;
    color: #2d2a26;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #ffffff;
    background-image: none;
    border-top: 1px solid #f3f0eb;
}

/* ============= Fullscreen Game ============= */
.app-module {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 99999;
}

.app-module iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
}

.app-module .game-close-btn {
    position: fixed;
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    color: #2d2a26;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 1100px) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    .game {
        grid-template-columns: 1fr;
        gap: 28px;
    }
}

@media (max-width: 900px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .page-wrapper {
        padding: 0 20px;
    }

    .header-top {
        padding: 16px 20px;
    }

    .category-title {
        font-size: 28px;
        margin-bottom: 24px;
    }

    .game {
        padding: 28px 20px 60px;
    }
}

@media (max-width: 768px) {
    .header-top {
        flex-wrap: wrap;
        gap: 14px;
    }

    .search-box {
        order: 3;
        max-width: 100%;
        margin-top: 2px;
    }

    .main-nav {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding: 8px 12px 14px;
        gap: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .main-nav::-webkit-scrollbar {
        display: none;
    }

    .main-nav a {
        font-size: 12px;
        padding: 8px 14px;
    }

    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .game-card {
        border-radius: 12px;
    }

    .game-card .game-title {
        font-size: 13px;
        padding: 10px 12px 14px;
    }

    .section-title {
        font-size: 18px;
    }

    .game {
        grid-template-columns: 1fr;
        padding: 20px 16px 40px;
    }

    .game-preview {
        border-radius: 14px;
    }

    .game-preview-icon img {
        width: 100px;
        height: 100px;
    }

    .game-preview-title {
        font-size: 20px;
    }

    .play-game-btn {
        font-size: 14px;
        padding: 12px 40px;
    }

    .action-btn {
        font-size: 14px;
        padding: 14px 20px;
    }

    .game-intro {
        padding: 20px;
    }

    .similar-games-section {
        padding: 0 20px;
        margin-top: 40px;
    }

    .similar-game-card {
        width: 145px;
    }

    .site-footer .page-wrapper {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .site-footer .footer-links {
        align-items: center;
    }
}

@media (max-width: 480px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .logo {
        font-size: 18px;
    }

    .logo img {
        height: 28px;
    }

    .search-box input {
        padding: 12px 16px;
        font-size: 14px;
    }

    .search-box button {
        width: 42px;
        height: 38px;
    }

    .game-card {
        border-radius: 10px;
    }

    .game-card img {
        aspect-ratio: 4 / 3;
    }

    .game-card .game-title {
        font-size: 12px;
        padding: 8px 10px 12px;
    }

    .category-title {
        font-size: 24px;
        margin-bottom: 20px;
    }

    .load-more button {
        padding: 12px 40px;
        font-size: 14px;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }

    /* Detail mobile */
    .game {
        padding: 14px 12px 32px;
        gap: 20px;
    }

    .game-preview {
        border-radius: 12px;
        aspect-ratio: auto;
        border: none;
        box-shadow: none;
        background: transparent;
    }

    .game-preview-inner {
        position: static;
        gap: 8px;
        padding: 8px 0 0;
    }

    .game-preview-icon img {
        width: 150px;
        height: 150px;
        border-radius: 24px;
    }

    .play-game-btn {
        position: absolute;
        left: 50%;
        bottom: 8px;
        transform: translateX(-50%);
        font-size: 13px;
        padding: 8px 28px;
    }

    .install-btn {
        position: absolute;
        top: -6px;
        right: -6px;
        width: 38px;
        height: 38px;
        border: none;
        border-radius: 50%;
        background: #e8734a;
        color: #fff;
        font-size: 24px;
        font-weight: 700;
        line-height: 1;
        cursor: pointer;
        box-shadow: 0 3px 12px rgba(232,115,74,0.35);
        transition: transform 0.2s;
        z-index: 5;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .install-btn:hover {
        transform: scale(1.08);
    }

    .game-preview-title {
        font-size: 20px;
        margin-top: 4px;
        color: #2d2a26;
    }

    .game-actions-bar {
        margin-top: 0;
    }

    .action-btn {
        font-size: 13px;
        padding: 12px 16px;
    }

    .game-intro {
        padding: 16px;
        border-radius: 12px;
    }

    .game-intro h2 {
        font-size: 16px;
        color: #1a1a1a;
    }

    .game-intro p {
        font-size: 13px;
        color: #6b6560;
    }

    .similar-games-section {
        padding: 0 12px;
        margin-top: 32px;
    }

    .similar-games-section .section-title {
        font-size: 16px;
        color: #1a1a1a;
    }

    .similar-games-scroll {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        overflow-x: visible;
        padding: 0;
    }

    .similar-game-card {
        width: 100%;
    }

    .similar-game-card .game-title {
        font-size: 11px;
        padding: 6px 8px 10px;
    }
}
