*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:#000;color:#fff;font-family:Arial,sans-serif}body{padding:0}button,input{font:inherit}button{cursor:pointer;touch-action:manipulation}button:disabled{cursor:default;opacity:.4}[hidden]{display:none!important}button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid #9eefff;outline-offset:3px}#lobbyApp{max-width:1400px;margin:auto;padding:16px 4% 45px}header.logo{display:block;text-align:center;font-family:'Arial Rounded MT Bold','Arial Black',sans-serif;font-weight:1000;font-size:clamp(26px,5vw,66px);letter-spacing:-2px;color:#fff9dc;-webkit-text-stroke:2px #b8400c;text-shadow:0 4px #873011,2px 6px #572014;line-height:1.2;margin:8px 0 24px;height:auto;border:0}.logo span{color:#ffd324}.screenPanel{max-width:1100px;margin:auto;text-align:center}.screenPanel h1{font-size:clamp(22px,3vw,36px);margin:16px 0 24px}.screenPanel h2{font-size:20px}.screenPanel p,.screenPanel small{color:#b9c7d5}.screenPanel a{color:#f5d179}.goldButton{background:linear-gradient(#ffdf70,#f3af24);color:#382007;border:2px solid #b96412;border-radius:14px;font-weight:bold;padding:15px 30px;margin:20px auto;box-shadow:0 4px #7d3c09}.countButtons{display:grid;grid-template-columns:repeat(5,1fr);gap:18px;max-width:650px;margin:25px auto}.countButtons button{border:2px solid #716046;border-radius:18px;background:#1a212d;color:#fff;font-size:36px;padding:20px}.countButtons button[aria-pressed=true]{background:#ffd34d;color:#3b2308;border-color:#fff1b5;box-shadow:0 0 26px #ffcf4440}.splash{position:fixed;inset:0;width:100%;height:100vh;height:100dvh;margin:0;padding:0;background:#000;z-index:90;display:block;overflow:hidden}.splash>img{position:absolute;inset:0;display:block;width:100%;height:100%;max-width:none;max-height:none;margin:0;object-fit:contain;object-position:center center}.splash button{position:absolute;bottom:7%;left:50%;transform:translateX(-50%);background:#132d49e8;color:white;border:1px solid #ffdf8e;border-radius:30px;padding:13px 25px;white-space:nowrap}.hostColumns{display:grid;grid-template-columns:1fr 1.2fr;gap:40px;align-items:center}.hostColumns #qr{width:min(300px,100%);height:auto;display:block;margin:0 auto 12px;border:14px solid white;border-radius:14px}.hostRoster{display:grid;grid-template-columns:1fr 1fr;gap:8px}.rosterPlayer{display:flex;align-items:center;background:#17202a;border:1px solid #46525e;border-radius:12px;padding:8px;text-align:left}.rosterPlayer img{width:56px;height:62px;object-fit:contain}.rosterPlayer strong{overflow-wrap:anywhere}.registerGrid{display:grid;grid-template-columns:1fr 2.2fr;gap:25px;text-align:left}.pseudoLabel{display:block;font-weight:900;font-size:26px;margin-bottom:8px}#pseudo{width:100%;border:2px solid #ccab5b;border-radius:12px;background:#171c24;color:#fff;padding:12px}.photoActions{display:flex;gap:8px;margin:15px 0}.photoActions button,#photoSettings button,#phonePass{background:#243547;color:white;padding:9px;border:1px solid #526981;border-radius:8px}#photoSettings{display:flex;align-items:center;gap:5px;margin:12px 0}#portrait{width:45px;height:67px;border-radius:50%;object-fit:cover}.avatarGrid{display:grid;grid-template-columns:repeat(5,1fr);gap:8px}.avatarGrid button{background:#172330;border:2px solid #475260;border-radius:13px;color:white;padding:4px;position:relative}.avatarGrid img{width:100%;height:100px;object-fit:contain}.avatarGrid span{display:block;font-size:11px}.avatarGrid button[aria-pressed=true]{border-color:#ffdc69;background:#493717}.avatarGrid button:disabled{filter:grayscale(1);opacity:.3}.waitingScreen{position:fixed;inset:0;background:#000}.waitingScreen img{width:100%;height:100%;object-fit:contain}.waitingScreen strong{position:absolute;top:50%;left:5%;width:90%;text-align:center;padding:20px;background:#102b42de;border:2px solid #ffde8a;border-radius:18px;font-size:clamp(22px,4vw,50px);text-shadow:0 2px #000}.playerColumns{display:grid;grid-template-columns:45% 55%;height:min(58vh,450px);text-align:left}.playerColumns canvas{width:100%;height:100%;min-height:0}.playerColumns section{overflow:auto;padding:0 20px}#liveRanking{list-style:none;padding:0;margin:0}#liveRanking li{display:flex;gap:12px;justify-content:space-between;padding:8px 12px;margin:5px 0;border-radius:8px;background:#172330;font-size:17px}#liveRanking li.mine{border:1px solid #ffd56a;color:#ffdf8c}#liveRanking li b{margin-left:auto}#playerName{margin:3px 0;font-size:clamp(24px,4vw,46px)}.phoneQuestionTop{display:flex;align-items:center;gap:15px}.phoneQuestionTop h2{flex:1}#phoneTimer{color:#ffdf7e;font-size:24px;font-weight:bold}.phoneQuestionGrid{display:flex;gap:18px;align-items:center}.phoneQuestionGrid>img{width:32%;max-height:210px;object-fit:contain}#phoneAnswers{flex:1;display:grid;grid-template-columns:1fr 1fr;gap:10px}#phoneAnswers>button{padding:15px;border-radius:12px;background:#24384d;color:#fff;border:1px solid #6c7c8e;font-weight:bold}.phoneQuestionGrid #phoneAnswers:has(.estimateSlider),.phoneQuestionGrid #phoneAnswers.rankControl{display:block}#phoneNotice{margin:5px}#connectionError{color:#ff9d9d;text-align:center;position:relative;z-index:100}.musicToggle{position:fixed;right:10px;bottom:8px;border:1px solid #695d42;background:#101922d9;color:#ffdf8c;border-radius:20px;padding:7px 13px;z-index:95}
@media(orientation:portrait){.hostColumns{grid-template-columns:1fr}.countButtons{gap:8px}.countButtons button{font-size:25px;padding:15px 8px}}
@media(orientation:landscape) and (max-height:550px){#lobbyApp{padding:5px 3% 25px}header.logo{font-size:30px;margin:2px 0 10px;-webkit-text-stroke:1px #a84014}.screenPanel h1{font-size:23px;margin:5px 0 12px}.countButtons{max-width:520px;gap:8px;margin:12px auto}.countButtons button{padding:9px;font-size:27px}.goldButton{padding:9px 20px;margin:10px auto}.screenPanel h2{font-size:16px;margin:6px}.registerGrid{gap:15px}.avatarGrid img{height:67px}.avatarGrid span{font-size:9px}.photoActions{margin:8px 0}.photoActions button{font-size:10px}small{font-size:9px}.pseudoLabel{font-size:21px}#pseudo{padding:8px}.avatarGrid{gap:5px}.playerColumns{height:62vh}.playerColumns h2{margin:0}#liveRanking li{font-size:13px;padding:5px 8px;margin:3px}#playerMessage{font-size:11px;margin:3px}.phoneQuestionTop h2{font-size:17px}#phoneAnswers>button{padding:10px;font-size:13px}.phoneQuestionGrid>img{max-height:155px}.hostColumns #qr{width:210px}.hostRoster img{height:40px;width:38px}.hostRoster{gap:4px}.rosterPlayer{font-size:12px;padding:4px}}

#phoneAnswers.estimateControl{display:flex;flex-direction:column;text-align:left}#phoneAnswers.rankingControl{display:block}#phoneAnswers .rankBoard{height:190px}#phoneAnswers .rankTile{color:#1c293c}#phoneAnswers .estimateValue{color:#ffda7b}#phoneAnswers .estimateHint{color:#ccd4e0}#phoneAnswers .rankNumber{color:#ffda7b}
@media(max-height:550px){#phoneAnswers .rankBoard{height:160px;min-height:0}#phoneAnswers .rankTile{font-size:12px;padding:5px}}
#playerTools{position:fixed;bottom:max(6px,env(safe-area-inset-bottom));left:10px;z-index:96;display:flex;gap:8px}#playerTools button{border:1px solid #737d8a;border-radius:20px;background:#102031ee;color:#fff;padding:8px 14px;font-size:12px}#leaveDialog{background:#13263b;color:white;border:2px solid #f1c86d;border-radius:20px;padding:22px;max-width:min(90vw,500px)}#leaveDialog::backdrop{background:#000c}#leaveDialog button{padding:12px;border-radius:10px;border:0;margin:5px;background:#ebc56e;color:#35291c}#confirmLeave{background:#a33c42!important;color:white!important}#leftScreen{text-align:center;padding:15vh 20px}#leftScreen a{color:#ffd776}#phoneDie{position:absolute;left:4%;bottom:45px;width:34%;border-radius:16px;background:#10263ce8;text-align:center;z-index:5}#phoneDieStage{height:135px;position:relative}#phoneDieStage:empty{display:none}#phoneDie .dice3d{position:absolute;inset:0;display:flex;align-items:center;justify-content:center}#phoneDie canvas{height:130px!important;width:130px!important}#phoneDie .dice3dCaption{position:absolute;bottom:0;font-size:11px}#phoneDie .goldButton{margin:8px;padding:10px}#phoneDie p{font-size:12px;margin:4px}#playerScreen{position:relative}.playerColumns{padding-bottom:10px}
@media(orientation:landscape) and (max-height:550px){#phoneDieStage{height:100px}#phoneDie canvas{height:95px!important;width:95px!important}#phoneDie .goldButton{font-size:13px;padding:8px;margin:5px}#playerTools button{font-size:10px;padding:7px 10px}#lobbyApp{padding-bottom:42px}}
/* Five choices on row one, four centered on row two. */
.countButtons{grid-template-columns:repeat(10,minmax(0,1fr))}.countButtons button{grid-column:span 2}.countButtons button:nth-child(6){grid-column:2/span 2}
#countScreen{overflow:auto;max-height:82dvh}
.teamField,.teamSetup label,#joinTeamPanel label{display:inline-flex;align-items:center;gap:.5em;margin:.35em;font-weight:bold}
.teamSetup select,.teamSetup input,.teamField select,#joinTeamPanel select,#extraMembers input{font:inherit;padding:.45em;border-radius:.5em;background:#202b40;color:#fff;border:1px solid #73849c}
#teamSizes input{width:3.6em}#extraMembers label{display:flex;flex-wrap:wrap}#extraMembers input{max-width:9em}
#joinTeamPanel{margin:.8rem auto;background:#142238;padding:.5rem;border-radius:12px}
.flowChoices,.flowNav{display:flex;justify-content:center;align-items:center;gap:clamp(12px,2vw,32px);flex-wrap:wrap;margin:22px auto}
.flowChoices button,.teamDrop>button:first-child,.flowNav button,#countScreen>button{border-radius:14px;border:2px solid #4d5e77;background:#202b40;color:white;padding:.7em 1.25em;font-weight:800}
.flowChoices button{font-size:clamp(22px,3vw,46px);min-width:4em}.flowChoices button[aria-pressed=true],.flowNav .goldButton{background:#ffd16d;color:#182137;border-color:#ffdf98}
.flowNav button{margin:0;font-size:clamp(17px,1.6vw,27px)}.teamNumbers button{min-width:2.6em}.teamNameRows{margin:auto;width:min(620px,96%);display:grid;gap:8px}.teamNameRows label{display:grid;grid-template-columns:1fr 2fr;text-align:left;align-items:center;gap:12px;font-size:clamp(16px,1.8vw,26px)}.teamNameRows input,#guestName{min-width:0;padding:.5em;border-radius:8px;font:inherit}
.teamColumns{display:grid;grid-template-columns:repeat(var(--teams),minmax(0,1fr));gap:10px}.teamDrop{min-width:0;min-height:100px;border:2px solid var(--team-color,#51617c);border-radius:14px;background:#131c2b;padding:8px}.teamDrop.over{background:#35445b}.teamDrop>button:first-child{width:100%;color:var(--team-color,#fff);font-size:clamp(16px,1.8vw,28px);overflow-wrap:anywhere;padding:8px;border:0}
.assignmentPool{margin-bottom:14px}.avatarCard{display:inline-flex;flex-direction:column;align-items:center;width:min(90px,100%);vertical-align:top;margin:3px;border:2px solid transparent;border-radius:10px;background:#273447;color:white;font-weight:bold;touch-action:none;cursor:grab;overflow-wrap:anywhere}.avatarCard img{width:100%;height:clamp(42px,7vh,76px);object-fit:contain}.avatarCard[aria-pressed=true]{border-color:#ffd16d}.avatarCard span{max-width:100%}
#guestDialog{color:white;background:#15243a;width:min(640px,95vw);border-radius:16px}#guestDialog::backdrop{background:#000a}#addGuestButton{position:relative;z-index:2}
@media(max-width:650px){.teamColumns{grid-template-columns:repeat(2,minmax(0,1fr))}}
.waitingScreen #addGuestButton{position:absolute;top:70%;left:50%;transform:translateX(-50%);width:min(88%,430px);margin:0}
/* Host setup occupies the area between the logo and the bottom controls. */
#lobbyApp:has(.setupMiddle){--setup-height:calc(100svh - clamp(112px,11vh + 65px,178px))}
#lobbyApp :is(#countScreen,#hostScreen,#modeScreen,#teamsScreen,#assignScreen,#devicesScreen){
 display:grid;grid-template-rows:auto minmax(min-content,1fr) auto;
 min-height:var(--setup-height);max-height:none;overflow:visible;
}
.setupMiddle{align-self:center;min-width:0;padding:12px 0}
#lobbyApp .setupMiddle .flowChoices{margin:12px auto}
#modeChoices,#deviceChoices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));max-width:850px;align-items:stretch}
#modeChoices button,#deviceChoices button{width:100%;min-width:0}
#countScreen .setupMiddle>button{margin:4px 8px;padding:8px 14px;border-radius:10px;background:#202b40;color:white;font-weight:700}
#lobbyApp .flowNav{align-self:end;margin:16px auto 6px}
@media(max-height:520px){#lobbyApp:has(.setupMiddle){--setup-height:calc(100svh - 70px)}.setupMiddle{padding:4px 0}#lobbyApp .flowNav{margin:8px auto 2px}}

#modeChoices{width:min(100%,600px);gap:12px}#modeChoices button{box-sizing:border-box;padding:.65em .5em;font-size:clamp(20px,3vw,38px)}
#lobbyApp #durationScreen{display:grid;grid-template-rows:auto minmax(min-content,1fr) auto;min-height:var(--setup-height)}
#durationChoices{max-width:720px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}#durationChoices button{min-width:0;font-size:clamp(19px,2.5vw,32px);padding:.6em}#durationChoices small,#shortRoutes small{display:block;font-size:.65em;font-weight:400;margin-top:8px;line-height:1.5}
#shortRoutes:not([hidden]){display:flex;justify-content:center;gap:12px;flex-wrap:wrap}#shortRoutes button{flex:1 1 220px;max-width:350px;padding:16px;border:2px solid #536581;border-radius:14px;background:#202b40;color:white;font-size:clamp(18px,2vw,26px)}#shortRoutes button[aria-pressed=true]{background:#ffd16d;color:#182137;border-color:#ffe8b8}
.accountDialog{width:min(440px,90vw);box-sizing:border-box;background:#142238;color:white;border:1px solid #596d89;border-radius:20px;padding:24px}.accountDialog::backdrop{background:#000c}.accountDialog input{display:block;width:100%;box-sizing:border-box;padding:12px;margin:12px 0;font-size:18px}.accountDialog button{padding:12px;font-size:18px}.organizerBadge{position:absolute;top:max(12px,env(safe-area-inset-top));right:12px;z-index:5;background:#000b;padding:8px 12px;border-radius:10px;color:white;max-width:80vw;font-size:14px;overflow-wrap:anywhere}.organizerBadge button{display:block;font-size:12px;padding:4px;margin:4px 0 0}
.splash .organizerBadge button{position:static;transform:none;white-space:normal;left:auto;bottom:auto;border-radius:6px;padding:4px 8px}
#shortRoutes button[aria-pressed=true] small,#durationChoices button[aria-pressed=true] small{color:#44321d}
/* Compact host menus on landscape phones. Portrait/player question layouts stay independent. */
body.landscapeSetup{height:var(--visible-height,100dvh);overflow:hidden}
body.landscapeSetup #lobbyApp{height:var(--visible-height);padding:4px max(12px,env(safe-area-inset-right)) 4px max(12px,env(safe-area-inset-left));overflow:hidden}
body.landscapeSetup header.logo{font-size:25px;line-height:1.1;margin:0 0 4px;-webkit-text-stroke:1px #b8400c}
body.landscapeSetup #lobbyApp .screenPanel{min-height:0;transform-origin:top center;grid-template-rows:auto auto auto}
body.landscapeSetup .screenPanel h1{font-size:19px;margin:2px 0 5px}
body.landscapeSetup .setupMiddle{padding:2px 0}
body.landscapeSetup .flowNav{margin:5px auto 0!important;gap:16px}
body.landscapeSetup .flowNav button{font-size:16px;padding:6px 20px}
body.landscapeSetup .flowChoices{margin:4px auto!important;gap:10px}
body.landscapeSetup .flowChoices button{font-size:21px;padding:7px 16px}
body.landscapeSetup .countButtons{max-width:470px;gap:6px;margin:4px auto}
body.landscapeSetup .countButtons button{font-size:23px;padding:6px;border-radius:10px}
body.landscapeSetup #countScreen .setupMiddle>button{font-size:12px;padding:5px 9px;margin:2px 4px}
body.landscapeSetup #testBotHint{font-size:11px;margin:2px}body.landscapeSetup #countScreen a{font-size:11px}
body.landscapeSetup .hostColumns{grid-template-columns:150px 1fr;gap:16px;max-width:850px;margin:auto}
body.landscapeSetup .hostColumns #qr{width:120px;border-width:6px;margin-bottom:2px}
body.landscapeSetup #joinedCount{font-size:16px;margin:2px}
body.landscapeSetup .hostRoster{grid-template-columns:repeat(5,minmax(0,1fr));gap:4px}
body.landscapeSetup .rosterPlayer{flex-direction:column;text-align:center;padding:3px;font-size:10px;gap:2px}
body.landscapeSetup .rosterPlayer img{width:30px;height:34px}
body.landscapeSetup .teamNameRows{grid-template-columns:repeat(2,minmax(0,1fr));max-width:850px;gap:4px 15px}
body.landscapeSetup .teamNameRows label{font-size:13px;gap:5px;grid-template-columns:70px 1fr}
body.landscapeSetup .teamNameRows input{padding:4px}
body.landscapeSetup .teamColumns{grid-template-columns:repeat(var(--teams),minmax(0,1fr));gap:5px}
body.landscapeSetup .teamDrop{padding:3px;min-height:48px;border-radius:8px}
body.landscapeSetup .teamDrop>button:first-child{font-size:12px;padding:3px}
body.landscapeSetup .avatarCard{width:45px;margin:2px;font-size:10px}
body.landscapeSetup .avatarCard img{height:30px}
body.landscapeSetup .assignmentPool{margin-bottom:4px}
body.landscapeSetup #assignScreen p,body.landscapeSetup #deviceOwners{font-size:11px;margin:3px}
body.landscapeSetup #durationChoices button{font-size:19px;padding:5px 16px}
body.landscapeSetup #shortRoutes{flex-wrap:nowrap;gap:8px}
body.landscapeSetup #shortRoutes button{min-width:0;font-size:15px;padding:7px;flex:1}
body.landscapeSetup #shortRoutes small,body.landscapeSetup #durationChoices small{font-size:11px;line-height:1.25;margin-top:3px}
body.landscapeSetup #durationScreen p{font-size:11px;margin:4px}
body.landscapeSetup .musicToggle{font-size:11px;padding:4px;bottom:4px;right:4px}

#leftScreen{position:fixed;inset:0;z-index:9999;background:#000;padding:0}

.danceTests{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin:5px auto}
.danceTests button,#dancePreview button{font-size:14px;line-height:1.2;font-family:inherit;font-weight:700;color:#eafafb;border:1px solid #42707d;border-radius:10px;background:#163342;padding:9px 14px}
#dancePreview{padding:0;width:min(90vw,920px);height:min(85dvh,620px);max-height:95dvh;box-sizing:border-box;color:white;background:#102b3a;border:1px solid #57868c;border-radius:16px;overflow:hidden}
#dancePreview[open]{display:grid;grid-template-rows:auto minmax(0,1fr) auto}
#dancePreview::backdrop{background:#021017da}
#dancePreview header,#dancePreview footer{display:flex;align-items:center;justify-content:space-between;padding:8px 14px;gap:8px}
#dancePreview h2{font-size:clamp(16px,2.6vh,27px);margin:0}
#dancePreview footer>div{display:flex;gap:6px}
#dancePreview button[aria-pressed=true]{background:#ffd273;color:#2b2419;border-color:#ffd273}
.danceStage{position:relative;min-height:0;background:#09253c}.danceStage canvas{position:absolute;inset:0;width:100%;height:100%;display:block}
.danceCue{position:absolute;top:8px;left:12px;color:#ffda86;font-size:clamp(18px,4vh,36px)}
@media(orientation:landscape) and (max-height:540px){#dancePreview{height:94dvh}#dancePreview header,#dancePreview footer{padding:3px 10px}#dancePreview button,.danceTests button{padding:5px 10px}}
#seeGenie{color:#ffdd8a;border-color:#a2834d}
#genieDialog{padding:0;width:min(90vw,850px);height:min(88dvh,660px);background:#132b38;border:1px solid #9dbaaa;border-radius:18px;overflow:hidden}
#genieDialog::backdrop{background:#020917d9}
#genieDialog iframe{display:block;width:100%;height:100%;border:0}
#closeGenie{position:absolute;top:10px;right:10px;width:44px;height:44px;padding:0;border-radius:50%;background:#112735;color:white;border:1px solid #a7bcbb}

#leftScreen:not([hidden]){display:grid;align-content:center;justify-items:center;gap:1rem;color:white}
