#chat-toggle[hidden],#chat-panel[hidden]{display:none!important}
#chat-toggle{position:absolute;top:100px;right:14px;z-index:20;min-height:44px;border:1px solid #ead99e;border-radius:24px;background:#f7f0d8;color:#173c32;font:700 16px Arial,sans-serif;padding:0 16px;box-shadow:0 3px 9px #0002;width:auto;margin:0}
#chat-toggle.unread::after{content:'';display:inline-block;width:8px;height:8px;border-radius:50%;background:#ee4545;margin-right:8px}
#chat-panel{position:absolute;top:94px;left:10px;right:10px;height:154px;z-index:21;background:#f9f5e8;border:1px solid #dcc17f;border-radius:16px;box-shadow:0 6px 20px #0003;overflow:hidden;color:#173c32;display:flex;flex-direction:column;text-align:right;font:15px Arial,sans-serif}
.chat-head{flex:0 0 40px;background:#174a39;color:#f9f1d4;display:flex;align-items:center;justify-content:space-between;padding:0 12px;font-size:16px}
.chat-head button{min-height:40px;min-width:44px;background:none;color:#f9f1d4;font-size:24px;border:0;padding:0;margin:0;width:auto;box-shadow:none}
#chat-messages{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;display:flex;flex-direction:column;gap:6px;padding:8px 10px;scrollbar-width:thin}
.chat-bubble{flex-shrink:0;max-width:85%;padding:6px 10px;border-radius:12px;align-self:flex-end;background:#e9e0c8;overflow-wrap:anywhere;white-space:pre-wrap;text-align:start}
.chat-bubble.mine{align-self:flex-start;background:#d7e7d8}.chat-bubble small{display:block;font-size:10px;color:#4f6655;margin-bottom:2px}.chat-bubble span{unicode-bidi:plaintext}.chat-empty{font-size:13px;color:#526653;margin:auto;text-align:center}
.chat-compose{flex:0 0 48px;border-top:1px solid #e5dcc8;display:flex;gap:6px;padding:5px 8px;align-items:center;margin:0}.chat-compose input{flex:1;min-width:0;width:auto;height:38px;min-height:38px;border:1px solid #d8cfb8;border-radius:20px;background:white;color:#173c32;padding:7px 12px;font:16px Arial,sans-serif;margin:0}.chat-compose button{width:auto;min-height:38px;margin:0;background:#174a39;color:white;border:0;border-radius:20px;padding:0 12px;font:14px Arial,sans-serif}#chat-status{font-size:12px;line-height:16px;margin:0;padding:0 10px;color:#7b3328;flex-shrink:0}#chat-status:empty{display:none}
body.four-mode #chat-toggle,body.four-mode #chat-panel{top:174px}body.four-mode #chat-panel{height:130px}
@media(max-height:600px){#chat-panel{top:94px;height:154px}body.four-mode #chat-panel{top:168px;height:126px}}

body.chat-typing #chat-panel{position:fixed;top:8px;bottom:auto;left:18px;right:18px;height:min(220px,calc(100dvh - 20px));z-index:90}

/* Proposed closed-keyboard two-player layout; keep focused keyboard and four-player rules. */
body:not(.chat-typing):not(.four-mode) #chat-panel{top:94px;height:142px}
body:not(.chat-typing):not(.four-mode) .chat-head{flex:0 0 44px}
body:not(.chat-typing):not(.four-mode) .chat-head button{min-height:44px}
body:not(.chat-typing):not(.four-mode) #chat-messages{padding:2px 8px;gap:4px}
body:not(.chat-typing):not(.four-mode) .chat-bubble{padding:3px 8px}
body:not(.chat-typing):not(.four-mode) .chat-bubble small{display:inline;margin:0;margin-inline-end:6px}
body:not(.chat-typing):not(.four-mode) .chat-compose{flex:0 0 44px;padding:0 7px}
body:not(.chat-typing):not(.four-mode) .chat-compose input{height:36px;min-height:36px;padding:5px 12px}
body:not(.chat-typing):not(.four-mode) .chat-compose button{height:44px;min-height:44px;min-width:44px}
/* Proposed permanent two-player positions, independent of chat visibility. */
body:not(.chat-typing):not(.four-mode) .game .table-stage.has-scene::before,
body:not(.chat-typing):not(.four-mode) .game .table-stage.has-scene::after{top:max(50%,340px)}
body:not(.chat-typing):not(.four-mode) .game .table-stage #table{position:absolute;top:225px;bottom:12px;padding-top:0;align-content:center;min-height:0}
@media(max-height:650px){
body:not(.chat-typing):not(.four-mode) .game .table-stage.has-scene::before,
body:not(.chat-typing):not(.four-mode) .game .table-stage.has-scene::after{width:67px;height:160px;background-size:67px 160px}
body:not(.chat-typing):not(.four-mode) .game .table-stage #table{position:absolute;top:225px;bottom:12px;padding-top:0;align-content:center;min-height:0}
}
/* Preview-only raised turn label, independent from permanent scene positions. */
body.in-game:not(.four-mode) .game>.table-label{top:56px}

/* DENSE-TABLE PROPOSAL (not user-approved): driven by table-fit.js for 2p, keyboard-open and 4p; natural layout is untouched while data-fit is absent or "plain". */
body .game .table-stage #table[data-fit=overlap],body .game .table-stage #table[data-fit=overflow]{row-gap:var(--rg,5px);padding-bottom:calc(var(--pb0,0px) + var(--ov,0px) + 5px)}
body .game .table-stage #table[data-padx]{padding-left:var(--padx);padding-right:var(--padx)}
body .game .table-stage #table[data-fit=overlap] .card,body .game .table-stage #table[data-fit=overflow] .card{margin-bottom:calc(-1*var(--ov,0px))}
body .game .table-stage #table[data-scaled] .card{width:calc(var(--bw)*var(--k));height:calc(var(--bh)*var(--k));font-size:calc(14px*var(--k));padding:calc(3px*var(--k))}
body .game .table-stage #table[data-scaled] .card .pip{top:calc(27px*var(--k));left:calc(17px*var(--k));font-size:calc(20px*var(--k))}
body .game .table-stage #table[data-fit=overlap] .card.selected,body .game .table-stage #table[data-fit=overflow] .card.selected{outline-offset:-4px;background:#f6e9b8}

/* 2p real DOM: empty status blocks add 24px of margin above the stage so the score pill sat 24px lower than in the approved layout and covered the raised turn label. Empty blocks take no space. */
body.in-game:not(.four-mode) :is(#four-seats,#dealer-label,#opening-specials,#redeal-notice):empty{display:none}

#chat-mute{font-size:13px;padding:6px 9px;white-space:nowrap}#chat-muted-note{font-size:13px;line-height:1.5;padding:8px;background:#fff4cd;color:#443815;margin:4px 10px;border-radius:8px}.chat-head{flex-wrap:wrap;gap:6px}

#chat-muted-note{flex:0 0 auto;margin:0;padding:3px 8px;font-size:12px;line-height:15px;border-radius:0}#chat-panel .chat-compose{flex-shrink:0}#chat-panel #chat-messages{flex-shrink:1}
