:root {
  color-scheme: light;
  --bg: #f5f1eb;
  --panel: #fffdf8;
  --text: #2f3431;
  --muted: #7a817d;
  --line: #ded8cf;
  --brand: #8aa39b;
  --brand-strong: #637d75;
  --accent: #b98f84;
  --accent-strong: #9d7169;
  --soft: #e9e1d8;
  --shadow: 0 14px 34px rgba(70, 77, 72, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(138, 163, 155, 0.18), transparent 300px),
    var(--bg);
  color: var(--text);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

body.modal-open {
  overflow: hidden;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: max-content minmax(260px, 520px);
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid rgba(223, 228, 222, 0.8);
  background: rgba(245, 241, 235, 0.9);
  backdrop-filter: blur(14px);
}

.header-tools {
  display: grid;
  grid-template-columns: 86px minmax(160px, 1fr);
  gap: 10px;
  align-items: center;
}

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

.brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: block;
  border-radius: 10px;
}

.search input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.search input {
  padding: 0 14px;
}

select {
  padding: 0 34px 0 12px;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 54px;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.update-strip {
  color: var(--brand-strong);
  font-size: 13px;
  line-height: 1.5;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.tab[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.notice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 20px;
  padding: 12px 14px;
  border: 1px solid rgba(185, 143, 132, 0.26);
  border-radius: 8px;
  background: rgba(185, 143, 132, 0.14);
  color: #6e5a54;
  font-size: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}

.movie-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.poster-link {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--soft);
}

.poster {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 180ms ease;
}

.movie-card:hover .poster {
  transform: scale(1.035);
}

.badges {
  position: absolute;
  left: 10px;
  top: 10px;
  max-width: calc(100% - 20px);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(99, 125, 117, 0.92);
  color: #fffdf8;
  font-size: 12px;
  font-weight: 700;
}

.badge.tone-0 {
  background: rgba(99, 125, 117, 0.92);
}

.badge.tone-1 {
  background: rgba(185, 143, 132, 0.94);
}

.badge.tone-2 {
  background: rgba(141, 132, 116, 0.94);
}

.badge.tone-3 {
  background: rgba(126, 143, 154, 0.94);
}

.badge.tone-4 {
  background: rgba(157, 113, 105, 0.94);
}

.movie-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

.movie-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.movie-body h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.3;
  cursor: pointer;
}

.movie-body h2:hover {
  color: var(--brand-strong);
}

.movie-body h2 a {
  display: block;
}

.movie-body p {
  min-height: 66px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 9;
}

.download-list {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.download {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  text-align: center;
}

.download.secondary {
  background: var(--brand-strong);
}

.empty {
  padding: 36px 0;
  color: var(--muted);
  text-align: center;
}

.load-more {
  display: block;
  min-height: 42px;
  margin: 24px auto 0;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--brand-strong);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.load-more:hover {
  border-color: var(--brand);
  background: #f0ebe3;
}

.detail-modal[hidden] {
  display: none;
}

.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(47, 52, 49, 0.46);
}

.detail-dialog {
  position: relative;
  width: min(900px, 100%);
  max-height: min(860px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 22px 70px rgba(47, 52, 49, 0.24);
}

.detail-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: rgba(47, 52, 49, 0.68);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.detail-poster {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: cover;
  background: var(--soft);
}

.detail-content {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.detail-meta {
  color: var(--muted);
  font-size: 13px;
}

.detail-content h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.25;
}

.detail-content p,
.detail-body p {
  margin: 0;
  color: #4f5652;
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.detail-body {
  display: grid;
  gap: 12px;
}

.detail-images {
  display: grid;
  gap: 12px;
}

.detail-images:empty {
  display: none;
}

.detail-images img {
  width: 100%;
  max-height: 720px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--soft);
}

.detail-inline-image {
  width: 100%;
  max-height: 720px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--soft);
}

.detail-downloads {
  display: grid;
  gap: 8px;
}

.static-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.static-nav .tab {
  min-height: 36px;
  border-color: rgba(99, 125, 117, 0.35);
  color: var(--brand-strong);
  font-weight: 800;
}

.static-nav .nav-home {
  background: var(--brand);
  border-color: var(--brand);
  color: #fffdf8;
}

.static-nav .nav-today {
  background: rgba(185, 143, 132, 0.2);
  border-color: rgba(185, 143, 132, 0.45);
  color: var(--accent-strong);
}

.static-nav .nav-category {
  background: rgba(138, 163, 155, 0.16);
}

.static-page .site-header {
  grid-template-columns: max-content max-content;
}

.static-page main {
  width: min(980px, calc(100% - 32px));
}

.static-detail {
  position: static;
  width: min(920px, 100%);
  max-height: none;
  overflow: visible;
  margin: 0 auto;
}

.category-heading {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.category-heading h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.2;
}

.related-section {
  display: grid;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.related-heading {
  color: var(--brand-strong);
  font-size: 14px;
  font-weight: 800;
}

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

.related-links a {
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(99, 125, 117, 0.24);
  border-radius: 8px;
  background: rgba(138, 163, 155, 0.14);
  color: #506860;
  font-size: 13px;
  line-height: 1.35;
}

.related-links a:hover {
  border-color: var(--brand);
  background: rgba(138, 163, 155, 0.24);
}

@media (max-width: 680px) {
  .site-header {
    grid-template-columns: 1fr;
  }

  .site-header {
    position: static;
  }

  .header-tools {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .header-tools select {
    padding-left: 10px;
    padding-right: 20px;
  }

  .movie-body p {
    min-height: auto;
  }

  .static-page .site-header {
    grid-template-columns: 1fr;
  }

  .static-nav {
    justify-content: flex-start;
  }
}
