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

html {
  min-width: 320px;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg-soft) 78%, #000 22%) 0, var(--bg) 440px),
    var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

body.is-menu-open,
body.is-lights-off {
  overflow: hidden;
}

img,
svg,
video,
iframe,
embed,
object {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
  background: var(--surface-2);
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.container {
  width: min(100% - 24px, var(--container));
  margin-inline: auto;
  min-width: 0;
}

.sr-only,
.skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  padding: 10px 14px;
  color: var(--primary-contrast);
  background: var(--primary);
  border-radius: var(--radius-sm);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 120;
  min-height: var(--header-h);
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.header-inner {
  min-height: var(--header-h);
  display: grid;
  grid-template-columns: auto 44px;
  align-items: center;
  gap: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  flex: 0 0 auto;
  color: var(--primary-contrast);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.brand-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-toggle {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.nav-toggle-line {
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.site-nav {
  position: fixed;
  inset: calc(var(--header-h) + env(safe-area-inset-top)) 12px auto;
  display: none;
  max-height: calc(100vh - var(--header-h) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow: auto;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.site-nav.is-open {
  display: grid;
  gap: 4px;
}

.site-nav a,
.quick-types a,
.filter-list a,
.episode-list a,
.route-nav button,
.pager-btn,
.theme-switch button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  border-radius: var(--radius-sm);
}

.site-nav a {
  justify-content: flex-start;
  padding: 8px 10px;
  color: var(--muted);
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--text);
  background: var(--surface-2);
}

.header-search {
  grid-column: 1 / -1;
  display: flex;
  min-width: 0;
  gap: 8px;
}

.header-search input,
.search-panel input,
.gbook-form input,
.gbook-form textarea {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.header-search input {
  height: 42px;
  padding: 0 12px;
}

.header-search button {
  min-width: 64px;
  min-height: 42px;
  color: var(--primary-contrast);
  background: var(--primary);
  border: 0;
  border-radius: var(--radius);
  font-weight: 700;
}

.theme-switch {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: thin;
}

.theme-switch button {
  min-width: 40px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
}

.theme-switch button.is-active {
  color: var(--primary-contrast);
  background: var(--primary);
  border-color: transparent;
}

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

.section {
  padding: 28px 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  min-width: 0;
  gap: 14px;
  margin-bottom: 14px;
}

.section-head h2,
.page-hero h1,
.detail-info h1,
.player-head h1,
.article-header h1 {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.18;
}

.section-head h2 {
  font-size: 1.28rem;
}

.section-kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.section-more {
  flex: 0 0 auto;
  color: var(--primary);
  font-weight: 700;
}

.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  font-weight: 800;
}

.btn-primary {
  color: var(--primary-contrast);
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
  box-shadow: var(--shadow-soft);
}

.btn-ghost {
  color: var(--text);
  background: var(--surface);
}

.hero-slider {
  position: relative;
  min-height: 500px;
  overflow: hidden;
  background: var(--bg-soft);
}

.hero-track,
.hero-slide {
  min-height: 500px;
}

.hero-slide {
  position: relative;
  display: grid;
  align-items: end;
}

.hero-bg {
  position: absolute;
  inset: 0;
}

.hero-bg::after,
.detail-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--bg) 90%, transparent) 0, color-mix(in srgb, var(--bg) 54%, transparent) 54%, color-mix(in srgb, var(--bg) 15%, transparent) 100%),
    linear-gradient(180deg, transparent 0, var(--bg) 100%);
}

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

.hero-content {
  position: relative;
  z-index: 2;
  padding: 112px 0 34px;
}

.hero-kicker {
  margin: 0 0 8px;
  color: var(--primary);
  font-weight: 800;
}

.hero-title {
  max-width: 760px;
  margin: 0 0 12px;
  font-size: 2rem;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.hero-content p {
  max-width: 620px;
  margin: 0 0 16px;
  color: var(--muted);
}

.hero-tags,
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.hero-tags span,
.detail-tags span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.hero-actions,
.detail-actions,
.player-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-types {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 0 4px;
  scrollbar-width: thin;
}

.quick-types a {
  flex: 0 0 auto;
  padding: 0 14px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
}

.vod-grid,
.art-grid,
.topic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.art-grid,
.topic-grid {
  grid-template-columns: 1fr;
}

.vod-card,
.art-card,
.topic-card,
.gbook-item {
  min-width: 0;
}

.vod-poster,
.art-cover,
.topic-card a {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--radius);
}

.vod-poster {
  aspect-ratio: 2 / 3;
}

.art-cover,
.topic-card a {
  aspect-ratio: 16 / 9;
}

.vod-poster img,
.art-cover img,
.topic-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vod-remarks,
.play-badge,
.topic-card span {
  position: absolute;
  z-index: 2;
}

.vod-remarks {
  left: 8px;
  right: 8px;
  bottom: 8px;
  min-width: 0;
  padding: 4px 8px;
  overflow: hidden;
  color: #fff;
  background: rgba(0, 0, 0, .56);
  border-radius: var(--radius-sm);
  font-size: .78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-badge {
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--primary-contrast);
  background: var(--primary);
  border-radius: 50%;
}

.vod-card-body,
.art-card-body {
  min-width: 0;
  padding: 8px 2px 0;
}

.vod-card h3,
.art-card h3 {
  margin: 0;
  font-size: .94rem;
  line-height: 1.35;
}

.vod-card h3 a,
.art-card h3 a,
.rank-title {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.vod-card p,
.art-card p {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--weak);
  font-size: .82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vod-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 5px;
  color: var(--primary);
  font-size: .8rem;
}

.split-section {
  display: grid;
  gap: 24px;
}

.panel {
  min-width: 0;
}

.rank-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.rank-item a {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.rank-index {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--primary-contrast);
  background: var(--primary);
  border-radius: var(--radius-sm);
  font-weight: 800;
}

.rank-score {
  color: var(--accent);
  font-weight: 800;
}

.page-hero {
  padding: 28px 0 12px;
}

.compact-hero {
  padding-top: 24px;
}

.page-hero h1 {
  margin-top: 10px;
  font-size: 1.8rem;
}

.page-hero p {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--weak);
  font-size: .88rem;
}

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

.filter-panel,
.search-panel,
.gbook-form {
  display: grid;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.filter-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.filter-label {
  color: var(--weak);
  font-weight: 800;
  line-height: 40px;
}

.filter-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.filter-list a {
  flex: 0 0 auto;
  scroll-snap-align: start;
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.filter-list a.is-active {
  color: var(--primary-contrast);
  background: var(--primary);
  border-color: transparent;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.pager-btn,
.pager-current {
  min-width: 42px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.pager-current {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  color: var(--text);
}

.detail-hero {
  position: relative;
  overflow: hidden;
  padding: 28px 0;
}

.detail-bg {
  position: absolute;
  inset: 0;
  opacity: .58;
}

.detail-grid {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 18px;
}

.detail-poster {
  width: min(220px, 68vw);
}

.detail-poster img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.detail-info {
  min-width: 0;
}

.detail-info h1,
.player-head h1,
.article-header h1 {
  margin-top: 10px;
  font-size: 1.9rem;
}

.meta-list {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}

.meta-list div {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 10px;
}

.meta-list dt {
  color: var(--weak);
  font-weight: 800;
}

.meta-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
}

.detail-desc,
.article-body {
  max-width: 860px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

[data-collapsible].is-collapsed {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.collapse-toggle {
  min-height: 40px;
  margin-top: 8px;
  padding: 0;
  color: var(--primary);
  background: transparent;
  border: 0;
  font-weight: 800;
}

.route-tabs,
.route-shell {
  display: grid;
  gap: 14px;
}

.route-panel {
  min-width: 0;
}

.route-panel h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.episode-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.episode-list a {
  flex: 0 0 auto;
  min-width: 54px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
}

.episode-list a.is-current {
  color: var(--primary-contrast);
  background: var(--primary);
  border-color: transparent;
}

.play-main {
  background: var(--bg);
}

.player-stage {
  position: relative;
  z-index: 20;
  padding: 20px 0 8px;
  background: color-mix(in srgb, var(--bg-soft) 84%, #000 16%);
  border-bottom: 1px solid var(--line);
}

.player-head {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.player-wrap iframe,
.player-wrap video,
.player-wrap embed,
.player-wrap object,
.player-wrap > div {
  width: 100%;
  height: 100%;
}

.player-empty {
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.player-wrap.is-wide {
  border-radius: 0;
}

.route-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.route-nav button {
  flex: 0 0 auto;
  padding: 0 14px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
}

.route-nav button.is-active {
  color: var(--primary-contrast);
  background: var(--primary);
  border-color: transparent;
}

.route-shell .route-panel {
  display: none;
}

.route-shell .route-panel.is-active {
  display: block;
}

.search-panel {
  grid-template-columns: 1fr;
  margin-bottom: 18px;
}

.search-panel input {
  min-height: 44px;
  padding: 0 12px;
}

.art-card,
.topic-card,
.gbook-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.art-card-body {
  padding: 12px;
}

.art-card-body time {
  display: block;
  margin-top: 8px;
  color: var(--weak);
  font-size: .82rem;
}

.topic-card span {
  left: 10px;
  right: 10px;
  bottom: 10px;
  padding: 8px 10px;
  overflow: hidden;
  color: #fff;
  background: rgba(0, 0, 0, .58);
  border-radius: var(--radius-sm);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-page {
  padding: 26px 0 40px;
}

.article-header {
  margin: 10px 0 18px;
}

.article-header time {
  display: block;
  margin-top: 8px;
  color: var(--weak);
}

.article-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin-bottom: 18px;
  border-radius: var(--radius);
}

.article-body {
  font-size: 1rem;
}

.article-body img {
  border-radius: var(--radius);
}

.gbook-layout {
  display: grid;
  gap: 18px;
}

.jump-page {
  min-height: 42vh;
  display: grid;
  align-content: center;
}

.jump-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.gbook-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.gbook-form input,
.gbook-form textarea {
  padding: 10px 12px;
}

.gbook-list {
  display: grid;
  gap: 12px;
}

.gbook-item {
  padding: 14px;
}

.gbook-item h2 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.gbook-item p {
  margin: 0;
  color: var(--muted);
}

.gbook-reply {
  margin-top: 10px;
  padding: 10px;
  color: var(--text);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.site-footer {
  margin-top: 24px;
  padding: 28px 0 calc(28px + env(safe-area-inset-bottom));
  color: var(--muted);
  background: color-mix(in srgb, var(--bg-soft) 86%, #000 14%);
  border-top: 1px solid var(--line);
}

.footer-grid {
  display: grid;
  gap: 18px;
}

.footer-brand {
  margin-bottom: 8px;
}

.site-footer p {
  max-width: 680px;
  margin: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.footer-links a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.back-top {
  position: fixed;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 110;
  width: 44px;
  height: 44px;
  display: none;
  place-items: center;
  color: var(--primary-contrast);
  background: var(--primary);
  border: 0;
  border-radius: 50%;
  box-shadow: var(--shadow);
}

.back-top.is-visible {
  display: grid;
}

.light-mask {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  background: rgba(0, 0, 0, .86);
}

body.is-lights-off .light-mask {
  display: block;
}

body.is-lights-off .site-header {
  z-index: 8;
}

body.is-lights-off .player-stage {
  z-index: 60;
}

@media (min-width: 360px) {
  .container {
    width: min(100% - 28px, var(--container));
  }

  .vod-grid {
    gap: 14px;
  }
}

@media (min-width: 390px) {
  .hero-title,
  .detail-info h1,
  .player-head h1 {
    font-size: 2.12rem;
  }
}

@media (min-width: 430px) {
  .container {
    width: min(100% - 32px, var(--container));
  }

  .search-panel {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (min-width: 768px) {
  body {
    font-size: 16px;
  }

  .header-inner {
    grid-template-columns: auto minmax(0, 1fr) minmax(220px, 300px);
  }

  .nav-toggle {
    display: none;
  }

  .site-nav {
    position: static;
    display: flex;
    max-height: none;
    overflow: visible;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .site-nav a {
    padding: 0 8px;
    min-height: 38px;
    white-space: nowrap;
  }

  .header-search {
    grid-column: auto;
  }

  .theme-switch {
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-bottom: 8px;
  }

  .hero-title {
    font-size: 3rem;
  }

  .section {
    padding: 36px 0;
  }

  .vod-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }

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

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

  .split-section,
  .detail-grid,
  .gbook-layout {
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  }

  .detail-poster {
    width: 280px;
  }

  .player-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .footer-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }
}

@media (min-width: 1024px) {
  .header-inner {
    grid-template-columns: auto minmax(0, 1fr) minmax(280px, 360px) auto;
  }

  .theme-switch {
    grid-column: auto;
    padding-bottom: 0;
  }

  .hero-slider,
  .hero-track,
  .hero-slide {
    min-height: 560px;
  }

  .hero-content {
    padding-bottom: 64px;
  }

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

  .vod-grid.compact {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

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

  .detail-grid {
    grid-template-columns: 320px minmax(0, 1fr);
    align-items: end;
  }

  .detail-poster {
    width: 320px;
  }

  .detail-info h1,
  .player-head h1,
  .article-header h1 {
    font-size: 2.6rem;
  }
}

@media (min-width: 1280px) {
  .hero-title {
    font-size: 3.4rem;
  }

  .section-head h2 {
    font-size: 1.45rem;
  }

  .vod-grid {
    gap: 18px;
  }
}
