:root {
  --bg: #f5f6f8;
  --bg2: #ffffff;
  --panel: #ffffff;
  --panel2: #f0f2f6;
  --line: #e2e6ee;
  --text: #12151c;
  --muted: #667085;
  --accent: #e11d48;
  --accent-soft: rgba(225, 29, 72, 0.10);
  --ok: #059669;
  --radius: 10px;
  --shadow: 0 8px 24px rgba(18, 21, 28, 0.08);
  --font: "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --max: 1280px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(225, 29, 72, 0.06) 0%, transparent 55%),
    radial-gradient(700px 360px at 95% 0%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; display: block; }
button, input { font: inherit; }

.wrap { width: min(var(--max), calc(100% - 28px)); margin: 0 auto; }

/* —— header —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0 8px;
}
.brand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  line-height: 0;
}
.brand-logo {
  height: 42px;
  width: auto;
  max-width: min(260px, 72vw);
  object-fit: contain;
  display: block;
  background: transparent;
  border-radius: 0;
}
.search {
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  gap: 8px;
  margin: 0 0 8px;
}
.search input {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  outline: none;
}
.search input:focus { border-color: #f9a8b8; background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
.search button {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: linear-gradient(180deg, #fb7185, var(--accent));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(225, 29, 72, 0.22);
}
.nav {
  display: flex;
  gap: 10px;
  flex: 1 1 auto;
  justify-content: flex-end;
}
.nav a {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  padding: 6px 8px;
}
.nav a:hover { color: var(--text); }

.catstrip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 12px;
  scrollbar-width: thin;
}
.catstrip a {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.catstrip a:hover,
.catstrip a.is-active {
  color: var(--accent);
  border-color: #fda4af;
  background: var(--accent-soft);
}

/* —— page intro —— */
.page-head {
  padding: 22px 0 6px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-head h1 {
  margin: 0 0 4px;
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
  letter-spacing: -0.02em;
}
.page-head p { margin: 0; color: var(--muted); max-width: 62ch; }
.count-pill {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

/* —— grid / cards —— */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 14px 0 36px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .16s ease, border-color .16s, box-shadow .16s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: #cbd2e0;
  box-shadow: var(--shadow);
}
.media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #e8ebf2;
  overflow: hidden;
}
.media .thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity .2s ease;
}
.media .preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  background: #000;
}
.media.is-previewing .thumb { opacity: 0; }
.media.is-previewing .preview { opacity: 1; }
.media-empty, .media.media-broken::after {
  display: grid;
  place-items: center;
  height: 100%;
  color: #98a2b3;
  font-size: 0.8rem;
}
.media.media-broken::after {
  content: "No thumb";
  position: absolute;
  inset: 0;
}
.play-badge {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.7);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity .15s, transform .15s;
}
.play-badge::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 13px;
  border-style: solid;
  border-width: 9px 0 9px 14px;
  border-color: transparent transparent transparent #fff;
}
.card:hover .play-badge {
  opacity: 1;
  transform: scale(1);
}
.badge.hd {
  position: absolute;
  left: 8px;
  top: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 3px 6px;
  border-radius: 5px;
}
.dur {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
}
.meta { padding: 10px 11px 12px; }
.meta h3 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em;
}
.sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.sub .dot { opacity: 0.5; }

/* —— pagination —— */
.nav-links, .pager {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 0 48px;
}
.nav-links a, .nav-links span,
.pager a, .pager span {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 9px;
  padding: 8px 13px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}
.nav-links a:hover, .pager a:hover {
  color: var(--text);
  border-color: #cbd2e0;
}
.nav-links .current, .page-numbers.current {
  color: var(--accent);
  border-color: #fda4af;
  background: var(--accent-soft);
}

/* —— video page —— */
.watch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  padding: 18px 0 40px;
  align-items: start;
}
.watch-main { min-width: 0; }
.player-shell {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.player-shell video,
.fm-player {
  width: 100%;
  max-height: min(72vh, 720px);
  background: #000;
  aspect-ratio: 16 / 9;
  object-fit: contain;
}
.player-empty,
.player-status {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0,0,0,.72);
  color: #fff;
  font-size: 0.85rem;
  text-align: center;
}
.player-empty {
  position: static;
  min-height: 180px;
  display: grid;
  place-items: center;
}
.pill-hd {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 8px;
  font-weight: 800;
  font-size: 0.75rem;
}
.cat-dir {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 12px 0 40px;
}
.cat-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 12px;
  min-height: 74px;
}
.cat-tile:active { transform: scale(0.98); }
.cat-tile-name { font-weight: 700; font-size: 0.92rem; }
.cat-tile-count { color: var(--muted); font-size: 0.75rem; }
.search-404 { max-width: 520px; margin: 0 0 18px; }
.v-title {
  margin: 16px 0 8px;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.v-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 12px;
}
.v-stats strong { color: var(--text); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip {
  border: 1px solid var(--line);
  background: var(--panel2);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}
.chip:hover { color: var(--text); border-color: #cbd2e0; }
.chip.is-model { border-color: #fecdd3; color: #be123c; background: #fff1f2; }
.chip.is-cat { border-color: #bfdbfe; color: #1d4ed8; background: #eff6ff; }
.desc {
  color: var(--muted);
  line-height: 1.6;
  max-width: 78ch;
  font-size: 0.95rem;
}
.watch-side .side-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.side-list { display: grid; gap: 10px; }
.side-list .card .meta h3 { font-size: 0.82rem; min-height: 0; -webkit-line-clamp: 2; }

.related { margin-top: 8px; }
.related h2 {
  margin: 8px 0 12px;
  font-size: 1.1rem;
}

.foot {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 18px 0 28px;
  font-size: 0.85rem;
  background: var(--bg2);
}
.foot .wrap {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 980px) {
  .watch { grid-template-columns: 1fr; gap: 14px; }
  .watch-side { order: 2; }
  .related { order: 3; }
  .side-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .side-list .card .meta h3 { -webkit-line-clamp: 2; }
}
@media (max-width: 720px) {
  .wrap { width: min(var(--max), calc(100% - 16px)); }
  .brand-logo { height: 28px; }
  .page-head { padding: 14px 0 4px; }
  .page-head h1 { font-size: 1.25rem; }
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px 0 28px;
  }
  .meta { padding: 8px 8px 10px; }
  .meta h3 { font-size: 0.78rem; min-height: 2.3em; }
  .card:hover { transform: none; box-shadow: none; }
  .play-badge { display: none; }
  .catstrip { padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
  .v-title { font-size: 1.05rem; margin-top: 12px; }
  .chips { gap: 6px; }
  .chip { padding: 7px 10px; font-size: 0.74rem; }
  .player-shell video, .fm-player { max-height: 56vh; border-radius: 0; }
  .player-shell { border-radius: 10px; }
  .watch { padding-top: 10px; }
  .side-title { margin-top: 4px; }
}
@media (max-width: 380px) {
  .nav a:last-child { display: none; }
  .grid { gap: 6px; }
}
