:root {
  --bg-main: #0b0e14;
  --bg-sidebar: #0f131a;
  --bg-card: #151a23;
  --bg-elevated: #1b222e;
  --accent: #10b981;
  --accent-hover: #0ea572;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --sidebar-width: 220px;
  --header-height: 64px;
  --radius-sm: 8px;
  --radius-md: 11px;
  --radius-lg: 14px;
  --font-display: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Noto Sans TC", system-ui, -apple-system, sans-serif;
  --font-body: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Noto Sans TC", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background-color: var(--bg-main);
}

body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 68% -8%, rgba(16, 185, 129, 0.12), transparent 40%),
    var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.55;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

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

button,
input {
  font-family: inherit;
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: flex;
}

/* =========================================================
   左側固定導覽欄 (220px)
   ========================================================= */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform 200ms var(--ease-out);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out),
    border-color 160ms var(--ease-out);
}

.nav-item svg {
  color: var(--accent);
  flex-shrink: 0;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.nav-item.is-active {
  background-color: var(--accent-soft);
  color: var(--text-primary);
  border-color: rgba(16, 185, 129, 0.28);
}

.sidebar-divider {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 2px 4px;
}

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

.sidebar-section-label {
  margin: 0;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.category-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.category-btn {
  width: 100%;
  min-height: 38px;
  padding: 7px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

.category-btn-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-btn-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.category-btn:hover {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--text-primary);
}

.category-btn.is-active {
  background-color: var(--accent);
  color: #052218;
  font-weight: 600;
}

.category-btn.is-active .category-btn-count {
  color: #063626;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(4, 6, 10, 0.72);
  backdrop-filter: blur(2px);
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms var(--ease-out);
}

.sidebar-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* =========================================================
   右側主內容區
   ========================================================= */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 頂部黏性導覽列 */
.sticky-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-height);
  padding: 0 4vw;
  background-color: rgba(11, 14, 20, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 18px;
}

.mobile-brand {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.mobile-home-btn {
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 500;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.mobile-home-btn:hover {
  background-color: var(--bg-elevated);
  border-color: var(--accent);
}

.search-form {
  flex: 1;
  max-width: 580px;
  height: 40px;
  display: flex;
  align-items: stretch;
  background-color: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  transition: border-color 160ms var(--ease-out);
}

.search-form:focus-within {
  border-color: var(--accent);
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  height: 100%;
  padding: 0 34px 0 18px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.search-clear-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.08);
}

.search-submit-btn {
  padding: 0 18px;
  border: none;
  background-color: var(--accent);
  color: #041d14;
  font-size: 0.88rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 160ms var(--ease-out);
}

.search-submit-btn:hover {
  background-color: var(--accent-hover);
}

.header-quick-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
}

.header-quick-links a:hover {
  color: var(--text-primary);
}

.btn-primary {
  min-height: 40px;
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background-color: var(--accent);
  color: #052218;
  font-size: 0.92rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 160ms var(--ease-out), transform 140ms var(--ease-out);
}

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

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  min-height: 38px;
  padding: 7px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.btn-secondary:hover {
  background-color: var(--bg-elevated);
  border-color: rgba(255, 255, 255, 0.28);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.icon-btn:hover {
  background-color: var(--bg-elevated);
  border-color: var(--border-strong);
}

.mobile-only {
  display: none;
}

/* =========================================================
   主內容區
   ========================================================= */
.main-content {
  flex: 1;
  width: 100%;
  padding: 0 4vw 48px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* =========================================================
   主視覺橫幅 (全寬展開 + 底部 6 張海報預覽列)
   ========================================================= */
.hero-banner {
  position: relative;
  margin: 0 -4vw;
  min-height: 560px;
  overflow: hidden;
  background-color: #0e131c;
  display: flex;
  align-items: flex-end;
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  display: block;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(11, 14, 20, 0.96) 0%, rgba(11, 14, 20, 0.78) 42%, rgba(11, 14, 20, 0.16) 100%),
    linear-gradient(180deg, rgba(11, 14, 20, 0.15) 0%, rgba(11, 14, 20, 0.52) 55%, rgba(11, 14, 20, 0.98) 100%);
}

.hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 52px 4vw 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.hero-copy {
  max-width: 540px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-kicker {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--accent);
}

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.3vw, 2.8rem);
  font-weight: 700;
  line-height: 1.18;
  color: var(--text-primary);
  text-wrap: balance;
}

.hero-desc {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.6;
  color: #cbd5e1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-actions {
  margin-top: 8px;
}

.hero-play-btn {
  min-height: 44px;
  padding: 10px 24px;
}

.hero-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

/* =========================================================
   首頁欄目分頁標籤列 & 多欄目區
   ========================================================= */
.home-view {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.home-tabs {
  display: flex;
  align-items: center;
  gap: 26px;
  padding-top: 4px;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.home-tabs a {
  padding: 10px 0;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.home-tabs a:hover,
.home-tabs a.is-active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

.home-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-margin-top: 84px;
}

.home-category-sections {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.section-heading-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.section-kicker {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-muted);
}

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

.section-more-btn {
  padding: 6px 4px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 150ms var(--ease-out);
}

.section-more-btn:hover {
  opacity: 0.82;
}

.browse-header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.section-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.status-banner {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-banner.is-error {
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

/* =========================================================
   響應式 2:3 影片海報網格 (CSS Grid)
   ========================================================= */
.video-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px 14px;
}

.vod-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 180ms var(--ease-out), border-color 180ms var(--ease-out);
}

.vod-card:hover {
  transform: translateY(-4px);
  border-color: rgba(16, 185, 129, 0.45);
}

.poster-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  background-color: #0e1219;
  overflow: hidden;
}

.poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 240ms var(--ease-out);
}

.vod-card:hover .poster-img {
  transform: scale(1.04);
}

.poster-fallback {
  position: absolute;
  inset: 0;
  padding: 16px;
  background: radial-gradient(circle at 30% 25%, #1d2636 0%, #10151e 72%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  color: var(--text-muted);
}

.poster-fallback-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.35;
}

.poster-scrim {
  position: absolute;
  inset: auto 0 0 0;
  height: 44%;
  background: linear-gradient(180deg, transparent 0%, rgba(11, 14, 20, 0.84) 100%);
  pointer-events: none;
}

.card-play-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;
  background-color: var(--accent);
  color: #052218;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  transition: transform 180ms var(--ease-out), background-color 160ms var(--ease-out);
}

.vod-card:hover .card-play-btn {
  transform: scale(1.08);
  background-color: var(--accent-hover);
}

.card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  margin: 0;
  font-size: 0.77rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 熱門榜單與全部分類區塊 */
.rank-panel,
.categories-panel {
  padding: 22px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-margin-top: 84px;
}

.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 24px;
}

.rank-item {
  border-bottom: 1px solid var(--border-subtle);
}

.rank-row-btn {
  width: 100%;
  padding: 12px 4px;
  border: none;
  background: transparent;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: color 150ms var(--ease-out);
}

.rank-row-btn:hover .rank-title {
  color: var(--accent);
}

.rank-num {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.rank-title {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-cat {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

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

.cat-tile-btn {
  min-height: 48px;
  padding: 12px 15px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background-color: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.cat-tile-btn:hover {
  background-color: #222b3a;
  border-color: rgba(16, 185, 129, 0.4);
}

.cat-tile-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-tile-count {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* 瀏覽模式 */
.catalog-section {
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 骨架屏 */
.skeleton-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.skeleton-poster {
  aspect-ratio: 2 / 3;
  background: linear-gradient(90deg, #151a23 25%, #1c2330 50%, #151a23 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

.skeleton-text {
  height: 13px;
  margin: 12px 12px 6px;
  border-radius: 4px;
  background-color: #1f2735;
}

.skeleton-subtext {
  height: 10px;
  width: 60%;
  margin: 0 12px 12px;
  border-radius: 4px;
  background-color: #1b222e;
}

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

.empty-state {
  padding: 56px 24px;
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.empty-desc {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* =========================================================
   底部分頁按鈕
   ========================================================= */
.pagination {
  margin-top: 8px;
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.page-btn {
  min-height: 40px;
  padding: 8px 18px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.page-btn:hover:not(:disabled) {
  background-color: var(--bg-elevated);
  border-color: var(--accent);
  color: var(--accent);
}

.page-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.page-indicator {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.site-footer {
  padding: 24px 4vw;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.site-footer strong {
  color: var(--text-primary);
}

/* =========================================================
   內建 HLS 影片播放區 (隱藏左側欄，保留頂部導覽列與左上角首頁)
   ========================================================= */
body.is-playing-view .sidebar,
body.is-playing-view .sidebar-backdrop,
body.is-playing-view #btn-menu-toggle {
  display: none;
}

body.is-playing-view .main-wrapper {
  margin-left: 0;
}

body.is-playing-view #mobile-brand-link,
body.is-playing-view #btn-mobile-home {
  display: inline-flex;
  align-items: center;
}

.player-view {
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.crumb-link {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: color 150ms var(--ease-out);
}

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

.crumb-sep {
  color: var(--text-muted);
  user-select: none;
}

.crumb-current {
  color: var(--text-primary);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60vw;
}

.player-card {
  width: 100%;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.detail-story-card {
  padding: 22px 24px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-section-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.detail-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.24rem;
  font-weight: 700;
  color: var(--text-primary);
}

.detail-synopsis {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.75;
  color: #cbd5e1;
  white-space: pre-line;
}

.detail-credits {
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-credit-row {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-primary);
}

.detail-credit-label {
  color: var(--text-secondary);
  font-weight: 600;
}

.detail-credit-value {
  color: var(--text-primary);
}

.detail-recommended-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#grid-recommended {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.modal-header {
  padding: 14px 18px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
}

.modal-title-group {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.06rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-subtitle {
  margin: 0;
  font-size: 0.82rem;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-close-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.direct-test-bar {
  padding: 12px 20px;
  background-color: var(--bg-main);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 10px;
}

.direct-url-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.direct-url-input:focus {
  border-color: var(--accent);
  outline: none;
}

.video-stage {
  position: relative;
  width: 100%;
  flex-shrink: 0;
  aspect-ratio: 16 / 9;
  background-color: #000000;
}

.video-element {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background-color: #000000;
}

.player-status {
  position: absolute;
  inset: 0;
  padding: 20px;
  background-color: rgba(11, 14, 20, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.player-status p {
  margin: 0;
  max-width: 480px;
  font-size: 0.92rem;
  color: #e2e8f0;
  line-height: 1.6;
}

.player-toolbar {
  padding: 10px 20px;
  background-color: var(--bg-main);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
}

.toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.ad-filter-info {
  font-size: 0.78rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.skip-label {
  font-size: 0.84rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.skip-select {
  height: 34px;
  padding: 0 10px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.83rem;
  cursor: pointer;
}

.skip-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-btn {
  min-height: 34px;
  padding: 5px 12px;
  font-size: 0.82rem;
}

.episode-panel {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border-subtle);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.episode-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.episode-heading {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.source-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.source-tab-btn {
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background-color: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.source-tab-btn.is-active {
  border-color: rgba(16, 185, 129, 0.5);
  background-color: var(--accent-soft);
  color: var(--accent);
}

.episode-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.episode-btn {
  min-height: 38px;
  padding: 6px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 150ms var(--ease-out), border-color 150ms var(--ease-out),
    color 150ms var(--ease-out);
}

.episode-btn:hover {
  background-color: var(--bg-elevated);
  border-color: var(--border-strong);
}

.episode-btn.is-active {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #052218;
  font-weight: 600;
}

/* =========================================================
   響應式斷點
   ========================================================= */
@media (max-width: 1220px) {
  .video-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .hero-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .hero-cards .vod-card:nth-child(n + 5) {
    display: none;
  }

  .all-categories-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .mobile-only {
    display: inline-flex;
  }

  .sidebar {
    width: 248px;
    transform: translateX(-100%);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0;
  }

  .sticky-header {
    height: 58px;
    padding: 0 14px;
    gap: 10px;
  }

  .header-quick-links {
    display: none;
  }

  .search-form {
    height: 38px;
  }

  .search-btn-label {
    display: none;
  }

  .search-submit-btn {
    padding: 0 14px;
  }

  .main-content {
    padding: 0 14px 36px;
    gap: 22px;
  }

  .hero-banner {
    margin: 0 -14px;
    min-height: 460px;
  }

  .hero-inner {
    padding: 36px 14px 20px;
    gap: 22px;
  }

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

  .hero-cards .vod-card:nth-child(n + 4) {
    display: none;
  }

  .hero-cards .card-body {
    padding: 7px 8px 9px;
  }

  .hero-cards .card-title {
    font-size: 0.78rem;
  }

  .hero-cards .card-meta {
    font-size: 0.7rem;
  }

  .video-grid,
  #grid-recommended {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 10px;
  }

  .rank-list {
    grid-template-columns: 1fr;
  }

  .all-categories-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .rank-panel,
  .categories-panel {
    padding: 16px;
  }

  .browse-header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .player-view {
    padding-top: 12px;
  }

  .modal-header {
    padding: 10px 14px;
    gap: 10px;
  }

  .direct-test-bar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
