:root {
  --bg: #f0f1f5;
  --surface: #ffffff;
  --border: #d4d4dc;
  --text: #14141c;
  --muted: #5a5a6c;
  --accent: #c94b6a;
  --accent-hover: #a83a56;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(20, 20, 28, 0.06);
}

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

body {
  margin: 0;
  font-family: "Noto Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  text-align: start;
}

body.rtl {
  direction: rtl;
}

body.ltr {
  direction: ltr;
}

.hidden {
  display: none !important;
}

/* Age gate */
.age-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.96);
  padding: 1rem;
}

.age-gate-panel {
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

.age-gate-panel h1 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
}

.age-gate-warning {
  font-size: 0.875rem;
  color: var(--muted);
}

.age-gate-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* Layout */
.header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 16px rgba(20, 20, 28, 0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem clamp(0.5rem, 1.25vw, 1rem);
  max-width: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.logo-mark {
  display: flex;
  line-height: 0;
}

.logo-text {
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  flex: 1;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: flex-start;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
  background: rgba(201, 75, 106, 0.1);
}

.nav-icon {
  display: flex;
  opacity: 0.85;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-lang {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}

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

#app {
  width: 100%;
  min-height: 100vh;
}

.main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.65rem clamp(0.5rem, 1.25vw, 1rem);
}

/* Controls */
.toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.filters-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
}

.filters-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.65rem;
  align-items: center;
}

.filters-row select,
.filters-row .search-input {
  width: 100%;
  min-width: 0;
  padding: 0.55rem 0.65rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.filters-row .filter-check {
  grid-column: 1 / -1;
  font-size: 0.9rem;
}

.filters-row #btn-clear-filters {
  justify-self: start;
}

.page-title {
  margin: 0 0 0.65rem;
  font-size: 1.35rem;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  text-align: start;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.search-input:focus {
  outline: 2px solid rgba(201, 75, 106, 0.35);
  border-color: var(--accent);
}

.provider-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.tab {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.875rem;
}

.tab.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(201, 75, 106, 0.1);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 168px), 1fr));
  gap: 0.65rem;
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  }
}

@media (min-width: 1200px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0.75rem;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.card-thumb {
  aspect-ratio: 16 / 9;
  background: linear-gradient(145deg, #e4e4ea, #d8d8e0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.75rem;
  overflow: hidden;
  position: relative;
}

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

.card-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #ebebf0, #dedee6);
  color: var(--muted);
  font-size: 0.8rem;
}

.card-body {
  padding: 0.55rem 0.6rem;
}

.card-title {
  margin: 0;
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Player */
.player-wrap {
  margin-bottom: 1rem;
}

.player-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.player-header h1 {
  margin: 0;
  font-size: 1.25rem;
}

.player-actions {
  display: flex;
  gap: 0.5rem;
}

.embed-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: #e8e8ec;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.embed-container iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 1.25rem 0.5rem;
}

.error-banner {
  background: rgba(201, 75, 106, 0.08);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.fav-active {
  color: var(--accent);
  border-color: var(--accent);
}

.main-wide {
  width: 100%;
  max-width: none;
}

.layout-browse {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 240px);
  gap: 0.85rem;
  align-items: start;
  width: 100%;
}

.browse-main,
.watch-main {
  min-width: 0;
}

.home-sections {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.home-more {
  text-align: center;
  margin: 0.85rem 0 0;
}

.sidebar-loading {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.home-regions {
  margin-top: 0.5rem;
  padding-top: 0;
  border-top: none;
}

/* Home page */
.home-hero {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
  background: linear-gradient(135deg, rgba(201, 75, 106, 0.12), rgba(255, 255, 255, 0.95));
  border: 1px solid rgba(201, 75, 106, 0.2);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
}

.home-hero-icon {
  flex-shrink: 0;
  color: var(--accent);
  margin-top: 0.15rem;
}

.home-hero-text h1 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  line-height: 1.3;
}

.home-hero-text p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.home-quick {
  margin-bottom: 1rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.section-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.section-link {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.chip-list-home {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip-region {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.88rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, color 0.15s;
}

.chip-region:hover,
.chip-all:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chip-all {
  background: rgba(201, 75, 106, 0.08);
  border: 1px dashed var(--accent);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.88rem;
  text-decoration: none;
  color: var(--accent);
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  margin-bottom: 0.85rem;
}

.search-bar-icon {
  color: var(--muted);
  display: flex;
  flex-shrink: 0;
}

.search-input-lg {
  flex: 1;
  min-width: 0;
  border: none;
  box-shadow: none;
  padding: 0.55rem 0;
  font-size: 1rem;
  background: transparent;
}

.search-input-lg:focus {
  outline: none;
  border: none;
  box-shadow: none;
}

.home-filters-toggle {
  margin-bottom: 1rem;
}

.home-filters-toggle summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.35rem 0;
  list-style: none;
}

.home-filters-toggle summary::-webkit-details-marker {
  display: none;
}

.home-filters-toggle[open] summary {
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.home-feed-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.home-feed-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.home-feed-count {
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--bg);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

/* Skeleton loading */
.skeleton-shimmer {
  background: linear-gradient(90deg, #e8e8ee 25%, #f4f4f8 50%, #e8e8ee 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

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

.card-skeleton {
  pointer-events: none;
  cursor: default;
}

.card-skeleton:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: none;
}

.card-skeleton .card-thumb {
  border-radius: 0;
}

.skeleton-line {
  height: 0.75rem;
  border-radius: 4px;
  background: linear-gradient(90deg, #e8e8ee 25%, #f4f4f8 50%, #e8e8ee 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  margin-bottom: 0.4rem;
}

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

@media (max-width: 900px) {
  .header-inner {
    flex-wrap: wrap;
  }
  .nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
  }
  .nav-link span:not(.nav-icon) {
    font-size: 0.82rem;
  }
  .home-hero {
    flex-direction: column;
    gap: 0.5rem;
  }
}

.results-summary {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

html[dir="rtl"] .layout-browse {
  grid-template-columns: minmax(0, 1fr) minmax(200px, 240px);
}

html[dir="ltr"] .layout-browse {
  grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
}

html[dir="ltr"] .layout-browse .browse-main {
  order: 2;
}

html[dir="ltr"] .layout-browse .sidebar-panel {
  order: 1;
}

@media (max-width: 900px) {
  .layout-browse,
  html[dir="rtl"] .layout-browse,
  html[dir="ltr"] .layout-browse {
    grid-template-columns: 1fr;
  }
  .sidebar-panel {
    order: 2;
  }
  .sidebar-panel .ad-slot {
    display: none;
  }
  .browse-main > .ad-slot:not(.ad-juicy-inline):not(.ad-magsrv-inline) {
    display: none;
  }
  .home-sections > .ad-slot {
    display: none;
  }
  .browse-main > .ad-juicy-inline {
    display: flex !important;
    justify-content: center;
    margin-bottom: 1rem;
  }
  .nav {
    gap: 0.25rem 0.5rem;
    font-size: 0.9rem;
  }
  .header {
    padding: 0.65rem 1rem;
  }
}

.ad-banner-wrap[hidden] {
  display: none !important;
}

.ad-banner-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 clamp(0.5rem, 1.25vw, 1rem);
  line-height: 0;
}

.ad-banner {
  display: flex;
  justify-content: center;
  margin: 0 0 0.5rem;
  min-height: 0;
  overflow: hidden;
}

.ad-banner ins {
  display: block;
  max-width: 100%;
}

.ad-footer-wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.ad-footer-wrap .ad-slot {
  margin-bottom: 0;
}

.ad-footer-wrap .ad-magsrv-footer,
.ad-footer-wrap .ad-magsrv-footer ins {
  max-width: 300px;
  max-height: 250px;
}

.ad-footer {
  display: flex;
  justify-content: center;
  min-height: 60px;
  overflow: hidden;
}

.ad-footer ins {
  display: block;
  max-width: 100%;
}

.ad-slot {
  display: flex;
  justify-content: center;
  margin: 0 0 0.65rem;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: transparent;
}

.ad-slot:empty:not(:has(ins)) {
  display: none;
  margin: 0;
}

.ad-slot.ad-slot-collapsed {
  display: none !important;
  min-height: 0 !important;
  margin: 0 !important;
}

.ad-slot ins,
.ad-banner ins,
.ad-footer ins {
  display: block;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
}

.ad-banner ins {
  min-height: 50px;
  min-width: min(100%, 728px);
}

.ad-footer ins {
  min-width: 468px;
  min-height: 60px;
}

.sidebar-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.65rem;
  position: sticky;
  top: 3.75rem;
  max-height: none;
  overflow: visible;
  align-self: start;
}

.sidebar-nav {
  margin: 0;
}

.sidebar-list {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
}

.sidebar-list-compact .sidebar-link {
  font-size: 0.82rem;
}

.sidebar-link-all {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.sidebar-panel .ad-slot {
  min-height: 250px;
  margin: 0.5rem 0 0;
  padding: 0;
  background: rgba(0, 0, 0, 0.03);
}

.sidebar-panel .ad-slot ins {
  min-width: 0;
  width: 100%;
  max-width: 300px;
  min-height: 250px;
}

.sidebar-panel .ad-wm-embed,
.sidebar-panel .ad-wm-iframe {
  display: none;
}

.sidebar-panel .ad-magsrv {
  min-height: 250px;
  margin: 0.5rem 0;
}

.sidebar-panel .ad-magsrv ins,
.ad-magsrv-sidebar ins,
.watch-sidebar-ads .ad-magsrv ins,
ins[data-zoneid="5933214"] {
  display: block;
  width: 100%;
  max-width: 300px;
  min-height: 250px;
  margin: 0 auto;
}

.sidebar-panel .ad-slot,
.watch-sidebar-ads .ad-slot {
  margin-top: 0.5rem;
}

.sidebar-panel .ad-slot.ad-juicy,
.watch-sidebar-ads .ad-slot.ad-juicy,
.watch-sidebar-ads .ad-slot.ad-wm-iframe {
  min-height: 250px;
  background: rgba(0, 0, 0, 0.03);
}

.ad-slot.ad-magsrv {
  min-height: 0;
  margin-top: 0.5rem;
  background: transparent;
}

.ad-slot.ad-magsrv:not(.ad-magsrv-sticky):not(.ad-magsrv-header):has(iframe),
.ad-slot.ad-magsrv:not(.ad-magsrv-sticky):not(.ad-magsrv-header):has(img),
.ad-slot.ad-magsrv:not(.ad-magsrv-sticky):not(.ad-magsrv-header):has(a) {
  min-height: 250px;
  background: rgba(0, 0, 0, 0.03);
}

.ad-magsrv-inline ins,
.ad-magsrv-banner ins,
.ad-magsrv-footer ins {
  display: block;
  width: 100%;
  max-width: 728px;
  min-height: 0;
  max-height: 120px;
  margin: 0 auto;
  overflow: hidden;
}

/* Zone 5933198 — native format: sidebar only, fixed 300×250 */
.ad-magsrv ins[data-zoneid="5933198"],
.ad-slot:has(ins[data-zoneid="5933198"]) {
  max-width: 300px;
  max-height: 250px;
  overflow: hidden;
}

.ad-slot:has(ins[data-zoneid="5933198"]) {
  min-height: 0;
  margin: 0.5rem auto 0;
}

.ad-slot:has(ins[data-zoneid="5933198"]) iframe,
.ad-slot:has(ins[data-zoneid="5933198"]) img,
.ad-slot:has(ins[data-zoneid="5933198"]) video {
  max-width: 100% !important;
  max-height: 250px !important;
  object-fit: contain;
}

/* Never show 5933198 in main column (legacy SPA nodes) */
.browse-main .ad-slot:has(ins[data-zoneid="5933198"]),
.watch-main .ad-slot:has(ins[data-zoneid="5933198"]),
.main > .ad-slot:has(ins[data-zoneid="5933198"]) {
  display: none !important;
}

/* Header leaderboard — shrink-wrap to creative (zone 5933202) */
.ad-banner-wrap .ad-magsrv-banner.ad-magsrv-header,
.ad-banner-wrap .ad-slot.ad-magsrv.ad-magsrv-header {
  display: inline-block;
  width: auto;
  max-width: min(970px, 100%);
  min-height: 0 !important;
  margin: 0 auto 0.35rem;
  padding: 0;
  background: transparent !important;
  overflow: visible;
  line-height: 0;
}

.ad-banner-wrap .ad-magsrv-header ins,
.ad-banner-wrap ins[data-zoneid="5933202"] {
  display: block;
  width: auto;
  max-width: min(970px, 100%);
  min-height: 0 !important;
  height: auto;
  margin: 0 auto;
  padding: 0;
  line-height: 0;
  background: transparent;
}

.ad-banner-wrap ins[data-zoneid="5933202"] iframe,
.ad-banner-wrap ins[data-zoneid="5933202"] img,
.ad-banner-wrap ins[data-zoneid="5933202"] a {
  display: block;
  max-width: min(970px, 100%);
  height: auto;
}

/* MagSrv instant message — bottom-right overlay (zone 5933210) */
.ad-instant-mount {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 500;
  max-width: min(340px, calc(100vw - 2rem));
  pointer-events: none;
}

.ad-instant-mount .ad-magsrv-instant {
  pointer-events: auto;
  margin: 0;
  min-height: 0;
  overflow: visible;
  background: transparent;
}

.ad-instant-mount .ad-magsrv-instant ins,
.ad-instant-mount ins[data-zoneid="5933210"] {
  display: block;
  width: 100%;
  max-width: 320px;
  min-height: 0;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .ad-instant-mount {
    right: 0.5rem;
    bottom: 0.5rem;
    max-width: min(280px, calc(100vw - 1rem));
  }
}

/* MagSrv sticky banner — locked to viewport bottom (zone 5933224) */
#ad-sticky-mount.ad-sticky-mount {
  position: fixed !important;
  top: auto !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  transform: none !important;
  z-index: 490;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  pointer-events: none;
  line-height: 0;
  padding: 0;
  margin: 0;
}

/* MagSrv sticky creatives often ship with position:fixed;top:0 — contain them */
.ad-sticky-mount iframe,
.ad-sticky-mount ins,
.ad-sticky-mount .ad-magsrv-sticky,
.ad-sticky-mount .ad-magsrv-sticky > div {
  position: relative !important;
  top: auto !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  transform: none !important;
}

.ad-sticky-mount .ad-magsrv-sticky,
.ad-sticky-mount .ad-slot.ad-magsrv {
  pointer-events: auto;
  display: block;
  margin: 0;
  padding: 0;
  min-height: 0 !important;
  max-height: none;
  overflow: visible;
  background: transparent !important;
  border-radius: 0;
}

/* Target size for MagSrv to inject; shrinks once creative loads */
.ad-sticky-mount .ad-magsrv-sticky ins,
.ad-sticky-mount ins[data-zoneid="5933224"] {
  display: block;
  width: min(728px, 100vw);
  max-width: 100vw;
  min-height: 90px;
  height: auto;
  margin: 0 auto;
  padding: 0;
  line-height: 0;
  background: transparent;
}

.ad-sticky-mount ins[data-zoneid="5933224"]:has(iframe, img, a) {
  width: auto;
  min-width: 0;
  min-height: 0;
  max-width: min(970px, 100vw);
}

.ad-sticky-mount ins[data-zoneid="5933224"] iframe,
.ad-sticky-mount ins[data-zoneid="5933224"] img,
.ad-sticky-mount ins[data-zoneid="5933224"] a {
  display: block;
  max-width: min(970px, 100vw);
  height: auto;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .ad-sticky-mount {
    max-width: 100vw;
  }

  .ad-instant-mount {
    bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
  }
}

.watch-sidebar .ad-slot {
  margin-bottom: 1rem;
}

.ad-wm-embed {
  min-height: 243px;
  overflow: hidden;
}

.wm-sipr-target {
  width: 100%;
  max-width: 432px;
  min-height: 243px;
  margin: 0 auto;
}

.ad-wm-embed iframe,
.ad-wm-iframe iframe {
  max-width: 100%;
  border: 0;
}

.ad-wm-iframe {
  display: flex;
  justify-content: center;
  min-height: 250px;
}

.watch-main > .ad-slot,
.browse-main > .ad-slot,
.home-sections > .ad-slot,
.main > .ad-slot {
  margin: 0 0 1rem;
  justify-content: center;
}

.sidebar-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.sidebar-panel h2:not(:first-child) {
  margin-top: 0.55rem;
}

.sidebar-link {
  display: block;
  padding: 0.2rem 0;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  line-height: 1.35;
}

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

.sidebar-link small {
  color: var(--muted);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.chip {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
}

.chip:hover,
.chip.active {
  border-color: var(--accent);
  color: var(--accent);
}

.catalog-section {
  margin-bottom: 1.25rem;
}

.catalog-section h2 {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr));
  gap: 0.45rem;
}

.catalog-card {
  display: block;
  padding: 0.65rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
}

.catalog-card:hover {
  border-color: var(--accent);
}

.catalog-card span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.2rem;
}

.results-summary {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.card-badges {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(201, 75, 106, 0.1);
  color: var(--accent);
  text-transform: uppercase;
}

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

.btn-lang {
  margin-inline-start: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.sidebar-link-arabic {
  font-weight: 600;
  color: var(--accent);
}

.hero-banner {
  background: linear-gradient(135deg, rgba(201, 75, 106, 0.1), rgba(255, 255, 255, 0.95));
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  text-align: start;
  box-shadow: var(--shadow);
}

.hero-banner.hero-compact {
  padding: 0.9rem 1.15rem;
}

.hero-banner.hero-compact h2 {
  font-size: 1.15rem;
}

.hero-banner.hero-compact p {
  font-size: 0.9rem;
}

.hero-banner h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

.hero-banner p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.badge-ar {
  background: rgba(26, 115, 232, 0.12);
  color: #1a73e8;
}

.card-title {
  text-align: start;
}

.filters-row select {
  text-align: start;
}

.age-gate-panel {
  text-align: start;
}

.pagination {
  flex-wrap: wrap;
}

/* Footer SEO links */
.site-footer {
  margin-top: 1.25rem;
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.footer-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
}

.footer-nav a:hover {
  color: var(--accent);
}

.footer-copy {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Auth */
.main-narrow {
  max-width: 420px;
}

.auth-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
}

.auth-panel h1 {
  margin: 0 0 1.25rem;
  font-size: 1.5rem;
}

.auth-form label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.auth-form input,
.auth-form textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
}

.auth-error {
  color: var(--accent);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.auth-switch {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.9rem;
}

.auth-switch a {
  color: var(--accent);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nav-user {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Home sections */
.home-sections {
  margin-bottom: 1.5rem;
}

.home-section {
  margin-bottom: 1rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.section-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.section-link {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
}

.grid-compact {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 155px), 1fr));
  gap: 0.6rem;
}

/* Watch layout */
.watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 280px);
  gap: 0.85rem;
  align-items: start;
  width: 100%;
}

.watch-main .embed-container {
  max-width: min(100%, 960px);
}

.watch-main .player-wrap {
  margin-bottom: 0.65rem;
}

@media (max-width: 960px) {
  .watch-layout {
    grid-template-columns: 1fr;
  }
}

.watch-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 4.5rem;
  align-self: start;
  overflow: visible;
  max-height: none;
}

.watch-sidebar-ads {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-shrink: 0;
}

.watch-sidebar-ads .ad-slot {
  margin-bottom: 0;
  min-height: 250px;
  background: rgba(0, 0, 0, 0.03);
}

.watch-sidebar-ads .ad-magsrv ins {
  display: block;
  width: 100%;
  max-width: 300px;
  min-height: 250px;
  margin: 0 auto;
}

.comments-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.comments-panel-sticky {
  position: sticky;
  top: 4.5rem;
  z-index: 2;
}

#comments-list {
  max-height: none;
  overflow: visible;
}

.comments-panel h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
}

.comment {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.comment:last-of-type {
  border-bottom: none;
}

.comment time {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.comment p {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
}

.comment-form textarea,
.comment-form input {
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
}

.comment-form textarea {
  resize: vertical;
}

.muted {
  color: var(--muted);
  font-size: 0.875rem;
}

.playlist-select {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.85rem;
  max-width: 180px;
}

/* Playlists */
.playlist-create {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.playlist-create input {
  flex: 1;
  min-width: 200px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.playlist-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.playlist-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s;
}

.playlist-row:hover {
  border-color: var(--accent);
}

.playlist-row span {
  color: var(--muted);
  font-size: 0.85rem;
}
