/* ERIC FIX 2026-05-31: smooth scroll card anime Android kecil.
   File ini mengganti optimasi lama yang memakai content-visibility,
   karena content-visibility bisa membuat area card terlihat hitam/kosong saat scroll cepat. */

@media (max-width: 640px) {
  .section,
  .home-feature-section,
  .anime-grid,
  .anime-card,
  .poster-wrap,
  .poster,
  .poster img {
    content-visibility: visible;
    contain: none;
    contain-intrinsic-size: auto;
  }

  body[data-route-page="home"] .section.home-feature-section {
    padding-top: 18px;
    padding-bottom: 2px;
  }

  body[data-route-page="home"] .section .anime-grid,
  body[data-route-page="home"] .home-feature-section .anime-grid {
    grid-auto-columns: clamp(118px, 34vw, 145px);
    gap: 10px;
    padding: 2px 0 6px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-snap-type: none;
  }

  body[data-route-page="home"] .section .anime-grid::-webkit-scrollbar,
  body[data-route-page="home"] .home-feature-section .anime-grid::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  body[data-route-page="home"] .anime-card {
    min-width: 0;
    transform: translateZ(0);
    backface-visibility: hidden;
  }

  body[data-route-page="home"] .poster-wrap,
  body[data-route-page="home"] .poster {
    overflow: hidden;
    border-radius: 2px;
    background: #0f172a;
    transform: translateZ(0);
    backface-visibility: hidden;
  }

  body[data-route-page="home"] .poster {
    box-shadow: 0 4px 12px rgba(0, 0, 0, .22);
    transition: none;
  }

  body[data-route-page="home"] .poster img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    opacity: 1;
    transition: none;
    transform: translateZ(0);
    backface-visibility: hidden;
  }

  body[data-route-page="home"] .card-body {
    padding-top: 6px;
  }

  body[data-route-page="home"] .card-body h3 {
    min-height: 32px;
    font-size: .78rem;
    line-height: 1.25;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  body[data-route-page="home"] .episode-badge {
    min-height: 20px;
    min-width: 42px;
    padding: 3px 7px;
    font-size: .62rem;
    box-shadow: none;
  }

  body[data-route-page="home"] .scroll-btn,
  body[data-route-page="home"] .poster:hover {
    transform: none;
  }
}

/* Badge live chat tetap utuh tanpa memotong border radius. */
.home-live-chat-fab {
  overflow: visible;
}

.home-live-chat-fab .home-chat-badge,
.home-chat-badge {
  box-sizing: border-box;
  overflow: visible;
  z-index: 5;
}

@media (max-width: 640px) {
  .home-live-chat-fab .home-chat-badge,
  .home-chat-badge {
    top: -7px;
    right: -7px;
    min-width: 24px;
    height: 24px;
  }
}


/* ERIC RAM3GB V2 DOM LITE: kurangi beban render card home di HP kecil tanpa ubah player/live chat. */
@media (max-width: 640px) {
  body[data-route-page="home"] .section.home-feature-section {
    padding-top: 14px;
    padding-bottom: 0;
  }

  body[data-route-page="home"] .section-head {
    margin-bottom: 10px;
  }

  body[data-route-page="home"] .section-head h2 {
    font-size: 1.08rem;
    letter-spacing: -.02em;
  }

  body[data-route-page="home"] .section-head p,
  body[data-route-page="home"] .section-kicker {
    display: none;
  }

  body[data-route-page="home"] .section .anime-grid,
  body[data-route-page="home"] .home-feature-section .anime-grid {
    grid-auto-columns: clamp(124px, 35vw, 150px);
    gap: 10px;
    padding: 0 0 4px;
    touch-action: pan-x pan-y;
  }

  body[data-route-page="home"] .anime-card,
  body[data-route-page="home"] .poster-wrap,
  body[data-route-page="home"] .poster,
  body[data-route-page="home"] .poster img {
    transform: none;
    will-change: auto;
    backface-visibility: visible;
  }

  body[data-route-page="home"] .poster {
    border: 0;
    box-shadow: none;
  }

  body[data-route-page="home"] .episode-badge {
    min-width: 36px;
    min-height: 18px;
    padding: 2px 6px;
    font-size: .56rem;
    left: 5px;
    bottom: 6px;
    box-shadow: none;
  }

  body[data-route-page="home"] .card-body {
    padding-top: 4px;
  }

  body[data-route-page="home"] .card-body h3 {
    min-height: 30px;
    font-size: .8rem;
    line-height: 1.22;
  }

  body[data-route-page="home"] .anime-grid-load-wrap {
    margin-top: 4px;
    padding: 8px 0 4px;
  }

  body[data-route-page="home"] .anime-grid-load-wrap small {
    font-size: .68rem;
  }
}


/* ERIC FIX 2026-05-31: loader muat hanya spinner kecil, tanpa teks. */
.anime-grid-load-wrap.page-inline-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 0 2px;
}
.anime-grid-load-wrap.page-inline-loader[hidden] {
  display: none;
}
.anime-grid-load-wrap.page-inline-loader .anime-grid-page-spinner {
  inline-size: 22px;
  block-size: 22px;
  flex: 0 0 auto;
  margin: 0;
}
.anime-grid-load-wrap.page-inline-loader small,
.anime-grid-load-wrap.page-inline-loader .anime-grid-load-more {
  display: none;
}
body[data-route-page="home"] .anime-grid-load-wrap,
body[data-route-page="home"] .anime-grid-sentinel {
  display: none;
}

/* ERIC FIX 2026-05-31: edit 2 card lebih ringan, tanpa animasi berat. */
.collection-leaderboard-picker.editing.eric-leaderboard-edit-shop-style {
  contain: layout paint;
}
.collection-leaderboard-picker.editing.eric-leaderboard-edit-shop-style .leaderboard-choice-slider {
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior-x: contain;
}
.collection-leaderboard-picker.editing.eric-leaderboard-edit-shop-style .leaderboard-choice-slider::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.collection-leaderboard-picker.editing.eric-leaderboard-edit-shop-style .leaderboard-choice,
.collection-leaderboard-picker.editing.eric-leaderboard-edit-shop-style .chart-card,
.collection-leaderboard-picker.editing.eric-leaderboard-edit-shop-style .chart-card-link,
.collection-leaderboard-picker.editing.eric-leaderboard-edit-shop-style .chart-image-wrap,
.collection-leaderboard-picker.editing.eric-leaderboard-edit-shop-style .chart-main-img,
.collection-leaderboard-picker.editing.eric-leaderboard-edit-shop-style .chart-banner-img {
  transition: none;
  animation: none;
  box-shadow: none;
  filter: none;
  transform: none;
  will-change: auto;
}
.collection-leaderboard-picker.editing.eric-leaderboard-edit-shop-style .leaderboard-choice.active .chart-card,
.collection-leaderboard-picker.editing.eric-leaderboard-edit-shop-style .leaderboard-choice:has(input:checked) .chart-card {
  outline: 1px solid rgba(216,180,254,.72);
  box-shadow: 0 0 0 2px rgba(168,85,247,.16);
}


/* ERIC REPLACE 2026-06-01: Hero pure fade, posisi gambar tidak bergeser. */
body[data-route-page="home"] .hero[data-hero-slider] {
  background-size: auto 100%;
  background-position: center center;
  background-repeat: no-repeat;
  transition: none;
  transform: none;
  will-change: auto;
}
body[data-route-page="home"] .hero[data-hero-slider] .hero-bg-fade-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-size: auto 100%;
  background-position: center center;
  background-repeat: no-repeat;
  opacity: 0;
  transform: none;
  transition: none;
  will-change: opacity;
}
body[data-route-page="home"] .hero[data-hero-slider].is-hero-image-changing .hero-bg-fade-layer {
  animation: ericHeroImageFade .62s ease both;
}
body[data-route-page="home"] .hero[data-hero-slider] .hero-inner {
  position: relative;
  z-index: 2;
}
body[data-route-page="home"] .hero[data-hero-slider]::before,
body[data-route-page="home"] .hero[data-hero-slider]::after {
  z-index: 1;
}
@keyframes ericHeroImageFade {
  0% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: none; }
}

@media (max-width: 640px) {
  body[data-route-page="home"] .hero,
  body[data-route-page="home"] .hero[data-hero-slider],
  .app-shell > .app-main[data-active-page="home"] .hero,
  .app-shell > .app-main[data-active-page="home"] .hero[data-hero-slider],
  .home-page .hero,
  .home-page .hero[data-hero-slider] {
    min-height: min(760px, calc(94svh - var(--eric-home-hero-header-offset, 70px)));
    height: min(760px, calc(94svh - var(--eric-home-hero-header-offset, 70px)));
    background-size: auto 100%;
    background-position: center center;
    background-repeat: no-repeat;
  }
  body[data-route-page="home"] .hero[data-hero-slider] .hero-bg-fade-layer {
    background-size: auto 100%;
    background-position: center center;
    background-repeat: no-repeat;
  }
}

/* ERIC REPLACE 2026-05-31: Library, Bookmark, dan Search dibuat rapat kiri-kanan. */
@media (max-width: 640px) {
  body[data-route-page="library"] .page.container.library-page,
  body[data-route-page="bookmark"] .page.container.bookmark-page,
  body[data-route-page="favorite"] .page.container.bookmark-page,
  body[data-route-page="search"] .page.container.search-page {
    padding-left: 2px;
    padding-right: 2px;
  }
}


/* Search page list shape and header search button. */
body[data-route-page="search"] .compact-navbar {
  height: auto;
  min-height: 86px;
  padding: 14px 2px 8px;
  background: transparent;
  border-bottom: 0;
  box-shadow: none;
  backdrop-filter: none;
}

body[data-route-page="search"] .compact-navbar .nav-search {
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  height: 70px;
  min-height: 70px;
  margin: 0;
  padding: 0 6px 0 12px;
  gap: 13px;
  border: 1px solid rgba(255,255,255,.055);
  border-radius: 30px;
  background: rgba(255,255,255,.075);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 18px 42px rgba(0,0,0,.22);
}

body[data-route-page="search"] .compact-navbar .nav-search svg {
  width: 26px;
  height: 26px;
  color: rgba(255,255,255,.68);
  flex: 0 0 auto;
}

body[data-route-page="search"] .compact-navbar .nav-search input {
  min-width: 0;
  height: 68px;
  min-height: 68px;
  color: #fff;
  font-size: clamp(1.28rem, 5vw, 1.8rem);
  font-weight: 500;
  letter-spacing: .01em;
}

.nav-search-submit {
  width: 108px;
  min-width: 108px;
  height: 58px;
  border: 0;
  border-radius: 22px;
  color: #fff;
  background: rgba(255,255,255,.13);
  font-size: clamp(1rem, 3.8vw, 1.38rem);
  font-weight: 950;
  cursor: pointer;
}

@media (max-width: 640px) {
  body[data-route-page="search"] .compact-navbar {
    min-height: 80px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 2px 6px;
  }

  body[data-route-page="search"] .compact-navbar .nav-search {
    height: 64px;
    min-height: 64px;
    border-radius: 27px;
    padding-left: 12px;
  }

  body[data-route-page="search"] .compact-navbar .nav-search input {
    height: 62px;
    min-height: 62px;
  }

  .nav-search-submit {
    width: 92px;
    min-width: 92px;
    height: 52px;
    border-radius: 19px;
  }
}

@media (max-width: 380px) {
  body[data-route-page="search"] .compact-navbar {
    padding-left: 2px;
    padding-right: 2px;
  }

  .nav-search-submit {
    width: 78px;
    min-width: 78px;
  }
}

/* ERIC FIX 2026-06-01: normal purple loader for page route and library inline loading. */
.eric-purple-loader {
  inline-size: 42px;
  block-size: 42px;
  border-radius: 999px;
  border: 4px solid rgba(139, 92, 246, .22);
  border-top-color: #8b5cf6;
  border-right-color: #a78bfa;
  animation: networkSpin .78s linear infinite;
  box-shadow: 0 0 22px rgba(139, 92, 246, .22);
}

.page-logo-loader .network-loading-card {
  display: grid;
  place-items: center;
  min-width: 84px;
  min-height: 84px;
  padding: 20px;
  background: rgba(5, 5, 9, .74);
  border: 1px solid rgba(139, 92, 246, .18);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .32);
}

.anime-grid-load-wrap.page-inline-loader .eric-purple-loader.anime-grid-page-spinner {
  inline-size: 24px;
  block-size: 24px;
  border-width: 3px;
}

.boot-screen {
  position: relative;
  display: grid;
  place-items: center;
  gap: 12px;
}

.boot-screen::after {
  content: "";
  inline-size: 34px;
  block-size: 34px;
  border-radius: 999px;
  border: 4px solid rgba(139, 92, 246, .22);
  border-top-color: #8b5cf6;
  border-right-color: #a78bfa;
  animation: networkSpin .78s linear infinite;
}
