@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,500;9..40,700&family=Noto+Sans+SC:wght@400;500;700&display=swap');

:root {
  --bg: #07070a;
  --bg-2: #111116;
  --bg-3: #1a1a22;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f6f4f1;
  --muted: #9a96a3;
  --accent: #ff4d6d;
  --accent-soft: rgba(255, 77, 109, 0.16);
  --accent-2: #ffb703;
  --radius: 16px;
  --tab-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-space: calc(var(--tab-h) + max(8px, var(--safe-bottom)));
  font-family: 'Noto Sans SC', 'DM Sans', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html,
body,
#root,
.app-shell {
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.pager a,
.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
}
.pager a.disabled,
.pager-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(255, 77, 109, 0.18), transparent 55%),
    radial-gradient(700px 360px at 100% 20%, rgba(255, 183, 3, 0.06), transparent 45%),
    #07070a;
  color: var(--text);
}

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

button,
input {
  font: inherit;
}

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

.app-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding-bottom: var(--tabbar-space);
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  backdrop-filter: blur(18px);
  background: rgba(7, 7, 10, 0.82);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ff4d6d, #ff7a59);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 8px 24px rgba(255, 77, 109, 0.35);
}

.brand-text {
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 1rem;
}

.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 14px;
  height: 40px;
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--line);
}

.search-icon {
  color: var(--muted);
  font-size: 1rem;
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
}

.search input::placeholder {
  color: #6f6b78;
}

.main {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 12px 14px 28px;
}

.tabbar {
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 40;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  min-height: var(--tab-h);
  padding-top: 6px;
  padding-bottom: max(8px, var(--safe-bottom));
  padding-left: max(4px, env(safe-area-inset-left, 0px));
  padding-right: max(4px, env(safe-area-inset-right, 0px));
  background: rgba(12, 12, 16, 0.96);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.2;
  padding: 4px 2px;
  overflow: hidden;
  text-align: center;
}

.tab span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-icon {
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
}

.tab.active {
  color: var(--accent);
}

.page {
  display: grid;
  gap: 18px;
  width: 100%;
  max-width: 100%;
}

.drama-hero {
  position: relative;
  display: block;
  min-height: 280px;
  border-radius: 22px;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  animation: rise 0.45s ease both;
}

.drama-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.04);
}

.drama-hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7, 7, 10, 0.15) 0%, rgba(7, 7, 10, 0.92) 78%),
    linear-gradient(90deg, rgba(7, 7, 10, 0.55), transparent 55%);
}

.drama-hero-body {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: end;
  gap: 8px;
  min-height: 280px;
  padding: 22px 20px;
}

.hero-tag {
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #ff8fa3;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.drama-hero-body h1 {
  margin: 0;
  font-size: clamp(1.45rem, 4vw, 2rem);
  font-weight: 700;
  max-width: 14em;
}

.drama-hero-body p {
  margin: 0;
  color: #c9c4cf;
  font-size: 0.9rem;
}

.hero-cta {
  margin-top: 6px;
  width: fit-content;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff4d6d, #ff7a59);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 10px 28px rgba(255, 77, 109, 0.35);
}

.genre-pills {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

.genre-pills::-webkit-scrollbar {
  display: none;
}

.pill,
.chip,
.ep,
.pager button,
.text-btn,
.hero-cta {
  cursor: pointer;
  border: 0;
  transition: 0.18s ease;
}

.pill {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 0.86rem;
}

.pill:hover,
.pill-muted:hover {
  border-color: rgba(255, 77, 109, 0.4);
}

.pill-muted {
  color: var(--muted);
}

.rail-section,
.section,
.featured-strip {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  justify-items: stretch;
}

.section.compact {
  gap: 10px;
}

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

.section-head h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
}

.more-link,
.section-head span,
.tags,
.actors,
.crumb,
.now-ep {
  color: var(--muted);
  font-size: 0.86rem;
}

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

.rail {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 8px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

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

.vod-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.vod-card-rail {
  box-sizing: border-box;
  flex: 0 0 120px;
  width: 120px;
  min-width: 120px;
  max-width: 120px;
  scroll-snap-align: start;
}

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

.poster {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 14px;
  background: var(--bg-3);
  border: 1px solid var(--line);
}

.poster.tiny {
  width: 54px;
  flex-shrink: 0;
}

.poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.vod-card:hover .poster img,
.featured-card:hover img {
  transform: scale(1.05);
}

.poster-veil {
  position: absolute;
  inset: auto 0 0;
  height: 46%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  pointer-events: none;
  z-index: 1;
}

.poster-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  color: var(--muted);
  background: linear-gradient(160deg, #2a2430, #15141b);
}

.badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  max-width: calc(100% - 16px);
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.68rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.meta h3,
.history-meta h3,
.featured-card strong {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta p,
.history-meta p,
.featured-card span {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.featured-row {
  display: grid;
  gap: 10px;
}

.featured-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  background: rgba(26, 26, 34, 0.9);
  border: 1px solid var(--line);
}

.featured-card img {
  width: 72px;
  height: 96px;
  object-fit: cover;
  border-radius: 10px;
}

.class-group {
  display: grid;
  gap: 8px;
}

.class-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.class-bar,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 0.84rem;
}

.chip.active,
.chip:hover {
  background: var(--accent-soft);
  border-color: rgba(255, 77, 109, 0.45);
  color: #ff8fa3;
}

.state,
.empty-player {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  line-height: 1.7;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 42vh;
  margin: 0;
  padding: 40px 16px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  line-height: 1.7;
  text-align: center;
}

.state.error {
  color: #ff7b8a;
  border-color: rgba(255, 77, 109, 0.35);
}

.empty-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  text-align: center;
}

.empty-text span {
  display: block;
  width: 100%;
  text-align: center;
}

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  padding-top: 4px;
}

.pager button {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line);
}

.pager button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.detail-page {
  gap: 12px;
}

.detail-recommend {
  display: grid;
  gap: 18px;
  padding-top: 4px;
  padding-bottom: 8px;
}

.player-panel {
  position: relative;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.share-gate {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  aspect-ratio: 16 / 9;
  width: 100%;
  padding: 16px;
  overflow: hidden;
  background:
    radial-gradient(600px 240px at 50% 0%, rgba(255, 77, 109, 0.2), transparent 60%),
    #0c0c10;
}

.share-gate-card {
  width: min(520px, 100%);
  display: grid;
  gap: 12px;
  text-align: center;
}

.share-kicker {
  margin: 0;
  color: #ff8fa3;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.share-gate-card h2 {
  margin: 0;
  font-size: 1.35rem;
}

.share-desc {
  margin: 0;
  color: #c9c4cf;
  font-size: 0.9rem;
  line-height: 1.65;
}

.share-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.share-platform {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  color: #ddd7e2;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 4px;
}

.share-primary,
.share-confirm {
  border: 0;
  cursor: pointer;
  width: fit-content;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
}

.share-primary {
  background: linear-gradient(135deg, #ff4d6d, #ff7a59);
  color: #fff;
  box-shadow: 0 10px 28px rgba(255, 77, 109, 0.35);
}

.share-confirm {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 77, 109, 0.45);
}

.share-primary:disabled,
.share-confirm:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.share-link-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  text-align: left;
}

.share-link-box code {
  font-size: 0.72rem;
  color: #d7d0dc;
  word-break: break-all;
}

.share-msg {
  margin: 0;
  color: #ffb4c0;
  font-size: 0.86rem;
}

.share-msg.error {
  color: #ff7b8a;
}

.share-toast {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 77, 109, 0.12);
  border: 1px solid rgba(255, 77, 109, 0.28);
  color: #ffb4c0;
  font-size: 0.86rem;
}

/* 统一尊重 hidden，避免被组件 display 规则盖掉 */
[hidden] {
  display: none !important;
}

/* 默认隐藏；只有加 .is-open 才显示检测弹层 */
.share-modal {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: none;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
}

.share-modal.is-open {
  display: grid;
}

.share-modal-card {
  width: min(420px, 100%);
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  padding: 22px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, #1a1218, #120e14);
  border: 1px solid rgba(255, 77, 109, 0.28);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.share-modal-card h3 {
  margin: 0;
  font-size: 1.15rem;
}

.share-modal-card > p {
  margin: 0;
  color: #e8dfe6;
  font-size: 0.92rem;
}

.share-modal-sub {
  color: var(--muted) !important;
  font-size: 0.8rem !important;
}

.share-countdown {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 77, 109, 0.16);
  border: 2px solid rgba(255, 77, 109, 0.55);
  animation: pulse-count 1s ease-in-out infinite;
}

.share-modal-spinner {
  margin: 8px auto;
}

.share-fail-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 1.6rem;
  font-weight: 700;
  color: #ffb4c0;
  background: rgba(255, 77, 109, 0.12);
  border: 1px solid rgba(255, 77, 109, 0.35);
}

.share-fail-list {
  margin: 4px 0 0;
  padding-left: 1.1em;
  text-align: left;
  color: #c9c4cf;
  font-size: 0.84rem;
  line-height: 1.7;
}

.share-fail-actions {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 6px;
}

.share-fail-actions.is-open {
  display: flex;
}

.share-secondary {
  border: 1px solid var(--line);
  cursor: pointer;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-weight: 600;
}

@keyframes pulse-count {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

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

.player video,
.player-frame {
  width: 100%;
  height: 100%;
  background: #000;
  border: 0;
}

.player-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  gap: 12px;
  padding: 20px;
  text-align: center;
  background: rgba(0, 0, 0, 0.55);
  color: #f2f2f2;
  font-size: 0.9rem;
  pointer-events: none;
}

.player-error .player-overlay {
  background: rgba(0, 0, 0, 0.78);
}

.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

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

.detail-sheet {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: rgba(18, 18, 24, 0.96);
  border-radius: 18px;
  border: 1px solid var(--line);
  position: relative;
  z-index: 2;
}

.detail-title-block h1 {
  margin: 4px 0 8px;
  font-size: 1.4rem;
  font-weight: 700;
}

.blurb {
  margin: 0;
  color: #c7c2cd;
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.actors {
  margin: 0;
}

.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 8px;
}

.ep {
  padding: 12px 6px;
  border-radius: 12px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 0.84rem;
}

.ep.active,
.ep:hover {
  background: var(--accent-soft);
  border-color: rgba(255, 77, 109, 0.5);
  color: #ff8fa3;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  background: rgba(26, 26, 34, 0.92);
  border: 1px solid var(--line);
}

.history-meta {
  flex: 1;
  min-width: 0;
}

.history-go {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  flex-shrink: 0;
}

.text-btn {
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.text-btn:hover {
  color: var(--accent);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (min-width: 768px) {
  .main {
    padding: 18px 20px 36px;
  }

  .vod-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .vod-card-rail {
    flex: 0 0 140px;
    width: 140px;
    min-width: 140px;
    max-width: 140px;
  }

  .drama-hero,
  .drama-hero-body {
    min-height: 340px;
  }

  .detail-page {
    gap: 16px;
  }

  .detail-sheet {
    padding: 20px;
  }
}

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

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

  .vod-card-rail {
    flex: 0 0 108px;
    width: 108px;
    min-width: 108px;
    max-width: 108px;
  }
}
