/* Friend lobby shares the scale, pigments and controls of the main game UI. */
#friends-dialog{position:fixed;inset:0;box-sizing:border-box;width:100vw;max-width:none;height:100dvh;max-height:none;margin:0;padding:18px clamp(20px,2.5vw,42px);border:0;border-radius:0;overflow:auto;background:linear-gradient(#2e1d3520,#2e1d3530),url('assets/akaryakit/night-v1/preview.webp') center/cover no-repeat;color:var(--ui-paper);font-family:var(--ui-display);box-shadow:none}
#friends-dialog::backdrop{background:#281d32}
#friends-dialog .plate-button{width:auto;min-width:0}
.friends-header{height:86px;display:grid;grid-template-columns:24% minmax(0,1fr) 18%;gap:18px;align-items:start}
.friends-brand .brand-logo{width:min(100%,280px);height:auto;max-height:82px}
.friends-header h2{font:italic 800 clamp(22px,2.45vw,40px) var(--ui-display)!important;letter-spacing:1px;text-align:center;white-space:nowrap;margin:0;padding:8px 18px;border:3px solid var(--ui-ink);background:var(--ui-panel);transform:skew(-12deg);box-shadow:2px 2px var(--ui-ink)}
.friends-header>.plate-button{justify-self:end;min-width:100px!important;min-height:43px;font-size:23px!important}
.friends-stage{display:grid;grid-template-columns:minmax(0,1fr) minmax(280px,30%);gap:20px;align-items:center;min-height:calc(100dvh - 195px)}
.friends-players{position:relative;padding-top:52px;min-width:0}
.lobby-count{position:absolute;top:4px;left:50%;transform:translateX(-50%) skew(-12deg);font:italic 800 29px var(--ui-display);width:120px;text-align:center;padding:4px 15px;border:3px solid var(--ui-ink)}
#room-roster.lobby-cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:9px;border:0;padding:0;margin:0}
.lobby-player-card{position:relative;min-width:0;display:flex;flex-direction:column;justify-content:flex-end;box-sizing:border-box;height:clamp(285px,47vh,466px);padding:5px;margin:0;border:3px solid #17111e;border-radius:11px;background:linear-gradient(135deg,#63445f,#442b4b);box-shadow:inset 0 0 0 2px #f2e4cf,3px 4px #16101c88;overflow:hidden}
.lobby-player-scene{position:relative;flex:1;min-height:0;background:linear-gradient(#33263d00,#33263d22),url('assets/akaryakit/night-v1/preview.webp') 38% center/auto 100% no-repeat;overflow:hidden;border-radius:5px 5px 0 0}
.lobby-player-scene>img{position:absolute;bottom:0;left:50%;width:220%;max-width:none;height:105%;transform:translateX(-50%);object-fit:contain;object-position:50% 100%;filter:drop-shadow(3px 4px 1px #1c182b60)}
#friends-dialog #room-roster .lobby-team-tag{position:absolute;top:9px;left:9px;z-index:1;background:#f5d351;color:#18121d!important;-webkit-text-fill-color:#18121d;text-shadow:none;font:italic 800 18px var(--ui-display);padding:3px 11px;transform:skew(-8deg);border:2px solid #18121d;opacity:1}
#friends-dialog #room-roster .team-1 .lobby-team-tag{background:#c5a9e2}
.lobby-player-name{padding:8px 4px;background:#ffefd0;color:#16131b;text-align:center;font:italic 800 clamp(15px,1.34vw,23px) var(--ui-display);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.lobby-leader{height:24px;display:grid;place-items:center}
#friends-dialog #room-roster .lobby-leader>span{font:italic 800 15px/1.2 var(--ui-display);color:#18121d!important;-webkit-text-fill-color:#18121d;text-shadow:none;background:#f9d827;transform:skew(-12deg);padding:2px 13px;border:2px solid #18121d;position:relative;top:-4px;opacity:1}
.lobby-ready{text-align:center;font:italic 800 clamp(15px,1.5vw,26px) var(--ui-display);padding:5px 0 9px;color:#cdbbd0}
.lobby-ready.is-ready{color:#ffefcb}.lobby-ready.is-ready::first-letter{color:#f6d22a}
.empty-player{justify-content:center;align-items:center;gap:30px;cursor:pointer}.empty-player:hover{background:#725175}
.invite-plus{width:65px;height:65px;border:4px solid #ffefd0;border-radius:50%;font:normal 60px/54px Arial;color:#ffefd0}
.empty-player .cream-label{padding:4px 13px;font:italic 800 clamp(16px,1.6vw,27px) var(--ui-display);transform:skew(-12deg);border:2px solid #17111e}
.friends-match{box-sizing:border-box;padding:16px;background:linear-gradient(130deg,#65425ff5,#412a48f8);border:3px solid #17111e;border-radius:13px;box-shadow:5px 6px #17111e88;min-width:0}
.friends-map{box-sizing:border-box;width:100%;aspect-ratio:1.85;object-fit:cover;border:3px solid #fff0cc;border-radius:6px}
.friends-match h3{font:italic 800 27px var(--ui-display);display:table;padding:4px 16px;margin:11px 0 8px;transform:skew(-12deg);border:2px solid #17111e}
.lobby-match-facts{display:flex;justify-content:space-between;gap:8px;font:italic 800 clamp(14px,1.25vw,21px) var(--ui-display);border-bottom:2px solid #f6e6c880;padding-bottom:10px}
.lobby-match-facts>b+b{border-left:1px solid #f7e3c6aa;padding-left:10px}
#friends-dialog .room-controls{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin:12px 0}
#friends-dialog .room-controls label{display:flex;align-items:center;justify-content:space-between;font:italic 800 14px var(--ui-display);gap:8px;min-width:0}
#friends-dialog .room-controls .ink-select{min-width:65px;max-width:68%}
#friends-dialog .room-controls .ink-select-button{min-height:32px!important;font-size:15px!important;padding:6px 8px!important;gap:9px}
#friends-dialog .lobby-code-row{display:grid;grid-template-columns:auto minmax(65px,1fr) auto;gap:7px;align-items:center;font:italic 800 17px var(--ui-display);margin:13px 0 9px}
#friends-dialog .lobby-code-row .cream-label{display:block;min-width:0;font-size:23px;padding:5px 8px;text-align:center;white-space:nowrap}
#friends-dialog .lobby-code-row .plate-button{width:auto!important;min-width:0!important;max-width:115px;margin:0!important;padding:5px 7px!important;font-size:13px!important;min-height:36px!important;white-space:nowrap}
#friends-dialog .invite-room{width:100%;font-size:21px!important;min-height:41px!important;margin:0 0 13px!important}
#friends-dialog .lobby-launch{display:grid;grid-template-columns:36% minmax(0,1fr);gap:10px;align-items:center}
#friends-dialog .lobby-launch>button{width:100%!important;min-width:0!important;max-width:100%;margin:0!important;box-sizing:border-box;padding:7px 10px!important}
#friends-dialog .lobby-launch>.violet-button{font-size:17px!important;min-height:42px}
#friends-dialog .lobby-launch>.primary-button{min-height:55px;font-size:29px!important;justify-content:space-between}
#friends-dialog #room-status{font:italic 800 13px var(--ui-display);min-height:18px;margin:10px 0 0;color:#f5d463;line-height:1.4}
.friends-footer{padding-top:15px}
#friends-dialog .friends-footer>.plate-button{width:auto!important;min-width:145px;margin:0!important;font-size:20px!important;min-height:37px}
#friends-dialog .room-entry{display:grid!important;gap:12px;margin:15px 0 0!important}
#friends-dialog .room-entry[hidden]{display:none!important}
.friends-match .room-entry>div{display:flex;gap:10px}.friends-match .room-entry .plate-button{flex:1;font-size:20px!important;min-height:42px!important}
.friends-match .room-entry label{display:flex;justify-content:space-between;align-items:center;font:italic 800 18px var(--ui-display)}
.friends-match .room-entry input{width:140px}
@media(min-width:601px) and (max-width:1000px){
 #friends-dialog{padding:15px 18px}.friends-header{height:72px;grid-template-columns:24% minmax(0,1fr) 16%;gap:13px}.friends-header h2{font-size:clamp(20px,3vw,27px)!important;padding:7px}.friends-header>.plate-button{min-width:65px!important;min-height:36px;font-size:18px!important}
 .friends-stage{grid-template-columns:minmax(0,1fr) 265px;gap:14px;min-height:calc(100dvh - 150px)}.friends-players{padding-top:43px}.lobby-count{font-size:23px;width:96px}.lobby-player-card{height:clamp(266px,47vh,353px);padding:4px;border-width:2px;border-radius:7px}#room-roster.lobby-cards{gap:6px}.lobby-player-name{font-size:14px;padding:6px 2px}.lobby-ready{font-size:13px;padding-bottom:6px}.lobby-leader{height:18px}#friends-dialog #room-roster .lobby-leader>span{font-size:12px;padding:1px 7px}#friends-dialog #room-roster .lobby-team-tag{font-size:13px;top:5px;left:5px;padding:2px 6px;border-width:1px}
 .invite-plus{width:38px;height:38px;font-size:37px;line-height:31px;border-width:3px}.empty-player{gap:22px}.empty-player .cream-label{font-size:13px;padding:4px}.friends-match{padding:11px}.friends-match h3{font-size:23px}.lobby-match-facts{font-size:13px;gap:5px}.lobby-match-facts>b+b{padding-left:6px}
 #friends-dialog .room-controls{gap:8px}#friends-dialog .room-controls label{font-size:12px;gap:4px}#friends-dialog .room-controls .ink-select{min-width:56px}#friends-dialog .room-controls .ink-select-button{font-size:13px!important;padding:5px 6px!important;min-height:29px!important;gap:5px}
 #friends-dialog .lobby-code-row{grid-template-columns:49px minmax(63px,1fr) 91px;gap:5px;font-size:13px}#friends-dialog .lobby-code-row .plate-button{font-size:10px!important;padding:4px!important}#friends-dialog .lobby-code-row .cream-label{font-size:18px;padding:5px 4px}
 #friends-dialog .invite-room{font-size:18px!important;min-height:35px!important}#friends-dialog .lobby-launch{gap:9px}#friends-dialog .lobby-launch>.primary-button{min-height:47px;font-size:27px!important}#friends-dialog .lobby-launch>.violet-button{font-size:14px!important;min-height:38px}#friends-dialog #room-status{font-size:11px;line-height:1.3}
 #friends-dialog .friends-footer>.plate-button{font-size:17px!important;min-height:33px}.friends-match .room-entry input{width:112px}.friends-match .room-entry label{font-size:15px}.friends-match .room-entry .plate-button{font-size:16px!important;min-height:37px!important}
}
@media(max-width:600px){
 #friends-dialog{padding:15px}.friends-header{height:80px;grid-template-columns:1fr auto;gap:10px}.friends-header .friends-brand{max-width:180px}.friends-header h2{grid-row:2;grid-column:1/-1;font-size:22px!important;padding:5px}.friends-header>.plate-button{grid-column:2;grid-row:1;min-width:65px!important;min-height:35px;font-size:18px!important}
 .friends-stage{grid-template-columns:1fr;min-height:0;padding-top:23px;gap:20px}.friends-players{padding-top:39px}.lobby-player-card{height:220px}.lobby-count{font-size:22px;width:93px}.lobby-ready{font-size:12px}.lobby-player-name{font-size:13px}.lobby-leader{height:19px}#friends-dialog #room-roster .lobby-leader>span{font-size:12px;padding-inline:7px}#friends-dialog #room-roster .lobby-team-tag{font-size:12px;padding:2px 5px;left:5px;top:5px}
 .invite-plus{width:36px;height:36px;font-size:35px;line-height:29px;border-width:3px}.empty-player{gap:20px}.empty-player .cream-label{font-size:13px;padding:4px}.friends-match{padding:13px}.friends-map{aspect-ratio:2.8}.lobby-match-facts{font-size:17px}.friends-footer{padding-bottom:10px}
}
/* Leader-only live bot controls live inside the existing ESC menu. */
.pause-bot-panel{margin:3px 0;padding:10px 12px;border:2px solid #17111e;background:#37283f;border-radius:3px}.pause-bot-panel summary{font:italic 800 19px var(--ui-display);color:#f3dfb4;cursor:pointer}.pause-bot-panel[open] summary{margin-bottom:10px}.pause-bot-row{display:grid;grid-template-columns:1fr 33px 28px 33px;gap:8px;align-items:center;margin-top:7px;color:#f4e8cb}.pause-bot-row>b{font:italic 800 15px var(--ui-display)}.pause-bot-row>strong{text-align:center;font:italic 800 23px var(--ui-display)}.pause-menu .bot-step{display:grid;place-items:center;width:33px;min-width:0;min-height:31px;height:31px;padding:0;margin:0;border:2px solid #17111e;border-radius:3px;box-shadow:2px 2px #17111e;background:#f3d15b;color:#17111e;font:800 23px/1 Arial;cursor:pointer}.pause-menu .bot-step:hover{background:#fff0a1}.pause-menu .bot-step:disabled{opacity:.35;cursor:default}

#friends-dialog .room-lighting{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:12px;font:italic 800 17px var(--ui-display)}
#friends-dialog .room-lighting .ink-select{width:145px;max-width:58%}
#friends-dialog .room-lighting .ink-select-button{min-height:35px;font-size:16px}
#friends-dialog .room-lighting-note{font:13px/1.4 var(--ui-display);color:#eadccc;margin:6px 0 0}
#friends-dialog[data-time-of-day="night"] .friends-map{border-color:#bdc7ed}

/* Compact desktop lobby: smaller cards and a shorter settings panel. */
@media(min-width:601px){
 #friends-dialog{inset:0;width:min(1180px,94vw);height:min(740px,92dvh);margin:auto;padding:15px 20px;border:3px solid #17111e;border-radius:12px;box-shadow:0 15px 70px #080c20aa}
 #friends-dialog::backdrop{background:#0d1124c9;backdrop-filter:blur(4px)}
 .friends-header{height:62px;gap:14px}.friends-brand .brand-logo{max-width:210px;max-height:60px}
 .friends-header h2{font-size:clamp(22px,2.2vw,29px)!important;padding:7px 14px}
 .friends-header>.plate-button{min-height:34px;min-width:75px!important;font-size:18px!important}
 .friends-stage{grid-template-columns:minmax(0,1fr) 275px;min-height:calc(min(740px,92dvh) - 150px);gap:16px}
 .friends-players{padding-top:39px}.lobby-count{top:2px;font-size:23px;width:96px;padding:3px 12px}
 .lobby-player-card{height:clamp(225px,38vh,310px);padding:4px;border-width:2px;border-radius:8px}
 #room-roster.lobby-cards{gap:7px}.lobby-player-name{font-size:16px;padding:7px 3px}
 .lobby-ready{font-size:17px;padding:4px 0 6px}.lobby-leader{height:20px}
 #friends-dialog #room-roster .lobby-team-tag{font-size:14px;top:6px;left:6px;padding:2px 8px}
 #friends-dialog #room-roster .lobby-leader>span{font-size:12px;padding:2px 9px}
 .invite-plus{width:43px;height:43px;border-width:3px;font-size:41px;line-height:35px}.empty-player{gap:23px}.empty-player .cream-label{font-size:16px;padding:4px 10px}
 .friends-match{padding:11px;border-radius:9px}.friends-map{aspect-ratio:3.2;border-width:2px;border-radius:4px}
 .friends-match h3{font-size:23px;margin:8px 0 7px;padding:3px 12px}.lobby-match-facts{font-size:13px;gap:5px;padding-bottom:7px}.lobby-match-facts>b+b{padding-left:6px}
 #friends-dialog .room-lighting{font-size:14px;margin-top:8px;gap:8px}
 #friends-dialog .room-lighting .ink-select{width:120px}#friends-dialog .room-lighting .ink-select-button{min-height:30px!important;font-size:14px!important;padding:5px 8px!important}
 #friends-dialog .room-lighting-note{font-size:11px;line-height:1.3;margin-top:5px}
 #friends-dialog .room-controls{gap:7px;margin:8px 0}#friends-dialog .room-controls label{font-size:12px;gap:5px}
 #friends-dialog .room-controls .ink-select{min-width:54px}#friends-dialog .room-controls .ink-select-button{min-height:28px!important;font-size:12px!important;padding:5px 7px!important}
 #friends-dialog .lobby-code-row{grid-template-columns:44px minmax(55px,1fr) 88px;gap:5px;font-size:12px;margin:8px 0}
 #friends-dialog .lobby-code-row .cream-label{font-size:19px;padding:4px 5px}#friends-dialog .lobby-code-row .plate-button{font-size:10px!important;min-height:30px!important;padding:4px!important}
 #friends-dialog .invite-room{min-height:32px!important;font-size:16px!important;margin-bottom:8px!important}
 #friends-dialog .lobby-launch{gap:8px}#friends-dialog .lobby-launch>.violet-button{font-size:14px!important;min-height:35px}#friends-dialog .lobby-launch>.primary-button{font-size:24px!important;min-height:44px}
 #friends-dialog #room-status{font-size:11px;line-height:1.3;margin-top:7px;min-height:14px}
 .friends-footer{padding-top:9px}#friends-dialog .friends-footer>.plate-button{font-size:17px!important;min-height:32px}
 #friends-dialog .room-entry{gap:9px;margin-top:10px!important}.friends-match .room-entry label{font-size:14px}.friends-match .room-entry input{width:115px}.friends-match .room-entry .plate-button{font-size:15px!important;min-height:34px!important}
}
@media(min-width:601px) and (max-width:900px){.friends-stage{grid-template-columns:minmax(0,1fr) 245px;gap:11px}.lobby-player-card{height:250px}.lobby-player-name{font-size:12px}.lobby-ready{font-size:13px}.empty-player .cream-label{font-size:12px}.friends-header h2{font-size:21px!important}}
/* One viewport grid owns the lobby height; children never add page height. */
#friends-dialog{width:min(1120px,94vw);height:min(660px,calc(100dvh - 32px));max-height:calc(100dvh - 32px);padding:14px 18px;overflow:hidden;line-height:1.2}
#friends-dialog[open]{display:grid;grid-template-rows:54px minmax(0,1fr) 34px;gap:10px}
#friends-dialog .friends-header{height:auto;min-height:0;align-items:start}
#friends-dialog .friends-stage{height:100%;min-height:0;grid-template-columns:minmax(0,1fr) 270px;gap:16px}
#friends-dialog .friends-players{height:min(340px,100%);min-height:0;padding-top:36px}
#friends-dialog #room-roster.lobby-cards{height:100%;min-height:0;grid-auto-rows:minmax(0,1fr)}
#friends-dialog .lobby-player-card{height:100%;min-height:0}
#friends-dialog .friends-match{max-height:100%;min-height:0;padding:10px;align-self:center}
#friends-dialog .friends-map{aspect-ratio:3.5;display:block}
#friends-dialog .friends-match h3{font-size:21px;line-height:1.1;margin:6px 0;padding:3px 10px}
#friends-dialog .lobby-match-facts{font-size:12px;line-height:1.2;padding-bottom:6px;gap:4px}
#friends-dialog .room-lighting-note{display:none}
#friends-dialog .room-lighting{margin-top:7px;font-size:13px;line-height:1.2}
#friends-dialog .room-lighting .ink-select-button{min-height:29px!important;padding:5px 7px!important}
#friends-dialog .room-controls{margin:7px 0;gap:6px}
#friends-dialog .room-controls .ink-select-button{min-height:27px!important}
#friends-dialog .lobby-code-row{margin:6px 0}
#friends-dialog .lobby-code-row .cream-label{font-size:18px;padding:3px 5px}
#friends-dialog .invite-room{font-size:15px!important;min-height:29px!important;margin:0 0 6px!important}
#friends-dialog .lobby-launch>button{margin:0!important;padding:6px!important;min-height:38px!important}
#friends-dialog #room-status{font-size:10px;line-height:1.25;min-height:13px;margin:5px 0 0}
#friends-dialog .room-entry{margin:8px 0 0!important;gap:8px}
#friends-dialog .room-entry>div{display:flex;gap:8px}
#friends-dialog .room-entry .plate-button{min-height:33px!important;font-size:14px!important;margin:0!important;padding:7px 5px!important;white-space:nowrap}
#friends-dialog .room-entry input{min-height:32px;padding:6px 8px}
#friends-dialog .friends-footer{padding:0;min-height:0;border:0;display:flex;align-items:center}
#friends-dialog .friends-footer>.plate-button{min-height:30px!important;font-size:15px!important;padding:6px 12px!important}
#friends-dialog #room-roster[data-density="compact"] .lobby-player-scene{display:none}
#friends-dialog #room-roster[data-density="compact"] .lobby-player-name{padding:4px;font-size:13px}
#friends-dialog #room-roster[data-density="compact"] .lobby-ready{padding:2px;font-size:12px}
@media(max-height:700px){
 #friends-dialog[open]{grid-template-rows:43px minmax(0,1fr) 30px;gap:7px;padding:10px 15px}
 #friends-dialog .friends-map{display:none}#friends-dialog .friends-match h3{margin-top:0}
 #friends-dialog .friends-header h2{font-size:23px!important;padding:6px 10px}
 #friends-dialog .friends-brand .brand-logo{max-height:43px;max-width:165px}
 #friends-dialog .friends-players{height:min(290px,100%)}
}
@media(max-width:900px){#friends-dialog .friends-stage{grid-template-columns:minmax(0,1fr) 245px;gap:11px}}
@media(max-width:600px){
 #friends-dialog{width:96vw;height:calc(100dvh - 20px);max-height:calc(100dvh - 20px);padding:10px;border:2px solid #17111e;border-radius:8px;margin:auto}
 #friends-dialog[open]{grid-template-rows:43px minmax(0,1fr) 28px;gap:7px}
 #friends-dialog .friends-header{grid-template-columns:1fr auto;gap:6px}#friends-dialog .friends-header h2{grid-row:1;grid-column:1;font-size:19px!important;justify-self:start;margin:0;padding:7px 10px}
 #friends-dialog .friends-brand{display:none}
 #friends-dialog .friends-stage{grid-template-columns:1fr;grid-template-rows:minmax(72px,1fr) auto;padding:0;gap:8px}
 #friends-dialog .friends-players{height:100%;padding-top:25px}.lobby-count{font-size:16px!important;top:0!important;padding:1px 8px!important}
 #friends-dialog .lobby-player-scene,#friends-dialog .friends-map{display:none}
 #friends-dialog .lobby-player-name{font-size:12px;padding:4px 2px}#friends-dialog .lobby-ready{font-size:12px;padding:3px 0}.empty-player{gap:4px}.invite-plus{display:none}
 #friends-dialog .friends-match{padding:8px;width:100%}#friends-dialog .friends-match h3{display:none}
 #friends-dialog .room-lighting{margin-top:5px}#friends-dialog .room-controls{margin:5px 0}
 #friends-dialog .invite-room{display:none}#friends-dialog .lobby-code-row{margin:5px 0}
}
/* Friend rooms are a routed game page, under the shared menu header. */
#menu[data-page=friends] .header-back{display:flex}
#menu[data-page=friends] #game-shell{background:none}
body[data-menu-ready=true] #menu[data-page=friends] .ui-background{display:none}
#game-shell #friends-dialog{position:relative;inset:auto;width:100%;max-width:none;height:auto;min-height:100%;max-height:none;padding:18px var(--ui-edge) 22px;margin:0;border:0;border-radius:0;background:none;box-shadow:none;overflow:visible;display:grid;grid-template-rows:minmax(0,1fr) auto;gap:14px}
#game-shell #friends-dialog[hidden]{display:none!important}
#game-shell #friends-dialog>.friends-header{display:none}
#game-shell #friends-dialog .friends-stage{height:auto;min-height:420px;grid-template-columns:minmax(0,1fr) 300px;gap:25px;align-items:center}
#game-shell #friends-dialog .friends-players{height:365px;padding-top:42px}
#game-shell #friends-dialog #room-roster.lobby-cards{height:100%;grid-auto-rows:minmax(0,1fr)}
#game-shell #friends-dialog .lobby-player-card{height:100%;min-height:0}
#game-shell #friends-dialog .friends-match{max-height:none;padding:14px}
#game-shell #friends-dialog .friends-footer{padding-top:5px}
#game-shell #friends-dialog .friends-footer>.plate-button{font-size:18px!important;min-height:35px!important}
@media(min-width:601px) and (max-width:900px){#game-shell #friends-dialog .friends-stage{grid-template-columns:minmax(0,1fr) 270px;gap:15px;min-height:430px}#game-shell #friends-dialog .friends-players{height:310px}#game-shell #friends-dialog #room-roster.lobby-cards{grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:minmax(0,1fr);height:100%;gap:8px}#game-shell #friends-dialog .lobby-player-scene{min-height:55px}#game-shell #friends-dialog .lobby-player-card{padding:3px;border-radius:5px}#game-shell #friends-dialog .lobby-ready{font-size:12px;padding:3px 0}#game-shell #friends-dialog .lobby-player-name{font-size:13px;padding:4px 2px}#game-shell #friends-dialog .lobby-leader{height:17px}}
@media(max-width:600px){#game-shell #friends-dialog{padding:14px 20px 24px;gap:16px}#game-shell #friends-dialog .friends-stage{grid-template-columns:1fr;grid-template-rows:auto auto;gap:22px;min-height:0}#game-shell #friends-dialog .friends-players{height:175px;padding-top:30px}#game-shell #friends-dialog .friends-match{padding:14px}#game-shell #friends-dialog .friends-footer{padding:0}#game-shell #friends-dialog .lobby-player-scene{display:block;min-height:40px}#game-shell #friends-dialog .lobby-player-name{font-size:11px}#game-shell #friends-dialog .friends-map{display:block;aspect-ratio:3.5}}

/* The roster and chat share a column. Match rules and launch stay together. */
#game-shell #friends-dialog .friends-stage { align-items: start; }
#game-shell #friends-dialog .friends-match { align-self: start; }
.friends-social { min-width: 0; display: grid; gap: 14px; }
.room-rules, .room-list { margin-block: 8px; }
:is(.room-rules, .room-list) summary {
  padding: 7px 9px;
  border: 2px solid var(--ui-ink);
  border-radius: 3px;
  background: #322439;
  color: var(--ui-paper);
  font: italic 800 16px/1.1 var(--ui-display);
  cursor: pointer;
}
:is(.room-rules, .room-list) summary::marker { color: var(--ui-yellow); }
:is(.room-rules, .room-list, .room-chat) summary::after { content: none; }
.room-rules details > div { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; padding: 8px 5px 2px; }
.room-rules label { display: grid; min-width: 0; gap: 4px; align-content: end; margin: 0; color: var(--ui-paper); letter-spacing: normal; font: italic 800 14px/1.15 var(--ui-display); }
.room-rules .room-rule-toggle { display: flex; justify-content: space-between; align-items: center; grid-column: 1/-1; padding: 5px 1px 0; }
.room-rules input[type=checkbox] { margin: 0; width: 18px; height: 18px; accent-color: var(--ui-yellow); }
#friends-dialog .room-rules .ink-select { min-width: 0; }
#friends-dialog .room-rules .ink-select-button {
  justify-content: space-between;
  padding: 4px 6px !important;
  gap: 4px;
  min-height: 32px !important;
  font-size: 14px !important;
  text-align: left;
}
#friends-dialog .room-rules input[type=number] { min-height: 32px; }
.room-list [data-room-results] { display: grid; gap: 6px; max-height: 180px; overflow: auto; padding: 6px 2px; font: 12px/1.4 Arial,sans-serif; }
#friends-dialog .room-list button { display: grid; justify-content: start; gap: 3px; text-align: left; min-height: 38px; padding: 6px 9px; font-size: 16px; }
.room-list button small { font: 11px Arial,sans-serif; color: var(--sheet-muted); }
#friends-dialog .room-rule-action {
  width: 100%;
  padding: 3px 4px;
  background: var(--sheet-fill);
  color: var(--ui-paper);
  border: 1px solid var(--ui-ink);
  font-size: 13px;
}
#friends-dialog .room-rule-action:hover { background: var(--ui-paper); color: var(--ui-ink); }

.room-chat {
  min-width: 0;
  margin: 0;
  padding: 10px;
  color: var(--ui-paper);
  font: 13px/1.35 Arial,sans-serif;
}
.room-chat header, .room-chat form { display: flex; align-items: center; gap: 7px; }
.room-chat header { justify-content: space-between; margin-bottom: 7px; }
.room-chat ol { min-height: 39px; max-height: 120px; overflow: auto; margin: 0 0 7px; padding: 3px 8px; list-style: none; background: var(--sheet-fill); border: 1px solid var(--ui-ink); border-radius: 3px; }
.room-chat li { display: flow-root; padding: 5px 0; overflow-wrap: anywhere; }
.room-chat li + li { border-top: 1px solid var(--sheet-wash); }
.room-chat li strong { color: var(--ui-yellow); }
.room-chat li > span { display: block; }
.room-chat li > span:has(+ details) { margin-right: 28px; }
.room-chat li details { position: relative; }
.room-chat li summary {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 24px;
  height: 20px;
  background: var(--ui-panel);
  border: 1px solid var(--ui-ink);
  border-radius: 3px;
  list-style: none;
  cursor: pointer;
}
.room-chat li summary::-webkit-details-marker { display: none; }
.room-chat li details[open] summary { bottom: 100%; color: var(--ui-yellow); }
.room-chat li details div { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.room-chat li details .plate-button { width: auto; min-height: 24px; padding: 3px 7px; font-size: 14px; }
.room-chat li details .plate-button:disabled { opacity: .6; cursor: default; }
.room-chat form .plate-button { width: auto; flex: none; }
.team-chat, .match-chat-hud {
  position: fixed;
  left: clamp(12px,2.4vw,34px);
  bottom: clamp(118px,20vh,165px);
  width: min(380px,calc(100vw - 28px));
}
.team-chat {
  z-index: 14;
  pointer-events: auto;
  border: 2px solid var(--ui-ink);
  background: #4b354bee;
  box-shadow: 4px 4px var(--ui-ink);
}
.team-chat .sheet-section-title { color: var(--ui-ink); }
.team-chat .sheet-close { width: 30px; height: 30px; font-size: 21px; }
.match-chat-hud { z-index: 5; pointer-events: none; }
#hud:not([data-connection="online"]) .match-chat-hud,
.match-chat-hud[data-composing] { display: none; }
.match-chat-feed { display: grid; justify-items: start; gap: 4px; padding: 0; margin: 0 0 6px; list-style: none; }
.match-chat-feed:empty { margin: 0; }
.match-chat-feed li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  max-width: 100%;
  padding: 4px 9px;
  border: 2px solid var(--ui-ink);
  border-left: 3px solid var(--ui-yellow);
  background: #493449ed;
  color: var(--ui-paper);
  box-shadow: 2px 2px var(--ui-ink);
}
.match-chat-feed b { flex: none; color: var(--ui-yellow); font: italic 800 14px/1.2 var(--ui-display); }
.match-chat-feed span {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font: 13px/1.3 Arial,sans-serif;
}
.match-chat-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 2px;
  padding: 3px 7px;
  border: 1px solid var(--ui-ink);
  background: #362739e8;
  color: var(--ui-paper);
  transform: skew(-7deg);
  font: italic 800 13px/1.1 var(--ui-display);
  text-transform: uppercase;
}
.match-chat-hint kbd { font-size: 12px; padding: 2px 4px; }
@media(max-width:600px) {
  .friends-social { display: contents; }
  #game-shell #friends-dialog .room-chat { grid-row: 3; }
}
@media(max-width:550px) {
  .team-chat, .match-chat-hud { bottom: 208px; width: min(320px,calc(100vw - 28px)); }
}
