/* Settings and joining use App/Game unchanged. Only the playing arena is styled. */
#stage.cups-active{padding:0!important;min-width:0;overflow:hidden!important}
#stageWrap:has(#stage.cups-active){min-width:0;border-radius:0}
#stage.cups-active>.g-wrap{display:flex!important;flex-direction:column!important;width:100%!important;height:100%!important;max-width:none!important;min-height:0!important;transform:none!important;gap:0!important;padding:0!important}
#stage.cups-active .g-how,#stage.cups-active .g-top,#stage.cups-active #gtimer{display:none!important}
#stage.cups-active .g-body{display:block!important;flex:1!important;width:100%!important;height:100%!important;min-height:0!important;padding:0!important;overflow:hidden!important}
.cp3{height:100%;width:100%;min-width:0;display:flex;flex-direction:column;background:#0d1526;container-type:inline-size}.cp3 [hidden]{display:none!important}
.cp3-hud{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 18px;flex-shrink:0;background:linear-gradient(100deg,#181e33,#292136)}.cp3-hud>div{display:flex;gap:15px;align-items:center;min-width:0}.cp3-hud>div:first-child{align-items:start;flex-direction:column;gap:2px}.cp3-title{font-size:24px;color:#eee4da}.cp3-level,.cp3-round{font-size:12px;color:#b7b8cb}.cp3-clock{font-size:24px;min-width:44px;text-align:center;color:#e3b891;font-variant-numeric:tabular-nums}
.cp3-table{position:relative;flex:1;min-height:160px;min-width:0;overflow:hidden;isolation:isolate;touch-action:pan-y}.cp3-table canvas{display:block;width:100%;height:100%}.cp3-slots{position:absolute;inset:0;z-index:2;pointer-events:none}.cp3-slot{position:absolute;transform:translate(-50%,-50%);width:48px;height:44px;border:1px solid #b89c7e;border-radius:10px;background:#182030e8;color:#f2c89e;font:800 21px Tajawal,sans-serif;pointer-events:auto;cursor:pointer;box-shadow:0 6px 12px #0005}.cp3-slot:disabled{cursor:default}.cp3-slot.selected{background:#604334;border-color:#ffdda6;box-shadow:0 0 0 3px #e1af7922}.cp3-slot.correct{background:#2a5648;border-color:#8edbb4;color:#c7ffdc}.cp3-slot:focus-visible{outline:3px solid #dfb583;outline-offset:3px}
.cp3-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:45px;padding:8px 15px;flex-shrink:0;background:#191e34}.cp3-message{font-size:13px;color:#b7c2d9;line-height:1.7;min-width:0;overflow-wrap:anywhere}.cp3-next{flex-shrink:0;min-height:36px}.cp3-people{display:flex;align-items:center;gap:15px;padding:7px 15px;flex-shrink:0;background:#191e34;border-top:1px solid #32384f;font-size:12px;color:#baa98f}.cp3-faces{display:flex;gap:7px;align-items:center;min-width:0;flex-wrap:wrap}.cp3-avatar{display:inline-flex;align-items:center;justify-content:center}.cp3-people .av{width:29px!important;height:29px!important;font-size:17px!important;min-width:0!important}.cp3-result{position:absolute;z-index:3;top:3%;left:50%;transform:translateX(-50%);width:min(620px,92%);max-height:62%;overflow:auto;padding:13px 16px;background:#1b1d33eb;backdrop-filter:blur(10px);border:1px solid #9a87745e;border-radius:14px;text-align:center}.cp3-result h2{font-size:22px;color:#efd0a9}.cp3-result p{font-size:12px;color:#acbad2;margin:4px 0 10px}.cp3-reveal-faces{display:flex;justify-content:center;gap:12px;flex-wrap:wrap}.cp3-reveal-faces>div{display:flex;flex-direction:column;align-items:center;gap:4px;min-width:50px}.cp3-reveal-faces .av{width:49px!important;height:49px!important;font-size:28px!important}.cp3-reveal-faces b{font-size:12px;max-width:85px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cp3-reveal-faces small{font-size:10px}.cp3-reveal-faces .out{color:#e4abc7}.cp3-reveal-faces .out .av{filter:saturate(.6)}.cp3-reveal-faces .safe{color:#a9dbbe}.cp3-winners{text-align:center;padding:25px;width:100%;max-height:100%;overflow:auto}.cp3-winners h2{font-size:30px;margin-bottom:13px}.cp3-winners p{color:var(--dim);line-height:1.8}.cp3-winner-grid{display:flex;justify-content:center;gap:25px;flex-wrap:wrap;margin-top:24px}.cp3-winner-grid>div{display:flex;flex-direction:column;align-items:center;gap:9px}.cp3-winner-grid .av{width:84px!important;height:84px!important}
@container(max-width:600px){.cp3-hud{padding:7px 10px;gap:8px}.cp3-title{font-size:19px}.cp3-level,.cp3-round{font-size:10px}.cp3-clock{font-size:20px}.cp3-hud>div{gap:8px}.cp3-slot{width:42px;height:42px;font-size:19px}.cp3-footer{padding:7px 10px;gap:8px}.cp3-message{font-size:11px}.cp3-next{font-size:12px;padding:7px 9px}.cp3-people{padding:6px 10px;gap:9px;font-size:11px}.cp3-faces{gap:4px}.cp3-people .av{width:23px!important;height:23px!important;font-size:13px!important}.cp3-result{padding:9px 10px}.cp3-result h2{font-size:18px}.cp3-reveal-faces{gap:7px}.cp3-reveal-faces .av{width:36px!important;height:36px!important;font-size:21px!important}.cp3-reveal-faces b{font-size:10px;max-width:65px}.cp3-reveal-faces small{font-size:9px}.cp3-reveal-faces>div{min-width:38px}}
@media(max-height:500px) and (orientation:landscape){.cp3-hud{padding:4px 10px}.cp3-title{font-size:17px}.cp3-level{display:none}.cp3-clock{font-size:17px}.cp3-footer{padding:4px 10px;min-height:33px}.cp3-message{font-size:11px}.cp3-next{min-height:29px;padding:3px 8px;font-size:11px}.cp3-people{padding:3px 10px}.cp3-people .av{width:21px!important;height:21px!important}.cp3-slot{width:38px;height:34px;font-size:18px}.cp3-table{min-height:115px}.cp3-result{max-height:65%;padding:6px 10px}.cp3-result h2{font-size:17px}.cp3-result p{margin:2px 0 5px}.cp3-reveal-faces .av{width:29px!important;height:29px!important}.cp3-reveal-faces b{font-size:9px}}

/* The active match owns the viewport; removing cups-active restores the native lobby. */
body:has(#stage.cups-active){padding:0!important;overflow:hidden!important}
body:has(#stage.cups-active) #topbar,
body:has(#stage.cups-active) #rail,
body:has(#stage.cups-active) #chatpane,
body:has(#stage.cups-active) #brandmark{display:none!important}
body:has(#stage.cups-active) #toolrail{
 position:fixed!important;inset:0 0 auto!important;width:100%!important;
 height:calc(46px + env(safe-area-inset-top))!important;
 padding:env(safe-area-inset-top) max(10px,env(safe-area-inset-right)) 0 max(10px,env(safe-area-inset-left))!important;
 flex-direction:row!important;gap:10px!important;overflow:visible!important;
 border:0!important;background:#171e30!important;box-shadow:none!important
}
body:has(#stage.cups-active) #toolrail .brand{width:auto!important;flex-direction:row!important;padding:0!important}
body:has(#stage.cups-active) #toolrail .brand-logo{width:30px;height:30px;padding:4px}
body:has(#stage.cups-active) #toolrail .brand-text span,
body:has(#stage.cups-active) #toolrail .tr-foot,
body:has(#stage.cups-active) #toolrail::after{display:none!important}
body:has(#stage.cups-active) #toolrail .tools{flex-direction:row!important;width:auto!important;margin:0 auto 0 0!important;gap:6px!important}
body:has(#stage.cups-active) #toolrail .tools>button:not(#btnSound):not(#btnCfg):not(#btnFull){display:none!important}
body:has(#stage.cups-active) #toolrail .btn-icon{width:34px!important;height:34px!important}
body:has(#stage.cups-active) #layout{
 position:fixed!important;inset:calc(46px + env(safe-area-inset-top)) 0 0!important;
 display:block!important;width:auto!important;height:auto!important;
 min-height:0!important;padding:0!important;margin:0!important;overflow:hidden!important
}
body:has(#stage.cups-active) #stageWrap{
 position:absolute!important;inset:0!important;display:flex!important;flex-direction:column!important;
 width:100%!important;height:100%!important;max-width:none!important;min-height:0!important;
 margin:0!important;padding:0!important;gap:0!important;background:#0d1526
}
body:has(#stage.cups-active) #stageBar{
 position:relative!important;inset:auto!important;display:flex!important;order:2;
 flex:0 0 auto!important;justify-content:center!important;overflow:visible!important;
 padding:5px max(8px,env(safe-area-inset-right)) max(5px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))!important;
 border:0!important;border-radius:0!important;background:#171e30!important;box-shadow:none!important
}
body:has(#stage.cups-active) #stageBar .sb-right,
body:has(#stage.cups-active) #stageBar .sb-mid{display:none!important}
body:has(#stage.cups-active) #stageBar .sb-left{
 position:static!important;inset:auto!important;display:flex!important;width:auto!important;max-width:100%!important;
 flex-wrap:wrap!important;justify-content:center!important;margin:0!important;padding:0!important;
 gap:6px!important;background:none!important;border:0!important;box-shadow:none!important;backdrop-filter:none!important
}
body:has(#stage.cups-active) #stageBar .btn{min-height:34px;padding:5px 12px!important}
body:has(#stage.cups-active) #stage.cups-active{
 position:relative!important;inset:auto!important;order:0;flex:1 1 0!important;
 width:100%!important;height:auto!important;min-height:0!important;max-width:none!important;
 margin:0!important;padding:0!important;border:0!important;border-radius:0!important;box-shadow:none!important
}
#stage.cups-active::before,#stage.cups-active::after{display:none!important}
#stage.cups-active .g-body{max-width:none!important;margin:0!important}
body:has(#stage.cups-active) #practice{
 position:relative!important;inset:auto!important;order:1;flex:0 0 auto!important;
 width:100%!important;max-height:24dvh!important;overflow:auto!important;
 margin:0!important;border-radius:0!important;padding:6px 10px!important
}
body:has(#stage.cups-active) #gdock{right:0!important;max-height:100dvh!important}
#stage.cups-active .cp3-table{min-height:0}
#stage.cups-active .cp3-faces{flex-wrap:nowrap;overflow:hidden}
#stage.cups-active .cp3-faces>*{flex-shrink:0}
#stage.cups-active .cp3-hud,#stage.cups-active .cp3-footer,#stage.cups-active .cp3-people{
 padding-inline-start:max(10px,env(safe-area-inset-right));padding-inline-end:max(10px,env(safe-area-inset-left))
}
