  /* Fullscreen game overlay */
  .fs-overlay {
    position: fixed; inset: 0;
    background: #000;
    z-index: 1000;
    overflow: hidden;
  }
  .fs-overlay iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0; display: block;
  }

  /* Background-alive game iframe pool. The container itself has zero visual
     presence; each pooled iframe positions itself in screen coords to track
     its current "slot" (project page .live-frame or fullscreen overlay).
     Hidden iframes stay in the DOM and keep running — that's the whole point.
     IMPORTANT: no `position` here either. `position:fixed/sticky` (and
     `position:absolute/relative` with a z-index) form a stacking context;
     that would trap pooled iframes' z-index inside this container and the
     fullscreen iframe (z:1001) could not lift above .fs-overlay (z:1000)
     which lives in a sibling #modal-root. Children are `position:fixed`
     themselves, so they paint at viewport regardless of parent positioning. */
  #game-pool {
    width: 0; height: 0;
    pointer-events: none;
  }
  #game-pool iframe {
    position: fixed;
    top: -9999px; left: 0;
    border: 0; display: block;
    transform-origin: 0 0;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    background: #000;
  }
  /* Slot-mode pool iframe (over a project-page .live-frame). Rounded corners
     so the rectangular iframe doesn't poke past the slot's rounded border.
     z-index:1 keeps it above page bg but below modals/toasts/fs-overlay. */
  #game-pool iframe.pooled-slot {
    border-radius: var(--r-lg);
    z-index: 1;
  }
  /* Fullscreen-positioned pool iframe: cover the viewport. Must sit ABOVE
     the fs-overlay (z-index:1000) so the iframe receives clicks and the
     overlay's solid #000 bg doesn't hide it. fs-hotzone is bumped to 1002
     so the back button still floats over the iframe. */
  #game-pool iframe.pooled-fs {
    z-index: 1001;
    border-radius: 0;
  }
  /* Pooled fs overlay: solid #000 bg paints behind the iframe (the iframe
     is z-indexed above this overlay). Keeps fullscreen visually solid even
     if the iframe is letterboxed or briefly mid-load. */
  .fs-overlay.fs-overlay-pooled {
    background: #000;
  }
  .fs-hotzone {
    position: fixed;
    top: 0; left: 0;
    /* Расширил под 2 кнопки: fs-back (выход) + fs-back-prev (к пред. игре). */
    width: 180px; height: 110px;
    z-index: 1002;
  }
  /* Foreground host for ad UI during fullscreen play. Lives as a sibling of
     .fs-overlay so its z-index (1003) competes globally and sits above the
     pooled iframe (z:1001). pointer-events:none lets clicks fall through
     to the iframe by default; ad UI children (ad-catcher / ad-back / ad-
     close) explicitly opt back in via their own pointer-events:auto. */
  .fs-ad-host {
    position: fixed;
    inset: 0;
    z-index: 1003;
    pointer-events: none;
  }
  .fs-back {
    position: absolute;
    top: 16px; left: 16px;
    width: 44px; height: 44px;
    border-radius: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    touch-action: manipulation;
  }
  .fs-back.show { opacity: 1; pointer-events: auto; }
  .fs-back svg { width: 22px; height: 22px; }
  /* fs-back-prev (к предыдущей игре после ad-travel'а) — рядом с основной
     fs-back, отступ 12px справа. Видна только когда back-stack не пуст
     (JS toggling style.display). Цвет акцентный, чтобы визуально отличать. */
  .fs-back-prev {
    left: 72px !important;  /* 16 (fs-back left) + 44 (fs-back width) + 12 gap */
    background: linear-gradient(180deg, rgba(217,160,98,0.18), rgba(60, 40, 14, 0.55));
    border-color: rgba(217,160,98,0.55);
    color: #ffd49a;
  }
  .fs-back-prev:hover {
    background: linear-gradient(180deg, rgba(217,160,98,0.32), rgba(80, 52, 16, 0.7));
    border-color: rgba(217,160,98,0.85);
  }
  .fs-back-prev svg { width: 22px; height: 22px; }
  /* During an ad peek (.fs-ad-host.ad-active sibling), hide the fullscreen back
     button — the .ad-close (X) inside the ad-host is the only dismiss path
     during the 5-second ad cycle. fs-back returns to normal when the peek ends. */
  #fs-ad-host.ad-active ~ #fs-hot .fs-back {
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* ── Mobile adaptive ──────────────────────────────────────────────────────── */
  /* touch-action:none prevents browser pan/zoom hijacking game touch events
     on pooled iframes. Applied only on touch devices to avoid side-effects
     on desktop pointer interactions. */
  @media (pointer: coarse) {
    #game-pool iframe {
      touch-action: none;
    }
    /* .pooled-slot gets the same rule so slot-mode preview also blocks browser
       pan while the game is in the slot rect. */
    #game-pool iframe.pooled-slot,
    #game-pool iframe.pooled-fs {
      touch-action: none;
    }
    /* Safe-area insets: keep fs-hotzone and fs-back away from notch/status-bar.
       Using max() so the original 16px still applies on devices without notch. */
    .fs-hotzone {
      top: max(0px, env(safe-area-inset-top));
      left: max(0px, env(safe-area-inset-left));
    }
    .fs-back {
      top: max(16px, env(safe-area-inset-top));
      left: max(16px, env(safe-area-inset-left));
    }
    .fs-back-prev {
      top: max(16px, env(safe-area-inset-top));
      /* left is overridden by .fs-back-prev's own !important rule above;
         repeat here so safe-area shifts the whole pair if inset-left > 0. */
      left: calc(max(16px, env(safe-area-inset-left)) + 44px + 12px) !important;
    }
  }
