/* VIXEN
   片库设计：OLED 黑底，播放红只用于主动作。
   结构线用浅色发丝，不用 #312E81 当 1px 边框——它贴在纯黑上几乎看不见。
   焦点环用白色。正文对比按 4.5:1。 */
:root {
  --color-primary: #1a0a12;
  --color-secondary: #3a1024;
  --color-accent: #ff2d78;
  --color-on-accent: #1a0610;
  --color-background: #070607;
  --color-foreground: #fff5f8;
  --color-card: #120c10;
  --color-muted: #24161c;
  --color-muted-foreground: #c4a8b4;
  --color-destructive: #ff5a6a;
  --color-on-destructive: #1a0610;
  --color-ring: #ffffff;
  --line: rgba(255, 180, 206, 0.22);
  --header: 64px;
  --page: 1280px;
  --gutter: 24px;
  --font: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: dark;
  --color-primary-soft: var(--color-primary);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; scroll-padding-top: 80px; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-background);
  color: var(--color-foreground);
  font: 16px/1.5 var(--font);
  overflow-x: clip;
}
button, input, select { font: inherit; color: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { border: 0; background: none; cursor: pointer; }
a { color: inherit; text-decoration: none; cursor: pointer; }
button:disabled { opacity: 0.45; cursor: default; }
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}
img, video { max-width: 100%; }
[hidden] { display: none !important; }
.sprite, .offscreen { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
svg.solid, .solid svg { fill: currentColor; stroke: none; }
.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 40;
  padding: 8px 12px;
  background: var(--color-accent);
  color: var(--color-on-accent);
  border-radius: 8px;
}
.skip:focus { top: 12px; }

.mast {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--header);
  padding: 8px var(--gutter);
  background: rgba(0, 0, 0, 0.92);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 800; letter-spacing: -0.04em; min-height: 44px; }
.brand span span { color: var(--color-accent); }
.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--color-accent);
  color: var(--color-on-accent);
}
.brand-mark svg { width: 14px; height: 14px; }
.mast-note { margin: 0; color: var(--color-muted-foreground); font-size: 13px; }
.primary-nav { display: flex; align-items: center; gap: 4px; min-width: 0; }
.primary-nav a, .tabbar a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--color-muted-foreground);
  font-size: 14px;
  font-weight: 600;
}
.primary-nav a[aria-current="page"], .tabbar a[aria-current="page"] {
  background: var(--color-secondary);
  color: var(--color-foreground);
  box-shadow: inset 0 0 0 1px var(--line);
}
.primary-nav a:hover, .tabbar a:hover { color: var(--color-foreground); }
.primary-nav [data-count], .tabbar [data-count] {
  min-width: 1.25em;
  color: var(--color-foreground);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  max-width: 420px;
  margin-left: auto;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--color-card);
  color: var(--color-muted-foreground);
}
.search input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--color-foreground);
  outline: none;
}
.search input::placeholder { color: var(--color-muted-foreground); }
.search:focus-within { border-color: var(--color-foreground); }
.search input:focus-visible { outline: none; }

.hero {
  position: relative;
  height: calc(100dvh - var(--header));
  min-height: 520px;
  max-height: 860px;
  background: var(--color-background);
  overflow: hidden;
}
.slide { position: absolute; inset: 0; }
.hero-media { position: absolute; inset: 0; background: var(--color-primary); }
.hero-media img, .hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-media img { opacity: 0; }
.hero-media img.is-on { opacity: 1; transition: opacity 360ms ease; }
.hero-video { z-index: 1; opacity: 0; transition: opacity 520ms ease; }
.hero-video.is-playing { opacity: 1; }
.hero-scrim {
  position: absolute;
  inset: auto 0 0 0;
  height: 34%;
  z-index: 2;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0.16) 62%, transparent 100%);
}
.slide:not([hidden]) .hero-copy { animation: rise 460ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.hero-copy, .hero-controls {
  position: absolute;
  z-index: 2;
  left: max(var(--gutter), calc((100% - var(--page)) / 2));
  right: max(var(--gutter), calc((100% - var(--page)) / 2));
}
.hero-copy { bottom: 64px; max-width: 520px; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.hero-title { margin: 4px 0 6px; font-size: clamp(22px, 2.4vw, 34px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
.hero-title button { padding: 0; font: inherit; letter-spacing: inherit; text-align: start; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.hero-meta { margin: 0 0 10px; color: #fff; font-size: 14px; }
.hero-controls { bottom: 12px; display: flex; align-items: center; gap: 4px; }
.hero-pos { margin: 0 8px; color: var(--color-muted-foreground); font-variant-numeric: tabular-nums; font-size: 14px; }
.hero-pos b { color: var(--color-foreground); font-weight: 600; }
.dots { display: flex; align-items: center; margin-left: auto; }
.dots button { width: 44px; height: 44px; position: relative; }
.dots button::before { content: ""; position: absolute; left: 6px; right: 6px; top: 20px; height: 3px; border-radius: 3px; background: rgba(248, 250, 252, 0.35); }
.dots button[aria-current="true"] { width: 40px; }
.dots button[aria-current="true"]::before { background: var(--color-accent); }

.icon-button, .hero-controls > button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--color-foreground);
}
.hero-controls > button { background: rgba(0, 0, 0, 0.28); }
.hero-controls > button:hover, .icon-button:hover { background: var(--color-muted); }

.wrap { width: min(var(--page), calc(100% - var(--gutter) * 2)); margin: 0 auto; }
#browse .wrap { display: flex; flex-direction: column; gap: 40px; padding: 28px 0 64px; }
#browse .catalog-wrap { padding-bottom: 8px; }

.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--color-foreground); font-size: 12px; font-weight: 600; letter-spacing: 0.14em; }
.eyebrow > span[aria-hidden] { width: 8px; height: 8px; border-radius: 50%; background: var(--color-accent); }
h1 { margin: 8px 0; font-size: clamp(28px, 3vw, 40px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
h2 { margin: 0 0 16px; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.catalog-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
#page-sub, .watch-meta { margin: 0; max-width: 42em; color: var(--color-muted-foreground); font-size: 15px; }

.continue-row, .strip { display: grid; gap: 12px; }
.continue-row { grid-auto-flow: column; grid-auto-columns: minmax(220px, 28%); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
.continue-card, .strip-card { scroll-snap-align: start; }
.continue-card {
  display: block;
  min-width: 0;
  padding: 0;
  text-align: start;
  color: inherit;
}
.continue-card span { display: block; margin-top: 8px; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.strip-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 76px;
  padding: 16px;
  border-radius: 12px;
  background: var(--color-card);
  box-shadow: inset 0 0 0 1px var(--line);
  text-align: start;
}
.strip-card:hover { background: var(--color-muted); }
.strip-card strong { display: block; font-size: 15px; }
.strip-card small { color: var(--color-muted-foreground); font-size: 13px; }
.strip-card b { font-size: 28px; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }

.chips, .filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chips { margin-bottom: 12px; }
.chip, .text-button, .secondary, .primary, .danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}
.chip { background: transparent; color: var(--color-muted-foreground); box-shadow: inset 0 0 0 1px var(--line); }
.chip:hover { color: var(--color-foreground); }
.chip[aria-pressed="true"] { background: var(--color-secondary); color: var(--color-foreground); box-shadow: inset 0 0 0 1px var(--line); }
.filter-row label { display: inline-flex; align-items: center; gap: 8px; color: var(--color-muted-foreground); font-size: 14px; }
select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--color-card);
  color: var(--color-foreground);
}
.text-button { padding-inline: 8px; color: var(--color-foreground); }
.result-count { margin: 16px 0; color: var(--color-muted-foreground); font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px 12px; }
.card { min-width: 0; }
.card-open { display: block; color: inherit; }
.card-title { margin: 10px 0 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.card-meta { margin: 4px 0 0; color: var(--color-muted-foreground); font-size: 13px; }
.card-actions { display: flex; gap: 4px; margin-top: 4px; }
.card-actions button[aria-pressed="true"] { color: var(--color-accent); }
.card-actions button[aria-pressed="true"] svg { fill: currentColor; stroke: none; }

.poster { position: relative; overflow: hidden; border-radius: 12px; background: var(--color-primary); transition: transform 220ms ease, box-shadow 220ms ease; }
.poster.portrait, .poster.wide { aspect-ratio: 16 / 9; }
.poster-hd {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 1;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.poster img.is-on { opacity: 1; }
.poster-index { position: absolute; left: 12px; bottom: 8px; color: rgba(248, 250, 252, 0.22); font-size: clamp(40px, 6vw, 72px); font-weight: 700; letter-spacing: -0.06em; line-height: 1; }
.poster-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: var(--color-foreground);
  box-shadow: inset 0 0 0 1px var(--line);
}
.has-image .poster-play { opacity: 0; transition: opacity 180ms ease, transform 180ms ease; }
.card-open:hover .poster-play, .card-open:focus-visible .poster-play, .continue-card:hover .poster-play, .continue-card:focus-visible .poster-play { opacity: 1; transform: scale(1.06); }
.card-open:hover .poster img.is-on, .card-open:focus-visible .poster img.is-on { transform: scale(1.06); }
.poster img { transition: transform 280ms ease; }
.card-open:hover .poster, .card-open:focus-visible .poster, .continue-card:hover .poster, .continue-card:focus-visible .poster { transform: translateY(-2px); box-shadow: inset 0 0 0 2px var(--color-accent); }
.poster-time {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.78);
  color: var(--color-foreground);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.poster[data-tone="0"] { background: linear-gradient(165deg, #1e1b4b, #0c0c0d 58%, #3f0a1a); }
.poster[data-tone="1"] { background: linear-gradient(165deg, #3f0a1a, #0c0c0d 60%, #1e1b4b); }
.poster[data-tone="2"] { background: linear-gradient(180deg, #181818, #0c0c0d 45%, #1e1b4b); }
.poster[data-tone="3"] { background: linear-gradient(155deg, #312e81, #000 55%, #3f0a1a); }
.poster[data-tone="4"] { background: linear-gradient(200deg, #3f0a1a, #1e1b4b 48%, #000); }
.poster[data-tone="5"] { background: linear-gradient(180deg, #0f0f23, #000 72%); }
.hero-media[data-tone="0"] { background: linear-gradient(165deg, #1e1b4b, #0c0c0d 58%, #3f0a1a); }
.hero-media[data-tone="1"] { background: linear-gradient(165deg, #3f0a1a, #0c0c0d 60%, #1e1b4b); }
.hero-media[data-tone="2"] { background: linear-gradient(180deg, #181818, #0c0c0d 45%, #1e1b4b); }
.hero-media[data-tone="3"] { background: linear-gradient(155deg, #312e81, #000 55%, #3f0a1a); }
.hero-media[data-tone="4"] { background: linear-gradient(200deg, #3f0a1a, #1e1b4b 48%, #000); }
.hero-media[data-tone="5"] { background: linear-gradient(180deg, #0f0f23, #000 72%); }

.primary { background: var(--color-accent); color: var(--color-on-accent); }
.primary:hover { background: #ff5c96; }
.primary:active { background: #e21868; }
.secondary { background: transparent; color: var(--color-foreground); box-shadow: inset 0 0 0 1px var(--line); }
.secondary:hover, .secondary[aria-pressed="true"] { background: var(--color-muted); }
.secondary[aria-pressed="true"] { color: var(--color-accent); }
.secondary[aria-pressed="true"] svg { fill: currentColor; stroke: none; }
.danger { background: var(--color-destructive); color: var(--color-on-destructive); }
.danger:hover { background: #f87171; }

.empty { padding: 48px 8px 24px; }
.empty h3 { margin: 0 0 8px; font-size: 20px; }
.empty p { margin: 0 0 16px; color: var(--color-muted-foreground); }

.pager { display: flex; flex-wrap: nowrap; justify-content: center; align-items: center; gap: 6px; margin-top: 28px; }
.pager button { min-width: 40px; min-height: 40px; padding: 0 10px; border-radius: 8px; color: var(--color-muted-foreground); box-shadow: inset 0 0 0 1px var(--line); font-variant-numeric: tabular-nums; }
.pager button[aria-current="page"] { background: var(--color-accent); color: var(--color-on-accent); box-shadow: none; font-weight: 700; }
.pager button:hover:not(:disabled):not([aria-current="page"]) { color: var(--color-foreground); background: var(--color-muted); }
.pager-gap { width: 20px; color: var(--color-muted-foreground); text-align: center; letter-spacing: 0.12em; }

.colophon { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 8px; color: var(--color-muted-foreground); font-size: 13px; }
.colophon p { margin: 0; }
.colophon button { min-height: 44px; padding: 8px 0; color: var(--color-foreground); }

.watch-wrap { display: flex; flex-direction: column; gap: 20px; padding: 24px 0 64px; }
.stage { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; }
.stage video { width: 100%; height: 100%; display: block; background: #000; }
.missing { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; gap: 8px; padding: 24px; text-align: center; background: #000; }
.missing p { margin: 0; }
#missing-path { color: var(--color-muted-foreground); font-size: 14px; }
.watch-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 28px; }
#related-heading { margin-top: 8px; }

dialog {
  width: min(420px, calc(100% - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--color-card);
  color: var(--color-foreground);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.72); }
dialog h2 { margin: 0 0 8px; font-size: 22px; }
dialog p { margin: 0 0 20px; color: var(--color-muted-foreground); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 35;
  transform: translateX(-50%);
  max-width: min(420px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--color-foreground);
  color: #0c0c0d;
  font-size: 14px;
  font-weight: 600;
}
.toast:empty { display: none; }
.noscript { padding: 24px; }

.tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.94);
  border-top: 1px solid var(--line);
}
.tabbar a { flex: 1; flex-direction: column; gap: 2px; min-height: 52px; padding: 6px 4px; font-size: 11px; font-weight: 600; }
.tabbar [data-count] { font-size: 11px; }

@media (max-width: 1200px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  :root { --tabbar: 40px; }
  .primary-nav, .mast-note { display: none; }
  .tabbar {
    display: flex;
    align-items: center;
    padding: 0 2px env(safe-area-inset-bottom);
    min-height: var(--tabbar);
    background: rgba(0, 0, 0, 0.82);
  }
  .tabbar a {
    flex-direction: row;
    gap: 4px;
    min-height: 32px;
    padding: 2px 4px;
    border-radius: 6px;
    font-size: 11px;
  }
  .tabbar svg { width: 14px; height: 14px; }
  .tabbar [data-count] { display: none; }
  .toast { bottom: calc(var(--tabbar) + 8px + env(safe-area-inset-bottom)); }
  main { padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
  .dots { display: none; }
  .hero {
    height: calc(100dvh - var(--header) - var(--tabbar) - env(safe-area-inset-bottom));
    min-height: 0;
    max-height: none;
  }
  .hero-copy { bottom: 48px; }
  .hero-controls { bottom: 2px; }
  .strip { grid-template-columns: 1fr; }
  .pager { gap: 4px; }
  .pager button { min-width: 36px; min-height: 36px; padding: 0 8px; }
  .continue-row { grid-auto-columns: 78%; }
}
@media (max-width: 720px) {
  :root { --gutter: 16px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
  .catalog-head, .colophon { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: no-preference) {
  .dance .card { animation: rise 400ms cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 60ms); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
