/* Tsukiro 3.6.53 — native wheel/touch scrolling.
   Keep normal user scrolling immediate; smooth behavior is requested explicitly
   by the few buttons that need it (back-to-top, scrollIntoView, etc.). */
html,
html[data-candy-ui="true"]{
  scroll-behavior:auto!important;
}
html,body{
  overscroll-behavior-y:auto;
}
body{
  touch-action:pan-x pan-y pinch-zoom;
}

/* A closed off-canvas panel must never become the wheel/pointer target. */
.community-chat-panel:not(.open){
  pointer-events:none!important;
  visibility:hidden!important;
}
.community-chat-panel.open{
  pointer-events:auto!important;
  visibility:visible!important;
}
.community-chat:not(.is-open) .community-chat-backdrop{
  pointer-events:none!important;
}

/* Horizontal rails must not trap vertical wheel/trackpad motion. */
:where(
  .card-track,
  .discovery-release-strip,
  .profile-tabs,
  .character-dialog__cast-grid,
  .catalog-filter-checks,
  .watch-picker-list
){
  overscroll-behavior-y:auto!important;
}

/* Avoid scroll repaint work from decorative fixed layers. */
.candy-noise,
.candy-ambient,
.candy284-world,
body::before{
  pointer-events:none!important;
}

/* Don't pre-promote large page-wide decorative layers forever. */
.candy-cursor-glow,
.candy284-world,
.candy-ambient{
  will-change:auto!important;
}

/* 3.6.57 — responsive performance pass.
   Fixed backdrop filters and page-wide decorative layers are expensive while
   the browser is trying to scroll. Keep the same dark Tsukiro silhouette, but
   make scrolling and touch interaction native and cheap. */
html{
  min-width:0;
  max-width:100%;
  overflow-x:clip;
  scroll-behavior:auto!important;
}
body{
  min-width:0;
  max-width:100%;
  overflow-x:clip;
}

/* The progress bar now moves with transform in JS and never relayouts the page. */
.tsukiro-scroll-progress{
  width:100%!important;
  transform:scaleX(0);
  transform-origin:left center;
  contain:strict;
  will-change:transform;
}

/* A solid header is visually almost identical here and much cheaper to repaint. */
.navbar.is-scrolled,
.navbar.navbar-solid,
.navbar.candy-navbar-scrolled{
  background:rgba(9,9,13,.96)!important;
  -webkit-backdrop-filter:none!important;
  backdrop-filter:none!important;
}

/* Decorative full-screen layers were forcing a viewport-sized repaint. */
.candy-noise,
.candy-ambient,
.candy284-world,
.candy-cursor-glow{
  display:none!important;
}
body::before{
  background-attachment:scroll!important;
  filter:none!important;
}

@media (hover:none), (pointer:coarse), (max-width:760px){
  html,body{
    overscroll-behavior-y:auto!important;
    touch-action:pan-y pinch-zoom!important;
    -webkit-overflow-scrolling:touch;
  }

  /* Avoid delayed taps and expensive hover/entrance work on touch screens. */
  :where(.anime-card,.media-card,.quick-start-card,.profile-card,.collection-card,.schedule-card,.watch-player-shell,.button,.icon-button){
    transform:none!important;
    will-change:auto!important;
  }
  :where(.candy284-reveal,.tsukiro-scroll-reveal,.reveal){
    opacity:1!important;
    translate:none!important;
    transform:none!important;
    transition:none!important;
  }
  :where(.world294-stage,.candy284-hero-stage,.candy-hero-grid-layer,.candy-hero-orb,.profile-particles){
    display:none!important;
  }
  :where(.navbar,.search-results,.tsukiro-mobile-nav,.v19-notification-panel,.direct-messages-panel,.watch-titlebar,.watch-controls-row,.watch-franchise-button,.watch-source-button,.watch-player-settings){
    -webkit-backdrop-filter:none!important;
    backdrop-filter:none!important;
  }
  :where(.navbar,.search-results,.tsukiro-mobile-nav,.watch-player-shell,.watch-titlebar,.watch-source-panel){
    box-shadow:none!important;
  }
  :where(.profile-banner-media,body[data-profile-has-custom-bg="1"] #authUser::after){
    background-attachment:scroll!important;
  }

  /* Compact, stable app header. */
  .navbar{
    height:60px!important;
    min-height:60px!important;
    padding:7px 10px!important;
    gap:8px!important;
    background:#0b0a0f!important;
    border-bottom:1px solid rgba(255,255,255,.07)!important;
  }
  .navbar .brand{
    width:42px!important;
    min-width:42px!important;
  }
  .navbar .brand img{
    width:40px!important;
    height:40px!important;
    transform:none!important;
  }
  .navbar .nav-actions{
    gap:6px!important;
  }
  .navbar .icon-button{
    width:40px!important;
    min-width:40px!important;
    height:40px!important;
    min-height:40px!important;
    border-radius:12px!important;
  }
  .search-hint{display:none!important}

  /* Search behaves as a bounded sheet instead of covering the whole page. */
  .search-shell.is-open .search-input{
    position:fixed!important;
    z-index:1250!important;
    top:68px!important;
    left:10px!important;
    right:10px!important;
    width:auto!important;
    height:48px!important;
    padding:0 48px 0 15px!important;
    border-radius:15px!important;
    background:#111117!important;
    font-size:16px!important;
  }
  .search-shell.is-open .search-results{
    position:fixed!important;
    z-index:1249!important;
    top:124px!important;
    right:10px!important;
    bottom:calc(76px + env(safe-area-inset-bottom))!important;
    left:10px!important;
    width:auto!important;
    max-width:none!important;
    max-height:none!important;
    padding:6px!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior:contain!important;
    touch-action:pan-y!important;
    -webkit-overflow-scrolling:touch;
    border-radius:17px!important;
    background:#101016!important;
  }
  .search-type-tabs{
    gap:5px!important;
    padding:5px 5px 8px!important;
    background:#101016!important;
  }
  .search-type-tabs button{
    min-width:0!important;
    height:40px!important;
    padding:0 8px!important;
    font-size:13px!important;
  }
  .search-result,
  .search-user-result{
    min-width:0!important;
    min-height:60px!important;
    grid-template-columns:42px minmax(0,1fr) auto!important;
    gap:10px!important;
    padding:7px 8px!important;
    border-radius:12px!important;
  }
  .search-result img{
    width:42px!important;
    height:56px!important;
    border-radius:9px!important;
  }
  .search-user-avatar{
    width:42px!important;
    height:42px!important;
  }
  .search-result strong{
    max-width:100%!important;
    overflow:hidden!important;
    font-size:14px!important;
    line-height:1.25!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }
  .search-result small{
    overflow:hidden!important;
    font-size:12px!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }
  .search-result>span:last-child,
  .search-user-result>a:last-child{
    font-size:12px!important;
    white-space:nowrap!important;
  }

  /* Bottom navigation no longer competes with browser chrome. */
  body.has-mobile-nav{
    padding-bottom:calc(72px + env(safe-area-inset-bottom))!important;
  }
  .tsukiro-mobile-nav{
    left:8px!important;
    right:8px!important;
    bottom:max(6px,env(safe-area-inset-bottom))!important;
    height:58px!important;
    padding:4px!important;
    border-radius:18px!important;
    background:#0d0c12!important;
  }
  .tsukiro-mobile-nav a{
    min-width:0!important;
    border-radius:14px!important;
  }
  .tsukiro-mobile-nav a span{
    font-size:10px!important;
    line-height:1.1!important;
  }

  /* Global page rhythm: no accidental horizontal overflow. */
  main,.container,.page-main,.home-sections,.profile-page,.anime-detail-layout{
    min-width:0!important;
    max-width:100%!important;
  }
  img,video,canvas,svg,iframe{
    max-width:100%!important;
  }
  h1,h2,h3,p,strong,small,span{
    overflow-wrap:anywhere;
  }

  /* Watch page from the supplied iPhone screenshots. */
  body[data-page="watch"]{
    padding-bottom:env(safe-area-inset-bottom)!important;
  }
  body[data-page="watch"] .watch-main{
    width:100%!important;
    padding:66px 0 34px!important;
  }
  body[data-page="watch"] .watch-container{
    width:100%!important;
    max-width:100%!important;
    padding:0 10px 48px!important;
    overflow:hidden!important;
  }
  body[data-page="watch"] .watch-titlebar{
    position:relative!important;
    min-width:0!important;
    width:100%!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    align-items:end!important;
    gap:10px!important;
    margin:0 0 10px!important;
    padding:12px!important;
    overflow:hidden!important;
    border-radius:16px!important;
    background:#121118!important;
  }
  body[data-page="watch"] .watch-title-copy{
    min-width:0!important;
    overflow:hidden!important;
  }
  body[data-page="watch"] .watch-title-copy h1{
    display:-webkit-box!important;
    width:100%!important;
    max-width:100%!important;
    margin:6px 0 3px!important;
    overflow:hidden!important;
    font-size:clamp(20px,6.2vw,26px)!important;
    line-height:1.08!important;
    letter-spacing:-.035em!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
    -webkit-box-orient:vertical!important;
    -webkit-line-clamp:2!important;
  }
  body[data-page="watch"] .watch-title-copy p{
    margin:0!important;
    overflow:hidden!important;
    font-size:12px!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }
  body[data-page="watch"] .watch-back{
    font-size:12px!important;
  }
  body[data-page="watch"] .watch-titlebar-actions{
    width:auto!important;
    min-width:0!important;
    justify-content:flex-end!important;
  }
  body[data-page="watch"] .watch-editor-button{
    width:42px!important;
    min-width:42px!important;
    height:42px!important;
    min-height:42px!important;
    padding:0!important;
    border-radius:12px!important;
  }
  body[data-page="watch"] .watch-editor-button span{
    display:none!important;
  }
  body[data-page="watch"] .watch-player-shell{
    width:100%!important;
    max-width:100%!important;
    min-height:0!important;
    margin:0!important;
    overflow:hidden!important;
    border:1px solid rgba(255,255,255,.08)!important;
    border-radius:14px!important;
    aspect-ratio:16/9!important;
    touch-action:manipulation!important;
  }
  body[data-page="watch"] .watch-player-shell:hover{
    transform:none!important;
    box-shadow:none!important;
  }
  body[data-page="watch"] .watch-player-top-controls{
    top:6px!important;
    right:6px!important;
    left:6px!important;
    gap:5px!important;
    justify-content:space-between!important;
  }
  body[data-page="watch"] .watch-franchise-button,
  body[data-page="watch"] .watch-source-button{
    width:auto!important;
    max-width:47%!important;
    min-width:0!important;
    height:36px!important;
    padding:0 9px!important;
    overflow:hidden!important;
    border-radius:10px!important;
    background:#111117!important;
    font-size:11px!important;
  }
  body[data-page="watch"] .watch-franchise-button strong,
  body[data-page="watch"] .watch-source-button strong{
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }
  body[data-page="watch"] .watch-player-top-controls .watch-franchise-menu,
  body[data-page="watch"] .watch-player-top-controls .watch-source-menu{
    position:fixed!important;
    z-index:12500!important;
    top:66px!important;
    right:8px!important;
    bottom:max(8px,env(safe-area-inset-bottom))!important;
    left:8px!important;
    width:auto!important;
    min-width:0!important;
    max-width:none!important;
    max-height:none!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior:contain!important;
    touch-action:pan-y!important;
    -webkit-overflow-scrolling:touch;
    border-radius:16px!important;
    background:#101016!important;
  }
  body[data-page="watch"] .watch-controls{
    padding:42px 6px 6px!important;
  }
  body[data-page="watch"] .watch-controls-row{
    min-width:0!important;
    min-height:42px!important;
    padding:2px 3px!important;
    gap:2px!important;
    background:rgba(8,8,12,.94)!important;
  }
  body[data-page="watch"] .watch-control-button{
    width:36px!important;
    min-width:36px!important;
    height:36px!important;
    min-height:36px!important;
    padding:0 4px!important;
  }
  body[data-page="watch"] .watch-source-panel{
    width:100%!important;
    margin:12px 0 0!important;
    padding:12px!important;
    border-radius:17px!important;
    background:#111117!important;
  }
  body[data-page="watch"] .watch-source-panel .watch-options-card{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
    padding:10px 0 0!important;
  }
  body[data-page="watch"] .watch-episodes-section{
    margin:0!important;
    padding:24px 0 0!important;
  }
}

@media (max-width:390px){
  .navbar .icon-button{
    width:38px!important;
    min-width:38px!important;
    height:38px!important;
    min-height:38px!important;
  }
  .search-result,
  .search-user-result{
    grid-template-columns:40px minmax(0,1fr)!important;
  }
  .search-result>span:last-child,
  .search-user-result>a:last-child{
    grid-column:2!important;
    justify-self:start!important;
  }
  body[data-page="watch"] .watch-time,
  body[data-page="watch"] #pipButton{
    display:none!important;
  }
}
