/* Friends chat: live HTML text and avatars, no game background baked into the panel. */
.room-chat{--chat-gold:#f5bb30;--chat-ink:#563116;--chat-left:50vw;--chat-width:min(460px,94vw);--chat-top:12dvh;font-family:'Trebuchet MS',Arial,sans-serif}
.room-chat .chat-launch{border:2px solid #f5bd45;border-radius:18px;background:linear-gradient(#fffce9,#ffe8a9);box-shadow:inset 0 0 0 2px #fff8d6,0 3px 5px #49230b55;color:#5c3518;white-space:nowrap}
.room-chat .chat-launch>svg{width:24px;height:24px;color:#fff3be;filter:drop-shadow(0 1px 1px #694013);flex-shrink:0}
.room-chat .chat-launch span:empty{display:none}
.room-chat .chat-panel,.room-chat.chat-anchored .chat-panel{position:fixed;left:var(--chat-left);top:var(--chat-top);right:auto;bottom:auto;transform:translateX(-50%);width:var(--chat-width);max-height:calc(100dvh - var(--chat-top) - 16px);overflow:hidden;padding:0;display:flex;flex-direction:column;border:5px solid #f9c23e;border-radius:30px;background:linear-gradient(120deg,#fffdf0,#fff2d5);box-shadow:0 0 0 1px #90450d,inset 0 0 0 2px #fff6b7,0 4px 0 #b36b12,0 8px 0 -2px #f7c650,0 16px 25px #341b1070;color:var(--chat-ink);isolation:isolate}
.room-chat .chat-panel[hidden],.room-chat .chat-settings[hidden]{display:none}
.room-chat .chat-panel header{flex-shrink:0;display:flex;gap:10px;align-items:center;padding:14px 12px;background:radial-gradient(ellipse at 30% 0,#2da96899,transparent 65%),linear-gradient(#008a50,#00643a);border-bottom:4px solid #e6a52c;box-shadow:inset 0 2px 0 #c5ffb388,inset 0 -3px 0 #003d2d;color:#fff5cd}
.room-chat .chat-panel header>strong{flex:1;min-width:0;font:bold clamp(18px,4.7vw,25px)/1.1 'Trebuchet MS',Arial,sans-serif;letter-spacing:-.6px;text-shadow:0 2px 1px #183c1c,0 3px 2px #002e27;white-space:nowrap}
.room-chat .chat-header-icon{display:grid;place-items:center;width:38px;height:38px;flex-shrink:0;border:2px solid #f5c341;border-radius:50%;background:linear-gradient(#fffbdc,#efcf77);box-shadow:0 2px 3px #00372988;color:#fff7d4}
.room-chat .chat-header-icon svg{width:26px;height:26px;filter:drop-shadow(0 1px 1px #6d4a20)}
.room-chat .chat-panel header button{display:grid;place-items:center;flex-shrink:0;width:35px;height:35px;min-height:35px;padding:0;border:2px solid #ffdc77;border-radius:50%;box-shadow:0 0 0 1px #6d4219,inset 0 0 0 2px #ffffff55,0 3px 3px #003a2599;font:bold 18px Arial;color:#fff8da;background:linear-gradient(#0f9e63,#006a40)}
.room-chat .chat-panel header .chat-close{background:linear-gradient(#f94d3e,#c51a14);width:39px;height:39px}
.room-chat .chat-close svg{width:23px;height:23px;fill:none;stroke:#fff6df;stroke-width:4;stroke-linecap:round;filter:drop-shadow(0 1px 1px #89130d)}
.room-chat .chat-settings{padding:6px 14px;background:#fff2c9;border-bottom:1px solid #dfbd78}.room-chat .chat-settings label{font:13px/1.3 Arial;color:#57381c;margin:0;min-height:34px}.room-chat .chat-settings input{accent-color:#00844b}
.room-chat .chat-log{flex:1 1 auto;min-height:110px;height:clamp(160px,31dvh,290px);padding:18px 15px 10px;background:radial-gradient(ellipse at 50% 20%,#fffef6,#fff2d700);border-radius:0;scrollbar-width:thin;scrollbar-color:#d5af65 transparent;overscroll-behavior:contain}
.room-chat .chat-message{display:flex;align-items:center;gap:9px;margin:0 0 17px;--player-color:#bb8616}.room-chat .chat-message[data-color=red]{--player-color:#ce3029}.room-chat .chat-message[data-color=blue]{--player-color:#087ac2}.room-chat .chat-message[data-color=green]{--player-color:#008c4f}
.room-chat .chat-message.is-own{flex-direction:row-reverse}
.room-chat .chat-avatar{width:51px;height:51px;position:relative;flex:0 0 51px;display:grid;place-items:center;border:2px solid var(--player-color);border-radius:50%;padding:2px;background:#fff4ca;box-shadow:0 0 0 1px #f6c23b,0 3px 3px #734b1225}
.room-chat .chat-avatar>svg{width:100%;height:100%;border-radius:50%;overflow:hidden}.room-chat .chat-avatar i{position:absolute;right:-2px;bottom:0;width:13px;height:13px;border:2px solid #fff5d4;border-radius:50%;background:var(--player-color);box-shadow:0 0 0 1px var(--player-color)}
.room-chat .chat-message-content{max-width:calc(100% - 60px);min-width:0;display:flex;flex-direction:column;align-items:flex-start}.room-chat .is-own .chat-message-content{align-items:flex-end}
.room-chat .chat-author{display:block;font:bold 14px/1.2 'Trebuchet MS',Arial,sans-serif;color:var(--player-color);margin:0 8px 5px;max-width:100%;overflow-wrap:anywhere}
.room-chat .chat-message .chat-bubble{position:relative;max-width:100%;border:1px solid #ecc9a7;border-radius:17px;padding:10px 12px;background:linear-gradient(#fff8ed,#ffebd6);box-shadow:0 3px 4px #9b65151c;font:400 15px/1.35 'Trebuchet MS',Arial,sans-serif;color:#51331c;margin:0;overflow-wrap:anywhere;white-space:pre-wrap}
.room-chat .is-own .chat-bubble{background:linear-gradient(#effbdc,#d9efb9);border-color:#bedb8f}.room-chat .chat-message .is-reaction{font-size:30px;padding:6px 15px}
.room-chat .chat-empty{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;color:#947049;padding:18px 10px}.room-chat .chat-empty>span{display:grid;place-items:center;width:65px;height:65px;border:2px solid #edc86c;border-radius:50%;background:linear-gradient(#fffdf1,#ffe5a1);color:#fff7d5;margin-bottom:13px}.room-chat .chat-empty svg{width:39px;filter:drop-shadow(0 2px 1px #bd8a42)}.room-chat .chat-empty strong{font:bold 18px 'Trebuchet MS',Arial,sans-serif;color:#885522}.room-chat .chat-empty p{font:14px/1.4 Arial;margin:7px 0 0}
.room-chat .chat-reactions{flex-shrink:0;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:6px;padding:5px 14px 9px;flex-wrap:nowrap}
.room-chat .chat-reactions button{min-width:0;min-height:43px;padding:4px 0;font:27px/1.2 'Segoe UI Emoji','Apple Color Emoji',sans-serif;border:1.5px solid #e5b238;border-radius:14px;background:linear-gradient(#fffef4,#ffebbd);box-shadow:inset 0 0 0 2px #fff9df,0 3px 0 #d7ab52,0 4px 4px #8d5a191f;transition:transform .15s}
.room-chat .chat-reactions button:hover{transform:translateY(-2px);background:#fffde4}.room-chat .chat-reactions button:active{transform:translateY(2px)}
.room-chat .chat-panel form{flex-shrink:0;display:flex;align-items:center;gap:8px;margin:6px 13px 14px;padding:0;min-height:53px}
.room-chat .chat-panel #chat-text{width:0;min-width:0;min-height:51px;border:2px solid #e5c48c;border-radius:28px;padding:12px 15px;background:#fffaf0;box-shadow:inset 0 2px 3px #b3843225,0 0 0 2px #fffdf5;font:15px/1.3 'Trebuchet MS',Arial,sans-serif;color:#56341d}.room-chat #chat-text::placeholder{color:#9c8066;opacity:1}
.room-chat .chat-panel .chat-send{width:52px;height:52px;flex:0 0 52px;display:grid;place-items:center;border:3px solid #f9ce64;border-radius:50%;padding:10px;background:linear-gradient(#00a262,#006638);box-shadow:0 0 0 1px #b47717,inset 0 0 0 2px #ffffff66,0 3px 3px #78481944;color:#fff8d8}.room-chat .chat-send svg{width:29px;height:29px;fill:currentColor;stroke:#fff8d8;stroke-width:1.4;stroke-linejoin:round}.room-chat .chat-send:disabled{opacity:.55}
.room-chat .chat-panel button:focus-visible,.room-chat #chat-text:focus-visible{outline:3px solid #40b8f5;outline-offset:2px}.room-chat .chat-error{padding:0 16px 10px;margin:0;font:13px/1.3 Arial}.room-chat .chat-error:empty{display:none}
.room-chat.chat-anchored .reaction-toast{top:55px;right:0;bottom:auto;z-index:2}
@media(max-width:380px){.room-chat .chat-panel header{gap:7px;padding:12px 9px}.room-chat .chat-header-icon{width:31px;height:31px}.room-chat .chat-panel header>strong{font-size:19px}.room-chat .chat-panel header button{width:31px;height:31px;min-height:31px}.room-chat .chat-panel header .chat-close{width:34px;height:34px}.room-chat .chat-reactions{gap:5px;padding-left:10px;padding-right:10px}.room-chat .chat-reactions button{font-size:25px}.room-chat .chat-log{padding:15px 10px 8px}.room-chat .chat-avatar{width:43px;height:43px;flex-basis:43px}.room-chat .chat-message-content{max-width:calc(100% - 52px)}}
@media(max-height:550px){.room-chat .chat-panel,.room-chat.chat-anchored .chat-panel{top:8px;max-height:calc(100dvh - 16px)}.room-chat .chat-log{height:140px;min-height:60px}.room-chat .chat-panel header{padding-top:8px;padding-bottom:8px}}
@media(prefers-reduced-motion:reduce){.room-chat .chat-reactions button{transition:none}}
.room-chat .chat-panel,.room-chat.chat-anchored .chat-panel{border-color:transparent;background:linear-gradient(120deg,#fffdf0,#fff2d5) padding-box,linear-gradient(115deg,#a95508,#fff2a3 4%,#ffc635 9%,#fff9ca 13%,#dc8b0b 18%,#ffdf69 36%,#fff8c6 44%,#d78a08 49%,#ffe87c 72%,#b66b0b 93%,#fff0a0) border-box}
.room-chat .chat-message .chat-bubble:before{content:'';position:absolute;left:-6px;top:14px;width:10px;height:10px;transform:rotate(45deg);background:#fff2e2;border-left:1px solid #ecc9a7;border-bottom:1px solid #ecc9a7;border-radius:0 0 0 3px}
.room-chat .is-own .chat-bubble:before{left:auto;right:-6px;background:#e4f5ca;border-left:0;border-bottom:0;border-right:1px solid #bedb8f;border-top:1px solid #bedb8f}
/* Equal visual size for collection avatars and the default portraits. */
.room-chat .chat-avatar{padding:0;background:transparent}
.room-chat .chat-avatar-art{display:block;width:100%;height:100%;border-radius:50%;overflow:hidden;isolation:isolate}
.room-chat .chat-avatar-art>svg{display:block;width:100%;height:100%;border-radius:50%;transform-origin:center}
.room-chat .has-custom-avatar .chat-avatar-art>svg{transform:scale(1.14)}
.room-chat .chat-emoji-art{display:block;width:100%;height:100%;filter:drop-shadow(0 2px 1px #a3601633)}
.room-chat .chat-reactions button{display:grid;place-items:center;padding:4px;min-height:45px}
.room-chat .chat-reactions .chat-emoji-art{width:34px;height:34px}
.room-chat .chat-bubble.is-reaction .chat-emoji-art{width:38px;height:38px}
.room-chat .chat-panel .chat-send{position:relative;padding:0;display:grid;place-items:center}
.room-chat .chat-send>svg{display:block;width:28px;height:28px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);margin:0;overflow:visible}
.room-chat.chat-anchored .chat-launch{position:relative;width:100%;height:41px;min-height:0;padding:6px 9px;display:flex;justify-content:center;align-items:center;gap:6px;border:3px solid transparent;border-radius:25px;background:linear-gradient(#0ca466,#00683e) padding-box,linear-gradient(125deg,#fff4b7,#e4a32d 28%,#fff2a1 52%,#bb7615 74%,#ffe287) border-box;box-shadow:inset 0 0 0 1px #99e9af88,0 2px 0 #82460e,0 4px 5px #4b250b55;color:#fff4ce;font:700 14px/1 'Trebuchet MS',Arial,sans-serif;text-shadow:0 1px 1px #00462b}
.room-chat .chat-launch>svg{width:22px;height:22px;display:block;color:#fff2bd;filter:drop-shadow(0 1px 0 #005737);flex-shrink:0}
.room-chat .chat-launch span:not(:empty){position:absolute;right:-5px;top:-7px;min-width:21px;height:21px;display:grid;place-items:center;padding:0 4px;border:2px solid #ffe28a;background:#d32c26;border-radius:50%;font:bold 11px Arial;color:white;text-shadow:none}
.room-chat .chat-launch:hover{filter:brightness(1.08)}

.room-chat .chat-inline-emoji{display:inline-block;width:1.6em;height:1.6em;vertical-align:-.4em;margin:0 .06em}.room-chat .chat-inline-emoji .chat-emoji-art{width:100%;height:100%}
.room-chat .chat-reactions .chat-emoji-art{width:36px;height:36px;filter:drop-shadow(0 1px 1px #ad71142b)}
.room-chat .chat-bubble.is-reaction .chat-emoji-art{width:44px;height:44px}
.room-chat .reaction-toast{display:flex;align-items:center;gap:10px}.room-chat .reaction-toast>.chat-emoji-art{width:42px;height:42px}

/* Reactions follow their sender's board avatar, independent of chat visibility. */
.room-chat .avatar-reaction-bubble{position:fixed;z-index:15;display:grid;place-items:center;padding:6px;border:2px solid #efb733;border-radius:19px;background:linear-gradient(135deg,#fffef2,#ffebba);box-shadow:inset 0 0 0 2px #fff8d7,0 4px 9px #46260d55;pointer-events:none;animation:avatar-reaction-pop 4s both;transform-origin:center;isolation:isolate}
.room-chat .avatar-reaction-bubble[hidden]{display:none}
.room-chat .avatar-reaction-bubble:before{content:'';position:absolute;z-index:-1;top:calc(50% - 5px);width:10px;height:10px;background:#fff2d0;transform:rotate(45deg)}
.room-chat .avatar-reaction-bubble[data-side=right]:before{left:-7px;border-left:2px solid #efb733;border-bottom:2px solid #efb733}
.room-chat .avatar-reaction-bubble[data-side=left]:before{right:-7px;border-right:2px solid #efb733;border-top:2px solid #efb733}
.room-chat .avatar-reaction-bubble .chat-emoji-art{width:100%;height:100%;filter:drop-shadow(0 2px 1px #b1742822)}
@keyframes avatar-reaction-pop{0%{opacity:0;transform:translateY(6px) scale(.6)}8%{opacity:1;transform:translateY(-2px) scale(1.08)}15%,82%{opacity:1;transform:none}100%{opacity:0;transform:translateY(-9px) scale(.92)}}
@media(prefers-reduced-motion:reduce){.room-chat .avatar-reaction-bubble{animation:avatar-reaction-fade 4s both}}@keyframes avatar-reaction-fade{0%,85%{opacity:1}100%{opacity:0}}
/* Public duels expose only this compact reaction tray, never a chat log or input. */
.room-chat .chat-panel [hidden]{display:none!important}
.room-chat.reactions-only.chat-anchored .chat-launch{width:44px;height:44px;margin:0 auto;padding:4px;border-radius:50%}
.room-chat.reactions-only .chat-launch>svg{width:29px;height:29px;filter:drop-shadow(0 1px 1px #004a2f66)}
.room-chat.reactions-only .chat-panel{width:min(360px,var(--chat-width));top:var(--reactions-top,60px);border-radius:23px;max-height:70dvh}
.room-chat.reactions-only .chat-panel header{order:0;padding:7px 10px;gap:8px;border-bottom-width:2px}
.room-chat.reactions-only .chat-header-icon{display:none}
.room-chat.reactions-only .chat-panel header>strong{font-size:17px;letter-spacing:0;text-shadow:0 1px 1px #00442d}
.room-chat.reactions-only .chat-panel header .chat-close{width:29px;height:29px;min-height:29px}
.room-chat.reactions-only .chat-panel header .chat-close svg{width:18px;height:18px}
.room-chat.reactions-only .chat-reactions{order:1;padding:12px 10px 9px;gap:5px}
.room-chat.reactions-only .chat-reactions button{min-height:44px;border-radius:12px;padding:3px}
.room-chat.reactions-only .chat-reactions .chat-emoji-art{width:34px;height:34px}
.room-chat.reactions-only .chat-settings{order:2;padding:6px 12px 9px;background:transparent;border:0;border-top:1px solid #e5c992}
.room-chat.reactions-only .chat-settings label{justify-content:center;min-height:26px;gap:8px;font:13px/1.3 'Trebuchet MS',Arial,sans-serif;color:#71501f;cursor:pointer}
.room-chat.reactions-only .chat-settings input[type=checkbox]{width:17px;height:17px;margin:0;accent-color:#008951}
.room-chat.reactions-only .chat-error{order:3;padding-top:2px}
.room-chat.reactions-muted.reactions-only .chat-launch:after{content:'🔕';position:absolute;right:-4px;bottom:-3px;width:18px;height:18px;display:grid;place-items:center;border:1px solid #dfb454;border-radius:50%;background:#fff4d3;font:11px/1 'Segoe UI Emoji',Arial;text-shadow:none}
.room-chat .chat-reactions button:disabled{opacity:.6;cursor:wait}
/* The outer bubble handles entry/exit; each approved picture moves independently. */
.room-chat .avatar-reaction-bubble{animation-duration:3s}
.room-chat .avatar-reaction-bubble[data-reaction=laugh]>.chat-emoji-art{animation:reaction-laugh 1.1s ease-in-out .18s}
.room-chat .avatar-reaction-bubble[data-reaction=cool]>.chat-emoji-art{animation:reaction-cool .9s ease-in-out .18s}
.room-chat .avatar-reaction-bubble[data-reaction=angry]>.chat-emoji-art{animation:reaction-angry .32s ease-in-out .22s 2}
.room-chat .avatar-reaction-bubble[data-reaction=wow]>.chat-emoji-art{animation:reaction-wow .8s ease-in-out .18s}
.room-chat .avatar-reaction-bubble[data-reaction=clap]>.chat-emoji-art{animation:reaction-clap .32s ease-in-out .18s 4}
.room-chat .avatar-reaction-bubble[data-reaction=heart]>.chat-emoji-art{animation:reaction-heart .6s ease-in-out .18s 2}
.room-chat .avatar-reaction-bubble[data-reaction=cool]:after{content:'';position:absolute;left:21%;right:21%;top:28%;height:23%;border-radius:7px;background:linear-gradient(115deg,transparent 35%,#fff9 48%,#ffffd8cc 52%,transparent 65%);background-size:260% 100%;pointer-events:none;opacity:0;animation:reaction-glint .9s linear .35s}
@keyframes reaction-laugh{0%,100%{transform:none}10%,30%,50%,70%{transform:translateY(-2px) rotate(-7deg)}20%,40%,60%,80%{transform:translateY(1px) rotate(7deg)}}
@keyframes reaction-cool{0%,100%{transform:none}30%{transform:rotate(-10deg) scale(1.05)}65%{transform:rotate(5deg)}}
@keyframes reaction-angry{0%,100%{transform:none}25%{transform:translateX(-3px) rotate(-5deg)}75%{transform:translateX(3px) rotate(5deg)}}
@keyframes reaction-wow{0%,100%{transform:none}45%{transform:scale(1.18)}75%{transform:scale(.97)}}
@keyframes reaction-clap{0%,100%{transform:none}45%{transform:translateY(-2px) rotate(-6deg) scale(1.1,.94)}70%{transform:translateY(1px) rotate(3deg) scale(.96,1.04)}}
@keyframes reaction-heart{0%,100%{transform:none}25%{transform:scale(1.16)}50%{transform:scale(1)}70%{transform:scale(1.1)}}
@keyframes reaction-glint{0%{opacity:0;background-position:150% 0}20%,80%{opacity:1}100%{opacity:0;background-position:-50% 0}}
@media(prefers-reduced-motion:reduce){.room-chat .avatar-reaction-bubble>.chat-emoji-art{animation:none!important}.room-chat .avatar-reaction-bubble[data-reaction=cool]:after{display:none}}

.room-idle-notice{font-size:12px;line-height:1.3;text-align:center;margin:8px 12px;color:#6b4a2b}

.room-chat .chat-settings{max-height:46vh;overflow:auto;overscroll-behavior:contain}.chat-safety{display:grid;gap:8px;margin-top:10px;padding-top:10px;border-top:1px solid #cfa34e}.chat-safety label{display:grid;gap:4px;font-size:14px}.chat-safety select{width:100%;min-height:40px;font:16px Arial;color:#542d15;background:#fff8e9;border:1px solid #cba04e;border-radius:10px;padding:6px}.chat-safety button{min-height:40px;font:bold 15px Arial;color:#63330e;background:#fff4d7;border:2px solid #d4a33b;border-radius:12px}.chat-safety small,.safety-status{font:13px/1.4 Arial}.safety-status{margin:0}.room-chat .chat-panel:has(.chat-settings:not([hidden])) .chat-log{display:none}
