:root {
  color-scheme: dark;
  --bg: #141216;
  --surface: #1c191e;
  --raised: #262228;
  --line: #3a333c;
  --text: #fff5fb;
  --muted: #9b9098;
  --accent: #ff3ec8;
  --accent-ink: #2a061c;
  --pink-dim: #ff3ec833;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  max-width: 100%;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
button, input, select { font: inherit; color: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { border: 0; background: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:disabled { opacity: .45; cursor: wait; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
use { pointer-events: none; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.offscreen {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
[hidden] { display: none !important; }
img, video { max-width: 100%; }

.mast {
  position: sticky;
  top: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 320px) auto;
  grid-template-areas: "brand note search lang" "dock dock dock dock";
  gap: 8px 16px;
  align-items: center;
  min-width: 0;
  padding: 14px 22px 8px;
  background: #161318f2;
  border-bottom: 1px solid var(--line);
}
.brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -.6px;
  white-space: nowrap;
}
.brand-icon { width: 28px; height: 28px; border-radius: 8px; display: block; box-shadow: 0 0 16px #ff3ec888; }
.brand-name span { color: var(--accent); font-weight: 500; }
#page-subtitle:empty, #feature-description:empty { display: none; }
.mast-note {
  grid-area: note;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  color: var(--accent);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dock {
  grid-area: dock;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}
#discover-nav, #library-nav { display: flex; gap: 4px; min-width: 0; }
#library-nav { padding-inline-start: 8px; border-inline-start: 1px solid var(--line); }
.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 8px;
  color: #ff8adf;
  font-size: 13px;
}
.nav-item svg { display: none; }
.nav-item:hover { background: var(--raised); color: var(--text); }
.nav-item.active {
  color: #ffe6f7;
  background: linear-gradient(100deg, #ff3ec833, #ff3ec80d);
  font-weight: 650;
}
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count {
  min-width: 18px;
  padding: 0 4px;
  border-radius: 4px;
  background: #ffffff10;
  color: #b9a8b4;
  font-size: 11px;
  text-align: center;
}
.nav-item.active .nav-count { color: var(--accent); background: #ff3ec822; }
.search {
  grid-area: search;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 4px 0 12px;
  border: 1px solid #4a3d48;
  border-radius: 8px;
  background: #221e24;
  color: var(--accent);
}
.search input {
  flex: 1;
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  color: var(--text);
  font-size: 13px;
}
.search input::placeholder { color: #ff8adf; }
.search:focus-within { border-color: var(--accent); }
.search-submit { display: grid; place-items: center; padding: 8px; color: var(--accent); }
.header-actions { grid-area: lang; min-width: 0; }
.language-control { display: flex; align-items: center; gap: 6px; color: var(--accent); }
.language-control select {
  max-width: 92px;
  border: 0;
  background: transparent;
  color: #ffd0f2;
  cursor: pointer;
}
.language-control option { background: var(--raised); color: var(--text); }

main { max-width: 1280px; margin: 0 auto; padding: 22px 22px 40px; min-width: 0; }
.breadcrumb { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; color: #7d747a; font-size: 12px; }
.breadcrumb > span:last-child { color: var(--accent); }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; min-width: 0; }
.eyebrow { color: var(--accent); font-size: 12px; }
.page-heading h1 { margin: 4px 0 6px; font-size: 28px; font-weight: 700; letter-spacing: -.4px; line-height: 1.25; overflow-wrap: anywhere; }
.page-heading p { margin: 0; max-width: 46em; color: var(--muted); font-size: 13px; }
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  box-shadow: 0 0 18px #ff3ec866;
}
.primary:hover { background: #ff73da; }
.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid #564854;
  border-radius: 8px;
  background: #2a252b;
  color: #ffd0f0;
}
.secondary:hover { background: #352f36; }
.text-button { color: var(--accent); padding: 8px 0; }

.feature-banner {
  position: relative;
  min-width: 0;
  max-width: 100%;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid #ff3ec855;
  border-radius: 16px;
  background: radial-gradient(ellipse at 80% 0, #ff3ec844, transparent 55%), linear-gradient(120deg, #2a1524, #1a1218);
}
.feature-copy { padding: 28px 28px 24px; max-width: 640px; }
.feature-label { display: flex; align-items: center; gap: 8px; color: #ffb3ea; font-size: 12px; }
.feature-label > span:first-child { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.feature-copy h2 { margin: 12px 0 8px; font-size: 32px; font-weight: 750; line-height: 1.25; }
.feature-copy p { margin: 0 0 16px; color: #ffc4ee; }
.feature-art { display: none; }
.feature-banner.has-featured { border-color: #ff3ec877; }
.has-featured > .feature-copy { display: none; }
.featured-carousel {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: clamp(420px, 48vw, 620px);
  overflow: hidden;
  border-radius: inherit;
  background: #100c10;
}
.featured-cover, .featured-cover img, .featured-cover .featured-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.featured-cover { background: #100c10; }
.featured-cover-shade { display: none; }
.featured-content { position: absolute; z-index: 2; left: 32px; right: 32px; bottom: 78px; max-width: min(720px, calc(100% - 64px)); }
.featured-kicker { display: flex; gap: 10px; align-items: center; color: #ffd0f2; font-size: 13px; }
.featured-rank {
  padding: 3px 8px;
  border: 1px solid #ff3ec866;
  border-radius: 999px;
  background: #ff3ec822;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.featured-title { margin: 10px 0 8px; font-size: 40px; font-weight: 750; line-height: 1.2; }
.featured-title button {
  padding: 0;
  text-align: start;
  font: inherit;
  color: #fff;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.featured-metadata { display: flex; flex-wrap: wrap; gap: 14px; color: #ffd7f4; font-size: 14px; }
.featured-metadata span { display: inline-flex; align-items: center; gap: 6px; }
.featured-metadata svg { width: 16px; height: 16px; color: var(--accent); }
.featured-author { display: none; }
.featured-watch { margin-top: 16px; padding: 12px 20px; font-size: 15px; box-shadow: none; }
.featured-watch svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.featured-controls {
  position: absolute;
  z-index: 2;
  left: 24px;
  right: 24px;
  bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.featured-dots { display: flex; gap: 6px; min-width: 0; }
.featured-dots button { width: 22px; height: 18px; padding: 0; position: relative; flex: 0 0 auto; }
.featured-dots button:before { content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 3px; border-radius: 3px; background: #ffffff44; }
.featured-dots button.active { width: 36px; }
.featured-dots button.active:before { background: var(--accent); }
.featured-arrows { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.featured-arrows button {
  width: 32px;
  height: 32px;
  border: 1px solid #ff3ec855;
  border-radius: 8px;
  background: #1a1018cc;
  color: #ffe6f8;
}
.featured-position { color: #ffe6f8; font-variant-numeric: tabular-nums; font-size: 13px; white-space: nowrap; }
.featured-position span { color: #ff8adf; }

.collection-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 22px; }
.collection-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(110deg, #262028, #1c191e);
  text-align: start;
}
.collection-tile:hover { border-color: #ff3ec866; }
.collection-tile .tile-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #ff3ec818;
  color: var(--accent);
}
.tile-text { min-width: 0; flex: 1; }
.tile-text strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.tile-text small { display: block; overflow: hidden; color: #847b82; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.tile-number { color: #ffd0f2; font-size: 20px; }

.catalog { scroll-margin-top: 96px; min-width: 0; }
.catalog-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.catalog-top h2 { margin: 0; font-size: 18px; font-weight: 700; }
.result-count { color: var(--accent); font-size: 12px; white-space: nowrap; }
.category-row { display: flex; gap: 8px; overflow: hidden; }
.filters { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0 16px; color: var(--muted); font-size: 12px; min-width: 0; }
.filter-selects { display: flex; gap: 8px; min-width: 0; }
select {
  max-width: 100%;
  padding: 7px 8px;
  border: 1px solid #4a3d48;
  border-radius: 6px;
  background: #221e24;
  color: #ffd0f2;
}
.video-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px 16px; }
.video-card, .related-card, .card-open { min-width: 0; max-width: 100%; }
.card-open { display: block; width: 100%; padding: 0; text-align: start; }
.thumbnail {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid #4a3d48;
  border-radius: 10px;
  background: radial-gradient(ellipse at 90% 0, #ff3ec822, transparent 68%), linear-gradient(135deg, #2a242b, #1c191e);
}
.thumbnail img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumbnail-play {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid #ff3ec855;
  border-radius: 50%;
  background: #ff3ec814;
  color: var(--accent);
  opacity: 0;
}
.card-open:hover .thumbnail { border-color: var(--accent); transform: translateY(-2px); }
.card-open:hover .thumbnail-play, .thumbnail.image-failed .thumbnail-play, .thumbnail:not(.has-image) .thumbnail-play { opacity: 1; }
.thumb-duration {
  position: absolute;
  z-index: 1;
  right: 8px;
  bottom: 8px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #120910dd;
  color: #ffe6f8;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.card-title { margin: 10px 0 4px; font-size: 14px; font-weight: 600; }
.real-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; line-height: 1.45; min-height: 2.9em; }
.card-meta, .card-published { color: #847b82; font-size: 12px; }
.card-meta { display: flex; justify-content: space-between; gap: 8px; }
.card-meta > span:first-child, .card-meta > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-footer { display: flex; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px solid #322c33; }
.icon-button { width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 6px; color: var(--accent); }
.icon-button:hover, .icon-button.selected { background: #ff3ec818; color: #ffd0f2; }
.unavailable .card-open { opacity: .5; }
.empty-state { margin: 8px 0 20px; padding: 48px 16px; border: 1px dashed #4a3d48; border-radius: 12px; text-align: center; }
.empty-state .empty-art { margin-bottom: 8px; color: var(--accent); }
.empty-state h3 { margin: 0 0 8px; font-size: 20px; }
.empty-state p { margin: 0 auto 16px; max-width: 36em; color: #ffb3ea; }
.catalog-pagination { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; max-width: 100%; margin: 28px 0 8px; }
.catalog-pagination button { min-width: 32px; height: 32px; border: 1px solid #4a3d48; border-radius: 6px; color: #ffd0f2; }
.catalog-pagination button.active { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.catalog-pagination button:disabled { cursor: default; }
.catalog-pagination small { flex-basis: 100%; color: #ff8adf; text-align: center; }

.directory-toolbar { display: flex; justify-content: space-between; gap: 12px; min-width: 0; margin-bottom: 16px; }
.directory-tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid #4a3d48; border-radius: 8px; background: #1c191e; }
.directory-tabs button { padding: 6px 14px; border-radius: 6px; color: #ff8adf; }
.directory-tabs button.active { background: #3a2434; color: #ffe6f8; }
#directory-search { display: flex; width: min(320px, 100%); min-width: 0; height: 36px; border: 1px solid #4a3d48; border-radius: 8px; background: #1c191e; }
#directory-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); padding: 8px; }
.category-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.category-card { display: grid; gap: 6px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(125deg, #2a242b, #1c191e); text-align: start; }
.category-card strong { overflow-wrap: anywhere; font-size: 15px; }
.category-card small { color: var(--accent); }

footer { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 28px; padding-top: 16px; border-top: 1px solid #322c33; color: #7d747a; font-size: 12px; }
footer > span:nth-child(2) { margin-inline: auto; }
#footer-caption:empty { display: none; }
footer button { margin-inline-start: auto; color: var(--accent); }

body.watching main > :not(.watch-view):not(footer) { display: none; }
.watch-toolbar { margin-bottom: 12px; }
.watch-back svg { transform: scaleX(-1); }
html[dir=rtl] .watch-back svg { transform: none; }
.video-panel { overflow: hidden; border: 1px solid #4a3d48; border-radius: 16px; background: #1c191e; }
.player-stage { position: relative; background: #100c10; }
.player-stage video { display: block; width: 100%; max-width: 100%; aspect-ratio: 16/9; max-height: 72dvh; background: #000; object-fit: contain; }
.player-empty { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; background: #100c10; }
.player-orbit { width: 58px; height: 58px; display: grid; place-items: center; margin-bottom: 12px; border: 1px solid #ff3ec855; border-radius: 50%; background: #ff3ec814; color: var(--accent); }
.player-empty h2 { margin: 0 0 8px; font-size: 18px; }
.player-empty p { margin: 0; max-width: 36em; color: #ffb3ea; }
.player-empty .primary { margin-top: 16px; }
.video-detail-body { padding: 16px 18px 18px; }
.detail-title-row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.detail-title-row h2 { margin: 0 0 12px; font-size: 22px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.detail-badge { flex-shrink: 0; padding: 4px 8px; border: 1px solid #ff3ec855; border-radius: 4px; color: var(--accent); font-size: 12px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-actions .selected { border-color: var(--accent); background: #ff3ec818; color: #ffe6f8; }
.quality-control { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--accent); font-size: 12px; }
.detail-labels { margin-top: 16px; }
.detail-labels > div { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.detail-labels button { padding: 4px 8px; border: 1px solid #564854; border-radius: 4px; background: #2a252b; color: #ffd0f2; }
#related-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid #3a333c; }
#related-heading { margin: 0 0 12px; font-size: 15px; font-weight: 700; }
.related-videos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.related-card { padding: 0; text-align: start; }
.related-card > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin-top: 8px; color: #ffd0f2; }

.dialog {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100dvh - 40px);
  padding: 28px;
  overflow: auto;
  border: 1px solid #ff3ec844;
  border-radius: 16px;
  background: #221e24;
  color: var(--text);
}
.dialog::backdrop { background: #0c090ccc; }
.dialog h2 { margin: 0 0 8px; font-size: 22px; }
.confirm-dialog p { color: #ffb3ea; }
.confirm-dialog { text-align: center; }
.confirm-icon { margin-bottom: 8px; color: var(--accent); }
.confirm-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 20;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border: 1px solid #ff3ec855;
  border-radius: 10px;
  background: #2a2228;
  color: #ffe6f8;
  transform: translateX(-50%);
}

@media (max-width: 1100px) {
  .video-grid, .related-videos { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mast-note { display: none; }
  .featured-carousel { height: clamp(380px, 56vw, 520px); }
  .featured-title { font-size: 32px; }
}
@media (max-width: 760px) {
  .mast {
    position: relative;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand lang" "search search";
    gap: 10px;
    padding: 12px 14px 10px;
  }
  .dock {
    position: fixed;
    z-index: 7;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    gap: 0;
    width: auto;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    overflow: hidden;
    border-top: 1px solid #4a3d48;
    background: #1a161ae6;
  }
  #discover-nav { flex: 1 1 0; border: 0; padding: 0; }
  #library-nav { flex: 3 1 0; border: 0; padding: 0; }
  .nav-item {
    flex: 1 1 0;
    flex-direction: column;
    gap: 2px;
    justify-content: center;
    padding: 6px 2px;
    border-radius: 8px;
    font-size: 10px;
  }
  .nav-item svg { display: block; width: 18px; height: 18px; }
  .nav-item.active { color: var(--accent); background: #ff3ec818; }
  .nav-label { max-width: 100%; font-size: 10px; }
  .nav-count { display: none; }
  main { padding: 14px 14px 84px; }
  body.feature-first .breadcrumb,
  body.feature-first .page-heading { display: none; }
  body.feature-first main { padding-top: 8px; }
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 24px; }
  .feature-banner { border-radius: 14px; }
  .featured-carousel { height: min(68vh, 520px); min-height: 360px; }
  .featured-content { left: 16px; right: 16px; bottom: 64px; max-width: none; }
  .featured-title { font-size: 26px; }
  .featured-controls { left: 12px; right: 12px; bottom: 12px; }
  .featured-watch { padding: 10px 14px; font-size: 14px; }
  .collection-strip { gap: 8px; }
  .collection-tile { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 8px; }
  .tile-text small { display: none; }
  .tile-number { position: absolute; top: 8px; inset-inline-end: 8px; font-size: 16px; }
  .collection-tile { position: relative; }
  .video-grid, .related-videos, .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
  .filters { flex-wrap: wrap; }
  .filter-selects { width: 100%; }
  .filter-selects select { flex: 1; min-width: 0; }
  .directory-toolbar { flex-direction: column; align-items: stretch; }
  #directory-search { width: 100%; }
  .detail-title-row { flex-direction: column; }
  .quality-control { justify-content: flex-start; }
  .player-stage video { max-height: 56dvh; }
  .toast { bottom: 78px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
