/* This App Was Designed by Alhajri AM.
 * تنسيق واجهة الكشك والصفحات والنوافذ والشعار والبحث. القواعد مرتبة حسب عناصر الواجهة، ثم تحسينات الحركة والتجاوب. القواعد الأخيرة تتقدم عند تساوي خصوصية المحدد؛ عدّل قواعد الشعار والبحث في قسمها الأخير.
 */
/* قيم التصميم الأساسية: ألوان الخلفية والنص واللون المتغير accent؛ تعديل المتغيرات هنا ينعكس على العناصر التي تستخدمها. */
:root {
  color-scheme: dark;
  --bg: #080f1c;
  --panel: #111d2e;
  --text: #f6f8ff;
  --muted: #9aacc4;
  --accent: #76dabd;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #040912;
  color: var(--text);
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:disabled {
  cursor: default;
  opacity: 0.6;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 5px;
}
button {
  color: inherit;
}
button img {
  pointer-events: none;
}
button,
a {
  -webkit-user-select: none;
  user-select: none;
}
/* حاوية جهاز العرض: نسبة طولية وحد أدنى للارتفاع. Flex يوزع المساحة بين الرأس والمحتوى والتذييل؛ overflow يمنع خروج المؤثرات خارجها. */
.kiosk {
  width: min(100%, calc(max(100dvh, 720px) * 9 / 16));
  height: 100dvh;
  min-height: 720px;
  background:
    radial-gradient(ellipse at 80% 0%, #172d42 0, transparent 40%), var(--bg);
  margin: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
/* رأس الصفحة: توزيع الهوية وأزرار الأدوات والمسافات الجانبية. قواعد الشعار الإضافية في نهاية الملف تضبط الحجم والموضع الحاليين. */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(20px, 4vw, 46px) clamp(20px, 5vw, 64px);
  flex-shrink: 0;
  gap: 16px;
}
/* زر الهوية: رابط العودة للرئيسية مع العلامة والنص الافتراضيين؛ has-logo يظهر الصورة بدل النص بعد نجاح تحميلها. */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 0;
  background: none;
  text-align: left;
  font-size: clamp(20px, 3vw, 32px);
  letter-spacing: 2px;
  font-weight: 800;
  padding: 0;
  min-height: 56px;
}
.brand small {
  display: block;
  font-size: clamp(10px, 1.25vw, 14px);
  color: var(--muted);
  letter-spacing: 2.6px;
  font-weight: 400;
  margin-top: 8px;
}
.brand-mark {
  height: 54px;
  width: 54px;
  border: 1px solid #6bc8be70;
  border-radius: 15px;
  background: #132b36;
  display: grid;
  place-content: center;
  font-size: 34px;
  color: #8be3cf;
  position: relative;
}
.brand-mark span {
  position: absolute;
  right: 2px;
  top: -10px;
  color: #81baff;
  font-size: 26px;
}
.header-tools {
  display: flex;
  gap: 20px;
  align-items: center;
}
.kiosk-label {
  font-size: 12px;
  letter-spacing: 2px;
  color: #9daec2;
}
.icon-button {
  background: #ffffff08;
  border: 1px solid #ffffff20;
  border-radius: 50%;
  min-width: 56px;
  min-height: 56px;
  font-size: 26px;
  display: grid;
  place-items: center;
}
.icon-button:hover {
  background: #ffffff16;
}
#main {
  flex: 1;
  min-height: 0;
  outline: none;
  display: flex;
  flex-direction: column;
}
/* الصفحة الرئيسية: مقدمة ثابتة وثلاث بطاقات تشارك المساحة الباقية. min-height:0 يسمح بانكماش مساحة Flex دون خروجها. */
.home {
  padding: clamp(10px, 2vh, 38px) clamp(20px, 5vw, 64px) 12px;
  display: flex;
  flex-direction: column;
  gap: clamp(22px, 3vh, 56px);
  height: 100%;
  min-height: 0;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: clamp(12px, 1.6vw, 18px);
  color: var(--accent);
  font-weight: 700;
}
.home-intro h1 {
  font-size: clamp(34px, 5.6vw, 66px);
  line-height: 1.08;
  letter-spacing: -2px;
  margin: 18px 0;
}
.home-intro h1 span {
  font-weight: 400;
  color: #a7bbd2;
}
.home-intro p {
  color: var(--muted);
  font-size: clamp(16px, 2.1vw, 24px);
  margin: 14px 0 0;
  line-height: 1.5;
}
/* شبكة الشخصيات: ثلاث صفوف متساوية ومرنة، والفواصل تتجاوب مع ارتفاع الشاشة. */
.cards {
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2vh, 34px);
  flex: 1;
  min-height: 0;
}
/* بطاقة الشخصية: طبقات للصورة والتدرجات والنص والشخصية. isolation يحصر ترتيب z-index داخل البطاقة. */
.ambassador {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--card-accent), transparent 52%);
  border-radius: 24px;
  padding: clamp(20px, 3.8vw, 42px);
  background: #102235;
  text-align: left;
  display: flex;
  align-items: center;
  transition:
    transform 0.18s,
    border-color 0.18s;
  min-height: 0;
  box-shadow: 0 18px 35px #0003;
}
.ambassador:hover {
  transform: translateY(-3px);
  border-color: var(--card-accent);
}
.ambassador:active {
  transform: scale(0.99);
}
.card-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -3;
}
.ambassador:before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    #061224f5 0%,
    #061224ec 24%,
    #061224bc 49%,
    #06122438 100%
  );
  z-index: -2;
}
.ambassador:after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, #020d1da6, transparent 50%);
  z-index: -1;
}
.card-copy {
  position: relative;
  z-index: 2;
  max-width: 68%;
}
.card-index {
  font-size: clamp(12px, 1.6vw, 18px);
  letter-spacing: 3px;
  color: var(--card-accent);
  display: flex;
  gap: 14px;
  align-items: center;
}
.card-index:after {
  content: "";
  width: 40px;
  height: 1px;
  background: var(--card-accent);
}
.card-copy h2 {
  font-size: clamp(27px, 4.6vw, 54px);
  font-weight: 800;
  margin: 12px 0 8px;
  letter-spacing: -1px;
}
.card-copy p {
  font-size: clamp(15px, 2vw, 24px);
  color: #d2deec;
  margin: 0;
}
.card-link {
  margin-top: clamp(12px, 2vh, 32px);
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--card-accent);
  font-size: clamp(13px, 1.8vw, 20px);
  font-weight: 600;
}
.card-link b {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 400;
}
/* صورة الشخصية فوق الخلفية: contain يحافظ على كامل الجسم، والموضع يسمح بامتداد مقصود داخل حدود البطاقة. */
.character {
  position: absolute;
  right: 0;
  bottom: -8%;
  width: 40%;
  height: 112%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 0 30px #0008);
  z-index: 1;
}
.ambassador.inspire .character {
  right: 2%;
  bottom: 9%;
  height: 68%;
  width: 36%;
  opacity: 0.9;
}
.bottom-bar {
  padding: 26px clamp(20px, 5vw, 64px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #8599b5;
  font-size: clamp(10px, 1.3vw, 14px);
  letter-spacing: 1.5px;
  flex-shrink: 0;
}
.touch-hint {
  color: #bed0e2;
}
/* صفحة الشخصية: الرأس والبحث والفلاتر ثابتة، ومنطقة hub-scroll وحدها تتحرك عند زيادة المحتوى. */
.hub {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.hub-head {
  position: relative;
  padding: 18px clamp(20px, 5vw, 64px) 30px;
  overflow: hidden;
  flex-shrink: 0;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 18px;
  border: 1px solid #ffffff25;
  background: #111d2ecc;
  border-radius: 12px;
  font-size: 16px;
}
.hub-title {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 26px;
}
.hub-title img {
  width: 88px;
  height: 115px;
  object-fit: contain;
}
.hub-title h1 {
  font-size: clamp(32px, 5vw, 54px);
  margin: 8px 0;
}
.hub-title p {
  font-size: 18px;
  color: var(--muted);
  line-height: 1.5;
  margin: 8px 0;
}
.hub-scroll {
  overflow: auto;
  overscroll-behavior: contain;
  flex: 1;
  padding: 0 clamp(20px, 5vw, 64px) 24px;
  scrollbar-width: thin;
}
/* فلاتر التصنيفات: صف قابل للتمرير الأفقي؛ الأزرار لا تنكمش لتبقى أهداف لمس واضحة. */
.filters {
  display: flex;
  gap: 12px;
  overflow: auto;
  flex-shrink: 0;
  padding: 4px clamp(20px, 5vw, 64px) 24px;
  scrollbar-width: none;
}
.filter {
  flex-shrink: 0;
  min-height: 54px;
  padding: 0 24px;
  border: 1px solid #ffffff25;
  border-radius: 30px;
  background: #ffffff05;
  font-size: 16px;
}
.filter.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #07101c;
  font-weight: 700;
}
.section-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #ffffff12;
  padding: 24px 0;
  color: #a7b8cf;
  font-size: 14px;
}
/* شبكة الفيديو والمقال والكويز: عمودان افتراضيًا، وتعرض رسالة فراغ بعمود واحد عند عدم وجود نتائج. */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
/* بطاقة المحتوى: عرض العنوان والتصنيف ونوع التجربة؛ خلفية الغلاف والطبقات لا تغير منطقة الضغط. */
.content-card {
  position: relative;
  text-align: left;
  border: 1px solid #ffffff1a;
  border-radius: 20px;
  overflow: hidden;
  background: #132035;
  padding: 0;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}
.tile-visual {
  height: 140px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent), #111827 75%),
    #111827
  );
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  color: var(--accent);
  position: relative;
}
.tile-visual img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.5;
}
.tile-visual span {
  z-index: 1;
  border: 1px solid #ffffff30;
  border-radius: 50%;
  height: 64px;
  width: 64px;
  display: grid;
  place-content: center;
  background: #06101b80;
}
.tile-copy {
  padding: 22px;
  flex: 1;
}
.tile-copy small {
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.tile-copy h2 {
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.25;
  margin: 12px 0 20px;
}
.tile-copy p {
  color: #b6c7da;
  font-size: 14px;
  margin: 0;
}
.empty {
  padding: 50px 24px;
  text-align: center;
  line-height: 1.6;
  border: 1px dashed #ffffff25;
  border-radius: 20px;
  color: var(--muted);
}
.empty h2 {
  color: #edf5ff;
  font-size: 26px;
}
.empty-symbol {
  font-size: 40px;
  color: var(--accent);
}
.loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 22px;
  color: var(--muted);
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #ffffff15;
  border-top-color: #77daba;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
/* نوافذ المحتوى وتنبيه الخمول: حد أقصى للحجم وطبقة backdrop لعزل اللمس والتركيز عن الصفحة الخلفية. */
dialog {
  color: var(--text);
  border: 1px solid #ffffff25;
  padding: 0;
  background: #0c1627;
  border-radius: 28px;
  width: min(94vw, 960px);
  max-height: 92dvh;
  box-shadow: 0 30px 100px #0008;
}
dialog::backdrop {
  background: #020610d9;
  backdrop-filter: blur(12px);
}
.dialog-shell {
  display: flex;
  flex-direction: column;
  max-height: 90dvh;
}
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 26px;
  border-bottom: 1px solid #ffffff15;
  flex-shrink: 0;
}
.dialog-header > span {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 14px;
}
#detail-body {
  overflow: auto;
  overscroll-behavior: contain;
  padding: 30px;
}
.reader h2,
.quiz h2 {
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.2;
  margin: 10px 0 24px;
}
.body-text {
  font-size: clamp(18px, 2.4vw, 26px);
  line-height: 1.8;
  white-space: pre-line;
  color: #c3d0e2;
}
.reader img {
  width: 100%;
  max-height: 45vh;
  object-fit: contain;
  border-radius: 15px;
}
.quiz-question {
  font-size: clamp(20px, 2.8vw, 30px);
  line-height: 1.5;
}
/* خيارات الكويز: مساحات لمس كبيرة وحالات صحيحة/خاطئة أو محددة؛ صحة الإجابة لا تُحسب في CSS. */
.answers {
  display: grid;
  gap: 16px;
  margin: 30px 0;
}
.answer {
  display: flex;
  gap: 18px;
  align-items: center;
  text-align: left;
  padding: 20px;
  border: 1px solid #ffffff30;
  border-radius: 16px;
  background: #14233a;
  min-height: 78px;
  font-size: clamp(18px, 2.4vw, 24px);
  line-height: 1.4;
}
.answer b {
  font-size: 18px;
  color: #9eb3cb;
}
.answer.correct {
  background: #123d32;
  border-color: #66daa3;
}
.answer.wrong {
  background: #48232f;
  border-color: #ee8a9c;
}
.answer:disabled {
  opacity: 1;
}
.feedback {
  line-height: 1.6;
  font-size: 20px;
  color: #c8e8dd;
  padding: 12px 0;
}
.primary,
.secondary {
  min-height: 58px;
  border-radius: 12px;
  padding: 14px 24px;
  font-weight: 700;
  font-size: 18px;
}
.primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #08111c;
}
.secondary {
  background: transparent;
  border: 1px solid #ffffff35;
  color: white;
}
/* مساحة الفيديو: عرض كامل باستخدام contain دون قص، وعناصر التحكم خارج الفيديو لسهولة اللمس. */
.video-stage {
  background: #000;
  position: relative;
  max-height: 60dvh;
  aspect-ratio: 9/12;
  display: grid;
  place-items: center;
  border-radius: 16px;
  overflow: hidden;
  touch-action: pan-x;
}
.video-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: absolute;
}
.video-message {
  position: absolute;
  inset: auto 20px 20px;
  background: #102136ef;
  border-radius: 12px;
  padding: 20px;
  line-height: 1.6;
  text-align: center;
}
.video-message:empty {
  display: none;
}
.video-controls {
  display: flex;
  gap: 12px;
  margin: 16px 0;
  flex-wrap: wrap;
}
.video-controls button {
  flex: 1;
  min-width: 90px;
}
.video-progress {
  width: 100%;
  height: 28px;
  accent-color: var(--accent);
}
.video-caption {
  font-size: clamp(20px, 3vw, 32px);
  margin: 18px 0 8px;
}
.video-meta {
  font-size: 15px;
  color: var(--muted);
}
.idle-inner {
  padding: 40px;
  text-align: center;
}
.idle-inner h2 {
  font-size: 36px;
}
.idle-inner p {
  line-height: 1.6;
  color: #bbccdd;
  font-size: 20px;
}
.idle-inner button {
  display: block;
  width: 100%;
  margin: 15px 0;
}
#toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #21354b;
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  max-width: 90vw;
  z-index: 10;
  display: none;
}
#toast.visible {
  display: block;
}
@media (min-aspect-ratio: 1/1) {
  .kiosk {
    max-width: 740px;
  }
  .home-intro h1 {
    font-size: 38px;
  }
  .home-intro p {
    font-size: 16px;
  }
  .home {
    gap: 20px;
    padding-top: 8px;
  }
  .topbar {
    padding: 20px 36px;
  }
  .card-copy h2 {
    font-size: 28px;
    margin: 8px 0;
  }
  .card-copy p {
    font-size: 15px;
  }
  .card-link {
    margin-top: 10px;
    font-size: 14px;
  }
  .bottom-bar {
    padding: 18px 36px;
  }
  .home-intro h1 {
    margin: 12px 0;
  }
  .card-index {
    font-size: 12px;
  }
  .cards {
    gap: 14px;
  }
  .ambassador {
    padding: 20px 28px;
  }
  .kiosk-label {
    font-size: 10px;
  }
}
/* الجوال: تقليل الهوامش وأحجام العرض مع الحفاظ على أهداف اللمس وعدم تغيير ترتيب المحتوى. */
@media (max-width: 560px) {
  .kiosk-label {
    display: none;
  }
  .brand small {
    font-size: 9px;
  }
  .brand {
    font-size: 19px;
    gap: 10px;
  }
  .brand-mark {
    width: 44px;
    height: 44px;
  }
  .topbar {
    padding: 18px 20px;
  }
  .home {
    gap: 20px;
  }
  .home-intro h1 {
    font-size: 36px;
  }
  .home-intro p {
    font-size: 15px;
  }
  .home-intro .eyebrow {
    font-size: 11px;
  }
  .card-copy h2 {
    font-size: 28px;
  }
  .card-copy p {
    font-size: 14px;
  }
  .card-link {
    font-size: 12px;
    margin-top: 12px;
  }
  .card-link b {
    width: 26px;
    height: 26px;
  }
  .card-index {
    font-size: 11px;
  }
  .ambassador {
    border-radius: 18px;
    padding: 18px;
  }
  .bottom-bar {
    padding: 20px;
    font-size: 9px;
    letter-spacing: 0.5px;
  }
  .bottom-bar > span:first-child {
    display: none;
  }
  .content-grid {
    gap: 12px;
  }
  .tile-copy {
    padding: 16px;
  }
  .tile-copy h2 {
    font-size: 19px;
  }
  .content-card {
    min-height: 260px;
  }
  .tile-visual {
    height: 110px;
  }
  .hub-title img {
    width: 64px;
    height: 88px;
  }
  .hub-title p {
    font-size: 16px;
  }
  .hub-title h1 {
    font-size: 32px;
  }
  #detail-body {
    padding: 20px;
  }
  .icon-button {
    min-height: 48px;
    min-width: 48px;
  }
  .video-controls button {
    font-size: 15px;
    padding: 12px;
  }
  .answer {
    padding: 15px;
    font-size: 18px;
  }
  .idle-inner {
    padding: 24px;
  }
}
/* احترام إعداد تقليل الحركة في النظام بإيقاف الحركات والانتقالات. */
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (min-width: 1400px) and (max-aspect-ratio: 1/1) {
  .kiosk {
    zoom: 2;
    width: 50vw;
    height: 50dvh;
  }
  .home-intro h1 {
    font-size: 66px;
  }
  .home-intro p {
    font-size: 24px;
  }
  .topbar {
    padding: 46px 54px;
  }
  .home {
    padding: 30px 54px 12px;
    gap: 42px;
  }
  .cards {
    gap: 28px;
  }
  .ambassador {
    padding: 36px;
  }
  .card-copy h2 {
    font-size: 48px;
  }
  .card-copy p {
    font-size: 24px;
  }
  .character {
    width: 40%;
  }
  .bottom-bar {
    padding: 26px 54px;
  }
}

/* Lightweight, compositor-friendly kiosk transitions. Keep existing layout intact. */
#main.view-exit {
  animation: ueViewExit 145ms ease-in both;
  pointer-events: none;
}
#main.view-enter > .home,
#main.view-enter > .hub {
  animation: ueViewEnter 310ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}
@keyframes ueViewExit {
  to {
    opacity: 0;
    transform: translate3d(0, 9px, 0) scale(0.994);
  }
}
@keyframes ueViewEnter {
  from {
    opacity: 0;
    transform: translate3d(0, 16px, 0) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}
#detail[open],
#idle[open] {
  animation: ueModalEnter 260ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}
#detail.modal-closing {
  animation: ueModalExit 185ms ease-in both;
  pointer-events: none;
}
@keyframes ueModalEnter {
  from {
    opacity: 0;
    transform: translate3d(0, 24px, 0) scale(0.965);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}
@keyframes ueModalExit {
  to {
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale(0.98);
  }
}
/* Backdrop blur on every frame is costly on integrated kiosk graphics. */
dialog::backdrop {
  backdrop-filter: none;
  background: rgba(2, 6, 16, 0.88);
}
.content-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 290px;
}
.ambassador .card-bg,
.ambassador .character {
  backface-visibility: hidden;
}
@media (prefers-reduced-motion: reduce) {
  #main.view-exit,
  #main.view-enter > .home,
  #main.view-enter > .hub,
  #detail[open],
  #idle[open],
  #detail.modal-closing {
    animation: none !important;
  }
}

/* Animated landing background adapted from the supplied reference.
   Scoped to kiosk; decorative layers never block touchscreen interaction. */
.kiosk {
  isolation: isolate;
}
/* طبقة المؤثرات الخلفية: canvas وكلمات وإضاءات مستقلة عن التفاعل. JavaScript يوقفها أثناء الفيديو أو عند تعطيلها. */
.ue-effects {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  contain: layout paint;
}
.ue-effects canvas,
.ue-effects #ue-words {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.ue-effects #ue-words {
  overflow: hidden;
}
.ue-floating-word {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  font-family: Arial, sans-serif;
  font-weight: 900;
  letter-spacing: 2px;
  will-change: transform;
  user-select: none;
  opacity: 0.24;
}
.ue-floating-word.faltah {
  color: #0b78ff;
  text-shadow: 0 0 12px #0088ff;
}
.ue-floating-word.salamah {
  color: #00e676;
  text-shadow: 0 0 12px #00e676;
}
.ue-floating-word.inspire {
  color: #a855f7;
  text-shadow: 0 0 12px #a855f7;
}
.ue-ambient {
  position: absolute;
  width: 65%;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(85px);
  opacity: 0;
  animation: ueAmbientCharge 1.5s ease-out 0.4s forwards;
}
.ue-ambient-blue {
  left: -35%;
  top: -10%;
  background: #0b5bd3;
}
.ue-ambient-green {
  right: -35%;
  top: 4%;
  background: #0fa34a;
}
.ue-ambient-purple {
  left: 18%;
  bottom: -35%;
  background: #6c2bd9;
}
@keyframes ueAmbientCharge {
  from {
    opacity: 0;
    scale: 0.6;
  }
  to {
    opacity: 0.2;
    scale: 1;
  }
}
.ue-shockwave {
  position: absolute;
  left: 50%;
  top: 45%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    #fffc 0%,
    #0088ff66 30%,
    #a855f733 60%,
    transparent 100%
  );
  transform: translate(-50%, -50%) scale(0);
  animation: ueShockwave 1.2s cubic-bezier(0.1, 0.8, 0.2, 1) forwards;
}
@keyframes ueShockwave {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
    filter: blur(0);
  }
  50% {
    opacity: 0.8;
    filter: blur(8px);
  }
  100% {
    transform: translate(-50%, -50%) scale(150);
    opacity: 0;
    filter: blur(25px);
  }
}
/* Keep the existing layout and content above the decorative background. */
.kiosk > .topbar,
.kiosk > #main,
.kiosk > .bottom-bar {
  position: relative;
  z-index: 1;
}
/* Let the ambient colors and particles remain visible behind existing cards. */
.kiosk {
  background:
    radial-gradient(ellipse at 80% 0%, #172d4299 0, transparent 40%), var(--bg);
}
@media (prefers-reduced-motion: reduce) {
  .ue-ambient {
    animation: none;
    opacity: 0.12;
  }
  .ue-shockwave {
    display: none;
  }
  .ue-floating-word {
    will-change: auto;
  }
}

/* Dynamic colors are supplied from admin-configured catalog values. */
.ue-floating-word {
  opacity: 0.18;
  text-shadow: none !important;
}
.ue-ambient {
  filter: blur(58px);
}
.kiosk > .topbar,
.kiosk > #main,
.kiosk > .bottom-bar {
  position: relative;
  z-index: 1;
}

/* Reduce rendering load while playing video */

body.video-playing .ue-effects {
  display: none !important;
}

body.video-playing .ue-shockwave {
  animation: none !important;
}

body.video-playing .modal {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Floating 3D home cards: soft-edged artwork, character outside card surface.
   Only the visual surface fades; the button retains its full touch target. */
.home .cards {
  overflow: visible;
}
.home .ambassador {
  overflow: visible;
  isolation: isolate;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 24px;
  transform: translateZ(0);
  transition: transform 0.22s ease;
}
.home .ambassador:hover {
  transform: translate3d(0, -3px, 0);
  border-color: transparent;
}
.home .ambassador:active {
  transform: scale(0.99);
}
.home .ambassador::before,
.home .ambassador::after {
  content: none;
}
.home .ambassador .card-surface {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 24px;
  overflow: hidden;
  pointer-events: none;
  background: #102235;
  /* Gradient alpha makes edges dissolve without blurring the whole card. */
  -webkit-mask-image: radial-gradient(
    ellipse 78% 84% at 49% 50%,
    #000 48%,
    rgba(0, 0, 0, 0.94) 65%,
    rgba(0, 0, 0, 0.55) 82%,
    transparent 100%
  );
  mask-image: radial-gradient(
    ellipse 78% 84% at 49% 50%,
    #000 48%,
    rgba(0, 0, 0, 0.94) 65%,
    rgba(0, 0, 0, 0.55) 82%,
    transparent 100%
  );
}
.home .ambassador .card-surface::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    90deg,
    #061224f0 0%,
    #061224e0 28%,
    #06122491 55%,
    #06122420 100%
  );
}
.home .ambassador .card-surface::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(0deg, #020d1d8a, transparent 54%);
}
.home .ambassador .card-bg {
  z-index: 0;
}
.home .ambassador .card-copy {
  z-index: 2;
}
.home .ambassador .character {
  z-index: 3;
  right: 7%;
  bottom: -8%;
  height: 113%;
  width: 43%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 13px 11px rgba(0, 0, 0, 0.38));
  pointer-events: none;
}
.home .ambassador.inspire .character {
  right: 0;
  bottom: 4%;
  height: 92%;
  width: 40%;
  opacity: 1;
}
@media (max-width: 560px) {
  .home .ambassador .card-surface {
    border-radius: 18px;
  }
  .home .ambassador .character {
    right: 7%;
    width: 43%;
    height: 110%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .home .ambassador {
    transition: none;
  }
}

/* Multi-question quiz + leaderboard */
.quiz-welcome,
.quiz-result {
  max-width: 760px;
  margin: auto;
}
.quiz-intro {
  font-size: 20px;
  line-height: 1.65;
  color: var(--muted);
}
.quiz-name-label {
  display: grid;
  gap: 10px;
  font-weight: 700;
  margin: 28px 0 18px;
}
.quiz-name-label input {
  min-height: 62px;
  border: 1px solid #ffffff30;
  border-radius: 14px;
  background: #101f34;
  color: #fff;
  padding: 0 18px;
  font-size: 20px;
}
.quiz-progress {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  margin-bottom: 24px;
}
.quiz-progress progress {
  width: 100%;
  height: 10px;
  accent-color: var(--accent);
}
.answer.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent), transparent 60%);
  background: color-mix(in srgb, var(--accent), #14233a 82%);
}
.quiz-nav {
  display: flex;
  gap: 14px;
  margin-top: 26px;
}
.quiz-nav > * {
  flex: 1;
}
.quiz-score {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 24px;
  margin: 24px 0;
  border: 1px solid #ffffff20;
  border-radius: 20px;
  background: #ffffff08;
}
.quiz-score strong {
  font-size: 56px;
  color: var(--accent);
}
.quiz-score span {
  color: var(--muted);
}
.quiz-leaderboard {
  margin-top: 28px;
  padding: 22px;
  border: 1px solid #ffffff1b;
  border-radius: 18px;
  background: #07111f99;
}
.quiz-leaderboard h3 {
  margin: 0 0 16px;
}
.quiz-leaderboard ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: rank;
}
.quiz-leaderboard li {
  counter-increment: rank;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-top: 1px solid #ffffff12;
}
.quiz-leaderboard li:before {
  content: counter(rank);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffffff0c;
  color: var(--accent);
  font-weight: 800;
}
.quiz-leaderboard li strong {
  flex: 1;
}
.quiz-leaderboard li span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Home card discoverability: gentle sequential touch cue for kiosk users. */
.home .ambassador {
  will-change: transform;
}
.home .ambassador:nth-child(1) {
  --cue-delay: 1.2s;
}
.home .ambassador:nth-child(2) {
  --cue-delay: 4.2s;
}
.home .ambassador:nth-child(3) {
  --cue-delay: 7.2s;
}
.home .ambassador .card-link b {
  animation: ueTapArrow 2.4s ease-in-out infinite;
}
.home .ambassador .card-link::after {
  content: var(--tap-label, "TAP");
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 24px;
  padding: 0 8px;
  margin-left: 2px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--card-accent), transparent 42%);
  background: color-mix(in srgb, var(--card-accent), transparent 88%);
  color: var(--card-accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.4px;
  opacity: 0.72;
  animation: ueTapPill 2.4s ease-in-out infinite;
}
/* A single rise and fall avoids the previous double-step pulse. */
.home .ambassador {
  animation: ueCardAttention 9s cubic-bezier(0.45, 0, 0.25, 1)
    var(--cue-delay, 1.2s) infinite;
}
@keyframes ueCardAttention {
  0%,
  28%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  14% {
    transform: translate3d(0, -4px, 0) scale(1.008);
  }
}
/* Fixed gradient; animate only transform and opacity, with no blur/filter. */
.home .ambassador .card-surface::after {
  inset: -15% -45%;
  background: linear-gradient(
    110deg,
    transparent 36%,
    rgba(255, 255, 255, 0.04) 43%,
    rgba(255, 255, 255, 0.16) 50%,
    rgba(255, 255, 255, 0.04) 57%,
    transparent 64%
  );
  opacity: 0;
  transform: translate3d(-45%, 0, 0);
  animation: ueCardShine 9s cubic-bezier(0.45, 0, 0.25, 1)
    var(--cue-delay, 1.2s) infinite;
}
@keyframes ueCardShine {
  0% {
    opacity: 0;
    transform: translate3d(-45%, 0, 0);
  }
  14% {
    opacity: 0.8;
  }
  28%,
  100% {
    opacity: 0;
    transform: translate3d(45%, 0, 0);
  }
}
body.ue-user-engaged .home .ambassador .card-surface::after {
  animation: none !important;
  opacity: 0;
}
@media (prefers-reduced-motion: reduce) {
  .home .ambassador .card-surface::after {
    animation: none !important;
    opacity: 0;
  }
}
@keyframes ueTapArrow {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(3px, -3px, 0);
  }
}
@keyframes ueTapPill {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(0.98);
  }
  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}
body.ue-user-engaged .home .ambassador,
body.ue-user-engaged .home .ambassador .card-link b,
body.ue-user-engaged .home .ambassador .card-link::after {
  animation: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .home .ambassador,
  .home .ambassador .card-link b,
  .home .ambassador .card-link::after {
    animation: none !important;
    will-change: auto;
  }
}

/* Keep collection cards reachable on short landscape screens. */
@media (max-height: 900px) {
  .hub-head {
    padding: 8px 20px 12px;
  }
  .hub-title {
    margin-top: 8px;
    gap: 12px;
  }
  .hub-title h1 {
    font-size: 26px;
    margin: 4px 0;
    overflow-wrap: anywhere;
  }
  .hub-title p {
    font-size: 14px;
    margin: 4px 0;
  }
  .hub-title img {
    width: 48px;
    height: 64px;
  }
  .hub-title .eyebrow {
    font-size: 12px;
  }
  .filters {
    padding: 4px 20px 12px;
  }
  .hub-scroll {
    min-height: 120px;
    padding-inline: 20px;
  }
  .section-meta {
    padding: 14px 0;
    font-size: 12px;
  }
}

/* SVG controls stay identical on desktop and mobile fonts. */
.ui-icon {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
  flex-shrink: 0;
  pointer-events: none;
}
.brand-mark .ui-icon {
  width: 26px;
  height: 26px;
  vertical-align: 0;
}
.tile-visual .ui-icon {
  width: 32px;
  height: 32px;
}
/* Cover fills the entire card, including the title area. */
.content-card {
  isolation: isolate;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent), #111827 75%),
    #111827
  );
}
.content-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  z-index: -1;
}
.content-card .tile-visual {
  background: transparent;
  flex-shrink: 0;
}
.content-card .tile-copy {
  position: relative;
  background: linear-gradient(
    to bottom,
    rgba(4, 10, 20, 0.16),
    rgba(4, 10, 20, 0.48) 35%,
    rgba(4, 10, 20, 0.7)
  );
  color: var(--text);
}
.content-card .tile-copy h2,
.content-card .tile-copy small,
.content-card .tile-copy p {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  overflow-wrap: anywhere;
}
.content-card .tile-copy p {
  color: #e0e9f5;
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Keep the home labels inside narrow touch targets. */
@media (max-width: 400px) {
  .home .card-link {
    gap: 6px;
    flex-wrap: wrap;
  }
  .home .card-link::after {
    font-size: 9px;
    min-width: 34px;
    padding: 0 5px;
  }
  .home .card-copy h2 {
    font-size: 25px;
  }
  .home .card-copy p {
    font-size: 13px;
  }
}

/* حجم الصورة القديم في الوضع الافتراضي؛ قواعد .brand.has-logo اللاحقة تضبط الشعار الكامل الحالي. */
.app-logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  flex-shrink: 0;
}
[hidden] {
  display: none !important;
}
body.attention-off .home .ambassador,
body.attention-off .home .card-link b,
body.attention-off .home .card-link::after {
  animation: none !important;
  will-change: auto;
}
body.attention-off .home .card-surface::after,
body.shine-off .home .card-surface::after {
  animation: none !important;
  opacity: 0;
}
body.background-off .ue-effects {
  display: none !important;
}
html[dir="rtl"] .card-copy,
html[dir="rtl"] .tile-copy,
html[dir="rtl"] .answer,
html[dir="rtl"] .brand {
  text-align: right;
}
@media (max-width: 560px) {
  .app-logo {
    width: 44px;
    height: 44px;
  }
  .brand #app-name {
    overflow-wrap: anywhere;
    letter-spacing: 1px;
  }
  .brand {
    min-width: 0;
  }
  .header-tools {
    flex-shrink: 0;
  }
}

/* Full identity artwork: preserve the original transparent canvas and aspect ratio. */
.topbar {
  direction: ltr;
}
.brand {
  min-width: 0;
  flex-shrink: 1;
  max-width: 100%;
}
.brand.has-logo {
  width: 250px;
  height: auto;
  max-width: 100%;
  letter-spacing: normal;
  transform: translateY(-12px);
}
.brand.has-logo .app-logo {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  flex-shrink: 1;
}
.header-tools {
  flex-shrink: 0;
}
@media (max-width: 560px) {
  .brand.has-logo {
    width: clamp(135px, 42vw, 170px);
    transform: translateY(-6px);
  }
}
/* البحث العام: حقل ثابت أعلى المحتوى وقائمة نتائج مستقلة لا تزاحم ارتفاع بطاقات الصفحة. */
/* نصوص مساعدة لقارئ الشاشة: مخفية بصريًا مع بقائها مرتبطة بحقول البحث. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.global-search {
  position: relative;
  z-index: 8;
  flex-shrink: 0;
  margin: 0 clamp(20px, 5vw, 64px) 12px;
}
/* حقل البحث المشترك: منطقة إدخال مرنة وزر مسح مستقل، مع حد أدنى مناسب للمس على الجوال. */
.search-field {
  display: flex;
  align-items: center;
  border: 1px solid #ffffff35;
  border-radius: 14px;
  background: #101e30;
  margin-top: 0;
}
.search-field input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px 16px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}
.search-field input::placeholder {
  color: #acbdd3;
  opacity: 1;
}
.search-clear {
  border: 0;
  background: transparent;
  min-width: 48px;
  min-height: 48px;
  color: #d9e8fa;
  font-size: 25px;
  border-radius: 12px;
}
/* نتائج البحث العام تظهر فوق الصفحة؛ ارتفاع القائمة محدود وتمريرها مستقل حتى لا يغير حجم البطاقات. */
.global-search-results {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline: 0;
  border: 1px solid #ffffff35;
  border-radius: 16px;
  background: #101e30;
  box-shadow: 0 18px 45px #0009;
  overflow: hidden;
}
.search-results-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 12px;
  border-bottom: 1px solid #ffffff20;
}
.search-results-head button {
  border: 0;
  background: transparent;
  min-width: 44px;
  min-height: 44px;
  font-size: 24px;
}
.search-result-list {
  max-height: min(50vh, 520px);
  overflow: auto;
  overscroll-behavior: contain;
}
.search-result {
  display: block;
  text-align: start;
  width: 100%;
  padding: 14px 16px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #ffffff12;
  min-height: 64px;
  overflow-wrap: anywhere;
}
.search-result:hover,
.search-result:focus-visible {
  background: #203750;
}
.search-result strong {
  display: block;
  line-height: 1.4;
  font-size: 17px;
}
.search-result small {
  display: block;
  color: #adbed5;
  line-height: 1.5;
  margin-top: 5px;
}
.search-empty {
  padding: 16px;
  line-height: 1.6;
  color: #bccce0;
}
/* بحث الشخصية يبقى فوق أزرار الفلاتر ويشاركها عرض المحتوى ومساحاته الجانبية. */
/* بحث الشخصية أعلى الفلاتر؛ يفحص فقط عناصر الشخصية ويجمع شرط النص مع التصنيف المحدد. */
.section-search {
  flex-shrink: 0;
  margin: 0 clamp(20px, 5vw, 64px) 16px;
}
@media (min-aspect-ratio: 1/1) {
  .global-search {
    margin-inline: 36px;
  }
}
@media (max-width: 560px) {
  .global-search {
    margin-inline: 20px;
    margin-bottom: 8px;
  }
  .section-search {
    margin-inline: 20px;
    margin-bottom: 12px;
  }
  .search-field input {
    font-size: 16px;
  }
}

/* منع ظهور زر مسح المتصفح بجانب زر المسح المخصص؛ يبقى الإدخال type=search للوصول الصحيح. */
.search-field input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

/* البحث العام طبقة جانبية تحت زر العدسة: position:absolute يحافظ على ارتفاع المحتوى والبطاقات عند الفتح والإغلاق. */
.topbar {
  position: relative;
  z-index: 8;
}
.topbar .global-search {
  position: absolute;
  top: calc(100% - 4px);
  inset-inline: clamp(20px, 5vw, 64px);
  margin: 0;
  z-index: 20;
}
@media (min-aspect-ratio: 1/1) {
  .topbar .global-search {
    inset-inline: 36px;
  }
}
@media (max-width: 560px) {
  .topbar .global-search {
    inset-inline: 20px;
  }
  .header-tools {
    gap: 12px;
  }
}

/* أولوية رأس الصفحة أعلى من طبقة المحتوى حتى تكون النتائج مرئية وقابلة للمس. */
.kiosk > .topbar {
  z-index: 8;
}

/* This App Was Designed by Alhajri AM.
 * البوست الطولي: الحالي كبير قابل للقراءة، والمعاينتان مستقيمتان بلا منظور أو ميلان.
 * حاوية التفاصيل وحدها تمرّر المقال الطويل؛ شريط السحب مستقل عن النص وأزرار الفيديو والكويز.
 */
.post-dialog {
  width: min(94vw, calc(94dvh * 0.56), 960px);
  height: 94dvh;
  max-height: 94dvh;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}
.post-dialog .dialog-shell {
  height: 100%;
  max-height: none;
  min-height: 0;
}
.post-dialog .dialog-header {
  padding: 8px 14px;
  min-height: 48px;
  border: 0;
  background: #0c1627ef;
  border-radius: 16px;
  gap: 12px;
}
.post-dialog .dialog-header .icon-button {
  min-width: 42px;
  min-height: 42px;
  width: 42px;
  height: 42px;
}
.post-feed {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 8px;
  padding-top: 8px;
}
.feed-current {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--accent);
  border-radius: 22px;
  background: #0c1627;
  overflow: hidden;
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent), transparent 82%);
}
.feed-preview {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 94%;
  height: clamp(52px, 7dvh, 82px);
  min-height: 52px;
  flex-shrink: 0;
  border: 1px solid #ffffff35;
  border-radius: 14px;
  padding: 8px 14px;
  background: #102035;
  text-align: start;
  opacity: 0.62;
  transform: none;
  overflow: hidden;
}
.feed-preview:hover,
.feed-preview:focus-visible {
  opacity: 1;
  border-color: var(--accent);
}
.feed-preview:disabled {
  opacity: 0.36;
  cursor: default;
}
.feed-preview > span {
  min-width: 0;
  flex: 1;
}
.feed-preview small {
  display: block;
  font-size: 11px;
  color: #b6cadf;
  margin-bottom: 4px;
}
.feed-preview strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(14px, 2vw, 21px);
}
.feed-preview img {
  width: 64px;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.feed-preview .feed-kind-icon {
  flex: 0 0 36px;
  color: var(--accent);
  display: grid;
  place-items: center;
}
.feed-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid #ffffff18;
  color: var(--accent);
  font-size: 12px;
  flex-shrink: 0;
}
#feed-ambassador {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
#feed-ambassador img {
  width: 26px;
  height: 32px;
  object-fit: contain;
}
.post-dialog #detail-body {
  flex: 1;
  min-height: 0;
  padding: 20px;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-width: thin;
}
.post-dialog .reader img {
  max-height: 42dvh;
  width: 100%;
  height: auto;
  object-fit: contain;
}
.post-dialog .body-text {
  font-size: clamp(17px, 2.1vw, 24px);
}
.post-dialog .reader h2,
.post-dialog .quiz h2 {
  font-size: clamp(25px, 3vw, 38px);
}
.post-dialog .video-stage {
  max-height: 46dvh;
  min-height: 180px;
}
.post-dialog .video-caption {
  font-size: clamp(21px, 2.5vw, 30px);
}
.feed-swipe {
  flex-shrink: 0;
  min-height: 26px;
  display: grid;
  place-items: center;
  padding: 4px;
  color: #a9c3df;
  font-size: 12px;
  touch-action: none;
  user-select: none;
  border-radius: 8px;
  cursor: ns-resize;
}
.feed-enter {
  animation: feedEnter 0.2s ease-out;
}
@keyframes feedEnter {
  from {
    opacity: 0.6;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* رسم نافذة صغيرة من بطاقات الشبكة. ارتفاع ثابت يحافظ على التمرير عند حذف العناصر خارج الشاشة من DOM. */
.virtual-grid {
  --virtual-card-height: 280px;
}
.virtual-grid .content-card {
  height: var(--virtual-card-height);
  min-height: var(--virtual-card-height);
}
.virtual-grid .tile-visual {
  height: 112px;
  flex-shrink: 0;
}
.virtual-grid .tile-copy {
  padding: 14px;
  min-height: 0;
}
.virtual-grid .tile-copy small {
  font-size: 11px;
}
.virtual-grid .tile-copy h2 {
  font-size: 22px;
  line-height: 1.2;
  margin: 8px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.virtual-grid .tile-copy p {
  font-size: 14px;
}
.virtual-spacer {
  grid-column: 1/-1;
  pointer-events: none;
}
.content-load-more {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 14px 0;
  padding: 10px 16px;
  border: 1px solid #ffffff30;
  border-radius: 12px;
  background: #102035;
  color: var(--text);
}
.search-result {
  height: 84px;
  min-height: 84px;
  overflow: hidden;
}
.search-result strong,
.search-result small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 560px) {
  .post-dialog #detail-body {
    padding: 16px;
  }
  .feed-meta {
    padding: 8px 14px;
  }
  .feed-preview {
    gap: 8px;
  }
  .feed-preview img {
    width: 48px;
  }
  .virtual-grid {
    --virtual-card-height: 260px;
  }
  .virtual-grid .tile-copy h2 {
    font-size: 19px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .feed-enter {
    animation: none;
  }
}
.virtual-grid > .empty {
  grid-column: 1 / -1;
}
/* عرض الفيديو يملأ عرض البطاقة، ونسبته تأتي من بيانات الوسيط؛ object-fit:contain يحفظ الصورة كاملة. */
.post-dialog .video-stage {
  width: 100%;
  aspect-ratio: 16 / 9;
}

/* توسيع البوست في شاشات العرض مع إبقاء هوامش الجوال؛ المعاينتان مستقيمتان ومتطابقتان. */
.post-dialog {
  width: min(94vw, calc(94dvh * 0.76), 1400px);
}
@media (min-aspect-ratio: 1/1) and (min-width: 800px) {
  .post-dialog {
    width: min(76vw, 1200px);
  }
}
.feed-svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: block;
}
.feed-preview {
  opacity: 0.8;
  background: linear-gradient(120deg, #132b43, #0e1c30);
  border-color: #ffffff45;
  transition:
    background 0.18s,
    border-color 0.18s,
    box-shadow 0.18s;
  gap: 14px;
}
.feed-preview .feed-nav-direction {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent), transparent 83%);
  color: var(--accent);
}
.feed-preview .feed-preview-copy {
  flex: 1;
  min-width: 0;
}
.feed-preview:hover:not(:disabled),
.feed-preview:focus-visible {
  background: #1b354f;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent), transparent 60%);
  opacity: 1;
}
.feed-preview:active:not(:disabled) {
  background: #244563;
}
.feed-preview:disabled .feed-nav-direction {
  background: #ffffff0c;
  color: #9aafc2;
}
.feed-swipe {
  display: flex;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
}
.feed-swipe .feed-svg {
  width: 18px;
  height: 18px;
}
.post-dialog button.primary,
.post-dialog button.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 14px;
  min-height: 48px;
  transition:
    filter 0.18s,
    box-shadow 0.18s;
}
.post-dialog button.primary:hover,
.post-dialog button.secondary:hover {
  filter: brightness(1.14);
}
.post-dialog button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
/* إطار فيديو 9:16 لجميع المصادر، مع قص الأطراف دون تمديد الصورة. */
.post-dialog .video-stage {
  width: min(100%, calc(58dvh * 9 / 16));
  height: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: 9 / 16;
  margin-inline: auto;
  touch-action: pan-y;
}
.post-dialog .video-stage video {
  object-fit: cover;
  object-position: center;
}
@media (max-width: 560px) {
  .feed-preview {
    gap: 8px;
    padding-inline: 10px;
  }
  .feed-preview .feed-nav-direction {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }
  .feed-preview .feed-svg {
    width: 21px;
    height: 21px;
  }
  .post-dialog .video-stage {
    width: min(100%, calc(51dvh * 9 / 16));
  }
}
@media (prefers-reduced-motion: reduce) {
  .feed-preview,
  .post-dialog button.primary,
  .post-dialog button.secondary {
    transition: none;
  }
}

/* أدوات الفيديو داخل الإطار؛ الألوان والمسافات تتبع هوية الشخصية. */
.post-dialog .video-stage { border: 1px solid #ffffff24; box-shadow: 0 12px 32px #00000030; }
.post-dialog .video-controls { position: absolute; top: 12px; right: 12px; z-index: 2; display: flex; flex-wrap: nowrap; gap: 8px; margin: 0; direction: ltr; }
.post-dialog .video-controls .video-overlay-button { display: grid; place-items: center; flex: none; width: 48px; height: 48px; min-width: 48px; min-height: 48px; padding: 0; border-radius: 50%; border: 1px solid #ffffff66; color: #fff; background: #0c162799; backdrop-filter: blur(10px); box-shadow: 0 3px 12px #00000035; }
.post-dialog .video-controls button:hover { background: #0c1627cc; }
.post-dialog .video-controls button:active { transform: scale(.96); }
.post-dialog .video-controls button:disabled { opacity: .5; }
.post-dialog .video-controls button span { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.post-dialog .video-message { z-index: 1; padding: 12px 16px; font-size: 14px; }
.post-dialog .reel { max-width: 680px; margin-inline: auto; }
.post-dialog .video-progress { display: block; min-height: 44px; margin: 4px 0 0; cursor: pointer; }
.post-dialog .video-caption { margin: 6px 0 8px; line-height: 1.35; }
.post-dialog .video-meta { font-size: 12px; line-height: 1.6; }
.post-dialog .feed-current { border-color: color-mix(in srgb, var(--accent), transparent 45%); background: linear-gradient(155deg, #102035, #0c1627); box-shadow: 0 16px 48px #00000040; }
.post-dialog .reader { max-width: 760px; margin-inline: auto; }
.post-dialog .reader h2 { line-height: 1.3; }
.post-dialog .reader img { border-radius: 14px; margin-block: 12px; }
.post-dialog .body-text { line-height: 1.85; }
@media (max-width: 560px) { .post-dialog #detail-body { padding: 12px; } .post-dialog .video-controls { top: 10px; right: 10px; } }

/* عنوان الفيديو وبياناته داخل الصورة فوق ظل متدرج شفاف. */
.post-dialog .video-copy { position: absolute; inset: auto 0 0; z-index: 1; padding: 48px 18px 18px; max-height: 48%; overflow-y: auto; background: linear-gradient(to bottom, transparent, rgba(4, 10, 20, .55) 35%, rgba(4, 10, 20, .86)); color: #fff; text-align: start; overflow-wrap: anywhere; scrollbar-width: thin; }
.post-dialog .video-copy .video-caption { margin: 0 0 8px; font-size: clamp(18px, 2.4vw, 28px); line-height: 1.4; color: #fff; text-shadow: 0 2px 5px #0009; }
.post-dialog .video-copy .video-meta { color: #edf3fa; font-size: clamp(11px, 1.4vw, 14px); text-shadow: 0 1px 4px #0009; }
.post-dialog .video-message { z-index: 3; }
@media (max-width: 560px) { .post-dialog .video-copy { padding: 36px 14px 14px; } }

/* الفيديو يملأ منطقة reel؛ شريط التقدم مدمج في الحافة السفلى. */
.post-dialog .reel { width: 100%; max-width: none; }
.post-dialog .reel .video-stage { width: 100%; margin: 0; }
.post-dialog .video-stage .video-progress { position: absolute; z-index: 2; bottom: 0; left: 12px; width: calc(100% - 24px); height: 44px; min-height: 44px; margin: 0; padding: 0; background: transparent; direction: ltr; touch-action: none; }
.post-dialog .video-copy { padding-bottom: 52px; }
.post-dialog .video-message { bottom: 52px; }
@media (max-width: 560px) { .post-dialog .video-copy { padding-bottom: 52px; } }

/* حجم الفيديو مرتبط بالمساحة المتاحة بعد الرأس ومعاينات التنقل. */
.post-dialog #detail-body.video-view { display: grid; place-items: center; overflow: hidden; container-type: size; padding: 8px; touch-action: manipulation; }
.post-dialog .video-view .reel { width: min(100cqw, calc(100cqh * 9 / 16)); height: min(100cqh, calc(100cqw * 16 / 9)); min-height: 0; margin: 0; }
.post-dialog .video-view .video-stage { width: 100%; height: 100%; max-height: none; min-height: 0; margin: 0; aspect-ratio: 9 / 16; }
.post-dialog .video-view .video-copy { overflow: hidden; max-height: 52%; padding-top: 24px; }
.post-dialog .video-view .video-caption { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: clamp(16px, 2.2cqw, 26px); }
.post-dialog .video-view .video-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@supports not (width: 1cqw) { .post-dialog .video-view .reel { width: min(100%, calc(46dvh * 9 / 16)); height: auto; } .post-dialog .video-view .video-stage { height: auto; } }

/* شريط موحد لبيانات المحتوى وزر الإغلاق. */
.post-dialog .feed-meta { gap: 10px; padding: 10px 14px; min-height: 64px; }
.post-dialog #feed-ambassador { flex: 1; min-width: 0; }
.post-dialog #feed-ambassador span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-dialog .feed-meta-details { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; flex-shrink: 0; font-size: 12px; }
.post-dialog #detail-type { color: #d9e5f3; }
.post-dialog .feed-meta #close-detail { flex: 0 0 48px; width: 48px; height: 48px; min-width: 48px; min-height: 48px; display: grid; place-items: center; border: 1px solid #ffffff30; border-radius: 50%; background: #ffffff08; color: #ecf3ff; padding: 0; }
.post-dialog .feed-meta #close-detail:hover { background: #ffffff18; }
@media (max-width: 560px) { .post-dialog .feed-meta { padding: 8px 10px; gap: 8px; } .post-dialog .feed-meta-details { font-size: 11px; } }

/* نصوص الفيديو تظهر عند اللمس أو Pause وتختفي أثناء المشاهدة. */
.post-dialog .video-copy { opacity: 1; transition: opacity .65s ease; pointer-events: none; }
.post-dialog .video-copy-hidden .video-copy { opacity: 0; }
.post-dialog .video-view .video-stage { touch-action: none; }
@media (prefers-reduced-motion: reduce) { .post-dialog .video-copy { transition: none; } }

/* أدوات التشغيل والصوت تتبع توقيت ظهور نصوص الفيديو نفسه. */
.post-dialog .video-controls { opacity: 1; transition: opacity .65s ease; }
.post-dialog .video-copy-hidden .video-controls { opacity: 0; pointer-events: none; }
.post-dialog .video-copy-hidden .video-controls:has(button:focus-visible) { opacity: 1; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .post-dialog .video-controls { transition: none; } }
