:root {
  --green-950: #031f1b;
  --green-900: #00343A;
  --green-850: #07372d;
  --green-800: #0b4639;
  --paper: #f6f0e4;
  --paper-muted: #c7d0c8;
  --line: rgba(226, 235, 218, 0.18);
  --line-strong: rgba(226, 235, 218, 0.32);
  --active-accent: #d95786;
}

* { box-sizing: border-box; }

html, body, #game-container { width: 100%; min-height: 100%; }

html, body {
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--green-900);
  color: var(--paper);
  font-family: 'Cairo', sans-serif;
}

button { font: inherit; }

#game-container {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  isolation: isolate;
  overflow: hidden;
  background-color: #00343A;
  background-image: url('assets/الخلفية-1-2.png');
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

#game-container::before,
#game-container::after {
  content: '';
  position: absolute;
  z-index: -1;
  pointer-events: none;
}

#game-container::before {
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(30deg, rgba(217, 87, 134, 0.08) 12%, transparent 12.5%, transparent 87%, rgba(217, 87, 134, 0.08) 87.5%, rgba(217, 87, 134, 0.08)),
    linear-gradient(150deg, rgba(217, 87, 134, 0.08) 12%, transparent 12.5%, transparent 87%, rgba(217, 87, 134, 0.08) 87.5%, rgba(217, 87, 134, 0.08));
  background-size: 84px 146px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.45), transparent 38%);
}

#game-container::after {
  width: 42vw;
  height: 42vw;
  min-width: 340px;
  min-height: 340px;
  left: -18vw;
  bottom: -25vw;
  border: 1px solid rgba(238, 190, 84, 0.2);
  transform: rotate(45deg);
  box-shadow: 0 0 0 22px rgba(238, 190, 84, 0.03), 0 0 0 46px rgba(238, 190, 84, 0.025);
}

#game-container:has(.identity-home) {
  background-image: url('assets/الخلفية-5.png');
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}

#game-container:has(.identity-home)::before,
#game-container:has(.identity-home)::after {
  display: none;
}

#ui-layer {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: clamp(14px, 2.7vh, 26px) clamp(18px, 5vw, 84px) clamp(12px, 2.3vh, 22px);
  position: relative;
  overflow: hidden;
}

.identity-home {
  width: min(1420px, 100%);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  --active-accent: #d95786;
}

.site-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: clamp(38px, 6vh, 48px);
  direction: rtl;
  border-bottom: 1px solid var(--line);
  padding-bottom: clamp(8px, 2vh, 19px);
}

.header-mark {
  width: 35px;
  height: 35px;
  display: block;
  flex: 0 0 35px;
  object-fit: contain;
}

.header-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.header-copy span { color: #a9c1b3; font-size: 0.68rem; letter-spacing: 0.04em; }
.header-copy strong { color: var(--paper); font-size: 0.82rem; font-weight: 700; }

.header-status {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #a9c1b3;
  font-size: 0.76rem;
}

.header-status i {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: #72bd63;
  box-shadow: 0 0 12px #72bd63;
}

.hero-section {
  flex: 0 0 auto;
  text-align: center;
  padding: clamp(4px, 0.9vh, 10px) 20px clamp(6px, 1vh, 12px);
}

.hero-title-image {
  display: block;
  width: min(100%, clamp(620px, 68vw, 980px));
  height: auto;
  max-height: clamp(220px, 34vh, 340px);
  margin: 0 auto;
  object-fit: contain;
  object-position: center;
}


.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #e5b34b;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.hero-kicker span {
  width: 30px;
  height: 1px;
  background: #e5b34b;
  display: inline-block;
}

.hero-section h1 {
  margin: clamp(8px, 1.6vh, 14px) 0 2px;
  color: var(--paper);
  font-size: clamp(2.7rem, 7vh, 5.6rem);
  line-height: 1.08;
  font-weight: 900;
  letter-spacing: -0.045em;
  text-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.hero-section p {
  margin: 0;
  color: var(--paper-muted);
  font-size: clamp(0.95rem, 1.6vw, 1.2rem);
  font-weight: 400;
}

.hero-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: clamp(6px, 1.2vh, 12px);
}

.hero-rule span { width: 62px; height: 2px; background: var(--active-accent); transition: background 300ms ease; }
.hero-rule b { width: 5px; height: 5px; background: #e5b34b; transform: rotate(45deg); }

.identity-section {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  background: rgba(3, 31, 27, 0.32);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: clamp(12px, 2.4vh, 22px) 0 clamp(10px, 2.2vh, 21px);
}

.section-heading {
  flex: 0 0 auto;
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: clamp(9px, 1.8vh, 17px);
  direction: rtl;
}

.eyebrow {
  display: block;
  color: #e5b34b;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin-bottom: 2px;
}

.section-heading h2 { margin: 0; font-size: 1.5rem; line-height: 1; font-weight: 800; }
.identity-count { color: #91aaa0; font-size: 0.72rem; }

.identity-grid {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
  gap: clamp(8px, 1vw, 12px);
  direction: rtl;
}

.identity-card {
  --accent: #d95786;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(218, 231, 219, 0.16);
  border-radius: 4px;
  background: rgba(7, 55, 45, 0.74);
  color: var(--paper);
  text-align: right;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 260ms ease, border-color 260ms ease, box-shadow 260ms ease, background 260ms ease;
}

.identity-card::before {
  content: '';
  height: 3px;
  width: 100%;
  background: var(--accent);
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  opacity: 0.85;
}

.identity-card:hover,
.identity-card:focus-visible,
.identity-card.is-selected {
  transform: translateY(-7px);
  border-color: var(--accent);
  background: rgba(8, 66, 52, 0.98);
  box-shadow: 0 18px 34px rgba(0,0,0,0.2), 0 0 0 1px color-mix(in srgb, var(--accent), transparent 70%), 0 0 28px color-mix(in srgb, var(--accent), transparent 82%);
  outline: none;
}

.card-number {
  position: absolute;
  top: 13px;
  left: 14px;
  z-index: 3;
  color: rgba(246, 240, 228, 0.74);
  direction: ltr;
  font-family: Inter, sans-serif;
  font-size: 0.64rem;
  letter-spacing: 0.12em;
}

.image-frame {
  flex: 1 1 0;
  min-height: 0;
  display: block;
  padding: clamp(8px, 1.3vw, 16px) clamp(7px, 1vw, 13px) clamp(5px, 0.7vw, 8px);
  position: relative;
  overflow: hidden;
  background: rgba(3, 31, 27, 0.82);
}

.image-frame::after {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 48%);
  opacity: 0.55;
  pointer-events: none;
}

.image-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  position: relative;
  z-index: 1;
  transition: transform 400ms cubic-bezier(.2,.8,.2,1), filter 300ms ease;
}

.image-wash {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 64%, rgba(3, 31, 27, 0.34));
}

.identity-card:hover .image-frame img,
.identity-card.is-selected .image-frame img { transform: scale(1.035); filter: saturate(1.06); }

.card-caption {
  flex: 0 0 clamp(64px, 9vh, 83px);
  min-height: 64px;
  padding: clamp(7px, 1.3vh, 10px) clamp(9px, 1vw, 14px) clamp(9px, 1.8vh, 14px);
  display: flex;
  flex-direction: column;
  position: relative;
  direction: rtl;
  border-top: 1px solid rgba(225, 236, 223, 0.12);
}

.card-caption small { color: color-mix(in srgb, var(--accent), white 18%); font-size: 0.63rem; line-height: 1.3; font-weight: 700; }
.card-caption strong { color: var(--paper); font-size: clamp(0.85rem, 1.4vw, 1.06rem); line-height: 1.55; font-weight: 800; }
.card-arrow { color: var(--accent); position: absolute; left: 14px; bottom: 15px; font-family: Inter, sans-serif; font-size: 1rem; opacity: 0.9; }

.future-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 630px;
  margin: 15px auto 0;
  direction: rtl;
}

.future-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px dashed rgba(213, 225, 211, 0.22);
  color: rgba(246, 240, 228, 0.58);
  background: rgba(3, 31, 27, 0.22);
  border-radius: 4px;
}

.future-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(213, 225, 211, 0.3);
  color: rgba(246, 240, 228, 0.65);
  font-size: 1rem;
  line-height: 1;
}

.future-card div { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.35; }
.future-card strong { font-size: 0.79rem; font-weight: 700; }
.future-card small { color: #9aae9f; font-size: 0.62rem; }

.home-footer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 20px;
  color: #8fa99b;
  font-size: 0.68rem;
  direction: rtl;
}

.home-footer span:first-child { color: #e5b34b; font-weight: 700; }
.footer-divider { width: 4px; height: 4px; border-radius: 50%; background: var(--active-accent); transition: background 300ms ease; }
.home-credit,
.home-tiktok {
  position: absolute;
  top: 20px;
  color: inherit;
  font: inherit;
  font-weight: 400;
  line-height: inherit;
  white-space: nowrap;
}
.home-credit {
  right: 0;
  font-size: 1.03em;
  font-weight: 500;
  text-shadow: 0 0 7px rgba(3, 31, 27, 0.3);
}
.home-tiktok { left: 0; }

@media (max-width: 1180px) {
  #ui-layer { padding-inline: clamp(18px, 3.2vw, 32px); }
  .identity-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }
  .section-heading h2 { font-size: clamp(1.2rem, 2.5vw, 1.5rem); }
  .card-caption { flex-basis: clamp(64px, 8.5vh, 76px); }
  .card-caption strong { font-size: clamp(0.82rem, 1.55vw, 1.02rem); }
  .card-arrow { left: 11px; bottom: 12px; }
}

@media (max-width: 620px) {
  #ui-layer { padding: 12px 14px; }
  .site-header { gap: 10px; }
  .header-mark { width: 30px; height: 30px; flex-basis: 30px; }
  .header-copy span { font-size: 0.6rem; }
  .header-copy strong { font-size: 0.72rem; }
  .header-status { font-size: 0.65rem; }
  .hero-section { padding-block: 6px 7px; }
  .hero-section h1 { font-size: clamp(2.5rem, 7vh, 4.1rem); }
  .hero-title-image {
    width: min(100%, 94vw);
    max-height: clamp(145px, 27vh, 220px);
  }
  .hero-section p { font-size: 0.85rem; }
  .identity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .identity-section { padding-block: 10px 9px; }
  .section-heading { margin-bottom: 8px; }
  .section-heading h2 { font-size: 1.15rem; }
  .identity-count { font-size: 0.62rem; }
  .card-caption {
    flex-basis: clamp(58px, 8.5vh, 68px);
    min-height: 58px;
    padding: 6px 9px 8px;
  }
  .card-caption small { font-size: 0.57rem; }
  .card-caption strong { font-size: clamp(0.7rem, 3.2vw, 0.85rem); line-height: 1.4; }
  .card-arrow { left: 9px; bottom: 9px; font-size: 0.85rem; }
  .card-number { top: 9px; left: 9px; font-size: 0.56rem; }
  .image-frame { padding: 8px 6px 5px; }
  .image-frame::after { inset: 6px; }
  .home-footer { padding-top: 9px; font-size: 0.56rem; gap: 6px; }
  .home-credit,
  .home-tiktok { top: 9px; }
}

@media (max-height: 680px) {
  .hero-section { padding-block: 5px 6px; }
  .hero-title-image { max-height: clamp(175px, 32vh, 300px); }
  .hero-section h1 { font-size: clamp(2.35rem, 7vh, 4rem); }
  .identity-section { padding-block: 9px 8px; }
  .home-footer { padding-top: 8px; }
  .home-credit,
  .home-tiktok { top: 8px; }
}

@media (min-width: 768px) and (max-width: 1180px) and (pointer: coarse) {
  .identity-card { min-height: 112px; }
  .card-caption { flex-basis: clamp(68px, 9vh, 78px); }
  .card-caption strong { font-size: clamp(0.9rem, 1.7vw, 1.08rem); }
}

/* هوية البطاقات الرئيسية — تكبير محدود وواضح للكمبيوتر والآيباد فقط. */
@media (min-width: 768px) {
  .identity-card {
    transform: scale(1.025);
  }

  .identity-card:hover,
  .identity-card:focus-visible,
  .identity-card.is-selected {
    transform: translateY(-7px) scale(1.025);
  }

  .image-frame {
    padding: clamp(6px, 1vw, 12px) clamp(5px, 0.8vw, 10px) clamp(4px, 0.55vw, 7px);
  }

  .image-frame img {
    transform: scale(1.055);
  }

  .identity-card:hover .image-frame img,
  .identity-card.is-selected .image-frame img {
    transform: scale(1.095);
  }
}

/* أصالتنا — independent question-card prototype */
.asala-screen {
  --asala-lime: #a5c83b;
  --asala-green: #0a6e42;
  --asala-deep: #00343a;
  --asala-ink: #00343a;
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  color: #00343a;
  background-color: #0b2625;
  background-image: url('assets/السؤال-الاول-1.png');
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.asala-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -3;
  opacity: 0.1;
  background-image: linear-gradient(45deg, transparent 47%, rgba(165, 200, 59, 0.55) 48%, transparent 50%);
  background-size: 78px 78px;
  mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent);
}

.asala-screen::after {
  content: '';
  position: absolute;
  width: min(72vw, 980px);
  height: min(72vw, 980px);
  left: 50%;
  top: 51%;
  z-index: -4;
  border: 1px solid rgba(165, 200, 59, 0.24);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 34px rgba(165, 200, 59, 0.035), 0 0 0 72px rgba(165, 200, 59, 0.025);
}

.asala-ambient {
  position: absolute;
  z-index: -2;
  width: 28vw;
  height: 28vw;
  min-width: 240px;
  min-height: 240px;
  border: 1px solid rgba(165, 200, 59, 0.18);
  transform: rotate(45deg);
  pointer-events: none;
}

.asala-ambient-one { top: -17vw; right: -8vw; }
.asala-ambient-two { bottom: -19vw; left: -10vw; border-color: rgba(42, 179, 104, 0.2); }

/* Question 2 background: a soft crossfade layer over the section's original backdrop. */
.asala-q2-background {
  position: absolute;
  inset: -2.5%;
  z-index: -5;
  width: 105%;
  height: 105%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  filter: saturate(0.9) brightness(0.78);
  transform: scale(1.045) translate3d(0, 8px, 0);
  transform-origin: center;
  transition: opacity 1500ms cubic-bezier(.2, .72, .2, 1), transform 1800ms cubic-bezier(.2, .72, .2, 1), filter 1500ms ease;
  will-change: opacity, transform, filter;
  pointer-events: none;
}

/* Question 3 background: the newly added full-screen heritage composition. */
.asala-q3-background {
  position: absolute;
  inset: -2.5%;
  z-index: -5;
  width: 105%;
  height: 105%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  filter: saturate(0.9) brightness(0.78);
  transform: scale(1.045) translate3d(0, 8px, 0);
  transform-origin: center;
  transition: opacity 1500ms cubic-bezier(.2, .72, .2, 1), transform 1800ms cubic-bezier(.2, .72, .2, 1), filter 1500ms ease;
  will-change: opacity, transform, filter;
  pointer-events: none;
}

/* Question 5 background video: muted, full-bleed, and non-interactive. */
.asala-q5-background {
  position: absolute;
  inset: -2.5%;
  z-index: -5;
  width: 105%;
  height: 105%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  filter: saturate(0.9) brightness(0.78);
  transform: scale(1.045) translate3d(0, 8px, 0);
  transform-origin: center;
  transition: opacity 1500ms cubic-bezier(.2, .72, .2, 1), transform 1800ms cubic-bezier(.2, .72, .2, 1), filter 1500ms ease;
  will-change: opacity, transform, filter;
  pointer-events: none;
}

.asala-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 21, 25, 0.18) 100%);
}

.asala-manuscript {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 46px;
  width: clamp(105px, 11vw, 150px);
  height: auto;
  object-fit: contain;
  opacity: 1;
  filter: saturate(0.92) drop-shadow(0 6px 12px rgba(0, 18, 20, 0.22));
  transform: translateX(-50%);
  transition: transform 520ms cubic-bezier(.2,.8,.2,1), filter 520ms ease;
  pointer-events: none;
}

.asala-diriyah {
  position: absolute;
  z-index: 9;
  left: clamp(6px, 1.5vw, 22px);
  right: auto;
  top: auto;
  bottom: clamp(6px, 1.2vh, 14px);
  width: min(42vw, 560px);
  max-height: 44vh;
  object-fit: contain;
  object-position: left bottom;
  opacity: 1;
  filter: saturate(1.08) contrast(1.08) brightness(1) drop-shadow(0 12px 22px rgba(0, 18, 20, 0.42));
  transform: translate3d(0, 0, 0) scale(1);
  animation: diriyah-breathe 8s ease-in-out infinite;
  transition: left 520ms cubic-bezier(.2,.8,.2,1), filter 520ms ease, opacity 260ms ease;
  pointer-events: none;
}

.asala-ceramic,
.asala-vase,
.asala-q2-corner {
  position: absolute;
  top: auto;
  object-fit: contain;
  object-position: left bottom;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 420ms ease, transform 520ms cubic-bezier(.2,.8,.2,1), visibility 0s linear 420ms;
}

.asala-ceramic {
  z-index: 8;
  left: clamp(14px, 2.5vw, 36px);
  bottom: clamp(8px, 1.6vh, 18px);
  width: min(32vw, 400px);
  max-height: 34vh;
  filter: saturate(1.04) contrast(1.05) drop-shadow(0 12px 20px rgba(0, 18, 20, 0.38));
  transform: translate3d(-10px, 8px, 0) scale(0.96);
}

.asala-vase {
  z-index: 9;
  left: clamp(8px, 1.6vw, 24px);
  bottom: clamp(-280px, -24vh, -170px);
  width: min(47vw, 600px);
  max-height: 92vh;
  filter: saturate(1.06) contrast(1.06) drop-shadow(0 18px 28px rgba(0, 18, 20, 0.46));
  transform: translate3d(-8px, 8px, 0) scale(0.94);
}

.asala-q2-corner {
  z-index: 9;
  right: clamp(8px, 1.6vw, 24px);
  bottom: clamp(-170px, -14vh, -90px);
  width: min(55vw, 740px);
  max-height: 100vh;
  object-position: right bottom;
  filter: saturate(0.96) contrast(1.08) drop-shadow(0 18px 28px rgba(0, 18, 20, 0.46));
  transform: translate3d(8px, 8px, 0) scale(0.94);
}


.asala-header {
  flex: 0 0 auto;
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  width: min(1380px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(16px, 3vh, 30px) 0 clamp(10px, 2vh, 18px);
  border-bottom: 1px solid rgba(210, 231, 155, 0.2);
  direction: ltr;
}

.asala-back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border: 1px solid rgba(210, 231, 155, 0.34);
  border-radius: 2px;
  color: #eaf0cf;
  background: rgba(3, 35, 31, 0.34);
  cursor: pointer;
  direction: rtl;
  transition: border-color 220ms ease, background 220ms ease, transform 220ms ease;
}

.asala-back:hover, .asala-back:focus-visible { border-color: var(--asala-lime); background: rgba(165, 200, 59, 0.14); transform: translateY(-2px); outline: none; }
.asala-back span { color: var(--asala-lime); font-size: 1.25rem; line-height: 1; }
.asala-back b { font-size: 0.78rem; font-weight: 700; }

.asala-heading { display: grid; place-items: center; min-width: 84px; }
.asala-heading i { display: block; width: 56px; height: 8px; border-top: 1px solid rgba(165, 200, 59, 0.72); border-bottom: 1px solid rgba(165, 200, 59, 0.28); transform: skewX(-28deg); }

.asala-progress { justify-self: end; display: flex; align-items: baseline; gap: 7px; color: #b4cba1; direction: ltr; font-family: Inter, sans-serif; }
.asala-progress strong { color: #f5f3df; font-size: clamp(1.6rem, 3vw, 2.3rem); line-height: 1; }
.asala-progress span { font-size: 0.8rem; opacity: 0.7; }

.asala-stage {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1500px;
  overflow: hidden;
}

.asala-stage-label {
  position: absolute;
  top: clamp(12px, 2vh, 22px);
  left: 50%;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(229, 239, 201, 0.58);
  font-size: 0.72rem;
  transform: translateX(-50%);
  white-space: nowrap;
  direction: rtl;
}
.asala-stage-label span { width: 26px; height: 1px; background: rgba(165, 200, 59, 0.55); }

.asala-deck {
  --drag-x: 0px;
  --drag-tilt: 0deg;
  position: relative;
  width: min(100%, 980px);
  height: min(66vh, 590px);
  min-height: 390px;
  transform-style: preserve-3d;
  touch-action: pan-y;
  user-select: none;
  cursor: grab;
  isolation: isolate;
}
.asala-deck[data-dragging="true"] { cursor: grabbing; }

.asala-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(290px, 42vw, 520px);
  height: min(100%, 570px);
  transform-style: preserve-3d;
  transform-origin: 50% 50% -58px;
  pointer-events: none;
  opacity: 0;
  transition: transform 650ms cubic-bezier(.18,.82,.2,1), opacity 480ms ease, filter 650ms ease;
  will-change: transform, opacity;
}

.asala-card::before {
  content: '';
  position: absolute;
  inset: 9px -12px -14px 12px;
  z-index: -1;
  border: 1px solid rgba(165, 200, 59, 0.2);
  border-radius: 5px;
  background: linear-gradient(135deg, rgba(40, 117, 70, 0.82), rgba(3, 42, 37, 0.9));
  box-shadow: 14px 18px 28px rgba(0, 15, 13, 0.25);
  transform: translateZ(-22px) rotateZ(1.2deg);
  pointer-events: none;
}

.asala-card-surface {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(165, 200, 59, 0.72);
  border-radius: 4px;
  background: #ffffff;
  box-shadow: 0 30px 58px rgba(0, 19, 16, 0.52), 0 0 0 7px rgba(165, 200, 59, 0.05), inset 0 0 0 1px rgba(0, 52, 58, 0.1);
  transform: translateZ(6px);
  transform-style: preserve-3d;
}

.asala-card-surface::before {
  content: '';
  position: absolute;
  inset: 11px;
  z-index: 4;
  border: 1px solid rgba(204, 229, 116, 0.46);
  pointer-events: none;
}
.asala-card-surface::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  background: linear-gradient(108deg, rgba(255,255,255,0.62), transparent 24%, transparent 76%, rgba(0, 52, 58, 0.06));
  pointer-events: none;
}

.asala-card-shade { position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(242, 248, 237, 0.18) 86%), linear-gradient(90deg, rgba(165, 200, 59, 0.06), transparent 45%, rgba(0, 52, 58, 0.04)); }
.asala-card-border { position: absolute; inset: 0; z-index: 2; background: linear-gradient(135deg, rgba(190, 229, 89, 0.22), transparent 25%, transparent 74%, rgba(190, 229, 89, 0.18)); pointer-events: none; }

.asala-card-topline, .asala-card-foot { position: absolute; left: 30px; right: 30px; z-index: 5; display: flex; align-items: center; justify-content: space-between; direction: rtl; }
.asala-card-topline { top: 27px; color: #4c751a; font-size: clamp(0.56rem, 0.75vw, 0.68rem); font-weight: 800; letter-spacing: 0.02em; line-height: 1.2; }
.asala-card-topline span { white-space: nowrap; }
.asala-card-topline b { color: rgba(0, 52, 58, 0.58); direction: ltr; font-family: Inter, sans-serif; font-size: 0.66rem; letter-spacing: 0.14em; }
.asala-card-foot { bottom: 25px; color: rgba(0, 52, 58, 0.58); font-size: 0.62rem; }
.asala-card-foot i { width: 5px; height: 5px; border-radius: 50%; background: var(--asala-lime); box-shadow: 0 0 12px var(--asala-lime); }

.asala-question-block { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; justify-content: center; padding: 112px 36px 54px; direction: rtl; }
.asala-question-block h2 { max-width: 420px; margin: 0 0 18px; color: #00343a; font-size: clamp(1.05rem, 1.85vw, 1.5rem); line-height: 1.48; font-weight: 800; text-shadow: none; }
.asala-options { display: grid; gap: 7px; }
.asala-option { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 35px; padding: 5px 8px; border: 1px solid rgba(0, 52, 58, 0.18); background: rgba(0, 52, 58, 0.045); color: #174b4c; font: inherit; font-size: 0.72rem; text-align: right; transition: background 200ms ease, border-color 200ms ease; appearance: none; -webkit-appearance: none; }
.asala-option:hover { border-color: var(--asala-lime); background: rgba(165, 200, 59, 0.16); }
.asala-option span { display: grid; place-items: center; width: 23px; height: 23px; flex: 0 0 23px; border: 1px solid rgba(76, 117, 26, 0.72); color: #4c751a; font-family: Inter, sans-serif; font-size: 0.6rem; direction: ltr; }
.asala-option b { flex: 1 1 auto; min-width: 0; font-weight: 700; }
.asala-option { position: relative; cursor: pointer; }
.asala-option .asala-result { display: grid; place-items: center; width: 24px; min-width: 24px; height: 24px; margin-inline-start: auto; opacity: 0; font-size: 1rem; font-style: normal; font-weight: 900; line-height: 1; transition: opacity 180ms ease, color 180ms ease; }
.asala-option.is-selected .asala-result { opacity: 1; }
.asala-option.is-correct { border-color: rgba(52, 132, 76, 0.72); background: rgba(52, 132, 76, 0.1); }
.asala-option.is-correct .asala-result { color: #2f8d50; }
.asala-option.is-wrong { border-color: rgba(171, 62, 62, 0.72); background: rgba(171, 62, 62, 0.08); }
.asala-option.is-wrong .asala-result { color: #b23e3e; }

.asala-empty-card { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 13px; color: rgba(0, 52, 58, 0.72); direction: rtl; }
.asala-empty-card span { color: #4c751a; font-size: 1.35rem; font-weight: 800; }
.asala-empty-card i { width: 46px; height: 1px; background: var(--asala-lime); box-shadow: 0 0 18px rgba(165, 200, 59, 0.7); }
.asala-empty-card small { color: rgba(0, 52, 58, 0.5); font-size: 0.72rem; }

/* The three-dimensional fan: center, partial left/right, then deeper cards. */
.asala-card[data-relative="0"] { z-index: 7; opacity: 1; transform: translate3d(calc(-50% + var(--drag-x)), -50%, 80px) rotateY(var(--drag-tilt)) rotateZ(calc(var(--drag-tilt) * -0.22)); filter: none; }
.asala-card[data-relative="0"] { pointer-events: auto; }
.asala-deck[data-dragging="true"] .asala-card[data-relative="0"] { transition-duration: 80ms; }
.asala-card[data-relative="-1"] { z-index: 6; opacity: 0.88; transform: translate3d(calc(-50% - 43%), -50%, -18px) rotateY(23deg) rotateZ(-3deg) scale(0.88); filter: brightness(0.78) saturate(0.88); }
.asala-card[data-relative="1"] { z-index: 6; opacity: 0.88; transform: translate3d(calc(-50% + 43%), -50%, -18px) rotateY(-23deg) rotateZ(3deg) scale(0.88); filter: brightness(0.78) saturate(0.88); }
.asala-card[data-relative="-2"] { z-index: 4; opacity: 0.42; transform: translate3d(calc(-50% - 72%), -50%, -100px) rotateY(30deg) rotateZ(-6deg) scale(0.76); filter: brightness(0.6); }
.asala-card[data-relative="2"] { z-index: 4; opacity: 0.42; transform: translate3d(calc(-50% + 72%), -50%, -100px) rotateY(-30deg) rotateZ(6deg) scale(0.76); filter: brightness(0.6); }
.asala-card[data-relative^="-"] { pointer-events: none; }
.asala-card[data-relative="0"] .asala-card-surface { box-shadow: 0 35px 70px rgba(0, 19, 16, 0.64), 0 0 45px rgba(165, 200, 59, 0.13), inset 0 0 0 1px rgba(248, 255, 220, 0.14); }
.asala-card[data-relative="-1"] .asala-card-surface, .asala-card[data-relative="1"] .asala-card-surface { box-shadow: 0 24px 48px rgba(0, 19, 16, 0.48); }

.asala-deck[data-dragging="false"] .asala-card[data-relative="0"] .asala-card-art { transform: scale(1.19); }
.asala-deck[data-transition="forward"] .asala-card[data-relative="1"] { animation: asala-exit-right 680ms cubic-bezier(.18,.82,.2,1) both; }
.asala-deck[data-transition="backward"] .asala-card[data-relative="-1"] { animation: asala-exit-left 680ms cubic-bezier(.18,.82,.2,1) both; }
.asala-deck.is-edge .asala-card[data-relative="0"] { animation: edge-pulse 420ms ease both; }

.asala-axis { position: absolute; left: 50%; bottom: 1.5%; z-index: 0; display: flex; gap: 8px; transform: translateX(-50%); opacity: 0.45; }
.asala-axis i { display: block; width: 5px; height: 5px; border-radius: 50%; background: var(--asala-lime); box-shadow: 0 0 12px rgba(165, 200, 59, 0.8); }

.asala-footer { flex: 0 0 auto; position: relative; z-index: 10; display: flex; align-items: center; justify-content: center; gap: clamp(28px, 8vw, 120px); width: min(1380px, calc(100% - 48px)); margin: 0 auto; padding: clamp(10px, 2vh, 20px) 0 clamp(14px, 3vh, 28px); border-top: 1px solid rgba(210, 231, 155, 0.2); }
.asala-dots { display: flex; align-items: center; gap: 8px; direction: ltr; }
.asala-dot { position: relative; width: 32px; height: 32px; padding: 0; border: 1px solid rgba(210, 231, 155, 0.3); border-radius: 50%; color: rgba(229, 239, 201, 0.65); background: transparent; cursor: pointer; font-family: Inter, sans-serif; font-size: 0.6rem; transition: width 220ms ease, border-color 220ms ease, color 220ms ease, background 220ms ease; }
.asala-dot.is-active { width: 42px; border-color: var(--asala-lime); color: #102f29; background: var(--asala-lime); box-shadow: 0 0 18px rgba(165, 200, 59, 0.28); }
.asala-dot:hover, .asala-dot:focus-visible { border-color: var(--asala-lime); outline: none; }
.asala-next { display: inline-flex; align-items: center; gap: 13px; padding: 10px 0; border: 0; border-bottom: 1px solid rgba(165, 200, 59, 0.66); color: #edf2d4; background: transparent; cursor: pointer; direction: rtl; font-size: 0.8rem; transition: color 220ms ease, border-color 220ms ease, transform 220ms ease; }
.asala-next b { color: var(--asala-lime); font-family: Inter, sans-serif; font-size: 1.3rem; line-height: 0.8; }
.asala-next:hover, .asala-next:focus-visible { color: var(--asala-lime); border-color: var(--asala-lime); transform: translateX(-4px); outline: none; }
.asala-next:disabled, .asala-next.is-locked { color: rgba(237, 242, 212, 0.46); border-color: rgba(165, 200, 59, 0.24); cursor: wait; opacity: 0.72; transform: none; }

/* Focused group reveal after an answer is selected. */
.asala-resolution {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 260ms ease, visibility 0s linear 260ms;
}
.asala-resolution.is-active {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}
.asala-resolution-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0, 52, 58, 0.28), rgba(0, 18, 20, 0.72) 78%);
  backdrop-filter: blur(2px);
}
.asala-resolution-panel {
  position: relative;
  width: min(500px, calc(100% - 36px));
  min-height: 300px;
  padding: 28px 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(210, 231, 155, 0.62);
  border-radius: 4px;
  color: #f5f3df;
  background: linear-gradient(145deg, rgba(0, 52, 58, 0.97), rgba(3, 31, 27, 0.96));
  box-shadow: 0 26px 70px rgba(0, 15, 13, 0.58), 0 0 0 7px rgba(165, 200, 59, 0.07), inset 0 0 0 1px rgba(248, 255, 220, 0.08);
  direction: rtl;
  text-align: center;
  transform: translateY(14px) scale(0.96);
  transition: transform 520ms cubic-bezier(.18,.82,.2,1), border-color 260ms ease, box-shadow 260ms ease;
  pointer-events: auto;
}
.asala-resolution-panel::before,
.asala-resolution-panel::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 30px;
  border-color: rgba(165, 200, 59, 0.72);
  pointer-events: none;
}
.asala-resolution-panel::before { top: 12px; right: 12px; border-top: 1px solid; border-right: 1px solid; }
.asala-resolution-panel::after { bottom: 12px; left: 12px; border-bottom: 1px solid; border-left: 1px solid; }
.asala-resolution.is-active .asala-resolution-panel { transform: translateY(0) scale(1); }
.asala-resolution-kicker { color: var(--asala-lime); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.16em; }
.asala-resolution-mark {
  width: 74px;
  height: 74px;
  margin: 14px 0 12px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(210, 231, 155, 0.48);
  border-radius: 50%;
  color: var(--asala-lime);
  font-family: Inter, sans-serif;
  font-size: 2.3rem;
  font-weight: 800;
  line-height: 1;
  animation: resolution-mark-pulse 1100ms ease-in-out infinite;
}
.asala-resolution-title { margin: 0; color: #f5f3df; font-size: clamp(1.35rem, 3vw, 1.85rem); line-height: 1.25; font-weight: 900; }
.asala-resolution-choice { margin: 12px 0 0; color: #dce8bf; font-size: clamp(0.85rem, 1.5vw, 1rem); font-weight: 700; }
.asala-resolution-answer { min-height: 1.55em; margin: 8px 0 0; color: var(--asala-lime); font-size: clamp(0.8rem, 1.35vw, 0.92rem); font-weight: 800; }
.asala-resolution-rule { display: flex; align-items: center; gap: 8px; width: min(220px, 70%); margin: 18px 0 13px; opacity: 0.72; }
.asala-resolution-rule i { flex: 1; height: 1px; background: rgba(165, 200, 59, 0.54); }
.asala-resolution-rule b { width: 6px; height: 6px; background: var(--asala-lime); transform: rotate(45deg); }
.asala-resolution-note { margin: 0; color: rgba(229, 239, 201, 0.64); font-size: 0.7rem; }
.asala-resolution[data-outcome="correct"] .asala-resolution-panel { border-color: rgba(110, 202, 123, 0.8); box-shadow: 0 26px 70px rgba(0, 15, 13, 0.58), 0 0 34px rgba(74, 179, 96, 0.18), inset 0 0 0 1px rgba(248, 255, 220, 0.08); }
.asala-resolution[data-outcome="correct"] .asala-resolution-mark { color: #8fe09a; border-color: rgba(110, 202, 123, 0.8); }
.asala-resolution[data-outcome="wrong"] .asala-resolution-panel { border-color: rgba(220, 117, 117, 0.82); box-shadow: 0 26px 70px rgba(0, 15, 13, 0.58), 0 0 34px rgba(190, 70, 70, 0.16), inset 0 0 0 1px rgba(248, 255, 220, 0.08); }
.asala-resolution[data-outcome="wrong"] .asala-resolution-mark { color: #ef9b9b; border-color: rgba(220, 117, 117, 0.8); }
.asala-resolution.is-ready .asala-resolution-note { color: #e5b34b; font-weight: 800; }
.asala-screen[data-resolution="active"] .asala-deck,
.asala-screen[data-resolution="revealed"] .asala-deck { pointer-events: none; }
.asala-screen[data-resolution="active"] .asala-card[data-relative="0"] .asala-card-surface,
.asala-screen[data-resolution="revealed"] .asala-card[data-relative="0"] .asala-card-surface,
.asala-screen[data-resolution="ready"] .asala-card[data-relative="0"] .asala-card-surface { box-shadow: 0 35px 70px rgba(0, 19, 16, 0.68), 0 0 46px rgba(165, 200, 59, 0.3), inset 0 0 0 1px rgba(248, 255, 220, 0.2); }
.asala-screen[data-resolution="active"] .asala-option.is-selected,
.asala-screen[data-resolution="revealed"] .asala-option.is-selected,
.asala-screen[data-resolution="ready"] .asala-option.is-selected { transform: scale(1.035); box-shadow: 0 0 18px rgba(165, 200, 59, 0.22); }

@keyframes resolution-mark-pulse { 0%, 100% { transform: scale(1); opacity: 0.78; } 50% { transform: scale(1.06); opacity: 1; } }

@keyframes diriyah-breathe { 0%, 100% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(-8px, -4px, 0) scale(1.018); } }
@keyframes diriyah-transition-forward { 0% { transform: translate3d(0, 0, 0) scale(1); } 42% { transform: translate3d(-18px, -5px, 0) scale(1.035); } 100% { transform: translate3d(0, 0, 0) scale(1); } }
@keyframes diriyah-transition-backward { 0% { transform: translate3d(0, 0, 0) scale(1); } 42% { transform: translate3d(12px, -4px, 0) scale(1.028); } 100% { transform: translate3d(0, 0, 0) scale(1); } }
@keyframes asala-q2-vase-rise {
  0% { opacity: 0; transform: translate3d(-8px, 112px, -16px) rotateY(7deg) rotateZ(-1deg) scale(0.78); }
  68% { opacity: 1; transform: translate3d(0, -5px, 8px) rotateY(-1deg) rotateZ(0.25deg) scale(1.012); }
  100% { opacity: 1; transform: translate3d(0, 0, 0) rotateY(0) rotateZ(0) scale(1); }
}
@keyframes asala-q2-vase-breathe {
  0%, 100% { transform: translate3d(0, 0, 0) rotateY(0) rotateZ(0) scale(1); }
  50% { transform: translate3d(4px, -3px, 8px) rotateY(1deg) rotateZ(-0.25deg) scale(1.008); }
}
@keyframes asala-q2-corner-rise {
  0% { opacity: 0; transform: translate3d(8px, 132px, -16px) rotateY(-7deg) rotateZ(1deg) scale(0.78); }
  68% { opacity: 1; transform: translate3d(0, -5px, 8px) rotateY(1deg) rotateZ(-0.25deg) scale(1.012); }
  100% { opacity: 1; transform: translate3d(0, 0, 0) rotateY(0) rotateZ(0) scale(1); }
}
@keyframes asala-q2-corner-breathe {
  0%, 100% { transform: translate3d(0, 0, 0) rotateY(0) rotateZ(0) scale(1); }
  50% { transform: translate3d(-4px, -3px, 8px) rotateY(-1deg) rotateZ(0.25deg) scale(1.008); }
}
.asala-screen[data-transition="forward"] .asala-diriyah { animation: diriyah-transition-forward 680ms cubic-bezier(.2,.7,.2,1) both; }
.asala-screen[data-transition="backward"] .asala-diriyah { animation: diriyah-transition-backward 680ms cubic-bezier(.2,.7,.2,1) both; }
.asala-screen[data-scene="1"] .asala-manuscript { transform: translateX(-50%) translateY(4px) scale(0.97); }
.asala-screen[data-scene="2"] .asala-manuscript { transform: translateX(-50%) translateY(-2px) scale(1.02); }
.asala-screen[data-scene="1"] .asala-diriyah,
.asala-screen[data-scene="2"] .asala-diriyah,
.asala-screen[data-scene="3"] .asala-diriyah,
.asala-screen[data-scene="4"] .asala-diriyah {
  opacity: 0;
  visibility: hidden;
  filter: saturate(1) brightness(0.9) sepia(0.06) drop-shadow(0 0 42px rgba(165, 200, 59, 0.58));
}
.asala-screen[data-scene="1"] .asala-q2-background {
  opacity: 1;
  filter: saturate(0.98) brightness(0.84);
  transform: scale(1) translate3d(0, 0, 0);
}
.asala-screen[data-scene="2"] .asala-q3-background {
  opacity: 1;
  filter: saturate(0.98) brightness(0.84);
  transform: scale(1) translate3d(0, 0, 0);
}
.asala-screen[data-scene="3"] {
  background-image: url('assets/تصميم-بدون-عنوان-2026-09-03t230254-576.png');
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}
.asala-screen[data-scene="4"] {
  background-image: none;
}
.asala-screen[data-scene="4"] .asala-q5-background {
  opacity: 1;
  filter: saturate(0.98) brightness(0.84);
  transform: scale(1) translate3d(0, 0, 0);
  transition: none;
}
.asala-screen[data-scene="1"] .asala-ceramic,
.asala-screen[data-scene="1"] .asala-vase,
.asala-screen[data-scene="1"] .asala-q2-corner,
.asala-screen[data-scene="1"] .asala-diriyah,
.asala-screen[data-scene="1"] .asala-ambient-one,
.asala-screen[data-scene="1"] .asala-ambient-two {
  opacity: 0;
  visibility: hidden;
  animation: none;
  pointer-events: none;
}
@keyframes asala-exit-right { 0% { transform: translate3d(-50%, -50%, 80px) rotateY(0) rotateZ(0) scale(1); opacity: 1; } 100% { transform: translate3d(58%, -50%, -160px) rotateY(-32deg) rotateZ(7deg) scale(0.72); opacity: 0; } }
@keyframes asala-exit-left { 0% { transform: translate3d(-50%, -50%, 80px) rotateY(0) rotateZ(0) scale(1); opacity: 1; } 100% { transform: translate3d(-158%, -50%, -160px) rotateY(32deg) rotateZ(-7deg) scale(0.72); opacity: 0; } }
@keyframes edge-pulse { 0%, 100% { transform: translate3d(-50%, -50%, 80px) scale(1); } 50% { transform: translate3d(-50%, -50%, 80px) scale(1.025); } }

@media (max-width: 720px) {
  .asala-header, .asala-footer { width: calc(100% - 28px); }
  .asala-header { grid-template-columns: auto 1fr auto; gap: 10px; padding-top: 12px; }
  .asala-heading { min-width: 46px; }
  .asala-heading i { width: 32px; height: 6px; }
  .asala-back { padding: 8px 9px; }
  .asala-back b { display: none; }
  .asala-progress strong { font-size: 1.55rem; }
  .asala-stage-label { top: 10px; font-size: 0.6rem; }
  .asala-stage-label span { width: 14px; }
  .asala-deck { width: 100%; height: min(67vh, 540px); min-height: 360px; }
  .asala-card { width: min(74vw, 390px); height: min(100%, 510px); }
  .asala-card[data-relative="-1"] { transform: translate3d(calc(-50% - 51%), -50%, -18px) rotateY(20deg) rotateZ(-3deg) scale(0.82); }
  .asala-card[data-relative="1"] { transform: translate3d(calc(-50% + 51%), -50%, -18px) rotateY(-20deg) rotateZ(3deg) scale(0.82); }
  .asala-card[data-relative="-2"] { opacity: 0.18; }
  .asala-card[data-relative="2"] { opacity: 0.18; }
  .asala-question-block { padding: 104px 24px 50px; }
  .asala-question-block h2 { margin-bottom: 14px; font-size: 0.98rem; line-height: 1.48; }
  .asala-option { min-height: 34px; font-size: 0.64rem; }
  .asala-card-topline, .asala-card-foot { left: 22px; right: 22px; }
  .asala-footer { gap: 18px; justify-content: space-between; }
  .asala-dot { width: 27px; height: 27px; font-size: 0.52rem; }
  .asala-dot.is-active { width: 34px; }
  .asala-next { font-size: 0.68rem; gap: 8px; }
  .asala-manuscript { top: 36px; width: clamp(92px, 27vw, 125px); }
  .asala-diriyah { width: min(48vw, 300px); max-height: 34vh; left: 4px; right: auto; top: auto; bottom: clamp(4px, 1vh, 10px); opacity: 1; }
  .asala-ceramic { left: 4px; bottom: clamp(4px, 1vh, 10px); width: min(46vw, 270px); max-height: 28vh; }
  .asala-vase { left: 0; bottom: clamp(-130px, -11vh, -65px); width: min(41vw, 222px); max-height: 65vh; }
  .asala-q2-corner { right: 0; bottom: clamp(-90px, -7vh, -48px); width: min(53vw, 306px); max-height: 74vh; }
}

@media (prefers-reduced-motion: reduce) {
  .asala-q2-background, .asala-q3-background, .asala-q5-background, .asala-diriyah, .asala-ceramic, .asala-vase, .asala-q2-corner, .asala-card { animation: none; transition-duration: 1ms; }
  .asala-deck[data-dragging="true"] .asala-card[data-relative="0"] { transition-duration: 1ms; }
}

/* عزنا بجودنا — blank question-card template */
.jod-screen {
  --jod-purple: #6565E0;
  position: absolute;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #ffffff;
  background: #6565E0 url('assets/الخلفية.png') center / cover no-repeat;
}

/* One already-loaded still image is shared by every Jod question, so scene changes never wait for media playback. */
.jod-background {
  position: absolute;
  inset: 0;
  z-index: -1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 1;
  pointer-events: none;
}

.jod-screen::before,
.jod-screen::after {
  content: '';
  position: absolute;
  pointer-events: none;
  z-index: -2;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transform: rotate(45deg);
}

.jod-screen::before {
  width: min(58vw, 720px);
  height: min(58vw, 720px);
  top: -38%;
  right: -15%;
  box-shadow: 0 0 0 24px rgba(255, 255, 255, 0.035), 0 0 0 48px rgba(0, 0, 0, 0.035);
}

.jod-screen::after {
  width: min(42vw, 560px);
  height: min(42vw, 560px);
  left: -18%;
  bottom: -30%;
  border-color: rgba(0, 0, 0, 0.16);
  box-shadow: 0 0 0 22px rgba(255, 255, 255, 0.035), 0 0 0 44px rgba(0, 0, 0, 0.03);
}

.jod-pattern {
  position: absolute;
  z-index: -1;
  width: min(34vw, 500px);
  height: 10px;
  opacity: 0.26;
  background: repeating-linear-gradient(90deg, transparent 0 14px, #ffffff 14px 22px, transparent 22px 36px);
  transform: skewX(-28deg);
  pointer-events: none;
}

.jod-pattern-top { top: 10%; right: 9%; }
.jod-pattern-bottom { bottom: 10%; left: 9%; opacity: 0.18; }

.jod-back {
  position: absolute;
  top: clamp(18px, 3vh, 34px);
  left: clamp(18px, 3vw, 48px);
  z-index: 8;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 50%;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease, border-color 180ms ease;
}

.jod-back:hover,
.jod-back:focus-visible {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
  outline: none;
}

.jod-back span { font-family: Inter, sans-serif; font-size: 1.45rem; line-height: 1; }

.jod-stage {
  position: relative;
  flex: 1 1 auto;
  width: min(100%, 980px);
  min-height: 0;
  display: grid;
  place-items: center;
  padding: clamp(54px, 7vh, 84px) 20px clamp(28px, 5vh, 58px);
  perspective: 1500px;
  overflow: hidden;
}

.jod-deck {
  --drag-x: 0px;
  --drag-tilt: 0deg;
  position: relative;
  width: 100%;
  height: min(66vh, 590px);
  min-height: 390px;
  touch-action: pan-y;
  user-select: none;
  transform-style: preserve-3d;
  cursor: grab;
  isolation: isolate;
}

.jod-deck[data-dragging="true"] { cursor: grabbing; }

.jod-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(290px, 42vw, 520px);
  height: min(100%, 570px);
  min-height: 390px;
  transform-style: preserve-3d;
  transform-origin: 50% 50% -58px;
  pointer-events: none;
  opacity: 0;
  transition: transform 650ms cubic-bezier(.18,.82,.2,1), opacity 480ms ease, filter 650ms ease;
  will-change: transform, opacity;
}

.jod-card-surface {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.28), 0 8px 18px rgba(0, 0, 0, 0.18);
  transform-style: preserve-3d;
}

.jod-card-surface::before,
.jod-card-surface::after {
  content: '';
  position: absolute;
  pointer-events: none;
}

.jod-card-surface::before {
  inset: 13px;
  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 14px;
}

.jod-card-surface::after {
  width: 72%;
  height: 28%;
  right: -22%;
  bottom: -9%;
  border: 1px solid rgba(101, 101, 224, 0.2);
  border-radius: 50%;
  transform: rotate(-18deg);
}

.jod-card-border {
  position: absolute;
  inset: 10px;
  z-index: 1;
  border: 1px solid rgba(101, 101, 224, 0.46);
  border-radius: 17px;
  pointer-events: none;
}

.jod-card-topline {
  position: absolute;
  top: clamp(23px, 3.5vh, 34px);
  right: clamp(24px, 2.8vw, 36px);
  z-index: 3;
  color: #202348;
  font-size: clamp(0.62rem, 1vw, 0.78rem);
  font-weight: 700;
  letter-spacing: 0.035em;
  white-space: nowrap;
}

.jod-card-topline::before {
  content: '';
  position: absolute;
  top: 50%;
  right: calc(100% + 9px);
  width: 22px;
  height: 1px;
  background: #6565E0;
  transform: translateY(-50%);
}

.jod-manuscript {
  position: absolute;
  top: clamp(58px, 8vh, 78px);
  left: 50%;
  z-index: 3;
  display: block;
  width: min(66%, 270px);
  height: auto;
  max-height: 82px;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  transform: translateX(-50%) translateY(-4px) scale(0.97);
  transition: opacity 360ms ease, transform 500ms cubic-bezier(.2, .8, .2, 1);
  pointer-events: none;
}

.jod-question-block {
  position: absolute;
  top: clamp(148px, 23%, 172px);
  right: clamp(24px, 3vw, 34px);
  bottom: clamp(54px, 9%, 66px);
  left: clamp(24px, 3vw, 34px);
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
  text-align: right;
}

.jod-question-block h2 {
  margin: 0 0 clamp(14px, 2.4%, 20px);
  color: #202348;
  font-size: clamp(0.88rem, 1.45vw, 1.15rem);
  line-height: 1.58;
  font-weight: 800;
  text-align: center;
}

.jod-options {
  display: grid;
  gap: clamp(7px, 1.2%, 11px);
  width: 100%;
}

.jod-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: clamp(36px, 6%, 44px);
  padding: 6px 9px;
  border: 1px solid rgba(32, 35, 72, 0.18);
  border-radius: 3px;
  color: #202348;
  background: rgba(101, 101, 224, 0.035);
  font: inherit;
  font-size: clamp(0.68rem, 1.08vw, 0.82rem);
  line-height: 1.4;
  text-align: right;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background 200ms ease, border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}

.jod-option:hover,
.jod-option:focus-visible {
  border-color: #6565E0;
  background: rgba(101, 101, 224, 0.11);
  outline: none;
}

.jod-option > span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border: 1px solid rgba(101, 101, 224, 0.58);
  color: #4c4cb4;
  font-family: Inter, sans-serif;
  font-size: 0.62rem;
  direction: ltr;
}

.jod-option > b {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 700;
}

.jod-option .jod-result {
  display: grid;
  place-items: center;
  width: 24px;
  min-width: 24px;
  height: 24px;
  margin-inline-start: auto;
  opacity: 0;
  color: #6565E0;
  font-size: 1rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
  transition: opacity 180ms ease, color 180ms ease;
}

.jod-option.is-selected .jod-result { opacity: 1; }
.jod-option.is-correct { border-color: rgba(52, 132, 76, 0.72); background: rgba(52, 132, 76, 0.1); }
.jod-option.is-correct .jod-result { color: #2f8d50; }
.jod-option.is-wrong { border-color: rgba(171, 62, 62, 0.72); background: rgba(171, 62, 62, 0.08); }
.jod-option.is-wrong .jod-result { color: #b23e3e; }

.jod-card-foot {
  position: absolute;
  right: 50%;
  bottom: 29px;
  z-index: 3;
  display: flex;
  gap: 7px;
  transform: translateX(50%);
}

.jod-card-foot i {
  display: block;
  width: 6px;
  height: 6px;
  background: #6565E0;
  transform: rotate(45deg);
}

.jod-screen[data-resolution="active"] .jod-deck,
.jod-screen[data-resolution="revealed"] .jod-deck,
.jod-screen[data-resolution="ready"] .jod-deck { pointer-events: none; }

.jod-screen[data-resolution="active"] .jod-card[data-relative="0"] .jod-card-surface,
.jod-screen[data-resolution="revealed"] .jod-card[data-relative="0"] .jod-card-surface,
.jod-screen[data-resolution="ready"] .jod-card[data-relative="0"] .jod-card-surface {
  box-shadow: 0 35px 70px rgba(0, 0, 0, 0.34), 0 0 46px rgba(101, 101, 224, 0.22);
}

.jod-card[data-relative="0"] {
  z-index: 7;
  pointer-events: auto;
  opacity: 1;
  filter: none;
  transform: translate3d(calc(-50% + var(--drag-x)), -50%, 80px) rotateY(var(--drag-tilt)) rotateZ(calc(var(--drag-tilt) * -0.22));
}

.jod-card[data-relative="-1"] {
  z-index: 6;
  opacity: 0.88;
  filter: brightness(0.78) saturate(0.88);
  transform: translate3d(calc(-50% - 43%), -50%, -18px) rotateY(23deg) rotateZ(-3deg) scale(0.88);
}

.jod-card[data-relative="1"] {
  z-index: 6;
  opacity: 0.88;
  filter: brightness(0.78) saturate(0.88);
  transform: translate3d(calc(-50% + 43%), -50%, -18px) rotateY(-23deg) rotateZ(3deg) scale(0.88);
}

.jod-card[data-relative="-2"] {
  z-index: 4;
  opacity: 0.42;
  filter: brightness(0.6);
  transform: translate3d(calc(-50% - 72%), -50%, -100px) rotateY(30deg) rotateZ(-6deg) scale(0.76);
}

.jod-card[data-relative="2"] {
  z-index: 4;
  opacity: 0.42;
  filter: brightness(0.6);
  transform: translate3d(calc(-50% + 72%), -50%, -100px) rotateY(-30deg) rotateZ(6deg) scale(0.76);
}

.jod-card[data-relative^="-"] { pointer-events: none; }
.jod-deck[data-dragging="true"] .jod-card[data-relative="0"] { transition-duration: 80ms; }
.jod-deck[data-transition="forward"] .jod-card[data-relative="1"] { animation: jod-exit-right 680ms cubic-bezier(.18,.82,.2,1) both; }
.jod-deck[data-transition="backward"] .jod-card[data-relative="-1"] { animation: jod-exit-left 680ms cubic-bezier(.18,.82,.2,1) both; }

.jod-card:not([data-relative="0"]) .jod-manuscript {
  opacity: 0;
}

.jod-card[data-relative="0"] .jod-manuscript {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

@keyframes jod-exit-right {
  0% { transform: translate3d(-50%, -50%, 80px) rotateY(0) rotateZ(0) scale(1); opacity: 1; }
  100% { transform: translate3d(58%, -50%, -160px) rotateY(-32deg) rotateZ(7deg) scale(0.72); opacity: 0; }
}

@keyframes jod-exit-left {
  0% { transform: translate3d(-50%, -50%, 80px) rotateY(0) rotateZ(0) scale(1); opacity: 1; }
  100% { transform: translate3d(-158%, -50%, -160px) rotateY(32deg) rotateZ(-7deg) scale(0.72); opacity: 0; }
}

.jod-controls {
  position: relative;
  z-index: 8;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 34px);
  padding: 0 20px clamp(20px, 4vh, 38px);
  direction: ltr;
}

.jod-arrow {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.09);
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease, opacity 180ms ease;
}

.jod-arrow:hover,
.jod-arrow:focus-visible {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.08);
  outline: none;
}

.jod-arrow:disabled { opacity: 0.35; cursor: default; }
.jod-arrow span { font-family: Inter, sans-serif; font-size: 1.7rem; line-height: 0.8; }

.jod-dots {
  display: flex;
  align-items: center;
  gap: 10px;
}

.jod-dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: width 220ms ease, border-radius 220ms ease, background 220ms ease, transform 220ms ease;
}

.jod-dot:hover,
.jod-dot:focus-visible { transform: scale(1.18); outline: none; }
.jod-dot.is-active { width: 28px; border-radius: 8px; background: #ffffff; }

@media (max-width: 720px) {
  .jod-pattern { width: 46vw; }
  .jod-pattern-top { top: 9%; right: -2%; }
  .jod-pattern-bottom { bottom: 9%; left: -2%; }
  .jod-back { top: 16px; left: 16px; width: 38px; height: 38px; }
  .jod-stage { padding: 42px 0 20px; }
  .jod-deck { height: min(67vh, 540px); min-height: 360px; }
  .jod-card { width: min(74vw, 390px); height: min(100%, 510px); }
  .jod-card[data-relative="-1"] { transform: translate3d(calc(-50% - 51%), -50%, -18px) rotateY(20deg) rotateZ(-3deg) scale(0.82); }
  .jod-card[data-relative="1"] { transform: translate3d(calc(-50% + 51%), -50%, -18px) rotateY(-20deg) rotateZ(3deg) scale(0.82); }
  .jod-card[data-relative="-2"], .jod-card[data-relative="2"] { opacity: 0.18; }
  .jod-card-topline { top: 22px; right: 25px; font-size: 0.58rem; }
  .jod-manuscript { top: 54px; width: 66%; max-height: 70px; }
  .jod-question-block { top: 128px; right: 22px; bottom: 42px; left: 22px; }
  .jod-question-block h2 { margin-bottom: 10px; font-size: 0.72rem; line-height: 1.45; }
  .jod-options { gap: 5px; }
  .jod-option { min-height: 30px; padding: 4px 7px; gap: 7px; font-size: 0.62rem; line-height: 1.3; }
  .jod-option > span { width: 21px; height: 21px; flex-basis: 21px; font-size: 0.56rem; }
  .jod-option .jod-result { width: 21px; min-width: 21px; height: 21px; font-size: 0.88rem; }
  .jod-card-foot { bottom: 24px; }
  .jod-controls { gap: 16px; padding-bottom: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .jod-card, .jod-manuscript, .jod-dot, .jod-arrow, .jod-back { transition-duration: 1ms; }
}

/* عزنا بهمتنا — the supplied films, with an explicit answer reveal action. */
.hemma-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: #000;
}

.hemma-video {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  object-position: center;
}

.hemma-video[hidden],
.hemma-answer-button[hidden],
.hemma-next-button[hidden] {
  display: none;
}

.hemma-back-button {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 3;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(239, 195, 91, 0.72);
  border-radius: 50%;
  color: #f2d487;
  background: rgba(0, 39, 31, 0.72);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32), inset 0 0 0 1px rgba(255, 248, 230, 0.08);
  cursor: pointer;
  direction: ltr;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.hemma-back-button span {
  font-family: Inter, sans-serif;
  font-size: 1.35rem;
  line-height: 1;
}

.hemma-back-button:hover,
.hemma-back-button:focus-visible {
  outline: none;
  border-color: #f0c65b;
  color: #fff8e6;
  background: rgba(16, 102, 70, 0.9);
  transform: translateY(-2px);
}

.hemma-answer-button,
.hemma-next-button {
  position: absolute;
  top: 50%;
  left: clamp(34px, 8vw, 120px);
  z-index: 2;
  min-width: clamp(178px, 18vw, 245px);
  padding: 12px 25px 13px;
  border: 1px solid rgba(162, 232, 184, 0.92);
  border-radius: 999px;
  color: #f3fff5;
  background: linear-gradient(135deg, rgba(16, 103, 70, 0.98), rgba(35, 157, 91, 0.98));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.38), 0 0 0 5px rgba(93, 205, 132, 0.12);
  cursor: pointer;
  font-size: clamp(0.92rem, 1.5vw, 1.12rem);
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  direction: rtl;
  transform: translateY(-50%);
  transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease;
}

.hemma-answer-button:hover,
.hemma-answer-button:focus-visible,
.hemma-next-button:hover,
.hemma-next-button:focus-visible {
  outline: none;
  filter: brightness(1.08);
  box-shadow: 0 15px 34px rgba(0, 0, 0, 0.44), 0 0 0 6px rgba(93, 205, 132, 0.18);
  transform: translateY(calc(-50% - 2px));
}

/* عزنا بكرمنا — the supplied opening film and its quiet hand-off to the challenge. */
.karam-screen {
  position: absolute;
  inset: 0;
  z-index: 40;
  overflow: hidden;
  isolation: isolate;
  color: #f5f1e5;
  background: #00343a;
}

.karam-intro,
.karam-second-video,
.karam-third-video,
.karam-challenge {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transition: opacity 900ms cubic-bezier(.2, .72, .2, 1), transform 1100ms cubic-bezier(.2, .72, .2, 1);
}

.karam-intro {
  z-index: 1;
  opacity: 1;
  transform: scale(1);
  background: #00343a;
}

.karam-intro-video,
.karam-second-video-element,
.karam-third-video-element,
.karam-fourth-video-element,
.karam-result-video-element {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

.karam-fourth-video-element {
  position: absolute;
  inset: 0;
  z-index: 6;
  opacity: 0;
}

.karam-result-video-element {
  position: absolute;
  inset: 0;
  z-index: 12;
  opacity: 0;
}

.karam-result {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: clamp(28px, 6vh, 64px) 20px;
  background: rgba(0, 28, 30, 0.22);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 520ms ease, visibility 0s linear 520ms;
}

.karam-screen[data-phase="answer"][data-answer-complete="true"] .karam-result,
.karam-screen[data-phase="result"][data-answer-complete="true"] .karam-result {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.karam-result-panel {
  width: min(620px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid rgba(75, 195, 210, 0.48);
  border-radius: 6px;
  background: rgba(0, 52, 58, 0.88);
  box-shadow: 0 24px 60px rgba(0, 18, 20, 0.4), inset 0 0 0 1px rgba(245, 241, 229, 0.06);
  color: #f5f1e5;
  text-align: center;
}

.karam-result-kicker {
  display: block;
  color: #4bc3d2;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.karam-result-panel h2 {
  margin: 8px 0 6px;
  color: #f5f1e5;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.3;
  font-weight: 900;
}

.karam-result-message {
  margin: 0;
  color: rgba(245, 241, 229, 0.78);
  font-size: clamp(0.78rem, 1.4vw, 0.95rem);
  line-height: 1.7;
}

.karam-result-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 22px 0 16px;
}

.karam-result-metric {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  justify-content: center;
  column-gap: 5px;
  padding: 13px 10px 11px;
  border: 1px solid rgba(245, 241, 229, 0.16);
  border-radius: 4px;
  background: rgba(3, 31, 27, 0.34);
}

.karam-result-metric strong {
  color: #f5f1e5;
  font-family: Inter, sans-serif;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  line-height: 1;
}

.karam-result-score strong,
.karam-result-score span { color: #e5b34b; }

.karam-result-metric > span {
  color: rgba(245, 241, 229, 0.62);
  font-family: Inter, sans-serif;
  font-size: 0.82rem;
  direction: ltr;
}

.karam-result-metric small {
  grid-column: 1 / -1;
  margin-top: 7px;
  color: rgba(245, 241, 229, 0.64);
  font-size: 0.68rem;
  line-height: 1.4;
}

.karam-result-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  direction: rtl;
}

.karam-result-card {
  min-width: 0;
  display: grid;
  gap: 5px;
  place-items: center;
  padding: 9px 5px 8px;
  border: 1px solid rgba(245, 241, 229, 0.18);
  border-radius: 3px;
  background: rgba(3, 31, 27, 0.34);
}

.karam-result-card b {
  color: rgba(245, 241, 229, 0.56);
  font-family: Inter, sans-serif;
  font-size: 0.62rem;
}

.karam-result-card span {
  color: #f5f1e5;
  font-size: clamp(0.58rem, 1vw, 0.72rem);
  line-height: 1.35;
}

.karam-result-card i {
  color: rgba(245, 241, 229, 0.45);
  font-family: Inter, sans-serif;
  font-size: 0.88rem;
  font-style: normal;
  font-weight: 900;
}

.karam-result-card.is-correct {
  border-color: rgba(126, 218, 153, 0.68);
  background: rgba(54, 132, 91, 0.3);
  box-shadow: inset 0 0 0 1px rgba(126, 218, 153, 0.08), 0 0 16px rgba(126, 218, 153, 0.1);
}

.karam-result-card.is-correct b,
.karam-result-card.is-correct i { color: #8fe09a; }
.karam-result-card.is-misplaced { border-color: rgba(229, 179, 75, 0.35); }

.karam-sort-card.is-position-correct {
  outline: 2px solid rgba(143, 224, 154, 0.9);
  outline-offset: 4px;
}

.karam-sort-card.is-position-misplaced { outline: 2px solid rgba(229, 179, 75, 0.44); outline-offset: 4px; }

.karam-second-video {
  z-index: 2;
  opacity: 0;
  transform: scale(1.018);
  background: #00343a;
}

.karam-third-video {
  z-index: 3;
  opacity: 0;
  transform: scale(1.018);
  background: #00343a;
}

.karam-sort-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 520ms ease;
}

.karam-sort-deck {
  width: 100%;
  max-width: 1500px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1vw, 13px);
  padding: 0 clamp(14px, 2.5vw, 36px);
  direction: rtl;
  pointer-events: none;
}

.karam-sort-card {
  position: relative;
  flex: 0 0 clamp(46px, 14.3vw, 190px);
  width: clamp(46px, 14.3vw, 190px);
  aspect-ratio: 260 / 800;
  min-width: 0;
  overflow: hidden;
  opacity: 0;
  transform: translate3d(0, 118vh, 0);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 920ms cubic-bezier(.18, .82, .2, 1), opacity 720ms ease;
  will-change: transform, opacity;
}

.karam-sort-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  -webkit-user-drag: none;
}

.karam-sort-card.is-dragging {
  z-index: 20;
  cursor: grabbing;
  transition: none !important;
}

.karam-sort-card.is-flipping {
  transition: none !important;
}

.karam-screen[data-phase="third-video"][data-third-ready="true"] .karam-sort-layer {
  opacity: 1;
}

.karam-screen[data-phase="third-video"][data-third-ready="true"] .karam-sort-deck {
  pointer-events: auto;
}

.karam-screen[data-phase="third-video"][data-third-ready="true"] .karam-sort-card {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.karam-screen[data-phase="third-video"][data-third-ready="true"] .karam-sort-card:nth-child(2) { transition-delay: 70ms; }
.karam-screen[data-phase="third-video"][data-third-ready="true"] .karam-sort-card:nth-child(3) { transition-delay: 140ms; }
.karam-screen[data-phase="third-video"][data-third-ready="true"] .karam-sort-card:nth-child(4) { transition-delay: 210ms; }
.karam-screen[data-phase="third-video"][data-third-ready="true"] .karam-sort-card:nth-child(5) { transition-delay: 280ms; }

.karam-challenge {
  z-index: 4;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(1.018);
  background: #00343a;
}

.karam-challenge-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.28;
  filter: saturate(0.92) brightness(0.62);
  pointer-events: none;
}

.karam-challenge-copy {
  position: relative;
  z-index: 1;
  width: min(1100px, calc(100% - 40px));
  max-height: calc(100% - 48px);
  display: grid;
  gap: 12px;
  place-items: center;
  padding: 28px;
  overflow: auto;
  text-align: center;
}

.karam-challenge-copy span {
  color: #4bc3d2;
  font-size: clamp(0.72rem, 1.2vw, 0.9rem);
  font-weight: 700;
  letter-spacing: 0.12em;
}

.karam-challenge-copy h1 {
  margin: 0;
  color: #f5f1e5;
  font-size: clamp(1.8rem, 5vw, 4rem);
  line-height: 1.2;
  font-weight: 900;
  text-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
}

.karam-challenge-copy p {
  max-width: 760px;
  margin: 0;
  color: rgba(245, 241, 229, 0.82);
  font-size: clamp(0.84rem, 1.5vw, 1.08rem);
  line-height: 1.8;
}

.karam-round-scenes {
  width: min(100%, 940px);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(7px, 1vw, 12px);
  margin-top: 7px;
  direction: rtl;
}

.karam-scene-summary {
  min-height: 78px;
  display: grid;
  place-items: center;
  padding: 12px 9px;
  border: 1px solid rgba(75, 195, 210, 0.32);
  background: rgba(0, 52, 58, 0.62);
  color: #f5f1e5;
  text-align: center;
}

.karam-scene-summary span {
  color: #f5f1e5;
  font-size: clamp(0.68rem, 1.05vw, 0.84rem);
  line-height: 1.45;
  letter-spacing: 0;
}

.karam-back {
  position: absolute;
  top: clamp(18px, 3vh, 34px);
  left: clamp(18px, 3vw, 48px);
  z-index: 20;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 50%;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.1);
  font-family: Inter, sans-serif;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 500ms ease, background 180ms ease, transform 180ms ease, border-color 180ms ease;
}

.karam-back:hover,
.karam-back:focus-visible {
  border-color: #4bc3d2;
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
  outline: none;
}

.karam-screen[data-phase="second-video"] .karam-intro,
.karam-screen[data-phase="third-video"] .karam-intro,
.karam-screen[data-phase="challenge"] .karam-intro,
.karam-screen[data-phase="answer"] .karam-intro,
.karam-screen[data-phase="result-video"] .karam-intro,
.karam-screen[data-phase="cards-video-ended"] .karam-intro,
.karam-screen[data-phase="result"] .karam-intro {
  opacity: 0;
  transform: scale(1.012);
  pointer-events: none;
}

.karam-screen[data-phase="second-video"] .karam-second-video {
  opacity: 1;
  transform: scale(1);
}

.karam-screen[data-phase="third-video"] .karam-second-video,
.karam-screen[data-phase="challenge"] .karam-second-video,
.karam-screen[data-phase="answer"] .karam-second-video,
.karam-screen[data-phase="result-video"] .karam-second-video,
.karam-screen[data-phase="cards-video-ended"] .karam-second-video,
.karam-screen[data-phase="result"] .karam-second-video {
  opacity: 0;
  transform: scale(1.012);
  pointer-events: none;
}

.karam-screen[data-phase="third-video"] .karam-third-video,
.karam-screen[data-phase="answer"] .karam-third-video {
  opacity: 1;
  transform: scale(1);
}

.karam-screen[data-phase="answer"] .karam-third-video-element {
  opacity: 0;
}

.karam-screen[data-phase="answer"] .karam-fourth-video-element {
  opacity: 1;
}

.karam-screen[data-phase="result-video"] .karam-fourth-video-element {
  opacity: 0;
}

.karam-screen[data-phase="result-video"] .karam-result-video-element,
.karam-screen[data-phase="cards-video-ended"] .karam-result-video-element {
  opacity: 1;
}

.karam-screen[data-phase="result"] .karam-result-video-element {
  opacity: 0;
}

.karam-screen[data-phase="challenge"] .karam-third-video,
.karam-screen[data-phase="result-video"] .karam-third-video,
.karam-screen[data-phase="result"] .karam-third-video {
  opacity: 0;
  transform: scale(1.012);
  pointer-events: none;
}

.karam-screen[data-phase="challenge"] .karam-challenge {
  opacity: 1;
  transform: scale(1);
}

.karam-screen[data-phase="challenge"] .karam-back,
.karam-screen[data-phase="answer"] .karam-back {
  opacity: 1;
  pointer-events: auto;
}

.karam-screen[data-phase="result-video"] .karam-back,
.karam-screen[data-phase="cards-video-ended"] .karam-back,
.karam-screen[data-phase="result"] .karam-back {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 720px) {
  .karam-back { top: 16px; left: 16px; width: 38px; height: 38px; }
  .karam-challenge-copy { width: calc(100% - 28px); padding: 22px 14px; }
  .karam-challenge-copy p { font-size: 0.78rem; line-height: 1.65; }
  .karam-round-scenes { gap: 5px; }
  .karam-scene-summary { min-height: 64px; padding: 8px 4px; }
  .karam-scene-summary span { font-size: 0.58rem; }
}

@media (prefers-reduced-motion: reduce) {
  .karam-intro, .karam-second-video, .karam-third-video, .karam-challenge, .karam-back { transition-duration: 1ms; }
}

/* عزنا برؤيتنا — start the opening film directly, then continue with the selected films. */
.roya-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background: #00343a;
  color: #f5f1e5;
}

.roya-elements {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(195, 154, 75, 0.18), transparent 34%),
    linear-gradient(145deg, #002d32, #00343a 54%, #052b28);
}

.roya-elements::before,
.roya-elements::after {
  content: '';
  position: absolute;
  width: min(62vw, 760px);
  height: min(62vw, 760px);
  border: 1px solid rgba(195, 154, 75, 0.22);
  transform: rotate(45deg);
  pointer-events: none;
}

.roya-elements::before {
  top: -42%;
  right: -14%;
  box-shadow: 0 0 0 24px rgba(195, 154, 75, 0.04), 0 0 0 48px rgba(195, 154, 75, 0.025);
}

.roya-elements::after {
  bottom: -42%;
  left: -14%;
  border-color: rgba(195, 154, 75, 0.15);
}

.roya-back {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 14px);
  left: calc(env(safe-area-inset-left) + 14px);
  z-index: 20;
  min-width: 52px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 15px;
  border: 1px solid rgba(229, 179, 75, 0.82);
  border-radius: 999px;
  color: #fff8e6;
  background: rgba(0, 39, 31, 0.88);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34), inset 0 0 0 1px rgba(255, 248, 230, 0.08);
  cursor: pointer;
  direction: rtl;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 180ms ease, transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.roya-back:hover,
.roya-back:focus-visible {
  border-color: #f0c65b;
  background: rgba(16, 102, 70, 0.94);
  box-shadow: 0 11px 28px rgba(0, 0, 0, 0.4), 0 0 0 4px rgba(229, 179, 75, 0.14);
  transform: translateY(-2px);
  outline: none;
}

.roya-back span { color: #f0c65b; font-family: Inter, sans-serif; font-size: 1.7rem; font-weight: 800; line-height: 0.8; }
.roya-back b { font-size: 0.78rem; font-weight: 800; white-space: nowrap; }

.roya-heading {
  position: absolute;
  top: clamp(74px, 12vh, 126px);
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 10px;
  direction: rtl;
  text-align: center;
}

.roya-heading span {
  color: #e5b34b;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.roya-heading h1 {
  margin: 0;
  color: #f5f1e5;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1.15;
  font-weight: 900;
}

.roya-art {
  position: relative;
  z-index: 2;
  display: block;
  width: min(52vw, 560px);
  height: min(52vw, 560px);
  object-fit: contain;
  filter: drop-shadow(0 22px 34px rgba(0, 15, 13, 0.42));
}

.roya-rule {
  position: absolute;
  bottom: clamp(28px, 7vh, 70px);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(270px, 48vw);
}

.roya-rule i { flex: 1; height: 1px; background: rgba(195, 154, 75, 0.6); }
.roya-rule b { width: 6px; height: 6px; background: #e5b34b; transform: rotate(45deg); }

.roya-first-video,
.roya-second-video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: transparent;
  pointer-events: none;
}

.roya-first-video {
  z-index: 3;
}

.roya-second-video {
  z-index: 4;
  opacity: 0;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  object-position: center;
}

.roya-third-video,
.roya-fourth-video,
.roya-fifth-video,
.roya-sixth-video,
.roya-seventh-video,
.roya-eighth-video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  opacity: 0;
  object-fit: contain;
  object-position: center;
  background: transparent;
  pointer-events: none;
}

.roya-third-video {
  z-index: 5;
}

.roya-fourth-video {
  z-index: 6;
}

.roya-fifth-video {
  z-index: 7;
}

.roya-sixth-video {
  z-index: 8;
}

.roya-seventh-video {
  z-index: 9;
}

.roya-eighth-video {
  z-index: 10;
}

.roya-screen.is-second-active .roya-first-video {
  opacity: 0;
}

.roya-screen.is-second-active .roya-second-video {
  opacity: 1;
}

.roya-screen.is-third-active .roya-second-video {
  opacity: 0;
}

.roya-screen.is-third-active .roya-third-video {
  opacity: 1;
}

.roya-screen.is-fourth-active .roya-third-video {
  opacity: 0;
}

.roya-screen.is-fourth-active .roya-fourth-video {
  opacity: 1;
}

.roya-screen.is-fifth-active .roya-fourth-video {
  opacity: 0;
}

.roya-screen.is-fifth-active .roya-fifth-video {
  opacity: 1;
}

.roya-screen.is-sixth-active .roya-fifth-video {
  opacity: 0;
}

.roya-screen.is-sixth-active .roya-sixth-video {
  opacity: 1;
}

.roya-screen.is-seventh-active .roya-sixth-video {
  opacity: 0;
}

.roya-screen.is-seventh-active .roya-seventh-video {
  opacity: 1;
}

.roya-screen.is-eighth-active .roya-seventh-video {
  opacity: 0;
}

.roya-screen.is-eighth-active .roya-eighth-video {
  opacity: 1;
}

@media (max-width: 720px) {
  .roya-back {
    top: calc(env(safe-area-inset-top) + 12px);
    left: calc(env(safe-area-inset-left) + 12px);
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
  }
  .roya-back b { display: none; }
  .roya-heading { top: 76px; }
  .roya-heading h1 { font-size: clamp(1.7rem, 8vw, 2.7rem); }
  .roya-art { width: min(75vw, 420px); height: min(75vw, 420px); }
  .roya-rule { bottom: 34px; }
}

