:root {
  --ink: #172032;
  --muted: #6d7688;
  --line: rgba(95, 117, 148, 0.18);
  --glass: rgba(255, 255, 255, 0.68);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --blue: #4f8cff;
  --cyan: #2dc7c9;
  --gold: #d6a84d;
  --shadow: 0 24px 80px rgba(46, 68, 102, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 15% 12%, rgba(111, 199, 255, 0.28), transparent 30%),
    radial-gradient(circle at 82% 8%, rgba(255, 214, 132, 0.26), transparent 28%),
    linear-gradient(135deg, #f8fbff 0%, #edf7f7 50%, #fffaf1 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  min-height: 100%;
  margin: 0;
  letter-spacing: 0;
}

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

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

button,
input {
  font: inherit;
}

.site-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 36px;
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr minmax(260px, 360px);
  align-items: center;
  gap: 24px;
  min-height: 72px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 14px 60px rgba(39, 61, 94, 0.12);
  backdrop-filter: blur(22px) saturate(160%);
}

.topbar.is-scrolled {
  background: rgba(255, 255, 255, 0.82);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 12px 24px rgba(79, 140, 255, 0.24);
}

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

.nav a,
.filters a,
.pagination a,
.pagination span,
.episode-grid a {
  border: 1px solid transparent;
  border-radius: 8px;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.nav a {
  padding: 10px 13px;
  color: var(--muted);
  font-weight: 650;
}

.nav a:hover,
.nav a.is-active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
  border-color: var(--line);
}

.quick-search {
  display: flex;
  gap: 8px;
}

.quick-search input,
.search-hero input,
.admin-login input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
  outline: none;
  background: rgba(255, 255, 255, 0.72);
}

.quick-search input:focus,
.search-hero input:focus,
.admin-login input:focus {
  border-color: rgba(79, 140, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(79, 140, 255, 0.12);
}

.quick-search button,
.search-hero button,
.button {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 12px 28px rgba(79, 140, 255, 0.24);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font-weight: 750;
}

.button.ghost {
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: none;
}

.glass-panel {
  border: 1px solid rgba(255, 255, 255, 0.74);
  background: var(--glass);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(24px) saturate(155%);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 360px);
  gap: 34px;
  min-height: 520px;
  margin-top: 28px;
  padding: 64px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  background: rgba(255, 255, 255, 0.42);
  box-shadow: var(--shadow);
}

.hero-bg,
.detail-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(30px);
  opacity: 0.2;
  transform: scale(1.08);
}

.hero::after,
.detail-hero::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.48)),
    radial-gradient(circle at 85% 30%, rgba(79, 140, 255, 0.22), transparent 32%);
}

.hero-content,
.hero-poster,
.detail-poster,
.detail-info {
  position: relative;
  z-index: 1;
}

.hero-content {
  align-self: center;
  max-width: 780px;
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 14px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.hero h1 {
  max-width: 820px;
  margin-bottom: 18px;
  font-size: clamp(42px, 7vw, 92px);
  line-height: 0.98;
}

.hero p {
  max-width: 680px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-poster {
  align-self: center;
  padding: 12px;
  border-radius: 8px;
}

.hero-poster img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 8px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 42px 0 18px;
}

.section-head h2 {
  margin-bottom: 5px;
  font-size: 28px;
}

.section-head p,
.footer,
.movie-meta p,
.page-title p,
.search-hero p,
.admin-top p {
  color: var(--muted);
}

.section-head > a {
  color: var(--blue);
  font-weight: 750;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 750;
}

.chip span {
  color: var(--muted);
  font-weight: 700;
}

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

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

.movie-card {
  overflow: hidden;
  border-radius: 8px;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.movie-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 28px 86px rgba(42, 64, 96, 0.2);
}

.poster {
  position: relative;
  display: block;
  background: rgba(255, 255, 255, 0.52);
}

.poster img,
.poster-empty {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

.poster-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
  background: linear-gradient(135deg, rgba(79, 140, 255, 0.14), rgba(45, 199, 201, 0.18));
}

.badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  padding: 6px 8px;
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(23, 32, 50, 0.72);
  backdrop-filter: blur(10px);
}

.movie-meta {
  padding: 13px;
}

.movie-meta h3 {
  margin-bottom: 6px;
  overflow: hidden;
  font-size: 16px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.movie-meta p {
  min-height: 22px;
  margin-bottom: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-title,
.search-hero {
  margin-top: 28px;
  padding: 36px;
  border-radius: 8px;
}

.page-title h1,
.search-hero h1,
.admin-top h1 {
  margin-bottom: 10px;
  font-size: 42px;
}

.filters {
  display: grid;
  gap: 14px;
  margin: 20px 0 24px;
  padding: 18px;
  border-radius: 8px;
}

.filters div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.filters strong {
  margin-right: 4px;
}

.filters a,
.episode-grid a,
.pagination a,
.pagination span {
  padding: 9px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.44);
}

.filters a.is-active,
.filters a:hover,
.episode-grid a.is-active,
.episode-grid a:hover,
.pagination a:hover {
  color: var(--ink);
  border-color: rgba(79, 140, 255, 0.24);
  background: rgba(255, 255, 255, 0.82);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 30px 0 0;
}

.detail-hero {
  position: relative;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 28px;
  margin-top: 28px;
  padding: 34px;
  overflow: hidden;
  border-radius: 8px;
}

.detail-poster {
  padding: 12px;
  border-radius: 8px;
}

.detail-poster img,
.detail-poster .poster-empty {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 8px;
}

.detail-info {
  padding: 32px;
  border-radius: 8px;
}

.detail-info h1 {
  margin-bottom: 12px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.08;
}

.subtitle,
.summary,
.credits dd {
  color: var(--muted);
  line-height: 1.75;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.meta-line span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.54);
}

.credits {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 8px 12px;
  margin: 0 0 24px;
}

.credits dt {
  color: var(--ink);
  font-weight: 800;
}

.credits dd {
  margin: 0;
}

.episode-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px;
  border-radius: 8px;
}

.player-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  margin-top: 28px;
  padding: 18px;
  border-radius: 8px;
}

.player-stage {
  overflow: hidden;
  border-radius: 8px;
  background: #0d1424;
}

.player-stage video,
.player-stage iframe,
.player-empty {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

.player-empty {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.74);
}

.player-info {
  padding: 16px 10px;
}

.player-info h1 {
  font-size: 28px;
  line-height: 1.25;
}

.search-hero form {
  display: flex;
  gap: 10px;
  max-width: 760px;
  margin: 22px 0 0;
}

.notice,
.empty {
  margin-top: 22px;
  padding: 20px;
  border-radius: 8px;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 46px;
  padding: 28px 0 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.62);
  color: var(--ink);
  font-size: 16px;
}

.footer strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 18px 52px rgba(50, 74, 108, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px) saturate(150%);
  font-weight: 850;
}

.clicky-badge {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

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

.admin-login {
  width: min(460px, 100%);
  margin: 10vh auto 0;
  padding: 34px;
  border-radius: 8px;
}

.admin-login form {
  display: grid;
  gap: 16px;
}

.admin-login label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.form-error {
  margin: 0;
  color: #bf2f38;
}

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

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat-card,
.admin-block {
  padding: 22px;
  border-radius: 8px;
}

.stat-card {
  display: grid;
  gap: 8px;
}

.stat-card span {
  color: var(--muted);
}

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

.visit-stat strong {
  color: var(--blue);
}

.admin-block {
  margin-top: 18px;
}

.field-map {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.field-map span {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.54);
}

.admin-table {
  display: grid;
  gap: 8px;
}

.admin-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 160px 100px;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.46);
}

.admin-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row.head {
  color: var(--muted);
  font-weight: 800;
  background: transparent;
}

.visit-table .admin-row {
  grid-template-columns: minmax(0, 1fr) 110px;
}

.empty-mini {
  padding: 12px;
  color: var(--muted);
}

@media (max-width: 1120px) {
  .movie-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .topbar {
    grid-template-columns: auto 1fr;
  }

  .quick-search {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .site-shell,
  .admin-page {
    width: min(100% - 20px, 720px);
  }

  .topbar {
    top: 8px;
    gap: 12px;
  }

  .nav {
    justify-content: flex-end;
  }

  .hero,
  .detail-hero,
  .player-shell {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding: 30px;
  }

  .hero-poster,
  .detail-poster {
    max-width: 260px;
  }

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

  .detail-hero,
  .detail-info,
  .page-title,
  .search-hero {
    padding: 22px;
  }

  .search-hero form,
  .admin-top {
    flex-direction: column;
    align-items: stretch;
  }

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

  .admin-row {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .admin-row span:nth-child(3),
  .admin-row span:nth-child(4) {
    display: none;
  }

  .visit-table .admin-row {
    grid-template-columns: minmax(0, 1fr) 84px;
  }
}

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

  .brand,
  .nav {
    justify-content: center;
  }

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

  .hero h1 {
    font-size: 42px;
  }

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

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

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