/* Cooperative room modal. Stage-map entry only; original town/menu remains behind it. */
#dsCoopOverlay[hidden],#dsCoopIncoming[hidden],[data-ds-coop-hidden][hidden]{display:none!important}
#dsCoopOverlay{position:fixed;inset:0;z-index:100050;background:rgba(4,8,23,.69);backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px);display:flex;align-items:center;justify-content:center;padding:18px;box-sizing:border-box}
#dsCoopOverlay *{box-sizing:border-box}
.dsCoopPanel{width:min(940px,100%);max-height:min(92dvh,890px);overflow:hidden;display:flex;flex-direction:column;color:#f3f6ff;background:linear-gradient(155deg,#31589f,#203970 68%,#192e60);border:3px solid #b7c9f9;outline:2px solid #5d82be;outline-offset:-8px;border-radius:14px;box-shadow:0 22px 70px #010917cc, inset 0 0 0 2px #748fcb}
.dsCoopHead{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:24px 27px 8px}
.dsCoopHead h2{font-size:clamp(22px,3vw,28px);letter-spacing:.03em;margin:0;font-weight:950;color:#fff;text-shadow:0 2px 1px #14264d}
.dsCoopHead small{font-size:12px;color:#c3d6ff;display:block;margin-top:4px}
.dsCoopHead button{flex:none}
.dsCoopBody{overflow-y:auto;overscroll-behavior:contain;padding:7px 27px 22px;scrollbar-width:thin;scrollbar-color:#849edd #203869}
.dsCoopPanel button{cursor:pointer;font:inherit;font-size:13px;font-weight:900;border:2px solid #7799d3;border-radius:10px;padding:9px 14px;background:linear-gradient(#4a6bb2,#2b4886);color:#f4f7ff;min-height:40px;box-shadow:0 3px 0 #142958;transition:filter .15s,border-color .15s}
.dsCoopPanel button:hover:not(:disabled){filter:brightness(1.14);border-color:#dfecff}
.dsCoopPanel button:disabled{opacity:.43;cursor:default;filter:grayscale(.4)}
.dsCoopPanel button.dsCoopGold{color:#37200f;background:linear-gradient(#ffdf76,#ffbd30);border-color:#fff1b9;box-shadow:0 4px 0 #9f5d19}
.dsCoopPanel button.dsCoopPlain{background:linear-gradient(#486caf,#2c4b89)}
.dsCoopIntro{font-size:13px;color:#ccd9fa;margin:6px 0 15px;line-height:1.7}
.dsCoopStageName{font-size:14px;font-weight:900;color:#ffe5a3}
.dsCoopRow{display:flex;gap:9px;align-items:center;flex-wrap:wrap}
.dsCoopControls{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:14px;margin:15px 0}
.dsCoopCreateBox,.dsCoopJoinBox{border:2px solid #6e90c8;background:#1a3469b5;border-radius:13px;padding:17px}
.dsCoopControls h3,.dsCoopFriendHeader h3{margin:0 0 10px;font-size:17px;color:#fff}
.dsCoopControls p{color:#cad8f5;font-size:12px;line-height:1.65;margin:0 0 14px}
.dsCoopJoinBox input{width:100%;min-width:0;min-height:43px;border:2px solid #7596d2;border-radius:9px;background:#122a58;color:#fff;letter-spacing:.11em;font-size:18px;font-weight:950;padding:8px 11px;font-variant-numeric:tabular-nums}
.dsCoopJoinBox .dsCoopRow{margin-top:10px}
.dsCoopSeats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:14px 0}
.dsCoopSeat{min-height:153px;background:#1e3667;border:3px dashed #607bad;border-radius:12px;display:flex;align-items:center;flex-direction:column;justify-content:center;padding:13px;gap:5px;min-width:0;text-align:center}
.dsCoopSeat.filled{border-style:solid;border-color:#c2d3f7;background:linear-gradient(140deg,#26467e,#182c59)}
.dsCoopSeat.mine{border-color:#ffcc38}
.dsCoopAvatar{width:59px;height:59px;display:grid;place-items:center;font-size:34px;overflow:hidden;image-rendering:pixelated}
.dsCoopAvatar img,.dsCoopFriendPortrait img{width:100%;height:100%;max-width:100%;max-height:100%;object-fit:contain;image-rendering:pixelated}
.dsCoopSeat strong{font-size:15px;color:#fff2a8;max-width:100%;overflow-wrap:anywhere}
.dsCoopSeat small{color:#cad8f2;font-size:11px}
.dsCoopSeat .dsCoopReady{font-size:11px;font-weight:950;color:#a5f5cd}
.dsCoopSeat .dsCoopReady.wait{color:#ffe5a9}
.dsCoopRoomTop{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin:12px 0}
.dsCoopCode{padding:8px 13px;background:#142954;border:2px solid #7e9ccd;border-radius:10px;font-size:13px;font-weight:750;color:#cbd9f1}
.dsCoopCode strong{font-size:23px;color:#ffe281;margin-left:11px;letter-spacing:.13em;font-variant-numeric:tabular-nums}
.dsCoopActions{display:flex;flex-wrap:wrap;gap:10px;margin:12px 0 17px}
.dsCoopFriendHeader{display:flex;justify-content:space-between;align-items:center;gap:9px;margin:18px 0 9px}
.dsCoopFriendHeader h3{margin:0}
.dsCoopFriends{max-height:245px;min-height:74px;overflow:auto;display:flex;flex-direction:column;gap:7px;padding-right:5px;scrollbar-color:#7b9ada #1b3265;scrollbar-width:thin}
.dsCoopFriend{min-height:58px;display:flex;align-items:center;gap:10px;padding:7px 9px;background:#1c3568;border:2px solid #456eae;border-radius:9px;min-width:0}
.dsCoopFriend .dsCoopFriendPortrait{width:39px;height:39px;flex:none;display:grid;place-items:center;font-size:21px}
.dsCoopFriendName{flex:1;min-width:0;color:white;font-size:13px;font-weight:900;overflow-wrap:anywhere}
.dsCoopFriendName small{display:block;color:#b6caec;font-size:10px;font-weight:500;margin-top:3px}
.dsCoopOnline{display:inline-block;width:9px;height:9px;flex:none;border-radius:50%;background:#63efac;box-shadow:0 0 7px #62e8a4}
.dsCoopOnline.off{background:#8799b8;box-shadow:none}
.dsCoopPanel .dsCoopFriend button{padding:6px 12px;min-height:35px;font-size:12px}
.dsCoopStatus{font-size:12px;line-height:1.7;min-height:24px;color:#e6f4ff;padding:11px 13px;background:#173063;border:1px solid #6285c3;border-radius:10px;overflow-wrap:anywhere}
.dsCoopHint{margin-top:11px;font-size:11px;line-height:1.6;color:#becdee}
.dsCoopInbox{margin:12px 0;padding:11px;background:#162b59;border-radius:9px;border:1px solid #7692bf}
.dsCoopInbox strong{display:block;margin-bottom:8px;font-size:13px;color:#fff4c4}
.dsCoopInviteRow{display:flex;align-items:center;gap:9px;justify-content:space-between;border-top:1px solid #4265a0;padding:8px 0;flex-wrap:wrap;font-size:12px}
.dsCoopInviteRow small{color:#bbccec}
#dsCoopIncoming{position:fixed;right:17px;bottom:17px;z-index:100060;width:min(370px,calc(100vw - 34px));background:linear-gradient(135deg,#284989,#172f62);border:3px solid #c8d8ff;color:#fff;padding:14px;border-radius:14px;box-shadow:0 10px 40px #050c24b8;font-size:13px}
#dsCoopIncoming strong{color:#ffe7a1;display:block;margin:0 0 6px;font-size:15px}
#dsCoopIncoming p{margin:4px 0 11px;line-height:1.5}
#dsCoopIncoming .dsCoopRow{justify-content:flex-end}
#dsCoopIncoming button{border-radius:8px;border:1px solid #92b4e4;padding:8px 12px;background:#355ba0;color:#fff;font-weight:900;cursor:pointer}
#dsCoopIncoming button:first-child{background:#ffca56;color:#301e11;border-color:#ffe8a4}
@media(max-width:700px){#dsCoopOverlay{padding:8px}.dsCoopPanel{max-height:97dvh;border-width:2px}.dsCoopHead{padding:19px 14px 7px}.dsCoopHead h2{font-size:20px}.dsCoopBody{padding:7px 13px 17px}.dsCoopControls{grid-template-columns:1fr}.dsCoopCreateBox,.dsCoopJoinBox{padding:12px}.dsCoopSeat{min-height:137px;padding:8px}.dsCoopAvatar{width:49px;height:49px}.dsCoopSeat strong{font-size:12px}.dsCoopSeat small{font-size:10px}.dsCoopRoomTop{align-items:flex-start}.dsCoopCode strong{font-size:19px;letter-spacing:.08em}.dsCoopActions button{flex:1 1 110px}.dsCoopFriend{min-height:51px;padding:5px 7px}.dsCoopPanel button{padding:8px 10px;font-size:12px}}
@media(max-width:390px){.dsCoopSeats{gap:7px}.dsCoopSeat{min-height:130px}.dsCoopCode{width:100%}.dsCoopPanel .dsCoopFriend button{padding:5px 9px}.dsCoopFriendName{font-size:12px}}

/* While the cooperative dialog is open, account/save floating badges must not
   intercept its close button or obscure its heading. Restored on close. */
body.dsCoopModalOpen #dsCloudAccount,
body.dsCoopModalOpen #dsCloudSaveButton{display:none!important}

/* Pull-only public room directory controls, scoped to the existing co-op modal. */
#dsCoopOverlay select{max-width:100%;min-height:36px;padding:6px 9px;border:1px solid #7596d2;border-radius:8px;background:#122a58;color:#fff;font:inherit;font-size:13px}
#dsCoopPublicCreate{width:18px;height:18px;vertical-align:middle;accent-color:#ffd17a}
#dsCoopRecruitPanel[hidden],#dsCoopRecruitHost[hidden]{display:none!important}
#dsCoopRecruitRows .dsCoopFriendName{min-width:0;overflow-wrap:anywhere}
#dsCoopRecruitRows .dsCoopFriend button{flex-shrink:0}

/* The exact existing public chat node is docked alongside the waiting room.
   A compact mobile column leaves the room visible while the keyboard is open. */
#dsCoopOverlay{gap:14px}
#dsCoopOverlay .dsCoopPanel{min-width:0;flex:0 1 940px}
#dsCoopChatDock{flex:0 1 350px;width:350px;min-width:0;align-self:flex-end;max-height:100%;display:flex;align-items:flex-end}
#dsCoopChatDock:empty{display:none}
#dsCoopChatDock #dsLobbyChat.dsChatCoopDocked{position:relative;inset:auto;width:100%;max-width:100%;margin:0;z-index:auto}
#dsCoopChatDock #dsChatPanel{max-height:min(70dvh,540px);margin-bottom:0}
#dsCoopChatDock #dsChatInput{min-width:0;font-size:16px}
@media(max-width:900px){
 #dsCoopOverlay{flex-direction:column;gap:7px;padding:8px;align-items:center;justify-content:center}
 #dsCoopOverlay .dsCoopPanel{width:min(940px,100%);flex:1 1 auto;min-height:0;max-height:calc(100% - 48px)}
 #dsCoopChatDock{width:min(940px,100%);flex:0 1 auto;align-self:center;min-height:0;max-height:43dvh}
 #dsCoopChatDock #dsLobbyChat.dsChatCoopDocked{max-height:43dvh}
 #dsCoopChatDock #dsChatPanel{min-height:0;max-height:calc(43dvh - 43px);overflow-y:auto}
 #dsCoopChatDock #dsChatFeed{height:clamp(65px,16dvh,150px);min-height:55px;flex-shrink:0}
 #dsCoopChatDock #dsChatToggle{min-height:36px!important}
 #dsCoopChatDock #dsChatForm{flex-shrink:0}
}
@media(max-height:450px) and (max-width:900px){
 #dsCoopOverlay{flex-direction:row;align-items:center}
 #dsCoopOverlay .dsCoopPanel{flex:1 1 60%;max-height:100%}
 #dsCoopChatDock{flex:0 1 40%;width:auto;max-height:100%;align-self:center}
 #dsCoopChatDock #dsLobbyChat.dsChatCoopDocked{max-height:100%}
 #dsCoopChatDock #dsChatPanel{max-height:calc(100dvh - 66px)}
}

/* Persistent chat entry remains visible even if the optional dock is absent. */
.dsCoopHeadActions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:7px;flex:0 0 auto}
.dsCoopPanel button.dsCoopChatOpen{background:linear-gradient(#287d87,#205262);border-color:#92dfd6;color:#fff}
@media(max-width:540px){
 .dsCoopHead{flex-wrap:wrap;gap:7px}
 .dsCoopHeadActions{width:100%;justify-content:space-between}
 .dsCoopHeadActions .dsCoopChatOpen{flex:1}
}
