:root {
  --bg: #09090B;
  --bg-2: #111114;
  --card: #131317;
  --ink: #F5F1E8;
  --muted: #8E8A82;
  --line: #24242A;
  --accent: #F59E0B;
  --accent-2: #FB7185;
  --ok: #34D399;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Rubik", system-ui, sans-serif;
  line-height: 1.8;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: #000; }
.mono { font-family: var(--mono); }
.dim { opacity: .4; }

/* ================= الواجهة الأولى ================= */
.hero {
  position: relative;
  min-height: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
}

.hero-grid {
  position: absolute; inset: 0; z-index: -2;
  background-image:
    linear-gradient(to right, rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 45%, #000 20%, transparent 70%);
          mask-image: radial-gradient(ellipse at 50% 45%, #000 20%, transparent 70%);
  animation: grid-move 20s linear infinite;
}
@keyframes grid-move { to { background-position: 64px 64px; } }

/* بقعة ضوء تتبع الماوس */
.hero-glow {
  position: absolute; z-index: -1;
  width: 620px; height: 620px;
  left: var(--mx, 50%); top: var(--my, 45%);
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(245,158,11,.22), rgba(251,113,133,.08) 40%, transparent 68%);
  pointer-events: none;
  transition: left .25s ease-out, top .25s ease-out;
}

.nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px clamp(20px, 5vw, 56px);
}
/* الشعار المصغّر في الزاوية العليا */
.nav-mark { display: block; line-height: 0; text-decoration: none; transition: transform .2s; }
.nav-mark svg { height: 33px; width: auto; overflow: visible; direction: ltr; }
.nav-mark .logo-en { animation: none; }
.nav-mark:hover { transform: scale(1.06); }
.nav-link {
  color: var(--ink); text-decoration: none; font-weight: 500;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 18px; display: flex; gap: 10px; align-items: center;
  background: rgba(255,255,255,.02); backdrop-filter: blur(6px);
  transition: border-color .2s;
}
.nav-link:hover { border-color: var(--accent); }
.nav-count { font-family: var(--mono); font-size: .75rem; color: var(--accent); }

.hero-inner {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  text-align: center;
  padding: 0 20px 24px;
}

.logo {
  width: min(880px, 94vw);
  height: auto;
  overflow: visible;
  direction: ltr;
}
.logo-en {
  font-family: "Bungee", Impact, sans-serif;
  font-size: 66px;
  letter-spacing: 1px;
  fill: var(--ink);
  animation: rise 1.1s cubic-bezier(.2,.8,.2,1) both;
}
.logo-ar { font-family: "Reem Kufi Fun", sans-serif; font-weight: 700; font-size: 62px; }
/* حدّ بلون الخلفية يفصل «دماحا» عن الحروف التي تتكئ عليها */
.logo-ar-fill { fill: var(--accent); stroke: var(--bg); stroke-width: 7px; stroke-linejoin: round; paint-order: stroke; }
.anim-ar {
  transform-box: fill-box; transform-origin: center;
  animation: drop 1s cubic-bezier(.3,1.5,.5,1) .55s both;
}
@keyframes rise { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
@keyframes drop { from { opacity: 0; transform: translateY(-40px) scale(1.5) rotate(-6deg); } to { opacity: 1; transform: none; } }

.hero-line {
  margin-top: clamp(16px, 3vw, 32px);
  font-size: clamp(1.6rem, 4.2vw, 2.8rem);
  font-weight: 700;
  line-height: 1.4;
  animation: rise .9s ease 1s both;
}
.rotator {
  display: inline-block;
  color: transparent;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  min-width: 4ch;
  transition: opacity .3s, transform .3s;
}
.rotator.out { opacity: 0; transform: translateY(-12px); }

.hero-sub {
  margin-top: 12px;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  max-width: 560px;
  animation: rise .9s ease 1.15s both;
}
.hero-sub .mono { color: var(--ink); }

.cta {
  margin-top: 40px;
  display: inline-flex; align-items: center; gap: 12px;
  padding: 14px 28px;
  background: var(--ink); color: #0A0A0A;
  border-radius: 999px;
  font-weight: 600; text-decoration: none;
  animation: rise .9s ease 1.3s both;
  transition: transform .2s, box-shadow .2s;
}
.cta:hover { transform: translateY(-2px); box-shadow: 0 10px 40px -10px rgba(245,158,11,.6); }
.cta-arrow { display: inline-block; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(4px); } }

/* ================= التطبيقات ================= */
.apps-section {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}
.section-head { text-align: center; margin-bottom: 40px; }
.eyebrow { color: var(--accent); font-size: .85rem; }
.section-head h2 {
  font-family: "Reem Kufi Fun", sans-serif;
  font-size: clamp(2.6rem, 6.5vw, 4.4rem);
  line-height: 1.2; font-weight: 700;
  margin: 6px 0 8px;
}
.dots-title { position: relative; }
/* خط Reem Kufi Fun ملوّن: القلوب حمراء من داخل الخط، فنغيّر ألوانه هنا إلى لون «دماحا» */
@font-palette-values --domaha-hearts {
  font-family: "Reem Kufi Fun";
  override-colors: 0 #F59E0B, 1 #F59E0B, 2 #F59E0B, 3 #F59E0B, 4 #F59E0B, 5 #F59E0B;
}
.dt-base { color: var(--accent); font-palette: --domaha-hearts; }
.dt-top { position: absolute; inset: 0; color: var(--ink); pointer-events: none; }
.section-head p { color: var(--muted); }

/* شجرة النطاقات */
.tree {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 0;
}
.tree-root {
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 6px 16px; border-radius: 8px;
  font-size: .9rem;
  background: rgba(245,158,11,.06);
}
.tree::after {
  content: ""; width: 1px; height: 36px;
  background: linear-gradient(var(--accent), var(--line));
}

.apps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  position: relative;
  padding-top: 36px;
  border-top: 1px solid var(--line);
}

.app {
  position: relative;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px;
  color: inherit; text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  transition: transform .3s cubic-bezier(.2,.8,.2,1), border-color .3s;
  zoom: .75; /* البطاقات أصغر بـ 25%: أربع في الصف */
}
/* ضوء يتبع الماوس داخل البطاقة */
.app::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(420px circle at var(--x, 50%) var(--y, 0%), rgba(245,158,11,.14), transparent 45%);
  opacity: 0; transition: opacity .3s;
}
.app:hover::before { opacity: 1; }
a.app:hover { transform: translateY(-6px); border-color: rgba(245,158,11,.5); }
a.app:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

.app-head { display: flex; justify-content: space-between; align-items: center; }
.app-num { color: var(--muted); font-size: .85rem; }
.status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .8rem; font-weight: 500; color: var(--ok);
  background: rgba(52,211,153,.08);
  border: 1px solid rgba(52,211,153,.25);
  padding: 3px 12px; border-radius: 999px;
}
.status-soon { color: var(--accent); background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.25); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); position: relative; }
.pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--ok); animation: ping 1.6s ease-out infinite;
}
@keyframes ping { to { transform: scale(3); opacity: 0; } }

/* الرادار المتحرك */
.radar {
  position: relative;
  width: 150px; height: 150px;
  margin: 18px auto 14px;
  border-radius: 50%;
  border: 1px solid rgba(245,158,11,.35);
  background:
    radial-gradient(circle, transparent 32%, rgba(245,158,11,.25) 32.5%, transparent 33.5%),
    radial-gradient(circle, transparent 65%, rgba(245,158,11,.25) 65.5%, transparent 66.5%),
    linear-gradient(transparent 49.6%, rgba(245,158,11,.18) 49.6% 50.4%, transparent 50.4%),
    linear-gradient(90deg, transparent 49.6%, rgba(245,158,11,.18) 49.6% 50.4%, transparent 50.4%);
  overflow: hidden;
}
.radar-sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(245,158,11,.55), rgba(245,158,11,0) 28%);
  animation: spin 3.2s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.blip {
  position: absolute; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 12px var(--accent);
  animation: blink 3.2s ease-in-out infinite;
}
.b1 { top: 26%; left: 62%; animation-delay: .3s; }
.b2 { top: 60%; left: 24%; animation-delay: 1.5s; }
.b3 { top: 70%; left: 68%; animation-delay: 2.4s; background: var(--accent-2); box-shadow: 0 0 12px var(--accent-2); }
@keyframes blink { 0%, 100% { opacity: .15; } 15% { opacity: 1; } }

.app h3 { font-size: 1.6rem; font-weight: 700; line-height: 1.3; }
.app p { color: var(--muted); flex: 1; }

.app-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; padding-top: 16px;
  border-top: 1px dashed var(--line);
}
.url { color: var(--accent); font-size: .9rem; }
.lock { font-size: .8rem; color: var(--muted); }

.app-go {
  position: absolute; top: 22px; left: 50%;
  transform: translate(-50%, -8px); opacity: 0;
  font-size: 1.4rem; color: var(--accent);
  transition: all .3s;
}
a.app:hover .app-go { opacity: 1; transform: translate(-50%, 0); }

/* مروحة البطاقات (تطبيق بطاقتي) */
.fan { position: relative; height: 150px; margin: 18px 0 14px; }
.mini {
  position: absolute; left: 50%; top: 50%;
  width: 92px; height: 124px; margin: -62px 0 0 -46px;
  border-radius: 12px;
  display: grid; place-items: center; text-align: center;
  font-family: "Reem Kufi Fun", sans-serif; font-weight: 700; font-size: 1rem; line-height: 1.3;
  box-shadow: 0 10px 24px -10px rgba(0,0,0,.6);
  transition: transform .45s cubic-bezier(.2,.8,.2,1);
}
.m1 { background: #1E3A5F; color: #F6D58E; transform: rotate(-14deg) translateX(-34px); }
.m2 { background: #F5F1E8; color: #92400E; transform: rotate(0deg) translateY(-6px); z-index: 2; }
.m3 { background: #3B1F4A; color: #F0ABFC; transform: rotate(14deg) translateX(34px); }
a.app:hover .m1 { transform: rotate(-22deg) translateX(-62px) translateY(6px); }
a.app:hover .m2 { transform: rotate(0deg) translateY(-14px) scale(1.06); }
a.app:hover .m3 { transform: rotate(22deg) translateX(62px) translateY(6px); }

/* حاسبة الذهب: خط بياني يرسم نفسه + سبيكة */
.gold-viz {
  height: 150px; margin: 18px 0 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 10px;
}
.gold-chart { width: 80%; height: 80px; overflow: visible; }
.gold-zero { fill: none; stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 3 5; vector-effect: non-scaling-stroke; }
.gold-line {
  fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 100; stroke-dashoffset: 100;
  filter: drop-shadow(0 0 6px rgba(245,158,11,.55));
}
.gold-dot { fill: var(--accent); opacity: 0; filter: drop-shadow(0 0 6px var(--accent)); }
.app.in .gold-line { animation: gold-draw 1.8s cubic-bezier(.4,0,.2,1) .3s forwards; }
.app.in .gold-dot { animation: gold-dot .4s ease 2s forwards; }
a.app:hover .gold-line { animation: gold-redraw 1.2s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes gold-draw { to { stroke-dashoffset: 0; } }
@keyframes gold-redraw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes gold-dot { to { opacity: 1; } }
.ingot {
  position: relative; overflow: hidden;
  width: 118px; height: 40px;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #FDE68A 0%, #F59E0B 55%, #B45309 100%);
  clip-path: polygon(13% 0, 87% 0, 100% 100%, 0 100%);
  transition: transform .45s cubic-bezier(.2,.8,.2,1);
}
.ingot-label { color: #78350F; font-size: .72rem; font-weight: 500; letter-spacing: 1.5px; }
.ingot-sheen {
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.65) 50%, transparent 65%);
  transform: translateX(-130%);
}
a.app:hover .ingot { transform: translateY(-5px); }
a.app:hover .ingot-sheen { animation: sheen 1s ease; }
@keyframes sheen { to { transform: translateX(130%); } }

/* محلل الأسهم: حلقة درجة تمتلئ + أعمدة محاور التحليل */
.ashom-viz {
  height: 150px; margin: 18px 0 14px;
  display: flex; align-items: center; justify-content: center; gap: 22px;
}
.av-gauge { position: relative; width: 108px; height: 108px; flex: none; }
.av-gauge::before { content: ""; position: absolute; inset: -14px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(52,211,153,.16), transparent 65%); }
.av-gauge svg { position: relative; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.av-track { fill: none; stroke: var(--line); stroke-width: 7; }
.av-arc {
  fill: none; stroke: url(#avg); stroke-width: 7; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 100;
  filter: drop-shadow(0 0 6px rgba(52,211,153,.45));
}
.av-bars { position: relative; }
.av-bars::before { content: ""; position: absolute; inset: 22px -8px 0; pointer-events: none;
  background: repeating-linear-gradient(to top, rgba(255,255,255,.06) 0 1px, transparent 1px 20.5px); }
.av-score { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.7rem; font-weight: 500; color: var(--ink); padding-bottom: 8px; }
.av-of { position: absolute; left: 0; right: 0; bottom: 30px; text-align: center; font-size: .62rem; color: var(--muted); }
.av-bars { display: flex; align-items: flex-end; gap: 16px; height: 104px; }
.av-bar { position: relative; width: 18px; height: 82px; display: flex; align-items: flex-end; border-radius: 5px; background: rgba(255,255,255,.04); }
.av-bar i {
  display: block; width: 100%; height: var(--h); border-radius: 5px;
  background: linear-gradient(180deg, #FCD34D, var(--accent) 60%, #B45309);
  transform: scaleY(0); transform-origin: bottom;
}
.av-bar:nth-child(2) i { background: linear-gradient(180deg, #6EE7B7, var(--ok) 60%, #047857); }
.av-bar em { position: absolute; top: calc(100% + 5px); left: 50%; transform: translateX(-50%); font-style: normal; font-size: .62rem; color: var(--muted); white-space: nowrap; }
.app.in .av-arc { animation: av-fill 1.6s cubic-bezier(.4,0,.2,1) .3s forwards; }
.app.in .av-bar i { animation: av-rise .9s cubic-bezier(.2,.8,.2,1) forwards; }
.app.in .av-bar:nth-child(1) i { animation-delay: .5s; }
.app.in .av-bar:nth-child(2) i { animation-delay: .62s; }
.app.in .av-bar:nth-child(3) i { animation-delay: .74s; }
.app.in .av-bar:nth-child(4) i { animation-delay: .86s; }
a.app:hover .av-arc { animation: av-refill 1.1s cubic-bezier(.4,0,.2,1) forwards; }
a.app:hover .av-bar i { animation: av-rerise .7s cubic-bezier(.2,.8,.2,1) forwards; }
a.app:hover .av-gauge { transform: scale(1.05); }
.av-gauge { transition: transform .45s cubic-bezier(.2,.8,.2,1); }
@keyframes av-fill { to { stroke-dashoffset: 22; } }
@keyframes av-refill { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 22; } }
@keyframes av-rise { to { transform: scaleY(1); } }
@keyframes av-rerise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) {
  .av-arc { stroke-dashoffset: 22; animation: none !important; }
  .av-bar i { transform: none; animation: none !important; }
}

/* الحارس: درع وشعاع فحص يمر على الملفات؛ الملف المتنكر يُحجَر بالأحمر */
.guard-viz {
  height: 150px; margin: 18px 0 14px;
  display: flex; align-items: center; justify-content: center; gap: 20px;
}
.gv-shield { position: relative; width: 84px; height: 94px; flex: none; transition: transform .45s cubic-bezier(.2,.8,.2,1); }
.gv-shield::before { content: ""; position: absolute; inset: -16px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(52,211,153,.2), transparent 65%); }
.gv-shield svg { position: relative; width: 100%; height: 100%; overflow: visible; }
.gv-body { fill: url(#gvg); filter: drop-shadow(0 6px 14px rgba(16,185,129,.35)); }
.gv-shine { fill: rgba(255,255,255,.16); }
.gv-check { fill: none; stroke: #fff; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.gv-files { position: relative; display: flex; flex-direction: column; gap: 7px; width: 168px; }
.gv-file {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-size: .7rem; color: var(--muted); padding: 6px 9px; border-radius: 7px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line);
}
.gv-file b { font-family: inherit; font-weight: 500; font-size: .62rem; color: var(--ok); opacity: 0; direction: rtl; }
.gv-bad b { color: #F87171; }
.gv-beam {
  position: absolute; left: -8px; right: -8px; top: 0; height: 2px; border-radius: 2px; opacity: 0;
  background: linear-gradient(90deg, transparent, var(--ok), transparent); box-shadow: 0 0 12px var(--ok);
}
.app.in .gv-beam { animation: gv-scan 1.6s ease-in-out .4s forwards; }
.app.in .gv-file b { animation: gv-show .3s ease forwards; }
.app.in .gv-file:nth-of-type(1) b { animation-delay: .75s; }
.app.in .gv-file:nth-of-type(2) b { animation-delay: 1.15s; }
.app.in .gv-file:nth-of-type(3) b { animation-delay: 1.55s; }
.app.in .gv-bad { animation: gv-bad .4s ease 1.15s forwards; }
.app.in .gv-check { animation: gv-draw .6s cubic-bezier(.4,0,.2,1) 1.9s forwards; }
a.app:hover .gv-beam { animation: gv-scan2 1.3s ease-in-out forwards; }
a.app:hover .gv-file b { opacity: 0; animation: gv-show2 .3s ease forwards; }
a.app:hover .gv-file:nth-of-type(1) b { animation-delay: .3s; }
a.app:hover .gv-file:nth-of-type(2) b { animation-delay: .65s; }
a.app:hover .gv-file:nth-of-type(3) b { animation-delay: 1s; }
a.app:hover .gv-bad { animation: gv-bad2 .4s ease .65s both; }
a.app:hover .gv-shield { transform: scale(1.05); }
@keyframes gv-scan { 0% { top: 0; opacity: 1; } 90% { top: 100%; opacity: 1; } 100% { top: 100%; opacity: 0; } }
@keyframes gv-scan2 { 0% { top: 0; opacity: 1; } 90% { top: 100%; opacity: 1; } 100% { top: 100%; opacity: 0; } }
@keyframes gv-show { to { opacity: 1; } }
@keyframes gv-show2 { from { opacity: 0; } to { opacity: 1; } }
@keyframes gv-bad { to { color: #FCA5A5; border-color: rgba(248,113,113,.55); background: rgba(248,113,113,.1); } }
@keyframes gv-bad2 { from { color: var(--muted); border-color: var(--line); background: rgba(255,255,255,.04); } to { color: #FCA5A5; border-color: rgba(248,113,113,.55); background: rgba(248,113,113,.1); } }
@keyframes gv-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .gv-beam { display: none; }
  .gv-file b { opacity: 1 !important; animation: none !important; }
  .gv-bad { color: #FCA5A5; border-color: rgba(248,113,113,.55); background: rgba(248,113,113,.1); animation: none !important; }
  .gv-check { stroke-dashoffset: 0; animation: none !important; }
}

/* مملكة النحو: حركة آخر الكلمة تتبدّل بين الرفع والنصب والخفض */
.irab-viz {
  height: 150px; margin: 18px 0 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  --r: #60A5FA; --n: #F87171; --k: #4ADE80;
}
.irab-word { position: relative; height: 84px; width: 100%; display: grid; place-items: center; }
.iw {
  position: absolute; font-family: "Amiri", serif; font-weight: 700; font-size: 3.4rem; line-height: 1.5;
  opacity: 0; transform: translateY(8px) scale(.96);
  animation: iw-cycle 6s infinite;
}
.iw-r { color: var(--r); text-shadow: 0 0 22px rgba(96,165,250,.45); }
.iw-n { color: var(--n); text-shadow: 0 0 22px rgba(248,113,113,.45); animation-delay: 2s; }
.iw-k { color: var(--k); text-shadow: 0 0 22px rgba(74,222,128,.45); animation-delay: 4s; }
@keyframes iw-cycle {
  0%   { opacity: 0; transform: translateY(8px) scale(.96); }
  6%, 30% { opacity: 1; transform: none; }
  36%, 100% { opacity: 0; transform: translateY(-8px) scale(.96); }
}
.irab-cases { display: flex; gap: 8px; }
.ic {
  font-family: "Reem Kufi Fun", sans-serif; font-weight: 700; font-size: .85rem;
  padding: 2px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
  animation: ic-cycle 6s infinite;
}
.ic-r { --c: var(--r); }
.ic-n { --c: var(--n); animation-delay: 2s; }
.ic-k { --c: var(--k); animation-delay: 4s; }
@keyframes ic-cycle {
  0%, 33% { color: var(--c); border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
  36%, 100% { color: var(--muted); border-color: var(--line); background: transparent; }
}
a.app:hover .irab-word { transform: scale(1.06); }
.irab-word { transition: transform .45s cubic-bezier(.2,.8,.2,1); }

/* البطاقة القادمة */
.app-soon {
  background: repeating-linear-gradient(135deg, transparent 0 14px, rgba(255,255,255,.015) 14px 28px), var(--bg-2);
  border-style: dashed;
}
.soon-visual {
  height: 150px; margin: 18px 0 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem; color: var(--ink);
}
.caret { color: var(--accent); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

/* ================= التذييل ================= */
.footer {
  margin-top: 80px;
  border-top: 1px solid var(--line);
  overflow: hidden;
}
.footer-giant {
  font-family: "Bungee", sans-serif;
  font-size: clamp(3.5rem, 15vw, 14rem);
  line-height: .85;
  text-align: center;
  letter-spacing: 4px;
  padding: 40px 0 10px;
  direction: ltr;
  user-select: none;
  cursor: default;
  /* مفرّغة: خط خارجي رمادي هادئ، بدون توهّج */
  color: transparent;
  -webkit-text-stroke: 2px #3A3A42;
}
/* عند مرور الماوس فقط: الخط الخارجي يتبدّل لونه باستمرار (بدون توهّج) */
.footer-giant:hover {
  -webkit-text-stroke-color: var(--neon);
  animation: neon 2.4s linear infinite;
}
@property --neon { syntax: "<color>"; inherits: true; initial-value: #39FF14; }
@keyframes neon {
  0%, 100% { --neon: #39FF14; }   /* أخضر */
  25%      { --neon: #00E5FF; }   /* أزرق */
  50%      { --neon: #FF9F1C; }   /* برتقالي */
  75%      { --neon: #FF2EC4; }   /* وردي */
}
.footer-row {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
  padding: 22px clamp(20px, 5vw, 56px);
  color: var(--muted); font-size: .9rem;
}
.to-top { color: var(--ink); text-decoration: none; }
.to-top:hover { color: var(--accent); }

/* ظهور العناصر عند التمرير */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.8,.2,1); }
.reveal.in { opacity: 1; transform: none; }
.apps .reveal:nth-child(2) { transition-delay: .12s; }
.apps .reveal:nth-child(3) { transition-delay: .24s; }
.apps .reveal:nth-child(4) { transition-delay: .36s; }

@media (max-width: 980px) { .apps { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .apps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .apps-section { padding-top: 16px; }
}
/* الجوال: بطاقة واحدة في الصف بحجمها الكامل ليبقى النص مقروءاً */
@media (max-width: 520px) {
  .apps { grid-template-columns: 1fr; gap: 22px; }
  .app { zoom: 1; }
}

/* إذا كان «تقليل الحركة» مفعّلاً في الجهاز: نوقف التحريك الكبير فقط،
   وتبقى الألوان المتبدلة والرادار والنبض تعمل */
@media (prefers-reduced-motion: reduce) {
  .hero-grid, .logo-en, .anim-ar, .hero-line, .hero-sub, .cta, .cta-arrow { animation: none !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
  a.app:hover { transform: none; }
  .gold-line { stroke-dashoffset: 0; animation: none !important; }
  .gold-dot { opacity: 1; animation: none !important; }
  .iw, .ic { animation: none !important; }
  .iw-r { opacity: 1; transform: none; }
  .ic-r { color: var(--r); border-color: var(--r); }
}

/* ===== تحدي الخلية: لوحتان تلتقيان على خط بحواف الخلايا ===== */
@property --split { syntax: "<percentage>"; inherits: true; initial-value: 54%; }
.duel {
  --split: 54%; --zig: 9px;
  position: relative; height: 170px; margin: 18px 0 14px;
  border-radius: 16px; overflow: hidden; border: 1px solid var(--line);
  background: #0e1620;
  transition: --split .9s cubic-bezier(.2,.8,.2,1);
}
.duel img {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover; transform: scale(1.28);
  transition: transform 1.2s cubic-bezier(.2,.8,.2,1), filter .6s;
}
/* اللوحة الصفراء تركّز على خلية «الهلال» المضيئة، والزرقاء على خلية «التعاون» */
.duel .d-b { object-position: 100% 30%; transform-origin: 90% 30%; filter: saturate(1.1); }
.duel .d-a { object-position: 100% 30%; transform-origin: 85% 32%;
  clip-path: polygon(0 0, calc(var(--split) + var(--zig)) 0, calc(var(--split) - var(--zig)) 20%, calc(var(--split) + var(--zig)) 40%,
    calc(var(--split) - var(--zig)) 60%, calc(var(--split) + var(--zig)) 80%, calc(var(--split) - var(--zig)) 100%, 0 100%); }
/* الخط الفاصل نفسه: شريط رفيع بنفس التعرّج */
.d-seam {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--accent);
  filter: drop-shadow(0 0 6px rgba(245,158,11,.8));
  clip-path: polygon(calc(var(--split) + var(--zig)) 0, calc(var(--split) + var(--zig) + 3px) 0,
    calc(var(--split) - var(--zig) + 3px) 20%, calc(var(--split) + var(--zig) + 3px) 40%, calc(var(--split) - var(--zig) + 3px) 60%,
    calc(var(--split) + var(--zig) + 3px) 80%, calc(var(--split) - var(--zig) + 3px) 100%, calc(var(--split) - var(--zig)) 100%,
    calc(var(--split) + var(--zig)) 80%, calc(var(--split) - var(--zig)) 60%, calc(var(--split) + var(--zig)) 40%, calc(var(--split) - var(--zig)) 20%);
}
.d-vs {
  position: absolute; top: 50%; left: var(--split); transform: translate(-50%, -50%);
  width: 46px; height: 52px; display: grid; place-items: center;
  background: var(--accent); color: #1a1205; font-weight: 700; font-size: .85rem; letter-spacing: .05em;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.d-turn {
  position: absolute; bottom: 12px; left: 50%; transform: translate(-50%, 14px);
  background: #1e6fe0; color: #fff; font-weight: 700; font-size: .9rem;
  padding: 5px 16px; border-radius: 99px; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0,0,0,.5), 0 0 0 2px rgba(255,255,255,.8);
  opacity: 0; transition: opacity .35s, transform .35s cubic-bezier(.2,1.4,.4,1);
}
/* عند ظهور البطاقة: الخط يتأرجح مرة واحدة ليعرّف الزائر أن هناك لوحتين */
.app.in .duel { animation: duel-intro 2.4s cubic-bezier(.45,0,.2,1) .4s 1; }
@keyframes duel-intro { 0% { --split: 54%; } 35% { --split: 74%; } 70% { --split: 34%; } 100% { --split: 54%; } }
/* عند مرور الماوس: يتراجع الخط فتتقدّم اللوحة الصفراء، وتقترب الصورتان، ويظهر «دورك الآن!» */
a.app:hover .duel { --split: 28%; animation: none; }
a.app:hover .duel img { transform: scale(1.5); }
a.app:hover .d-turn { opacity: 1; transform: translate(-50%, 0); animation: turn-blink .5s ease-in-out .35s 3; }
@keyframes turn-blink { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) {
  .duel, .duel img, .d-turn { transition: none !important; animation: none !important; }
}

/* اللعب أونلاين: شريط تحت اللوحتين، مدينتان وبينهما خط تنتقل عليه الحركات في الاتجاهين */
.d-net {
  display: flex; align-items: center; gap: 10px;
  margin: -4px 2px 4px; font-size: .78rem; font-weight: 700; color: var(--ink);
}
.dn-end { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dn-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); position: relative; }
.dn-b .dn-dot { background: #60A5FA; }
.dn-dot::after { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 50%; border: 1.5px solid currentColor; color: var(--accent); animation: dn-ring 1.8s ease-out infinite; }
.dn-b .dn-dot::after { color: #60A5FA; animation-delay: .9s; }
@keyframes dn-ring { from { transform: scale(1); opacity: .9; } to { transform: scale(3); opacity: 0; } }
.dn-wire { position: relative; flex: 1; height: 22px; display: grid; place-items: center; min-width: 0; }
.dn-wire::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1.5px dashed rgba(245,241,232,.35); }
.dn-p { position: absolute; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; }
.dn-p1 { background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: dn-rtl 2.4s linear infinite; }
.dn-p2 { background: #60A5FA; box-shadow: 0 0 8px #60A5FA; animation: dn-ltr 2.4s linear 1.2s infinite; opacity: 0; }
@keyframes dn-rtl { 0% { right: 0; opacity: 0; } 10%, 90% { opacity: 1; } 100% { right: calc(100% - 7px); opacity: 0; } }
@keyframes dn-ltr { 0% { left: 0; opacity: 0; } 10%, 90% { opacity: 1; } 100% { left: calc(100% - 7px); opacity: 0; } }
.dn-live {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 99px; background: var(--card);
  border: 1px solid rgba(52,211,153,.55); color: var(--ok); font-size: .74rem;
}
.dn-led { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); animation: dn-led 1.6s ease-out infinite; }
@keyframes dn-led { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.7); } 70%, 100% { box-shadow: 0 0 0 6px rgba(52,211,153,0); } }
@media (prefers-reduced-motion: reduce) {
  .dn-dot::after, .dn-led { animation: none !important; }
  .dn-p { display: none; }
}
/* سطر الأونلاين تحت الوصف */
.app p.online-line {
  flex: 0; display: flex; gap: 10px; align-items: flex-start;
  margin-top: -2px; padding: 10px 12px; border-radius: 12px;
  background: linear-gradient(90deg, rgba(52,211,153,.08), rgba(96,165,250,.08));
  border: 1px solid rgba(52,211,153,.25); color: var(--muted); font-size: .92rem; line-height: 1.7;
}
.online-line b { color: var(--ink); }
.ol-icon { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: rgba(52,211,153,.15); color: var(--ok); font-weight: 700; }

/* أرقام كل تطبيق على بطاقته، عمودياً: الزوار، المشاهدات، الإعجاب */
.app-head { align-items: flex-start; }
.app-stats {
  display: grid; gap: 3px; min-width: 112px;
  padding: 7px 10px; border-radius: 10px;
  background: rgba(255,255,255,.025); border: 1px solid var(--line);
  font-size: .74rem; color: var(--muted);
}
.app-stats:empty { display: none; }
.ds-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.ds-k { font-family: Rubik, system-ui, sans-serif; }
.ds-v { font-family: var(--mono); font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.ds-like .ds-v { color: #ff6b81; }
.ds-row + .ds-row { border-top: 1px dashed rgba(255,255,255,.07); padding-top: 3px; }
.ds-wait .ds-v { color: var(--muted); animation: ds-wait 1.2s ease-in-out infinite; }
@keyframes ds-wait { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .ds-wait .ds-v { animation: none; } }

/* تلاشٍ ناعم أسفل الواجهة حتى لا يظهر خط فاصل حاد بينها وبين قسم التطبيقات */
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 160px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none; z-index: -1;
}

/* مناسبات العائلة: تقويم صغير — مناسبة تحجز يوماً، والثانية تحاول نفس اليوم فترتد وتنتقل لليوم التالي */
.cal-viz { height: 150px; margin: 18px 0 14px; display: grid; place-items: center; }
.cv-board {
  position: relative; padding: 10px 12px 12px; border-radius: 14px;
  background: rgba(255,255,255,.03); border: 1px solid var(--line);
  transition: transform .45s cubic-bezier(.2,.8,.2,1);
}
.cv-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; font-size: .72rem; font-weight: 700; color: var(--ink); }
.cv-top .mono { font-size: .6rem; font-weight: 400; color: var(--muted); }
.cv-grid { position: relative; display: grid; grid-template-columns: repeat(7, 26px); grid-auto-rows: 22px; gap: 4px; }
.cv-grid i {
  font-style: normal; font-family: var(--mono); font-size: .58rem; color: var(--muted);
  display: flex; align-items: flex-start; justify-content: flex-start; padding: 2px 4px;
  border-radius: 6px; background: rgba(255,255,255,.04); border: 1px solid var(--line);
}
/* الطبقة العائمة فوق اليوم العاشر (الصف 2، العمود 3 من اليمين) */
.cv-ghost {
  position: absolute; top: 26px; right: 53px; width: 40px; height: 22px;
  display: grid; place-items: center; border-radius: 6px;
  font-size: .56rem; font-weight: 700; color: #3fc1c3;
  border: 1.5px dashed #3fc1c3; background: rgba(19,19,23,.92);
  opacity: 0; transform: translateY(-18px); pointer-events: none;
}
.cv-note {
  position: absolute; left: 50%; bottom: -24px; transform: translate(-50%, 4px);
  white-space: nowrap; font-size: .7rem; font-weight: 700; color: var(--ok); opacity: 0;
}
.app.in .cv-a { animation: cv-book1 .35s ease .4s forwards; }
.app.in .cv-ghost { animation: cv-try 1.5s ease-in-out 1s forwards; }
.app.in .cv-b { animation: cv-book2 .35s ease 2.2s forwards; }
.app.in .cv-note { animation: cv-note .4s ease 2.5s forwards; }
a.app:hover .cv-board { transform: scale(1.05); }
a.app:hover .cv-a { animation: cv-book1b .3s ease forwards; }
a.app:hover .cv-ghost { animation: cv-try2 1.4s ease-in-out .35s forwards; }
a.app:hover .cv-b { animation: cv-book2b .3s ease 1.45s both; }
a.app:hover .cv-note { animation: cv-note2 .4s ease 1.7s both; }
@keyframes cv-book1 { to { background: #c2485d; border-color: #c2485d; color: #fff; box-shadow: 0 0 14px -2px rgba(194,72,93,.7); } }
@keyframes cv-book1b { from { background: rgba(255,255,255,.04); border-color: var(--line); color: var(--muted); box-shadow: none; } to { background: #c2485d; border-color: #c2485d; color: #fff; box-shadow: 0 0 14px -2px rgba(194,72,93,.7); } }
@keyframes cv-book2 { to { background: #3fc1c3; border-color: #3fc1c3; color: #0b1f20; box-shadow: 0 0 14px -2px rgba(63,193,195,.7); } }
@keyframes cv-book2b { from { background: rgba(255,255,255,.04); border-color: var(--line); color: var(--muted); box-shadow: none; } to { background: #3fc1c3; border-color: #3fc1c3; color: #0b1f20; box-shadow: 0 0 14px -2px rgba(63,193,195,.7); } }
/* تنزل فوق اليوم المحجوز، تهتز بالأحمر، ثم تنتقل لليوم التالي وتختفي فيه */
@keyframes cv-try {
  0% { opacity: 0; transform: translateY(-18px); }
  18% { opacity: 1; transform: translateY(0); }
  26% { transform: translateX(3px); border-color: #F87171; color: #F87171; }
  34% { transform: translateX(-3px); }
  42% { transform: translateX(3px); }
  50% { transform: translateX(0); border-color: #F87171; color: #F87171; }
  80% { opacity: 1; transform: translateX(-30px); border-color: #3fc1c3; color: #3fc1c3; }
  100% { opacity: 0; transform: translateX(-30px); }
}
@keyframes cv-try2 {
  0% { opacity: 0; transform: translateY(-18px); }
  18% { opacity: 1; transform: translateY(0); }
  26% { transform: translateX(3px); border-color: #F87171; color: #F87171; }
  34% { transform: translateX(-3px); }
  42% { transform: translateX(3px); }
  50% { transform: translateX(0); border-color: #F87171; color: #F87171; }
  80% { opacity: 1; transform: translateX(-30px); border-color: #3fc1c3; color: #3fc1c3; }
  100% { opacity: 0; transform: translateX(-30px); }
}
@keyframes cv-note { to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes cv-note2 { from { opacity: 0; transform: translate(-50%, 4px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) {
  .cv-board { transition: none; }
  .app .cv-a, a.app:hover .cv-a { animation: none !important; background: #c2485d; border-color: #c2485d; color: #fff; }
  .app .cv-b, a.app:hover .cv-b { animation: none !important; background: #3fc1c3; border-color: #3fc1c3; color: #0b1f20; }
  .app .cv-ghost, a.app:hover .cv-ghost { animation: none !important; opacity: 0; }
  .app .cv-note, a.app:hover .cv-note { animation: none !important; opacity: 1; transform: translate(-50%, 0); }
}
