:root {
  color-scheme: dark;
  --bg: #000;
  --text: #f2f2f2;
  --muted: #9a9a9a;
  --chip: #2a2a2a;
  --chip-on: #f22e52;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.play-page {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 16px;
}

.play-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  padding-top: calc(8px + var(--safe-t));
  min-height: 44px;
}

.play-back {
  flex-shrink: 0;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  text-decoration: none;
  font-size: 22px;
}

.play-brand {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-top__share {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.play-top__ad {
  flex-shrink: 0;
  max-width: 42%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.play-top:not(.play-top--has-ad) .play-top__ad {
  display: none;
}

.play-mid-ad:empty {
  display: none;
  margin: 0;
  padding: 0;
}

.play-slot-ad--compact {
  max-width: 100%;
}

.play-slot-ad--compact .play-slot-ad__media {
  max-height: 40px;
  border-radius: 8px;
  overflow: hidden;
}

.play-slot-ad--compact .play-slot-ad__media img,
.play-slot-ad--compact .play-slot-ad__media video {
  display: block;
  max-height: 40px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.play-slot-ad--compact .play-slot-ad__text {
  margin: 0;
  font-size: 12px;
  line-height: 1.3;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-slot-ad--banner {
  width: 100%;
}

.play-slot-ad--banner .play-slot-ad__media {
  border-radius: 10px;
  overflow: hidden;
  background: #1a1a1a;
}

.play-slot-ad--banner .play-slot-ad__media img,
.play-slot-ad--banner .play-slot-ad__media video {
  display: block;
  width: 100%;
  max-height: 120px;
  object-fit: cover;
}

.play-slot-ad__title {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
}

.play-slot-ad__text {
  margin: 0;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  background: #1a1a1a;
  border-radius: 10px;
}

.play-slot-ad--clickable {
  cursor: pointer;
}

.play-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: min(72vh, 680px);
  background: #111;
}

.play-tap-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
  padding: 16px;
  border: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.play-tap-overlay[data-mode='loading'] {
  pointer-events: none;
  cursor: default;
}

.play-tap-overlay__icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--chip-on);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  padding-left: 5px;
  box-shadow: 0 6px 28px rgba(242, 46, 82, 0.45);
}

.play-tap-overlay__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: play-spin 0.75s linear infinite;
  flex-shrink: 0;
}

.play-unmute-hint {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 4;
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.play-unmute-hint[hidden] {
  display: none !important;
}

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

.play-tap-overlay[hidden] {
  display: none !important;
}

.play-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* 沉浸播放：主流短剧 H5 进页自动铺满视口，Recolher 回到详情 */
html.is-play-immersive body {
  overflow: hidden;
}

html.is-play-immersive .app-tabbar {
  visibility: hidden;
  pointer-events: none;
}

.play-page.is-immersive .play-top,
.play-page.is-immersive .play-info,
.play-page.is-immersive .play-mid-ad,
.play-page.is-immersive .play-episodes-title,
.play-page.is-immersive .episode-scroll,
.play-page.is-immersive .play-err {
  display: none;
}

.play-page.is-immersive .play-stage {
  position: fixed;
  inset: 0;
  z-index: 200;
  width: 100%;
  max-height: none;
  height: 100%;
  height: 100dvh;
  aspect-ratio: auto;
  background: #000;
}

.play-page.is-immersive .play-stage video {
  object-fit: contain;
}

.play-immersive-exit {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: calc(8px + env(safe-area-inset-left, 0px));
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  -webkit-tap-highlight-color: transparent;
}

.play-immersive-exit__icon {
  font-size: 16px;
  line-height: 1;
}

.play-immersive-exit[hidden] {
  display: none !important;
}

@media (min-width: 901px) {
  .play-immersive-exit {
    display: none !important;
  }
}

.play-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.play-poster.is-hidden {
  display: none;
}

.play-info {
  padding: 12px 14px 8px;
}

.play-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
}

.play-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.play-stats strong {
  color: var(--text);
  font-weight: 600;
}

.play-desc {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: #ccc;
}

.play-episodes-title {
  margin: 16px 14px 8px;
  font-size: 14px;
  font-weight: 600;
}

.episode-scroll {
  display: flex;
  gap: 8px;
  padding: 0 12px 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.episode-chip {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: var(--chip);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.episode-chip.is-on {
  background: var(--chip-on);
  color: #fff;
}

.episode-chip.is-locked {
  opacity: 0.72;
}

.episode-chip.is-locked::after {
  content: ' 🔒';
  font-size: 10px;
}

.episode-chip.is-paywall {
  opacity: 0.85;
  box-shadow: inset 0 0 0 1px rgba(242, 46, 82, 0.45);
}

.episode-chip.is-paywall::after {
  content: ' 💎';
  font-size: 10px;
}

.series-sub-dialog {
  border: none;
  padding: 0;
  max-width: min(400px, calc(100vw - 32px));
  width: 100%;
  background: transparent;
  color: var(--text);
}

.series-sub-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.series-sub-dialog__card {
  margin: auto;
  padding: 20px 18px calc(18px + var(--safe-b));
  border-radius: 14px;
  background: #141414;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.series-sub-dialog__title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
}

.series-sub-dialog__desc {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.45;
  color: #ccc;
}

.series-sub-dialog__price {
  margin: 0 0 16px;
  font-size: 22px;
  font-weight: 700;
  color: var(--chip-on);
}

.series-sub-dialog__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.series-sub-dialog__btn {
  min-height: 48px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.series-sub-dialog__btn--primary {
  background: var(--chip-on);
  color: #fff;
}

.series-sub-dialog__btn--ghost {
  background: #2a2a2a;
  color: var(--text);
}

.series-sub-dialog__hint {
  margin: 12px 0 0;
  font-size: 13px;
  color: #f88;
}

.series-sub-pix {
  margin-bottom: 12px;
}

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

.series-sub-pix__code {
  width: 100%;
  margin: 0 0 8px;
  padding: 10px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #0a0a0a;
  color: var(--text);
  font-size: 11px;
  line-height: 1.35;
  resize: none;
}

.series-sub-pix__wait {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.play-err {
  padding: 24px 14px;
  color: #f88;
  font-size: 14px;
}

body.ad-open {
  overflow: hidden;
}

.ad-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  padding: calc(12px + var(--safe-t)) 12px calc(12px + var(--safe-b));
}

.ad-overlay__inner {
  width: 100%;
  max-width: 480px;
  cursor: pointer;
}

.ad-overlay__title {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
}

.ad-overlay__media {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #111;
  cursor: pointer;
  touch-action: manipulation;
}

.ad-overlay__media--loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #1a1a1a 0%, #2a2a2a 50%, #1a1a1a 100%);
  background-size: 200% 100%;
  animation: ad-shimmer 1.2s ease-in-out infinite;
  pointer-events: none;
}

.ad-overlay__media--err {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.ad-overlay__media-err {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
}

.ad-overlay__media-fallback {
  max-width: 100%;
  max-height: 55%;
  object-fit: contain;
}

@keyframes ad-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.ad-overlay__media video,
.ad-overlay__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ad-overlay__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  gap: 12px;
}

.ad-overlay__count {
  font-size: 13px;
  color: var(--muted);
}

.ad-overlay__skip {
  min-height: 44px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.ad-overlay__skip:disabled {
  opacity: 0.45;
}

.ad-overlay__progress {
  height: 3px;
  margin-bottom: 8px;
  border-radius: 2px;
  background: #333;
  overflow: hidden;
}

.ad-overlay__progress-fill {
  height: 100%;
  width: 0;
  background: var(--chip-on);
  transition: width 0.25s linear;
}

.ad-overlay__hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--accent, #f22e52);
  text-align: center;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
