/* ==========================================
   DOWNLIN - DESIGN SYSTEM & GLOBAL STYLES
   Minimalist dark/light design inspired by X.com & shadcn/ui
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Color Palette - Light Mode */
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --card-bg: #ffffff;
  --card-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-hover: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --accent-primary: #000000;
  --accent-primary-hover: #1a1a1a;
  --accent-primary-fg: #ffffff;
  --brand: #000000;
  --brand-hover: #1a1a1a;
  --badge-bg: #f1f5f9;
  --badge-text: #334155;
  --badge-official-bg: #dcfce7;
  --badge-official-text: #166534;
  --badge-github-bg: #e8e8e8;
  --badge-github-text: #111111;
  --badge-mirror-bg: #fef3c7;
  --badge-mirror-text: #92400e;
  --ring: #000000;
  --header-bg: rgba(255, 255, 255, 0.85);

  /* Layout & Sizing */
  --container-max-width: 1240px;
  --header-height: 64px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Transitions & Shadows */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
  /* Color Palette - Dark Mode (pure black & white) */
  --bg: #000000;
  --bg-subtle: #0a0a0a;
  --card-bg: #111111;
  --card-hover: #1a1a1a;
  --border: #222222;
  --border-hover: #333333;
  --text-primary: #ffffff;
  --text-secondary: #a3a3a3;
  --text-muted: #737373;
  --accent-primary: #ffffff;
  --accent-primary-hover: #e5e5e5;
  --accent-primary-fg: #000000;
  --brand: #ffffff;
  --brand-hover: #e5e5e5;
  --badge-bg: #1a1a1a;
  --badge-text: #d4d4d4;
  --badge-official-bg: #064e3b;
  --badge-official-text: #6ee7b7;
  --badge-github-bg: #262626;
  --badge-github-text: #d4d4d4;
  --badge-mirror-bg: #78350f;
  --badge-mirror-text: #fde68a;
  --ring: #ffffff;
  --header-bg: rgba(0, 0, 0, 0.85);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.7);
}

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

html {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--text-primary);
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

main {
  flex: 1;
}

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

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

select option
{
background: var(--bg);
color: var(--text-primary);
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

/* Focus States for Accessibility */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Container */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.container-narrow {
  max-width: 960px;
}

/* Typography Utilities */
.heading-xl {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.heading-lg {
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
/* Responsive Layout Outer Wrapper */
    .download-page-wrap {
      padding: 1.5rem 0 3rem;
    }

    /* Ad Slot Utilities */
    .ad-banner-slot {
      background-color: var(--card-bg);
      border: 1px dashed var(--border-hover);
      border-radius: var(--radius-md);
      padding: 1rem;
      text-align: center;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }

    /* Top & Bottom Ad Slot Styles */
    .ad-slot-top ,
    .ad-slot-bottom {
      width: 100%;
      max-width: 970px;
      margin: 0 auto;
    }

   

    /* 3-Column Middle Grid Layout */
    .download-center-grid {
      display: grid;
      grid-template-columns: 260px 1fr 260px;
      gap: 1.5rem;
      align-items: center;
      margin: 1.5rem 0;
    }

    /* Vertical Side Banner Adjustments */
    .ad-slot-side {
      min-height: 380px;
      border-radius: var(--radius-lg);
    }

    /* Center Minimal Redirect Card */
    .redirect-card-centered {
      background-color: var(--card-bg);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 2.5rem 2rem;
      box-shadow: var(--shadow-sm);
      text-align: center;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }

    /* Progress Bar */
    .progress-track {
      width: 100%;
      max-width: 320px;
      height: 6px;
      background-color: var(--border);
      border-radius: 999px;
      overflow: hidden;
      margin: 1.25rem auto;
    }

    .progress-fill {
      height: 100%;
      width: 0%;
      background-color: var(--brand);
      border-radius: 999px;
      transition: width 100ms linear;
    }

    .ad-tag {
      font-size: 0.65rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--text-muted);
      margin-bottom: 0.35rem;
      display: block;
    }

    /* Responsive Breakdown */
    @media (max-width: 900px) {
      .download-center-grid {
        grid-template-columns: 1fr;
      }

      .ad-slot-side {
        min-height: auto;
      }
    }
.heading-md {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.heading-sm {
  font-size: 1rem;
  font-weight: 600;
}

.text-muted {
  color: var(--text-secondary);
}

.text-xs {
  font-size: 0.75rem;
}

.text-sm {
  font-size: 0.875rem;
}

.text-lg {
  font-size: 1.125rem;
}

/* Layout Utilities */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.gap-1 {
  gap: 0.25rem;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 0.75rem;
}

.gap-4 {
  gap: 1rem;
}

.gap-6 {
  gap: 1.5rem;
}

.gap-8 {
  gap: 2rem;
}

.w-full {
  width: 100%;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.season-tab-bar {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      padding-bottom: 0.75rem;
      margin-bottom: 1.25rem;
      overflow-x: auto;
      scrollbar-width: none;
      /* Firefox */
      -ms-overflow-style: none;
      /* IE/Edge */
    }

    .season-tab-bar::-webkit-scrollbar {
      display: none;
      /* Chrome/Safari */
    }

    .season-tab-btn {
      padding: 0.5rem 1.1rem;
      font-size: 0.8rem;
      font-weight: 600;
      color: var(--text-secondary);
      background: var(--card-bg);
      border: 1px solid var(--border);
      border-radius: var(--radius-full);
      transition: all var(--transition-fast);
      cursor: pointer;
      white-space: nowrap;
      letter-spacing: 0.01em;
    }

    .season-tab-btn:hover {
      color: var(--text-primary);
      border-color: var(--border-hover);
      background: var(--card-hover);
    }

    .season-tab-btn.active {
      color: var(--accent-primary-fg);
      background: var(--accent-primary);
      border-color: var(--accent-primary);
    }

    /* ── Episode List Container ── */
    .episodes-scroll-wrapper {
      position: relative;
          padding-bottom: 48px;

    }

    .episodes-scroll-wrapper::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      height: 48px;
      background: linear-gradient(to bottom, transparent, var(--bg));
      pointer-events: none;
      border-radius: 0 0 var(--radius-md) var(--radius-md);
    }

    #episodes-container {
      max-height: 420px;
      overflow-y: auto;
      scrollbar-width: none;
      -ms-overflow-style: none;
      padding-bottom: 1.5rem;
    }

    #episodes-container::-webkit-scrollbar {
      display: none;
    }

    /* ── Episode Row ── */
    .episode-row {
      display: flex;
      align-items: center;
      gap: 1rem;
      padding: 0.75rem 0.85rem;
      border-bottom: 1px solid var(--border);
      transition: background var(--transition-fast);
    }

    .episode-row:last-child {
      border-bottom: none;
    }

    .episode-row:hover {
      background: var(--card-hover);
    }

    .ep-number {
      padding: 10px;
      min-width: 36px;
      border-radius: var(--radius-full);
      background: var(--bg-subtle);
      border: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.75rem;
      font-weight: 700;
    }

    .ep-info {
      flex: 1;
      min-width: 0;
    }

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

    .ep-meta {
      font-size: 0.75rem;
      color: var(--text-muted);
      margin-top: 0.15rem;
    }

    .ep-download-btn {
      padding: 0.35rem 0.85rem;
      font-size: 0.75rem;
      font-weight: 600;
      border-radius: var(--radius-full);
      border: 1px solid var(--border);
      background: transparent;
      color: var(--text-primary);
      transition: all var(--transition-fast);
      white-space: nowrap;
      text-decoration: none;
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
    }

    .ep-download-btn:hover {
      background: var(--accent-primary);
      color: var(--accent-primary-fg);
      border-color: var(--accent-primary);
    }

    /* ── Responsive ── */
    @media (max-width: 640px) {
      .episode-row {
        gap: 0.65rem;
        padding: 0.65rem 0.5rem;
      }

      .ep-number {
        width: 30px;
        height: 30px;
        min-width: 30px;
        font-size: 0.65rem;
      }

      .ep-title {
        font-size: 0.82rem;
      }

      .ep-download-btn {
        padding: 0.3rem 0.65rem;
        font-size: 0.7rem;
      }

      .ep-download-btn .dl-label {
        display: none;
      }

      #episodes-container {
        max-height: 360px;
      }
    }

    .movie-hero-backdrop {
      position: relative;
      background-color: #0f172a;
      background-image: linear-gradient(180deg, rgba(15, 23, 42, 0.85) 0%, rgba(15, 23, 42, 0.98) 100%),
        url('https://images.unsplash.com/photo-1536440136628-849c177e76a1?w=1400');
      background-position: center;
      background-size: cover;
      padding: 3rem 0 2.5rem;
      border-bottom: 1px solid var(--border);
      color: #ffffff;
    }

    .movie-hero-grid {
      display: grid;
      grid-template-columns: 220px 1fr;
      gap: 2rem;
      align-items: start;
    }

    @media (max-width: 768px) {
      .movie-hero-grid {
        grid-template-columns: 1fr;
      }
    }

    .movie-poster {
      width: 100%;
      aspect-ratio: 2 / 3;
      border-radius: var(--radius-lg);
      background: #1e293b;
      box-shadow: var(--shadow-lg);
      border: 1px solid rgba(255, 255, 255, 0.15);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      color: #cbd5e1;
      font-weight: 700;
      text-align: center;
      padding: 1rem;
    }

    .movie-rating-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      background-color: #f59e0b;
      color: #000000;
      font-weight: 800;
      font-size: 0.825rem;
      padding: 0.2rem 0.6rem;
      border-radius: var(--radius-sm);
    }

    .movie-meta-tag {
      font-size: 0.75rem;
      font-weight: 700;
      text-transform: uppercase;
      padding: 0.2rem 0.6rem;
      border-radius: 4px;
      background: rgba(255, 255, 255, 0.12);
      color: #f8fafc;
      border: 1px solid rgba(255, 255, 255, 0.18);
    }

    .trailer-box {
      width: 100%;
      aspect-ratio: 16 / 9;
      background: #090d16;
      border-radius: var(--radius-lg);
      border: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      position: relative;
      overflow: hidden;
      margin-top: 0.75rem;
    }

    .gallery-movie-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 1rem;
    }

    @media (max-width: 640px) {
      .gallery-movie-grid {
        grid-template-columns: 1fr;
      }
    }


    /* Alert Messages */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.alert::before {
    flex-shrink: 0;
    font-size: 1rem;
    line-height: 1.4;
}

.alert-success {
    background: rgba(34, 197, 94, 0.10);
    border-color: rgba(34, 197, 94, 0.30);
    color: #15803d;
}

.alert-success::before {
    content: "✓";
    font-weight: 700;
}

.alert-error {
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.30);
    color: #dc2626;
}

.alert-error::before {
    content: "!";
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: currentColor;
    color: var(--card-bg);
    font-size: 0.7rem;
    font-weight: 800;
}
.redirect-animation {
    display: none;
    width: 100%;
    justify-content: center;
    align-items: center;
    margin: 0.5rem 0 1.5rem;
}

.redirect-loader {
    width: 42px;
    height: 42px;
    border: 4px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: redirect-spin 0.8s linear infinite;
}

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


.robot-animation {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0.75rem 0 1.5rem;
}

.robot-face {
    position: relative;
    width: 145px;
    height: 75px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* The thin line between the eyes */
.robot-connection {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 55px;
    height: 3px;
    transform: translate(-50%, -50%);
    background: var(--brand);
    
    border-radius: 10px;
}

/* Eyes */
.robot-eye {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--brand);

    display: flex;
    align-items: center;
    justify-content: center;

    box-shadow:
        0 0 0 5px color-mix(in srgb, var(--brand) 12%, transparent),
        0 0 22px color-mix(in srgb, var(--brand) 25%, transparent);

    animation:
        robot-float 2.5s ease-in-out infinite,
        robot-blink 5s ease-in-out infinite;
}

.right-eye {
    animation-delay: 0.12s, 0.15s;
}

/* Cute little pupils */
.eye-pupil {
    width: 13px;
    height: 13px;
    background: white;
    border-radius: 50%;

    box-shadow: 0 0 8px rgba(255,255,255,0.8);

    animation: robot-look 4s ease-in-out infinite;
}

.right-eye .eye-pupil {
    animation-delay: 0.15s;
}

/* Floating motion */
@keyframes robot-float {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

/* Occasional blink */
@keyframes robot-blink {
    0%, 42%, 46%, 100% {
        transform: scaleY(1);
    }

    44% {
        transform: scaleY(0.08);
    }
}

/* Eyes looking around */
@keyframes robot-look {
    0%, 20% {
        transform: translateX(0);
    }

    30%, 45% {
        transform: translateX(7px);
    }

    55%, 70% {
        transform: translateX(-6px);
    }

    80%, 100% {
        transform: translateX(0);
    }
}

/* Little processing dots */
.robot-status {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

.robot-status span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--brand);

    animation: robot-dots 1.2s ease-in-out infinite;
}

.robot-status span:nth-child(2) {
    animation-delay: 0.2s;
}

.robot-status span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes robot-dots {
    0%, 60%, 100% {
        opacity: 0.25;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-4px);
    }
}


/* Dark mode */
[data-theme="dark"] .alert-success {
    color: #4ade80;
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.25);
}

[data-theme="dark"] .alert-error {
    color: #f87171;
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
}