/* BLB arcade hand-off (WEB-PORTS.md 4.14). The arcade dives into its cabinet screen, covers the window in this
   game's hand-off colour and opens <game>/#arcade. This overlay starts in that same colour at first paint and fades
   into the page, so the navigation has no visible seam. The page needs, as the first child of <body>:
     <div id="arcade" class="blb-handoff" aria-hidden="true"></div>
   and sets --blb-handoff on :root to the colour of its first screen (the arcade's GAMES[].handoff must match).
   :target is what makes this work without inline script: it matches only when the URL ends in #arcade.
   Each port's package.sh copies this file from blb-site/handoff/ and stamps it like its other files. */
.blb-handoff { display: none; }
.blb-handoff:target {
  display: block; position: fixed; inset: 0; z-index: 2147483647; pointer-events: none;
  background: var(--blb-handoff, #000);
  animation: blb-handoff-out .45s ease-out .08s both;
}
/* the arcade's overlay has the same scanlines, so the two frames match */
.blb-handoff:target::after {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(transparent 0 2px, rgba(0, 0, 0, .35) 2px 3px);
}
@keyframes blb-handoff-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .blb-handoff:target { animation-duration: .2s; } }

/* EXIT (the way back to the arcade, WEB-PORTS.md 4.14): a link on the hub screen. handoff.js zooms the page out
   into --blb-handoff and opens <arcade>/#return-<game>, where the arcade pulls back out of that game's cabinet. The
   link is shown only by the hub, so it never sits over a running game. */
/* Styled like the arcade's own panels (dark box, red + yellow double border, hard drop shadow, chunky caps). No web
   font on purpose: ports run a strict CSP, so it uses the system monospace bold. */
.blb-exit {
  display: inline-block; margin: 0 0 18px; padding: 8px 14px; color: #ffd23f; text-decoration: none;
  font: 700 13px/1.2 ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace; letter-spacing: .14em; text-transform: uppercase;
  background: rgba(3, 4, 12, .88); border: 2px solid #ff2e4d; border-radius: 0;
  outline: 2px solid #ffd23f; outline-offset: -6px; box-shadow: 3px 3px 0 #000;
  text-shadow: 2px 2px 0 #000; cursor: pointer;
  transition: transform .06s, box-shadow .06s;
}
.blb-exit:hover, .blb-exit:focus-visible { color: #fff; background: #c40f24; outline-color: #fff; }
.blb-exit:focus-visible { animation: blb-exit-blink .5s steps(2) infinite; }
.blb-exit:active { transform: translate(3px, 3px); box-shadow: 0 0 0 #000; }
@keyframes blb-exit-blink { 50% { outline-color: #ffd23f; } }
@media (prefers-reduced-motion: reduce) { .blb-exit:focus-visible { animation: none; } }
/* the zoom-out: the page shrinks to a point and the hand-off colour takes over the window */
.blb-exit-cover {
  position: fixed; inset: 0; z-index: 2147483646; pointer-events: none; opacity: 0;
  background: var(--blb-handoff, #000);
}
html.blb-exiting body { transform-origin: 50% 50%; animation: blb-exit-zoom .55s cubic-bezier(.55, 0, .9, .5) both; }
html.blb-exiting .blb-exit-cover { animation: blb-exit-fade .5s ease-in both; }
@keyframes blb-exit-zoom { to { transform: scale(.02); opacity: 0; } }
@keyframes blb-exit-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  html.blb-exiting body { animation: blb-exit-fade .2s ease-in both; }
  html.blb-exiting .blb-exit-cover { animation-duration: .2s; }
}
