/* Fixed 1920x1080 stage (src/stage.ts). Applies only when the stage is on (body.xr-staged, ?stage=1 during the move).
   The stage is transformed, so screens that use position:fixed inside it fill the 1920x1080 stage, not the window. */
body.xr-staged {
  margin: 0;
  overflow: hidden;
  background: #05090c;
}
body.xr-staged #xr-viewport {
  position: fixed;
  inset: 0;
  overflow: clip;
}
/* Background art that extends past the 16:9 frame lives here (the other screens follow in later steps). */
body.xr-staged #xr-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
body.xr-staged #xr-stage {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  width: 1920px;
  height: 1080px;
  transform-origin: 0 0;
  overflow: clip;
}
/* The overlay plane (opened cards, dialogs, toasts): the same 1920x1080 frame above the effects canvas. */
body.xr-staged #xr-stage-over {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 39;
  width: 1920px;
  height: 1080px;
  transform-origin: 0 0;
  overflow: clip;
  pointer-events: none;
}
body.xr-staged #xr-stage-over[hidden] {
  display: none;
}
/* clickable again, but any rule of their own still wins (:where adds no specificity) */
:where(body.xr-staged #xr-stage-over) > * {
  pointer-events: auto;
}
/* Window units mean nothing on a fixed stage: stylesheets write var(--xvw,1vw) and get 1% of 1920x1080 here. */
body.xr-staged {
  --xvw: 19.2px;
  --xvh: 10.8px;
  --xvmin: 10.8px;
  --xsl: 0px;
  --xsr: 0px;
}
/* The stage is scaled as a whole, so a phone's notch is not something the board has to step around. */
body.xr-staged .game-shell {
  --el: var(--edge);
  --er: var(--edge);
}
/* The screens inside clip the same way: focusing or scrolling to a card must not slide them inside the frame. */
body.xr-staged .game-shell,
body.xr-staged .home {
  overflow: clip;
}

/* The home and title pictures run past the frame the same way as the table: an identical copy behind the stage. */
body.xr-staged #xr-stage .hm-art,
body.xr-staged #xr-stage .xr-entry-scene {
  inset: var(--xr-bleed-y, 0px) var(--xr-bleed-x, 0px);
}
/* the thin frame line on the title page would only show two of its sides on a window that is not 16:9 */
body.xr-staged.xr-wide .xr-entry::after,
body.xr-staged.xr-tall .xr-entry::after {
  display: none;
}
body.xr-staged #xr-backdrop .hm-art,
body.xr-staged #xr-backdrop .xr-entry-scene {
  display: none;
}
body.xr-staged #xr-backdrop[data-screen='home'] .hm-art,
body.xr-staged #xr-backdrop[data-screen='entry'] .xr-entry-scene {
  display: block;
}
/* dimmed with the home side sheet (.hm-scrim) and the sign-in sheet (.xr-entry::before) */
body.xr-staged #xr-backdrop[data-dim]:not([data-dim=''])::after {
  content: '';
  position: absolute;
  inset: 0;
}
body.xr-staged #xr-backdrop[data-dim='sheet']::after {
  background: #03070cb3;
}
body.xr-staged #xr-backdrop[data-dim='signin']::after {
  background: #040b11b8;
  backdrop-filter: blur(6px);
}
/* The painted table runs past the 16:9 frame. The board's own copy and the one behind the stage cover the same
   window area with the same picture, so the frame edge does not show. */
body.xr-staged #xr-stage .bd-scene::before,
body.xr-staged #xr-stage .bd-scene::after {
  inset: var(--xr-bleed-y, 0px) var(--xr-bleed-x, 0px);
  height: auto;
}
body.xr-staged #xr-backdrop .bd-scene {
  --battle-scene: url('assets/river-observatory.webp');
  display: none;
}
body.xr-staged.in-battle #xr-backdrop .bd-scene {
  display: block;
}
/* While a choice dims the board (.stage-scrim, board.css), the art around the frame dims with it: the same colours,
   placed at the frame edges. The middle of this layer is hidden behind the stage. */
body.xr-staged.in-battle #xr-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .18s ease;
  background: linear-gradient(90deg, #0306046b var(--xr-ox, 0px), #030604b8 calc(var(--xr-ox, 0px) + 1920px * var(--xr-scale, 1)));
}
body.xr-staged.in-battle[data-stage-dim='full'] #xr-backdrop::after {
  opacity: 1;
}
body.xr-staged.in-battle[data-stage-dim='card'] #xr-backdrop::after {
  opacity: .18;
}
/* the shade behind the options column fades out before a frame edge that has more picture beyond it */
body.xr-staged.xr-wide .choice-stage.so-left .stage-shade {
  background: linear-gradient(270deg, #03060400, #030604b8 32%, #030604d0 72%, #03060400);
}
body.xr-staged.xr-wide .choice-stage:not(.so-left) .stage-shade {
  background: linear-gradient(90deg, #03060400, #030604b8 32%, #030604d0 72%, #03060400);
}

/* Library, pack and shop screens: their pictures continue past the frame, in the deck colour of the screen. */
body.xr-staged #xr-stage .lib-art,
body.xr-staged #xr-stage .gc-bg,
body.xr-staged #xr-stage .gc-veil,
body.xr-staged #xr-stage .sh-bg {
  inset: var(--xr-bleed-y, 0px) var(--xr-bleed-x, 0px);
}
body.xr-staged .library,
body.xr-staged .gacha,
body.xr-staged .shop {
  overflow: clip;
}
body.xr-staged #xr-backdrop .lib-art,
body.xr-staged #xr-backdrop .gc-bg,
body.xr-staged #xr-backdrop .gc-veil,
body.xr-staged #xr-backdrop .sh-bg {
  display: none;
}
body.xr-staged #xr-backdrop[data-screen='library'] .lib-art,
body.xr-staged #xr-backdrop[data-screen='gacha'] .gc-bg,
body.xr-staged #xr-backdrop[data-screen='gacha'] .gc-veil,
body.xr-staged #xr-backdrop[data-screen='shop'] .sh-bg {
  display: block;
}
body.xr-staged #xr-backdrop[data-scene='1'] .gc-veil {
  opacity: 1;
}
/* a dialog dims the window around the frame like the frame itself (.modal-root, game.css) */
body.xr-staged.modal-open #xr-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 1;
  background: #080b16bd;
}
/* The face-off screen still covers the whole window (it is added to the page, not the stage): window units there. */
body.xr-staged > .vs-screen {
  --xvw: 1vw;
  --xvh: 1vh;
  --xvmin: 1vmin;
}
/* The result card is opaque inside the frame; the window around it takes the same night colour. */
body.xr-staged.result-open #xr-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 1;
  background: #0b141e;
}
