  /* 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;
    /* Flex-ряд: кнопки (выход/поделиться/полный-экран/к-пред.-игре) выкладываются
       слева-направо с равным зазором. СКРЫТЫЕ (display:none — fs-full на тач,
       fs-back-prev без back-stack) СХЛОПЫВАЮТСЯ, поэтому ничего не наслаивается и
       не оставляет дыр ни при какой комбинации. */
    display: flex;
    gap: 12px;
    padding: 16px;
    z-index: 1005;            /* над скримом(1002) и iframe(1001) */
    /* Контейнер только ПОЗИЦИОНИРУЕТ кнопки и НЕ перехватывает ввод (его
       дефолтный pointer-events:auto был «невидимой мёртвой зоной»). Клики ловят
       только сами кнопки (.fs-back.show). Reveal — жест ВНУТРИ фрейма игры,
       hide — .fs-reveal-scrim (он есть только пока меню открыто). */
    pointer-events: none;
  }
  /* 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: relative;          /* в потоке flex (раньше absolute с hardcoded left) */
    flex: 0 0 auto;
    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-share («Поделиться») — позиция определяется flex-потоком (см. .fs-hotzone).
     Наследует базовый .fs-back (размер/анимация/.show). */
  /* Подтверждение «скопировано» — короткая изумрудная вспышка кнопки (тост может
     не отрисоваться поверх нативного fullscreen, поэтому фидбэк прямо на кнопке). */
  .fs-share.fs-share-done {
    background: linear-gradient(180deg, rgba(42,134,105,.9), rgba(20,60,46,.95)) !important;
    border-color: rgba(67,199,154,.95) !important;
    color: #eafff6 !important;
  }
  /* fs-back-prev (к предыдущей игре после ad-travel'а) — видна только когда
     back-stack не пуст (JS toggling style.display). Позиция — flex-поток: всегда
     ПОСЛЕДНЯЯ в ряду, появляется справа без наложений. Акцентный цвет. */
  .fs-back-prev {
    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-full («Полный экран») — ТОЛЬКО десктоп; в разметке стоит [hidden], JS
     снимает его при наличии Fullscreen API и !touch (тогда действует базовый
     .icon-btn display:grid). Селектор .fs-full[hidden] (специфичнее .icon-btn)
     гарантирует скрытие на тач/iOS — кнопки фуллскрина там в ряду нет. */
  .fs-full[hidden] { display: none; }
  .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; }
  /* Скрим раскрытого меню — появляется ТОЛЬКО когда меню открыто; тап по нему
     (т.е. НЕ по кнопке) закрывает меню. Прозрачный — игру не затемняет. Это
     единственный слой, что перекрывает игру, и только пока меню видно — вне
     меню игра принимает все клики (reveal-жест ловится ВНУТРИ фрейма). */
  .fs-reveal-scrim {
    position: fixed; inset: 0;
    z-index: 1002;            /* над iframe(1001), под кнопками(1005) */
    pointer-events: none; opacity: 0;
  }
  .fs-reveal-scrim.show { pointer-events: auto; opacity: 1; }
  /* 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: сдвигаем ВЕСЬ ряд кнопок от выреза/статус-бара через padding
       контейнера (flex-кнопки внутри едут вместе). max() — чтобы базовые 16px
       сохранялись на устройствах без выреза. */
    .fs-hotzone {
      padding-top: max(16px, env(safe-area-inset-top));
      padding-left: max(16px, env(safe-area-inset-left));
    }
  }
