:root {
  --bg: #000;
  --tile: #161616;
  --tile-2: #1f1f1f;
  --text: #f5f5f7;
  --muted: #86868b;
  --faint: rgba(245, 245, 247, 0.55);
  --accent: #2dd4bf;
  --radius: 12px;
}

* { box-sizing: border-box; }

html { scrollbar-color: #333 var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
    "Helvetica Neue", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 0; height: 0; }

/* ---------- 顶栏：悬浮半透明 ---------- */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 48px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.12); }

#search-form { display: flex; gap: 10px; flex: 1; max-width: 480px; }

#search-input {
  flex: 1;
  padding: 9px 16px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 14px;
  transition: background 0.2s;
}
#search-input::placeholder { color: var(--faint); }
#search-input:focus { outline: none; background: rgba(255, 255, 255, 0.16); }

button {
  padding: 9px 18px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s;
}
button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.22); }
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.3; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#search-form button { background: rgba(255, 255, 255, 0.9); color: #000; font-weight: 600; }
#search-form button:hover { background: #fff; }

main { max-width: 1240px; margin: 0 auto; padding: 32px 48px 80px; }

/* ---------- 顶栏常驻搜索框 ---------- */

header #search-form {
  flex: 0 1 480px;
  gap: 8px;
}

header #search-input {
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.1);
}
header #search-input:focus { background-color: rgba(255, 255, 255, 0.16); }

header #search-form button {
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
}
header #search-form button:hover { background: rgba(255, 255, 255, 0.12); }

/* ---------- 状态 ---------- */

.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  padding: 64px 0;
  font-size: 15px;
}
.status[hidden] { display: none; }
.status::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.summary { color: var(--muted); font-size: 13px; margin: 0 0 24px; }

/* ---------- 搜索结果：无框海报，hover 放大 ---------- */

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 28px 20px;
}

.card {
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.card:hover { transform: scale(1.06); z-index: 2; position: relative; }

.poster {
  aspect-ratio: 2 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background:
    radial-gradient(130% 100% at 30% 0%, hsl(var(--hue) 50% 30% / 0.85), transparent 70%),
    linear-gradient(165deg, hsl(var(--hue) 40% 18%), hsl(var(--hue) 45% 8%));
  user-select: none;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
  transition: box-shadow 0.25s;
}
.poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.poster-char {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -1px;
  color: hsl(var(--hue) 75% 78%);
}
.card:hover .poster { box-shadow: 0 18px 48px rgba(0, 0, 0, 0.8); }

.poster .tag {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 10px;
  font-weight: 500;
  color: var(--faint);
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  border: none;
  border-radius: 6px;
  padding: 3px 8px;
}

.card-body { padding: 12px 2px 0; }
.card-body h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-body .meta {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag {
  display: inline-block;
  font-size: 11px;
  color: var(--muted);
  border-radius: 6px;
  padding: 1px 6px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 40px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- 详情：全幅 hero ---------- */

.back {
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
}

.hero {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  min-height: 420px;
  display: flex;
  align-items: flex-end;
  background: var(--tile);
  margin-bottom: 8px;
}
.hero-backdrop {
  position: absolute;
  inset: -40px;
  width: calc(100% + 80px);
  height: calc(100% + 80px);
  object-fit: cover;
  filter: blur(28px) brightness(0.5) saturate(1.3);
  transform: scale(1.05);
}
.hero-poster {
  position: absolute;
  right: 56px;
  top: 50%;
  transform: translateY(-50%);
  height: 78%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
  z-index: 1;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.45) 45%, transparent 75%),
    linear-gradient(to right, rgba(0, 0, 0, 0.55), transparent 60%);
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 48px;
  max-width: 720px;
}
.hero-kicker {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  margin: 0 0 10px;
}
.hero-content h1 {
  margin: 0 0 14px;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
}
.hero-meta {
  color: var(--faint);
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 10px;
}
.hero-credits {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 14px;
}
.hero-synopsis {
  color: var(--faint);
  font-size: 14px;
  line-height: 1.65;
  margin: 0 0 24px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-actions { display: flex; gap: 12px; }
.btn-play {
  background: #fff;
  color: #000;
  border-radius: 999px;
  padding: 12px 30px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.btn-play:hover { background: #fff; transform: scale(1.04); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  color: var(--text);
  border-radius: 999px;
  padding: 12px 26px;
  font-size: 15px;
  font-weight: 600;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.26); }

/* ---------- 首页海报货架 ---------- */

.rail-poster { flex: 0 0 152px; }
.rail-poster .card-body { padding: 10px 2px 0; }
.rail-poster .card-body h3 { font-size: 13px; }
.rail-poster .card-body .meta { display: none; }

/* ---------- 横向货架 ---------- */

.rail { margin-top: 36px; }
.rail-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 0 0 14px;
}

.rail-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 6px 4px 14px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 56px), transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 56px), transparent);
}
.rail-scroll::-webkit-scrollbar { display: none; }

.rail-ep {
  flex: 0 0 172px;
  scroll-snap-align: start;
  text-decoration: none;
  color: inherit;
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.rail-ep:hover { transform: scale(1.07); z-index: 2; position: relative; }

.rail-ep-thumb {
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  background: linear-gradient(150deg, var(--tile-2), var(--tile));
  border: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: rgba(245, 245, 247, 0.35);
  transition: border-color 0.2s, color 0.2s;
}
.rail-ep:hover .rail-ep-thumb {
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(245, 245, 247, 0.8);
}

.rail-ep-label {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-ep.current .rail-ep-thumb {
  background: linear-gradient(150deg, rgba(45, 212, 191, 0.25), rgba(45, 212, 191, 0.08));
  border-color: var(--accent);
  color: var(--accent);
}
.rail-ep.current .rail-ep-label { color: var(--text); font-weight: 600; }

/* ---------- 播放页 ---------- */

.player-wrap {
  background: #000;
  border-radius: 20px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  margin-bottom: 24px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.9);
}
.player-wrap video { width: 100%; height: 100%; display: block; }

.play-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0 0 8px;
}

/* ---------- 响应式 ---------- */

@media (max-width: 720px) {
  header { padding: 12px 20px; gap: 14px; }
  main { padding: 20px 20px 56px; }
  .results { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 20px 14px; }
  .poster-char { font-size: 42px; }
  .hero { min-height: 340px; }
  .hero-content { padding: 28px; }
  .hero-content h1 { font-size: 30px; }
  .hero-poster { display: none; }
  .rail-ep { flex-basis: 140px; }
}
