/* إعدادات عامة */
:root {
  --bg: #2a0a0a; /* deep red base */
  --text: #f8f9fa; /* near-white */
  --muted: #f4d4d4; /* soft muted */
  --primary: #e53935; /* red-600 */
  --primary-700: #c62828; /* red-700 */
  --card: #210e10; /* dark red card */
  --border: #3a1414; /* dark red border */
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Noto Naskh Arabic, Noto Sans Arabic, Arial, sans-serif;
  background: linear-gradient(135deg, #2a0a0a 0%, #7a0b0b 50%, #e53935 100%);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden; /* منع التمدد الأفقي الناتج عن التحويلات */
}

.container {
  width: min(100%, 980px);
  margin-inline: auto;
  padding: 1rem;
}

/* ترويسة الموقع */
.site-header {
  position: sticky;
  top: 0;
  backdrop-filter: blur(6px);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.brand-name {
  font-weight: 700;
  letter-spacing: 0.5px;
}
.brand-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
  border-radius: 0.25rem;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  margin-inline-start: 1rem;
}
.nav a:hover { color: var(--text); }
.icon-actions { display:flex; align-items:center; gap: 0.5rem; }
.icon-actions .icon-btn {
  display:inline-flex; align-items:center; justify-content:center;
  width:40px; height:40px; border-radius:0.5rem; padding:4px;
  border:1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 90%, var(--card));
}
.icon-actions .icon-btn:hover { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent) inset; }
.icon-actions .icon-btn img { max-width:100%; max-height:100%; object-fit: contain; }

/* البطل */
.hero {
  position: relative;
  overflow: hidden;
  padding: 5rem 0 3rem;
  text-align: center;
}
.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.55) 70%);
  z-index: 1;
}
.hero .container { position: relative; z-index: 2; }
.lead {
  color: var(--muted);
  max-width: 58ch;
  margin: 0.5rem auto 1.25rem;
}
.actions { margin-top: 1rem; }

.btn {
  display: inline-block;
  padding: 0.9rem 1.25rem;
  border-radius: 0.75rem;
  text-decoration: none;
  border: 1px solid var(--border);
}
.btn-primary {
  background: var(--primary);
  color: #04120a;
  font-weight: 700;
}
.btn-primary:hover { background: var(--primary-700); color: #fff; }
.hint { color: var(--muted); font-size: 0.95rem; }
.hint a { color: var(--text); }

/* أقسام المحتوى */
section.about, section.support {
  padding: 2rem 0;
}
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem 1rem;
  margin: 1rem 0 0;
}
.features li {
  list-style: "✔ ";
  background: var(--card);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
}

/* تذييل */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}
.site-footer .container {
  text-align: center;
  padding: 1.25rem 1rem;
  color: var(--muted);
}

/* فيديو التحميل */
.download-video {
  margin-top: 1.5rem;
  text-align: center;
}
.download-video h3 {
  margin: 0 0 0.5rem;
  color: var(--text);
  font-weight: 600;
}
.promo-video {
  width: min(100%, 860px);
  height: auto;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--bg) 40%, transparent);
}

/* روابط سريعة (ديسكورد/السلة) */
.quick-links {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--bg) 50%, #e53935 15%);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.icon-btn:hover {
  background: color-mix(in srgb, var(--bg) 35%, #e53935 25%);
}
.icon-btn img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 0.25rem;
  background: transparent;
}

/* شعار في الترويسة */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.brand-logo {
  height: 36px;
  width: auto;
}
/* دخلة الموقع */
.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.7) 60%, rgba(0,0,0,0.4) 100%);
  transition: opacity 450ms ease;
}
.intro-overlay.hidden { opacity: 0; pointer-events: none; }
.intro-content { text-align: center; }
.intro-logo { width: clamp(160px, 26vw, 320px); height: auto; margin-bottom: 0.75rem; }
.intro-title { margin: 0; color: var(--text); font-size: clamp(24px, 4vw, 42px); letter-spacing: 0.04em; }
.caret { display: inline-block; width: 1ch; border-right: 2px solid var(--text); vertical-align: text-bottom; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { border-color: transparent; } }

/* الصفحة الترحيبية */
.welcome {
  position: relative;
  padding: 2rem 0 260px;
  background: #0b0b0b; /* base dark */
  overflow: hidden; /* قص أي عناصر متحولة تتجاوز العرض */
}
.welcome::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 6px;
  background: #e53935;
  box-shadow: 0 0 0 2px #e53935 inset, 0 2px 0 #c62828;
}
.welcome .grid-bg {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.9;
  will-change: transform, background-position;
  transform: perspective(900px) rotateX(18deg) scale(1.06);
  transform-origin: top center;
  animation: gridDrift 30s linear infinite, tiltBreath 14s ease-in-out infinite alternate;
}

@keyframes gridDrift {
  0% { background-position: 0 0, 0 0; }
  100% { background-position: -240px 0, 0 -240px; }
}

@keyframes tiltBreath {
  0% { transform: perspective(900px) rotateX(17deg) scale(1.04); }
  100% { transform: perspective(900px) rotateX(22deg) scale(1.08); }
}

.welcome::after {
  content: "";
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.6) 70%);
  z-index: 0;
}
.welcome .titles { position: relative; z-index: 2; text-align: center; padding: 4rem 1rem 5rem; }
.welcome-ar, .welcome-en {
  text-shadow: 0 6px 18px rgba(0,0,0,0.55), 0 2px 0 rgba(0,0,0,0.35);
}

/* زخارف حمراء */
.red-decor { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.shard {
  position: absolute; width: 42px; height: 42px;
  background: linear-gradient(145deg, #b71c1c, #ff4d4d);
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.45));
  opacity: 0.96;
  animation: shardFloat var(--dur, 12s) ease-in-out infinite;
}
/* مواقع القطع */
.red-decor .s1 { top: 20%; left: 14%; transform: rotate(-16deg); --dur: 13s; }
.red-decor .s2 { top: 12%; right: 18%; transform: rotate(24deg); --dur: 15s; }
.red-decor .s3 { top: 58%; left: 22%; transform: rotate(-10deg); --dur: 11s; }
.red-decor .s4 { top: 66%; right: 9%; transform: rotate(32deg); --dur: 12s; }
.red-decor .s5 { top: 38%; right: 40%; transform: rotate(-6deg); --dur: 17s; }

@keyframes shardFloat {
  0%   { transform: translateY(0) rotate(var(--rot, 0deg)); }
  50%  { transform: translateY(-10px) rotate(calc(var(--rot, 0deg) + 4deg)); }
  100% { transform: translateY(0) rotate(var(--rot, 0deg)); }
}
.welcome-ar {
  margin: 0.25rem 0; color: #e5e5e5; font-weight: 800;
  font-size: clamp(40px, 9vw, 120px);
  letter-spacing: 1px;
}
.welcome-en {
  margin: 0; color: #e5e5e5; font-weight: 800;
  font-size: clamp(36px, 7vw, 96px);
  letter-spacing: 2px;
}
.welcome .caret { border-color: var(--primary); }
.welcome-wave {
  position: absolute; left: 0; right: 0; bottom: -2px;
  width: 100%; height: 260px; z-index: 0;
}
.welcome .tri {
  position: absolute; width: 36px; height: 36px; opacity: 0.92;
  background: linear-gradient(145deg, #8b0b0b, #e53935);
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.5));
}
.welcome .tri.t1 { top: 58%; left: 22%; transform: rotate(-12deg); }
.welcome .tri.t2 { top: 20%; right: 14%; transform: rotate(18deg); }
.welcome .tri.t3 { top: 68%; right: 8%; transform: rotate(32deg); }

/* تحسين وصول للأزرار/الروابط */
.btn:focus-visible, .icon-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 60%, #fff); outline-offset: 2px; }

.actions { margin-top: 1rem; }

.btn {
  display: inline-block;
  padding: 0.9rem 1.25rem;
  border-radius: 0.75rem;
  text-decoration: none;
  border: 1px solid var(--border);
}
.btn-primary {
  background: var(--primary);
  color: #04120a;
  font-weight: 700;
}
.btn-primary:hover { background: var(--primary-700); color: #fff; }
.hint { color: var(--muted); font-size: 0.95rem; }
.hint a { color: var(--text); }

/* أقسام المحتوى */
section.about, section.support {
  padding: 2rem 0;
}
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem 1rem;
  margin: 1rem 0 0;
}
.features li {
  list-style: "✔ ";
  background: var(--card);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
}

/* تذييل */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}
.site-footer .container {
  text-align: center;
  padding: 1.25rem 1rem;
  color: var(--muted);
}

/* فيديو التحميل */
.download-video {
  margin-top: 1.5rem;
  text-align: center;
}
.download-video h3 {
  margin: 0 0 0.5rem;
  color: var(--text);
  font-weight: 600;
}
.promo-video {
  width: min(100%, 860px);
  height: auto;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--bg) 40%, transparent);
}

/* روابط سريعة (ديسكورد/السلة) */
.quick-links {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--bg) 50%, #e53935 15%);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.icon-btn:hover {
  background: color-mix(in srgb, var(--bg) 35%, #e53935 25%);
}
.icon-btn img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 0.25rem;
  background: transparent;
}

/* صفحة دخول ديسكورد */
.join-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: radial-gradient(circle at 30% 20%, rgba(229,57,53,0.18) 0%, rgba(0,0,0,0.82) 45%),
              linear-gradient(135deg, rgba(15,15,18,0.9) 0%, rgba(15,15,18,0.8) 100%);
  transition: opacity 420ms ease;
}
.join-overlay.hidden { opacity: 0; pointer-events: none; }
.join-decor {
  position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(to right, rgba(255,255,255,0.06) 1px, transparent 1px),
                    linear-gradient(to bottom, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.12;
}
.join-card {
  position: relative; z-index: 1;
  width: min(92vw, 640px);
  padding: 1.75rem 1.5rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 80%, var(--card));
  backdrop-filter: blur(10px);
  text-align: center;
  box-shadow: 0 12px 36px rgba(0,0,0,0.4), 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent) inset;
  animation: pop 420ms cubic-bezier(.18,.7,.25,1) both;
}
.join-logo {
  width: 84px; height: 84px; border-radius: 0.75rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
  margin-bottom: 0.5rem;
}
#join-title { margin: 0.25rem 0 0.25rem; font-size: clamp(26px, 4.4vw, 36px); font-weight: 800; letter-spacing: 0.4px; }
.join-sub { margin: 0 0 1rem; color: var(--muted); }
.join-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.join-actions .btn { min-width: 220px; }
.join-actions .btn-primary { background: linear-gradient(180deg, var(--primary) 0%, var(--primary-700) 100%); color: #fff; }
.join-actions .btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.join-actions .btn { background: color-mix(in srgb, var(--bg) 40%, var(--card)); color: var(--text); }
.join-actions .btn:hover { background: color-mix(in srgb, var(--bg) 35%, var(--card)); }

@keyframes pop { 0% { transform: translateY(8px) scale(.98); opacity: 0; } 100% { transform: translateY(0) scale(1); opacity: 1; } }
.wave-canvas {
  position: absolute;
  inset: 0;
  z-index: 1; /* فوق الشبكة وتحت العناوين */
  pointer-events: none;
  opacity: 0.8;
  filter: drop-shadow(0 8px 20px rgba(229,57,53,0.25));
}
/* لوحة اختيار القوائم (أعلى اليمين) */
.floating-panel { position: fixed; top: 0.75rem; right: 0.75rem; z-index: 1050; }
.fp-toggle { display:flex; align-items:center; justify-content:center; gap:6px; width:42px; height:42px; border-radius: 0.6rem; border:1px solid var(--border); background: rgba(0,0,0,0.75); color:#fff; box-shadow: 0 8px 20px rgba(0,0,0,.35), 0 0 0 2px color-mix(in srgb, #e53935 35%, transparent) inset; }
.fp-toggle .icon { width:18px; height:18px; fill: currentColor; opacity:.9; }
.fp-toggle:hover { background: linear-gradient(180deg, #e53935, #b71c1c); color: #fff; }
.fp-panel { position:absolute; top:52px; right:0; width: 290px; max-height: 62vh; overflow:auto; background: color-mix(in srgb, var(--bg) 85%, var(--card)); border:1px solid var(--border); border-radius: 0.8rem; box-shadow: 0 14px 40px rgba(0,0,0,.5); backdrop-filter: blur(8px); padding: 0.75rem; animation: pop 260ms ease both; }
.fp-header { display:flex; align-items:center; gap:0.5rem; }
.fp-header input { flex:1; padding: 0.5rem 0.6rem; border:1px solid var(--border); border-radius: 0.5rem; background: var(--bg); color: var(--text); }
.fp-close { background: transparent; border: 0; color: var(--text); font-size: 1.25rem; line-height: 1; padding:0.25rem 0.5rem; border-radius: 0.5rem; }
.fp-close:hover { background: color-mix(in srgb, var(--bg) 30%, var(--card)); }
.fp-list { display: grid; gap: 0.45rem; margin-top: 0.5rem; }
.fp-link { display:block; text-align:right; padding: 0.55rem 0.6rem; border-radius: 0.6rem; background: color-mix(in srgb, var(--bg) 60%, #e53935 12%); color: var(--text); border:1px solid var(--border); cursor:pointer; }
.fp-link:hover { background: color-mix(in srgb, var(--bg) 55%, #e53935 16%); }
.fp-actions { display:none; }
@media (max-width: 520px) { .fp-panel { right: -0.25rem; width: min(92vw, 300px); } }
.join-actions .btn { min-width: 220px; }
.join-actions .btn-primary { background: linear-gradient(180deg, var(--primary) 0%, var(--primary-700) 100%); color: #fff; }
.join-actions .btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.join-actions .btn { background: color-mix(in srgb, var(--bg) 40%, var(--card)); color: var(--text); }
.join-actions .btn:hover { background: color-mix(in srgb, var(--bg) 35%, var(--card)); }

@keyframes pop { 0% { transform: translateY(8px) scale(.98); opacity: 0; } 100% { transform: translateY(0) scale(1); opacity: 1; } }
.wave-canvas {
  position: absolute;
  inset: 0;
  z-index: 1; /* فوق الشبكة وتحت العناوين */
  pointer-events: none;
  opacity: 0.8;
  filter: drop-shadow(0 8px 20px rgba(229,57,53,0.25));
}
/* Maintenance mode styles */
body[data-maintenance="true"] .page-wrap {
  display: none !important;
}
body[data-maintenance="true"] header,
body[data-maintenance="true"] main,
body[data-maintenance="true"] footer,
body[data-maintenance="true"] .floating-panel {
  display: none !important;
}

/* تعطيل الرسائل القديمة عبر ::before/::after عند تفعيل الصيانة */
body[data-maintenance="true"]::before,
body[data-maintenance="true"]::after {
  content: none !important;
}

/* طبقة الصيانة مع زر ديسكورد */
body[data-maintenance="true"] .maintenance-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
body[data-maintenance="true"] .maintenance-box {
  background: rgba(42, 16, 18, 0.95);
  color: #fff;
  padding: 20px 24px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  text-align: center;
  max-width: 520px;
}
body[data-maintenance="true"] .maintenance-box h2 {
  margin: 0 0 0.5rem;
  font-size: 22px;
}
body[data-maintenance="true"] .maintenance-box p {
  margin: 0 0 0.75rem;
  color: #ddd;
}

/* زر مميز مع تأثير هوفر لمولتي Ai */
.btn-accent {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-700) 100%);
  color: #fff;
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 28%, transparent);
  transition: transform 180ms ease, box-shadow 220ms ease, filter 180ms ease;
}
.btn-accent:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--primary) 40%, transparent);
}
.btn-accent:active {
  transform: translateY(0);
  filter: brightness(0.98);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 26%, transparent);
}
.btn-accent:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 60%, #fff);
  outline-offset: 2px;
}

/* تأثير عام لجميع الأزرار */
.btn {
  transition: transform 180ms ease, box-shadow 220ms ease, filter 180ms ease, background-color 180ms ease, color 180ms ease;
}
.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 8px 22px rgba(0,0,0,0.35);
}
.btn:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

/* تعزيز تأثير زر primary */
.btn-primary:hover {
  box-shadow: 0 10px 28px color-mix(in srgb, var(--primary) 40%, transparent);
  filter: brightness(1.06);
}

/* تأثير للأزرار الأيقونية والروابط السريعة */
.icon-btn {
  transition: transform 180ms ease, box-shadow 220ms ease, filter 180ms ease;
}
.icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.35);
}

/* تأثير لأزرار قائمة التنقّل العائمة */
.fp-link {
  transition: transform 180ms ease, box-shadow 220ms ease, filter 180ms ease;
}
.fp-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.30);
}
.fp-link:active {
  transform: translateY(0);
}