:root {
  --bg-dark: #1a1a1a;
  --bg-nav: #2d2d2d;
  --bg-card: #fff;
  --bg-page: #f5f5f5;
  --text-primary: #333;
  --text-secondary: #888;
  --text-light: #ccc;
  --accent: #f5a623;
  --accent-hover: #e09510;
  --star: #f5a623;
  --star-empty: #ddd;
  --border: #e8e8e8;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --radius: 4px;
  --header-h: 60px;
  --nav-h: 42px;
  --max-w: 1200px;
}

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

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button,
input,
textarea,
select {
  font: inherit;
}

ul {
  list-style: none;
}

/* Header */
.site-header {
  background: var(--bg-dark);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  color: #fff;
}

.logo-stars {
  font-size: 28px;
  line-height: 1;
}

.logo-text h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
}

.logo-text span {
  font-size: 10px;
  color: var(--text-light);
  letter-spacing: 2px;
}

.search-box {
  flex: 1;
  max-width: 480px;
  display: flex;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  margin: 0 auto;
}

.search-box input {
  flex: 1;
  border: none;
  padding: 8px 16px;
  outline: none;
  font-size: 13px;
}

.search-box button {
  border: none;
  background: transparent;
  padding: 8px 14px;
  cursor: pointer;
  color: #999;
  font-size: 16px;
}

.search-box button:hover {
  color: var(--accent);
}

.header-actions {
  display: flex;
  gap: 16px;
  flex-shrink: 0;
}

.header-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  transition: color 0.2s;
}

.header-action:hover {
  color: var(--accent);
}

.header-action .icon {
  font-size: 18px;
}

/* Nav */
.site-nav {
  background: var(--bg-nav);
  border-bottom: 1px solid #444;
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.nav-links {
  display: flex;
}

.nav-links a {
  color: #fff;
  padding: 10px 18px;
  font-size: 14px;
  transition: background 0.2s, color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent);
}

.nav-update {
  color: var(--text-light);
  font-size: 12px;
  white-space: nowrap;
}

.nav-update em {
  color: var(--accent);
  font-style: normal;
  font-weight: 700;
}

/* Main layout */
.main-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 16px;
}

.page-card {
  background: var(--bg-page);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Banner */
.banner-section {
  position: relative;
  background: #fff;
  margin-bottom: 2px;
}

.app-promo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #fafafa;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.app-promo-btn {
  background: #e74c3c;
  color: #fff;
  border: none;
  padding: 4px 12px;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
}

.carousel {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: clamp(160px, 28vw, 280px);
}

.carousel-track {
  display: flex;
  transition: transform 0.5s ease;
  height: 100%;
}

.carousel-slide {
  min-width: 100%;
  position: relative;
  cursor: pointer;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-slide .slide-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 16px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.carousel-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  border: none;
  cursor: pointer;
  padding: 0;
}

.carousel-dot.active {
  background: #fff;
}

/* Content sections */
.content-section {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: #fff;
  margin-bottom: 2px;
}

.section-main {
  flex: 1;
  min-width: 0;
}

.section-sidebar {
  width: 260px;
  flex-shrink: 0;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
}

.section-title .icon {
  color: var(--accent);
  font-size: 18px;
}

.sub-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  max-width: 100%;
  justify-content: flex-end;
}

.sub-filters a {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 2px 0;
  transition: color 0.2s;
}

.sub-filters a:hover,
.sub-filters a.active {
  color: var(--accent);
}

.sub-filters .more {
  color: var(--accent);
}

/* Video grid */
.video-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

.video-card {
  min-width: 0;
  width: 100%;
  cursor: pointer;
  transition: transform 0.2s;
}

.video-card:hover {
  transform: translateY(-2px);
}

.video-poster {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  max-height: 240px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #eee;
}

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

.video-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 2px;
}

.video-info {
  padding: 6px 2px 0;
}

.video-title {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-meta {
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

/* Hot ranking */
.hot-panel {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.hot-panel-title {
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.hot-list {
  padding: 4px 0;
}

.hot-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.hot-item:hover {
  background: #f0f0f0;
}

.hot-thumb {
  position: relative;
  width: 48px;
  height: 64px;
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
  background: #eee;
}

.hot-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hot-info {
  flex: 1;
  min-width: 0;
}

.hot-name {
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hot-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.stars {
  display: flex;
  gap: 1px;
}

.star {
  color: var(--star-empty);
  font-size: 11px;
}

.star.filled {
  color: var(--star);
}

.rating-num {
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
}

/* Category page */
.page-header {
  background: #fff;
  padding: 16px;
  margin-bottom: 2px;
}

.page-header h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-btn {
  padding: 4px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  padding: 16px;
  background: #fff;
  width: 100%;
}

.listing-grid .video-card {
  width: 100%;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  background: #fff;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.page-btn:hover,
.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.page-btn:disabled,
.page-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

a.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  color: inherit;
}

/* Category page (xxtp / xxsw) */
.category-page {
  overflow: hidden;
}

.category-type-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  background: var(--bg-nav);
  border-bottom: 2px solid var(--accent);
}

.type-nav-link {
  padding: 10px 18px;
  color: var(--text-light);
  font-size: 14px;
  transition: background 0.2s, color 0.2s;
}

.type-nav-link:hover,
.type-nav-link.active {
  background: var(--accent);
  color: #fff;
}

.filter-screen {
  background: #fff;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  max-height: 220px;
  overflow-y: auto;
}

.filter-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}

.filter-row:last-child {
  border-bottom: none;
}

.filter-label {
  flex: 0 0 56px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 28px;
}

.filter-options {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.filter-link {
  padding: 4px 10px;
  border-radius: 3px;
  font-size: 13px;
  color: var(--text-primary);
  transition: all 0.2s;
}

.filter-link:hover,
.filter-link.active {
  background: var(--accent);
  color: #fff;
}

.category-page-header {
  padding: 12px 16px 0;
  background: #fff;
}

.category-layout {
  display: flex;
  gap: 0;
  align-items: flex-start;
  background: #fff;
}

.category-main {
  flex: 1;
  min-width: 0;
}

.category-main .listing-grid {
  padding-top: 0;
}

.category-sidebar {
  width: 220px;
  flex-shrink: 0;
  padding: 16px 12px;
  border-left: 1px solid var(--border);
  background: #fafafa;
}

.category-sidebar .hot-panel + .hot-panel {
  margin-top: 16px;
}

.sidebar-empty {
  color: var(--text-secondary);
  font-size: 12px;
  padding: 8px 0;
}

.category-pagination {
  flex-wrap: wrap;
  align-items: center;
}

.page-info {
  padding: 0 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.page-ellipsis {
  padding: 0 4px;
  color: var(--text-secondary);
}

/* Detail page */
.detail-page {
  background: #fff;
  padding: 20px;
}

.detail-top {
  display: flex;
  gap: 24px;
}

.detail-poster {
  width: min(220px, 40vw);
  flex-shrink: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  aspect-ratio: 2 / 3;
  background: #eee;
  position: relative;
}

.detail-poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-info {
  flex: 1;
}

.detail-info h1 {
  font-size: 22px;
  margin-bottom: 12px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.detail-meta strong {
  color: var(--text-primary);
}

.detail-rating {
  margin-bottom: 12px;
}

.detail-desc {
  font-size: 13px;
  line-height: 1.8;
  color: #555;
  margin-bottom: 16px;
}

.episode-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.episode-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fafafa;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.episode-btn:hover,
.episode-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.related-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.related-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

/* Detail page v2 (reference layout) */
.detail-page-v2,
.player-detail-card {
  padding: 0;
  overflow: hidden;
}

.detail-layout {
  display: flex;
  align-items: flex-start;
  background: #fff;
}

.detail-main {
  flex: 1;
  min-width: 0;
  padding: 16px;
}

.detail-sidebar {
  width: 220px;
  flex-shrink: 0;
  padding: 16px 12px;
  border-left: 1px solid var(--border);
  background: #fafafa;
}

.detail-header-block {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.detail-cover {
  flex: 0 0 190px;
  width: 190px;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 2 / 3;
  background: #eee;
}

.detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-status {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 2px;
}

.detail-head-info {
  flex: 1;
  min-width: 0;
}

.detail-head-info h1 {
  font-size: 20px;
  margin-bottom: 10px;
  line-height: 1.35;
}

.detail-data {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.6;
}

.detail-data-inline {
  color: var(--text-secondary);
}

.detail-desc-block {
  font-size: 13px;
  line-height: 1.75;
  color: #555;
  margin: 10px 0 12px;
  padding-left: 42px;
}

.detail-desc-block.no-label {
  padding-left: 0;
}

.detail-desc-block .left {
  margin-left: -42px;
}

.detail-desc-block .desc-full {
  display: none;
}

.detail-desc-block.expanded .desc-sketch {
  display: none;
}

.detail-desc-block.expanded .desc-full {
  display: inline;
}

.detail-more-btn {
  border: none;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  padding: 0 4px;
}

.detail-action-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
  padding-left: 42px;
}

.detail-sources {
  margin-top: 8px;
}

.source-panel {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

.playlist-panel .panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ep-count {
  font-size: 12px;
  font-weight: normal;
  color: var(--text-secondary);
}

.source-panel-body.is-scroll {
  max-height: 300px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.panel-title {
  font-size: 15px;
  padding: 10px 14px;
  background: #fafafa;
  border-bottom: 1px solid var(--border);
  margin: 0;
}

.source-playlist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  list-style: none;
  margin: 0;
}

.source-playlist-grid {
  display: grid;
  gap: 0;
  padding: 0;
}

.source-playlist-grid.cols-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.source-playlist-grid li {
  min-width: 0;
}

.source-playlist-grid .source-ep {
  display: block;
  width: 100%;
  text-align: center;
  padding: 10px 4px;
  border: none;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-playlist-grid.cols-6 li:nth-child(6n) .source-ep {
  border-right: none;
}

.detail-cover-link {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  color: inherit;
}

.detail-cover-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-cover-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 28px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.detail-cover-link:hover .detail-cover-play {
  opacity: 1;
}

.play-btn-row {
  margin-top: 4px;
}

.detail-action-btns.play-btn-row {
  margin-top: 20px;
}

.episode-select-section {
  margin-top: 4px;
}

.source-ep {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: #fff;
  transition: all 0.2s;
}

.source-ep:hover,
.source-ep.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.source-ep.external {
  opacity: 0.85;
}

.guess-section,
.synopsis-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.guess-section .video-grid {
  padding: 12px 0 0;
}

/* Player page v2 */
.player-page-v2 {
  background: #111;
}

.player-top-bar {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  color: #ccc;
  font-size: 13px;
}

.player-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.player-top-actions a {
  color: #fff;
}

.player-top-actions a:hover {
  color: var(--accent);
}

.player-top-actions .disabled {
  opacity: 0.4;
}

.player-page-v2 .player-iframe-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
}

.player-detail-card {
  margin-top: 0;
  border-radius: 0;
}

.player-vod-head {
  margin-bottom: 12px;
}

.player-vod-head h1 {
  font-size: 20px;
  margin-bottom: 8px;
}

.player-page-v2 .player-mode-btn {
  background: transparent;
  border: 1px solid #555;
  color: #ccc;
  padding: 4px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
}

.player-page-v2 .player-mode-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Player */
.player-page {
  background: #000;
}

.player-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
}

.player-wrap video {
  width: 100%;
  max-height: 70vh;
  background: #000;
}

.player-iframe-wrap {
  aspect-ratio: 16 / 9;
  max-height: 70vh;
  background: #000;
}

.player-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

.source-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  padding: 2px 8px;
  border-radius: 10px;
  vertical-align: middle;
  margin-left: 6px;
}

.source-badge-wrap {
  position: relative;
}

.source-badge-wrap > .source-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #eee;
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.8s linear infinite;
}

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

.player-info {
  background: #fff;
  padding: 16px 20px;
}

.player-info h1 {
  font-size: 18px;
  margin-bottom: 8px;
}

.player-nav {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.player-nav a,
.player-nav button {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}

.player-nav .play-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.player-mode-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}

.player-mode-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Search results */
/* Search page (xxsc) */
.search-page-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 0;
  background: #fff;
}

.search-keyword {
  font-size: 20px;
  font-weight: 600;
}

.search-layout {
  display: flex;
  align-items: flex-start;
  background: #fff;
}

.search-main {
  flex: 1;
  min-width: 0;
  padding: 12px 16px 16px;
}

.search-result-list {
  list-style: none;
}

.search-result-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-thumb {
  flex: 0 0 120px;
  position: relative;
}

.search-thumb a {
  display: block;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: #eee;
}

.search-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-thumb .video-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
}

.search-detail {
  flex: 1;
  min-width: 0;
}

.search-title {
  font-size: 17px;
  margin-bottom: 8px;
}

.search-title a:hover {
  color: var(--accent);
}

.search-detail p {
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-primary);
}

.text-muted {
  color: var(--text-secondary);
}

.split-line {
  display: inline-block;
  width: 1px;
  height: 12px;
  background: var(--border);
  margin: 0 8px;
  vertical-align: middle;
}

.search-meta-line {
  color: var(--text-secondary);
}

.search-actions {
  margin-top: 10px !important;
}

.btn-min {
  display: inline-block;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-right: 8px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn-default {
  background: #f5f5f5;
  border: 1px solid var(--border);
}

.btn-default:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.search-sidebar {
  width: 240px;
  flex-shrink: 0;
  padding: 16px 12px;
  border-left: 1px solid var(--border);
  background: #fafafa;
}

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rank-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  padding: 4px 0;
}

.rank-item:hover .rank-name {
  color: var(--accent);
}

.rank-num {
  flex: 0 0 18px;
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
}

.rank-name {
  font-size: 13px;
  line-height: 1.4;
}

.rank-status {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.search-header {
  background: #fff;
  padding: 16px;
  font-size: 14px;
}

.search-header strong {
  color: var(--accent);
}

.search-empty {
  text-align: center;
  padding: 60px 20px;
  background: #fff;
  color: var(--text-secondary);
}

.search-empty .icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* History & Request pages */
.simple-page {
  background: #fff;
  padding: 20px;
  min-height: 400px;
}

.simple-page h2 {
  font-size: 18px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.history-item:hover {
  background: #fafafa;
}

.history-thumb {
  position: relative;
  width: 60px;
  height: 80px;
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
  background: #eee;
}

.history-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-info {
  flex: 1;
}

.history-title {
  font-weight: 600;
  font-size: 14px;
}

.history-ep {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.history-time {
  font-size: 11px;
  color: #bbb;
}

.clear-btn {
  margin-top: 16px;
  padding: 8px 20px;
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
}

.request-form {
  max-width: 500px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
  font-weight: 600;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.submit-btn {
  padding: 10px 28px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
}

.submit-btn:hover {
  background: var(--accent-hover);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 200;
  transition: transform 0.3s;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Footer */
.site-footer {
  max-width: var(--max-w);
  margin: 16px auto;
  padding: 20px 16px;
  text-align: center;
  color: var(--text-light);
  font-size: 12px;
  line-height: 1.8;
}

.site-footer a {
  color: var(--text-light);
}

.site-footer a:hover {
  color: var(--accent);
}

.breadcrumb {
  background: #fff;
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.breadcrumb a:hover {
  color: var(--accent);
}

.breadcrumb span {
  margin: 0 6px;
}

/* Responsive */
@media (max-width: 1024px) {
  .video-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .listing-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .section-sidebar {
    width: 220px;
  }

  .video-poster {
    max-height: 220px;
  }
}

@media (max-width: 768px) {
  .main-wrap {
    padding: 12px;
  }

  .header-inner {
    flex-wrap: wrap;
  }

  .search-box {
    order: 3;
    max-width: 100%;
    width: 100%;
  }

  .header-actions {
    margin-left: auto;
  }

  .nav-inner {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-links {
    flex-wrap: nowrap;
  }

  .nav-update {
    display: none;
  }

  .content-section {
    flex-direction: column;
    padding: 12px;
  }

  .category-layout {
    flex-direction: column;
  }

  .category-sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .filter-row {
    flex-direction: column;
    gap: 6px;
  }

  .filter-label {
    line-height: 1.4;
  }

  .search-layout {
    flex-direction: column;
  }

  .search-sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .search-result-item {
    flex-direction: column;
  }

  .search-thumb {
    flex-basis: auto;
    max-width: 140px;
  }

  .detail-layout {
    flex-direction: column;
  }

  .detail-sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .detail-header-block {
    flex-direction: column;
  }

  .detail-cover {
    flex: 0 0 115px;
    width: 115px;
    max-width: 115px;
  }

  .source-playlist-grid.cols-6 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .section-sidebar {
    width: 100%;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .sub-filters {
    justify-content: flex-start;
  }

  .video-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .listing-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    padding: 12px;
  }

  .detail-top {
    flex-direction: column;
  }

  .detail-poster {
    width: min(180px, 55vw);
    margin: 0 auto;
  }

  .carousel {
    height: clamp(140px, 42vw, 220px);
  }

  .video-poster {
    max-height: 200px;
  }

  .player-nav {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 13px;
  }

  .nav-links a {
    padding: 10px 10px;
    font-size: 13px;
  }

  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .listing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .listing-grid .video-card {
    max-width: none;
  }

  .source-playlist-grid.cols-6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .source-playlist-grid.cols-6 li:nth-child(6n) .source-ep {
    border-right: 1px solid var(--border);
  }

  .source-playlist-grid.cols-6 li:nth-child(3n) .source-ep {
    border-right: none;
  }

  .sub-filters {
    display: none;
  }

  .video-poster {
    max-height: 180px;
  }

  .carousel {
    height: clamp(120px, 38vw, 180px);
  }

  .carousel-slide .slide-title {
    font-size: 14px;
    padding: 16px 12px 10px;
  }
}

/* Auth gate */
.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse at top, rgba(245, 166, 35, 0.12), transparent 55%),
    var(--bg-page);
}

.auth-card {
  width: min(400px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px 20px;
  box-shadow: var(--shadow);
}

.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  font-size: 42px;
  display: block;
  margin-bottom: 8px;
}

.auth-brand h1 {
  font-size: 22px;
  margin: 0 0 6px;
  color: var(--text-primary);
}

.auth-brand p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.auth-form h2 {
  margin: 0 0 16px;
  font-size: 18px;
  text-align: center;
  color: var(--text-primary);
}

.auth-hint {
  margin: -8px 0 16px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.auth-field {
  display: block;
  margin-bottom: 14px;
}

.auth-field span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-primary);
  font-size: 15px;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-submit {
  width: 100%;
  margin-top: 6px;
  padding: 11px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.auth-submit:hover {
  background: var(--accent-hover);
}

.auth-link-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
}

.auth-foot {
  margin: 20px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
}

.header-user {
  position: relative;
}

.header-user-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: transparent;
  color: var(--text-light);
  font-size: 13px;
  cursor: pointer;
}

.header-user-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 130px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 200;
  overflow: hidden;
}

.header-user-menu.open {
  display: block;
}

.header-user-menu button {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  font-size: 14px;
  cursor: pointer;
}

.header-user-menu button:hover {
  background: var(--bg-page);
}

.auth-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-modal.open {
  display: flex;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.auth-modal-card {
  position: relative;
  width: min(380px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  z-index: 1;
}

.auth-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.auth-modal-head h3 {
  margin: 0;
  font-size: 17px;
  color: var(--text-primary);
}

.auth-modal-close {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
