/* 本站数据适配层：保留参考模板视觉，同时适配现有 PHP/SQLite 数据。 */
body {
  padding-top: 0;
  padding-bottom: 32px;
}

body.has-top-ad {
  padding-top: 87px;
}

.logo {
  min-width: 170px;
  margin-left: 0;
  padding-left: 0;
  line-height: 1.15;
}

.logo .gradient-text {
  font-size: 24px;
  white-space: nowrap;
}

.logo-domain {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  opacity: .9;
  white-space: nowrap;
}

.pc-nav {
  flex: 1;
  justify-content: center;
  gap: 13px;
}

.header-actions {
  min-width: 70px;
  justify-content: flex-end;
}

.page-content {
  min-height: 420px;
  padding-top: 22px;
}

.ads-banners + .ads-app-icons,
.ads-app-icons + .ads-text-links {
  border-top: 1px solid #151515;
}

.ads-banners .ads-banner-item img {
  max-height: 150px;
  min-height: 48px;
}

.ads-bottom {
  z-index: 1200;
}

.has-bottom-ad {
  padding-bottom: 87px;
}

.notice-bar {
  margin-bottom: 16px;
  padding: 10px 14px;
  color: #f3edff;
  background: rgba(102, 126, 234, .18);
  border: 1px solid rgba(148, 163, 255, .28);
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
}

.notice-bar.error {
  color: #ffd7df;
  background: rgba(225, 29, 72, .15);
  border-color: rgba(251, 113, 133, .28);
}

.search-section {
  margin-bottom: 15px;
}

.search-wrapper {
  max-width: 720px;
  margin: 0 auto;
}

.search-box {
  width: 100%;
}

.search-box .input {
  width: 100%;
}

.sort-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 15px;
  padding: 12px;
  background: #1a1a1a;
  border-radius: 8px;
}

.sort-label {
  color: #fff;
  font-size: 14px;
  white-space: nowrap;
}

.sort-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sort-option {
  padding: 6px 16px;
  color: #aaa;
  background: none;
  border: 0;
  border-radius: 4px;
  font-size: 14px;
}

.sort-option:hover,
.sort-option.active {
  color: #fff;
  background: #667eea;
}

.main-content {
  min-width: 0;
}

.video-card {
  color: inherit;
}

.video-title {
  min-height: 44px;
}

.empty-state {
  padding: 70px 24px;
  color: var(--text-secondary);
  text-align: center;
}

.vip-hero {
  margin-bottom: 22px;
  padding: 44px 24px;
  text-align: center;
  background: linear-gradient(135deg, rgba(255, 215, 0, .12), rgba(118, 75, 162, .16));
}

.vip-hero .vip-icon {
  margin-bottom: 8px;
  font-size: 54px;
}

.vip-hero h1 {
  font-size: 30px;
}

.vip-hero p {
  color: var(--text-secondary);
}

.player-page {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.player-container {
  height: auto;
  aspect-ratio: auto;
  overflow: hidden;
  margin-bottom: 28px;
  background: rgba(7, 7, 18, .96);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
}

.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(0, 0, 0, .9);
}

.player-title {
  flex: 1;
  margin: 0 12px;
  color: #fff;
  font-size: 16px;
  line-height: 1.45;
  text-align: center;
  overflow-wrap: anywhere;
  white-space: normal;
}

.back-btn,
.fullscreen-btn,
.action-btn {
  padding: 8px 13px;
  color: #fff;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}

.back-btn:hover,
.fullscreen-btn:hover,
.action-btn:hover {
  color: #fff;
  background: #667eea;
}

.video-wrapper {
  position: relative;
  width: 100%;
  background: #000;
}

.video-wrapper video {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: #000;
}

.player-info {
  padding: 20px;
}

.player-info h1 {
  margin-bottom: 10px;
  color: #fff;
  font-size: 18px;
}

.player-meta,
.player-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.player-meta {
  margin-bottom: 15px;
  color: #888;
  font-size: 14px;
}

.related-section {
  margin-top: 30px;
}

.section-title {
  margin-bottom: 18px;
  font-size: 20px;
}

.footer-inner {
  justify-content: center;
  text-align: center;
}

.footer-disclaimer {
  flex-basis: 100%;
}

.ads-right-float {
  display: flex;
}

.ads-popup-overlay {
  display: flex;
}

.ads-popup {
  width: auto;
  max-width: 90%;
  max-height: 86vh;
  overflow: visible;
}

.ads-popup-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(68px, 1fr));
  gap: 12px;
  max-height: 82vh;
  overflow-y: auto;
}

.ads-popup-content {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  color: #fff;
  text-align: center;
}

.ads-popup-content img.img {
  display: block;
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 12px;
}

.ads-popup-content span {
  display: block;
  width: 72px;
  padding-top: 6px;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ads-popup-list > :only-child {
  grid-column: 1 / -1;
}

@media (max-width: 600px) {
  .ads-popup-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px 7px;
  }

  .ads-popup-content img.img {
    width: 58px;
    height: 58px;
  }

  .ads-popup-content span {
    width: 62px;
    font-size: 11px;
  }
}

.ads-popup-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 34px;
  height: 34px;
  color: #fff;
  background: #111;
  border: 2px solid #fff;
  border-radius: 50%;
  font-size: 24px;
  line-height: 28px;
  cursor: pointer;
}

.back-top {
  position: fixed;
  right: 18px;
  bottom: 28px;
  z-index: 800;
  display: none;
  width: 42px;
  height: 42px;
  color: #fff;
  background: var(--gradient-primary);
  border: 0;
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.back-top.visible {
  display: block;
}

.ads-right-float {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s ease;
}

.ads-right-float.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mobile-menu.active ~ .ads-right-float {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 991px) {
  .logo {
    min-width: 0;
  }

  .logo .gradient-text {
    font-size: 21px;
  }

  .logo-domain {
    font-size: 12px;
  }

  .header-actions .btn {
    display: none;
  }
}

@media (max-width: 768px) {
  body {
    padding-top: 0;
    padding-bottom: 32px;
  }

  .header {
    position: sticky;
    top: 0;
  }

  .mobile-menu {
    top: 56px;
    bottom: 0;
    height: calc(100dvh - 56px);
  }

  body.has-top-ad {
    padding-top: 87px;
  }

  body.has-top-ad .header {
    top: 87px;
  }

  body.has-top-ad .mobile-menu {
    top: 143px;
    height: calc(100dvh - 143px);
  }

  .ads-top,
  .ads-bottom {
    left: 0;
    right: 0;
    width: 100vw;
    height: min(20vw, 78px);
    max-width: none;
    margin: 0 !important;
  }

  .ads-top a,
  .ads-bottom a {
    width: 100%;
    height: 100%;
    max-width: none;
    padding: 0;
  }

  .ads-banners {
    padding: 0;
  }

  .ads-top img,
  .ads-bottom img {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    object-fit: cover;
  }

  .ads-banners .ads-banner-item img {
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    object-fit: contain;
  }

  .app-icons-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px 5px;
  }

  .app-icon-item {
    width: auto;
  }

  .app-icon-item img {
    width: 54px;
    height: 54px;
  }

  .app-icon-item span {
    max-width: 100%;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .text-links-table td {
    padding: 9px 3px;
  }

  .text-links-table a {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sort-bar {
    gap: 10px;
    padding: 10px;
    flex-wrap: wrap;
  }

  .sort-option {
    padding: 5px 11px;
    font-size: 12px;
  }

  .ads-right-float .ads-right-item img {
    width: 72px;
    height: 72px;
    border-radius: 14px;
  }

  .ads-right-float .ads-right-item span {
    display: block;
    max-width: 76px;
    font-size: 11px;
    text-shadow: 0 1px 3px #000;
  }

  .player-header {
    padding: 10px;
  }

  .player-title {
    font-size: 14px;
  }

  .back-btn,
  .fullscreen-btn,
  .action-btn {
    padding: 6px 9px;
    font-size: 12px;
  }

  .player-info {
    padding: 14px 12px;
  }

  .has-bottom-ad {
    padding-bottom: 87px;
  }
}

@media (max-width: 479px) {
  .mobile-menu {
    top: 50px;
    height: calc(100dvh - 50px);
  }

  body.has-top-ad .mobile-menu {
    top: 137px;
    height: calc(100dvh - 137px);
  }

  .app-icons-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .logo-domain {
    display: none;
  }

  .player-title {
    margin: 0 6px;
  }

  .ads-right-float {
    right: 7px;
  }

  .ads-right-float .ads-right-item img {
    width: 68px;
    height: 68px;
    border-radius: 13px;
  }

  .ads-right-float .ads-right-item span {
    display: block;
    max-width: 72px;
    font-size: 10px;
  }
}
