/* YUGIMON — Desktop viewport correction. Mobile's no-scroll layout is unchanged. */
@media (min-width:901px) {
 body:has(#game:not(.hidden)) {position:static!important;inset:auto!important;height:auto!important;max-height:none!important;overflow:auto!important;touch-action:auto!important;}
 body:has(#game:not(.hidden)) #game {position:relative!important;inset:auto!important;width:100%!important;height:auto!important;max-height:none!important;min-height:100dvh!important;overflow:visible!important;}
 body:has(#game:not(.hidden)) #game .topbar {height:54px!important;min-height:54px!important;}
 body:has(#game:not(.hidden)) #game .layout {grid-template-columns:minmax(190px,230px) minmax(550px,1fr) minmax(190px,230px);gap:8px;margin-top:7px;}
 body:has(#game:not(.hidden)) #game .duel-wrap {display:grid;grid-template-rows:auto auto 48px 56px minmax(220px,1fr) 56px 48px;gap:3px;min-height:0;height:calc(100dvh - 85px);max-height:850px;}
 body:has(#game:not(.hidden)) #game .board {height:100%!important;min-height:220px!important;max-height:none!important;}
 body:has(#game:not(.hidden)) #game .field-half {height:calc((100% - 32px)/2)!important;gap:2px;justify-content:center;padding-right:98px;}
 body:has(#game:not(.hidden)) #game .field-divider {height:32px!important;min-height:32px!important;}
 body:has(#game:not(.hidden)) #game .zone-row {height:calc(50% - 1px);gap:5px;}
 body:has(#game:not(.hidden)) #game .zone {height:clamp(35px,8dvh,72px);max-width:50px;aspect-ratio:67/96;}
 body:has(#game:not(.hidden)) #game .card-face {width:calc(100% - 3px);height:calc(100% - 3px);}
 body:has(#game:not(.hidden)) #game .player-head {height:48px;min-height:48px;padding:4px 9px;}
 body:has(#game:not(.hidden)) #game .player-name {font-size:.86rem;}
 body:has(#game:not(.hidden)) #game .lp {font-size:1.12rem;}
 body:has(#game:not(.hidden)) #game .opponent-hand,body:has(#game:not(.hidden)) #game .my-hand {height:56px;min-height:56px;overflow:visible;}
 body:has(#game:not(.hidden)) #game .hand-card {height:53px;width:38px;flex:0 0 38px;}
 body:has(#game:not(.hidden)) #game .left-panel,body:has(#game:not(.hidden)) #game .right-panel {height:calc(100dvh - 86px);min-height:420px;overflow:auto;}
}
@media (min-width:901px) and (max-height:700px) {
 body:has(#game:not(.hidden)) #game .duel-wrap {height:620px}
 body:has(#game:not(.hidden)) #game .board {min-height:290px!important}
}
/* Per-owner backs: the class on the player's hand, zones and piles applies locally. */
.sleeve-black .card-back,.sleeve-black.card-back,.sleeve-red .card-back,.sleeve-red.card-back,.sleeve-green .card-back,.sleeve-green.card-back,.sleeve-blue .card-back,.sleeve-blue.card-back {background-size:cover!important}

/* V2: hidden FFA/team navigation must not leave two phantom grid tracks in 1v1. */
@media(min-width:901px){
 body:has(#game:not(.hidden)) #game .duel-wrap:has(#multiplayerTableNav.hidden):has(#focusBanner.hidden) {
   grid-template-rows:48px 56px minmax(260px,1fr) 56px 48px!important;
 }
}
@media(max-width:700px){
 body:has(#game:not(.hidden)) .duel-wrap:has(#multiplayerTableNav.hidden):has(#focusBanner.hidden){
   grid-template-rows:36px 42px minmax(0,1fr) 46px 36px!important;
 }
}
@media(max-height:700px) and (max-width:900px){
 body:has(#game:not(.hidden)) .duel-wrap:has(#multiplayerTableNav.hidden):has(#focusBanner.hidden){
   grid-template-rows:30px 34px minmax(0,1fr) 36px 30px!important;
 }
}
@media(orientation:landscape) and (max-height:520px) and (max-width:950px){
 body:has(#game:not(.hidden)) .duel-wrap:has(#multiplayerTableNav.hidden):has(#focusBanner.hidden){
   grid-template-rows:28px 30px minmax(0,1fr) 32px 28px!important;
 }
}

@media (min-width:901px) and (max-width:1100px){
 body:has(#game:not(.hidden)) #game .layout {
   grid-template-columns:minmax(155px,180px) minmax(0,1fr) minmax(155px,180px);
   gap:6px;
 }
 body:has(#game:not(.hidden)) #game .field-half{padding-right:66px}
 body:has(#game:not(.hidden)) #game .zone-row{gap:3px}
 body:has(#game:not(.hidden)) #game .side-rail{right:3px}
}
