:root {
  color-scheme: dark;
  --bg: #0f0f10;
  --bg-soft: #131414;
  --surface: #1c1c1c;
  --surface-2: #222325;
  --text: #f5f5f7;
  --muted: #9c9ca3;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #ff7e0d;
  --accent-2: #ff9233;
  --accent-soft: rgba(255, 126, 13, 0.14);
  --radius: 14px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(
      1200px 600px at 50% -10%,
      rgba(255, 126, 13, 0.08),
      transparent 60%
    ),
    var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

input {
  font: inherit;
}

.icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: none;
}

.icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------------------------------------------------------------- top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding-top: var(--safe-top);
  background: rgba(15, 15, 16, 0.84);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}

.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #16110b;
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 6px 18px rgba(255, 126, 13, 0.28);
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.brand-tag {
  padding: 2px 7px;
  border: 1px solid rgba(255, 146, 51, 0.4);
  border-radius: 999px;
  color: var(--accent-2);
  font-size: 10px;
  line-height: 1.5;
}

.nav {
  display: flex;
  gap: 4px;
  margin-left: 4px;
}

.nav-link {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #191308;
  font-weight: 700;
}

.spacer {
  flex: 1;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  transition: background 0.15s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.search-bar {
  display: none;
  align-items: center;
  gap: 8px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px 12px;
  color: var(--muted);
}

.topbar.search-open .search-bar {
  display: flex;
}

.search-bar input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  outline: none;
}

.search-bar input:focus {
  border-color: rgba(255, 146, 51, 0.55);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-bar button {
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #191308;
  font-weight: 700;
}

/* ------------------------------------------------------------------- view */

.view {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 16px 32px;
  min-height: 60vh;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: fade-in 0.25s ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ------------------------------------------------------------------- hero */

.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 260px;
  overflow: hidden;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-position: center 28%;
  background-size: cover;
  filter: saturate(1.1);
  transform: scale(1.02);
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, rgba(10, 10, 11, 0.94) 78%),
    linear-gradient(90deg, rgba(10, 10, 11, 0.9) 0%, rgba(10, 10, 11, 0.1) 70%);
}

.hero-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 22px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.hero-title {
  margin: 0;
  font-size: clamp(22px, 4.6vw, 34px);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0.2px;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.6);
}

.hero-desc {
  display: -webkit-box;
  margin: 0;
  max-width: 560px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.btn-primary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #191308;
  box-shadow: 0 8px 22px rgba(255, 126, 13, 0.3);
}

.btn-ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.hero .icon {
  width: 15px;
  height: 15px;
}

/* --------------------------------------------------------------- sections */

.section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.section-title::before {
  content: "";
  width: 4px;
  height: 15px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.section-more {
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.section-more:hover {
  color: var(--accent-2);
}

/* ------------------------------------------------------------------- chips */

.chips {
  display: flex;
  gap: 8px;
  padding: 2px 0 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

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

.chip {
  flex: none;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  transition:
    color 0.15s ease,
    border-color 0.15s ease;
}

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

.chip.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #191308;
  font-weight: 700;
}

/* ------------------------------------------------------------------- cards */

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

@media (max-width: 359px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

@media (min-width: 700px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
  }
}

@media (min-width: 1000px) {
  .grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
  }
}

.card {
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.4);
}

.thumb {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background:
    linear-gradient(150deg, rgba(255, 126, 13, 0.22), transparent 55%),
    linear-gradient(180deg, #242424, #181818);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.card:hover .thumb img {
  transform: scale(1.04);
}

.thumb img.is-empty {
  display: none;
}

.badge,
.rank-badge {
  position: absolute;
  z-index: 2;
  padding: 3px 7px;
  border-radius: 7px;
  font-size: 11px;
  line-height: 1.4;
  backdrop-filter: blur(6px);
}

.badge {
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
}

.rank-badge {
  top: 8px;
  right: 8px;
  background: rgba(255, 126, 13, 0.9);
  color: #1a1207;
  font-weight: 800;
  font-style: italic;
}

.card-body {
  padding: 9px 10px 11px;
}

.card-title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-meta {
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------- rank row */

.rank-row {
  display: flex;
  gap: 12px;
  padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.rank-row::-webkit-scrollbar {
  display: none;
}

.rank-row .card {
  flex: 0 0 128px;
}

/* ------------------------------------------------------------ continue */

.continue-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(
    120deg,
    rgba(255, 126, 13, 0.12),
    rgba(255, 255, 255, 0.03) 55%
  );
  text-decoration: none;
}

.continue-cover {
  width: 54px;
  height: 72px;
  flex: none;
  overflow: hidden;
  border-radius: 9px;
  background: var(--surface-2);
}

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

.continue-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.continue-title {
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.continue-sub {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.continue-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #191308;
  font-size: 13px;
  font-weight: 700;
}

/* ------------------------------------------------------------ page header */

.page-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.page-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* ------------------------------------------------------------------- play */

body.player-mode {
  overflow: hidden;
}

body.player-mode .topbar,
body.player-mode .footer {
  display: none;
}

body.player-mode .view {
  max-width: none;
  padding: 0;
}

.player-page {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  background: #000;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.player-track {
  display: flex;
  flex-direction: column;
  height: 100%;
  will-change: transform;
  transform: translate3d(0, -100vh, 0);
  transform: translate3d(0, -100dvh, 0);
}

.player-slide {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

.player-slide video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  pointer-events: none;
}

.player-slide.empty::after {
  content: "没有更多了";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.32);
  font-size: 13px;
  letter-spacing: 0.1em;
}

.player-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.62) 0,
    transparent 20%,
    transparent 62%,
    rgba(0, 0, 0, 0.84) 100%
  );
}

.player-ui button,
.player-ui a {
  pointer-events: auto;
}

.player-top {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: calc(10px + var(--safe-top)) 16px 0;
}

.player-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  text-decoration: none;
}

.player-heading {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.player-title {
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.player-episode {
  margin: 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 11px;
}

.player-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.48);
  color: #fff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.player-play[hidden] {
  display: none;
}

.player-play .icon {
  width: 26px;
  height: 26px;
  margin-left: 3px;
}

.player-error {
  position: absolute;
  right: 14px;
  bottom: 118px;
  left: 14px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.8);
  color: #ffb27a;
  font-size: 12px;
  pointer-events: auto;
}

.player-error.visible {
  display: flex;
}

.player-error button {
  flex: none;
  padding: 6px 12px;
  border: 1px solid rgba(255, 178, 122, 0.4);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-size: 12px;
}

.player-bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px calc(16px + var(--safe-bottom));
}

.player-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.player-tags span {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
}

.player-desc {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  line-height: 1.6;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.player-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}

.player-swipe-hint {
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
}

.player-select {
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #191308;
  font-size: 13px;
  font-weight: 700;
}

/* -------------------------------------------------------------- episode sheet */

.episode-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
}

.episode-sheet.open {
  display: block;
}

.sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
}

.sheet-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  max-height: 64vh;
  padding-bottom: var(--safe-bottom);
  border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  background: #161617;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
}

.sheet-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.sheet-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.sheet-episodes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 8px;
  padding: 4px 16px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet-ep {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.sheet-ep.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #191308;
  font-weight: 700;
}

/* --------------------------------------------------------------- feedback */

.load-status {
  padding: 16px 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.load-status[data-retry="1"] {
  cursor: pointer;
  color: var(--accent-2);
}

.sentinel {
  height: 1px;
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--radius);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.06),
    transparent
  );
  animation: shimmer 1.3s infinite;
  transform: translateX(-100%);
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

.skeleton-hero {
  height: 260px;
}

.skeleton-card {
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
}

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

@media (max-width: 359px) {
  .skeleton-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 700px) {
  .skeleton-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 56px 20px;
  color: var(--muted);
  text-align: center;
}

.state-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent-2);
}

.state h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
}

.state p {
  margin: 0;
  max-width: 420px;
  font-size: 13px;
  line-height: 1.7;
}

.state button {
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #191308;
  font-weight: 700;
}

.toast {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  z-index: 50;
  max-width: 78vw;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(28, 28, 28, 0.96);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-size: 13px;
  text-align: center;
  transform: translateX(-50%);
}

.toast:not([hidden]) {
  animation: toast-in 0.2s ease both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.footer {
  padding: 8px 16px calc(28px + var(--safe-bottom));
  color: rgba(255, 255, 255, 0.28);
  font-size: 11px;
  text-align: center;
}

.noscript {
  padding: 40px 16px;
  text-align: center;
}

@media (max-width: 389px) {
  .brand-tag {
    display: none;
  }
}

@media (min-width: 760px) {
  .search-bar {
    display: flex;
  }

  #search-toggle {
    display: none;
  }
}

@media (min-width: 760px) {
  .view {
    padding: 26px 24px 40px;
  }

  .hero {
    min-height: 340px;
  }

  .hero-content {
    padding: 30px;
  }
}
