:root {
  --bg: #07090c;
  --bg-2: #0e1218;
  --bg-3: #151b24;
  --line: rgba(255, 255, 255, 0.06);
  --text: #eef3f7;
  --muted: #8b97a6;
  --cyan: #2ec8ff;
  --green: #3ee08f;
  --accent: linear-gradient(120deg, #2ec8ff, #3ee08f);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --radius: 14px;
}

* { box-sizing: border-box; }

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

.runtime-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 80;
  padding: 8px 16px;
  text-align: center;
  background: #c45c26;
  color: #fff;
  font-size: 13px;
}

html, body {
  height: 100%;
  height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color-scheme: dark;
}

body {
  display: flex;
  overflow: hidden;
  overscroll-behavior: none;
}

button, input {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.sidebar {
  width: 228px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
  background: linear-gradient(180deg, #0b1016 0%, #080b10 100%);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 22px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
}

.brand-word {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: var(--accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

#nav { display: grid; gap: 8px; }

.nav-item {
  appearance: none;
  border: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.nav-item::before {
  content: "";
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat;
  mask: var(--ico) center / contain no-repeat;
}

.nav-item[data-page="home"] {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 3 4 9.5V21h5v-6h6v6h5V9.5z'/%3E%3C/svg%3E");
}
.nav-item[data-page="cate"] {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 4h7v7H4zm9 0h7v7h-7zM4 13h7v7H4zm9 0h7v7h-7z'/%3E%3C/svg%3E");
}
.nav-item[data-page="discover"] {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm3.7 6.3-2.2 6.6-6.6 2.2 2.2-6.6 6.6-2.2z'/%3E%3C/svg%3E");
}
.nav-item[data-page="history"] {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 5h-2v6l5 3 1-1.7-4-2.3z'/%3E%3C/svg%3E");
}
.nav-item[data-page="fav"] {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 21S5 16.6 2.5 12.4C.4 9.4 1.6 5.5 5 4.3 7.1 3.6 9.4 4.4 12 7c2.6-2.6 4.9-3.4 7-2.7 3.4 1.2 4.6 5.1 2.5 8.1C19 16.6 12 21 12 21z'/%3E%3C/svg%3E");
}

.nav-item:hover { color: #fff; background: var(--bg-3); }

.nav-item.active {
  color: #061014;
  background: var(--accent);
  font-weight: 700;
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px 8px 0;
  color: #5b6673;
  font-size: 12px;
}

.workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px 8px;
}

.search-box {
  flex: 1;
  display: flex;
  max-width: 560px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.search-box input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  color: inherit;
  padding: 11px 18px;
}

.search-box button,
.ghost {
  border: 0;
  cursor: pointer;
  color: #061014;
  background: var(--accent);
  padding: 0 18px;
  font-weight: 700;
}

.ghost {
  height: 42px;
  border-radius: 999px;
  color: var(--text);
  background: var(--bg-3);
}

body.public-mode #btnRemote,
body.public-mode #remoteBox {
  display: none !important;
}

.web-hint:empty {
  display: none !important;
}

#pages {
  flex: 1;
  overflow: auto;
  padding: 8px 24px 32px;
}

.page.hidden, .hidden { display: none !important; }

.hero {
  position: relative;
  height: 320px;
  border-radius: 22px;
  overflow: hidden;
  background: #111;
  box-shadow: var(--shadow);
}

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

.hero-mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(7, 9, 12, 0.88) 0%, rgba(7, 9, 12, 0.15) 58%, transparent 100%);
}

.hero-copy {
  position: absolute;
  left: 36px;
  bottom: 28px;
  right: 36px;
  max-width: 560px;
}

.hero-copy h2 {
  margin: 0 0 8px;
  font-size: 32px;
  letter-spacing: 0.5px;
}

.hero-copy p {
  margin: 0 0 16px;
  color: #d5dde6;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-dots {
  position: absolute;
  right: 24px;
  bottom: 22px;
  display: flex;
  gap: 6px;
}

.hero-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}

.hero-dots i.on { background: #3ee08f; }

.play-btn, .more-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 700;
}

.play-btn { background: var(--accent); color: #061014; }
.more-btn { background: rgba(255, 255, 255, 0.12); color: #fff; }

.row { margin-top: 28px; overflow: visible; }

.row-head, .cate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.row-head h3, .cate-head h3, .block-title {
  margin: 0;
  font-size: 20px;
}

.row-scroller {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 18px 10px 22px;
  margin: -10px -10px -8px;
  scrollbar-width: thin;
}

.poster {
  width: 148px;
  flex: 0 0 148px;
  cursor: pointer;
  background: transparent;
  border: 0;
  padding: 0;
  text-align: left;
  color: inherit;
  position: relative;
  z-index: 1;
  transform-origin: center bottom;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.poster-cover {
  position: relative;
  height: 210px;
  border-radius: 12px;
  overflow: hidden;
  background: #1a212b;
  transition: box-shadow 0.22s ease;
}

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

.poster-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.28) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><circle cx='32' cy='32' r='20' fill='rgba(0,0,0,0.45)'/><polygon points='28,22 46,32 28,42' fill='white'/></svg>") center/44px no-repeat;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.watch-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.18);
}

.watch-bar b {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2ec8ff, #3ee08f);
}

.continue-row .row-head h3 {
  background: var(--accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@media (hover: hover) and (pointer: fine) {
  .poster:hover {
    transform: scale(1.12) translateY(-6px);
    z-index: 8;
  }
  .poster:hover .poster-cover {
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
  }
  .poster:hover .poster-cover::after { opacity: 1; }
}

.poster:focus-visible {
  outline: 2px solid #2ec8ff;
  outline-offset: 4px;
}

.badge, .score {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.62);
}

.score { color: #ffd36a; left: 8px; right: auto; }

.poster-name, .poster-sub {
  display: block;
  margin-top: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poster-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 18px 14px;
  padding: 12px 6px 20px;
}

.grid .poster {
  width: auto;
  flex: none;
  flex-basis: auto;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 18px;
}

.tab {
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
}

.tab.active {
  border-color: transparent;
  color: #061014;
  background: var(--accent);
  font-weight: 700;
}

.empty, .loading {
  color: var(--muted);
  padding: 48px 0;
  text-align: center;
}

.player-layer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 20;
}

.player-sheet {
  position: relative;
  width: min(1180px, 100%);
  background: #0d1218;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.close-x {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #1b232e;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}

.player-main {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 18px;
}

.player-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 14px;
}

.player-frame #player {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.12);
  transform-origin: 18% 82%;
  border-radius: 0;
}

.wm-mask {
  position: absolute;
  top: 0;
  right: 0;
  width: 28%;
  height: 16%;
  background: radial-gradient(120% 120% at 100% 0%, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.18) 46%, transparent 72%);
  backdrop-filter: blur(14px);
  pointer-events: none;
}

#meta h2 { margin: 8px 0 8px; font-size: 24px; }
#meta p { margin: 0 0 10px; color: var(--muted); line-height: 1.6; }
#meta .facts { color: #c9d4df; font-size: 13px; }

#episodes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.ep {
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  background: #1b232e;
  color: #fff;
  cursor: pointer;
}

.ep.active { background: var(--accent); color: #061014; font-weight: 700; }

.hots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 24px 8px;
}

.hot {
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--bg-3);
  color: var(--muted);
  cursor: pointer;
  flex: 0 0 auto;
  white-space: nowrap;
}

.hot:hover { color: #fff; }

.history-row .hot { background: #1b232e; }
.history-row .hist-clear { color: #8b98a5; }

.search-filters { margin: 0 0 8px; }
.filter-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 6px 0;
  font-size: 13px;
}
.filter-label {
  width: 40px;
  flex-shrink: 0;
  color: var(--muted);
  padding-top: 4px;
}
.filter-opts { display: flex; flex-wrap: wrap; gap: 4px 2px; }
.filter-opts button {
  border: 0;
  background: transparent;
  color: #9aa6b2;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.filter-opts button.on {
  background: #2ec8c0;
  color: #061014;
  font-weight: 700;
}
.search-meta { color: var(--muted); margin: 10px 0 16px; }
.search-meta b { color: #3ee08f; }
.search-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 36px;
  align-items: start;
}
.search-hit {
  display: flex;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.search-hit-cover {
  width: 120px;
  height: 168px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #1a212b;
}
.search-hit-cover img { width: 100%; height: 100%; object-fit: cover; }
.search-hit-title {
  margin: 0 0 8px;
  color: #7dcea0;
  font-size: 22px;
  font-weight: 800;
}
.search-hit-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.search-hit-tags span {
  background: #2a323c;
  color: #c5cdd6;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}
.search-hit-score { color: #ff8a3d; font-size: 22px; font-weight: 800; font-style: normal; }
.search-hit-meta { color: #d7dee6; font-size: 13px; line-height: 1.75; }
.search-hit-meta p { margin: 0; }
.search-hit-play {
  margin-top: 12px;
  border: 1px solid #2ec8c0;
  background: transparent;
  color: #2ec8c0;
  padding: 5px 14px;
  border-radius: 4px;
  cursor: pointer;
}
.search-hit-play:hover { background: rgba(46, 200, 192, 0.12); }
.search-hot h4 { margin: 4px 0 12px; font-size: 16px; }
.search-hot ol { margin: 0; padding: 0; list-style: none; }
.search-hot li {
  display: flex;
  gap: 10px;
  padding: 7px 0;
  cursor: pointer;
  color: #d5dde6;
}
.search-hot li:hover { color: #fff; }
.search-hot .n { width: 1.1em; font-weight: 800; color: #fff; }
.search-hot .n.top { color: #ff8a3d; }
.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin: 28px 0 8px;
  color: #8b97a6;
}
.pager button { border: 0; background: transparent; color: inherit; cursor: pointer; }
.pager button.on { color: #2ec8c0; font-weight: 800; }

.player-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 12px;
  flex-wrap: wrap;
}

.player-toolbar button,
.player-toolbar select,
.more-page {
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  background: #1b232e;
  color: #fff;
  cursor: pointer;
}

.player-toolbar label {
  color: var(--muted);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.player-toolbar #quality {
  min-width: 92px;
}

.key-hint {
  margin: 0 0 10px;
  color: #5b6673;
  font-size: 12px;
}

.resume-bar,
.next-count {
  position: absolute;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(7, 10, 14, 0.82);
  color: #fff;
}

.resume-bar { left: 16px; bottom: 56px; }
.next-count { right: 16px; bottom: 56px; }
.resume-bar button,
.next-count button {
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--accent);
  color: #061014;
  cursor: pointer;
  font-weight: 700;
}

.tap-to-play {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: rgba(0, 0, 0, 0.42);
  color: #061014;
  cursor: pointer;
}
.tap-to-play::after {
  content: "点击播放";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #061014;
  font-size: 16px;
  font-weight: 800;
}

.player-hud {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 10px 18px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-weight: 700;
  pointer-events: none;
  z-index: 5;
}

.more-page {
  display: block;
  margin: 22px auto 0;
  padding: 10px 22px;
}

.fav-on { background: var(--accent) !important; color: #061014 !important; font-weight: 700; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #1c2430;
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 10px;
  z-index: 30;
}

@media (max-width: 980px) {
  .player-main { grid-template-columns: 1fr; }
}
