/* ── Page wrapper ─────────────────────────────── */
.game-page-wrap {
    width: var(--all-width);
    margin: 20px auto;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}
/* ── Top bar ──────────────────────────────────── */
.game-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #1a1a1a;
    min-height: 46px;
}

.game-topbar-title {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 100px);
}

.game-topbar-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.topbar-btn {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    cursor: pointer;
    border: none;
    outline: none;
}

.topbar-btn:hover {
    background: rgba(255, 255, 255, .22);
}

.topbar-btn svg {
    width: 17px;
    height: 17px;
}

/* ── Frame wrapper ────────────────────────────── */
.game-frame-wrap {
    position: relative;
    width: 100%;
    /* Fixed 16:9 aspect ratio — all games same size */
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.game-frame-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Fullscreen override */
.game-frame-wrap.is-fullscreen,
.game-frame-wrap:fullscreen {
    width: 100vw;
    height: 100vh;
    aspect-ratio: unset;
    border-radius: 0;
}

.game-frame-wrap:fullscreen iframe,
.game-frame-wrap.is-fullscreen iframe {
    width: 100%;
    height: 100%;
}

/* ── Cover / splash ───────────────────────────── */
.game-cover {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cover-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(10px) brightness(.45);
    transform: scale(1.08);
}

.cover-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 30px 24px;
    text-align: center;
}

.cover-thumb {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, .8);
    flex-shrink: 0;
    background: #333;
}

.cover-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cover-title {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .7);
    max-width: 480px;
    line-height: 1.3;
}

.cover-category {
    color: rgba(255, 255, 255, .7);
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.cover-play-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 36px;
    background: #fff;
    color: #111;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: background .2s, color .2s, transform .15s;
    margin-top: 6px;
}

.cover-play-btn svg {
    width: 20px;
    height: 20px;
}

.cover-play-btn:hover {
    background: #111;
    color: #fff;
    transform: scale(1.04);
}

/* ── Meta bar ─────────────────────────────────── */
.game-metabar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f7f7f7;
    border-top: 1px solid #e8e8e8;
    font-size: 12px;
    color: #888;
}

.meta-category {
    color: #e05a00;
    font-weight: 600;
    font-size: 12px;
}

.meta-sep { color: #ccc; }

.meta-hint {
    display: flex;
    align-items: center;
    gap: 4px;
}

.meta-hint kbd {
    background: #eee;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 11px;
    font-family: inherit;
    color: #444;
}

/* ── Share wrap spacing ───────────────────────── */
.share-wrap {
    width: var(--all-width);
    margin: 0 auto;
    padding: 0 0 10px;
}

/* ── Fullscreen exit button (shown only in fullscreen) ── */
.fs-exit-btn {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 9999;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    border: 2px solid rgba(255, 255, 255, .5);
    color: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background .2s, transform .15s;
    /* large tap target for mobile */
    touch-action: manipulation;
}

.fs-exit-btn svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.fs-exit-btn:hover {
    background: rgba(0, 0, 0, .8);
    transform: scale(1.08);
}

/* show it when the wrapper is fullscreen */
.game-frame-wrap:fullscreen .fs-exit-btn,
.game-frame-wrap.is-fullscreen .fs-exit-btn {
    display: flex;
}
@media (max-width: 799px) {
    /* 游戏页面撑满整个视口 */
    body:has(.game-page-wrap) {
        overflow: hidden;
        height: 100dvh;
        height: 100vh;
        display: flex;
        flex-direction: column;
    }

    body:has(.game-page-wrap) main {
        flex: 1;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        padding: 0;
    }

    .game-page-wrap {
        margin: 0;
        border-radius: 0;
        border: none;
        flex: 1;
        overflow: hidden;
    }

    .game-frame-wrap {
        aspect-ratio: unset;
        flex: 1;
        min-height: 0;
    }

    .cover-title {
        font-size: 16px;
    }

    .cover-thumb {
        width: 80px;
        height: 80px;
    }

    .cover-play-btn {
        padding: 10px 28px;
        font-size: 15px;
    }

    .game-topbar-title {
        font-size: 13px;
    }

}
