﻿/* Final, isolated layout layer. */

/* Full-width home hero */
html body.is-home #continueWatch .hero-carousel__video-shell {
  display: block !important;
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
html body.is-home #continueWatch .hero-carousel__video-shell video {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  transform: none !important;
}
html body.is-home #continueCard.continue-card {
  width: 100vw !important;
  max-width: none !important;
  margin: 0 0 58px calc(50% - 50vw) !important;
  padding: 0 !important;
}
html body.is-home #continueWatch.hero-carousel.watch-progress {
  width: 100% !important;
  min-height: clamp(364px, 30.8vw, 420px) !important;
  height: clamp(364px, 30.8vw, 420px) !important;
  aspect-ratio: auto !important;
  padding: 20px clamp(24px, 4.5vw, 64px) !important;
  border-width: 0 0 1px !important;
  border-radius: 0 !important;
  background-image: var(--hero-bg, none) !important;
  background-color: transparent !important;
  background-position: center center !important;
  background-size: cover !important;
  background-repeat: no-repeat !important;
  box-shadow: none !important;
  filter: none !important;
}
html body.is-home #continueWatch.hero-carousel.watch-progress::before,
html body.is-home #continueWatch.hero-carousel.watch-progress::after {
  content: none !important;
  background: none !important;
  box-shadow: none !important;
}
html body.is-home main.site-shell #homePage:not([hidden]) #continueCard.continue-card {
  position: relative !important;
  left: 50% !important;
  width: 100vw !important;
  max-width: none !important;
  margin: 0 0 52px !important;
  transform: translateX(-50%) !important;
}
html body.is-home main.site-shell #homePage:not([hidden]) #continueWatch.hero-carousel.watch-progress {
  width: 100vw !important;
  min-height: clamp(364px, 30.8vw, 420px) !important;
  border-radius: 0 !important;
}
html body.is-home #continueCard.continue-card #continueWatch.hero-carousel.watch-progress {
  width: 100% !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
}

/* Keep the hero copy inside the shorter, centered banner. */
html body.is-home #continueWatch .hero-carousel__copy {
  align-self: center !important;
  min-width: 0;
}
html body.is-home #continueWatch.hero-carousel.watch-progress h3 {
  font-size: clamp(28px, 3vw, 40px) !important;
  line-height: 1.05 !important;
  margin: 0 0 10px !important;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
html body.is-home #continueWatch .hero-carousel__facts {
  margin: 0 0 8px !important;
}
html body.is-home #continueWatch .hero-carousel__description {
  font-size: 14px !important;
  line-height: 1.4 !important;
  margin: 0 !important;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
html body.is-home #continueWatch .hero-carousel__actions {
  margin-top: 12px !important;
}

/* Compact history cards directly below the home hero. */
body.is-home .home-section-title,
body.is-home #homeContinueTitle { display: flex !important; align-items: center; gap: 12px; }
body.is-home .home-heading-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  overflow: visible;
  stroke-width: 2;
  filter: none;
}
@media (max-width: 760px) {
  body.is-home .home-section-title { gap: 9px; }
  body.is-home .home-heading-icon { width: 29px; height: 29px; flex-basis: 29px; }
}
body:not(.is-home) #homeContinueSection { display: none !important; }
html body.is-home #homeContinueSection {
  width: calc(100% - 88px);
  max-width: 1512px;
  margin: -24px auto 30px;
}
#homeContinueSection .home-continue-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
#homeContinueSection .home-continue-heading h2 {
  margin: 0;
  color: #f4f4f5;
  font-size: 21px;
  line-height: 1.2;
  font-weight: 750;
}
#homeContinueSection .home-continue-heading a {
  color: #a4a6ad;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}
#homeContinueSection .home-continue-heading a:hover { color: var(--accent-default); }
#homeContinueGrid, #profileHistoryRailV33 {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 3px 2px 10px;
  scrollbar-width: none;
}
#homeContinueGrid::-webkit-scrollbar, #profileHistoryRailV33::-webkit-scrollbar { display: none; width: 0; height: 0; }
body.is-home .home-continue-all {
  flex: 0 0 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #a4a6ad;
  font-size: 12px;
  text-decoration: none;
}
body.is-home .home-continue-all-arrow {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid #ffffff24;
  border-radius: 50%;
  background: #ffffff08;
  color: #fff;
  font-size: 25px;
  transition: background .15s, border-color .15s;
}
body.is-home .home-continue-all:hover { color: #fff; }
body.is-home .home-continue-all:hover .home-continue-all-arrow { background: #ffffff14; border-color: #ffffff50; }
body.is-home .home-continue-all:focus-visible { outline: 2px solid #fff; outline-offset: -2px; border-radius: 8px; }
#homeContinueGrid .continue-history-card, #profileHistoryRailV33 .continue-history-card {
  position: relative;
  flex: 0 0 290px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #ffffff0c;
  border-radius: 8px;
  background: #000;
  cursor: pointer;
}
#homeContinueGrid .continue-history-card:hover, #profileHistoryRailV33 .continue-history-card:hover { border-color: #ffffff30; }
#homeContinueGrid .continue-history-cover, #profileHistoryRailV33 .continue-history-cover {
  position: relative;
  aspect-ratio: 3 / 1;
  overflow: hidden;
}
#homeContinueGrid .continue-history-cover img,
#homeContinueGrid .continue-history-cover .poster-fallback,
#profileHistoryRailV33 .continue-history-cover img,
#profileHistoryRailV33 .continue-history-cover .poster-fallback {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
#homeContinueGrid .continue-history-cover::before, #profileHistoryRailV33 .continue-history-cover::before {
  content: '';
  position: absolute;
  inset: 22% 0 0;
  z-index: 1;
  background: linear-gradient(transparent, #000b 54%, #000000fa);
  pointer-events: none;
}
#homeContinueGrid .continue-history-title, #profileHistoryRailV33 .continue-history-title {
  position: absolute;
  z-index: 2;
  left: 11px;
  right: 11px;
  bottom: 10px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.15;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#homeContinueGrid .continue-history-footer, #profileHistoryRailV33 .continue-history-footer {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px 11px 17px;
  color: #a0a0a5;
  font-size: 11px;
  line-height: 1.2;
}
#homeContinueGrid .continue-history-footer span, #profileHistoryRailV33 .continue-history-footer span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#homeContinueGrid .continue-history-time, #profileHistoryRailV33 .continue-history-time { font-variant-numeric: tabular-nums; }
#homeContinueGrid .continue-history-footer::after, #profileHistoryRailV33 .continue-history-footer::after {
  content: '';
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 7px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(to right, #fff var(--history-progress, 0%), #ffffff20 var(--history-progress, 0%));
}
#homeContinueGrid .history-remove, #profileHistoryRailV33 .history-remove {
  position: absolute;
  z-index: 3;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: 1px solid #ffffff26;
  border-radius: 50%;
  background: #08090bd9;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
}
#homeContinueGrid .continue-history-card:hover .history-remove,
#homeContinueGrid .continue-history-card:focus-within .history-remove,
#profileHistoryRailV33 .continue-history-card:hover .history-remove,
#profileHistoryRailV33 .continue-history-card:focus-within .history-remove { opacity: 1; }
#homeContinueGrid .history-remove:hover,
#homeContinueGrid .history-remove:focus-visible,
#profileHistoryRailV33 .history-remove:hover,
#profileHistoryRailV33 .history-remove:focus-visible { color: #fff; border-color: #ffffff26; background: rgba(207, 55, 55, .94); outline: none; }
#homeContinueGrid .home-continue-empty, #profileHistoryRailV33 .home-continue-empty { margin: 0; padding: 14px 0; color: #898b94; font-size: 13px; }
#homeContinueGrid:focus-visible,
#homeContinueGrid .continue-history-card:focus-visible,
#homeContinueSection a:focus-visible,
#profileHistoryRailV33:focus-visible,
#profileHistoryRailV33 .continue-history-card:focus-visible { outline: 2px solid var(--accent-default); outline-offset: 2px; }
body.is-home .poster-grid.is-rmb-dragging,
body.is-home #homeContinueGrid.is-rmb-dragging,
body.is-library #profileHistoryRailV33.is-rmb-dragging {
  cursor: grabbing !important;
  user-select: none;
  scroll-behavior: auto !important;
  scroll-snap-type: none !important;
}
body.is-home .is-rmb-dragging * { cursor: grabbing !important; user-select: none; }
body.is-home .home-page > .poster-section .poster-grid,
body.is-home #homeContinueGrid,
body.is-library #profileHistoryRailV33 { user-select: none; -webkit-user-select: none; }
body.is-home .home-page > .poster-section img,
body.is-home #homeContinueGrid img,
body.is-library #profileHistoryRailV33 img { -webkit-user-drag: none; user-select: none; pointer-events: none; }

body:not(.is-home) .home-telegram { display: none !important; }
html body.is-home .home-telegram {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  box-sizing: border-box;
  width: calc(100% - 88px);
  max-width: 1512px;
  margin: 28px auto 40px;
  padding: clamp(28px, 4vw, 56px);
  border-radius: 24px;
  background: linear-gradient(110deg, #32b0e7, #229ed6);
  color: white;
}
.home-telegram h2 { margin: 0 0 14px; font-size: clamp(25px, 3vw, 42px); line-height: 1.12; font-weight: 850; letter-spacing: -.035em; }
.home-telegram p { margin: 0; max-width: 670px; font-size: clamp(15px, 1.4vw, 19px); line-height: 1.5; color: #effaff; }
.home-telegram-tags { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.home-telegram-tags span { border-radius: 24px; background: #ffffff20; padding: 7px 13px; font-size: 13px; }
.home-telegram > a { display: inline-flex; align-items: center; justify-content: center; gap: 10px; flex-shrink: 0; padding: 18px 26px; border-radius: 40px; background: white; color: #178ac0; font-size: 17px; font-weight: 750; text-decoration: none; transition: background .15s; }
.home-telegram > a:hover { background: #e9f8ff; }
.home-telegram > a:focus-visible { outline: 3px solid #fff; outline-offset: 5px; }
.home-telegram > a svg { width: 22px; height: 22px; fill: currentColor; }
@media (max-width: 800px) {
  html body.is-home .home-telegram { width: calc(100% - 28px); flex-direction: column; align-items: flex-start; gap: 24px; border-radius: 18px; }
  .home-telegram > a { padding: 14px 22px; font-size: 15px; }
}
@media (max-width: 760px) {
  html body.is-home #homeContinueSection { width: calc(100% - 28px); margin: -20px auto 24px; }
  #homeContinueSection .home-continue-heading h2 { font-size: 18px; }
  #homeContinueGrid .continue-history-card, #profileHistoryRailV33 .continue-history-card { flex-basis: min(270px, 78vw); }
}
@media (hover: none) { #homeContinueGrid .history-remove, #profileHistoryRailV33 .history-remove { opacity: 1; } }

/* AniLand-like search */
#searchModal { align-items: flex-start !important; padding-top: clamp(80px, 12vh, 140px) !important; }
#searchModal .search-modal__panel {
  width: min(960px, calc(100vw - 32px)) !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 16px !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
}
#searchModal .search-modal__head { display: none !important; }
#searchModal .search-modal__form {
  width: 100% !important;
  max-width: none !important;
  height: 82px !important;
  padding: 0 28px !important;
  border: 1px solid rgba(255,255,255,.08) !important;
  border-radius: 16px !important;
  background: #131419 !important;
  box-shadow: 0 18px 60px rgba(0,0,0,.38) !important;
}
#searchModal .search-modal__form input { font-size: 18px !important; }
.search-kind-tabs {
  display: grid !important;
  grid-template-columns: repeat(3,1fr) !important;
  gap: 8px !important;
  margin-top: 14px !important;
  padding: 8px !important;
  border-radius: 14px !important;
  background: #111217 !important;
}
.search-kind-tabs button {
  height: 48px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: transparent !important;
  color: rgba(255,255,255,.56) !important;
  font-size: 15px !important;
  font-weight: 800 !important;
}
.search-kind-tabs button.is-active { background: #292a30 !important; color: #fff !important; }
.search-results-count {
  margin: 16px 0 0 !important;
  padding: 18px 22px 8px !important;
  border-radius: 14px 14px 0 0 !important;
  background: #111217 !important;
  color: rgba(255,255,255,.46) !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
  letter-spacing: .7px !important;
}
#searchModalResults.modal-results {
  display: block !important;
  width: 100% !important;
  max-height: min(460px, 52vh) !important;
  margin: 0 !important;
  padding: 8px 22px 22px !important;
  border-radius: 0 0 14px 14px !important;
  overflow-y: auto !important;
  background: #111217 !important;
}
#searchModalResults .search-result-card,
#searchModalResults .user-search-card {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: center !important;
  width: 100% !important;
  height: 118px !important;
  min-height: 118px !important;
  max-height: 118px !important;
  margin: 0 !important;
  padding: 14px 18px 14px 108px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: transparent !important;
}
#searchModalResults .search-result-card + .search-result-card,
#searchModalResults .user-search-card + .user-search-card { margin-top: 8px !important; }
#searchModalResults .search-result-card:hover,
#searchModalResults .user-search-card:hover { background: rgba(255,255,255,.055) !important; }
#searchModalResults .search-result-card::after { display: none !important; }
body #searchModalResults .search-result-card img,
#searchModalResults .user-search-card img {
  position: absolute !important;
  top: 9px !important;
  left: 0 !important;
  right: auto !important;
  bottom: auto !important;
  width: 86px !important;
  height: 100px !important;
  border-radius: 9px !important;
  object-fit: cover !important;
  opacity: 1 !important;
}
#searchModalResults .search-result-title { align-self: end !important; font-size: 17px !important; text-shadow: none !important; }
#searchModalResults .search-result-title {
  position: static !important;
  align-self: auto !important;
  width: auto !important;
  margin: 0 !important;
  color: #fff !important;
  line-height: 1.25 !important;
  text-align: left !important;
}
#searchModalResults .search-result-meta {
  position: static !important;
  justify-self: start !important;
  margin-top: 8px !important;
  padding: 5px 9px !important;
  border-radius: 7px !important;
  background: #24252b !important;
  color: rgba(255,255,255,.7) !important;
  font-size: 12px !important;
}

/* Stop skeleton animation as soon as an image element is mounted. */
.poster-card:has(img)::before,
.mini-card:has(img)::before,
.favorite-card__cover:has(img)::before,
.continue-history-cover:has(img)::before,
.search-result-card:has(img)::before,
.anime-poster:has(img)::before,
.detail-extra-card:has(img)::before { display: none !important; animation: none !important; }

/* Clean description layout */
#profileVotes,
#detailExtra { display: none !important; }

/* AnimeLib-like watch layout */

/* Hard reset for legacy watch rules with higher specificity. */

/* Character cards always remain one horizontal, scrollable rail. */
