/* ===================== الأساسيات ===================== */

:root {
  --bg: #080b14;
  --bg-soft: #0d1220;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .075);
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #eef2ff;
  --muted: #8f9bb8;
  --brand: #00c2e8;
  --brand-2: #5eefd0;
  --brand-rgb: 0, 194, 232;
  --brand-deep: #0891b2;
  --aurora-1: #0891b2;
  --aurora-2: #0e7490;
  --aurora-3: #2563eb;
  --sky: #141c33;
  --bar: rgba(8, 11, 20, .72);
  --panel: #121828;
  --panel-2: #0b1020;
  --field: rgba(255, 255, 255, .04);
  --label: #c3cbe2;
  --danger: #f43f5e;
  --success: #22c55e;
  --warn: #f59e0b;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px rgba(0, 0, 0, .55);
  --header-h: 74px;
}

html[data-theme="violet"] {
  --brand: #8b5cf6; --brand-2: #c4b5fd; --brand-rgb: 139, 92, 246; --brand-deep: #6d28d9;
  --aurora-1: #7c3aed; --aurora-2: #4c1d95; --aurora-3: #db2777; --sky: #1a1033;
}
html[data-theme="emerald"] {
  --brand: #10b981; --brand-2: #6ee7b7; --brand-rgb: 16, 185, 129; --brand-deep: #047857;
  --aurora-1: #059669; --aurora-2: #065f46; --aurora-3: #0ea5e9; --sky: #06281f;
}
html[data-theme="amber"] {
  --brand: #f59e0b; --brand-2: #fde68a; --brand-rgb: 245, 158, 11; --brand-deep: #d97706;
  --aurora-1: #d97706; --aurora-2: #92400e; --aurora-3: #ef4444; --sky: #2a1a08;
}
html[data-theme="rose"] {
  --brand: #f43f5e; --brand-2: #fda4af; --brand-rgb: 244, 63, 94; --brand-deep: #be123c;
  --aurora-1: #e11d48; --aurora-2: #9f1239; --aurora-3: #a855f7; --sky: #2a0c14;
}
html[data-theme="light"] {
  --bg: #f3fbfc;
  --bg-soft: #ffffff;
  --surface: rgba(8, 90, 105, .05);
  --surface-2: rgba(8, 90, 105, .09);
  --line: rgba(8, 100, 115, .14);
  --line-strong: rgba(8, 100, 115, .24);
  --text: #12343c;
  --muted: #4e6d76;
  --brand: #00bcd4;
  --brand-2: #5eead4;
  --brand-rgb: 0, 188, 212;
  --brand-deep: #0891b2;
  --aurora-1: #67e8f9;
  --aurora-2: #2dd4bf;
  --aurora-3: #22d3ee;
  --sky: #dff9ff;
  --bar: rgba(255, 255, 255, .86);
  --panel: #ffffff;
  --panel-2: #f4fbfc;
  --field: #ffffff;
  --label: #1a4d58;
  --shadow: 0 18px 40px rgba(8, 90, 105, .12);
}

* { box-sizing: border-box; }

/* سمة hidden يجب أن تخفي العنصر حتى لو حدّد التنسيق display */
[hidden] { display: none !important; }

html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Cairo', system-ui, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

html.is-locked, body.is-locked { overflow: hidden; height: 100%; }

h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 800; letter-spacing: -.01em; }
p { margin: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, .card, .filter, .side__link { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
svg { width: 1.15em; height: 1.15em; flex: none; }

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

::selection { background: var(--brand); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 99px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.22); }

/* ===================== الخلفية المتوهجة ===================== */

.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(120% 80% at 50% -10%, var(--sky) 0%, var(--bg) 60%); }
.aurora span { position: absolute; border-radius: 50%; filter: blur(110px); opacity: .5; }
.aurora span:nth-child(1) { width: 46vw; height: 46vw; background: var(--aurora-1); top: -14vw; right: -8vw; animation: float 22s ease-in-out infinite; }
.aurora span:nth-child(2) { width: 38vw; height: 38vw; background: var(--aurora-2); bottom: -12vw; left: -6vw; animation: float 28s ease-in-out infinite reverse; }
.aurora span:nth-child(3) { width: 30vw; height: 30vw; background: var(--aurora-3); top: 45%; left: 42%; opacity: .25; animation: float 34s ease-in-out infinite; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(4vw, 5vh) scale(1.12); }
}

/* ===================== الشريط العلوي ===================== */

.topbar {
  position: sticky; top: 0; z-index: 50;
  padding-top: env(safe-area-inset-top);
  background: var(--bar);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  max-width: 1400px; margin: 0 auto; padding: 0 22px;
  height: var(--header-h);
  display: flex; align-items: center; gap: 18px;
}

.brand { display: flex; align-items: center; gap: 12px; flex: none; }

.brand__logo { height: 38px; width: auto; display: block; }
.login-card .brand__logo { height: 52px; margin: 0 auto 14px; }
.side .brand__logo { height: 30px; }

.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__text strong { font-size: 1.12rem; font-weight: 800; }
.brand__text small { color: var(--muted); font-size: .72rem; }

/* ===================== الأزرار ===================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 18px; height: 42px;
  border: 1px solid transparent; border-radius: 11px;
  background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: .9rem; cursor: pointer;
  transition: transform .15s, background .2s, border-color .2s, box-shadow .2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn--primary { background: linear-gradient(135deg, var(--brand), var(--brand-deep)); box-shadow: 0 10px 26px rgba(var(--brand-rgb),.38); color: #fff; }
.btn--primary:hover { box-shadow: 0 14px 32px rgba(var(--brand-rgb),.5); }

.btn--ghost { background: var(--surface); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--line-strong); }

.btn--danger { background: rgba(244,63,94,.14); border-color: rgba(244,63,94,.32); color: #fda4af; }
.btn--danger:hover { background: rgba(244,63,94,.24); }

.btn--lg { height: 50px; padding: 0 26px; font-size: 1rem; border-radius: 13px; }
.btn--sm { height: 34px; padding: 0 12px; font-size: .82rem; border-radius: 9px; }
.btn--block { width: 100%; }

.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface); cursor: pointer; transition: .2s; flex: none;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.icon-btn svg { width: 18px; height: 18px; }

/* ===================== الصفحة ===================== */

.page { max-width: 1400px; margin: 0 auto; padding: 30px 22px 70px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin: 30px 0 16px; }
.section-head h2 { font-size: 1.28rem; }

/* ===================== البطل (Hero) ===================== */

.hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1.4fr .9fr; align-items: center; gap: 24px;
  padding: 40px 42px;
  border: 1px solid var(--line); border-radius: 26px;
  background: linear-gradient(120deg, rgba(var(--brand-rgb),.18), transparent 55%);
  box-shadow: var(--shadow);
}
.hero__glow { position: absolute; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(var(--brand-rgb),.4), transparent 68%); top: -160px; left: -80px; pointer-events: none; }
.hero__body { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.hero__body h1 { font-size: clamp(1.7rem, 3.4vw, 2.7rem); }
.hero__body p { color: var(--muted); max-width: 52ch; }
.hero__art { position: relative; display: grid; place-items: center; }
.hero__art img {
  width: min(380px, 100%); aspect-ratio: 16 / 10; object-fit: contain;
  padding: 16px; border-radius: 26px;
  background: rgba(255,255,255,.05); border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  animation: bob 6s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(-6px); } 50% { transform: translateY(6px); } }

.hero { touch-action: pan-y; min-height: 320px; }
.hero__art { display: none !important; }
.hero__body { z-index: 2; }
.hero__bg {
  position: absolute; inset: 0; z-index: 0;
  background: center / cover no-repeat;
  transform-origin: 30% 50%;
  animation: heroZoom 14s ease-in-out infinite alternate;
  transition: opacity .45s ease;
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(to left,
      color-mix(in srgb, var(--bg) 94%, transparent) 0%,
      color-mix(in srgb, var(--bg) 72%, transparent) 42%,
      color-mix(in srgb, var(--bg) 18%, transparent) 100%),
    linear-gradient(to top, color-mix(in srgb, var(--bg) 70%, transparent), transparent 45%);
}
.hero__glow { z-index: 1; }
.hero.is-leaving .hero__bg { opacity: 0; }
@keyframes heroZoom {
  from { transform: scale(1.04) translate(0, 0); }
  to { transform: scale(1.16) translate(-3%, -2%); }
}
.hero__body { transition: opacity .45s ease, transform .45s ease; }
.hero.is-leaving .hero__body { opacity: 0; transform: translateX(28px); }
.hero.is-leaving.is-back .hero__body { transform: translateX(-28px); }

.hero__controls {
  position: absolute; inset-inline: 0; bottom: 18px; z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.hero:has(.hero__controls:not([hidden])) { padding-bottom: 70px; }
.hero__controls[hidden] { display: none; }
.hero__arrow {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: border-color .2s, background .2s;
}
.hero__arrow:hover { border-color: rgba(var(--brand-rgb),.6); background: var(--surface-2); }
.hero__arrow svg { width: 18px; height: 18px; }
.hero__dots { display: flex; align-items: center; gap: 7px; }
.hero__dot {
  width: 8px; height: 8px; padding: 0; border: 0; border-radius: 99px;
  background: var(--line-strong); cursor: pointer; transition: width .3s, background .3s;
}
.hero__dot.is-active { width: 26px; background: var(--brand); }

.hero__progress {
  position: absolute; inset-inline: 0; bottom: 0; height: 3px; z-index: 2;
  background: rgba(var(--brand-rgb),.12);
}
.hero__progress[hidden] { display: none; }
.hero__progress i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-deep));
}
.hero__progress.is-running i { animation: heroProgress var(--hero-delay, 6s) linear forwards; }
.hero.is-paused .hero__progress i { animation-play-state: paused; }
@keyframes heroProgress { from { width: 0; } to { width: 100%; } }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 13px; border-radius: 99px; font-size: .78rem; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--line);
}
.chip--live { color: #fca5a5; background: rgba(244,63,94,.12); border-color: rgba(244,63,94,.3); }
.chip--live i { width: 7px; height: 7px; border-radius: 50%; background: #f43f5e; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(244,63,94,.6); } 50% { opacity: .55; box-shadow: 0 0 0 7px rgba(244,63,94,0); } }

/* ===================== تحميل التطبيقات ===================== */

.downloads { margin-top: 28px; padding-top: 8px; }
.downloads .section-head { margin: 0 0 8px; }
.downloads .section-head h2 { font-size: .98rem; }
.downloads__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.dl-card {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; min-height: 0;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface);
  transition: border-color .2s;
}
.dl-card:hover { border-color: rgba(var(--brand-rgb),.45); }
.dl-card img, .dl-card .dl-fallback {
  width: 32px; height: 32px; flex: none; object-fit: contain;
  padding: 4px; border-radius: 9px;
  background: rgba(255,255,255,.05); border: 1px solid var(--line);
}
.dl-card .dl-fallback { display: grid; place-items: center; color: var(--brand); padding: 0; }
.dl-card .dl-fallback svg { width: 16px; height: 16px; }
.dl-card__text { flex: 1; min-width: 0; }
.dl-card__text b { display: block; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-card__text span { display: block; color: var(--muted); font-size: .68rem; margin-top: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-card .btn { flex: none; height: 28px; min-height: 28px; padding: 0 10px; font-size: .72rem; border-radius: 8px; }

.apps-editor { display: grid; gap: 16px; }
.app-edit__body { display: grid; grid-template-columns: 92px 1fr; gap: 16px; align-items: start; }
.app-icon-preview {
  width: 92px; height: 92px; display: grid; place-items: center;
  border: 1px dashed var(--line-strong); border-radius: 18px;
  background: rgba(255,255,255,.03); overflow: hidden; color: var(--brand);
}
.app-icon-preview img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.app-icon-preview svg { width: 36px; height: 36px; }
.app-edit__fields { display: grid; gap: 12px; min-width: 0; }

/* ===================== فلاتر الأقسام ===================== */

.filters {
  display: flex; gap: 10px; flex-wrap: nowrap; overflow-x: auto;
  padding: 26px 2px 6px; scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }

.filter {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 99px;
  background: var(--surface); color: var(--muted);
  font-weight: 600; font-size: .88rem; cursor: pointer; transition: .2s;
}
.filter:hover { color: var(--text); border-color: var(--line-strong); }
.filter b { font-weight: 700; font-size: .74rem; opacity: .65; }
.filter.is-active {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  box-shadow: 0 8px 22px rgba(var(--brand-rgb),.35);
}
.filter.is-active b { opacity: .85; }

/* ===================== شبكة القنوات ===================== */

.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
}

.card {
  position: relative; overflow: hidden; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
  transition: transform .24s cubic-bezier(.2,.8,.3,1), border-color .24s, box-shadow .24s;
  animation: rise .4s backwards;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.card:hover { transform: translateY(-6px); border-color: rgba(var(--brand-rgb),.55); box-shadow: 0 18px 40px rgba(0,0,0,.5); }
.card:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

.card__thumb {
  position: relative; aspect-ratio: 16 / 10;
  display: grid; place-items: center; padding: 18px;
  background: radial-gradient(circle at 50% 35%, rgba(255,255,255,.08), rgba(255,255,255,.02));
  overflow: hidden;
}
.card__thumb img { width: 100%; height: 100%; object-fit: contain; transition: transform .3s; }
.card:hover .card__thumb img { transform: scale(1.07); }

.card__fallback {
  width: 68px; height: 68px; display: grid; place-items: center;
  border-radius: 18px; font-size: 1.5rem; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.card__play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(8,11,20,.62); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .22s;
}
.card:hover .card__play, .card:focus-visible .card__play { opacity: 1; }
.card__play span {
  width: 54px; height: 54px; display: grid; place-items: center;
  border-radius: 50%; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  box-shadow: 0 10px 26px rgba(var(--brand-rgb),.55);
  transform: scale(.85); transition: transform .22s;
}
.card:hover .card__play span { transform: scale(1); }
.card__play svg { width: 24px; height: 24px; margin-inline-start: 2px; }

.card__live {
  position: absolute; top: 12px; inset-inline-start: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 99px;
  font-size: .68rem; font-weight: 800; letter-spacing: .04em;
  background: rgba(244,63,94,.9); color: #fff;
}
.card__live i { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.6s infinite; }

.card__body { padding: 13px 15px 15px; border-top: 1px solid var(--line); }
.card__body h3 { font-size: .95rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__body span { display: block; color: var(--muted); font-size: .76rem; margin-top: 2px; }

/* ===================== حالة فارغة ===================== */

.empty { text-align: center; padding: 70px 20px; display: grid; gap: 12px; justify-items: center; }
.empty__icon { font-size: 3.4rem; }
.empty p { color: var(--muted); }

/* ===================== المشغل ===================== */

.player { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 22px; }
.player__backdrop { position: absolute; inset: 0; background: rgba(4,6,12,.82); backdrop-filter: blur(10px); animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }

.player__box {
  position: relative; width: min(1120px, 100%); max-height: calc(100dvh - 44px);
  overflow: auto; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line-strong); border-radius: 22px;
  box-shadow: var(--shadow);
  animation: pop .3s cubic-bezier(.2,.9,.3,1);
}
@keyframes pop { from { opacity: 0; transform: translateY(20px) scale(.97); } }

.player__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; }
.player__id { display: flex; align-items: center; gap: 13px; min-width: 0; }
.player__id img {
  width: 48px; height: 48px; object-fit: contain; flex: none;
  padding: 7px; border-radius: 13px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.player__id h3 { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.video-shell { position: relative; background: #000; aspect-ratio: 16 / 9; min-height: 180px; }
.player__box:fullscreen,
.player__box:-webkit-full-screen {
  width: 100%; height: 100%; max-height: 100%; overflow: hidden;
  border-radius: 0; border: 0;
  display: flex; flex-direction: column;
}
.player__box:fullscreen .player__bar,
.player__box:-webkit-full-screen .player__bar { flex: none; }
.player__box:fullscreen .video-shell,
.player__box:-webkit-full-screen .video-shell {
  flex: 1; aspect-ratio: auto; min-height: 0;
}
.player__box:fullscreen .player__related,
.player__box:-webkit-full-screen .player__related { display: none; }
.video-shell video { width: 100%; height: 100%; display: block; background: #000; object-fit: contain; }
.video-shell iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }

.video-tap {
  position: absolute; inset: 0; z-index: 3; border: 0; cursor: pointer;
  display: grid; place-content: center; justify-items: center; gap: 10px;
  background: rgba(0,0,0,.55); color: #fff; font-weight: 700;
}
.video-tap span {
  width: 74px; height: 74px; display: grid; place-items: center; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  box-shadow: 0 12px 30px rgba(var(--brand-rgb),.4);
}
.video-tap svg { width: 30px; height: 30px; margin-inline-start: 3px; }

.video-state {
  position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: 14px;
  background: rgba(0,0,0,.7); color: var(--muted); text-align: center; padding: 20px;
  pointer-events: none;
}
.video-state--error { color: #fda4af; pointer-events: auto; z-index: 4; }
.video-state__icon { font-size: 2.4rem; }

.spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.14); border-top-color: var(--brand);
  animation: spin .85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.player__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.player__quality { display: flex; align-items: center; gap: 10px; }
.player__quality label { color: var(--muted); font-size: .85rem; }
.player__quality select {
  height: 38px; padding: 0 12px; min-width: 130px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; outline: 0; cursor: pointer;
}
.player__quality select option { background: var(--panel); }
.player__actions { display: flex; gap: 10px; }

.player__related { padding: 16px 18px 20px; }
.player__related h4 { font-size: .95rem; margin-bottom: 12px; }

.rail { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.rail__item {
  flex: none; width: 116px; cursor: pointer; text-align: center;
  border: 1px solid var(--line); border-radius: 14px; padding: 10px;
  background: var(--surface); transition: .2s;
}
.rail__item:hover { border-color: rgba(var(--brand-rgb),.5); background: var(--surface-2); transform: translateY(-3px); }
.rail__item img, .rail__item .card__fallback { width: 100%; height: 56px; object-fit: contain; margin-bottom: 8px; border-radius: 10px; font-size: 1.1rem; }
.rail__item b { display: block; font-size: .76rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===================== التنبيهات ===================== */

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 200; padding: 13px 22px;
  background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: 13px; box-shadow: var(--shadow);
  font-weight: 600; font-size: .9rem;
  animation: toastIn .28s cubic-bezier(.2,.9,.3,1);
}
.toast.is-error { border-color: rgba(244,63,94,.5); color: #e11d48; }
.toast.is-success { border-color: rgba(34,197,94,.45); color: #15803d; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px); } }

/* ===================== التذييل ===================== */

.footer { border-top: 1px solid var(--line); padding: 26px 22px calc(26px + env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: .84rem; }

.topbar__matches { height: 40px; padding: 0 14px; margin-inline-start: auto; }
.matches-note { margin: 8px 0 0; color: var(--muted); font-size: .8rem; }
.league-picker { display: grid; gap: 7px; max-width: 420px; margin: 16px 0 18px; }
.league-picker label { font-size: .85rem; font-weight: 700; color: var(--label); }
.league-menu { position: relative; }
.league-menu__btn {
  width: 100%; height: 48px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 16px;
  cursor: pointer; box-shadow: var(--shadow);
}
.league-menu__chevron { width: 18px; height: 18px; color: var(--brand); transition: transform .2s; }
.league-menu.is-open .league-menu__btn {
  border-color: rgba(var(--brand-rgb), .55);
  box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .14);
}
.league-menu.is-open .league-menu__chevron { transform: rotate(180deg); }
.league-menu__list {
  position: absolute; z-index: 30; inset-inline: 0; top: calc(100% + 8px);
  margin: 0; padding: 6px; list-style: none;
  max-height: 320px; overflow: auto;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 16px;
  box-shadow: var(--shadow);
}
.league-menu__list::-webkit-scrollbar-thumb { background: rgba(var(--brand-rgb), .45); border-color: var(--panel); }
.league-menu__option {
  width: 100%; text-align: start;
  background: transparent; color: var(--text);
  border: 0; border-radius: 12px;
  padding: 10px 12px; cursor: pointer; font-weight: 700;
}
.league-menu__option:hover { background: var(--surface-2); }
.league-menu__option.is-active {
  background: rgba(var(--brand-rgb), .16);
  color: var(--brand-deep);
}
.fixture-list { display: grid; gap: 12px; }
.fixture {
  display: grid; gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface);
}
.fixture__league { font-size: .82rem; font-weight: 800; color: var(--brand-deep); }
.fixture__label { font-size: .72rem; color: var(--muted); margin-bottom: 6px; }
.fixture__row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.fixture__team { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; font-size: .92rem; }
.fixture__team--away { flex-direction: row-reverse; text-align: end; }
.fixture__team img { width: 32px; height: 32px; object-fit: contain; flex: none; }
.fixture__team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fixture__meta { text-align: center; min-width: 88px; }
.fixture__meta b { display: block; font-size: 1rem; }
.fixture__meta small { display: block; color: var(--muted); font-size: .75rem; }
.fixture__empty { color: var(--muted); font-size: .86rem; }

/* ===================== لوحة التحكم ===================== */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(400px, 100%); padding: 38px 32px;
  background: var(--bar); backdrop-filter: blur(20px);
  border: 1px solid var(--line-strong); border-radius: 22px; box-shadow: var(--shadow);
  text-align: center;
}
.login-card h1 { font-size: 1.4rem; margin-bottom: 6px; }
.login-card p { color: var(--muted); font-size: .88rem; margin-bottom: 24px; }
.login-card form { display: grid; gap: 12px; text-align: start; }

.admin-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }

.side {
  border-inline-end: 1px solid var(--line);
  background: var(--bar); backdrop-filter: blur(16px);
  padding: 20px 16px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.side .brand { margin-bottom: 20px; padding: 0 6px; }

.side__link {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px; border-radius: 12px;
  color: var(--muted); font-weight: 600; font-size: .92rem;
  cursor: pointer; border: 1px solid transparent; transition: .18s;
}
.side__link:hover { background: var(--surface); color: var(--text); }
.side__link.is-active { background: linear-gradient(135deg, rgba(var(--brand-rgb),.22), rgba(var(--brand-rgb),.06)); color: #fff; border-color: rgba(var(--brand-rgb),.35); }
.side__spacer { flex: 1; }

.admin-main { padding: 26px 30px 60px; max-width: 1200px; }

.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.admin-head h1 { font-size: 1.45rem; }
.admin-head p { color: var(--muted); font-size: .88rem; }

.panel { display: none; animation: rise .3s; }
.panel.is-active { display: block; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat b { display: block; font-size: 1.85rem; font-weight: 800; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .84rem; }
.viewers-count { font-variant-numeric: tabular-nums; color: var(--brand-deep); }

.card-box { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.card-box + .card-box { margin-top: 20px; }
.card-box__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-box__head h3 { font-size: 1.02rem; }
.card-box__body { padding: 20px; }

.field { display: grid; gap: 7px; }
.field > label { font-size: .85rem; font-weight: 600; color: var(--label); }
.field small { color: var(--muted); font-size: .76rem; }

.input, .select, .textarea {
  width: 100%; padding: 0 14px; height: 44px;
  background: var(--field); border: 1px solid var(--line);
  border-radius: 11px; outline: 0; transition: .2s;
}
.textarea { height: auto; min-height: 92px; padding: 12px 14px; resize: vertical; font-family: inherit; }
.input:focus, .select:focus, .textarea:focus { border-color: rgba(var(--brand-rgb),.6); background: rgba(255,255,255,.06); box-shadow: 0 0 0 4px rgba(var(--brand-rgb),.12); }
.input::placeholder, .textarea::placeholder { color: #5f6b85; }
.select option { background: var(--panel); }
.input[dir="ltr"] { text-align: left; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }

.switch { display: flex; align-items: center; gap: 11px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch__track { width: 44px; height: 25px; border-radius: 99px; background: rgba(255,255,255,.14); position: relative; transition: .22s; flex: none; }
.switch__track::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: .22s; }
.switch input:checked + .switch__track { background: linear-gradient(135deg, var(--brand), var(--brand-deep)); }

.pass-field { position: relative; }
.pass-field .input { padding-inline-end: 78px; }
.pass-toggle {
  position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%);
  height: 30px; padding: 0 10px; border: 0; border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,.08); color: var(--muted); font-size: .78rem; font-weight: 700;
}
.pass-toggle:hover { color: var(--text); }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.theme-swatch {
  display: grid; gap: 8px; justify-items: center;
  padding: 10px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.theme-swatch b { font-size: .82rem; font-weight: 700; }
.theme-swatch i { width: 100%; height: 34px; border-radius: 10px; display: block; }
.theme-swatch.is-active { border-color: rgba(var(--brand-rgb),.8); box-shadow: 0 0 0 3px rgba(var(--brand-rgb),.18); }

.encrypt-note {
  margin: 0 0 18px; padding: 12px 14px; border-radius: 12px;
  background: rgba(var(--brand-rgb),.08); border: 1px solid rgba(var(--brand-rgb),.22);
  color: #c9f6ff; font-size: .88rem;
}
.switch input:checked + .switch__track::after { transform: translateX(-19px); }
.switch__text { font-size: .88rem; }
.switch__text small { display: block; color: var(--muted); font-size: .74rem; }

.logo-picker { display: flex; align-items: center; gap: 14px; }
.logo-preview {
  width: 76px; height: 76px; flex: none; display: grid; place-items: center;
  border: 1px dashed var(--line-strong); border-radius: 15px;
  background: rgba(255,255,255,.03); overflow: hidden; color: var(--muted); font-size: 1.5rem;
}
.logo-preview img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.logo-picker__fields { flex: 1; display: grid; gap: 9px; min-width: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .89rem; }
thead th { text-align: start; padding: 12px 16px; color: var(--muted); font-weight: 600; font-size: .8rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody td { padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.05); vertical-align: middle; }
tbody tr { transition: background .18s; }
tbody tr:hover { background: rgba(255,255,255,.03); }
tbody tr:last-child td { border-bottom: 0; }

.cell-channel { display: flex; align-items: center; gap: 11px; min-width: 190px; }
.cell-channel img, .cell-channel .ph {
  width: 42px; height: 42px; flex: none; object-fit: contain;
  border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); padding: 5px;
}
.cell-channel .ph { display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); border: 0; }
.cell-channel b { font-weight: 700; }
.cell-url { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .8rem; direction: ltr; text-align: left; }
.cell-actions { display: flex; gap: 7px; justify-content: flex-end; }

.tag { display: inline-block; padding: 3px 11px; border-radius: 99px; font-size: .76rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); color: #c3cbe2; }
.tag--muted { color: var(--muted); }

.cat-list { display: flex; flex-wrap: wrap; gap: 10px; }
.cat-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px 8px 14px; border-radius: 13px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.cat-item b { font-weight: 600; font-size: .9rem; }
.cat-item span { color: var(--muted); font-size: .76rem; }
.cat-item .icon-btn { width: 30px; height: 30px; border-radius: 9px; }
.cat-item .icon-btn svg { width: 14px; height: 14px; }

.row-inline { display: flex; gap: 10px; flex-wrap: wrap; }
.row-inline .input { flex: 1; min-width: 190px; }

/* نافذة منبثقة */
.modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 22px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(4,6,12,.8); backdrop-filter: blur(8px); }
.modal__box {
  position: relative; width: min(760px, 100%); max-height: calc(100dvh - 44px); overflow: auto;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line-strong); border-radius: 20px; box-shadow: var(--shadow);
  animation: pop .28s cubic-bezier(.2,.9,.3,1);
}
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.modal__head h3 { font-size: 1.08rem; }
.modal__body { padding: 22px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel-2); }
.modal--sm .modal__box { width: min(440px, 100%); }
.modal__body > p { color: var(--muted); }

/* ===================== الاستجابة ===================== */

@media (hover: none) {
  .card:active { transform: scale(.985); }
  .btn, .icon-btn, .filter { min-height: 44px; }
}

@media (max-width: 1024px) {
  .downloads__grid { grid-template-columns: 1fr; }
  .dl-card { padding: 8px 12px; }
  .hero { grid-template-columns: 1fr; padding: 32px 26px 70px; }
  .hero { min-height: 0; align-content: end; padding-top: calc(min(60vw, 340px) - 24px); }
  .hero__bg {
    bottom: auto; height: min(60vw, 340px);
    -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
    mask-image: linear-gradient(to bottom, #000 55%, transparent);
  }
  .hero::after {
    background: linear-gradient(to top,
      color-mix(in srgb, var(--bg) 92%, transparent) 0%,
      color-mix(in srgb, var(--bg) 70%, transparent) 40%,
      transparent 62%);
  }
  .admin-shell { grid-template-columns: 1fr; }
  .side {
    position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto;
    border-inline-end: 0; border-bottom: 1px solid var(--line); padding: 12px;
    -webkit-overflow-scrolling: touch;
  }
  .side .brand { margin: 0 8px 0 0; }
  .side__link { white-space: nowrap; padding: 9px 13px; }
  .side__spacer { display: none; }
  .admin-main { padding: 20px 16px 50px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .player { padding: 0; align-items: stretch; }
  .player__box {
    width: 100%; height: 100dvh; max-height: 100dvh;
    border-radius: 0; border: 0; overflow: hidden;
  }
  .player__head { padding-top: max(12px, env(safe-area-inset-top)); }
  .video-shell { flex: 1 1 auto; aspect-ratio: auto; min-height: 0; }
  .player__bar { padding-bottom: 10px; }
  .player__actions { flex: 1; }
  .player__actions .btn { flex: 1; }
  .player__related { max-height: 30dvh; overflow: auto; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .modal { padding: 0; align-items: stretch; }
  .modal__box { width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
}

@media (max-width: 900px) and (orientation: landscape) {
  .player__related { display: none; }
  .player__head, .player__bar { padding-block: 8px; }
}

@media (max-width: 720px) {
  .topbar__inner { padding: 0 14px; gap: 10px; }
  .brand__logo { height: 30px; }
  .brand__text { display: none; }
  .side .brand__text { display: flex; }
  .topbar__admin span { display: none; }
  .topbar__admin { padding: 0 12px; }
  .topbar__matches { padding: 0 10px; font-size: .8rem; }
  .fixture__team { font-size: .8rem; gap: 6px; }
  .fixture__team img { width: 26px; height: 26px; }
  .page { padding: 18px 12px 48px; }
  .hero { padding: 22px 16px 62px; gap: 14px; }
  .hero .btn--lg { width: 100%; }
  .hero__body p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .hero { min-height: 0; padding-top: calc(60vw - 20px); }
  .hero__arrow { width: 32px; height: 32px; }
  .app-edit__body { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card__body { padding: 10px 12px 12px; }
  .card__body h3 { font-size: .86rem; }
  .section-head { margin: 18px 0 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .input, .select, .textarea { font-size: 16px; }
  .admin-head .btn { width: 100%; }
  .row-inline .input, .row-inline .select { width: 100% !important; }
  .cell-url { max-width: 140px; }
  .login-card { padding: 28px 18px; }
}

@media (max-width: 380px) {
  .filters { gap: 8px; }
  .filter { padding: 0 12px; }
  .player__quality label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
