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

/* ===== COLOR THEME VARIABLES ===== */
:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-card: #0f3460;

  --sky-blue: #87ceeb;
  --sky-blue-dark: #4fb3d9;
  --sky-blue-glow: rgba(135, 206, 235, 0.25);

  --light-red: #ff6b6b;
  --light-red-dark: #e05252;
  --light-red-glow: rgba(255, 107, 107, 0.25);

  --purple: #b06cf5;
  --purple-dark: #8a4fd4;
  --purple-glow: rgba(176, 108, 245, 0.25);

  --text-primary: #e8e8f0;
  --text-sky: #87ceeb;
  --text-red: #ff6b6b;
  --text-purple: #c492f7;

  --border-sky: rgba(135, 206, 235, 0.35);
  --border-purple: rgba(176, 108, 245, 0.35);

  --navbar-height: 64px;
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Outfit', Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== ANIMATED BACKGROUND GRADIENT ===== */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at top left, rgba(135, 206, 235, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at top right, rgba(176, 108, 245, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at bottom, rgba(255, 107, 107, 0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ===== NAVBAR / HEADER ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  height: var(--navbar-height);
  background: rgba(22, 33, 62, 0.95);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 2px solid var(--border-sky);
  box-shadow: 0 4px 30px rgba(135, 206, 235, 0.08);
  gap: 12px;
  will-change: transform;
}

.navbar .logo {
  font-size: 1.7rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--sky-blue), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1px;
  text-decoration: none;
  transition: filter 0.3s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.navbar .logo:hover {
  filter: brightness(1.2);
}

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
  margin-left: auto;
}

.nav-links a {
  color: var(--sky-blue);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.98rem;
  padding: 8px 16px;
  border-radius: 10px;
  transition: all 0.3s ease;
  border: 1px solid transparent;
  position: relative;
  white-space: nowrap;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--sky-blue), var(--purple));
  transform: translateX(-50%);
  transition: width 0.3s ease;
}

.nav-links a:hover {
  color: #fff;
  background: rgba(135, 206, 235, 0.1);
  border-color: var(--sky-blue);
  box-shadow: 0 0 16px rgba(135, 206, 235, 0.2);
}

.nav-links a:hover::after {
  width: calc(100% - 32px);
}

/* ===== HAMBURGER MENU ===== */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-shrink: 0;
}

.hamburger span {
  width: 24px;
  height: 3px;
  background: var(--sky-blue);
  border-radius: 2px;
  transition: all 0.3s ease;
  display: block;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 6px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -6px);
}

/* ===== PAGE WRAPPER ===== */
.page-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 50px 28px 80px;
}

/* ===== KEYFRAME ANIMATIONS ===== */
/* Use opacity-based pulse — GPU-friendly, no filter repaint */
@keyframes titlePulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.82; }
}

@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-30px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-12px); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== HOME PAGE - HERO ===== */
.hero {
  text-align: center;
  padding: 100px 20px 70px;
  animation: slideInDown 0.8s ease-out;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--sky-blue) 0%, var(--purple) 50%, var(--light-red) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 24px;
  letter-spacing: 2px;
  text-shadow: none;
  animation: titlePulse 3s ease-in-out infinite;
  line-height: 1.15;
  will-change: opacity;
}

.hero p {
  color: var(--text-purple);
  font-size: 1.2rem;
  margin-bottom: 20px;
  font-weight: 500;
  animation: slideInUp 0.8s ease-out 0.15s both;
  line-height: 1.6;
  opacity: 0.95;
}

.hero p:last-of-type {
  font-size: 0.95rem;
  color: rgba(196, 146, 247, 0.8);
  margin-bottom: 32px;
  animation-delay: 0.25s;
}

.hero-subtitle {
  font-size: 0.95rem;
  opacity: 0.8;
  margin-top: 12px;
  animation: slideInUp 0.8s ease-out 0.25s both;
}

/* ===== ANIME CARD GRID ===== */
.anime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 28px;
  margin-top: 60px;
  animation: slideInUp 0.8s ease-out 0.2s both;
}

.anime-card {
  background: linear-gradient(145deg, rgba(15, 52, 96, 0.7), rgba(26, 26, 46, 0.9));
  border: 1px solid var(--border-purple);
  border-radius: 18px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              border-color 0.4s ease,
              box-shadow 0.4s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: scaleIn 0.6s ease-out;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.anime-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--sky-blue-glow), var(--purple-glow));
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.anime-card:hover {
  transform: translateY(-12px) scale(1.03);
  border-color: var(--sky-blue);
  box-shadow:
    0 20px 50px rgba(135, 206, 235, 0.25),
    0 0 0 2px var(--sky-blue);
}

.anime-card:hover::after {
  opacity: 1;
}

/* Disable heavy transform on touch devices */
@media (hover: none) and (pointer: coarse) {
  .anime-card:hover,
  .anime-card:active {
    transform: translateY(-4px) scale(1.01);
    border-color: var(--border-purple);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  }
}

.anime-card img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
  aspect-ratio: 2 / 3;
  flex-shrink: 0;
}

.anime-card:hover img {
  transform: scale(1.12) rotate(1deg);
  opacity: 0.8;
}

.anime-card .card-body {
  padding: 16px 18px 18px;
  position: relative;
  z-index: 1;
  background: rgba(26, 26, 46, 0.95);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.anime-card .card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--sky-blue);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.anime-card .card-badge {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--purple-dark), var(--purple));
  color: #fff;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: auto;
}

/* Coming soon cards */
.anime-card.coming-soon {
  border-style: dashed;
  opacity: 0.65;
  background: linear-gradient(145deg, rgba(15, 52, 96, 0.4), rgba(26, 26, 46, 0.6));
  cursor: default;
  pointer-events: none;
}

.anime-card.coming-soon:hover {
  transform: none;
  border-color: var(--border-purple);
}

.coming-soon-placeholder {
  height: 280px;
  background: linear-gradient(135deg, #0f3460, #1a1a2e);
  display: flex;
  align-items: center;
  justify-content: center;
}

.coming-soon-emoji {
  font-size: 3rem;
  animation: float 3s ease-in-out infinite;
}

.coming-soon-emoji.delay {
  animation-delay: 0.2s;
}

.coming-soon-title-purple { color: var(--text-purple); }
.coming-soon-title-red    { color: var(--text-red); }

/* ===== EPISODE PAGE — SHOW HEADER ===== */
.show-header {
  display: flex;
  align-items: flex-start;
  gap: 36px;
  margin-bottom: 56px;
  flex-wrap: wrap;
  animation: slideInUp 0.8s ease-out;
}

.show-header img {
  width: 200px;
  border-radius: 16px;
  border: 4px solid var(--purple);
  box-shadow: 0 0 32px var(--purple-glow), 0 12px 48px rgba(0, 0, 0, 0.4);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  flex-shrink: 0;
  object-fit: cover;
}

.show-header img:hover {
  transform: scale(1.06) rotate(-2deg);
  box-shadow: 0 0 50px var(--purple-glow), 0 16px 64px rgba(0, 0, 0, 0.5);
}

.show-info {
  flex: 1;
  min-width: 220px;
}

.show-info h1 {
  font-size: 2.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--light-red), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 14px;
  line-height: 1.2;
}

.show-info > p,
.show-info .show-meta {
  color: var(--text-sky);
  margin-top: 8px;
  font-size: 0.95rem;
}

.show-description {
  color: var(--text-purple);
  margin-top: 14px;
  font-size: 0.88rem;
  max-width: 480px;
  line-height: 1.5;
}

.show-info .genre-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.genre-tag {
  font-size: 0.77rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  transition: all 0.3s ease;
  cursor: default;
}

.genre-tag.action {
  background: rgba(255, 107, 107, 0.18);
  color: var(--light-red);
  border: 1.5px solid var(--light-red);
}

.genre-tag.anime {
  background: rgba(176, 108, 245, 0.18);
  color: var(--purple);
  border: 1.5px solid var(--purple);
}

.genre-tag.hero {
  background: rgba(135, 206, 235, 0.18);
  color: var(--sky-blue);
  border: 1.5px solid var(--sky-blue);
}

/* ===== SECTION TITLE ===== */
.section-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-purple);
  margin-top: 40px;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 3px solid var(--border-purple);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInLeft 0.6s ease-out;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 26px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--sky-blue), var(--purple));
  box-shadow: 0 0 12px rgba(135, 206, 235, 0.3);
  flex-shrink: 0;
}

/* ===== EPISODE LIST ===== */
.episode-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
}

.episode-list li a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 12px;
  background: rgba(15, 52, 96, 0.5);
  border: 1.5px solid var(--border-sky);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  min-height: 52px;
}

.episode-list li a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--sky-blue), var(--purple));
  border-radius: 4px 0 0 4px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.episode-list li a:hover {
  background: rgba(135, 206, 235, 0.12);
  border-color: var(--sky-blue);
  color: var(--sky-blue);
  transform: translateX(8px);
  box-shadow: 0 6px 24px rgba(135, 206, 235, 0.2);
}

.episode-list li a:hover::before {
  opacity: 1;
  box-shadow: 0 0 12px rgba(135, 206, 235, 0.4);
}

/* Better touch experience */
@media (hover: none) and (pointer: coarse) {
  .episode-list li a:hover,
  .episode-list li a:active {
    background: rgba(135, 206, 235, 0.08);
    border-color: var(--border-sky);
    transform: translateX(4px);
  }
}

.ep-number {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--purple-dark), var(--purple));
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(176, 108, 245, 0.3);
  transition: transform 0.3s ease;
}

.episode-list li a:hover .ep-number {
  transform: scale(1.15) rotate(-5deg);
}

.ep-icon {
  margin-left: auto;
  color: var(--sky-blue);
  font-size: 1.1rem;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  flex-shrink: 0;
}

.episode-list li a:hover .ep-icon {
  opacity: 1;
  transform: translateX(6px);
}

/* ===== ACTIVE EPISODE HIGHLIGHT ===== */
.ep-link.ep-active {
  background: rgba(135, 206, 235, 0.12) !important;
  border-color: var(--sky-blue) !important;
  color: var(--sky-blue) !important;
}

.ep-link.ep-active::before {
  opacity: 1 !important;
}

.ep-link.ep-active .ep-icon {
  opacity: 1 !important;
}

/* ===== BACK LINK ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-red);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 36px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1.5px solid var(--light-red);
  background: rgba(255, 107, 107, 0.1);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 44px;
}

.back-link:hover {
  background: rgba(255, 107, 107, 0.2);
  box-shadow: 0 0 20px rgba(255, 107, 107, 0.3);
  transform: translateX(-6px);
  border-color: #ff8888;
}

.back-link:active {
  transform: translateX(-3px);
}

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 48px 32px;
  color: rgba(135, 206, 235, 0.6);
  font-size: 0.87rem;
  border-top: 2px solid rgba(135, 206, 235, 0.2);
  position: relative;
  z-index: 1;
  line-height: 1.8;
  background: linear-gradient(180deg, rgba(26, 26, 46, 0) 0%, rgba(22, 33, 62, 0.3) 100%);
}

footer span {
  color: var(--light-red);
  font-weight: 600;
}

.copyright {
  margin-top: 16px;
  font-size: 0.78rem;
  color: rgba(176, 108, 245, 0.5);
  letter-spacing: 0.4px;
}

.copy-brand {
  color: var(--purple);
  font-weight: 700;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--sky-blue-dark), var(--purple-dark));
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--purple); }

/* ===== SEARCH BAR ===== */
.search-wrap {
  margin: 0 auto 20px;
  max-width: 560px;
  animation: slideInDown 0.8s ease-out 0.1s both;
}

.search-box {
  display: flex;
  align-items: center;
  background: rgba(15, 52, 96, 0.6);
  border: 2.5px solid var(--border-sky);
  border-radius: 18px;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  overflow: hidden;
  transition: all 0.3s ease;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.search-box::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(135, 206, 235, 0.1), rgba(176, 108, 245, 0.05));
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.search-box:focus-within {
  border-color: var(--sky-blue);
  box-shadow: 0 0 0 4px rgba(135, 206, 235, 0.15), 0 8px 32px rgba(135, 206, 235, 0.15);
  transform: translateY(-2px);
}

.search-box:focus-within::before {
  opacity: 1;
}

.search-icon {
  padding: 0 16px;
  font-size: 1.15rem;
  flex-shrink: 0;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  color: var(--sky-blue);
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: 'Outfit', Arial, sans-serif;
  font-size: 1rem;
  font-weight: 500;
  padding: 14px 12px;
  caret-color: var(--sky-blue);
  letter-spacing: 0.3px;
  min-width: 0;
}

.search-input::placeholder {
  color: rgba(135, 206, 235, 0.5);
  font-weight: 400;
}

.search-clear {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-right: 8px;
  background: rgba(255, 107, 107, 0.15);
  border: 1px solid rgba(255, 107, 107, 0.4);
  border-radius: 8px;
  color: var(--light-red);
  font-size: 0.88rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
  font-weight: 600;
}

.search-clear:hover {
  background: var(--light-red);
  color: #fff;
  box-shadow: 0 0 12px rgba(255, 107, 107, 0.5);
  transform: scale(1.1);
}

.search-clear:active {
  transform: scale(0.95);
}

.search-no-results {
  margin-top: 16px;
  text-align: center;
  color: rgba(176, 108, 245, 0.7);
  font-size: 1rem;
  font-weight: 500;
  animation: fadeIn 0.3s ease;
  padding: 12px;
  display: none;
}

.search-no-results span {
  color: var(--sky-blue);
  font-weight: 600;
}

/* =====================================================
   VIDEO MODAL (shared across episode pages)
   ===================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(10, 10, 20, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.25s ease;
}

.modal-overlay.active {
  display: flex;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  position: relative;
  width: min(92vw, 900px);
  background: linear-gradient(145deg, #0f1e3a, #1a1a2e);
  border: 1px solid rgba(135, 206, 235, 0.3);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(135, 206, 235, 0.15), 0 24px 80px rgba(0, 0, 0, 0.7);
  animation: modalSlideUp 0.3s ease;
  max-height: calc(100vh - 20px);
  display: flex;
  flex-direction: column;
}

@keyframes modalSlideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: rgba(135, 206, 235, 0.06);
  border-bottom: 1px solid rgba(135, 206, 235, 0.15);
  flex-shrink: 0;
  gap: 12px;
}

.modal-ep-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--sky-blue);
  letter-spacing: 0.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-close {
  background: rgba(255, 107, 107, 0.15);
  border: 1px solid var(--light-red);
  color: var(--light-red);
  font-size: 1.1rem;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--light-red);
  color: #fff;
  box-shadow: 0 0 14px rgba(255, 107, 107, 0.5);
}

.modal-video-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
  flex-shrink: 0;
}

.modal-video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.modal-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(176, 108, 245, 0.05);
  border-top: 1px solid rgba(176, 108, 245, 0.15);
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.modal-nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-family: 'Outfit', Arial, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.btn-prev {
  background: rgba(176, 108, 245, 0.15);
  color: var(--purple);
  border: 1px solid var(--purple);
}

.btn-prev:hover {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 0 16px rgba(176, 108, 245, 0.4);
}

.btn-next {
  background: rgba(135, 206, 235, 0.15);
  color: var(--sky-blue);
  border: 1px solid var(--sky-blue);
}

.btn-next:hover {
  background: var(--sky-blue-dark);
  color: #fff;
  box-shadow: 0 0 16px rgba(135, 206, 235, 0.4);
}

.btn-prev:disabled,
.btn-next:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  box-shadow: none;
}

.modal-ep-counter {
  font-size: 0.8rem;
  color: rgba(135, 206, 235, 0.6);
  text-align: center;
  white-space: nowrap;
}

/* ===== QUALITY SELECTOR ===== */
.quality-selector {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: rgba(135, 206, 235, 0.1);
  border: 1px solid rgba(135, 206, 235, 0.2);
  border-radius: 8px;
}

.quality-btn {
  padding: 5px 10px;
  background: transparent;
  border: none;
  color: rgba(135, 206, 235, 0.6);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: 'Outfit', Arial, sans-serif;
}

.quality-btn:hover {
  color: var(--sky-blue);
}

.quality-btn.active {
  background: var(--sky-blue);
  color: #000;
  box-shadow: 0 0 12px rgba(135, 206, 235, 0.4);
}

/* ===== DOWNLOAD BUTTON ===== */
.download-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  background: rgba(255, 107, 107, 0.15);
  border: 1px solid var(--light-red);
  color: var(--light-red);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Outfit', Arial, sans-serif;
  white-space: nowrap;
}

.download-btn:hover {
  background: var(--light-red);
  color: #fff;
  box-shadow: 0 0 16px rgba(255, 107, 107, 0.3);
}

.download-btn:active {
  transform: scale(0.95);
}

.download-btn.loading {
  opacity: 0.6;
  cursor: not-allowed;
}


/* ===== SEASON ACCORDION ===== */
.seasons-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  contain: layout;
}

.season-block {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-purple);
  background: rgba(15, 52, 96, 0.25);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.season-block.open {
  border-color: var(--sky-blue);
  box-shadow: 0 0 24px rgba(135, 206, 235, 0.1);
}

.season-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  background: rgba(15, 52, 96, 0.45);
  transition: background 0.25s ease;
  gap: 16px;
}

.season-header:hover {
  background: rgba(135, 206, 235, 0.08);
}

.season-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.season-num-badge {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--purple-dark), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.season-header-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--sky-blue);
  margin-bottom: 3px;
}

.season-header-meta {
  font-size: 0.8rem;
  color: rgba(135, 206, 235, 0.55);
}

.season-chevron {
  font-size: 1rem;
  color: var(--purple);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.season-block.open .season-chevron {
  transform: rotate(180deg);
}

.season-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.season-body > .season-body-inner {
  overflow: hidden;
  min-height: 0;
}

.season-block.open .season-body {
  grid-template-rows: 1fr;
}

.season-body-inner {
  padding: 4px 16px 16px;
}

/* Season body layout: image + episodes side by side */
.season-content {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.season-cover {
  width: 140px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--border-purple);
  box-shadow: 0 0 20px rgba(176, 108, 245, 0.2), 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: sticky;
  top: calc(var(--navbar-height) + 12px);
  align-self: flex-start;
}

.season-cover img {
  width: 100%;
  display: block;
  object-fit: cover;
}

.season-block.open .season-cover {
  border-color: var(--sky-blue);
  box-shadow: 0 0 28px rgba(135, 206, 235, 0.25), 0 8px 24px rgba(0, 0, 0, 0.5);
}

.season-episodes {
  flex: 1;
  min-width: 0;
}

/* =====================================================
   THEME TOGGLE BUTTON
   ===================================================== */
.theme-toggle {
  background: rgba(135, 206, 235, 0.12);
  border: 1.5px solid var(--border-sky);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
  margin-left: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.theme-toggle:hover {
  background: rgba(135, 206, 235, 0.2);
  border-color: var(--sky-blue);
  box-shadow: 0 0 20px rgba(135, 206, 235, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);
  transform: rotate(20deg) scale(1.1);
}

.theme-toggle:active {
  transform: rotate(20deg) scale(0.95);
}

/* =====================================================
   RESPONSIVE — MOBILE OPTIMIZATION
   ===================================================== */

/* ── Large Desktop (> 1200px) ── */
@media (min-width: 1200px) {
  .page-wrapper {
    max-width: 1400px;
  }

  .hero {
    padding: 120px 20px 80px;
  }

  .hero h1 {
    font-size: 4rem;
  }

  .hero p {
    font-size: 1.3rem;
  }

  .anime-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 32px;
  }

  .anime-card img {
    height: 300px;
  }
}

/* ── Medium Desktop (992px – 1200px) ── */
@media (min-width: 992px) and (max-width: 1200px) {
  .hero h1 { font-size: 3.6rem; }
  .anime-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 28px;
  }
  .anime-card img { height: 280px; }
}

/* ── Tablet (768px – 992px) ── */
@media (min-width: 768px) and (max-width: 992px) {
  .page-wrapper { padding: 40px 24px 70px; }
  .hero { padding: 80px 20px 60px; }
  .hero h1 { font-size: 2.8rem; }
  .anime-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
  .anime-card img { height: 260px; }
}

/* ── Mobile Landscape (640px – 768px) ── */
@media (min-width: 640px) and (max-width: 768px) {
  .anime-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  .anime-card img { height: 240px; }
}

/* ── Hamburger breakpoint (≤ 768px) ── */
@media (max-width: 768px) {
  :root { --navbar-height: 56px; }

  .navbar {
    padding: 0 14px;
    height: var(--navbar-height);
    gap: 8px;
  }

  .navbar .logo {
    font-size: 1.25rem;
  }

  .hamburger {
    display: flex;
  }

  .hamburger span {
    width: 22px;
    height: 2.5px;
  }

  /* Nav links: slide down below navbar */
  .nav-links {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(22, 33, 62, 0.98);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 2px solid var(--border-sky);
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
    z-index: 199;
    gap: 0;
    margin-left: 0;
  }

  .nav-links.active {
    max-height: calc(100dvh - var(--navbar-height));
    padding: 12px 0 16px;
  }

  .nav-links a {
    font-size: 1rem;
    padding: 14px 20px;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid rgba(135, 206, 235, 0.1);
    display: block;
  }

  .nav-links a:hover {
    background: rgba(135, 206, 235, 0.1);
    box-shadow: none;
    border-color: transparent;
  }

  .nav-links a::after {
    display: none;
  }

  .theme-toggle {
    width: 40px;
    height: 40px;
    margin-left: auto;
  }

  /* Hero */
  .hero {
    padding: 60px 16px 44px;
  }

  .hero h1 {
    font-size: 2.2rem;
    letter-spacing: 1px;
    margin-bottom: 16px;
  }

  .hero p {
    font-size: 1.05rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  /* Page wrapper */
  .page-wrapper {
    padding: 28px 16px 56px;
  }

  /* Search */
  .search-wrap {
    max-width: 100%;
    margin: 0 auto 16px;
  }

  .search-box {
    border-radius: 14px;
    border-width: 2px;
  }

  .search-input {
    font-size: 16px; /* Prevents auto-zoom on iOS */
    padding: 12px 8px;
  }

  .search-icon {
    padding: 0 12px;
  }

  /* Grid – 2 columns */
  .anime-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 36px;
  }

  .anime-card { border-radius: 14px; }
  .anime-card img { height: 220px; }

  .anime-card .card-body { padding: 12px 14px 14px; }
  .anime-card .card-title { font-size: 0.88rem; }
  .anime-card .card-badge { font-size: 0.62rem; padding: 5px 8px; }

  /* Show header */
  .show-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 40px;
  }

  .show-header img {
    width: 160px;
    border-radius: 12px;
    border-width: 3px;
  }

  .show-info h1 {
    font-size: 2rem;
    line-height: 1.25;
  }

  /* Episode list */
  .episode-list li a {
    padding: 12px 14px;
    font-size: 0.88rem;
    gap: 10px;
    min-height: 48px;
    border-radius: 10px;
  }

  .ep-number {
    min-width: 34px;
    width: 34px;
    height: 34px;
    font-size: 0.75rem;
  }

  .section-title {
    font-size: 1.2rem;
    margin-top: 36px;
    margin-bottom: 20px;
  }

  .back-link {
    font-size: 0.88rem;
    padding: 9px 14px;
    margin-bottom: 28px;
  }

  footer {
    padding: 36px 20px;
    font-size: 0.84rem;
  }

  .copyright {
    margin-top: 12px;
    font-size: 0.75rem;
  }

  /* Season accordion */
  .season-content {
    flex-direction: column;
    gap: 12px;
  }

  .season-cover {
    width: 100%;
    position: static;
  }

  .season-cover img {
    max-height: 200px;
    object-fit: cover;
  }

  /* Modal controls — stack on mobile */
  .modal-controls {
    padding: 8px 12px;
    gap: 6px;
    justify-content: center;
  }

  .modal-nav-btn {
    padding: 7px 12px;
    font-size: 0.8rem;
  }

  .modal-ep-counter {
    order: -1;
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    padding: 2px 0;
  }

  .quality-selector,
  .download-btn {
    font-size: 0.75rem;
  }

  .quality-btn {
    padding: 4px 7px;
    font-size: 0.68rem;
  }

  .season-header {
    padding: 14px 16px;
  }

  .season-body-inner {
    padding: 4px 12px 14px;
  }

  .season-num-badge {
    width: 38px;
    height: 38px;
    font-size: 0.95rem;
  }

  .season-header-title {
    font-size: 0.95rem;
  }
}

/* ── Small Mobile (≤ 480px) ── */
@media (max-width: 480px) {
  :root { --navbar-height: 52px; }

  .navbar { padding: 0 12px; }

  .navbar .logo { font-size: 1.1rem; }

  .hamburger span { width: 20px; height: 2px; }

  .theme-toggle {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
    margin-left: auto;
  }

  .hero {
    padding: 44px 12px 32px;
  }

  .hero h1 {
    font-size: 1.9rem;
    letter-spacing: 0.5px;
  }

  .hero p { font-size: 0.95rem; }
  .hero-subtitle { font-size: 0.82rem; }

  .page-wrapper { padding: 20px 12px 44px; }

  /* 2-column grid even on small phones */
  .anime-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 28px;
  }

  .anime-card img { height: 180px; }
  .anime-card .card-body { padding: 10px 12px 12px; }
  .anime-card .card-title { font-size: 0.82rem; }
  .anime-card .card-badge { font-size: 0.58rem; padding: 4px 7px; }

  .show-header img { width: 130px; }
  .show-info h1 { font-size: 1.7rem; }

  .episode-list li a {
    font-size: 0.82rem;
    padding: 11px 12px;
  }

  .ep-number {
    min-width: 30px;
    width: 30px;
    height: 30px;
    font-size: 0.68rem;
    border-radius: 8px;
  }

  footer {
    font-size: 0.75rem;
    padding: 28px 14px;
  }

  .copyright { font-size: 0.68rem; }
}

/* ── Tiny phones (≤ 360px) ── */
@media (max-width: 360px) {
  .hero h1 { font-size: 1.5rem; }
  .logo    { font-size: 0.95rem !important; }
  .show-info h1 { font-size: 1.4rem; }

  .anime-grid { gap: 10px; }
  .anime-card img { height: 150px; }

  .nav-links a { font-size: 0.9rem; }
}

/* ===== PREFERS REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =====================================================
   THEME TRANSITIONS — smooth colour changes only
   (keep transform transitions separate to avoid jank)
   ===================================================== */
body {
  transition: background-color 0.4s ease, color 0.3s ease;
}

.navbar {
  transition: background 0.4s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.episode-list li a {
  transition: background 0.25s ease, border-color 0.25s ease,
              color 0.25s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.25s ease;
}

.search-box {
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.back-link {
  transition: background 0.3s ease, box-shadow 0.3s ease,
              transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s ease;
}

footer {
  transition: background 0.4s ease, color 0.3s ease, border-color 0.3s ease;
}

.section-title {
  transition: border-color 0.3s ease, color 0.3s ease;
}

.show-header img {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

/* =====================================================
   LIGHT THEME
   ===================================================== */
html[data-theme="light"] {
  --bg-primary: #f0f8ff;
  --bg-secondary: #ddeef9;
  --bg-card: #ffffff;
  --sky-blue: #0ea5e9;
  --sky-blue-dark: #0284c7;
  --sky-blue-glow: rgba(14, 165, 233, 0.22);
  --light-red: #ef4444;
  --light-red-dark: #dc2626;
  --light-red-glow: rgba(239, 68, 68, 0.22);
  --purple: #8b5cf6;
  --purple-dark: #7c3aed;
  --purple-glow: rgba(139, 92, 246, 0.22);
  --text-primary: #0f172a;
  --text-sky: #0284c7;
  --text-red: #dc2626;
  --text-purple: #6d28d9;
  --border-sky: rgba(14, 165, 233, 0.45);
  --border-purple: rgba(139, 92, 246, 0.45);
}

html[data-theme="light"] body {
  background-color: var(--bg-primary);
}

/* Static light-theme gradient background — no animation to keep it smooth */
html[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse at 12% 18%, rgba(14, 165, 233, 0.18) 0%, transparent 45%),
    radial-gradient(ellipse at 88% 12%, rgba(239, 68, 68, 0.1) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 88%, rgba(139, 92, 246, 0.1) 0%, transparent 55%);
  animation: none;
}

/* Remove the extra blob layer for light theme — it was causing full-page repaints */
html[data-theme="light"] body::after {
  display: none;
}

html[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.95);
  border-bottom-color: rgba(14, 165, 233, 0.28);
  box-shadow: 0 2px 20px rgba(14, 165, 233, 0.09);
}

html[data-theme="light"] .nav-links {
  background: rgba(255, 255, 255, 0.98);
  border-bottom-color: rgba(14, 165, 233, 0.28);
}

html[data-theme="light"] .anime-card {
  background: linear-gradient(145deg, #ffffff, #eef7fe);
  border-color: rgba(14, 165, 233, 0.28);
  box-shadow: 0 4px 20px rgba(14, 165, 233, 0.10);
}

html[data-theme="light"] .anime-card:hover {
  box-shadow: 0 8px 32px rgba(14, 165, 233, 0.28), 0 0 0 1px var(--sky-blue);
}

html[data-theme="light"] .anime-card .card-title {
  color: var(--sky-blue);
}

html[data-theme="light"] .anime-card .card-body {
  background: rgba(240, 248, 255, 0.98);
}

html[data-theme="light"] .episode-list li a {
  background: rgba(240, 248, 255, 0.92);
  border-color: rgba(14, 165, 233, 0.28);
  color: var(--text-primary);
}

html[data-theme="light"] .episode-list li a:hover {
  background: rgba(14, 165, 233, 0.08);
  color: var(--sky-blue);
}

html[data-theme="light"] .search-box {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(14, 165, 233, 0.38);
}

html[data-theme="light"] .search-input {
  color: var(--text-primary);
}

html[data-theme="light"] .search-input::placeholder {
  color: rgba(14, 165, 233, 0.45);
}

html[data-theme="light"] .back-link {
  background: rgba(239, 68, 68, 0.06);
}

html[data-theme="light"] footer {
  color: rgba(15, 23, 42, 0.5);
  border-top-color: rgba(14, 165, 233, 0.18);
}

html[data-theme="light"] .copyright {
  color: rgba(109, 40, 217, 0.5);
}

html[data-theme="light"] .section-title {
  border-bottom-color: var(--border-purple);
}

html[data-theme="light"] .genre-tag.action { background: rgba(239, 68, 68, 0.10); }
html[data-theme="light"] .genre-tag.anime  { background: rgba(139, 92, 246, 0.10); }
html[data-theme="light"] .genre-tag.hero   { background: rgba(14, 165, 233, 0.10); }

html[data-theme="light"] .show-header img {
  box-shadow: 0 0 24px var(--purple-glow), 0 8px 32px rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .modal-box {
  background: linear-gradient(145deg, #e6f4fc, #f4fbff) !important;
  border-color: rgba(14, 165, 233, 0.38) !important;
  box-shadow: 0 0 60px rgba(14, 165, 233, 0.14), 0 24px 80px rgba(0, 0, 0, 0.14) !important;
}

html[data-theme="light"] .modal-topbar {
  background: rgba(14, 165, 233, 0.06) !important;
  border-bottom-color: rgba(14, 165, 233, 0.18) !important;
}

html[data-theme="light"] .modal-controls {
  background: rgba(139, 92, 246, 0.04) !important;
  border-top-color: rgba(139, 92, 246, 0.18) !important;
}

html[data-theme="light"] .modal-ep-counter {
  color: rgba(14, 165, 233, 0.7) !important;
}

html[data-theme="light"] .season-block {
  background: rgba(230, 244, 252, 0.6);
}

html[data-theme="light"] .season-header {
  background: rgba(200, 230, 250, 0.6);
}

html[data-theme="light"] ::-webkit-scrollbar-track { background: #eaf5ff; }
html[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--sky-blue), var(--purple));
}