/* ── 主题：墨青金笺 · 对齐与溢出修复 ── */
:root {
  --red: #0d7377;
  --red2: #14919b;
  --red3: #0a4d51;
  --ink: #102226;
  --muted: #5b6e72;
  --line: #d5e4e2;
  --bg: #f3f7f6;
  --soft: #e7f1ef;
  --card: #ffffff;
  --accent: #c4a35a;
  --accent-soft: #f7f1e3;
  --navy: #072629;
  --navy-2: #0b3539;
  --shadow: 0 10px 28px rgba(10, 77, 81, 0.08);
  --shadow-lg: 0 16px 36px rgba(10, 77, 81, 0.12);
  --radius: 8px;
  --radius-lg: 12px;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

a {
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

#root {
  min-height: 100dvh;
}

.wrap {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

input[type="range"]::-webkit-slider-thumb {
  background: var(--red);
}

input[type="range"]::-moz-range-thumb {
  background: var(--red);
}

/* ── 顶栏 ── */
.topbar {
  background: var(--navy);
  backdrop-filter: none;
  border-bottom: 2px solid var(--accent);
  box-shadow: none;
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
  padding: 0;
  flex-wrap: nowrap;
}

.brand {
  gap: 12px;
  flex-shrink: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--navy);
  box-shadow: none;
  font-size: 13px;
  font-weight: 900;
}

.brand strong {
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
  color: #fff;
  -webkit-text-fill-color: #fff;
  font-size: 20px;
  letter-spacing: 0.04em;
  line-height: 1.15;
}

.brand em {
  color: #8fb8b4;
  letter-spacing: 0.08em;
  margin-top: 3px;
}

.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.nav-link {
  position: relative;
  padding: 6px 11px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #c5ddd9;
  border-radius: 6px;
  background: transparent;
  white-space: nowrap;
}

.nav-link::after {
  display: none;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
  color: var(--navy);
  background: var(--accent);
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: 1px solid rgba(196, 163, 90, 0.45);
  background: transparent;
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.mobile-panel {
  display: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--navy-2);
  box-shadow: none;
  padding: 8px 16px 16px;
}

.mobile-panel.open {
  display: block;
}

.mobile-panel a {
  display: block;
  border-radius: 6px;
  margin: 4px 0;
  padding: 12px 10px;
  font-weight: 600;
  color: #c5ddd9;
  border-bottom: none;
}

.mobile-panel a.active,
.mobile-panel a:hover {
  background: var(--accent);
  color: var(--navy);
}

body.nav-open {
  overflow: hidden;
}

/* ── 轮播：高度锁定，避免侧卡撑破 ── */
.hero-carousel {
  height: 520px;
  min-height: 520px;
  max-height: 520px;
  overflow: hidden;
  background: var(--navy);
}

.hero-slide {
  overflow: hidden;
}

.hero-slide img {
  transform: none;
  filter: saturate(0.95) brightness(0.82);
}

.hero-slide.active img {
  transform: none;
}

.hero-bg {
  background:
    linear-gradient(90deg, rgba(7, 38, 41, 0.92) 0%, rgba(7, 38, 41, 0.62) 46%, rgba(7, 38, 41, 0.28) 100%);
}

.hero-orb {
  opacity: 0.28;
  background: rgba(196, 163, 90, 0.18);
}

.hero-content {
  height: 100%;
  min-height: 0;
  max-height: 520px;
  padding: 36px 0 48px;
  gap: 32px;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) 280px;
  box-sizing: border-box;
}

.hero-title {
  font-size: clamp(32px, 4.2vw, 52px);
  line-height: 1.15;
  margin: 14px 0 12px;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  letter-spacing: 0.01em;
}

.eyebrow {
  border-radius: 6px;
  background: rgba(196, 163, 90, 0.18);
  border-color: rgba(196, 163, 90, 0.45);
  color: #f3e6c4;
  backdrop-filter: none;
}

.hero-desc {
  color: #d5e8e5;
  max-width: 620px;
  font-size: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-actions {
  margin-top: 22px;
}

.hero-panel {
  align-self: center;
  width: 100%;
  max-height: 420px;
  overflow: hidden;
  background: var(--accent-soft);
  border: 1px solid rgba(196, 163, 90, 0.35);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: none;
  padding: 14px;
  color: var(--ink);
}

.hero-panel img {
  height: 168px;
  border-radius: 6px;
  box-shadow: none;
}

.hero-panel h2 {
  color: var(--ink);
  font-size: 18px;
  margin-top: 10px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-panel p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-tags {
  margin-top: 12px;
}

.hero-tags span {
  border-radius: 4px;
  background: rgba(196, 163, 90, 0.2);
  color: #f3e6c4;
}

.hero-dots {
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(6px);
  gap: 8px;
}

.hero-dots button {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.4);
}

.hero-dots button.active {
  width: 22px;
  background: var(--accent);
}

/* ── 按钮 ── */
.btn {
  border-radius: 8px;
  padding: 11px 18px;
  letter-spacing: 0.03em;
  box-shadow: none;
}

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

.btn-secondary {
  background: var(--red3);
  color: #fff;
  box-shadow: none;
}

.btn-ghost {
  backdrop-filter: none;
  border-radius: 8px;
  border-color: rgba(243, 230, 196, 0.55);
}

.btn:hover {
  transform: none;
  box-shadow: none;
  opacity: 0.92;
}

/* ── 区块 ── */
.section {
  padding: 52px 0;
}

.section-white {
  background: #fff;
}

.section-soft {
  background: var(--soft);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--line);
  border-left: none;
}

.section-kicker {
  color: var(--red);
  font-size: 11px;
  letter-spacing: 0.18em;
}

.section-title {
  color: var(--ink);
  font-size: clamp(24px, 3vw, 32px);
}

.section-desc {
  max-width: 640px;
}

.section-head .btn {
  flex-shrink: 0;
  width: auto;
}

/* ── 统计卡 ── */
.stat-grid {
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: none;
  padding: 22px 20px;
}

.stat-card:hover {
  transform: none;
  box-shadow: var(--shadow);
}

.stat-card strong {
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
  color: var(--red3);
  font-variant-numeric: tabular-nums;
}

/* ── 分类卡：五列对齐 ── */
.category-grid {
  gap: 16px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.category-card {
  min-height: 148px;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-top: 3px solid var(--red);
  box-shadow: none;
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.category-card:nth-child(2n),
.category-card:nth-child(3n),
.category-card:nth-child(4n),
.category-card:nth-child(5n) {
  background: #fff;
}

.category-card:nth-child(2n) {
  border-top-color: var(--accent);
}

.category-card:nth-child(3n) {
  border-top-color: var(--red2);
}

.category-card:after {
  display: none;
}

.category-card strong {
  color: var(--ink);
}

.category-card p {
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.category-card:hover {
  transform: none;
  box-shadow: var(--shadow);
}

/* ── 影片卡：等高 + 五列 ── */
.movie-grid {
  gap: 18px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
}

.movie-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: none;
  overflow: hidden;
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.movie-card:hover {
  transform: none;
  border-color: rgba(13, 115, 119, 0.28);
  box-shadow: var(--shadow);
}

.poster {
  background: linear-gradient(145deg, var(--navy), var(--red));
  border-radius: 0;
}

.poster-year {
  right: 8px;
  top: 8px;
  border-radius: 4px;
  background: var(--red3);
  color: #fff;
  backdrop-filter: none;
}

.movie-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 12px 12px 14px;
  min-height: 0;
}

.movie-title {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 16px;
  line-height: 1.35;
}

.movie-title:hover {
  color: var(--red);
}

.movie-info p {
  -webkit-line-clamp: 2;
}

.meta {
  margin-top: auto;
  padding-top: 8px;
}

.movie-card .card-tags {
  display: none;
}

.meta span,
.card-tags span,
.tag-cloud a,
.tag-cloud span {
  background: var(--soft);
  color: var(--red3);
  border: 1px solid var(--line);
  border-radius: 4px;
}

/* ── 编辑推荐 ── */
.featured-grid {
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-card {
  min-height: 260px;
  border-radius: var(--radius-lg);
}

.feature-card::after {
  background: linear-gradient(0deg, rgba(7, 38, 41, 0.94) 0%, rgba(7, 38, 41, 0.55) 42%, rgba(7, 38, 41, 0.12) 100%);
}

.feature-card div {
  left: 18px;
  right: 18px;
  bottom: 16px;
}

.feature-card strong {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feature-card p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── 榜单 ── */
.rank-layout {
  gap: 24px;
  grid-template-columns: minmax(0, 1fr);
}

.rank-layout:has(.side-card) {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.rank-list {
  gap: 8px;
}

.rank-copy {
  min-width: 0;
  overflow: hidden;
}

.rank-copy strong {
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rank-item {
  border-radius: var(--radius);
  border-color: var(--line);
  box-shadow: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.rank-item:hover {
  transform: none;
  border-color: var(--red);
  box-shadow: var(--shadow);
}

.rank-item:nth-child(1) .rank-no,
.rank-item:nth-child(2) .rank-no,
.rank-item:nth-child(3) .rank-no,
.rank-no {
  border-radius: 6px;
  background: var(--red3);
}

.rank-item:nth-child(1) .rank-no {
  background: var(--accent);
  color: var(--navy);
}

.rank-item:nth-child(2) .rank-no {
  background: #8aa3a0;
  color: #fff;
}

.rank-item:nth-child(3) .rank-no {
  background: #b8893d;
  color: #fff;
}

.rank-item img {
  border-radius: 6px;
  background: var(--soft);
}

.rank-heat {
  color: var(--red);
}

.side-card .rank-list .rank-item {
  grid-template-columns: 32px 48px minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
}

.side-card .rank-list .rank-no {
  width: 32px;
  height: 32px;
  font-size: 13px;
  border-radius: 6px;
}

.side-card .rank-list .rank-item img {
  width: 48px;
  height: 64px;
}

.side-card .rank-list .rank-heat {
  display: none;
}

.side-card .rank-list .rank-copy strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
}

.side-card .rank-list .rank-copy em {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 搜索与筛选 ── */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: none;
}

.search-box {
  border-radius: 8px;
  border-color: var(--line);
  background: var(--bg);
  box-shadow: none;
  min-width: 200px;
}

.search-box:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(13, 115, 119, 0.14);
  background: #fff;
}

.filter-row {
  gap: 8px;
  flex-wrap: wrap;
  overflow: visible;
  padding-bottom: 0;
}

.filter-btn {
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--soft);
  color: var(--red3);
  border: 1px solid var(--line);
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--red3);
  color: #fff;
  border-color: var(--red3);
  box-shadow: none;
}

/* ── 分类页 / 播放页 ── */
.breadcrumb {
  padding-top: 0;
  margin: 0 0 12px;
  color: #9ec8c4;
}

.breadcrumb a {
  color: var(--accent);
  font-weight: 600;
}

.detail-hero {
  padding: 28px 0 40px;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
}

.detail-grid {
  align-items: center;
}

.detail-poster {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  background: var(--navy);
  overflow: hidden;
}

.detail-poster img {
  border-radius: 0;
}

.detail-title {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.15;
}

.detail-meta span {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

.detail-one {
  color: #d5e8e5;
}

.player-wrap {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: none;
  background: #06191b;
  overflow: hidden;
}

.player-wrap video {
  width: 100%;
  max-height: min(72vh, 720px);
  background: #000;
}

.content-card,
.side-card {
  border-radius: var(--radius-lg);
  border-color: var(--line);
  box-shadow: none;
}

.side-card h3 {
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--accent);
}

.mini-card {
  border-radius: var(--radius);
  border-color: var(--line);
  box-shadow: none;
}

.mini-card:hover {
  border-color: var(--red);
  transform: none;
  box-shadow: var(--shadow);
}

.mini-card img {
  border-radius: 6px;
  background: var(--soft);
}

/* ── 页脚 ── */
.footer {
  margin-top: 0;
  background: #e8f0ee;
  color: #3d5558;
  border-top: 2px solid var(--red3);
}

.footer-grid {
  padding: 40px 0 28px;
  align-items: start;
}

.footer-brand {
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
  color: var(--red3);
}

.footer h3 {
  color: var(--ink);
}

.footer p {
  color: var(--muted);
}

.footer a {
  color: #3d5558;
}

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

.footer-bottom {
  background: var(--navy);
  border-top: none;
  color: #8fb8b4;
}

.footer-bottom a {
  color: #d4c49a;
}

.tag-cloud a,
.tag-cloud span {
  display: inline-block;
  margin: 0 8px 8px 0;
  padding: 4px 10px;
  text-decoration: none;
}

/* ── 播放错误 / 加载 ── */
.player-error {
  margin: 0;
  padding: 14px 18px;
  background: rgba(13, 115, 119, 0.1);
  color: var(--red3);
  font-size: 14px;
  font-weight: 700;
}

.app-bootstrap {
  display: grid;
  place-items: center;
  min-height: 70dvh;
  padding: 24px;
  text-align: center;
  background: linear-gradient(160deg, var(--navy), var(--red3), #13686c);
  color: #fff;
}

.app-bootstrap__spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.24);
  border-top-color: var(--accent);
  animation: appBootstrapSpin 0.9s linear infinite;
  margin: 0 auto 14px;
}

.app-bootstrap__msg {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.82);
}

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

.bbaaseo-float {
  position: fixed;
  right: 22px;
  bottom: 88px;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 9px;
  pointer-events: none;
  user-select: none;
  animation: bbaaseoFly 3.6s ease-in-out infinite;
}

.bbaaseo-tg {
  width: 30px;
  height: 30px;
  fill: #2aabee;
  filter: drop-shadow(0 6px 14px rgba(42, 171, 238, 0.35));
}

.bbaaseo-text {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #2aabee;
  text-shadow: 0 2px 10px rgba(42, 171, 238, 0.28);
}

@keyframes bbaaseoFly {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-16px);
  }
}

.content-card h2 {
  color: var(--ink);
}

.content-card p {
  color: #3d5558;
}

/* ── 响应式 ── */
@media (max-width: 1100px) {
  .nav-links {
    gap: 2px;
  }

  .nav-link {
    font-size: 12px;
    padding: 6px 8px;
  }

  .hero-carousel,
  .hero-content {
    height: 480px;
    min-height: 480px;
    max-height: 480px;
  }

  .hero-content {
    grid-template-columns: 1fr;
    padding: 32px 0 44px;
  }

  .hero-panel {
    display: none;
  }

  .rank-layout,
  .article-grid {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 820px) {
  .topbar {
    padding-top: env(safe-area-inset-top, 0);
  }

  .nav-wrap {
    min-height: 56px;
  }

  .nav-links {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .hero-carousel,
  .hero-content {
    height: 440px;
    min-height: 440px;
    max-height: 440px;
  }

  .hero-content {
    padding: 28px 0 40px;
  }

  .hero-title {
    font-size: clamp(28px, 7vw, 40px);
  }

  .section {
    padding: 36px 0;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    padding: 12px;
  }

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

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

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-poster {
    max-width: 260px;
    margin: 0 auto;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .rank-item {
    grid-template-columns: 40px 56px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .rank-item img {
    width: 56px;
    height: 74px;
  }

  .rank-no {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .rank-heat {
    display: none;
  }

  .player-wrap video {
    max-height: 56vh;
  }
}

@media (max-width: 560px) {
  .wrap {
    width: min(1180px, calc(100% - 24px));
  }

  .brand strong {
    font-size: 17px;
  }

  .hero-title {
    font-size: 28px;
  }

  .hero-actions {
    display: grid;
    gap: 10px;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .btn {
    width: auto;
  }

  .category-grid,
  .stat-grid,
  .featured-grid {
    grid-template-columns: 1fr;
  }

  .movie-info {
    padding: 12px;
  }

  .movie-title {
    font-size: 15px;
  }

  .stat-card strong {
    font-size: 28px;
  }

  .detail-title {
    font-size: 28px;
  }

  .content-card {
    padding: 20px;
  }

  .hero-desc {
    font-size: 15px;
  }

  .rank-copy em {
    display: none;
  }

  .bbaaseo-float {
    right: max(14px, env(safe-area-inset-right, 0));
    bottom: calc(72px + env(safe-area-inset-bottom, 0));
  }

  .bbaaseo-tg {
    width: 24px;
    height: 24px;
  }

  .bbaaseo-text {
    font-size: 13px;
  }
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 80;
  padding: 8px 14px;
  background: #0a4d51;
  color: #fff8e8;
  border-radius: 6px;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
