:root {
  --bg: #ffffff;
  --bg-soft: #f2f2f2;
  --card: #f2f2f2;
  --card-hover: #e9e9e9;
  --surface: #f2f2f2;
  --line: #e5e5e5;
  --line-soft: #eeeeee;
  --text: #0f0f0f;
  --muted: #606060;
  --muted-2: #909090;
  --accent: #ff0000;
  --accent-hover: #cc0000;
  --accent-2: #065fd4;
  --hot: #ff4e45;
  --radius: 12px;
  --sidebar-w: 208px;
  --topbar-h: 56px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial,
    sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  width: 100%;
}

button {
  font-family: inherit;
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ==================== Shared page header (doc pages) ==================== */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.2px;
  color: var(--text);
  flex-shrink: 0;
}

.logo__mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
}

/* ==================== Shell / layout ==================== */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg);
  border-right: 1px solid var(--line-soft);
  scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 18px;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.4px;
}

.brand__mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}

.brand__mark svg {
  width: 15px;
  height: 15px;
}

.brand__name {
  color: var(--text);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-nav__item {
  display: flex;
  align-items: center;
  gap: 22px;
  width: 100%;
  padding: 0 12px;
  height: 40px;
  border: none;
  background: none;
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-weight: 400;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.side-nav__item svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.side-nav__item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-nav__item:hover {
  background: var(--bg-soft);
}

.side-nav__item.is-active {
  background: var(--bg-soft);
  font-weight: 600;
}

.side-nav__item .pill {
  margin-left: auto;
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(255, 0, 0, 0.1);
  color: var(--accent);
}

/* ---------- Main column ---------- */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}

.icon-btn:hover {
  background: var(--bg-soft);
}

.icon-btn svg {
  width: 24px;
  height: 24px;
}

.search-btn,
.search-back {
  display: none;
}

/* ---------- Drawer scrim (mobile) ---------- */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.scrim.is-on {
  opacity: 1;
  visibility: visible;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.5px;
  color: var(--text);
}

.topbar__mark {
  width: 30px;
  height: 21px;
  border-radius: 6px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}

.topbar__mark svg {
  width: 13px;
  height: 13px;
}

.topbar__center {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.search {
  position: relative;
  flex: 1;
  max-width: 600px;
  display: flex;
  align-items: center;
}

.search input {
  width: 100%;
  height: 40px;
  padding: 0 18px 0 44px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 999px;
  color: var(--text);
  outline: none;
  font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search input::placeholder {
  color: var(--muted-2);
}

.search input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(6, 95, 212, 0.1);
}

.search__icon {
  position: absolute;
  left: 16px;
  display: grid;
  place-items: center;
  color: var(--muted);
  pointer-events: none;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.btn-fav {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.btn-fav svg {
  width: 18px;
  height: 18px;
}

.btn-fav:hover {
  background: #e5e5e5;
}

.btn-fav.is-on {
  background: #0f0f0f;
  color: #fff;
}

.btn-fav.is-on svg {
  color: #fff;
}

.btn-fav__count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #0f0f0f;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.btn-fav.is-on .btn-fav__count {
  background: #fff;
  color: #0f0f0f;
}

/* ---------- Content ---------- */
.content {
  padding: 24px 24px 0;
  flex: 1;
}

/* ==================== Hero banner ==================== */
.banner {
  margin-bottom: 32px;
}

.banner__link {
  position: relative;
  display: block;
  min-height: 340px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--card);
}

.banner__link img,
.banner__link video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner__veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.86) 0%,
      rgba(0, 0, 0, 0.6) 40%,
      rgba(0, 0, 0, 0.1) 72%,
      rgba(0, 0, 0, 0) 100%
    ),
    linear-gradient(0deg, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0) 55%);
}

.banner__content {
  position: relative;
  z-index: 2;
  min-height: 340px;
  max-width: 640px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
}

.banner__rank {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  font-size: 13px;
  font-weight: 600;
  color: #ffd54a;
}

.banner__rank svg {
  width: 15px;
  height: 15px;
}

.banner__title {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.16;
  letter-spacing: -0.5px;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
}

.banner__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.banner__list li {
  position: relative;
  padding-left: 16px;
  color: #e8e8e8;
  font-size: 13.5px;
}

.banner__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
}

.banner__cta {
  align-self: flex-start;
  margin-top: 4px;
  height: 40px;
  padding: 0 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 0.2px;
  transition: background 0.15s, transform 0.15s;
}

.banner__link:hover .banner__cta {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.banner__desc {
  max-width: 520px;
  color: #d0d0d0;
  font-size: 13.5px;
  line-height: 1.55;
}

/* ==================== Blocks / sections ==================== */
.block {
  margin-bottom: 36px;
}

.block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.block__head h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.block__more {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.live-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: livePulse 1.4s infinite;
}

@keyframes livePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.45);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(255, 0, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
  }
}

/* ---------- Horizontal poster row ---------- */
.row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.row::-webkit-scrollbar {
  display: none;
}

.row .card {
  flex: 0 0 320px;
  scroll-snap-align: start;
}

/* ==================== Category chips (pills) ==================== */
.cats {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  margin-bottom: 24px;
  padding-bottom: 4px;
  scroll-margin-top: 76px;
  scrollbar-width: none;
}

.cats::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  padding: 7px 14px;
  background: var(--bg-soft);
  border: none;
  border-radius: 999px;
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.chip:hover {
  background: #e5e5e5;
}

.chip.is-active {
  background: #0f0f0f;
  color: #fff;
  font-weight: 500;
}

/* ==================== Video cards ==================== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 40px 16px;
}

.grid-loader {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 80px 0;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--accent);
  animation: tipSpin 0.8s linear infinite;
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 15px;
}

.card {
  display: block;
  color: inherit;
}

.card__thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}

.card__thumb img,
.card__thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card:hover .card__thumb img {
  transform: scale(1.04);
}

.card__thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.4));
  opacity: 0;
  transition: opacity 0.2s;
}

.card:hover .card__thumb::after {
  opacity: 1;
}

.card__badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 4;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.card__badge--hot {
  background: var(--accent);
  color: #fff;
}

.card__badge--vip {
  background: linear-gradient(180deg, #ffe08a, #f5b301);
  color: #3a2600;
}

.card__play {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.card:hover .card__play {
  opacity: 1;
}

.card__thumb.is-playing .card__play {
  display: none;
}

.card__play svg {
  width: 50px;
  height: 50px;
  color: #fff;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.55));
}

.card__duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 4;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
}

.card__fav {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.15s, transform 0.15s;
}

.card:hover .card__fav {
  opacity: 1;
}

.card__fav:hover {
  transform: scale(1.1);
  background: rgba(0, 0, 0, 0.78);
}

.card__fav svg {
  width: 17px;
  height: 17px;
}

.card__fav.is-on {
  opacity: 1;
  color: #fff;
  background: var(--accent);
}

.card__info {
  display: flex;
  gap: 12px;
  padding: 12px 2px 0;
}

.card__avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  background: var(--card);
}

.card__body {
  min-width: 0;
  flex: 1;
}

.card__title {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s;
}

.card__meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.card__meta .dot-sep {
  margin: 0 4px;
}

/* ==================== Pagination ==================== */
.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 40px 0 56px;
  flex-wrap: wrap;
}

.pager button {
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: 18px;
  background: var(--bg-soft);
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.pager button:hover:not(:disabled) {
  background: #e5e5e5;
}

.pager button.is-active {
  background: #0f0f0f;
  color: #fff;
}

.pager button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==================== Footer ==================== */
.footer {
  border-top: 1px solid var(--line);
  padding: 28px 24px;
  color: var(--muted);
  font-size: 13px;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 12px;
}

.footer__links a:hover {
  color: var(--text);
}

.footer__copy {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  max-width: 720px;
}

/* ==================== Bottom tab bar (mobile) ==================== */
.tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}

.tabbar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s;
}

.tabbar__item svg {
  width: 22px;
  height: 22px;
}

.tabbar__item.is-active {
  color: var(--text);
}

@keyframes tipSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ==================== Responsive ==================== */
@media (max-width: 1180px) {
  :root {
    --sidebar-w: 180px;
  }
  .banner__link,
  .banner__content {
    min-height: 300px;
  }
  .banner__title {
    font-size: 28px;
  }
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  /* Sidebar becomes a slide-in drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    height: 100vh;
    z-index: 80;
    background: #fff;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 0 0 32px rgba(0, 0, 0, 0.18);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  /* Hide in-page search field; expose search icon */
  .topbar__center {
    display: none;
  }

  .search-btn {
    display: grid;
  }

  .notif-btn,
  .btn-fav__label {
    display: none;
  }

  .topbar.is-search-open .topbar__center {
    display: flex;
    position: absolute;
    inset: 0;
    z-index: 10;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    background: #fff;
  }

  .topbar.is-search-open .search-back {
    display: grid;
  }

  .topbar.is-search-open .search {
    max-width: none;
  }

  .content {
    padding: 16px 12px 0;
  }

  .topbar {
    padding: 0 8px;
    gap: 4px;
  }

  .footer {
    padding: 24px 16px;
  }

  .grid {
    gap: 28px 0;
  }
}

@media (max-width: 760px) {
  .banner__link,
  .banner__content {
    min-height: 260px;
  }
  .banner__content {
    padding: 22px 20px;
    gap: 9px;
  }
  .banner__title {
    font-size: 21px;
  }
  .banner__list li {
    font-size: 12.5px;
  }
  .banner__desc {
    font-size: 12.5px;
  }
  .block__head h2 {
    font-size: 18px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .row .card {
    flex-basis: 260px;
  }
  .btn-fav__label {
    display: none;
  }
  .block__more {
    display: none;
  }
}

@media (max-width: 560px) {
  .grid {
    gap: 22px 0;
  }
}
