/* KnightDesert V21 — conservative performance and mobile gesture fixes. */
html,
body {
  scroll-behavior: auto !important;
}

body.lineage-book-open .phoenix-launch-countdown {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity .16s ease, visibility 0s linear .16s !important;
}

/* Desktop V23: restore the real Phoenix hit area. The legacy coordinate-based
   controller is disabled, so this element must receive pointer events itself. */
@media (min-width: 901px) {
  html body > #phoenixHoverZone,
  #phoenixHoverZone {
    top: 38.5vh !important;
    width: clamp(280px, 23vw, 460px) !important;
    height: clamp(220px, 28vh, 360px) !important;
    transform: translateX(-50%) !important;
    clip-path: ellipse(49% 48% at 50% 50%) !important;
    pointer-events: auto !important;
    cursor: pointer !important;
  }

  /* A visible but static glow. It appears only while the pointer is over the
     bird, so unlike the old pulse it has no permanent animation cost. */
  html body > #phoenixHoverZone::before,
  #phoenixHoverZone::before {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    inset: 3% 1% !important;
    border-radius: 50% !important;
    pointer-events: none !important;
    background: radial-gradient(ellipse at 50% 48%, rgba(255,249,195,.58) 0%, rgba(255,190,72,.30) 27%, rgba(255,91,17,.12) 50%, transparent 72%) !important;
    mix-blend-mode: screen !important;
    filter: blur(12px) saturate(1.12) !important;
    opacity: 0 !important;
    transform: scale(.88) !important;
    transition: opacity .18s ease, transform .24s ease !important;
    animation: none !important;
  }
  body.phoenix-center-lit #phoenixHoverZone::before,
  #phoenixHoverZone.is-hovering::before,
  #phoenixHoverZone:hover::before,
  #phoenixHoverZone:focus-visible::before {
    content: "" !important;
    display: block !important;
    opacity: 1 !important;
    transform: scale(1.04) !important;
    animation: none !important;
  }
  body.news-revealed #phoenixHoverZone,
  body.news-scroll-active #phoenixHoverZone,
  body.lineage-book-open #phoenixHoverZone {
    pointer-events: none !important;
    visibility: hidden !important;
  }

  /* Keep the Phoenix reaction visible without recompositing several large
     blurred drop-shadows on every animation frame. */
  body.phoenix-center-lit .bg-layer {
    filter: brightness(1.14) contrast(1.04) saturate(1.12) !important;
    transform: scale(1.018) !important;
  }
  body.phoenix-center-lit .light-core {
    opacity: .94 !important;
    transform: scale(1.10) !important;
    filter: blur(14px) brightness(1.25) saturate(1.08) !important;
  }
  body.phoenix-center-lit .wing-glow,
  body.phoenix-center-lit .phoenix-left-aura,
  body.phoenix-center-lit .phoenix-wing-breath {
    opacity: .88 !important;
  }

  /* Large blurred layers and dozens of glowing particles were continuously
     repainting the whole desktop viewport. Preserve their static appearance
     and leave only a small group of light particles moving. */
  #scene .lava-sky,
  #scene .mobile-lightning,
  #scene .phoenix-left-aura,
  #scene .phoenix-wing-breath,
  #scene .light-core,
  #scene .wing-glow,
  #scene .heat,
  #scene .lava-flow,
  #scene .smoke,
  #startGameButton .lux-lava-aura,
  #startGameButton .lux-embers,
  #startGameButton .lux-shine,
  #phoenixLavaDust .dust-base,
  #phoenixLavaDust .dust-glow {
    animation: none !important;
    will-change: auto !important;
  }
  #embers,
  #lava {
    display: none !important;
  }
  #phoenixLavaDust .lava-dust {
    box-shadow: 0 0 7px rgba(255, 207, 91, .48) !important;
    filter: none !important;
    will-change: transform, opacity !important;
  }
  #phoenixLavaDust .lava-dust::after {
    display: none !important;
  }
  #phoenixLavaDust .lava-dust:nth-of-type(n+25) {
    display: none !important;
  }
  #phoenixSideMenu.is-collapsed *,
  html.phoenix-page-hidden * {
    animation-play-state: paused !important;
  }
}

/* Reveal the lower sections with one cheap compositor transition. */
.phoenix-news-section {
  transform: translate3d(0, 28px, 0) !important;
  transition: opacity .28s ease, transform .28s ease, visibility 0s linear .28s !important;
  will-change: auto !important;
}
body.news-revealed .phoenix-news-section {
  transform: translate3d(0, 0, 0) !important;
  transition-delay: 0s !important;
}

/* The solid card backgrounds already provide the same readable appearance.
   Removing live backdrop blur avoids repainting the fixed animated scene. */
#phoenixNews .news-shell,
#phoenixNews .news-card,
#phoenixServerInfo .premium-server-shell,
#phoenixServerInfo .premium-server-card {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
#phoenixNews .news-card::before,
#phoenixNews .news-card::after,
#phoenixServerInfo .premium-server-card::before,
#phoenixServerInfo .premium-server-card::after {
  animation: none !important;
}

/* The first screen is no longer visible behind content or the open book.
   Keep its current frame but stop continuous GPU work. */
body.news-revealed .scene *,
body.lineage-book-open .scene *,
html.phoenix-page-hidden .scene * {
  animation-play-state: paused !important;
}

@media (max-width: 900px), (hover: none), (pointer: coarse) {
  #phoenixNews .news-track {
    touch-action: pan-y !important;
    overscroll-behavior-x: contain !important;
    scroll-behavior: auto !important;
  }

  #lineageServerBook {
    overflow: hidden !important;
    overscroll-behavior: none !important;
  }
  #lineageServerBook .lineage-book,
  #lineageServerBook .phoenix-book-text-layer,
  #lineageServerBook .phoenix-book-text-page {
    touch-action: none !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
  }
  #lineageServerBook.is-visible:not(.is-book-closing) .lineage-book {
    transform-origin: 50% 50% !important;
    transform: translate3d(var(--phx-book-pan-x, 0px), var(--phx-book-pan-y, 0px), 0) scale(var(--phx-book-zoom, 1)) !important;
    transition: transform .10s ease-out !important;
  }
  #lineageServerBook.phoenix-book-panning .lineage-book,
  #lineageServerBook.phoenix-book-pinching .lineage-book {
    transition: none !important;
    will-change: transform !important;
  }

  /* These cinematic layers are invisible behind the mobile book image but
     still cost memory and paint time on older phones. */
  #lineageServerBook .book-vignette,
  #lineageServerBook .book-cinematic-fog,
  #lineageServerBook .book-stained-light,
  #lineageServerBook .book-floor-shadow,
  #lineageServerBook .book-real-fire-wall,
  #lineageServerBook .book-video-burn,
  #lineageServerBook .book-ash-field,
  #lineageServerBook .book-fragment-field,
  #lineageServerBook .phoenix-page-curl-ribs {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .phoenix-news-section {
    transition: none !important;
    transform: none !important;
  }
}
