/* Sideways mode (rotate-view.js). A touch browser that stays portrait gets the page
   turned 90° so the landscape layout fills the screen and the player turns the phone.
   --game-vw/--game-vh hold the turned (landscape) size, --real-w/--real-h the screen.
   Media queries, viewport units and safe-area insets in the other stylesheets are
   translated by script, so this file only places the turned page. */
:root[data-rotated]{width:100%;height:100%;overflow:hidden}
:root[data-rotated] body{position:fixed;inset:auto;top:0;left:0;width:var(--game-vw);height:var(--game-vh);margin:0;overflow:hidden;transform-origin:0 0}
:root[data-rotated=cw] body{transform:translateX(var(--real-w)) rotate(90deg)}
:root[data-rotated=ccw] body{transform:translateY(var(--real-h)) rotate(-90deg)}
/* Modal dialogs live in the top layer, outside the turned body, so they turn themselves.
   The browser's own dialog limits follow the real screen; use the turned size instead. */
:root[data-rotated] dialog[open]{position:fixed;inset:auto;left:50%;top:50%;margin:0}
:where(:root[data-rotated]) dialog:where([open]){max-width:calc(var(--game-vw) - 2em - 6px);max-height:calc(var(--game-vh) - 2em - 6px)}
:root[data-rotated=cw] dialog[open]{transform:translate(-50%,-50%) rotate(90deg)}
:root[data-rotated=ccw] dialog[open]{transform:translate(-50%,-50%) rotate(-90deg)}

/* Menu: 翻转横屏 flips which way the turned page faces; shown only while turned.
   切换全屏 is hidden by script where the browser has no page fullscreen. */
.mobile-menu-grid button[hidden]{display:none}
.mobile-menu-grid [data-menu-action=rotate]{--icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath fill-rule='evenodd' d='M2 0h5v1H2zM1 1h1v1H1zM7 1h3L8.5 2.5zM0 3h10v7H0zm1 1v5h8V4zM2 5h1v3H2z'/%3E%3C/svg%3E")}
:root:not([data-rotated]) .mobile-menu-grid [data-menu-action=rotate]{display:none}
