/*
 * StreamPulse - Mobile-First Video Streaming Platform
 * Production CSS - Optimized for GitHub Pages & Fast Mobile Networks
 */

:root {
  --bg-main: #070a12;
  --bg-card: #0f1523;
  --bg-card-hover: #161e31;
  --bg-surface: #141b2c;
  --bg-input: #0a0f1d;
  --border-subtle: #1e293f;
  --border-focus: #3b82f6;

  --accent-primary: #ff3366;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #ff3366 0%, #8b5cf6 100%);
  --accent-green: #10b981;
  --accent-green-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
  --accent-indigo-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(255, 51, 102, 0.25);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Helvetica Neue", Arial, sans-serif;
  --container-max: 1200px;
  --header-height: 64px;
  --bottom-nav-height: 60px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-bottom: var(--bottom-nav-height); /* Offset for mobile thumb bar */
}

@media (min-width: 768px) {
  body {
    padding-bottom: 0;
  }
}

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

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

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

/* Accessibility */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Utility Layout Containers */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: rgba(7, 10, 18, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  height: var(--header-height);
  display: flex;
  align-items: center;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-logo img {
  height: 38px;
  width: auto;
}

/* Desktop Nav Links */
.desktop-nav {
  display: none;
  align-items: center;
  gap: 20px;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s ease;
  position: relative;
  padding: 6px 2px;
}

.nav-link:hover, .nav-link.active {
  color: #ffffff;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
}

@media (min-width: 840px) {
  .desktop-nav {
    display: flex;
  }
}

/* Header Right Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Search Bar in Header */
.search-box-wrapper {
  position: relative;
  display: none;
}

@media (min-width: 640px) {
  .search-box-wrapper {
    display: block;
    width: 220px;
  }
}

@media (min-width: 1024px) {
  .search-box-wrapper {
    width: 280px;
  }
}

.search-input {
  width: 100%;
  padding: 8px 36px 8px 14px;
  font-size: 0.875rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-main);
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.search-icon-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

.search-icon-btn:hover {
  color: var(--text-main);
}

/* Language Selector Pill */
.lang-selector {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px 4px;
}

.lang-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn.active {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(255, 51, 102, 0.3);
}

/* Mobile Header Buttons */
.mobile-search-toggle,
.mobile-menu-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

@media (min-width: 840px) {
  .mobile-menu-toggle {
    display: none;
  }
}

@media (min-width: 640px) {
  .mobile-search-toggle {
    display: none;
  }
}

/* Mobile Search Bar Expandable Drawer */
.mobile-search-bar {
  display: none;
  padding: 10px 16px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.mobile-search-bar.active {
  display: block;
}

.mobile-search-bar .search-input {
  width: 100%;
}

/* Mobile Drawer Overlay */
.mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100%;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  z-index: 100;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.mobile-drawer.open {
  transform: translateX(0);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 99;
  display: none;
}

.drawer-backdrop.open {
  display: block;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.drawer-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

.drawer-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.drawer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-weight: 500;
  transition: background 0.2s ease;
}

.drawer-link:hover, .drawer-link.active {
  background-color: var(--bg-card-hover);
  color: #ffffff;
}

/* Bottom Navigation Bar for Mobile */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background-color: rgba(7, 10, 18, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 45;
  padding: 0 4px;
}

@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 6px 10px;
  gap: 3px;
  transition: color 0.2s ease;
  min-width: 60px;
}

.bottom-nav-item.active, .bottom-nav-item:hover {
  color: var(--accent-primary);
}

.bottom-nav-item svg {
  width: 20px;
  height: 20px;
}

/* Main Content Area */
.main-content {
  flex: 1;
  padding-top: 20px;
  padding-bottom: 40px;
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.section-title-icon {
  color: var(--accent-primary);
  display: flex;
  align-items: center;
}

.section-view-all {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-secondary);
  transition: color 0.2s ease;
}

.section-view-all:hover {
  color: var(--accent-primary);
}

/* Category Filter Bar */
.category-filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 24px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.category-filter-bar::-webkit-scrollbar {
  height: 4px;
}

.category-filter-bar::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: var(--radius-full);
}

.category-pill {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 600;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-pill:hover {
  border-color: var(--accent-secondary);
  color: #ffffff;
}

.category-pill.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(255, 51, 102, 0.25);
}

/* Hero / Featured Video Banner */
.featured-hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 28px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
}

.featured-hero-media {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  max-height: 420px;
  overflow: hidden;
}

.featured-hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.featured-hero:hover .featured-hero-media img {
  transform: scale(1.02);
}

.featured-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(7, 10, 18, 0.96) 0%, rgba(7, 10, 18, 0.6) 45%, rgba(0, 0, 0, 0.2) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
}

@media (min-width: 768px) {
  .featured-hero-overlay {
    padding: 32px;
  }
}

.featured-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-gradient);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  width: fit-content;
}

.featured-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.3;
  margin-bottom: 8px;
}

@media (min-width: 768px) {
  .featured-title {
    font-size: 1.85rem;
  }
}

.featured-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 16px;
  max-width: 700px;
}

.featured-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.8125rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.featured-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-gradient);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 14px rgba(255, 51, 102, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  width: fit-content;
}

.featured-play-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 51, 102, 0.45);
}

/* Video Grid Layout */
.video-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

@media (min-width: 520px) {
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (min-width: 840px) {
  .video-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

@media (min-width: 1100px) {
  .video-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
}

/* Reusable Video Card Component */
.video-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.video-card:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: var(--shadow-md);
}

.video-card-thumb-wrapper {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  background-color: var(--bg-input);
  overflow: hidden;
}

.video-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.video-card:hover .video-card-thumb {
  transform: scale(1.05);
}

.video-card-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background-color: rgba(7, 10, 18, 0.85);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.video-card-cat-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background-color: rgba(20, 27, 44, 0.85);
  backdrop-filter: blur(4px);
  color: #e2e8f0;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.video-card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.video-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
  transition: color 0.2s ease;
}

.video-card:hover .video-card-title {
  color: var(--accent-primary);
}

.video-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  font-size: 0.76rem;
  color: var(--text-dim);
}

.video-card-views {
  display: flex;
  align-items: center;
  gap: 4px;
}

.video-card-source {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.4);
}

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

.skeleton-thumb {
  aspect-ratio: 16 / 9;
  background: linear-gradient(90deg, #101625 25%, #182238 50%, #101625 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-body {
  padding: 12px;
}

.skeleton-line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, #101625 25%, #182238 50%, #101625 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  margin-bottom: 8px;
}

.skeleton-line.short {
  width: 60%;
}

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

/* Adsterra Advertisements Styling */
.ad-container {
  margin: 20px auto;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.ad-slot-horizontal {
  min-height: 90px;
  max-width: 728px;
}

.ad-slot-footer {
  min-height: 90px;
  max-width: 728px;
}

.ad-placeholder {
  width: 100%;
  padding: 16px;
  background-color: rgba(18, 23, 38, 0.7);
  border: 1px dashed rgba(139, 92, 246, 0.4);
  border-radius: var(--radius-md);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: border-color 0.2s ease;
}

.ad-placeholder:hover {
  border-color: var(--accent-primary);
}

.ad-placeholder-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent-secondary);
  background: rgba(139, 92, 246, 0.12);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.ad-placeholder-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
}

.ad-placeholder-info {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.ad-placeholder-info code {
  color: var(--accent-primary);
  background: rgba(255, 51, 102, 0.1);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: monospace;
}

/* Dedicated Player Page Layout */
.player-page-container {
  max-width: 960px;
  margin: 0 auto;
}

/* 1. Random Article Recommendation (Above Player) */
.random-article-box {
  background: linear-gradient(135deg, rgba(20, 27, 44, 0.9) 0%, rgba(29, 23, 44, 0.9) 100%);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.random-article-thumb {
  width: 90px;
  height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.random-article-content {
  flex: 1;
  min-width: 0;
}

.random-article-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-secondary);
  letter-spacing: 0.5px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.random-article-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.random-article-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.random-article-btn {
  background: rgba(139, 92, 246, 0.18);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.random-article-btn:hover {
  background: var(--accent-secondary);
}

@media (max-width: 540px) {
  .random-article-desc {
    display: none;
  }
}

/* 2. Main Video Player */
.player-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #000000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.player-video-element,
.player-iframe-element {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.player-video-element.vertical-video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  margin: 0 auto;
  object-fit: contain;
}

/* Player fallback shown when direct CDN source fails to load
   (e.g. twimg.com refusing CORS preflight or returning 403). */
.player-fallback-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #0b1020 0%, #050810 100%);
  color: var(--text-main);
  padding: 24px;
  text-align: center;
}
.player-fallback-inner {
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--text-muted);
}
.player-fallback-inner svg {
  color: var(--accent-primary);
  opacity: 0.9;
}
.player-fallback-text {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-muted);
}
.player-fallback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 4px;
}
.player-fallback-btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  background: var(--bg-card-hover);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.player-fallback-btn:hover {
  transform: translateY(-1px);
  background: var(--bg-surface);
  border-color: var(--accent-secondary);
}
.player-fallback-btn.primary {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #ffffff;
}
.player-fallback-btn.primary:hover {
  filter: brightness(1.08);
}

/* 3. Adsterra In-Player Timed Overlay */
.in-player-ad-overlay {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 360px;
  background-color: rgba(11, 15, 25, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 51, 102, 0.4);
  border-radius: var(--radius-md);
  padding: 12px;
  z-index: 30;
  box-shadow: var(--shadow-lg);
  display: none;
}

.in-player-ad-overlay.active {
  display: block;
  animation: fadeInPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInPop {
  from { opacity: 0; transform: translate(-50%, 15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.ad-overlay-close-btn {
  position: absolute;
  top: -12px;
  right: -12px;
  background: var(--accent-primary);
  border: 2px solid #ffffff;
  color: #ffffff;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 900;
  font-size: 1rem;
  box-shadow: var(--shadow-md);
  z-index: 35;
}

.ad-overlay-close-btn span {
  display: none;
}

.ad-placeholder.in-player {
  padding: 8px;
  background: transparent;
  border: none;
}

/* Video Details Block */
.video-details-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 20px;
}

.video-details-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.35;
  margin-bottom: 10px;
}

@media (min-width: 768px) {
  .video-details-title {
    font-size: 1.5rem;
  }
}

.video-details-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 0.8125rem;
  color: var(--text-dim);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 14px;
}

.video-details-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.video-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.video-tag-pill {
  font-size: 0.72rem;
  background-color: var(--bg-surface);
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

/* 5. Action Buttons (Download HD & Join Private) */
.action-buttons-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 580px) {
  .action-buttons-group {
    grid-template-columns: 1fr 1fr;
  }
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  color: #ffffff;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-height: 64px;
}

.action-btn:hover {
  transform: translateY(-2px);
}

.action-btn-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-btn-text {
  display: flex;
  flex-direction: column;
}

.action-btn-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.action-btn-sub {
  font-size: 0.75rem;
  opacity: 0.85;
  font-weight: 500;
}

.action-btn.download-btn {
  background: var(--accent-green-gradient);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.action-btn.download-btn:hover {
  box-shadow: 0 6px 22px rgba(16, 185, 129, 0.45);
}

.action-btn.private-btn {
  background: var(--accent-indigo-gradient);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.action-btn.private-btn:hover {
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.45);
}

/* 6. Continued Articles Section */
.articles-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 28px;
}

@media (min-width: 680px) {
  .articles-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

.article-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  gap: 12px;
  padding: 12px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.article-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-secondary);
}

.article-card-thumb {
  width: 100px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.article-card-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.article-card-meta {
  font-size: 0.7rem;
  color: var(--accent-secondary);
  font-weight: 700;
  margin-bottom: 4px;
}

.article-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Sorting Bar */
.sorting-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 20px;
}

.sort-select {
  background-color: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.82rem;
  cursor: pointer;
}

/* Load More Button */
.load-more-container {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.load-more-btn {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 12px 28px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.load-more-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-secondary);
}

/* Category Grid Page */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 30px;
}

@media (min-width: 640px) {
  .categories-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

@media (min-width: 900px) {
  .categories-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
}

.category-card {
  position: relative;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 18px;
  text-align: center;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.category-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
}

.category-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.category-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
}

.category-card-count {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Static Informational Pages (About, Privacy, Terms, Contact) */
.page-article {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 860px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .page-article {
    padding: 36px;
  }
}

.page-article h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: #ffffff;
}

.page-article h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 8px;
  color: var(--accent-secondary);
}

.page-article p {
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 14px;
}

.page-article ul {
  padding-left: 20px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

/* 404 Empty State */
.error-container {
  text-align: center;
  padding: 60px 16px;
  max-width: 500px;
  margin: 0 auto;
}

.error-code {
  font-size: 5rem;
  font-weight: 900;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  margin-bottom: 12px;
}

.error-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.error-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Floating Export ZIP Tool for GitHub Pages */
.export-zip-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.export-zip-badge:hover {
  background: var(--bg-card-hover);
  color: #ffffff;
  border-color: var(--accent-primary);
}

/* Toast Notifications */
.toast-notice {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(15, 21, 35, 0.95);
  border: 1px solid var(--accent-secondary);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-notice.show {
  opacity: 1;
  transform: translate(-50%, -10px);
}

/* Footer */
.site-footer {
  background-color: #05070d;
  border-top: 1px solid var(--border-subtle);
  padding: 40px 0 24px;
  margin-top: auto;
}

.footer-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  margin-bottom: 32px;
}

@media (min-width: 640px) {
  .footer-top {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.footer-brand p {
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-top: 12px;
  max-width: 360px;
}

.footer-heading {
  font-size: 0.875rem;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-link {
  font-size: 0.8125rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

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

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

@media (min-width: 640px) {
  .footer-bottom {
    flex-direction: row;
  }
}
