/* 独立桌游页：顶栏与全站子页一致（沿用 common .page-container，不收窄边距/全宽） */
html:has(body.card-game-page) {
    font-size: 100%;
}

body.card-game-page.page-container {
    font-size: 16px;
    line-height: 1.6;
    padding-bottom: 16px;
}

body.card-game-page.page-container > footer.site-footer {
    margin-top: 0.5rem;
    position: relative;
    z-index: 2;
}

/* 离开等按钮：fixed 在右下角，压在牌桌滚动内容之上 */
body.card-game-page .chat {
    z-index: 3;
}

.grey {
    color: #999;
}

.nopadding {
    padding-left: 0;
    padding-right: 0;
}

.card-game-page .list-all {
    margin-bottom: 8px;
}

.myToast {
    font-family: inherit;
}

/* 牌桌舞台 + 装饰层；底栏在 .card-game-dock（viewport 内、stage 外） */
.card-game-stage {
    position: relative;
    width: 760px;
    max-width: 100%;
    margin: 0 auto 0;
    min-height: 520px;
}

.card-game-viewport {
    position: relative;
    width: 100%;
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
}

.card-game-viewport > .card-game-dock {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    width: 100%;
    max-width: 700px;
    margin: 4px auto 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    text-align: center;
    box-sizing: border-box;
    padding: 0 8px;
    z-index: 2;
}

.card-game-stage .decor,
.card-game-stage .tutor-svg-2 {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
}

.card-game-stage .decor {
    width: 600px !important;
    max-width: 90%;
}

.card-game-stage .tutor-svg-2 {
    width: 500px !important;
    max-width: 85%;
}

.bodypad.uno,
.bodypad.texas,
.bodypad.hearts {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    width: 760px !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 520px !important;
    margin: 0 auto !important;
    z-index: 1;
}

.bodypad.uno .uno-svg,
.bodypad.uno .tutor-svg,
.bodypad.texas .texas-svg,
.bodypad.texas .tutor-svg,
.bodypad.hearts .hearts-svg,
.bodypad.hearts .tutor-svg {
    position: absolute !important;
    left: 50% !important;
    top: 40px !important;
    transform: translateX(-50%) !important;
    width: 500px !important;
    overflow: visible;
}

.bodypad.uno .uno-btns,
.bodypad.texas .texas-btns,
.bodypad.hearts .hearts-btns {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    top: 270px !important;
    transform: none !important;
    margin: 0 !important;
    width: auto !important;
    padding: 0 8px;
    box-sizing: border-box;
    text-align: center;
    white-space: nowrap;
    z-index: 2;
    pointer-events: auto;
}

@media (max-width: 960px) {
    .card-game-stage {
        width: 100%;
        min-height: auto;
        margin-bottom: 0;
    }

    .bodypad.uno,
    .bodypad.texas,
    .bodypad.hearts {
        min-width: 0 !important;
        min-height: auto !important;
        width: 100% !important;
        margin-top: 0 !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .card-game-viewport > .card-game-dock {
        max-width: 100%;
    }

    .bodypad.uno .uno-btns,
    .bodypad.texas .texas-btns,
    .bodypad.hearts .hearts-btns {
        margin-left: 0 !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
    }
}

@media (max-width: 767.98px) {
    body.card-game-page.shell-active {
        --card-game-dock-h: 52px;
    }

    body.card-game-page.card-game-playing.shell-active .page-header,
    body.card-game-page.card-game-playing.shell-active .site-footer {
        display: none;
    }

    body.card-game-page.card-game-playing.shell-active .card-game-viewport {
        margin-top: -8px;
    }

    body.card-game-page.shell-active .card-game-viewport:has(> .card-game-dock:not(:empty)) {
        padding-bottom: 10px;
    }

    body.card-game-page.card-game-playing.shell-active .card-game-viewport:has(> .card-game-dock:not(:empty)) {
        padding-bottom: 4px;
    }

    .card-game-viewport {
        --card-scale-num: 1;
        width: 100%;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        overflow-x: hidden;
        overflow-y: visible;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        min-height: calc(500px * var(--card-scale-num));
    }

    .card-game-viewport > .card-game-stage {
        position: relative;
        flex-shrink: 0;
        width: 760px !important;
        max-width: none;
        min-height: 500px !important;
        height: auto;
        margin: 0 !important;
        overflow: visible;
        transform: scale(var(--card-scale-num));
        transform-origin: top center;
        margin-bottom: calc(500px * (var(--card-scale-num) - 1));
    }

    .bodypad.uno,
    .bodypad.texas,
    .bodypad.hearts {
        transform: none !important;
        width: 760px !important;
        max-width: none !important;
        min-height: 500px !important;
        margin-bottom: 0 !important;
    }

    .bodypad.uno .uno-svg,
    .bodypad.uno .tutor-svg,
    .bodypad.texas .texas-svg,
    .bodypad.texas .tutor-svg,
    .bodypad.hearts .hearts-svg,
    .bodypad.hearts .tutor-svg {
        width: 500px !important;
        max-width: none !important;
    }

    .card-game-stage .decor,
    .card-game-stage .tutor-svg-2 {
        max-width: none !important;
    }

    .card-game-stage .decor {
        width: 600px !important;
    }

    .card-game-stage .tutor-svg-2 {
        width: 500px !important;
    }

    body.card-game-page.shell-active .card-game-viewport > .card-game-dock:not(:empty) {
        position: fixed !important;
        top: auto !important;
        bottom: calc(var(--shell-bottom-h, 56px) + env(safe-area-inset-bottom, 0px) + 6px) !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100vw !important;
        margin: 0 !important;
        padding: 0 8px;
        box-sizing: border-box;
        z-index: 102;
        pointer-events: auto;
    }

    .card-game-page .card-game-dock .btn-group {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-content: center;
        gap: 6px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .card-game-page .texas-btns-down .btn-group .btn-danger {
        order: 1;
        flex: 1 1 calc(33% - 6px);
        min-width: 4.5rem;
        max-width: 100%;
    }

    .card-game-page .texas-btns-down .btn-group .btn-default {
        order: 2;
        flex: 1 1 calc(33% - 6px);
        min-width: 4.5rem;
        max-width: 100%;
    }

    .card-game-page .texas-btns-down .btn-group .btn-primary {
        order: 3;
        flex: 0 1 auto;
    }

    .card-game-page .uno-btns-down .btn-group .btn-default {
        order: 1;
        flex: 1 1 calc(40% - 6px);
        min-width: 4.5rem;
    }

    .card-game-page .uno-btns-down .btn-group .btn-primary {
        order: 2;
        flex: 1 1 calc(40% - 6px);
        min-width: 4.5rem;
    }

    .card-game-page.shell-active .card-game-dock .btn {
        padding: 5px 8px;
        font-size: 12px;
    }

    .card-game-page .card-game-dock .btn-group > .btn + .btn {
        margin-left: 0;
    }

    .card-game-page .card-game-dock {
        color: #555;
        line-height: 1.6;
    }

    body.card-game-page.shell-active .chat {
        bottom: calc(
            var(--shell-bottom-h) + env(safe-area-inset-bottom, 0px) +
            var(--card-game-dock-h, 52px) + 10px
        ) !important;
        right: 16px !important;
        z-index: 103;
    }

}
