/* =========================================================================
   POKÉSPIRE · Production Title Screen Diagonal Card Waterfall & Floating UI
   Strictly scoped to:
     - #title-waterfall-stage / #title-waterfall-veil / #title-waterfall-dock
     - .wf-zoom-overlay (360° flip-zoom overlay)
     - #app[data-screen="title"] floating white left menu ONLY
   Zero modifications to internal game screen colors or CSS.
   ========================================================================= */

:root {
  --twf-bg-a: #f7faff;
  --twf-bg-b: #e7f0fb;
  --twf-bg-c: #f2f7fd;
  --twf-veil-color: 245, 250, 255;
  --twf-veil-opacity: 0.12;
  --twf-veil-center-opacity: 0.368;
  --twf-card-opacity: 0.94;
  --twf-card-blur: 0px;
  --twf-wall-angle: 0deg;
  --twf-foil-strength: 0.50;
}

body.has-title-waterfall[data-twf-theme="sky"] {
  --twf-bg-a: #f7faff;
  --twf-bg-b: #e7f0fb;
  --twf-bg-c: #f2f7fd;
  --twf-veil-color: 245, 250, 255;
}
body.has-title-waterfall[data-twf-theme="cream"] {
  --twf-bg-a: #fdfaf3;
  --twf-bg-b: #f3eadc;
  --twf-bg-c: #faf5eb;
  --twf-veil-color: 252, 248, 240;
}
body.has-title-waterfall[data-twf-theme="pearl"] {
  --twf-bg-a: #fbf8ff;
  --twf-bg-b: #eef3fc;
  --twf-bg-c: #fdf2f8;
  --twf-veil-color: 250, 248, 255;
}
body.has-title-waterfall[data-twf-theme="paper"] {
  --twf-bg-a: #ffffff;
  --twf-bg-b: #eef2f6;
  --twf-bg-c: #f8fafc;
  --twf-veil-color: 248, 250, 252;
}

/* Hide legacy dark #bg-stage only while Title Waterfall is active */
body.has-title-waterfall #bg-stage {
  display: none !important;
}

/* =========================================================================
   1. FULL-SCREEN DIAGONAL CARD WATERFALL STAGE + 3D CAMERA PITCH RIG
   ========================================================================= */
#title-waterfall-stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  /* Keep the perspective surface clipped to the viewport. */
  isolation: isolate;
  contain: strict;
  transform: translate3d(0, 0, 0);
  perspective: 960px;
  perspective-origin: 50% 42%;
  background:
    radial-gradient(ellipse 75% 65% at 18% 14%, rgba(255, 255, 255, 0.85) 0%, transparent 62%),
    radial-gradient(ellipse 68% 60% at 84% 84%, rgba(255, 255, 255, 0.6) 0%, transparent 65%),
    linear-gradient(145deg, var(--twf-bg-a) 0%, var(--twf-bg-b) 52%, var(--twf-bg-c) 100%);
}

/* The camera pose is projected per column during the three menu poses.
   Special transitions still use the camera and plane together. */
#title-waterfall-stage.is-projecting-columns {
  perspective: none;
}

.is-projecting-columns #title-waterfall-plane {
  transform: none;
}

body.twf-mode-floor #title-waterfall-stage,
body.twf-mode-ceiling #title-waterfall-stage,
body.twf-mode-back #title-waterfall-stage,
body.twf-yaw-turning #title-waterfall-stage,
body.twf-dex-rush #title-waterfall-stage {
  pointer-events: none;
}

#title-waterfall-stage[hidden],
#title-waterfall-veil[hidden],
#title-waterfall-sheen[hidden],
#title-waterfall-dock[hidden] {
  display: none !important;
}

/* 180° Back-Wall Mode (Settings): waterfall rests behind the viewer while the
   shared bright porcelain room backdrop (#title-waterfall-stage) stays seamless */
body.twf-mode-back #title-waterfall-camera,
body.twf-mode-back #title-waterfall-veil {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.twf-yaw-turning #title-waterfall-camera {
  transition: none !important;
  will-change: transform, opacity;
}

/* Subtle panoramic room light sweep during 180° rightward yaw turn */
#title-waterfall-sheen {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(ellipse 46% 92% at 50% 50%, rgba(255, 255, 255, 0.78) 0%, rgba(224, 242, 254, 0.34) 44%, transparent 74%);
  will-change: transform, opacity;
}

body.twf-mode-back #app[data-screen="title"] .screen.title-float-home {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body:is(.twf-mode-back, .is-twf-tuning) .pause-menu-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* When tuning from an in-run screen, lift the temporary preview cleanly above #app */
body.is-twf-tuning-overlay #title-waterfall-stage {
  z-index: 1000;
}
body.is-twf-tuning-overlay #title-waterfall-veil {
  z-index: 1001;
}
body.is-twf-tuning-overlay #title-waterfall-dock {
  z-index: 1010;
}

/* 3D Camera Pivot: flat transform-style avoids Chromium nested preserve-3d
   compositor flicker while keeping true 3D perspective pitch on the plane */
#title-waterfall-camera {
  position: absolute;
  inset: 0;
  transform-style: flat;
  /* Constant transform-origin across wall/floor/ceiling prevents any 1-frame snap/flicker on return */
  transform-origin: 50% 50%;
  transform: translate3d(0, 0, 0) rotateX(0deg) scale(1);
  transition: transform 0.82s cubic-bezier(0.22, 1, 0.36, 1);
}

body.twf-mode-floor #title-waterfall-camera {
  transform: translate3d(0, 31vh, -110px) rotateX(70deg) scale(1.62);
}

/* Multiplayer mode: exact mirror of Single-Player — camera tilts DOWNWARD so moving
   card ribbon flows overhead at the top while a transparent luminous stage opens below */
body.twf-mode-ceiling #title-waterfall-camera {
  transform: translate3d(0, -31vh, -110px) rotateX(-70deg) scale(1.62);
}

/* Pokédex seamless in-place morph: JS drives plane/column transforms per-frame with zero fighting CSS transition */
body.twf-dex-rush #title-waterfall-plane {
  opacity: 1;
  transition: opacity 0.28s ease;
}

body.twf-dex-rush #title-waterfall-veil {
  opacity: 0;
  transition: opacity 0.36s ease;
}

body.twf-dex-exit #title-waterfall-stage {
  pointer-events: none;
}

/* The same stage remains visible through the library gutters. */
body.has-title-waterfall {
  --twf-library-left: 300px;
  --twf-library-right: max(calc(var(--twf-library-gap, 28px) + 16px), clamp(46px, 4.4vw, 78px));
}

body.has-title-waterfall #app :is(.sts-dex-overlay, .collection-meta.col-wall-hub) {
  grid-template-columns: var(--twf-library-left) minmax(0, 1fr) var(--twf-library-right) !important;
}

body.has-title-waterfall #app :is(.sts-dex-overlay, .collection-meta.col-wall-hub)::before {
  content: none;
}

body.has-title-waterfall #app :is(.sts-dex-overlay, .collection-meta.col-wall-hub) > :is(.sts-dex-sidebar, .col-wall-sidebar) {
  background: rgba(247, 250, 255, 0.77) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  border-color: rgba(148, 163, 184, 0.23) !important;
  box-shadow: 0 20px 46px -18px rgba(15, 42, 78, 0.18), 0 4px 12px -4px rgba(15, 42, 78, 0.06) !important;
}

#title-waterfall-plane .wf-column.is-covered-by-library {
  visibility: hidden;
}

@media (max-width: 690px) {
  body.has-title-waterfall {
    --twf-library-left: clamp(14px, calc(var(--twf-library-gap, 16px) + 4px), 32px);
    --twf-library-right: var(--twf-library-left);
  }

  body.has-title-waterfall #app :is(.sts-dex-overlay, .collection-meta.col-wall-hub) >
  :is(.sts-dex-sidebar, .sts-dex-main, .col-wall-sidebar, .col-wall-main) {
    grid-column: 2;
  }
}

body.twf-dex-exit #title-waterfall-plane {
  opacity: var(--twf-card-opacity);
  transition: opacity 0.72s ease 0.22s;
}

body.twf-dex-exit #title-waterfall-veil {
  opacity: 1;
  transition: opacity 0.72s ease 0.22s;
}

@keyframes twfTitleReturnIn {
  from {
    opacity: 0;
    transform: translate3d(-44px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

body.twf-dex-exit #app[data-screen="title"]:not(:has(.sts-dex-overlay, .collection-meta)) .screen.title-float-home {
  animation: twfTitleReturnIn 0.46s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Camera pitches HIGHER upward while gliding forward: the card floor drops away
   beneath the bottom of the screen as your gaze enters the bright white sky ahead */
body.twf-fly-forward #title-waterfall-camera {
  transform: translate3d(0, 74vh, 220px) rotateX(83deg) scale(1.88);
  transition: transform 0.68s cubic-bezier(0.28, 0, 0.22, 1);
}

#title-waterfall-plane {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: center center;
  transform: translate3d(-50%, -50%, 0) rotate(var(--twf-wall-angle));
  backface-visibility: hidden;
  opacity: var(--twf-card-opacity);
  --foil-strength: var(--twf-foil-strength);
}

#title-waterfall-plane.has-blur {
  filter: blur(var(--twf-card-blur));
}

/* Card faces only need their own 3D context during interactive tilt. Keep idle
   faces in the same paint order while the camera pitches the whole wall. */
#title-waterfall-plane .poke-card.ptcg-v2.wf-card:not(.is-tilting) {
  perspective: none !important;
  transform-style: flat !important;
}

#title-waterfall-plane .wf-card:not(.is-tilting) :is(.j-rotator, .j-front) {
  transform-style: flat;
  transform: none;
  -webkit-backface-visibility: visible;
  backface-visibility: visible;
  will-change: auto;
}

#title-waterfall-plane .wf-card:not(.is-tilting) .j-subject {
  transform: translate(calc(var(--nx) * -6px), calc(var(--ny) * -4px)) !important;
}

#title-waterfall-plane .wf-card:not(.is-tilting) .j-dual-emblem {
  transform: translate(calc(var(--nx) * 5px), calc(var(--ny) * 4px));
}

body:is(.twf-mode-floor, .twf-mode-ceiling) #title-waterfall-plane .card-sprite {
  filter: none !important;
}

body:is(.twf-mode-floor, .twf-mode-ceiling) #title-waterfall-plane .j-shine,
body:is(.twf-mode-floor, .twf-mode-ceiling) #title-waterfall-plane .j-glare,
body:is(.twf-mode-floor, .twf-mode-ceiling) #title-waterfall-plane .j-subject-foil {
  display: none !important;
}

/* Luminous white sky expansion: blooms organically downward from the upper white
   horizon as the camera pitches higher into the sky, then gently reveals the next screen */
#title-waterfall-whiteout {
  position: fixed;
  inset: 0;
  z-index: 1500;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(0, -10%, 0) scale(1.06);
  background:
    linear-gradient(
      180deg,
      #ffffff 0%,
      #ffffff 48%,
      #f8fbff 76%,
      #ffffff 100%
    );
}

#title-waterfall-whiteout[hidden] {
  display: none !important;
}

#title-waterfall-whiteout.is-covering {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  transition:
    opacity 0.62s cubic-bezier(0.25, 0.1, 0.25, 1),
    transform 0.64s cubic-bezier(0.22, 1, 0.36, 1);
}

#title-waterfall-whiteout.is-revealing {
  opacity: 0;
  transform: translate3d(0, 0, 0) scale(1);
  transition: opacity 0.48s ease-out;
}

/* Sweep the 3 floating mode boxes downward & away as camera tilts up into the white sky */
body.twf-fly-forward #app[data-screen="mode"] .game-mode-screen .dex-detail-bar {
  opacity: 0;
  transform: translate3d(0, -18px, 0);
  pointer-events: none;
  transition: opacity 0.34s ease-out, transform 0.38s ease-out;
}

body.twf-fly-forward #app[data-screen="mode"] .game-mode-screen .game-mode-content {
  opacity: 0;
  transform: translate3d(0, 56px, 0) scale(0.94);
  pointer-events: none;
  transition: opacity 0.36s ease-out, transform 0.44s cubic-bezier(0.28, 0, 0.22, 1);
}

#title-waterfall-plane .wf-column {
  position: absolute;
  top: 0;
  left: 0;
}

#title-waterfall-plane .wf-slot {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  contain: layout style;
  /* Keep the stationary card artwork cached while its column moves. */
  will-change: transform;
}

#title-waterfall-plane .twf-dex-clone-slot {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  pointer-events: none;
  transform-origin: top left;
  contain: layout style;
}

/* Smooth center-origin jitter straightening & restoration during morph transitions */
body.twf-dex-rush #title-waterfall-plane .wf-column:not(.is-native-waterfall-column) .poke-card.ptcg-v2.wf-card {
  transform: rotate(0deg) scale(1) !important;
  transition: transform 0.44s cubic-bezier(0.45, 0, 0.55, 1) !important;
}

#title-waterfall-plane.twf-w4-exit-straight .wf-column:not(.is-native-waterfall-column) .poke-card.ptcg-v2.wf-card {
  transform: rotate(0deg) scale(1) !important;
  transition: none !important;
}

body.twf-dex-exit #title-waterfall-plane:not(.twf-w4-exit-straight) .wf-column:not(.is-native-waterfall-column) .poke-card.ptcg-v2.wf-card {
  transform: rotate(var(--card-jitter, 0deg)) scale(1) !important;
  transition: transform 0.62s cubic-bezier(0.45, 0, 0.55, 1) 0.14s !important;
}

#title-waterfall-plane .twf-dex-clone-slot .poke-card.ptcg-v2 {
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  aspect-ratio: 0.718 !important;
  margin: 0 !important;
  pointer-events: none !important;
  perspective: none !important;
  transform-style: flat !important;
}

#title-waterfall-plane .twf-dex-clone-slot .poke-card.ptcg-v2 .j-rotator,
#title-waterfall-plane .twf-dex-clone-slot .poke-card.ptcg-v2 .j-front {
  transform-style: flat !important;
}

#title-waterfall-plane .twf-dex-clone-slot .poke-card.ptcg-v2 .j-subject {
  transform: translate3d(0, 0, 0) !important;
}

/* Collection Card Skins (.col-skin-slot) cloned into waterfall columns during morph */
#title-waterfall-plane .twf-dex-clone-slot .col-skin-slot {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: transparent;
  border: 0;
  padding: 0;
}

#title-waterfall-plane .twf-dex-clone-slot .col-skin-card-stage {
  position: relative;
  width: 100%;
}

#title-waterfall-plane .twf-dex-clone-slot .col-skin-card-stage .poke-card.ptcg-v2 {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 0.718 !important;
  border: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#title-waterfall-plane .twf-dex-clone-slot .col-skin-eq-pin {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 8;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #facc15, #f59e0b);
  color: #451a03;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 6px 14px -4px rgba(245, 158, 11, 0.55);
}

#title-waterfall-plane .twf-dex-clone-slot .col-skin-meta-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 8px 20px -14px rgba(15, 42, 78, 0.16);
}

#title-waterfall-plane .twf-dex-clone-slot .col-skin-slot.is-equipped .col-skin-meta-bar {
  border-color: #f59e0b;
  background: linear-gradient(180deg, #fffbeb 0%, rgba(255, 255, 255, 0.95) 100%);
}

#title-waterfall-plane .twf-dex-clone-slot .col-skin-meta-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#title-waterfall-plane .twf-dex-clone-slot .col-skin-meta-top strong {
  font-size: 13.5px;
  font-weight: 900;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#title-waterfall-plane .twf-dex-clone-slot .col-skin-meta-desc {
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.35;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#title-waterfall-plane .twf-dex-clone-slot .cosmetic-rarity-pill {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

#title-waterfall-plane .twf-dex-clone-slot .cosmetic-rarity-pill.rarity-common { background: #f1f5f9; color: #475569; }
#title-waterfall-plane .twf-dex-clone-slot .cosmetic-rarity-pill.rarity-rare { background: #e0f2fe; color: #0369a1; }
#title-waterfall-plane .twf-dex-clone-slot .cosmetic-rarity-pill.rarity-epic { background: #f3e8ff; color: #7e22ce; }
#title-waterfall-plane .twf-dex-clone-slot .cosmetic-rarity-pill.rarity-legendary { background: #fef3c7; color: #b45309; }
#title-waterfall-plane .twf-dex-clone-slot .cosmetic-rarity-pill.rarity-mythic {
  background: linear-gradient(90deg, #fce7f3, #fef3c7);
  color: #9d174d;
  border: 1px solid #f9a8d4;
}

#title-waterfall-plane .twf-dex-clone-slot .col-skin-act-btn {
  width: 100%;
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#title-waterfall-plane .twf-dex-clone-slot .btn-primary.col-skin-act-btn {
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  border: 1px solid transparent;
  color: #ffffff;
}

#title-waterfall-plane .twf-dex-clone-slot .btn-secondary.col-skin-act-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #1e293b;
}

#title-waterfall-plane .twf-dex-clone-slot .col-skin-act-btn:disabled {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #94a3b8;
}

#title-waterfall-plane .wf-slot.is-hovered {
  z-index: 60;
}

/* Preserve 100% native ptcg-v2 3D perspective & neutralize legacy .poke-card
   backgrounds/borders/hover-jumps from styles.css & collection-ui.css */
#title-waterfall-plane .poke-card.ptcg-v2.wf-card {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 0.718 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
  pointer-events: auto !important;
  cursor: pointer;
  user-select: none;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  transform: rotate(var(--card-jitter, 0deg)) scale(1) !important;
}

#title-waterfall-plane .poke-card.ptcg-v2.wf-card::before,
#title-waterfall-plane .poke-card.ptcg-v2.wf-card::after {
  content: none !important;
  display: none !important;
}

#title-waterfall-plane .poke-card.ptcg-v2.wf-card:not(.unplayable):hover,
#title-waterfall-plane .wf-slot.is-hovered .poke-card.ptcg-v2.wf-card {
  margin: 0 !important;
  box-shadow: none !important;
  transform: rotate(0deg) scale(1.06) !important;
}

#title-waterfall-plane .poke-card.ptcg-v2.wf-card.is-zoom-lifted {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#title-waterfall-plane .poke-card.ptcg-v2.wf-card .j-rotator {
  box-shadow:
    0 10px 22px -8px rgba(51, 65, 85, 0.26),
    0 3px 8px -2px rgba(51, 65, 85, 0.14);
}

#title-waterfall-plane .wf-slot.is-hovered .poke-card.ptcg-v2.wf-card .j-rotator {
  box-shadow:
    0 0 14px -2px var(--j-glow, rgba(148, 163, 184, 0.6)),
    0 18px 34px -10px rgba(30, 41, 59, 0.36);
}

#title-waterfall-veil {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  background:
    radial-gradient(
      ellipse 56% 68% at 24% 52%,
      rgba(var(--twf-veil-color), var(--twf-veil-center-opacity)) 0%,
      rgba(var(--twf-veil-color), calc(var(--twf-veil-opacity) * 0.85)) 52%,
      rgba(var(--twf-veil-color), var(--twf-veil-opacity)) 100%
    );
  transition: opacity 0.6s ease;
}

/* Sky & Horizon Atmospheric Mist when camera pitches up into Floor Mode */
#title-waterfall-veil::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 56% at 50% 14%, rgba(255, 255, 255, 0.92) 0%, transparent 70%),
    linear-gradient(
      180deg,
      rgba(var(--twf-veil-color), 0.96) 0%,
      rgba(var(--twf-veil-color), 0.90) 34%,
      rgba(var(--twf-veil-color), 0.56) 50%,
      rgba(var(--twf-veil-color), 0.14) 64%,
      rgba(var(--twf-veil-color), 0.02) 78%,
      transparent 100%
    );
  transition: opacity 0.72s cubic-bezier(0.22, 1, 0.36, 1);
}

body.twf-mode-floor #title-waterfall-veil::after {
  opacity: 1;
}

/* Ceiling Mode (Multiplayer): clear overhead ribbon at top, bright white stage below */
#title-waterfall-veil::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 56% at 50% 86%, rgba(255, 255, 255, 0.96) 0%, transparent 72%),
    linear-gradient(
      0deg,
      rgba(var(--twf-veil-color), 0.98) 0%,
      rgba(var(--twf-veil-color), 0.93) 44%,
      rgba(var(--twf-veil-color), 0.64) 60%,
      rgba(var(--twf-veil-color), 0.14) 74%,
      transparent 100%
    );
  transition: opacity 0.72s cubic-bezier(0.22, 1, 0.36, 1);
}

body.twf-mode-ceiling #title-waterfall-veil::before {
  opacity: 1;
}

/* =========================================================================
   2. NATIVE 360° FLIP-AND-ZOOM OVERLAY (Background Keeps Moving!)
   ========================================================================= */
.card-zoom3d-overlay.wf-zoom-overlay {
  z-index: 1200 !important;
  background: rgba(15, 23, 42, 0.24) !important;
  transition: background 0.24s ease, opacity 0.2s ease !important;
}

.card-zoom3d-overlay.wf-zoom-overlay.is-returning {
  background: transparent !important;
  pointer-events: none !important;
}

.card-zoom3d-overlay.wf-zoom-overlay .zoom3d-card.ptcg-v2 .j-translater {
  transform: translate3d(var(--zoom-tx, 0px), var(--zoom-ty, 0px), 0.1px) rotate(var(--zoom-rz, 0deg)) scale(var(--zoom-scale, 1)) !important;
}

.card-zoom3d-overlay.wf-zoom-overlay .zoom3d-card.ptcg-v2 .j-rotator {
  box-shadow:
    0 0 2px 1px rgba(255, 255, 255, 0.78),
    0 0 26px -2px var(--j-glow, rgba(56, 189, 248, 0.5)),
    0 28px 54px -12px rgba(15, 23, 42, 0.42);
}

.card-zoom3d-overlay.wf-zoom-overlay .wf-zoom-hint {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 30;
  appearance: none;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.88);
  color: #1e293b;
  font: inherit;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.16);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.card-zoom3d-overlay.wf-zoom-overlay.is-returning .wf-zoom-hint {
  opacity: 0;
  pointer-events: none;
}

/* =========================================================================
   3. FLOATING WHITE LEFT-SIDE MAIN MENU (STRICTLY TITLE SCREEN ONLY!)
   ========================================================================= */
#app[data-screen="title"] {
  position: relative;
  z-index: 10;
  background: transparent !important;
  pointer-events: none;
}

/* Any modal opened on top of the title screen remains fully interactive */
#app[data-screen="title"] > :not(.title-float-home) {
  pointer-events: auto;
}

#app[data-screen="title"] .screen.title-float-home {
  position: fixed;
  inset: 0;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  padding: clamp(28px, 6vw, 88px);
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  pointer-events: none;
  overflow: visible;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

/* Hide the floating left menu while live-tuning or in multiplayer ceiling view */
body:is(.is-twf-tuning, .twf-mode-ceiling) #app[data-screen="title"] .screen.title-float-home {
  opacity: 0;
  transform: translateX(-18px);
  visibility: hidden;
  pointer-events: none;
}

/* Smoothly glide the left title panel out as the Pokédex sidebar replaces it in-place */
body.twf-dex-rush #app[data-screen="title"] .screen.title-float-home {
  opacity: 0;
  transform: translate3d(-44px, 0, 0);
  pointer-events: none;
  transition:
    opacity 0.28s ease-out,
    transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Keep underlying title menu hidden until Pokédex / Collection overlay unmounts on exit landing */
#app[data-screen="title"]:has(.sts-dex-overlay, .collection-meta) .screen.title-float-home {
  opacity: 0;
  pointer-events: none;
  animation: none;
}

.title-float-panel {
  width: min(368px, 86vw);
  padding: 30px 28px 26px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow:
    0 20px 50px -18px rgba(30, 41, 59, 0.18),
    0 4px 14px -4px rgba(30, 41, 59, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  pointer-events: auto;
  color: #0f172a;
}

.title-float-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.11);
  color: #0369a1;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.title-float-title {
  margin: 0 0 22px;
  font-size: clamp(32px, 3.8vw, 42px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.06;
  color: #0f172a;
}

.title-float-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.title-float-section-label {
  margin: 4px 0 0 2px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #64748b;
}

.title-float-continue-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.title-float-run-meta {
  margin: -4px 0 4px 2px;
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  line-height: 1.35;
}

.title-float-divider {
  height: 1px;
  margin: 4px 2px;
  background: rgba(148, 163, 184, 0.26);
}

.title-float-btn {
  appearance: none;
  width: 100%;
  padding: 13px 18px;
  border-radius: 13px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  background: rgba(255, 255, 255, 0.86);
  color: #1e293b;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.title-float-btn:hover {
  transform: translateX(4px);
  background: #ffffff;
  border-color: rgba(14, 165, 233, 0.55);
  box-shadow: 0 8px 20px -8px rgba(14, 165, 233, 0.28);
}

.title-float-btn:active {
  transform: translateX(2px) scale(0.99);
}

.title-float-btn.is-primary {
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 10px 24px -8px rgba(37, 99, 235, 0.5);
}

.title-float-btn.is-primary:hover {
  background: linear-gradient(135deg, #0284c7 0%, #1d4ed8 100%);
  box-shadow: 0 14px 28px -8px rgba(37, 99, 235, 0.62);
}

.title-float-btn.is-danger-ghost {
  width: auto;
  padding: 12px 14px;
  font-size: 13px;
  color: #64748b;
}

.title-float-btn.is-danger-ghost:hover {
  transform: none;
  border-color: rgba(239, 68, 68, 0.45);
  color: #dc2626;
  background: rgba(254, 242, 242, 0.92);
}

.title-float-btn small {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.72;
}

/* =========================================================================
   3b. SINGLE-PLAYER MODE SELECT — TRANSPARENT SKY + 3 FLOATING CARDS
       Strictly scoped to #app[data-screen="mode"] ONLY
   ========================================================================= */
@keyframes twfModeCardsRise {
  from {
    opacity: 0;
    transform: translate3d(0, -34px, 0) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

#app[data-screen="mode"] {
  position: relative;
  z-index: 10;
  isolation: isolate;
  transform: translate3d(0, 0, 0);
  background: transparent !important;
}

#app[data-screen="mode"] .game-mode-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #0f172a !important;
}

#app[data-screen="mode"] .game-mode-screen .dex-detail-bar {
  position: relative;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: clamp(16px, 2.8vh, 28px) clamp(18px, 3vw, 40px) 0;
}

#app[data-screen="mode"] .game-mode-screen .dex-detail-bar > div {
  max-width: 1040px;
  width: 100%;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

#app[data-screen="mode"] .game-mode-screen .dex-detail-bar h1 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #0f172a !important;
  text-shadow: 0 2px 14px rgba(255, 255, 255, 0.9);
}

#app[data-screen="mode"] .game-mode-screen .dex-detail-bar h1:focus {
  outline: none;
}

#app[data-screen="mode"] .game-mode-screen .dex-detail-back {
  appearance: none;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.96) !important;
  background: rgba(255, 255, 255, 0.92) !important;
  color: #1e293b !important;
  font-size: 13.5px;
  font-weight: 800;
  box-shadow: 0 10px 24px -10px rgba(15, 23, 42, 0.18) !important;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

#app[data-screen="mode"] .game-mode-screen .dex-detail-back:hover {
  transform: translateX(-3px);
  background: #ffffff !important;
  border-color: rgba(14, 165, 233, 0.55) !important;
  color: #0369a1 !important;
  box-shadow: 0 12px 28px -10px rgba(14, 165, 233, 0.28) !important;
}

#app[data-screen="mode"] .game-mode-screen .dex-detail-scroll {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(18px, 3vw, 40px) clamp(72px, 14vh, 150px);
  background: transparent !important;
  overflow: visible;
}

#app[data-screen="mode"] .game-mode-screen .game-mode-content {
  width: 100%;
  max-width: 1040px;
  padding: 0;
  background: transparent !important;
  animation: twfModeCardsRise 0.68s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#app[data-screen="mode"] .game-mode-screen .game-mode-options--three {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2.2vw, 28px);
  max-width: 1040px;
}

#app[data-screen="mode"] .game-mode-screen .game-mode-options section {
  position: relative;
  display: grid;
  justify-items: center;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
  padding: clamp(26px, 3.2vw, 40px) clamp(20px, 2.4vw, 30px);
  border-radius: 24px;
  /* Clean luminous glass without backdrop-filter avoids Chrome Skia RenderPass
     flicker over animating 3D perspective layers */
  background: rgba(255, 255, 255, 0.92) !important;
  border: 1px solid rgba(255, 255, 255, 0.98) !important;
  box-shadow:
    0 24px 56px -18px rgba(15, 23, 42, 0.18),
    0 6px 18px -6px rgba(15, 23, 42, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.98) !important;
  color: #0f172a !important;
  text-align: center;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.24s ease, border-color 0.24s ease, background 0.24s ease;
}

#app[data-screen="mode"] .game-mode-screen .game-mode-options section:hover {
  transform: translateY(-8px);
  background: rgba(255, 255, 255, 0.94) !important;
  border-color: rgba(14, 165, 233, 0.58) !important;
  box-shadow:
    0 32px 64px -18px rgba(14, 165, 233, 0.26),
    0 12px 24px -8px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 #ffffff !important;
}

#app[data-screen="mode"] .game-mode-screen .game-mode-options h2 {
  margin: 2px 0 0;
  font-size: clamp(20px, 2vw, 25px);
  font-weight: 900;
  color: #0f172a !important;
}

#app[data-screen="mode"] .game-mode-screen .game-mode-options p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #475569 !important;
  line-height: 1.5;
}

#app[data-screen="mode"] .game-mode-screen .game-mode-options small {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 800;
  color: #0369a1 !important;
}

#app[data-screen="mode"] .game-mode-screen .game-mode-options .collection-control {
  min-width: 128px;
  justify-content: center;
  margin-top: 8px;
  padding: 10px 22px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.36) !important;
  background: rgba(255, 255, 255, 0.92) !important;
  color: #0f172a !important;
  font-size: 14.5px;
  font-weight: 800;
  box-shadow: 0 4px 12px -4px rgba(15, 23, 42, 0.1) !important;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

#app[data-screen="mode"] .game-mode-screen .game-mode-options section:first-child .collection-control,
#app[data-screen="mode"] .game-mode-screen .game-mode-options section:hover .collection-control {
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%) !important;
  border-color: transparent !important;
  color: #ffffff !important;
  box-shadow: 0 10px 24px -8px rgba(37, 99, 235, 0.5) !important;
}

@media (max-width: 760px) {
  #app[data-screen="mode"] .game-mode-screen .dex-detail-scroll {
    padding-bottom: 32px;
    overflow-y: auto;
  }
  #app[data-screen="mode"] .game-mode-screen .game-mode-options--three {
    grid-template-columns: minmax(0, 1fr);
    max-width: 400px;
  }
}

/* =========================================================================
   4. LIVE BACKGROUND TUNING DOCK (Opened from Settings -> 主界面背景板设置)
   ========================================================================= */
#title-waterfall-dock {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  width: 332px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid rgba(148, 163, 184, 0.36);
  box-shadow: 0 18px 42px -12px rgba(15, 23, 42, 0.22);
  color: #1e293b;
  overflow: hidden;
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif;
  transition: width 0.2s ease;
}

#title-waterfall-dock.is-collapsed {
  width: auto;
}

#title-waterfall-dock.is-collapsed .twf-dock-body {
  display: none;
}

.twf-dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(248, 250, 252, 0.78);
}

#title-waterfall-dock.is-collapsed .twf-dock-head {
  border-bottom: 0;
}

.twf-dock-title {
  font-size: 13.5px;
  font-weight: 900;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.twf-dock-head-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

.twf-dock-toggle-btn {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #ffffff;
  color: #334155;
  border-radius: 8px;
  padding: 4px 9px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.twf-dock-toggle-btn:hover {
  border-color: #0284c7;
  color: #0369a1;
}
.twf-dock-toggle-btn.is-done {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
}
.twf-dock-toggle-btn.is-done:hover {
  background: #0369a1;
  color: #ffffff;
}

.twf-dock-body {
  padding: 12px 14px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 11px;
  scrollbar-width: thin;
}

.twf-ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.twf-ctrl-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  color: #334155;
}

.twf-ctrl-hint {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  margin-left: 3px;
}

.twf-ctrl-label output {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: #0369a1;
  font-variant-numeric: tabular-nums;
}

.twf-ctrl-group input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: #0284c7;
  cursor: pointer;
}

.twf-dock-select {
  width: 100%;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  background: rgba(255, 255, 255, 0.94);
  color: #1e293b;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.twf-seg-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}
.twf-seg-row.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.twf-seg-row.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.twf-seg-row.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.twf-seg-btn {
  appearance: none;
  padding: 5px 4px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.88);
  color: #334155;
  font: inherit;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.14s ease;
}

.twf-seg-btn:hover {
  border-color: #38bdf8;
  color: #0369a1;
}

.twf-seg-btn.is-active {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
  box-shadow: 0 3px 10px -2px rgba(2, 132, 199, 0.45);
}

.twf-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(241, 245, 249, 0.82);
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  cursor: pointer;
}

.twf-toggle-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #0284c7;
  cursor: pointer;
}

.twf-dock-details {
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(248, 250, 252, 0.72);
  padding: 6px 10px;
}

.twf-dock-details summary {
  font-size: 12px;
  font-weight: 800;
  color: #64748b;
  cursor: pointer;
  user-select: none;
}

.twf-dock-details .twf-details-inner {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.twf-dock-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.twf-dock-btn {
  appearance: none;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  background: #ffffff;
  color: #1e293b;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.twf-dock-btn:hover {
  border-color: #0284c7;
  color: #0369a1;
}

.twf-dock-btn.is-accent {
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  border-color: transparent;
  color: #ffffff;
}

.twf-dock-btn.is-accent:hover {
  background: linear-gradient(135deg, #0284c7 0%, #1d4ed8 100%);
  color: #ffffff;
}

/* =========================================================================
   5. MOBILE LANDSCAPE & SHORT VIEWPORT RESPONSIVE ADAPTATION
   ========================================================================= */
.card-zoom3d-overlay.wf-zoom-overlay {
  touch-action: none;
  -webkit-touch-callout: none;
}

.card-zoom3d-overlay.wf-zoom-overlay .zoom3d-card.ptcg-v2 {
  touch-action: none;
  -webkit-touch-callout: none;
}

.card-zoom3d-overlay.wf-zoom-overlay .wf-zoom-hint {
  bottom: max(14px, env(safe-area-inset-bottom, 0px));
}

#title-waterfall-dock {
  max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  top: max(16px, env(safe-area-inset-top, 0px));
  right: max(16px, env(safe-area-inset-right, 0px));
}

.title-float-panel {
  max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

@media (max-height: 560px) {
  #app[data-screen="title"] .screen.title-float-home {
    padding:
      max(10px, env(safe-area-inset-top, 0px))
      max(14px, env(safe-area-inset-right, 0px))
      max(10px, env(safe-area-inset-bottom, 0px))
      max(16px, env(safe-area-inset-left, 0px));
  }

  .title-float-panel {
    width: min(304px, 44vw);
    padding: 14px 16px 12px;
    border-radius: 18px;
  }

  .title-float-kicker {
    padding: 2px 8px;
    font-size: 10px;
    margin-bottom: 4px;
  }

  .title-float-title {
    margin: 0 0 10px;
    font-size: clamp(20px, 3vw, 26px);
  }

  .title-float-nav {
    gap: 6px;
  }

  .title-float-section-label {
    margin: 0 0 0 2px;
    font-size: 10px;
  }

  .title-float-divider {
    margin: 2px;
  }

  .title-float-btn {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    gap: 6px;
  }

  .title-float-btn.is-danger-ghost {
    padding: 8px 10px;
    font-size: 11.5px;
  }

  .title-float-btn small {
    font-size: 10.5px;
  }

  .title-float-run-meta {
    font-size: 10.5px;
  }

  .card-zoom3d-overlay.wf-zoom-overlay .wf-zoom-hint {
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
    padding: 5px 12px;
    font-size: 11px;
  }

  #title-waterfall-dock {
    width: min(300px, 46vw);
    top: max(8px, env(safe-area-inset-top, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
    max-height: calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }
}

@media (max-height: 360px) {
  .title-float-panel {
    width: min(276px, 42vw);
    padding: 10px 12px;
    border-radius: 14px;
  }

  .title-float-kicker,
  .title-float-section-label {
    display: none;
  }

  .title-float-title {
    margin: 0 0 7px;
    font-size: 18px;
  }

  .title-float-nav {
    gap: 4px;
  }

  .title-float-btn {
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
  }

  .title-float-btn small {
    font-size: 10px;
  }
}


/* =========================================================================
   IN-RUN FULL-SCREEN WATERFALL PAUSE OVERLAY (body.twf-pause-overlay)
   Uses the exact same stacking order as Title Screen (stage: 1, veil: 2, #app: 10)
   while smoothly hiding the underlying in-run DOM so the live waterfall sits cleanly
   behind .pause-menu-overlay, Pokédex, Collection, and Settings!
   ========================================================================= */
@keyframes twfPauseFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

body.twf-pause-overlay #title-waterfall-stage {
  z-index: 1;
  pointer-events: none;
  animation: twfPauseFadeIn 0.26s ease-out both;
}

body.twf-pause-overlay #title-waterfall-veil {
  z-index: 2;
  animation: twfPauseFadeIn 0.26s ease-out both;
}

body.twf-pause-overlay #app {
  position: relative;
  z-index: 10 !important;
  background: transparent !important;
}

/* Smoothly hide underlying in-run HUD/stage while paused so the live waterfall shows through */
body.twf-pause-overlay #app > :not(.pause-menu-overlay):not(.sts-dex-overlay):not(.collection-meta):not([data-game-menu]):not(.modal-backdrop):not(.dex-detail) {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.22s ease-out;
}

body.twf-pause-overlay.twf-pause-fading-out #app > :not(.pause-menu-overlay):not(.sts-dex-overlay):not(.collection-meta):not([data-game-menu]):not(.modal-backdrop):not(.dex-detail) {
  opacity: 1 !important;
  transition: opacity 0.22s ease-out;
}

body.twf-pause-overlay.twf-pause-fading-out #title-waterfall-stage,
body.twf-pause-overlay.twf-pause-fading-out #title-waterfall-veil {
  opacity: 0 !important;
  transition: opacity 0.22s ease-out !important;
}

body.twf-pause-overlay.twf-dex-rush .pause-menu-overlay {
  opacity: 0;
  transform: translate3d(-44px, 0, 0);
  pointer-events: none;
  transition: opacity 0.26s ease-out, transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes twfPauseReturnIn {
  from {
    opacity: 0;
    transform: translate3d(-36px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

body.twf-pause-overlay.twf-dex-exit .pause-menu-overlay {
  animation: twfPauseReturnIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
