/* MovaSpin V47 — universal upright board layout
   The board never rotates for landscape/desktop. Landscape simply gives the
   same portrait-oriented board more room and moves the spinner controls beside it.
   This removes the old portrait-only blocker so PC users can always play. */

/* Never block gameplay because of viewport orientation. */
.portrait-lock{display:none!important;visibility:hidden!important;pointer-events:none!important}

/* Explicitly keep gameplay boards upright and unrotated. */
body.classic-v40 .board-shell,
body.classic-v40 .shell-sunny,
body.classic-v40 .shell-royal,
body.classic-v40 .shell-future,
body.classic-v40 .shell-sky,
body.battle-v40-page .battle-canvas,
.duel-page .ring-wrap{
  rotate:0deg!important;
  transform-origin:50% 50%!important;
}

/* Pieces stay upright to the screen. Board orientation never gets inherited. */
body.classic-v40 .board .cell>.piece,
body.battle-v40-page .battle-cell>.piece,
.duel-page .duel-cell>.piece{
  rotate:0deg!important;
  transform-origin:50% 50%!important;
}

/* Classic + Battle Royale: preserve the approved portrait board geometry in
   landscape/desktop, scale it by available height, and put controls to the side. */
@media (orientation:landscape){
  body.classic-v40 .play-area,
  body.battle-v40-page .battle-play-area{
    position:absolute!important;
    inset:0!important;
    display:block!important;
    padding:0!important;
    margin:0!important;
  }

  body.classic-v40 .board-shell,
  body.classic-v40 .shell-sunny,
  body.classic-v40 .shell-royal,
  body.classic-v40 .shell-future,
  body.classic-v40 .shell-sky{
    position:absolute!important;
    left:50%!important;
    top:50%!important;
    transform:translate(-50%,-50%)!important;
    width:min(58vw,calc((100dvh - 24px) * .625),650px)!important;
    height:auto!important;
    max-width:none!important;
    max-height:none!important;
    aspect-ratio:5/8!important;
  }
  body.classic-v40 .edge-controls{
    left:calc(100% + 9px)!important;
    top:50%!important;
    transform:translateY(-50%)!important;
    flex-direction:column!important;
    gap:6px!important;
  }
  body.classic-v40 .movement-wheel-card{width:58px!important}
  body.classic-v40 .game-wheel{width:49px!important}

  body.battle-v40-page .battle-canvas{
    position:absolute!important;
    left:50%!important;
    top:50%!important;
    transform:translate(-50%,-50%)!important;
    width:min(58vw,calc((100dvh - 24px) * .6),620px)!important;
    height:auto!important;
    max-width:none!important;
    max-height:none!important;
    aspect-ratio:6/10!important;
  }
  body.battle-v40-page .edge-controls{
    left:calc(100% + 9px)!important;
    top:50%!important;
    transform:translateY(-50%)!important;
    flex-direction:column!important;
    gap:6px!important;
  }
  body.battle-v40-page .battle-spinner-card{width:58px!important}
  body.battle-v40-page .spinner{width:49px!important}

  /* Crown vs Crown remains a normal upright 4×4 board. Its spinner moves to
     the right in landscape so the arena can use nearly the full screen height. */
  .duel-page .ring-wrap{
    left:50%!important;
    top:50%!important;
    transform:translate(-50%,-50%)!important;
    width:min(70vw,calc(var(--duel-vh,100dvh) - 28px),720px)!important;
    height:auto!important;
    max-width:none!important;
    max-height:none!important;
    aspect-ratio:1/1!important;
  }
  .duel-page .control-deck{
    left:auto!important;
    right:max(10px,env(safe-area-inset-right))!important;
    top:50%!important;
    transform:translateY(-50%)!important;
    width:auto!important;
  }
  .duel-page .spinner-wrap{width:82px!important;margin:0!important}
  .duel-page .duel-spinner{width:82px!important;height:82px!important}
}

/* Short landscape phones: retain large touch targets while fitting the board. */
@media (orientation:landscape) and (max-height:420px){
  body.classic-v40 .board-shell,
  body.classic-v40 .shell-sunny,
  body.classic-v40 .shell-royal,
  body.classic-v40 .shell-future,
  body.classic-v40 .shell-sky{
    width:min(61vw,calc((100dvh - 18px) * .625))!important;
  }
  body.battle-v40-page .battle-canvas{
    width:min(61vw,calc((100dvh - 18px) * .6))!important;
  }
  body.classic-v40 .movement-wheel-card,
  body.battle-v40-page .battle-spinner-card{width:54px!important}
  body.classic-v40 .game-wheel,
  body.battle-v40-page .spinner{width:46px!important}
  .duel-page .ring-wrap{width:min(68vw,calc(var(--duel-vh,100dvh) - 18px))!important}
  .duel-page .spinner-wrap{width:72px!important}
  .duel-page .duel-spinner{width:72px!important;height:72px!important}
}
