/* ══════════════════════════════════════════════════
   KARTONEY.COM — Design System CSS
   "The Cinematic Oasis" — RTL-First Dark Theme
   ══════════════════════════════════════════════════ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;900&family=Be+Vietnam+Pro:wght@400;700;900&display=swap');

/* ── CSS Variables / Design Tokens ── */
:root {
  /* Surface Hierarchy */
  --bg: #0e0e0e;
  --surface: #0e0e0e;
  --surface-dim: #0e0e0e;
  --surface-container-lowest: #000000;
  --surface-container-low: #131313;
  --surface-container: #1a1919;
  --surface-container-high: #201f1f;
  --surface-container-highest: #262626;
  --surface-variant: #262626;
  --surface-bright: #2c2c2c;

  /* Primary (Action - Amber) */
  --primary: #ffac54;
  --primary-dim: #ec8c00;
  --primary-container: #ff9800;
  --primary-fixed: #ff9800;
  --on-primary: #583100;
  --on-primary-container: #4a2800;

  /* Secondary (Gold) */
  --secondary: #fdd400;
  --secondary-dim: #edc600;
  --secondary-container: #705d00;
  --on-secondary: #594a00;

  /* Tertiary */
  --tertiary: #f4d73f;
  --tertiary-container: #e5c930;

  /* Error */
  --error: #ff7351;
  --error-dim: #d53d18;
  --error-container: #b92902;

  /* Surfaces for text */
  --on-surface: #ffffff;
  --on-surface-variant: #adaaaa;
  --on-background: #ffffff;
  --outline: #777575;
  --outline-variant: #484847;

  /* Surface tint */
  --surface-tint: #ffac54;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;
  --space-12: 4rem;
  --space-16: 5.5rem;

  /* Border Radius */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius: 1rem;
  --radius-lg: 2rem;
  --radius-xl: 3rem;
  --radius-full: 9999px;

  /* Sidebar width */
  --sidebar-w: 240px;
  --navbar-h: 72px;
}

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

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

body {
  font-family: 'Cairo', sans-serif;
  background-color: var(--bg);
  color: var(--on-surface);
  overflow-x: hidden;
  min-height: 100vh;
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s ease;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

/* No scrollbar utility */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ──────────────────────────────────────────────
   TOP NAVBAR
   ────────────────────────────────────────────── */
.top-nav {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  height: var(--navbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background: rgba(14, 14, 14, 0.6);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 20px 40px rgba(255, 172, 84, 0.05);
  transition: all 0.3s ease;
}

.nav-logo {
  font-family: 'Cairo', sans-serif;
  font-weight: 900;
  font-size: 1.5rem;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  font-weight: 700;
  font-size: 1rem;
  color: var(--on-surface-variant);
  transition: color 0.3s, transform 0.3s;
  padding-bottom: 4px;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
  transform: scale(1.05);
}

.nav-links a.active {
  border-bottom: 2px solid var(--primary);
}

.nav-search {
  display: flex;
  align-items: center;
  background: var(--surface-container-high);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  width: 280px;
  transition: box-shadow 0.3s;
}

.nav-search:focus-within {
  box-shadow: 0 0 0 2px var(--primary);
}

.nav-search input {
  width: 100%;
  padding-right: 0.5rem;
  color: var(--on-surface);
  font-size: 0.875rem;
}

.nav-search input::placeholder {
  color: rgba(173, 170, 170, 0.5);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ──────────────────────────────────────────────
   SIDEBAR (Desktop)
   ────────────────────────────────────────────── */
.sidebar {
  display: none;
}

@media (min-width: 768px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 0;
    top: 0;
    height: 100%;
    width: var(--sidebar-w);
    z-index: 90;
    background: var(--surface-container);
    padding-top: calc(var(--navbar-h) + 1.5rem);
    gap: 0.5rem;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
  }

  .main-content {
    padding-right: var(--sidebar-w);
  }
}

.sidebar-header {
  padding: 0 1.5rem 1.5rem;
  text-align: right;
}

.sidebar-header h3 {
  color: var(--primary);
  font-weight: 700;
  font-size: 1.125rem;
}

.sidebar-header p {
  color: var(--on-surface-variant);
  font-size: 0.875rem;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  margin: 0 0.5rem;
  border-radius: var(--radius-full);
  color: var(--on-surface-variant);
  font-size: 0.9rem;
  transition: all 0.3s;
}

.sidebar-link:hover {
  background: var(--surface-variant);
  transform: translateX(-4px);
}

.sidebar-link.active {
  background: var(--primary);
  color: var(--on-primary);
}

.sidebar-link .icon {
  font-size: 1.25rem;
}

/* ──────────────────────────────────────────────
   MATERIAL SYMBOLS (Icons base)
   ────────────────────────────────────────────── */
.icon {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.icon-filled {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ──────────────────────────────────────────────
   HERO SECTION
   ────────────────────────────────────────────── */
.hero {
  position: relative;
  width: 100%;
  height: 85vh;
  min-height: 600px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
}

.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, var(--bg) 0%, rgba(14, 14, 14, 0.4) 50%, rgba(14, 14, 14, 0) 100%);
}

.hero-side-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to left, var(--bg), transparent, transparent);
}

.hero-content {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 2rem 5rem;
  max-width: 700px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.hero-badge .tag {
  background: var(--primary);
  color: var(--on-primary);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hero-badge .rating {
  color: var(--tertiary);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -2px;
  margin-bottom: 1rem;
}

.hero-desc {
  font-size: 1.125rem;
  color: var(--on-surface-variant);
  max-width: 600px;
  margin-bottom: 2rem;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ──────────────────────────────────────────────
   BUTTONS
   ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 8px 32px rgba(255, 172, 84, 0.2);
}

.btn-primary:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 40px rgba(255, 172, 84, 0.3);
}

.btn-glass {
  background: rgba(38, 38, 38, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--on-surface);
  border: 1px solid rgba(72, 72, 71, 0.2);
}

.btn-glass:hover {
  background: rgba(38, 38, 38, 0.6);
}

.btn-sm {
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

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

/* ──────────────────────────────────────────────
   SECTION HEADERS
   ────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-title .accent {
  width: 5px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--primary);
  flex-shrink: 0;
}

.section-title .accent.gold { background: var(--secondary); }
.section-title .accent.red { background: var(--error); }
.section-title .accent.blue { background: #2196f3; }

.section-link {
  color: var(--primary-dim);
  font-size: 0.875rem;
  font-weight: 700;
  transition: color 0.3s;
}

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

/* ──────────────────────────────────────────────
   CONTENT ROW (Horizontal Scroll)
   ────────────────────────────────────────────── */
.content-rows {
  padding: 0 2rem;
  margin-top: -4rem;
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.scroll-row {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  padding-bottom: 1rem;
}

/* ──────────────────────────────────────────────
   CARTOON CARD (Landscape – Most Watched style)
   ────────────────────────────────────────────── */
.card-landscape {
  flex: 0 0 280px;
  cursor: pointer;
}

.card-landscape .card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0.75rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.5s ease, box-shadow 0.5s ease;
}

.card-landscape:hover .card-thumb {
  transform: scale(1.05);
  box-shadow: 0 12px 32px rgba(255, 172, 84, 0.15);
}

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

.card-landscape:hover .card-thumb img {
  transform: scale(1.1);
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  opacity: 0;
  transition: opacity 0.3s;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 1rem;
}

.card-landscape:hover .card-overlay {
  opacity: 1;
}

.card-play {
  background: var(--primary);
  color: var(--on-primary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(8px);
  transition: transform 0.3s;
}

.card-landscape:hover .card-play {
  transform: translateY(0);
}

.card-landscape .card-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  transition: color 0.3s;
}

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

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--on-surface-variant);
  font-size: 0.8rem;
}

.card-meta .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--outline-variant);
}

/* ──────────────────────────────────────────────
   CARTOON CARD (Portrait – Suggested style)
   ────────────────────────────────────────────── */
.card-portrait {
  flex: 0 0 180px;
  cursor: pointer;
}

.card-portrait .card-thumb {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 0.75rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transition: transform 0.5s ease;
}

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

.card-portrait .card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-portrait .badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.625rem;
  font-weight: 700;
}

.card-portrait .card-title {
  font-weight: 700;
  text-align: center;
  transition: color 0.3s;
}

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

/* ──────────────────────────────────────────────
   GENRE CHIPS
   ────────────────────────────────────────────── */
.genre-row {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.genre-chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-full);
  background: var(--surface-container-high);
  color: var(--on-surface);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s;
  cursor: pointer;
  white-space: nowrap;
}

.genre-chip:hover {
  background: var(--primary);
  color: var(--on-primary);
  transform: scale(1.05);
}

.genre-chip.active {
  background: var(--primary);
  color: var(--on-primary);
}

.genre-chip .genre-icon {
  font-size: 1.1rem;
}

/* ──────────────────────────────────────────────
   BENTO GRID (New Episodes section)
   ────────────────────────────────────────────── */
.bento-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 1.25rem;
}

.bento-item {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transition: transform 0.4s;
}

.bento-item:hover {
  transform: scale(1.02);
}

.bento-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bento-item.featured {
  grid-row: span 2;
}

.bento-item .bento-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.2) 50%, transparent 100%);
}

.bento-item .bento-content {
  position: absolute;
  bottom: 0;
  width: 100%;
  padding: 1.5rem;
}

.bento-item .bento-small-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  transition: background 0.3s;
}

.bento-item:hover .bento-small-overlay {
  background: rgba(0,0,0,0.2);
}

.bento-small-title {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  text-align: center;
  padding: 1rem;
}

/* ──────────────────────────────────────────────
   CARTOON GRID (Browse / Genre pages)
   ────────────────────────────────────────────── */
.cartoons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

.cartoons-grid .card-portrait {
  flex: initial;
}

/* ──────────────────────────────────────────────
   CARTOON DETAILS PAGE
   ────────────────────────────────────────────── */
.detail-hero {
  position: relative;
  width: 100%;
  height: 60vh;
  min-height: 450px;
  overflow: hidden;
}

.detail-hero-bg {
  position: absolute;
  inset: 0;
}

.detail-hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.6);
}

.detail-hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, var(--bg) 10%, rgba(14,14,14,0.6) 50%, rgba(14,14,14,0.2) 100%);
}

.detail-hero-content {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 2rem 3rem;
}

.detail-season-badge {
  display: inline-block;
  background: var(--primary);
  color: var(--on-primary);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  width: fit-content;
}

.detail-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.detail-desc {
  font-size: 1rem;
  color: var(--on-surface-variant);
  max-width: 600px;
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.detail-info {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  color: var(--on-surface-variant);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.detail-info span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ──────────────────────────────────────────────
   EPISODE LIST
   ────────────────────────────────────────────── */
.episodes-section {
  padding: 2rem;
}

.season-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
}

.season-tab {
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-full);
  background: var(--surface-container-high);
  color: var(--on-surface-variant);
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
  transition: all 0.3s;
}

.season-tab:hover,
.season-tab.active {
  background: var(--primary);
  color: var(--on-primary);
}

.episode-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.episode-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--surface-container);
  cursor: pointer;
  transition: all 0.3s;
}

.episode-item:hover {
  background: var(--surface-container-high);
  transform: translateX(-4px);
}

.episode-item.active {
  background: var(--primary);
  color: var(--on-primary);
}

.episode-thumb {
  flex: 0 0 140px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.episode-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.episode-thumb .ep-duration {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
}

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

.episode-info h4 {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.episode-info p {
  color: var(--on-surface-variant);
  font-size: 0.8rem;
}

.episode-number {
  flex: 0 0 40px;
  text-align: center;
  font-weight: 900;
  font-size: 1.25rem;
  color: var(--on-surface-variant);
  font-family: 'Be Vietnam Pro', sans-serif;
}

/* ──────────────────────────────────────────────
   VIDEO PLAYER PAGE
   ────────────────────────────────────────────── */
.player-page {
  padding: calc(var(--navbar-h) + 1rem) 2rem 6rem;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
}

.player-main {
  min-width: 0;
}

.video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface-container-lowest);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-container-lowest);
}

.video-placeholder .play-big {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  box-shadow: 0 8px 32px rgba(255, 172, 84, 0.3);
}

.video-placeholder .play-big:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 48px rgba(255, 172, 84, 0.5);
}

.video-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.video-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--surface-container);
  border-radius: var(--radius);
}

.video-nav a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--on-surface-variant);
  font-weight: 600;
  font-size: 0.875rem;
  transition: color 0.3s;
}

.video-nav a:hover {
  color: var(--primary);
}

.video-nav .label {
  font-size: 0.7rem;
  color: var(--on-surface-variant);
  opacity: 0.6;
}

/* Player Sidebar */
.player-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.player-sidebar h3 {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.sidebar-ep-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.sidebar-ep {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.3s;
}

.sidebar-ep:hover {
  background: var(--surface-container-high);
}

.sidebar-ep.active {
  background: var(--surface-container-highest);
}

.sidebar-ep-thumb {
  flex: 0 0 100px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.sidebar-ep-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.sidebar-ep-info h5 {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sidebar-ep-info small {
  color: var(--on-surface-variant);
  font-size: 0.7rem;
}

/* ──────────────────────────────────────────────
   SEARCH OVERLAY
   ────────────────────────────────────────────── */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 15vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s;
}

.search-overlay.open {
  opacity: 1;
  visibility: visible;
}

.search-overlay .search-box {
  width: 90%;
  max-width: 600px;
  display: flex;
  align-items: center;
  background: var(--surface-container-high);
  border-radius: var(--radius-xl);
  padding: 1rem 1.5rem;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.search-overlay .search-box input {
  width: 100%;
  font-size: 1.25rem;
  color: var(--on-surface);
}

.search-results {
  width: 90%;
  max-width: 600px;
  max-height: 50vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface-container);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.3s;
}

.search-result-item:hover {
  background: var(--surface-container-high);
}

.search-result-thumb {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.search-result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ──────────────────────────────────────────────
   BOTTOM NAV (Mobile)
   ────────────────────────────────────────────── */
.bottom-nav {
  display: none;
}

@media (max-width: 767px) {
  .bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 0.75rem 1.5rem calc(0.75rem + env(safe-area-inset-bottom));
    background: rgba(14, 14, 14, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(72, 72, 71, 0.15);
    border-radius: 2rem 2rem 0 0;
    z-index: 100;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
  }

  .main-content {
    padding-bottom: 6rem;
  }
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: var(--radius);
  color: var(--on-surface-variant);
  transition: all 0.3s;
  text-decoration: none;
}

.bottom-nav-item.active {
  background: rgba(255, 172, 84, 0.1);
  color: var(--primary);
}

.bottom-nav-item span:last-child {
  font-size: 0.625rem;
  font-weight: 500;
  margin-top: 2px;
}

/* ──────────────────────────────────────────────
   LOADING / SKELETON
   ────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-container) 25%, var(--surface-container-high) 50%, var(--surface-container) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

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

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 0.5s, visibility 0.5s;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-ring {
  width: 48px;
  height: 48px;
  border: 3px solid var(--surface-container-high);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-screen .logo-text {
  margin-top: 1.5rem;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--primary);
}

/* ──────────────────────────────────────────────
   UTILITIES
   ────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-muted { color: var(--on-surface-variant); }
.text-center { text-align: center; }

.fadeIn {
  animation: fadeIn 0.5s ease-out;
}

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

/* ──────────────────────────────────────────────
   RESPONSIVE
   ────────────────────────────────────────────── */
@media (max-width: 767px) {
  :root {
    --sidebar-w: 0px;
  }

  .sidebar {
    display: none !important;
  }

  .nav-links {
    display: none;
  }

  .nav-search {
    display: none;
  }

  .mobile-search-btn {
    display: inline-block !important;
  }

  .hero {
    height: 70vh;
    min-height: 450px;
  }

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

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

  .content-rows {
    padding: 0 1rem;
    gap: 3rem;
  }

  .card-landscape {
    flex: 0 0 220px;
  }

  .card-portrait {
    flex: 0 0 140px;
  }

  .bento-grid {
    grid-template-columns: 1fr;
  }

  .bento-item.featured {
    grid-row: span 1;
    min-height: 300px;
  }

  .bento-item {
    min-height: 200px;
  }

  .cartoons-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
  }

  .player-page {
    grid-template-columns: 1fr;
    padding: calc(var(--navbar-h) + 0.5rem) 1rem 6rem;
  }

  .player-sidebar {
    order: 2;
  }

  .episodes-section {
    padding: 1rem;
  }

  .episode-thumb {
    flex: 0 0 100px;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .card-landscape {
    flex: 0 0 240px;
  }

  .player-page {
    grid-template-columns: 1fr 280px;
  }
}

/* ──────────────────────────────────────────────
   PAGE TRANSITIONS
   ────────────────────────────────────────────── */
.page {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.page.active {
  display: block;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--surface-container-highest);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--outline-variant);
}

/* ──────────────────────────────────────────────
   MOBILE SEARCH BUTTON
   ────────────────────────────────────────────── */
.mobile-search-btn {
  display: none;
}

/* ──────────────────────────────────────────────
   SEARCH OVERLAY ANIMATION (supplement)
   ────────────────────────────────────────────── */
.search-overlay .search-box {
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}

.search-overlay.open .search-box {
  transform: translateY(0);
}

/* ──────────────────────────────────────────────
   FOOTER
   ────────────────────────────────────────────── */
.site-footer {
  padding: 3rem 2rem;
  text-align: center;
  color: var(--on-surface-variant);
  font-size: 0.85rem;
  border-top: 1px solid var(--surface-container-high);
  margin-top: 4rem;
}

.footer-brand {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.footer-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.footer-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.footer-stat .stat-num {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--primary);
  font-family: 'Be Vietnam Pro', sans-serif;
}

.footer-stat .stat-label {
  font-size: 0.8rem;
  color: var(--on-surface-variant);
}

/* ──────────────────────────────────────────────
   ENHANCED VISUAL EFFECTS
   ────────────────────────────────────────────── */
.card-landscape:hover .card-thumb {
  box-shadow: 0 12px 32px rgba(255, 172, 84, 0.15),
              0 0 0 1px rgba(255, 172, 84, 0.1);
}

.card-portrait:hover .card-thumb {
  box-shadow: 0 12px 40px rgba(255, 172, 84, 0.15),
              0 0 0 1px rgba(255, 172, 84, 0.1);
}

.bento-item.featured {
  min-height: 400px;
}

.bento-item:not(.featured) {
  min-height: 190px;
}

/* Iframe/embed support for video */
.video-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--radius);
}

/* Detail info responsive */
@media (max-width: 767px) {
  .detail-info {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .detail-hero {
    height: 55vh;
    min-height: 380px;
  }

  .detail-title {
    font-size: 1.75rem;
  }

  .btn {
    padding: 0.625rem 1.5rem;
    font-size: 0.95rem;
  }
  
  .site-footer {
    padding: 2rem 1rem 5rem;
  }
}
