/* App shell: top bar, home, category, search, legal, cards, footer. */

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 15% -5%, rgba(124, 92, 255, .18), transparent 28%),
    var(--bg);
}

/* ---------------------------------------------------------------- topbar */

.topbar {
  flex: 0 0 auto;
  height: 64px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 11, 14, .88);
  backdrop-filter: blur(16px);
  z-index: 40;
}
.topbar.hidden { display: none; }

.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.logo {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #ff9d55 55%, var(--accent2));
  box-shadow: 0 6px 22px rgba(255, 63, 108, .3);
  flex: 0 0 auto;
}
.brandCopy { display: flex; flex-direction: column; line-height: 1.05; }
.brandName { font-weight: 900; white-space: nowrap; }
.brandSlogan { margin-top: 4px; font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }

.topNav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.topNav::-webkit-scrollbar { display: none; }

.navBtn {
  border: 0;
  background: transparent;
  color: #c8c8d2;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 800;
  transition: background .15s, color .15s;
}
.navBtn:hover, .navBtn.active { background: var(--panel2); color: #fff; }

.toolbar { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.searchBox { display: flex; align-items: center; }
.searchInput {
  width: 190px;
  height: 38px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 0 15px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, width .2s;
}
.searchInput:focus { border-color: rgba(255, 255, 255, .35); width: 230px; }
.searchInput::placeholder { color: #77777f; }

.pill {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
  transition: background .15s;
}
.pill:hover { background: var(--panel2); }

.mobileCategoryBtn { display: none; }
.mobileCategoryMenu { display: none; }

/* ---------------------------------------------------------------- main */

.main { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.view { padding-bottom: 40px; }

.page { padding: 20px 18px 0; }

.backRow { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.backRow h1 { font-size: 28px; }

/* ---------------------------------------------------------------- hero */

.hero {
  position: relative;
  overflow: hidden;
  min-height: 290px;
  border-radius: 26px;
  padding: 28px;
  display: flex;
  align-items: flex-end;
  margin-bottom: 8px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .78), rgba(0, 0, 0, .15)),
    linear-gradient(135deg, #451124, #1d1935 58%, #0a3040);
}
.hero::after {
  content: "";
  position: absolute;
  right: 7%; top: 12%;
  width: 38%; height: 86%;
  border-radius: 26px;
  background: linear-gradient(145deg, #ff708f, #8b62ff);
  transform: rotate(5deg);
  opacity: .78;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}
.heroText { position: relative; z-index: 2; max-width: 540px; }
.hero h1 { font-size: 42px; margin: 12px 0 8px; }
.hero p { color: #d8d8df; max-width: 520px; margin: 0 0 4px; line-height: 1.5; }
.hero .tag {
  display: inline-flex;
  background: rgba(255, 255, 255, .14);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.cta {
  margin-top: 16px;
  border: 0;
  border-radius: 14px;
  padding: 13px 22px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s;
}
.cta:hover { background: #ff5c83; }

/* ---------------------------------------------------------------- rows */

.section { margin-top: 30px; }
.sectionHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.sectionHead h2 { font-size: 20px; }

.grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}
/* Home rows show a single line; the rest is behind "View More". */
.grid.singleRow .card:nth-child(n+7) { display: none; }

/* ---------------------------------------------------------------- page layout */

/**
 * Two-column page: content + ranked sidebar.
 *
 * ⚠️ Do not add transform / filter / backdrop-filter / will-change /
 * contain:paint to .pageLayout or any ancestor. The mobile player is a
 * position:fixed layer inside .main and relies on nothing in its ancestor chain
 * creating a containing block — any of those properties would drop it into the
 * page flow and break the gesture surface.
 */
.pageLayout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: start;
}

.siteSidebar { display: grid; gap: 18px; align-content: start; }

.sideList {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.sideListHead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sideListHead h3 { font-size: 15px; }
.sideListBody { display: grid; gap: 4px; }

.miniRow {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px;
  border-radius: 10px;
  transition: background .15s;
}
.miniRow:hover { background: var(--panel2); }
.miniThumb {
  width: 44px;
  aspect-ratio: 2 / 3;
  border-radius: 7px;
  overflow: hidden;
  flex: 0 0 auto;
  background: #22222a;
}
.miniThumb img { width: 100%; height: 100%; object-fit: cover; }
.miniThumbArt {
  display: block;
  width: 100%; height: 100%;
  background: linear-gradient(150deg, #5a1830, #19192d 55%, #0e6670);
}
.miniThumbArt.alt1 { background: linear-gradient(150deg, #2e4d89, #151827 56%, #612f6e); }
.miniThumbArt.alt2 { background: linear-gradient(150deg, #243e22, #121b16 56%, #745429); }
.miniThumbArt.alt3 { background: linear-gradient(150deg, #6a3421, #211512 56%, #5d163d); }
.miniThumbArt.alt4 { background: linear-gradient(150deg, #3f225f, #151422 56%, #184c63); }

.miniText { min-width: 0; display: grid; gap: 4px; }
.miniText b {
  font-size: 13px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.miniText small { display: flex; gap: 10px; color: var(--muted); font-size: 11px; }
.miniRating { color: #f5b942; }

/* ---------------------------------------------------------------- chips */

/* .chipBar（首页的分类筛选条）已随首页改版移除；.chipBtn 还在「观看历史」
   的「清空」按钮上用，所以留着。 */
.chipBtn {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--panel);
  color: #cfcfd8;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.chipBtn:hover { background: var(--panel2); color: #fff; }
.chipBtn.active { background: var(--accent); border-color: transparent; color: #fff; }

/* ---------------------------------------------------------------- hero carousel */

.heroCarousel { position: relative; margin-bottom: 8px; }
/**
 * Draggable by mouse (see heroCarousel in home.js). Touch is left to the
 * browser's own scrolling, so `touch-action` is deliberately untouched —
 * setting it would disable the native momentum a phone gives for free.
 */
.heroSlides {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  cursor: grab;
}
.heroSlides::-webkit-scrollbar { display: none; }
/* While dragging, the cursor should read as "holding", and a stray text
   selection would fight the drag for the pointer. */
.heroSlides.dragging { cursor: grabbing; user-select: none; }

.heroCard {
  flex: 0 0 auto;
  width: clamp(160px, 22vw, 230px);
  scroll-snap-align: start;
}
.heroCard .cover { border-radius: 16px; }
.heroCard .cardTitle { font-size: 14px; margin-top: 9px; }
/* Posters are draggable images by default, which hijacks the pointer sequence
   mid-swipe and leaves the row stuck. */
.heroSlides img { -webkit-user-drag: none; }

/* ---------------------------------------------------------------- card */

/* The card is now just the poster plus a caption — no panel background, so a row
   of them reads as artwork rather than a grid of boxes. */
.card {
  display: block;
  cursor: pointer;
  transition: transform .18s;
}
.card:hover { transform: translateY(-4px); }
.card:active { transform: translateY(-1px); }

.cover {
  position: relative;
  aspect-ratio: 2 / 3;
  padding: 12px;
  display: flex;
  align-items: flex-end;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .06);
  background: linear-gradient(150deg, #5a1830, #19192d 55%, #0e6670);
}
.card:hover .cover { box-shadow: 0 0 0 1px rgba(255, 255, 255, .22); }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover.alt1 { background: linear-gradient(150deg, #2e4d89, #151827 56%, #612f6e); }
.cover.alt2 { background: linear-gradient(150deg, #243e22, #121b16 56%, #745429); }
.cover.alt3 { background: linear-gradient(150deg, #6a3421, #211512 56%, #5d163d); }
.cover.alt4 { background: linear-gradient(150deg, #3f225f, #151422 56%, #184c63); }

.cover .posterTitle {
  position: relative;
  font-weight: 800;
  font-size: 17px;
  text-shadow: 0 3px 10px #000;
  line-height: 1.2;
  z-index: 1;
}
.badge {
  position: absolute;
  top: 10px; left: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
  background: rgba(0, 0, 0, .62);
  border-radius: 999px;
  z-index: 2;
}
.lockBadge {
  position: absolute;
  top: 10px; right: 10px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .62);
  display: grid;
  place-items: center;
  font-size: 13px;
  z-index: 2;
}

/* Card body: title and metadata sit *below* the poster, matching the reference
   layout, rather than being overlaid on the artwork. */
.meta { padding: 10px 2px 12px; }
.cardTitle {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.32;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.64em;
}
.cardSub { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* Badge stack in the poster's bottom-right, like the reference's rating chip. */
.cardMarks {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  display: flex;
  gap: 5px;
  align-items: center;
}
.ratingBadge {
  background: rgba(0, 0, 0, .66);
  color: #ffd166;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

/* ---------------------------------------------------------------- pager */

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 32px 0 10px;
}
.pager button {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  font-weight: 700;
}
.pager button:disabled { opacity: .35; cursor: default; }
.pager span { color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- legal */

.legalDoc {
  background: #121217;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px;
  line-height: 1.8;
  color: #d8d8df;
  max-width: 900px;
}
.legalDoc h2 { font-size: 19px; color: #fff; margin: 28px 0 8px; }
.legalDoc h2:first-child { margin-top: 0; }
.legalDoc p, .legalDoc li { color: #b8b8c2; }
.legalDoc ul { padding-left: 22px; }
.legalMeta { color: #85858f; font-size: 13px; margin-bottom: 22px; }

/* ---------------------------------------------------------------- series detail */

.seriesHero {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
  margin-bottom: 8px;
}
.seriesPoster { position: relative; }
/* Same element, not a descendant: the poster is the `.cover`, it does not
   contain one. Written as a descendant selector this never matched anything. */
.cover.seriesPoster { border-radius: 16px; }
.playOverlay {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 62px; height: 62px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  padding-left: 4px;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 30px rgba(255, 63, 108, .45);
  transition: transform .15s;
}
.playOverlay:hover { transform: translate(-50%, -50%) scale(1.08); }

.seriesMeta h1 { font-size: clamp(22px, 3vw, 32px); line-height: 1.2; margin-bottom: 14px; }
.seriesSynopsis {
  color: #b8b8c2;
  font-size: 14px;
  line-height: 1.75;
  margin: 0 0 18px;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.infoTable {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 18px;
}
.infoRow { display: grid; grid-template-columns: 120px 1fr; border-bottom: 1px solid var(--line); }
.infoRow:last-child { border-bottom: 0; }
.infoKey { padding: 11px 14px; background: rgba(255, 255, 255, .03); color: var(--muted); font-size: 13px; font-weight: 700; }
.infoVal { padding: 11px 14px; font-size: 13px; font-weight: 700; }

.seriesTags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.seriesTags .chip { display: inline-block; padding: 6px 12px; }

.episodesSection { margin-top: 30px; }
.episodesSection > h2 { font-size: 20px; margin-bottom: 16px; }

.episodeGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.episodeCard {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  transition: border-color .15s, background .15s;
}
.episodeCard:hover { border-color: rgba(255, 255, 255, .26); background: var(--panel2); }
.epNum { font-size: 13px; font-weight: 800; }
.epMeta { margin-left: auto; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.epGo { color: var(--muted); font-size: 16px; }
.episodeCard.locked .epNum { color: #b9b9c4; }

/* ---------------------------------------------------------------- history */

.historyList { display: grid; gap: 12px; }
.historyRow {
  display: flex;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  align-items: center;
}
.historyThumb {
  width: 62px;
  aspect-ratio: 2 / 3;
  border-radius: 9px;
  overflow: hidden;
  flex: 0 0 auto;
  background: linear-gradient(150deg, #5a1830, #19192d 55%, #0e6670);
}
.historyThumb img { width: 100%; height: 100%; object-fit: cover; }
.historyBody { min-width: 0; flex: 1 1 auto; }
.historyBody b { display: block; font-size: 14px; margin-bottom: 5px; }
.historySub { color: var(--muted); font-size: 12px; margin-bottom: 9px; }
.historyBar { height: 4px; background: rgba(255, 255, 255, .13); border-radius: 999px; overflow: hidden; }
.historyBar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.historyActions { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }

@media (max-width: 1100px) {
  .episodeGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------------- tabbar */

.tabbar { display: none; }

/* ---------------------------------------------------------------- footer */

.siteFooter {
  margin-top: 48px;
  padding: 30px 16px calc(10px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}
.footerLinks { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; }
.footerLinks a { color: #d5d5dc; }
.footerLinks a:hover { text-decoration: underline; }
.footerDisclaimer { max-width: 900px; margin: 0 auto 12px; }
.copyright { color: #777; }

/* ---------------------------------------------------------------- search */

.searchHead { margin-bottom: 18px; }
.searchHead h1 { font-size: 26px; margin-bottom: 6px; }
.searchHead p { color: var(--muted); font-size: 14px; margin: 0; }

/* ---------------------------------------------------------------- genre index */

/* The full genre list, as a wrapping grid rather than the chip bar's single
   scrolling line: on a phone this is the page you land on to see everything,
   and a horizontally-scrolling index defeats the purpose. */
.genreIndex {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 30px;
}
.genreTile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: #e9e9ef;
  transition: border-color .15s, background .15s;
}
.genreTile:hover { border-color: var(--accent); background: var(--panel2); }
.genreTileName { font-size: 15px; font-weight: 700; }
.genreTileCount { font-size: 12px; color: var(--muted); }

@media (max-width: 560px) {
  .genreIndex { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .genreTile { padding: 13px 14px; }
}
