/* A shared page contract; individual boards keep their native proportions. */
html:has(body[data-game-frame]){min-height:100%;}
body[data-game-frame]{--game-frame-width:min(100%,960px);--game-frame-height:min(var(--game-frame-visible-height,100dvh),100dvh);box-sizing:border-box!important;position:relative!important;inset:auto!important;width:var(--game-frame-width)!important;max-width:960px!important;height:var(--game-frame-height)!important;min-height:var(--game-frame-height)!important;margin:0 auto!important;padding:0!important;}
body[data-game-frame]>main{box-sizing:border-box!important;width:100%!important;max-width:none!important;height:var(--game-frame-height)!important;min-height:0!important;margin:0!important;}
body[data-game-frame][data-game]>.nav{width:100%;max-width:none;margin:0;height:calc(44px + env(safe-area-inset-top));}
body[data-game-frame][data-game]>main.shell{height:calc(var(--game-frame-height) - 44px - env(safe-area-inset-top))!important;}
/* Identical field and controls geometry both before and after starting a game. */
body[data-game-frame][data-game] .game-card{max-width:560px;}
body[data-game-frame][data-game] .game-controls{height:196px;min-height:196px;justify-content:flex-end;}
body[data-game-frame][data-game] .game-controls>.actions{margin-top:auto;flex-shrink:0;}
body[data-game-frame][data-game] .game-controls>.status{height:16px;min-height:16px;flex:none;}
body[data-game-frame][data-game] .game-controls>#hint{flex:none;}
body[data-game-frame][data-game] .game-controls:has(#retry-connect:not([hidden]))>.status{height:auto;min-height:16px;}
body[data-game-frame][data-game] .heading{display:flex;}
body[data-game-frame][data-game] .progress-track{display:block;}
body[data-game-frame="link-match"] main{padding-inline:16px;}
body[data-game-frame="bridge-keeper"] #game{max-width:none;}
body[data-game-frame] dialog{max-width:calc(100vw - 24px);max-height:calc(var(--game-frame-height) - 24px - env(safe-area-inset-top))!important;}
@media(min-width:961px){body[data-game-frame]{box-shadow:0 0 0 1px #80808030,0 0 60px #00000018;}}
@media(orientation:landscape) and (max-height:540px){
 body[data-game-frame][data-game] .game-card{max-width:900px;}
 body[data-game-frame][data-game] .game-controls{height:100%;min-height:0;}
 body[data-game-frame][data-game] .heading,body[data-game-frame][data-game] .progress-track{display:none;}
}
@media(orientation:portrait) and (max-height:600px){body[data-game-frame][data-game] .heading,body[data-game-frame][data-game] .progress-track{display:none;}}
@media(orientation:portrait) and (max-height:600px){
 body[data-game-frame="2048"] .toolbar{display:none;}
 body[data-game-frame="2048"] .title{margin:2px 0;}
 body[data-game-frame="2048"] #status{margin:2px 0;}
 body[data-game-frame="2048"] .sponsors-top,body[data-game-frame="2048"] .sponsors-bottom{margin:3px 0;}
 body[data-game-frame="pixel-clear"] #tray-label{display:none;}
 body[data-game-frame="pixel-clear"] #tray{padding-block:3px;}
}
@media(max-height:600px){
 body[data-game-frame="2048"] .toolbar p{font-size:11px;line-height:1.3;}
 body[data-game-frame="2048"] h1{font-size:36px;}
 body[data-game-frame="2048"] :is(.sponsors-top,.sponsors-bottom) .sponsor-link{min-height:32px;padding:5px 8px;}
 body[data-game-frame="2048"] .sponsor-domain{font-size:10px;}
 body[data-game-frame="2048"] .sponsors-bottom .sponsor-name{font-size:13px;}
 body[data-game-frame="card-sort"] .hint{display:none;}
 body[data-game-frame="card-sort"] .tools{height:50px;min-height:50px;padding:0;}
 body[data-game-frame="card-sort"] .tool-tile{height:48px;min-height:44px;}
 body[data-game-frame="card-sort"] .tool-tile svg{height:25px;width:25px;}
 body[data-game-frame="card-sort"] :is(.sponsors-top,.sponsors-bottom) .sponsor-link{min-height:32px;padding:5px 7px;}
 body[data-game-frame="card-sort"] .sponsors-bottom .sponsor-name{font-size:12px;}
 body[data-game-frame="pixel-clear"] #ad-top:not(:empty){padding-bottom:0;}
 body[data-game-frame="pixel-clear"] .tools{margin:3px 0!important;}
 body[data-game-frame="pixel-clear"] .tools button{min-height:44px!important;}
 body[data-game-frame="pixel-clear"] .tools img{height:25px;width:25px;}
 body[data-game-frame="pixel-clear"] .hud{height:28px;margin:0 0 3px;}
 body[data-game-frame="pixel-clear"] #status{margin:0;}
 body[data-game-frame="find-ball"] .boards{min-height:0;}
 body[data-game-frame="find-ball"] .game-top h2{font-size:17px;}
 body[data-game-frame="find-ball"] .game-top .eyebrow{display:none;}
 body[data-game-frame="find-ball"] .stats{padding:4px 8px;margin-top:3px;}
 body[data-game-frame="find-ball"] :is(.sponsors-top,.sponsors-bottom) .sponsor-link{min-height:32px;padding:5px 8px;}
 body[data-game-frame="find-ball"] .game-bottom{min-height:44px;margin-top:3px;}
 body[data-game-frame="find-ball"] .game-bottom button{min-height:44px;padding:6px 10px;font-size:15px;}
 body[data-game-frame="find-ball"] .return-gallery{min-height:44px;margin-top:0;}
 body[data-game-frame="find-ball"] .caption{margin:2px 0;font-size:10px;}
}
@media(orientation:landscape) and (max-height:540px){
 body[data-game-frame="2048"] main{display:grid!important;grid-template-columns:220px minmax(0,1fr);grid-template-rows:40px 36px 44px 32px minmax(88px,1fr) 36px;gap:2px 12px;padding:6px 12px!important;}
 body[data-game-frame="2048"] main>nav{grid-area:1/1;margin:0;}
 body[data-game-frame="2048"] .title{grid-area:2/1;margin:0;}
 body[data-game-frame="2048"] .scores>div{padding:2px 8px;}
 body[data-game-frame="2048"] .scores strong{font-size:18px;}
 body[data-game-frame="2048"] .toolbar{grid-area:3/1;margin:0;}
 body[data-game-frame="2048"] .toolbar p{max-width:130px;font-size:10px;}
 body[data-game-frame="2048"] .toolbar #reset{padding:4px 6px;min-height:44px;font-size:11px;}
 body[data-game-frame="2048"] .sponsors-top{grid-area:4/1;margin:0;}
 body[data-game-frame="2048"] #board{grid-area:1/2/6/3;width:min(100%,calc(var(--game-frame-height) - 56px))!important;height:auto!important;justify-self:center;align-self:center;}
 body[data-game-frame="2048"] .viewport-actions{grid-area:5/1;margin:0;gap:0;}
 body[data-game-frame="2048"] #status{grid-area:6/1;align-self:center;margin:0;font-size:10px;}
 body[data-game-frame="2048"] .sponsors-bottom{grid-area:6/2;margin:0;gap:5px;}
 body[data-game-frame="2048"] .sponsors-bottom .sponsor-domain{display:none;}
 body[data-game-frame="card-sort"] main{display:grid!important;grid-template-columns:210px minmax(0,1fr);grid-template-rows:44px 34px 36px 34px minmax(48px,1fr) 42px;gap:3px 10px;padding:6px 12px!important;}
 body[data-game-frame="card-sort"] .head{grid-area:1/1;margin:0;gap:4px;}
 body[data-game-frame="card-sort"] .head-actions{gap:3px;}
 body[data-game-frame="card-sort"] .head-actions button,body[data-game-frame="card-sort"] .head-actions a{font-size:10px;padding:4px;}
 body[data-game-frame="card-sort"] .level{grid-area:2/1;min-width:0;margin:0;}
 body[data-game-frame="card-sort"] .play-options{grid-area:3/1;margin:0;}
 body[data-game-frame="card-sort"] .sponsors-top{grid-area:4/1;margin:0;}
 body[data-game-frame="card-sort"] .tray{grid-area:1/2/7/3;height:100%;min-height:0;}
 body[data-game-frame="card-sort"] .tools{grid-area:5/1;align-self:center;gap:8px;}
 body[data-game-frame="card-sort"] .sponsors-bottom{grid-area:6/1;margin:0;gap:4px;}
 body[data-game-frame="card-sort"] .sponsors-bottom .sponsor-domain{display:none;}
 body[data-game-frame="find-ball"] main{display:flex!important;padding:6px 12px!important;}
 body[data-game-frame="find-ball"] #home{min-height:0;}
 body[data-game-frame="find-ball"] .hero{min-height:0;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:minmax(0,1fr) 44px;gap:4px 12px;padding:0;}
 body[data-game-frame="find-ball"] .hero-copy{grid-area:1/1;}
 body[data-game-frame="find-ball"] .hero-copy h2{font-size:23px;}
 body[data-game-frame="find-ball"] .hero-copy .mobile-description{display:none;}
 body[data-game-frame="find-ball"] .current-story{grid-area:1/2/3/3;min-height:0;margin:0;}
 body[data-game-frame="find-ball"] .hero-art-frame{min-height:0;}
 body[data-game-frame="find-ball"] .continue{grid-area:2/1;margin:0;min-height:44px;width:calc(100% - 80px);}
 body[data-game-frame="find-ball"] .choose-levels{grid-area:2/1;justify-self:end;width:76px;min-height:44px;margin:0;font-size:11px;}
 body[data-game-frame="find-ball"] .home-actions{margin-top:3px;}
 body[data-game-frame="find-ball"] #game:not([hidden]){display:grid;grid-template-columns:210px minmax(0,1fr);grid-template-rows:44px 34px 32px minmax(44px,1fr) 44px 40px;gap:2px 10px;}
 body[data-game-frame="find-ball"] .game-top{grid-area:1/1;width:100%;gap:2px;}
 body[data-game-frame="find-ball"] .game-top h2{font-size:12px;}
 body[data-game-frame="find-ball"] .stats{grid-area:2/1;margin:0;gap:3px;font-size:11px;}
 body[data-game-frame="find-ball"] #game>.sponsors-top{grid-area:3/1;margin:0!important;}
 body[data-game-frame="find-ball"] #game>.progress-track{display:none;}
 body[data-game-frame="find-ball"] #game>.caption{display:none;}
 body[data-game-frame="find-ball"] .game-bottom{grid-area:5/1;margin:0;gap:4px;}
 body[data-game-frame="find-ball"] .game-bottom button{font-size:12px;min-width:44px;padding:4px 7px;}
 body[data-game-frame="find-ball"] #game>.sponsors-bottom{grid-area:6/1;margin:0!important;}
 body[data-game-frame="find-ball"] #game>.sponsors-bottom .sponsor-link{height:40px;min-height:36px!important;padding:4px 5px!important;}
 body[data-game-frame="find-ball"] .sponsors-bottom .sponsor-domain{display:none;}
 body[data-game-frame="find-ball"] .boards{grid-area:1/2/7/3;grid-template-columns:minmax(0,1fr);grid-template-rows:repeat(2,minmax(0,1fr));min-height:0;margin:0;}
 body[data-game-frame="find-ball"] .game-return{grid-area:4/1;position:static;width:100%;min-height:44px;margin:0;font-size:12px;}
 body[data-game-frame="find-ball"] .game-return svg{width:22px;height:22px;}
 body[data-game-frame="find-ball"] #sponsors-game-bottom{margin:2px 0;}
 body[data-game-frame="find-ball"] .boards .board{container-type:size;}
 body[data-game-frame="find-ball"] .boards canvas{width:min(100cqw,200cqh)!important;height:auto!important;aspect-ratio:2/1;}
 body[data-game-frame="find-ball"] .game-top{margin:0;}
 body[data-game-frame="find-ball"] .return-gallery{position:absolute;right:12px;top:6px;width:44px;font-size:0;}
 body[data-game-frame="pixel-clear"] #app{display:grid!important;grid-template-columns:210px minmax(0,1fr);grid-template-rows:40px 30px 36px minmax(0,1fr) 56px 38px 12px;gap:2px 10px;padding:6px 10px!important;}
 body[data-game-frame="pixel-clear"] #app>header{grid-area:1/1;}
 body[data-game-frame="pixel-clear"] #app>header .back{font-size:0;}
 body[data-game-frame="pixel-clear"] .hud{grid-area:2/1;}
 body[data-game-frame="pixel-clear"] #ad-top{grid-area:3/1;}
 body[data-game-frame="pixel-clear"] :is(#home,#battle):not([hidden]){display:contents;}
 body[data-game-frame="pixel-clear"] :is(#board-frame,.preview-frame){grid-area:1/2/5/3;width:min(100%,calc(var(--game-frame-height) - 116px))!important;height:100%!important;min-height:0;align-self:center;justify-self:center;margin:0!important;}
 body[data-game-frame="pixel-clear"] .preview-frame{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:3px;}
 body[data-game-frame="pixel-clear"] .preview-frame canvas{width:auto!important;height:calc(100% - 26px)!important;max-width:100%;object-fit:contain;}
 body[data-game-frame="pixel-clear"] .preview-frame #art-name{font-size:12px;margin-top:2px;}
 body[data-game-frame="pixel-clear"] .board-tools{grid-area:4/1;align-self:start;flex-wrap:wrap;margin:0;min-height:44px;}
 body[data-game-frame="pixel-clear"] .board-tools button{height:44px;min-height:44px;}
 body[data-game-frame="pixel-clear"] #status{grid-area:4/1;align-self:end;font-size:9px;min-height:12px;line-height:12px;}
 body[data-game-frame="pixel-clear"] #tray-label{display:none;}
 body[data-game-frame="pixel-clear"] #tray{grid-area:5/1;align-self:center;margin:0;}
 body[data-game-frame="pixel-clear"] .tools{grid-area:5/2;align-self:center;margin:0!important;}
 body[data-game-frame="pixel-clear"] #start{grid-area:4/1;align-self:center;min-height:44px!important;margin:0!important;}
 body[data-game-frame="pixel-clear"] .home-links{grid-area:5/1;justify-self:center;margin:0!important;}
 body[data-game-frame="pixel-clear"] #home-progress{grid-area:5/2;align-self:center;margin:0!important;font-size:11px;}
 body[data-game-frame="pixel-clear"] #ad-bottom{grid-area:6/1/7/3;margin:0!important;}
 body[data-game-frame="pixel-clear"] footer{grid-area:7/1/8/3;margin:0!important;}
}
