:root {
  --bg: #08080c;
  --surface: #111119;
  --surface2: #1c1c26;
  --divider: #23232f;
  --t1: #ffffff;
  --t2: #b4b4c4;
  --t3: #6c6c7e;
  --primary: #ff2e63;
  --primary2: #ff7a45;
  --gold: #f5c56b;
  --radius: 16px;
  --topbar-h: 76px;
  --tabbar-h: 60px;
}

@font-face {
  font-family: 'UKIJEkran';
  src: url('/fonts/UKIJEkran.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html {
  direction: rtl;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 88% -8%, rgba(255, 46, 99, 0.12), transparent 62%),
    radial-gradient(900px 520px at 2% 0%, rgba(120, 80, 255, 0.08), transparent 60%);
  background-attachment: fixed;
  color: var(--t1);
  font-family: 'UKIJEkran', 'Segoe UI', 'Microsoft YaHei UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button {
  font-family: inherit;
}

img {
  display: block;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: #2a2a36;
  border-radius: 999px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ── 顶栏 ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(35, 35, 47, 0.65);
  background: rgba(8, 8, 12, 0.84);
  backdrop-filter: blur(18px);
}

.topbar-inner {
  max-width: 1680px;
  margin: 0 auto;
  height: var(--topbar-h);
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 10px 30px -10px rgba(255, 46, 99, 0.55);
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.logo-text b {
  font-size: 21px;
}

.logo-text span {
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--t3);
  letter-spacing: 0.16em;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--divider);
  background: rgba(17, 17, 25, 0.55);
}

.topnav a {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--t2);
  transition: all 0.2s;
}

.topnav a:hover {
  color: #fff;
}

.topnav a.active {
  background: var(--surface2);
  color: #fff;
  font-weight: 700;
}

.top-actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--divider);
  background: var(--surface);
  color: var(--t2);
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.icon-btn.spin svg {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── 内容容器 ── */
#app {
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 32px 80px;
  min-height: 60vh;
}

.page {
  padding-top: 26px;
}

.loading {
  padding: 80px 0;
  text-align: center;
  color: var(--t3);
  font-size: 13.5px;
}

.empty {
  padding: 70px 0;
  text-align: center;
  color: var(--t3);
  font-size: 14px;
}

/* ── Hero ── */
.hero {
  position: relative;
  height: 560px;
  margin-top: 18px;
  border-radius: 24px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
  transition: opacity 0.5s;
}

.hero-mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to left,
    rgba(8, 8, 12, 0.96) 0%,
    rgba(8, 8, 12, 0.72) 36%,
    rgba(8, 8, 12, 0.12) 72%,
    transparent 100%
  );
}

.hero-bottom {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 200px;
  background: linear-gradient(to top, rgba(8, 8, 12, 0.95), transparent);
}

.hero-inner {
  position: relative;
  height: 100%;
  padding: 0 44px 54px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.hero-content {
  max-width: 600px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--gold);
  color: #241300;
  font-size: 11.5px;
  font-weight: 900;
}

.hero h1 {
  margin: 14px 0 0;
  font-size: clamp(30px, 3.6vw, 52px);
  line-height: 1.15;
  font-weight: 900;
  text-shadow: 0 8px 34px rgba(0, 0, 0, 0.7);
}

.hero-meta {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--t2);
  font-size: 13px;
}

.hero-meta .dot {
  width: 1px;
  height: 12px;
  background: rgba(255, 255, 255, 0.25);
}

.hero-meta .score {
  color: var(--gold);
  font-weight: 800;
}

.hero-actions {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 24px;
  border-radius: 999px;
  border: 0;
  font-size: 14.5px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #fff;
  box-shadow: 0 12px 34px -12px rgba(255, 46, 99, 0.65);
}

.btn-primary:hover {
  transform: scale(1.03);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  backdrop-filter: blur(8px);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.16);
}

.hero-thumbs {
  position: absolute;
  inset-inline-start: 44px;
  bottom: 24px;
  display: flex;
  gap: 10px;
}

.hero-thumb {
  width: 92px;
  height: 54px;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  opacity: 0.55;
  cursor: pointer;
  padding: 0;
  background: transparent;
}

.hero-thumb.active {
  opacity: 1;
  border: 2px solid var(--primary);
  box-shadow: 0 10px 24px -10px rgba(255, 46, 99, 0.8);
}

.hero-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── 横向轨道 ── */
.rail-block {
  margin-top: 38px;
}

.rail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.rail-head .bar {
  width: 6px;
  height: 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--primary), var(--primary2));
}

.rail-head h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 900;
}

.rail-head .more {
  margin-inline-start: auto;
  font-size: 12.5px;
  color: var(--t2);
  border: 1px solid var(--divider);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 13px;
}

.rail-head .more:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.rail {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
  padding-bottom: 4px;
}

.rail::-webkit-scrollbar {
  display: none;
}

.rail > * {
  flex: 0 0 176px;
  scroll-snap-align: start;
}

/* ── 海报卡 ── */
.card {
  display: block;
  cursor: pointer;
}

.card .cover {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 18px 40px -26px rgba(0, 0, 0, 0.9);
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.card:hover .cover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 28px 60px -26px rgba(0, 0, 0, 0.95);
}

.card .cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s;
}

.card:hover .cover img {
  transform: scale(1.05);
}

.card .shade {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 42%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
}

.card .score {
  position: absolute;
  top: 7px;
  inset-inline-end: 7px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--gold);
  font-size: 10.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.card .eps {
  position: absolute;
  top: 7px;
  inset-inline-start: 7px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.card .play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.22s;
}

.card:hover .play {
  opacity: 1;
}

.card .play span {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  padding-inline-start: 2px;
  box-shadow: 0 12px 30px -8px rgba(255, 46, 99, 0.75);
}

.card .title {
  margin-top: 9px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.2s;
}

.card:hover .title {
  color: var(--primary);
}

.card .type {
  margin-top: 4px;
  font-size: 11px;
  color: var(--t3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card .cn {
  margin-top: 2px;
  font-size: 10px;
  color: #585868;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cn-title {
  margin-top: 3px;
  font-size: 12px;
  color: var(--t3);
  font-family: 'Microsoft YaHei UI', 'PingFang SC', sans-serif;
  direction: ltr;
  text-align: right;
}

/* ── 分类页 ── */
.cat-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.cat-top h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
}

.cat-count {
  font-size: 12.5px;
  color: var(--t3);
  font-variant-numeric: tabular-nums;
}

.kind-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--divider);
  background: rgba(17, 17, 25, 0.55);
  overflow-x: auto;
  scrollbar-width: none;
}

.kind-tabs::-webkit-scrollbar {
  display: none;
}

.kind-tabs a {
  flex-shrink: 0;
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--t2);
}

.kind-tabs a.active {
  background: var(--surface2);
  color: #fff;
  font-weight: 700;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
}

.chip {
  border: 1px solid var(--divider);
  background: rgba(17, 17, 25, 0.7);
  color: var(--t2);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.chip.active {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border-color: transparent;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 26px -12px rgba(255, 46, 99, 0.7);
}

.sort-group {
  margin-inline-start: auto;
  display: flex;
  gap: 6px;
}

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

.grid > .card {
  min-width: 0;
}

.sentinel {
  padding: 40px 0 10px;
  text-align: center;
  color: var(--t3);
  font-size: 12.5px;
  min-height: 36px;
}

/* ── 播放页 ── */
.watch-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.back-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--divider);
  background: var(--surface);
  color: var(--t1);
  cursor: pointer;
}

.watch-title {
  min-width: 0;
  flex: 1;
}

.watch-title h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watch-title p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--t3);
}

.watch-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
}

.player-box {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.player-box video {
  width: 100%;
  height: 100%;
  background: #000;
}

.player-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.5);
}

.quality-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.qchip {
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--divider);
  background: var(--surface2);
  color: var(--t2);
  font-size: 12px;
  cursor: pointer;
}

.qchip.active {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border-color: transparent;
  color: #fff;
  font-weight: 700;
}

.info-card {
  border: 1px solid var(--divider);
  background: var(--surface);
  border-radius: 18px;
  padding: 16px;
}

.info-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--divider);
  color: var(--t2);
  font-size: 11.5px;
}

.tag.gold {
  background: rgba(245, 197, 107, 0.1);
  border-color: rgba(245, 197, 107, 0.35);
  color: var(--gold);
  font-weight: 800;
}

.info-card .intro {
  margin: 12px 0 0;
  color: var(--t2);
  font-size: 13px;
  line-height: 1.8;
}

.info-card .actions {
  margin-top: 14px;
  display: flex;
  gap: 9px;
}

.eps-card {
  border: 1px solid var(--divider);
  background: var(--surface);
  border-radius: 18px;
  padding: 16px;
  margin-top: 16px;
}

.eps-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.eps-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
}

.eps-head span {
  color: var(--t3);
  font-size: 12px;
}

.eps-range {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.eps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}

.ep {
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--divider);
  background: var(--surface2);
  color: var(--t1);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.ep.active {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border-color: transparent;
  font-weight: 800;
}

.watch .rail-block {
  margin-top: 26px;
}

/* ── 搜索 ── */
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  border-radius: 999px;
  border: 1px solid var(--divider);
  background: var(--surface);
  padding: 0 20px;
  color: var(--t3);
}

.search-box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--t1);
  font-size: 15px;
  font-family: inherit;
}

.search-box input::placeholder {
  color: var(--t3);
}

.search-go {
  flex-shrink: 0;
  height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* ── 底部导航 / 页脚 ── */
.tabbar {
  display: none;
}

.footer {
  border-top: 1px solid rgba(35, 35, 47, 0.7);
  background: rgba(17, 17, 25, 0.3);
}

.footer-inner {
  max-width: 1680px;
  margin: 0 auto;
  padding: 26px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--t3);
  font-size: 12px;
}

/* ── 响应式：手机 H5 ── */
@media (max-width: 1024px) {
  .watch-grid {
    grid-template-columns: 1fr;
  }
  .hero {
    height: 480px;
  }
}

@media (max-width: 768px) {
  :root {
    --topbar-h: 60px;
  }

  body {
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    background-attachment: scroll;
  }

  .topbar-inner {
    padding: 0 14px;
    gap: 10px;
    height: var(--topbar-h);
  }

  .logo-mark {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    font-size: 18px;
  }

  .logo-text b {
    font-size: 17px;
  }

  .logo-text span {
    display: none;
  }

  .topnav {
    display: none;
  }

  .top-actions {
    gap: 8px;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }

  #app {
    padding: 0 14px 94px;
  }

  .hero {
    height: 430px;
    margin-top: 12px;
    border-radius: 18px;
  }

  .hero-inner {
    padding: 0 18px 20px;
    justify-content: flex-end;
  }

  .hero-mask {
    background: linear-gradient(
      to top,
      rgba(8, 8, 12, 0.97) 0%,
      rgba(8, 8, 12, 0.78) 48%,
      rgba(8, 8, 12, 0.12) 100%
    );
  }

  .hero-bottom {
    height: 160px;
  }

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

  .hero-meta {
    font-size: 12px;
    gap: 8px;
  }

  .hero-actions {
    margin-top: 14px;
  }

  .btn {
    height: 42px;
    padding: 0 20px;
    font-size: 13.5px;
  }

  .hero-thumbs {
    display: none;
  }

  .rail-block {
    margin-top: 26px;
  }

  .rail-head {
    margin-bottom: 10px;
  }

  .rail-head h2 {
    font-size: 17px;
  }

  .rail-head .bar {
    height: 20px;
    width: 5px;
  }

  .rail {
    gap: 10px;
  }

  .rail > * {
    flex: 0 0 136px;
  }

  .card .title {
    font-size: 12.5px;
  }

  .card .type {
    font-size: 10.5px;
  }

  .cat-top {
    gap: 8px;
    margin-top: 6px;
  }

  .cat-top h1 {
    font-size: 20px;
  }

  .kind-tabs {
    width: 100%;
    border-radius: 14px;
    padding: 3px;
  }

  .kind-tabs a {
    padding: 7px 12px;
    font-size: 12.5px;
  }

  .filter-row {
    gap: 6px;
    margin: 12px 0;
  }

  .chip {
    padding: 6px 12px;
    font-size: 12px;
  }

  .sort-group {
    margin-inline-start: 0;
  }

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

  .grid .card .title {
    font-size: 12px;
  }

  .grid .card .type {
    font-size: 10px;
  }

  .watch-top {
    margin-top: 4px;
  }

  .watch-title h1 {
    font-size: 17px;
  }

  .player-box {
    border-radius: 14px;
  }

  .eps-grid {
    grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
    max-height: none;
  }

  .footer {
    display: none;
  }

  .tabbar {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 60;
    display: flex;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid rgba(35, 35, 47, 0.85);
    background: rgba(10, 10, 15, 0.94);
    backdrop-filter: blur(18px);
  }

  .tabbar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--t3);
    font-size: 10px;
  }

  .tabbar a.active {
    color: var(--primary);
  }

  body.watch-page .tabbar {
    display: none;
  }

  body.watch-page {
    padding-bottom: 24px;
  }
}
