/* DramaHub 短劇H5平台 - 豎屏手機H5樣式 */
:root {
  --primary: #E50914;
  --primary-dark: #B20710;
  --bg-dark: #0a0a0a;
  --bg-card: #1a1a1a;
  --bg-card-light: #2a2a2a;
  --text-primary: #ffffff;
  --text-secondary: #999;
  --text-tertiary: #666;
  --gold: #FFD700;
  --gradient: linear-gradient(135deg, #E50914 0%, #B20710 100%);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: 'PingFang TC', 'Microsoft JhengHei', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
  /* 手機H5優化 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
}

/* 為了限制豎屏體驗，在桌面端居中顯示手機寬度容器 */
@media (min-width: 768px) {
  body {
    background: #000;
    display: flex;
    justify-content: center;
  }
  #app, .top-bar, .bottom-nav, .player-page, .auth-page, .profile-page, .vip-page, .search-page, .pay-confirm {
    max-width: 430px !important;
    margin: 0 auto;
    width: 100%;
  }
  .bottom-nav { max-width: 430px !important; }
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* 滾動條 */
::-webkit-scrollbar { width: 0px; display: none; }
* { scrollbar-width: none; -ms-overflow-style: none; }

/* === 頂部導航 === */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 48px;
  padding-top: var(--safe-top);
  background: rgba(10,10,10,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 15px;
  padding-right: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.top-bar .logo {
  font-size: 19px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}
.top-bar .search-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === 輪播圖（豎屏優化） === */
.banner {
  margin-top: calc(48px + var(--safe-top));
  width: 100%;
  height: 240px;
  overflow: hidden;
  position: relative;
}
.banner-slide {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  padding: 20px 15px;
}
.banner-slide::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60%;
  background: linear-gradient(to bottom, transparent, rgba(10,10,10,0.9));
}
.banner-slide .banner-content {
  position: relative;
  z-index: 2;
}
.banner-slide .title {
  font-size: 20px;
  font-weight: 700;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}
.banner-slide .desc {
  font-size: 12px;
  color: #ddd;
  margin-top: 4px;
  text-shadow: 0 1px 5px rgba(0,0,0,0.8);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* === 分類標籤 === */
.category-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 15px;
  overflow-x: auto;
  white-space: nowrap;
}
.category-tabs .tab {
  padding: 6px 14px;
  border-radius: 16px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  border: 1px solid transparent;
}
.category-tabs .tab.active {
  background: var(--primary);
  color: #fff;
}

/* === 短劇列表（豎屏3列） === */
.section-title {
  padding: 15px 15px 10px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title .more {
  font-size: 12px;
  color: var(--text-secondary);
}

.drama-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 12px 15px;
}
.drama-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s;
  background: var(--bg-card);
}
.drama-card:active { transform: scale(0.96); }
.drama-card .cover {
  width: 100%;
  aspect-ratio: 3/4;
  background-size: cover;
  background-position: center;
  background-color: #222;
  position: relative;
}
.drama-card .info {
  padding: 6px 8px 8px;
}
.drama-card .info .title {
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drama-card .info .meta {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.drama-card .badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 3px;
  font-weight: 600;
}
.drama-card .badge.gold {
  background: var(--gold);
  color: #000;
}
.drama-card .play-icon {
  position: absolute;
  bottom: 36px;
  right: 6px;
  width: 28px; height: 28px;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

/* === 底部導航 === */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(54px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(10,10,10,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
}
.bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-tertiary);
  font-size: 10px;
  cursor: pointer;
  flex: 1;
}
.bottom-nav .nav-item.active {
  color: var(--primary);
}
.bottom-nav .nav-item .icon {
  font-size: 20px;
  line-height: 1;
}

/* === 詳情頁（豎屏優化） === */
.detail-header {
  position: relative;
  width: 100%;
  height: 320px;
  background-size: cover;
  background-position: center top;
}
.detail-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 180px;
  background: linear-gradient(to bottom, transparent, var(--bg-dark));
}
.detail-header .back-btn {
  position: absolute;
  top: calc(12px + var(--safe-top)); left: 12px;
  z-index: 10;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
}
.detail-info {
  padding: 0 15px;
  margin-top: -50px;
  position: relative;
  z-index: 2;
}
.detail-info h1 {
  font-size: 20px;
  font-weight: 700;
}
.detail-info .meta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}
.detail-info .desc {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.7;
  color: #ccc;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}
.detail-actions .btn {
  flex: 1;
  height: 44px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: var(--gradient);
  color: #fff;
}
.btn-outline {
  background: var(--bg-card);
  color: #fff;
  border: 1px solid #333;
}

/* === 劇集列表 === */
.episode-list {
  padding: 20px 15px 80px;
}
.episode-list h3 {
  font-size: 15px;
  margin-bottom: 12px;
}
.episode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.episode-item {
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
  border: 2px solid transparent;
}
.episode-item:active { transform: scale(0.94); }
.episode-item.locked .lock-icon { font-size: 12px; color: var(--gold); }
.episode-item.free { border-color: rgba(76,175,80,0.3); }
.episode-item .ep-num {
  font-size: 16px;
  font-weight: 700;
}
.episode-item .ep-label {
  font-size: 9px;
  color: var(--text-tertiary);
}
.episode-item .free-tag {
  position: absolute;
  top: 2px; right: 2px;
  font-size: 8px;
  background: #4CAF50;
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
}

/* === TikTok式豎屏視頻流播放器 === */
.tiktok-player {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  background: #000;
  overflow: hidden;
}
.tiktok-feed {
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tiktok-feed::-webkit-scrollbar { display: none; }
.tiktok-slide {
  width: 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
.tiktok-slide video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
/* TikTok式覆蓋層 */
.tk-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 5;
}
.tk-top-bar {
  display: flex;
  align-items: center;
  padding: calc(12px + var(--safe-top)) 12px 10px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
  pointer-events: auto;
}
.tk-top-bar .back-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer;
  flex-shrink: 0;
}
.tk-top-bar .tk-title {
  flex: 1;
  text-align: center;
  font-size: 14px;
  color: #fff;
  text-shadow: 0 1px 5px rgba(0,0,0,0.8);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0 10px;
}
.tk-top-bar .tk-share {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer;
  flex-shrink: 0;
}
/* 右側操作欄 */
.tk-side-bar {
  position: absolute;
  right: 10px;
  bottom: 100px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  pointer-events: auto;
  z-index: 6;
}
.tk-side-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.tk-side-btn .tk-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  transition: transform 0.15s;
}
.tk-side-btn:active .tk-icon { transform: scale(0.85); }
.tk-side-btn .tk-label {
  font-size: 11px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.tk-side-btn.liked .tk-icon { color: #ff3b30; }
/* 底部信息 */
.tk-bottom-bar {
  position: absolute;
  left: 0; right: 60px; bottom: 0;
  padding: 15px 15px calc(25px + var(--safe-bottom));
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  pointer-events: auto;
  z-index: 5;
}
.tk-drama-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 5px rgba(0,0,0,0.8);
}
.tk-drama-meta {
  font-size: 12px;
  color: #ddd;
  margin-top: 4px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  gap: 8px;
}
.tk-drama-desc {
  font-size: 12px;
  color: #ccc;
  margin-top: 8px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tk-prog-bar {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}
.tk-prog-fill {
  height: 100%;
  background: #fff;
  width: 0%;
  border-radius: 2px;
  transition: width 0.1s linear;
}
/* 鎖定覆蓋 */
.tk-lock-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  text-align: center;
  padding: 0 30px;
}
.tk-lock-overlay .lock-blur {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  filter: blur(20px);
  background-size: cover;
  background-position: center;
  opacity: 0.3;
  z-index: -1;
}
.tk-lock-overlay .lock-icon-big {
  font-size: 50px;
  margin-bottom: 15px;
}
.tk-lock-overlay .lock-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}
.tk-lock-overlay .lock-desc {
  font-size: 13px;
  color: #aaa;
  margin-bottom: 22px;
  line-height: 1.6;
}
.tk-lock-overlay .lock-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 280px;
}
.tk-lock-overlay .lock-actions .btn {
  height: 44px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
/* 滑動提示 */
.tk-swipe-hint {
  position: absolute;
  bottom: 40%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  text-align: center;
  animation: tkPulse 2s ease-in-out infinite;
  pointer-events: none;
}
.tk-swipe-hint .arrow {
  font-size: 24px;
  display: block;
  margin-bottom: 5px;
}
@keyframes tkPulse {
  0%, 100% { opacity: 0.4; transform: translateX(-50%) translateY(0); }
  50% { opacity: 0.9; transform: translateX(-50%) translateY(-8px); }
}
/* 已觀看進度標記 */
.tk-watched {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 7;
  background: rgba(229,9,20,0.8);
  color: #fff;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

/* === 豎屏播放器頁 === */
.player-page {
  min-height: 100vh;
  background: #000;
}
.player-header {
  position: relative;
}
.video-container {
  width: 100%;
  background: #000;
  position: relative;
  aspect-ratio: 9/16;
  max-height: 100vh;
  overflow: hidden;
}
.video-container video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
/* 豎屏播放器覆蓋層 */
.video-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}
.video-top-bar {
  display: flex;
  align-items: center;
  padding: calc(12px + var(--safe-top)) 12px 12px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
  pointer-events: auto;
}
.video-top-bar .back-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
}
.video-top-bar .ep-title {
  flex: 1;
  text-align: center;
  font-size: 13px;
  color: #fff;
  text-shadow: 0 1px 5px rgba(0,0,0,0.8);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0 10px;
}
.video-bottom-bar {
  padding: 12px 15px calc(20px + var(--safe-bottom));
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  pointer-events: auto;
}
.video-bottom-bar .v-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 5px rgba(0,0,0,0.8);
}
.video-bottom-bar .v-meta {
  font-size: 12px;
  color: #ddd;
  margin-top: 4px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.video-bottom-bar .v-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.video-bottom-bar .v-actions .btn {
  flex: 1;
  height: 38px;
  border-radius: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
/* 豎屏側邊操作按鈕（抖音式） */
.video-side-bar {
  position: absolute;
  right: 10px;
  bottom: 120px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  pointer-events: auto;
}
.video-side-bar .side-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.video-side-bar .side-btn .icon {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.video-side-bar .side-btn .count {
  font-size: 11px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
/* 豎屏鎖定提示覆蓋 */
.video-lock-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5;
}
.video-lock-overlay .lock-icon-big {
  font-size: 48px;
  margin-bottom: 12px;
}
.video-lock-overlay .lock-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}
.video-lock-overlay .lock-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  text-align: center;
  padding: 0 30px;
}
.video-lock-overlay .lock-actions {
  display: flex;
  gap: 10px;
  width: 80%;
  max-width: 280px;
}
.video-lock-overlay .lock-actions .btn {
  flex: 1;
  height: 42px;
  border-radius: 21px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
/* 播放列表（豎屏橫向滑動） */
.player-episodes {
  padding: 15px 0 80px;
}
.player-episodes h3 {
  font-size: 14px;
  padding: 0 15px;
  margin-bottom: 10px;
}
.player-episodes .ep-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 15px 10px;
}
.player-episodes .ep-scroll .ep-card {
  flex-shrink: 0;
  width: 100px;
  border-radius: 8px;
  background: var(--bg-card);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  position: relative;
}
.player-episodes .ep-scroll .ep-card.current {
  border-color: var(--primary);
}
.player-episodes .ep-scroll .ep-card .ep-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background-size: cover;
  background-position: center;
  background-color: #222;
}
.player-episodes .ep-scroll .ep-card .ep-info {
  padding: 6px 8px;
}
.player-episodes .ep-scroll .ep-card .ep-num {
  font-size: 12px;
  font-weight: 600;
}
.player-episodes .ep-scroll .ep-card .ep-status {
  font-size: 10px;
  color: var(--text-tertiary);
}
.player-episodes .ep-scroll .ep-card.locked .ep-thumb::after {
  content: '🔒';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
}

/* === 登入/註冊 === */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-top: calc(40px + var(--safe-top));
}
.auth-logo {
  font-size: 30px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 30px;
}
.auth-form {
  width: 100%;
  max-width: 360px;
}
.auth-form .form-group {
  margin-bottom: 16px;
}
.auth-form label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.auth-form input {
  width: 100%;
  height: 48px;
  background: var(--bg-card);
  border: 1px solid #333;
  border-radius: 12px;
  color: #fff;
  padding: 0 16px;
  font-size: 15px;
  -webkit-appearance: none;
  appearance: none;
}
.auth-form input:focus {
  border-color: var(--primary);
  outline: none;
}
.auth-form .btn-submit {
  width: 100%;
  height: 48px;
  background: var(--gradient);
  border: none;
  border-radius: 24px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
}
.auth-link {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-secondary);
}
.auth-link a {
  color: var(--primary);
}

/* === 個人中心 === */
.profile-page {
  min-height: 100vh;
  padding-top: calc(48px + var(--safe-top));
  padding-bottom: calc(60px + var(--safe-bottom));
}
.profile-header {
  padding: 30px 20px;
  text-align: center;
  background: linear-gradient(180deg, #1a1a1a, var(--bg-dark));
}
.profile-header .avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--gradient);
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
}
.profile-header .username {
  font-size: 17px;
  font-weight: 600;
}
.profile-header .vip-badge {
  display: inline-block;
  background: var(--gold);
  color: #000;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 12px;
  margin-top: 4px;
}
.profile-stats {
  display: flex;
  justify-content: space-around;
  padding: 20px;
  border-bottom: 1px solid #222;
}
.profile-stats .stat-item {
  text-align: center;
}
.profile-stats .stat-item .num {
  font-size: 18px;
  font-weight: 700;
}
.profile-stats .stat-item .label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.profile-menu {
  padding: 0 15px;
}
.profile-menu .menu-item {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #1a1a1a;
  cursor: pointer;
}
.profile-menu .menu-item .icon { width: 30px; font-size: 17px; }
.profile-menu .menu-item .text { flex: 1; font-size: 14px; }
.profile-menu .menu-item .arrow { color: var(--text-tertiary); font-size: 14px; }

/* === VIP頁面 === */
.vip-page {
  min-height: 100vh;
  padding: 20px 15px calc(80px + var(--safe-bottom));
  padding-top: calc(20px + var(--safe-top) + 48px);
}
.vip-header {
  text-align: center;
  padding: 20px 0;
}
.vip-header h1 {
  font-size: 26px;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}
.vip-header p { color: var(--text-secondary); font-size: 13px; }
.vip-plans {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 25px;
}
.vip-plan {
  border: 2px solid #333;
  border-radius: 12px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s;
}
.vip-plan.active {
  border-color: var(--gold);
  background: rgba(255,215,0,0.05);
}
.vip-plan .plan-name {
  font-size: 17px;
  font-weight: 700;
}
.vip-plan .plan-price {
  font-size: 30px;
  font-weight: 800;
  color: var(--gold);
  margin-top: 6px;
}
.vip-plan .plan-price .unit { font-size: 15px; }
.vip-plan .plan-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.vip-features {
  margin-top: 25px;
}
.vip-features .feature {
  padding: 10px 0;
  border-bottom: 1px solid #1a1a1a;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.vip-features .feature .check { color: #4CAF50; }

/* === 支付確認 === */
.pay-confirm {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-top: calc(40px + var(--safe-top));
}
.pay-confirm .amount {
  font-size: 44px;
  font-weight: 800;
  color: var(--gold);
}
.pay-confirm .desc {
  color: var(--text-secondary);
  margin-top: 8px;
  font-size: 13px;
}
.pay-confirm .paypal-btn {
  margin-top: 30px;
  width: 100%;
  max-width: 300px;
  height: 50px;
  background: #0070BA;
  border: none;
  border-radius: 25px;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}
.pay-confirm .paypal-btn:hover { background: #005ea6; }

/* === 彈窗 === */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 25px 20px;
  width: 90%;
  max-width: 340px;
  text-align: center;
}
.modal h3 { font-size: 17px; margin-bottom: 10px; }
.modal p { color: var(--text-secondary); font-size: 13px; margin-bottom: 20px; }
.modal .btn-row { display: flex; gap: 10px; }
.modal .btn-row .btn { flex: 1; height: 42px; border-radius: 21px; border: none; font-size: 14px; font-weight: 600; cursor: pointer; }
.modal .btn-cancel { background: #333; color: #fff; }
.modal .btn-confirm { background: var(--gradient); color: #fff; }

/* === Toast === */
.toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  max-width: 80%;
  text-align: center;
}
.toast.show { opacity: 1; }

/* === 搜索頁 === */
.search-page {
  padding-top: calc(48px + var(--safe-top));
}
.search-bar {
  padding: 10px 15px;
  display: flex;
  gap: 10px;
  position: fixed;
  top: calc(48px + var(--safe-top));
  left: 0; right: 0;
  background: var(--bg-dark);
  z-index: 50;
}
.search-bar input {
  flex: 1;
  height: 38px;
  background: var(--bg-card);
  border: 1px solid #333;
  border-radius: 19px;
  color: #fff;
  padding: 0 15px;
  font-size: 14px;
  -webkit-appearance: none;
}
.search-bar button {
  background: var(--primary);
  border: none;
  color: #fff;
  padding: 0 18px;
  border-radius: 19px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.search-results {
  padding: 60px 12px 80px;
}
.search-results .drama-grid {
  padding: 0;
}

/* === 載入動畫 === */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  color: var(--text-tertiary);
  font-size: 13px;
}
.spinner {
  width: 22px; height: 22px;
  border: 2px solid #333;
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* === 空狀態 === */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}
.empty-state .icon { font-size: 44px; margin-bottom: 10px; }

/* === 豎屏全屏播放模式 === */
.player-fullscreen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 999;
  background: #000;
  display: none;
  flex-direction: column;
}
.player-fullscreen.show {
  display: flex;
}
.player-fullscreen video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.player-fullscreen .fs-back {
  position: absolute;
  top: calc(15px + var(--safe-top)); left: 15px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  z-index: 10;
  cursor: pointer;
}

/* === 橫屏提示 === */
.rotate-hint {
  display: none;
}
@media (orientation: landscape) and (max-height: 500px) {
  .rotate-hint {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
  }
  .rotate-hint .icon {
    font-size: 48px;
    animation: rotate-anim 1.5s ease-in-out infinite;
    margin-bottom: 15px;
  }
  .rotate-hint .text {
    font-size: 16px;
    color: #ccc;
  }
}
@keyframes rotate-anim {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(90deg); }
}

/* === 滑動進入動畫 === */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.drama-card {
  animation: fadeInUp 0.3s ease-out;
}

/* === 頁面底部留白（避免被底欄遮擋） === */
.content-bottom-padding {
  height: calc(70px + var(--safe-bottom));
}

/* === 播放器內選集面板 === */
.tk-ep-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-height: 70vh;
  background: rgba(20,20,20,0.98);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: 16px 16px 0 0;
  z-index: 10000;
  display: none;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
.tk-ep-panel.show {
  display: flex;
  transform: translateY(0);
}
.tk-ep-panel .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}
.tk-ep-panel .panel-header .ph-title {
  font-size: 16px;
  font-weight: 700;
}
.tk-ep-panel .panel-header .ph-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.tk-ep-panel .panel-header .ph-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #333;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer;
}
.tk-ep-panel .panel-body {
  overflow-y: auto;
  padding: 12px 15px calc(20px + var(--safe-bottom));
}
.tk-ep-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.tk-ep-grid .tk-ep-item {
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  border: 2px solid transparent;
  transition: all 0.15s;
  font-size: 15px;
  font-weight: 700;
}
.tk-ep-grid .tk-ep-item:active { transform: scale(0.92); }
.tk-ep-grid .tk-ep-item.current {
  border-color: var(--primary);
  background: rgba(229,9,20,0.15);
  color: var(--primary);
}
.tk-ep-grid .tk-ep-item.watched {
  opacity: 0.5;
}
.tk-ep-grid .tk-ep-item.watched::after {
  content: '✓';
  position: absolute;
  top: 2px; right: 4px;
  font-size: 10px;
  color: #4CAF50;
}
.tk-ep-grid .tk-ep-item.locked {
  color: var(--gold);
}
.tk-ep-grid .tk-ep-item.locked .lock-mark {
  position: absolute;
  bottom: 2px;
  font-size: 10px;
}
.tk-ep-grid .tk-ep-item.free .free-mark {
  position: absolute;
  top: 2px; left: 2px;
  font-size: 8px;
  background: #4CAF50;
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
}
.tk-ep-grid .tk-ep-item .ep-label {
  font-size: 9px;
  color: var(--text-tertiary);
  margin-top: 1px;
  font-weight: 400;
}

/* 選集面板遮罩 */
.tk-panel-mask {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: none;
}
.tk-panel-mask.show { display: block; }

/* === 結尾頁推薦更多短劇 === */
.tk-end-recommend {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}
.tk-end-recommend .er-title {
  font-size: 14px;
  color: #999;
  margin-bottom: 12px;
  text-align: left;
}
.tk-end-recommend .er-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.tk-end-recommend .er-card {
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #1a1a1a;
  transition: transform 0.15s;
}
.tk-end-recommend .er-card:active { transform: scale(0.95); }
.tk-end-recommend .er-card .cover {
  width: 100%;
  aspect-ratio: 3/4;
  background-size: cover;
  background-position: center;
  background-color: #222;
}
.tk-end-recommend .er-card .title {
  font-size: 11px;
  padding: 4px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 封面角标横排（多标签不再重叠） */
.drama-card .badge-row {
  position: absolute;
  top: 4px;
  left: 4px;
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  max-width: calc(100% - 8px);
}
.drama-card .badge-row .badge {
  position: static;
}
.drama-card .badge.vip {
  background: linear-gradient(135deg, #f5b942, #e08c1a);
  color: #3a2400;
}

/* 靜音自動播放提示 */
.tk-sound-hint {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 16px;
  z-index: 30;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
}

/* === Facebook 登入 / 認證頁補充 === */
.auth-note {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  margin-top: 14px;
  line-height: 1.6;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-tertiary);
  font-size: 12px;
  margin: 22px 0 18px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}
.btn-fb {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #1877F2;
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-fb:active { opacity: .82; }
.btn-fb svg { flex: 0 0 auto; }
