:root {
  color-scheme: dark;
  --bg: #08080a;
  --panel: #121216;
  --panel-2: #191920;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --fg: #f4f2ee;
  --text: var(--fg);
  --muted: #a3a1ac;
  --accent: #d81f26;
  --accent-2: #ff4d4d;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC",
    "Hiragino Sans", "Microsoft JhengHei", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-2); }
img { max-width: 100%; }
::selection { background: rgba(216, 31, 38, 0.5); color: #fff; }

.shell {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 18px;
}

@media (min-width: 1440px) {
  .shell { width: 85vw; max-width: none; }
}

/* reading progress */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(8, 8, 10, 0.78);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  border-bottom: 1px solid var(--line);
  transition: background 240ms ease, box-shadow 240ms ease;
}
.site-header.is-scrolled {
  background: rgba(8, 8, 10, 0.95);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
}
.site-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(216, 31, 38, 0.65), transparent);
  opacity: 0.8;
  pointer-events: none;
}

.head-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 66px;
  flex-wrap: wrap;
  padding-top: 10px;
  padding-bottom: 10px;
}

.logo {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.02em;
  color: var(--fg);
  white-space: nowrap;
}
.logo:hover { color: var(--accent-2); }

.main-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.main-nav a { color: var(--muted); font-size: 15px; white-space: nowrap; }
.main-nav a:hover { color: var(--fg); }

.search { display: flex; gap: 8px; margin-left: auto; }
.search input {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--fg);
  padding: 8px 12px;
  font-size: 15px;
  min-width: 0;
  width: 220px;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.search button {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 15px;
  cursor: pointer;
}
.search.big { margin: 0 0 20px; max-width: 680px; flex-wrap: wrap; }
.search.big input { flex: 1 1 180px; width: auto; }
.search.big select {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--fg);
  padding: 8px 12px;
  font-size: 15px;
}

/* blocks */
main.shell { padding-top: 26px; padding-bottom: 60px; }

.hero {
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 100% 0%, rgba(216, 31, 38, 0.09), transparent 55%), var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(28px, 3.2vw, 44px) clamp(22px, 3vw, 40px);
  margin-bottom: 36px;
}
.hero::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 65%);
}
.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 3.4vw, 46px);
  line-height: 1.18;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.hero p { margin: 0; color: var(--muted); max-width: 640px; }

/* cinema hero — the one bold moment */
.hero--cinema {
  min-height: clamp(380px, 44vw, 540px);
  display: flex;
  isolation: isolate;
  padding: 0;
  border-radius: 18px;
}
.hero-backdrop {
  position: absolute;
  inset: -30px;
  z-index: -2;
  overflow: hidden;
}
.hero-backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 24%;
  filter: saturate(0.55) brightness(0.42) blur(14px);
  transform: scale(1.1);
}
.hero-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 88% 18%, rgba(216, 31, 38, 0.18), transparent 42%),
    linear-gradient(90deg, rgba(8, 8, 10, 0.97) 0%, rgba(8, 8, 10, 0.86) 40%, rgba(8, 8, 10, 0.42) 100%),
    linear-gradient(0deg, var(--bg) 0%, transparent 58%);
}
.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(24px, 4vw, 64px);
  width: 100%;
  min-height: inherit;
  padding: clamp(30px, 5vw, 72px);
}
.hero-copy { max-width: 640px; }
.hero--cinema h1 {
  margin: 0;
  font-size: clamp(40px, 6.4vw, 92px);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.03em;
  text-wrap: balance;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.55);
}
.hero-line { display: block; }
.hero .hero-lede {
  margin-top: 22px;
  color: #e6e4ea;
  font-size: clamp(15px, 1.25vw, 18px);
  line-height: 1.8;
  max-width: 560px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.hero-poster {
  flex: 0 0 auto;
  width: clamp(150px, 19vw, 264px);
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), 0 0 0 6px rgba(255, 255, 255, 0.025);
  transform: rotate(3deg);
}
.hero-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }

.block { margin-bottom: 44px; }

.block-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.block-head h1,
.block-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.block-head .more { margin-left: auto; color: var(--muted); font-size: 14px; }
.block-head .count { color: var(--muted); font-size: 14px; }
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 14px;
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--fg); text-decoration: underline; }
.crumbs-sep { opacity: 0.55; }
.crumbs-cur { color: var(--fg); }

/* grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 20px 14px;
}
.card { min-width: 0; }
.card .thumb {
  position: relative;
  display: block;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(160deg, var(--panel-2), #101014);
  border: 1px solid var(--line);
}
.card .thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: inherit;
  pointer-events: none;
}
.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}
.noimg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  font-size: 13px;
  background: var(--panel-2);
}
.badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  font-size: 11px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(8, 8, 10, 0.86);
  border: 1px solid var(--line-2);
  color: #fff;
}
.badge.r { right: 8px; bottom: 8px; left: auto; color: #efc96b; }
.card h3 {
  margin: 9px 0 2px;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card .meta {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* pager */
.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 26px;
  font-size: 14px;
}
.pager a, .pager span {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--fg);
}
.pager a:hover { border-color: var(--accent); color: var(--accent-2); }
.pager .cur { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager .disabled { color: #5d5b66; }
.pager .dots { border: 0; background: none; }

/* categories */
.category-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.category-link {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}
.category-link:hover { border-color: var(--accent); color: var(--accent-2); }
.category-link.disabled { color: var(--muted); cursor: default; opacity: 0.72; }
.category-link.disabled small { font-size: 0.8em; color: var(--muted); }
.category-link span { color: var(--muted); font-size: 0.85em; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
  font-size: 14px;
}
.tag-chip:hover, .tag-chip.active { border-color: var(--accent); color: var(--accent-2); background: rgba(216, 31, 38, 0.08); }
.tag-chip small { color: var(--muted); font-size: 0.8em; }
.watch-toggle {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  margin-top: 6px;
}
.watch-toggle:hover, .watch-toggle.on { border-color: var(--accent); color: var(--accent-2); background: rgba(216, 31, 38, 0.1); }

/* watch actions */
.watch-actions { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.watch-actions button {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}
.watch-actions button:hover { border-color: var(--accent); color: var(--accent-2); }

/* progress */
.progress { color: var(--muted); font-size: 12px; }

/* admin stats table */
.stats-table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.stats-table th, .stats-table td { border: 1px solid var(--line); padding: 8px 11px; text-align: left; font-size: 14px; }
.stats-table th { background: var(--panel); color: var(--text); font-weight: 600; }
.stats-table td:not(:first-child) { font-variant-numeric: tabular-nums; }
.stats-table tbody tr:hover { background: rgba(216, 31, 38, 0.06); }
.stats-table tfoot td { font-weight: 700; border-top: 2px solid var(--line-2); }

/* detail hero */
.detail { margin-bottom: 36px; }
.detail-hero {
  position: relative;
  min-height: clamp(360px, 40vw, 500px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  isolation: isolate;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.detail-hero-media { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.detail-hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: saturate(0.72) brightness(0.62);
  transform: scale(1.03);
}
.detail-hero-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 85% 10%, rgba(216, 31, 38, 0.14), transparent 45%),
    linear-gradient(90deg, rgba(8, 8, 10, 0.96) 0%, rgba(8, 8, 10, 0.8) 45%, rgba(8, 8, 10, 0.28) 100%),
    linear-gradient(0deg, var(--bg) 0%, transparent 65%);
}
.detail-hero-copy {
  position: relative;
  z-index: 1;
  padding: clamp(26px, 4vw, 56px);
  max-width: 800px;
}
.detail-kicker {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--accent-2);
}
.detail-hero-copy h1 {
  margin: 0;
  font-size: clamp(30px, 4.4vw, 64px);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.02em;
  text-wrap: balance;
  text-shadow: 0 4px 28px rgba(0, 0, 0, 0.6);
}
.detail-hero-copy .meta, .detail-hero-copy .rating { margin: 8px 0 0; color: #dedce3; font-size: 14px; }
.detail-hero-copy .excerpt {
  margin: 16px 0 0;
  color: #d0ced6;
  font-size: 15px;
  line-height: 1.8;
  max-width: 640px;
}
.detail-hero-copy .btn { margin-top: 20px; }
.genres { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.tag {
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 13px;
  color: #e6e4ea;
}

/* buttons */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 9px;
  padding: 11px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 8px 24px rgba(216, 31, 38, 0.22);
  transition: transform 200ms ease, box-shadow 200ms ease, background 200ms ease;
}
.btn:hover { color: #fff; background: var(--accent-2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 12px 30px rgba(216, 31, 38, 0.32); }
.btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.btn.ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-2);
  box-shadow: none;
  color: var(--fg);
}
.btn.ghost:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--accent); color: var(--fg); }

/* player */
.player {
  margin-top: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(216, 31, 38, 0.12), transparent 42%),
    #070709;
  border: 1px solid #33333d;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  position: relative;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.36), 0 0 0 1px rgba(255, 255, 255, 0.025) inset;
}
.player::before {
  content: '';
  position: absolute;
  z-index: 2;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  opacity: 0.9;
  pointer-events: none;
}
.player video { width: 100%; height: 100%; display: block; background: #050506; object-fit: contain; }
.player iframe { width: 100%; height: 100%; border: 0; display: block; }
.player:focus-within { outline: 2px solid rgba(255, 77, 77, 0.55); outline-offset: 3px; }
.player-msg {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  color: #c8c8d0;
  font-size: 15px;
  background: radial-gradient(circle, rgba(35, 35, 43, 0.35), rgba(5, 5, 6, 0.78));
}
.player-msg.error { color: #ff9b9b; }

/* sources */
.sources {
  margin-top: 0;
  padding: 18px 20px 20px;
  background: linear-gradient(180deg, #17171c, #111115);
  border: 1px solid #2c2c34;
  border-top: 0;
  border-radius: 0 0 14px 14px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}
.sources h2 { font-size: 16px; margin: 0 0 10px; }
.sources .group { margin-bottom: 16px; }
.sources .group:last-child { margin-bottom: 0; }
.sources .group-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #b7b7c2;
  margin-bottom: 9px;
}
.sources .group-label::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 12px rgba(255, 77, 77, 0.7);
}
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btns button {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid #363640;
  color: #dedee5;
  border-radius: 8px;
  padding: 7px 13px;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.btns button:hover { border-color: var(--accent-2); background: rgba(216, 31, 38, 0.12); transform: translateY(-1px); }
.btns button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.btns button.on { background: linear-gradient(135deg, var(--accent), #a91118); border-color: #ff5656; color: #fff; box-shadow: 0 5px 18px rgba(216, 31, 38, 0.24); }

.empty { color: var(--muted); }
.notfound { text-align: center; padding: 60px 0; }
.notfound .btn { margin: 6px; }

/* footer */
.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0 40px;
  overflow: hidden;
}
.footer-wordmark {
  color: rgba(255, 255, 255, 0.055);
  font-size: clamp(64px, 13vw, 180px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.04em;
  white-space: nowrap;
  margin-bottom: 14px;
  user-select: none;
}
.site-footer p { margin: 0; }

/* fine-pointer only motion */
@media (hover: hover) and (pointer: fine) {
  .card:hover .thumb { border-color: var(--line-2); }
  .card:hover .thumb img { transform: scale(1.045); }
  .btn:hover { transform: translateY(-1px); }
}

@media (max-width: 720px) {
  .head-inner { gap: 8px 10px; }
  .logo { order: 1; font-size: 18px; }
  .search { order: 2; width: 100%; margin-left: 0; }
  .search input { flex: 1; width: auto; }
  .main-nav {
    order: 3;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 18px;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .main-nav::-webkit-scrollbar { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 14px 10px; }
  .hero { padding: 26px 20px; margin-bottom: 28px; }
  .hero h1 { font-size: 28px; }
  .hero--cinema { min-height: 430px; }
  .hero-inner { padding: 26px 20px; }
  .hero--cinema h1 { font-size: clamp(34px, 9.4vw, 48px); }
  .hero .hero-lede { font-size: 15px; margin-top: 16px; color: #e6e4ea; }
  .hero-actions { margin-top: 22px; }
  .hero-poster { display: none; }
  .detail-hero { min-height: 380px; }
  .detail-hero-copy h1 { font-size: clamp(26px, 7vw, 38px); }
  .detail-hero-copy { padding: 24px 20px; }
  .sources { padding: 15px 14px 16px; }
  .sources .group-label { font-size: 11px; }
  .btns button { padding: 7px 10px; font-size: 13px; }
  .footer-wordmark { font-size: 18vw; }
  .card:hover .thumb img { transform: none; }
  .btn:hover { transform: none; }
  .hero-backdrop img, .detail-hero-media img { filter: saturate(0.7) brightness(0.5); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .card:hover .thumb img, .btn:hover, .btns button:hover { transform: none !important; }
}
