.game-chat{position:fixed;right:max(16px,env(safe-area-inset-right));bottom:max(16px,env(safe-area-inset-bottom));width:min(340px,calc(100vw - 32px));z-index:12;color-scheme:light;color:#25251e;font:13px Arial,sans-serif;pointer-events:none}
.game-chat [hidden]{display:none!important}.game-chat-panel,.game-chat-toggle{pointer-events:auto;box-shadow:0 5px 22px #0005;border:1px solid #d2d0c2;border-radius:6px;background:rgba(250,249,241,.86)}
.game-chat-panel{display:flex;flex-direction:column;height:min(300px,48svh);padding:12px;backdrop-filter:blur(5px);-webkit-backdrop-filter:blur(5px);border-top:3px solid #f4d52c}
.game-chat .chat-heading{padding-bottom:8px;flex:none}.game-chat h2{display:flex;align-items:center;gap:8px;font-size:11px;font-weight:900;letter-spacing:.07em;margin:0}.game-chat .ui-icon{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.game-chat button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation}.game-chat button:focus-visible,.game-chat input:focus-visible,.game-chat ol:focus-visible{outline:2px solid #bf1515;outline-offset:2px}.game-chat-hide{display:grid;place-items:center;width:32px;height:30px;border:1px solid #bcbcaf;border-radius:4px;background:#ffffff70}.game-chat-hide svg{width:15px}
.game-chat-scroll{position:relative;min-height:0;flex:1;margin:4px 0 9px}.game-chat ol{height:100%;overflow:auto;overscroll-behavior:contain;margin:0;padding:0 5px 0 0;list-style:none;scrollbar-width:thin;scrollbar-color:#b9b6a7 transparent;scrollbar-gutter:stable;scroll-behavior:auto}.game-chat .chat-message{padding:7px 0;border-bottom-color:#96958645}.game-chat .chat-message p{font-size:12px;color:#24241d}.game-chat .chat-message time{color:#55564d}.game-chat .chat-message strong{font-size:11px;color:#a01818}.game-chat .chat-empty{position:absolute;inset:0;display:grid;align-content:center;text-align:center;color:#56564b;pointer-events:none;font-size:12px;line-height:1.6;margin:0}
.game-chat .chat-form{grid-template-columns:minmax(0,1fr) 38px;gap:7px}.game-chat input{box-sizing:border-box;width:100%;min-width:0;min-height:38px;border:1px solid #aaa99c;border-radius:4px;background:#fff9;padding:8px 10px;font:13px Arial,sans-serif;color:#24241d}.game-chat-send{border:1px solid #aa972e;border-radius:4px;background:#ffe64b;display:grid;place-items:center}.game-chat-send:disabled{opacity:.45;cursor:default}.game-chat-feedback{font-size:10px;color:#55564b;min-height:12px;margin:6px 0 0;line-height:1.3}
.game-chat-new-anchor{position:absolute;inset:auto 8px 6px;display:flex;justify-content:center;pointer-events:none}.game-chat-new{pointer-events:auto;min-width:148px;max-width:100%;min-height:30px;white-space:nowrap;border:1px solid #aa972e;border-radius:16px;padding:5px 12px;background:#ffe64b;font-size:11px!important}.game-chat-toggle{float:right;display:flex;align-items:center;gap:9px;min-height:42px;padding:9px 13px;font-size:11px!important;font-weight:800!important;letter-spacing:.05em}.game-chat .unread-badge{display:inline-grid;place-items:center;min-width:20px;min-height:20px;background:#b71414;color:#fff;font-size:11px;border-radius:12px;padding:0 4px}.launcher-open .game-chat{display:none}
/* Keep scrollbars in the same quiet ivory/grey palette as the room UI. */
.game-chat ol::-webkit-scrollbar,#chatLog::-webkit-scrollbar{width:8px}
.game-chat ol::-webkit-scrollbar-track,#chatLog::-webkit-scrollbar-track{background:transparent}
.game-chat ol::-webkit-scrollbar-thumb,#chatLog::-webkit-scrollbar-thumb{background:#b9b6a7;border:2px solid transparent;background-clip:padding-box;border-radius:8px}
.game-chat ol::-webkit-scrollbar-thumb:hover,#chatLog::-webkit-scrollbar-thumb:hover{background-color:#918d7d}
#chatLog{color-scheme:light;scrollbar-gutter:stable;scroll-behavior:auto}
.chat-new-anchor{position:absolute;inset:auto 8px 4px;display:flex;justify-content:center;pointer-events:none}
#menuDialog .room-panel .chat-new-anchor .new-messages{position:static;transform:none;pointer-events:auto;min-width:148px;max-width:100%}
#menuDialog .room-panel .chat-new-anchor .new-messages:is(:hover,:active,:focus-visible){transform:none}
/* Compact desktop windows retain a bounded floating panel. */
@media(max-height:500px){
 .game-chat{bottom:max(8px,env(safe-area-inset-bottom));right:max(8px,env(safe-area-inset-right));width:min(300px,calc(100vw - 16px))}
 .game-chat-panel{height:240px;max-height:calc(100dvh - 24px);padding:9px}.game-chat .chat-message{padding:5px 0}
}
/* The collapsed shortcut clears the gears; the open conversation overlays them. */
@media(pointer:coarse){
 .game-chat{--chat-mobile-bottom:calc(max(180px,178px * var(--touch-button-scale,1)) + env(safe-area-inset-bottom));left:auto;right:max(12px,env(safe-area-inset-right));width:min(440px,calc(100vw - max(12px,env(safe-area-inset-left)) - max(12px,env(safe-area-inset-right))))}
 .game-chat:not(.chat-collapsed){top:calc(var(--chat-panel-top,12px) + env(safe-area-inset-top));bottom:auto;height:calc(var(--chat-panel-height,min(460px,calc(100dvh - 24px))) - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
 .game-chat-panel{box-sizing:border-box;height:100%;max-height:none;min-height:0;padding:12px;background:rgba(250,249,241,.94)}
 .game-chat .chat-heading,.game-chat .chat-form,.game-chat-feedback{flex-shrink:0}
 .game-chat .chat-heading{min-height:44px}.game-chat-scroll{min-height:0;margin:4px 0 10px}
 .game-chat input{font-size:16px}.game-chat :is(button,input){min-height:44px!important}
 .game-chat .game-chat-hide{width:44px;height:44px;min-width:44px}
 .game-chat .chat-form{grid-template-columns:minmax(0,1fr) 44px}
 .game-chat-feedback{min-height:0;margin:6px 0 0}
 .game-chat.chat-short-viewport:not(.chat-collapsed){top:var(--chat-panel-top);height:var(--chat-panel-height)}
 .game-chat.chat-short-viewport .game-chat-panel{padding:8px}
 .game-chat.chat-short-viewport .game-chat-feedback{display:none}
 .game-chat.chat-short-viewport .chat-heading{padding-bottom:4px}
 .game-chat.chat-short-viewport .game-chat-scroll{margin:0 0 6px}
 .game-chat.chat-collapsed{top:auto;left:auto;right:max(18px,env(safe-area-inset-right));bottom:var(--chat-mobile-bottom);height:auto;width:auto}
 .game-chat-toggle{float:none;min-height:44px;gap:6px;padding:7px 10px;font-size:10px!important;border-radius:5px}
 .game-chat-toggle .ui-icon{width:16px;height:16px}.game-chat-toggle .unread-badge{min-width:18px;min-height:18px;font-size:10px}
}
@media(pointer:coarse) and (max-height:500px){
 .game-chat{--chat-mobile-bottom:calc(max(166px,164px * var(--touch-button-scale,1)) + env(safe-area-inset-bottom))}
}
