/* PE_STAGE — a dark background with depth for menus and end cards (24.11). Pure CSS: big soft gradients that drift very slowly
   (transform only, composited), a hex texture at 6 %, a vignette. Parallax from pe_stage.js. Never mounted on the play screen. */
.pe-stage-host { position: relative; isolation: isolate; }
.pe-stage { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; contain: strict; border-radius: inherit;
  --st-a: rgba(136, 84, 247, .30); --st-b: rgba(6, 182, 212, .20); --st-c: rgba(184, 154, 255, .16); --st-hex: .06; --st-vig: rgba(5, 5, 8, .72); background: transparent; }
.pe-st-par { position: absolute; inset: -40px; will-change: transform; }
.pe-st-b { position: absolute; display: block; width: 70vmax; height: 70vmax; max-width: 1400px; max-height: 1400px; border-radius: 50%; will-change: transform; }
.pe-st-b1 { left: -18%; top: -38%; background: radial-gradient(closest-side, var(--st-a), transparent 72%); }
.pe-st-b2 { right: -22%; top: 8%; background: radial-gradient(closest-side, var(--st-b), transparent 70%); }
.pe-st-b3 { left: 20%; bottom: -52%; background: radial-gradient(closest-side, var(--st-c), transparent 70%); }
.pe-st-hex { position: absolute; inset: 0; display: block; opacity: var(--st-hex);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cpath d='M28 0L56 16.2V48.5L28 64.7L0 48.5V16.2Z M28 64.7V97 M0 48.5L-28 64.7 M56 48.5L84 64.7' fill='none' stroke='%23B89AFF' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 56px 97px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 30%, #000 30%, transparent 80%); mask-image: radial-gradient(120% 90% at 50% 30%, #000 30%, transparent 80%); }
.pe-st-vig { position: absolute; inset: 0; display: block; background: radial-gradient(130% 100% at 50% 20%, transparent 45%, var(--st-vig) 100%); }
/* bigQA 24.11: the page stage fades out at its side edges, so a drifting blob never shows a hard vertical cut on a wide screen */
.pe-stage:not(.pe-st-card) { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%); }
.pe-st-card .pe-st-b1 { left: -30%; top: -50%; }
.pe-st-card .pe-st-b2 { right: -35%; top: 20%; }

@media (prefers-reduced-motion: no-preference) {
  .pe-st-b1 { animation: pe-st-d1 38s ease-in-out infinite alternate; }
  .pe-st-b2 { animation: pe-st-d2 46s ease-in-out infinite alternate; }
  .pe-st-b3 { animation: pe-st-d3 54s ease-in-out infinite alternate; }
}
@keyframes pe-st-d1 { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(9vmax, 6vmax, 0) scale(1.12); } }
@keyframes pe-st-d2 { from { transform: translate3d(0, 0, 0) scale(1.05); } to { transform: translate3d(-10vmax, 7vmax, 0) scale(.94); } }
@keyframes pe-st-d3 { from { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); } to { transform: translate3d(6vmax, -8vmax, 0) rotate(20deg) scale(1.1); } }
html.pe-st-paused .pe-stage *, .pe-stage.pe-st-off * { animation-play-state: paused !important; }

/* light theme: the same depth, softer */
html[data-theme=light] .pe-stage, :root[data-theme="light"] .pe-stage { --st-a: rgba(136, 84, 247, .16); --st-b: rgba(6, 182, 212, .12); --st-c: rgba(184, 154, 255, .14); --st-hex: .07; --st-vig: rgba(255, 255, 255, 0); }
html[data-theme=light] .pe-st-hex, :root[data-theme="light"] .pe-st-hex { filter: brightness(.55) saturate(1.4); }

/* ── screen transitions (View Transitions API; pe_stage.js sets .pe-vt on <html> only while its own transition runs) ── */
html.pe-vt::view-transition-group(root) { animation: none; }
html.pe-vt::view-transition-old(root), html.pe-vt::view-transition-new(root) { animation: none; }
html.pe-vt::view-transition-group(pe-screen) { animation-duration: 260ms; animation-timing-function: cubic-bezier(.23, 1, .32, 1); }
html.pe-vt::view-transition-old(pe-screen) { animation: pe-vt-out 150ms cubic-bezier(.55, 0, 1, .45) both; }
html.pe-vt::view-transition-new(pe-screen) { animation: pe-vt-in 260ms cubic-bezier(.23, 1, .32, 1) both; }
@keyframes pe-vt-out { to { opacity: 0; transform: translateX(calc(var(--pe-vt-x, 18px) * -.7)); } }
@keyframes pe-vt-in { from { opacity: 0; transform: translateX(var(--pe-vt-x, 18px)) scale(.985); } }
@media (prefers-reduced-motion: reduce) {
  html.pe-vt::view-transition-group(*), html.pe-vt::view-transition-old(*), html.pe-vt::view-transition-new(*) { animation: none !important; }
}
