﻿:root {
  /* Color palette */
  --color-bg: #f5f5f7;
  --color-surface: #ffffff;
  --color-surface-hover: #f8f8fa;
  --color-text-primary: #1d1d1f;
  --color-text-secondary: #86868b;
  --color-text-tertiary: #aeaeb2;
  --color-accent: #4361ee;
  --color-accent-hover: #3651d4;
  --color-border: #d2d2d7;
  --color-border-light: #e5e5ea;
  --color-overlay: rgba(0, 0, 0, 0.88);
  --color-card-shadow: rgba(0, 0, 0, 0.06);
  --color-tag-bg: #f0f0f5;
  --color-tag-text: #515154;
  --color-stat-icon: #86868b;
  --color-like-active: #e74c3c;

  /* Typography */
  --font-sans:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', Helvetica, Arial,
    sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.8125rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 2rem;
  --font-size-3xl: 2.5rem;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  /* Spacing (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Layout */
  --max-width-content: 1200px;
  --max-width-post: 840px;
  --header-height: 56px;
  --card-radius: 12px;
  --card-radius-sm: 8px;
  --button-radius: 8px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 2px 12px var(--color-card-shadow);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.25, 0.1, 0.25, 1);
  --transition-normal: 300ms cubic-bezier(0.25, 0.1, 0.25, 1);
  --transition-slow: 500ms cubic-bezier(0.25, 0.1, 0.25, 1);

  /* Z-index */
  --z-header: 100;
  --z-overlay: 1000;
  --z-modal: 1100;

  /* Search highlight */
  --color-search-highlight: #ffe066;
  --color-search-highlight-text: #1d1d1f;
}

.search-highlight {
  background: var(--color-search-highlight);
  color: var(--color-search-highlight-text);
  border-radius: 2px;
  padding: 0 1px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --color-search-highlight: #ffd43b;
    --color-search-highlight-text: #1d1d1f;
    --color-bg: #1c1c1e;
    --color-surface: #2c2c2e;
    --color-surface-hover: #3a3a3c;
    --color-text-primary: #f5f5f7;
    --color-text-secondary: #98989d;
    --color-text-tertiary: #6e6e73;
    --color-border: #48484a;
    --color-border-light: #38383a;
    --color-tag-bg: #3a3a3c;
    --color-tag-text: #d1d1d6;
    --color-card-shadow: rgba(0, 0, 0, 0.3);
    --color-overlay: rgba(0, 0, 0, 0.92);
    --shadow-card: 0 2px 12px var(--color-card-shadow);
  }
}

/* === Video Player === */

.video-section {
  margin: var(--space-12) 0;
}

.video-section .section-title {
  margin-bottom: var(--space-5);
}

.video-container {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-8);
  min-height: 360px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.video-container video {
  width: 100%;
  display: block;
  max-height: 70vh;
  background: #000;
  flex-shrink: 0;
}

/* Big centered play button */
.video-player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}

.video-big-play {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #1d1d1f;
  pointer-events: auto;
  transition:
    transform var(--transition-fast),
    background var(--transition-fast),
    opacity var(--transition-normal);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.video-big-play:hover {
  transform: scale(1.1);
  background: #fff;
}

.video-container.playing .video-big-play {
  opacity: 0;
  pointer-events: none;
}

.video-container.paused .video-big-play {
  opacity: 1;
  pointer-events: auto;
}

/* Controls bar */
.video-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.6));
  font-size: var(--font-size-xs);
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  z-index: 3;
  border-radius: 0 0 var(--card-radius) var(--card-radius);
  flex-shrink: 0;
}

.video-controls button {
  color: #fff;
  font-size: 1.15rem;
  padding: 4px;
  border-radius: 4px;
  transition: background var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

.video-controls button:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Time display */
.vc-time-current,
.vc-time-duration {
  font-size: var(--font-size-xs);
  font-family: var(--font-mono);
  min-width: 34px;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
}

/* Progress bar */
.vc-progress {
  flex: 1;
  height: 24px;
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.vc-progress-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  position: relative;
  transition: height var(--transition-fast);
}

.vc-progress:hover .vc-progress-track {
  height: 7px;
}

.vc-progress-buffer {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  pointer-events: none;
  width: 0;
  transition: width 0.3s ease;
}

.vc-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--color-accent);
  border-radius: 3px;
  pointer-events: none;
  width: 0;
  z-index: 1;
  transition: width 0.15s linear;
}

.vc-progress-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 13px;
  height: 13px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 2;
  left: 0;
}

.vc-progress:hover .vc-progress-thumb {
  opacity: 1;
}

.vc-progress-hover {
  position: absolute;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
  z-index: 3;
}

/* Volume */
.vc-volume {
  display: flex;
  align-items: center;
  position: relative;
  flex-shrink: 0;
}
.vc-volume-btn {
  font-size: 1.15rem !important;
}
.vc-volume-slider {
  width: 0;
  overflow: hidden;
  transition: width var(--transition-fast);
}
.vc-volume:hover .vc-volume-slider {
  width: 60px;
}
.vc-volume-range {
  width: 56px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.vc-volume-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

/* Quality switch toast */
.vc-switch-toast {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.vc-switch-toast.show {
  opacity: 1;
}

/* Loading spinner */
.video-container.buffering::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: vc-spin 0.8s linear infinite;
  z-index: 4;
}

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

/* Speed / Quality dropdown */
.vc-speed,
.vc-quality {
  position: relative;
  flex-shrink: 0;
}

.vc-speed-btn,
.vc-quality-btn {
  font-size: var(--font-size-xs) !important;
  font-family: var(--font-mono);
  padding: 3px 6px !important;
  display: flex;
  align-items: center;
  gap: 2px;
}

.vc-speed-menu,
.vc-quality-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 30, 30, 0.95);
  backdrop-filter: blur(12px);
  border-radius: var(--button-radius);
  padding: 4px;
  display: none;
  flex-direction: column;
  min-width: 80px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.vc-speed-menu.open,
.vc-quality-menu.open {
  display: flex;
}

.vc-speed-menu button,
.vc-quality-menu button {
  font-size: var(--font-size-xs);
  font-family: var(--font-mono);
  padding: 6px 12px;
  border-radius: 4px;
  text-align: center;
  white-space: nowrap;
  width: 100%;
}

.vc-speed-menu button:hover,
.vc-quality-menu button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.vc-speed-menu button.active,
.vc-quality-menu button.active {
  color: var(--color-accent);
}

/* Download & Next & Fullscreen */
.vc-download {
  color: #fff;
  font-size: 1.15rem;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.vc-download:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Fullscreen state */
.video-container:fullscreen {
  border-radius: 0;
  max-width: none;
}

.video-container:fullscreen video {
  max-height: none;
  height: calc(100vh - 44px);
}

/* === Page-level Playlist Panel === */
.post-page-wrapper {
  display: flex !important;
  align-items: flex-start;
  gap: var(--space-6);
}
.post-page-wrapper .post-page {
  flex: 1;
  min-width: 0;
  max-width: 100%;
}
.post-playlist-panel {
  width: 240px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  margin-left: var(--space-3);
}

.post-playlist-panel .playlist-header {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-primary);
}

.post-playlist-panel .playlist-list {
  overflow-y: auto;
  flex: 1;
}

.post-playlist-panel .pl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  border-bottom: 1px solid var(--color-border-light);
}

.post-playlist-panel .pl-item:last-child {
  border-bottom: none;
}
.post-playlist-panel .pl-item:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
}
.post-playlist-panel .pl-item.active {
  background: rgba(67, 97, 238, 0.08);
  color: var(--color-accent);
  font-weight: 500;
}

.post-playlist-panel .pl-num {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--color-tag-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.post-playlist-panel .pl-item.active .pl-num {
  background: var(--color-accent);
  color: #fff;
}
.post-playlist-panel .pl-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.post-playlist-panel .pl-playing {
  display: none;
  font-size: 12px;
}
.post-playlist-panel .pl-item.active .pl-playing {
  display: inline;
}

/* Old inline playlist 鈥?simplified */
.video-playlist-wrap {
  display: block;
}
.video-playlist-wrap .video-container {
  margin-bottom: 0;
}
.video-playlist-wrap .playlist-bar {
  display: none;
} /* Hide inline bar when page panel is used */

@media (max-width: 1024px) {
  .post-playlist-panel {
    position: static;
    width: 100%;
    max-height: 200px;
    margin-top: 16px;
  }
}

/* Mobile adjustments */
@media (max-width: 639px) {
  .video-controls {
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    flex-wrap: wrap;
  }
  .vc-speed-btn,
  .vc-quality-btn {
    font-size: 0.625rem !important;
    padding: 2px 4px !important;
  }
  .vc-time-current,
  .vc-time-duration {
    font-size: 0.625rem;
    min-width: 26px;
  }
  .video-big-play {
    width: 52px;
    height: 52px;
    font-size: 1.5rem;
  }
}

/* Playlist layout: article + panel in flex row */
.post-page-wrapper {
  display: flex !important;
  align-items: flex-start;
  gap: var(--space-6);
  max-width: 1200px;
}
.post-page-wrapper .post-page {
  flex: 1;
  min-width: 0;
  max-width: none;
}
.post-playlist-panel {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
}
@media (max-width: 1024px) {
  .post-page-wrapper {
    flex-direction: column;
  }
  .post-playlist-panel {
    width: 100%;
    position: static;
    max-height: 200px;
  }
}

@media (max-width: 1024px) {
  .post-page-wrapper {
    flex-direction: column;
  }
  .post-playlist-panel {
    width: 100%;
    position: static;
    margin-left: 0;
    margin-top: 16px;
    max-height: 200px;
  }
}

