/* Shared material and close controls for player-site dialogs. */
:root {
    --game-modal-surface: url('/images/profile-felt.svg') 0 0 / 180px 180px repeat,
        radial-gradient(ellipse at 8% 0, #443426 0, transparent 64%),
        linear-gradient(145deg, #29231e, #191819);
    --game-modal-blend: soft-light, normal, normal;
    --game-modal-edge: #aa8148;
    --game-modal-shadow: 0 24px 66px #0008, inset 0 1px #f6d99a55, inset 0 0 0 3px #1b1816;
}

/* Component styles still own dimensions, positioning and game states. */
body .modal:not(#profileModal) .modal-dialog > .modal-content,
body :is(.blot-score, .blot-result, .blot-levelup, .blot-trump-modal, .wheel-reward-modal):not(#profileModal) {
    color: #fff5df;
    background: var(--game-modal-surface) !important;
    background-blend-mode: var(--game-modal-blend) !important;
    border: 1px solid var(--game-modal-edge) !important;
    border-radius: 24px;
    box-shadow: var(--game-modal-shadow) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body .modal:not(#profileModal) .modal-dialog > .modal-content { position: relative; }

/* Retire old shell overlays while preserving icons and content decorations. */
body .modal:not(#profileModal) .modal-dialog > .modal-content::before,
body .modal:not(#profileModal) .modal-dialog > .modal-content::after { display: none !important; }

body .modal:not(#profileModal) .modal-header {
    position: static;
    padding-right: 60px;
    background: transparent !important;
    border-bottom-color: #b58e4938 !important;
}

body .modal:not(#profileModal) .modal-footer {
    background: transparent !important;
    border-top-color: #b58e4938 !important;
}

body .modal:not(#profileModal) :is(.modal-title, h2, h3, h4, h5) { color: #fff0d5; }

/* Icon close controls only: footer buttons remain in their normal flow. */
body .modal:not(#profileModal) :is(.profile-close, .vip-close, .tournament-modal-close, .language-picker-close, .invite-friend-close, .game-leave-close, .payment-method-close, .payment-success-close, .btn-close) {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    bottom: auto !important;
    left: auto !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px;
    min-height: 44px;
    margin: 0 !important;
    padding: 0 !important;
    float: none;
    transform: none !important;
    color: #d2b98b !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    filter: none !important;
    font-size: 22px !important;
    line-height: 1;
    opacity: 1 !important;
    z-index: 5;
}

body .modal:not(#profileModal) .btn-close::before { content: "×"; font-size: 28px; line-height: 1; }

body .modal:not(#profileModal) :is(.profile-close, .vip-close, .tournament-modal-close, .language-picker-close, .invite-friend-close, .game-leave-close, .payment-method-close, .payment-success-close, .btn-close):hover {
    color: #fff0ce !important;
    background: #e6ba6612 !important;
}

body .modal:not(#profileModal) :is(.profile-close, .vip-close, .tournament-modal-close, .language-picker-close, .invite-friend-close, .game-leave-close, .payment-method-close, .payment-success-close, .btn-close):focus-visible {
    outline: 2px solid #f1cb76;
    outline-offset: -2px;
}

@media (max-width: 420px), (max-height: 440px) {
    body .modal:not(#profileModal) .modal-dialog > .modal-content,
    body :is(.blot-score, .blot-result, .blot-levelup, .blot-trump-modal, .wheel-reward-modal):not(#profileModal) {
        border-radius: 20px;
        box-shadow: 0 12px 28px #0006, inset 0 1px #f6d99a55, inset 0 0 0 3px #1b1816 !important;
    }
}

/* Consistent warm backdrop on desktop and mobile. */
body .modal-backdrop { background:#211c19!important; }

/* Leave-game decisions use the same textured, warm button language. */
#gameLeaveConfirmModal .modal-footer { gap:10px; }
#gameLeaveConfirmModal .modal-footer .btn { flex:1; margin:0; min-height:42px; padding:9px 16px; border-radius:12px; font-weight:700; border:1px solid #b497615e; color:#f4e5c8; background:url('/images/profile-felt.svg') 0 0/180px 180px repeat,linear-gradient(145deg,#514638,#332e29); background-blend-mode:soft-light,normal; box-shadow:inset 0 1px #ffe8ba15,0 3px 0 #201b17; }
#gameLeaveConfirmModal .modal-footer #confirmGameLeaveBtn { background:url('/images/profile-felt.svg') 0 0/180px 180px repeat,linear-gradient(145deg,#855044,#62372f); border-color:#be8973; color:#fff0df; }
#gameLeaveConfirmModal .modal-footer .btn:hover { filter:brightness(1.1); }
#gameLeaveConfirmModal .modal-footer .btn:focus-visible { outline:2px solid #edca7e; outline-offset:3px; }
#gameLeaveConfirmModal .modal-footer .btn:active { transform:translateY(2px); box-shadow:inset 0 1px #ffe8ba15; }

/* Friends table keeps its green felt material within the shared modal shell. */
#friendTableModal {
 --game-modal-surface: url('/images/profile-felt.svg') 0 0 / 180px 180px repeat, radial-gradient(ellipse at 8% 0, #286e50 0, transparent 64%), linear-gradient(145deg, #18543e, #10372c);
 --game-modal-edge: #6c9167;
 --game-modal-shadow: 0 24px 66px #0008, inset 0 1px #c2e2b833, inset 0 0 0 3px #153c2e;
}
