:root {
  --bg: #0b0d10;
  --surface: #141820;
  --surface-2: #1c2230;
  --text: #f2f4f8;
  --muted: #9aa3b2;
  --accent: #e8a838;
  --accent-dim: rgba(232, 168, 56, 0.18);
  --danger: #ff6b6b;
  --radius: 14px;
  --nav-h: 64px;
  --fs-hero: clamp(1.6rem, 3.5vw, 2.4rem);
  --fs-title: clamp(1.15rem, 2vw, 1.45rem);
  --fs-body: clamp(0.95rem, 1.4vw, 1.05rem);
  --fs-meta: clamp(0.8rem, 1.1vw, 0.9rem);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: radial-gradient(1200px 600px at 80% -10%, #1a2233 0%, var(--bg) 55%);
  color: var(--text);
  font-family: 'Segoe UI', Tahoma, 'Noto Sans Arabic', sans-serif;
  font-size: var(--fs-body); line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
img { max-width: 100%; display: block; }
.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topnav {
  position: sticky; top: 0; z-index: 40; height: var(--nav-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 clamp(16px, 3vw, 36px);
  background: rgba(11, 13, 16, 0.86); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.brand { font-weight: 800; font-size: clamp(1.1rem, 2vw, 1.35rem); color: var(--accent); white-space: nowrap; }
.nav-links { display: flex; gap: 8px; flex: 1; overflow-x: auto; }
.nav-links a { padding: 8px 12px; border-radius: 999px; color: var(--muted); white-space: nowrap; }
.nav-links a:hover, .nav-links a.is-active { color: var(--text); background: var(--surface-2); }
.main { flex: 1; width: min(1200px, 100%); margin: 0 auto; padding: 22px clamp(16px, 3vw, 36px) 48px; }
.page-title { margin: 0 0 8px; font-size: var(--fs-hero); font-weight: 800; }
.page-sub { margin: 0 0 22px; color: var(--muted); }
.section { margin-bottom: 36px; }
.section-title { margin: 0 0 14px; font-size: var(--fs-title); font-weight: 800; }
.rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(140px, 180px);
  gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory;
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.card { scroll-snap-align: start; background: transparent; border: 0; padding: 0; text-align: start; color: inherit; cursor: pointer; }
.card-poster {
  aspect-ratio: 2 / 3; border-radius: var(--radius); overflow: hidden;
  background: var(--surface-2); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.card-poster img { width: 100%; height: 100%; object-fit: cover; }
.card-title {
  margin-top: 8px; font-size: var(--fs-meta); font-weight: 700;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; font-weight: 700;
}
.btn-primary { background: var(--accent); color: #1a1200; }
.btn-ghost { background: transparent; border-color: rgba(255, 255, 255, 0.14); color: var(--text); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1); background: var(--surface-2);
  color: var(--text); cursor: pointer; font-weight: 700; font-size: var(--fs-meta);
}
.chip.is-active, .chip:hover { background: var(--accent-dim); border-color: var(--accent); }
.detail { display: grid; grid-template-columns: minmax(160px, 280px) 1fr; gap: 28px; align-items: start; }
@media (max-width: 720px) { .detail { grid-template-columns: 1fr; } }
.detail-poster { border-radius: calc(var(--radius) + 4px); overflow: hidden; background: var(--surface-2); aspect-ratio: 2 / 3; }
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }
.detail-meta { color: var(--muted); margin-bottom: 14px; }
.detail-desc { color: var(--muted); margin: 0 0 18px; white-space: pre-wrap; }
.picker-block { margin-bottom: 16px; }
.picker-label { margin: 0 0 8px; color: var(--accent); font-size: var(--fs-meta); font-weight: 800; }
.form { display: grid; gap: 12px; max-width: 420px; }
.form label { display: grid; gap: 6px; font-weight: 700; }
.form input {
  min-height: 46px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--surface); color: var(--text); padding: 0 14px;
}
.error-banner {
  background: rgba(255, 107, 107, 0.12); color: var(--danger);
  padding: 12px 14px; border-radius: 12px; margin-bottom: 12px;
}
.empty, .muted-note { color: var(--muted); }
.search-bar { display: flex; gap: 10px; margin-bottom: 20px; }
.search-bar input {
  flex: 1; min-height: 46px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--surface); color: var(--text); padding: 0 16px;
}
.player-page { position: fixed; inset: 0; background: #000; z-index: 100; display: flex; flex-direction: column; }
.player-page video { flex: 1; width: 100%; height: 100%; background: #000; object-fit: contain; }
.player-top {
  position: absolute; inset-inline: 0; top: 0; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; padding: 14px 16px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent); z-index: 2;
}
.player-title { font-weight: 800; font-size: var(--fs-title); }
.splash { min-height: 40vh; display: grid; place-items: center; color: var(--muted); }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.15); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
