:root {
  color-scheme: dark;
  --bg: #100e0f;
  --ink: #fff7e9;
  --muted: #d7c7ae;
  --red: #d31820;
  --gold: #f4b43a;
  --green: #35c57a;
  --blue: #5fd3ff;
  --panel: rgba(22, 18, 18, 0.78);
  --stroke: rgba(255, 228, 177, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: #050505;
  color: var(--ink);
  font-family: "Cairo", Tahoma, Arial, sans-serif;
}

html[lang="en"] body {
  font-family: "Poppins", Arial, sans-serif;
}

html[lang="ar"] body {
  font-family: "Cairo", Tahoma, Arial, sans-serif;
}

body {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.phone-shell {
  position: relative;
  isolation: isolate;
  width: min(100vw, 430px);
  min-height: 100svh;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  --choices-top: 170px;
  --face-x: 50%;
  --face-y: 360px;
  --face-w: 128px;
  --face-h: 152px;
  background:
    radial-gradient(circle at 25% 12%, rgba(244, 180, 58, 0.28), transparent 20rem),
    radial-gradient(circle at 80% 100%, rgba(211, 24, 32, 0.32), transparent 18rem),
    linear-gradient(145deg, #191112, #070707 55%, #140b0b);
}

.camera-bg,
.camera {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.camera-bg {
  z-index: -5;
  object-fit: cover;
  opacity: 0;
  filter: blur(16px) saturate(1.08);
  transform: scaleX(-1) scale(1.08);
  transition: opacity 240ms ease;
}

.camera {
  z-index: -4;
  object-fit: contain;
  opacity: 0;
  transform: scaleX(-1);
  transition: opacity 240ms ease;
}

.camera-bg.is-on {
  opacity: 0.18;
}

.camera.is-on {
  opacity: 1;
}

.phone-shell[data-screen="result"] .camera,
.phone-shell[data-screen="result"] .camera-bg {
  opacity: 0 !important;
  visibility: hidden;
}

.smoke-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 32% 42%, rgba(255, 255, 255, 0.18), transparent 9rem),
    radial-gradient(circle at 70% 56%, rgba(244, 180, 58, 0.16), transparent 8rem),
    radial-gradient(circle at 48% 72%, rgba(255, 255, 255, 0.13), transparent 10rem);
}

.smoke-layer.burst {
  animation: smokeBurst 520ms ease;
}

.transition-layer {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 48%, rgba(244, 180, 58, 0.18), transparent 16rem),
    linear-gradient(180deg, rgba(255, 247, 233, 0.08), rgba(13, 9, 8, 0.34));
  transform: translateY(14px);
  backdrop-filter: blur(6px);
}

.transition-layer.is-active {
  animation: calmFade 520ms ease;
}

.screen {
  min-height: 100%;
  padding: 26px 20px calc(22px + env(safe-area-inset-bottom));
  animation: screenIn 360ms ease both;
}

.intro-screen,
.gate-screen,
.loading-screen,
.result-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
}

.intro-screen {
  position: relative;
}

.intro-screen > :not(.intro-fruits) {
  position: relative;
  z-index: 1;
}

.gate-screen h2 {
  max-width: 12em;
  font-size: clamp(2rem, 10vw, 3.2rem);
  line-height: 1.05;
}

.gate-screen p {
  max-width: 24rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.gate-actions {
  display: grid;
  width: min(100%, 340px);
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.gate-btn {
  min-height: 56px;
  border: 1px solid rgba(255, 231, 171, 0.8);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 42%),
    linear-gradient(135deg, #ffe39c, #eda53a 58%, #cf2b2f);
  color: #170808;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.34);
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
}

.brand-lockup {
  display: grid;
  gap: 5px;
  place-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.logo,
.logo-ar {
  display: inline-grid;
  min-width: 116px;
  min-height: 42px;
  place-items: center;
  border: 2px solid var(--gold);
  border-radius: 8px;
  background: linear-gradient(135deg, #bf141a, #741014);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  color: #fff5d8;
  font-weight: 900;
  letter-spacing: 0;
}

.logo-ar {
  min-width: 104px;
  font-size: 1.8rem;
}

.logo-ar.mini {
  min-width: 54px;
  min-height: 28px;
  border-width: 1px;
  border-radius: 7px;
  font-size: 1rem;
}

.top-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo.small {
  min-width: 78px;
  min-height: 30px;
  font-size: 0.88rem;
}

.slogan-img {
  display: block;
  width: min(58vw, 230px);
  height: auto;
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.48));
}

.slogan-small {
  display: block;
  width: 76px;
  height: auto;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.42));
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 13ch;
  font-size: clamp(2.25rem, 12vw, 3.85rem);
  line-height: 0.96;
  text-wrap: balance;
}

h1 span,
.loading-screen h2 span {
  display: block;
  margin-top: 0.35em;
  color: var(--muted);
  font-size: 0.34em;
  line-height: 1.15;
}

.intro-screen p {
  max-width: 23rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.intro-fruits {
  position: absolute;
  right: max(-106px, -24vw);
  bottom: 70px;
  z-index: 0;
  width: min(74vw, 330px);
  height: auto;
  opacity: 0.88;
  pointer-events: none;
  transform: rotate(-10deg);
  filter: drop-shadow(0 22px 38px rgba(0, 0, 0, 0.42));
}

.agree-btn {
  width: min(100%, 330px);
  min-height: 56px;
  border: 1px solid rgba(255, 231, 171, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 42%),
    linear-gradient(135deg, #ffe39c, #eda53a 58%, #cf2b2f);
  color: #170808;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.34);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0;
}

.agree-btn.is-loading {
  filter: saturate(0.75);
}

.carousel,
.pack-orbit {
  position: relative;
  width: min(92vw, 340px);
  height: 158px;
}

.carousel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  perspective: 800px;
}

.carousel img {
  position: relative;
  top: auto;
  width: 62px;
  height: 112px;
  margin-inline: -10px;
  border-radius: 8px;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center bottom;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.46);
  animation: packFloat 2.4s infinite ease-in-out;
}

.carousel img:nth-child(1) {
  transform: rotate(8deg);
}

.carousel img:nth-child(2) {
  transform: rotate(-5deg);
  animation-delay: 120ms;
}

.carousel img:nth-child(3) {
  transform: rotate(5deg);
  animation-delay: 240ms;
}

.carousel img:nth-child(4) {
  transform: rotate(-7deg);
  animation-delay: 360ms;
}

.carousel img:nth-child(5) {
  transform: rotate(5deg);
  animation-delay: 480ms;
}

.carousel img:nth-child(6) {
  transform: rotate(-5deg);
  animation-delay: 600ms;
}

.carousel img:nth-child(7) {
  transform: rotate(6deg);
  animation-delay: 720ms;
}

.carousel img:nth-child(8) {
  transform: rotate(-6deg);
  animation-delay: 840ms;
}

.carousel img:nth-child(9) {
  transform: rotate(7deg);
  animation-delay: 960ms;
}

.pack {
  position: relative;
  display: grid;
  width: 78px;
  height: 124px;
  place-items: end center;
  padding: 10px 7px;
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-radius: 7px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.42);
}

.pack::before {
  content: "";
  position: absolute;
  width: 42px;
  height: 42px;
  margin-bottom: 52px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
}

.pack::after {
  content: attr(data-emoji);
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  color: #111;
  font-size: 1.05rem;
  line-height: 1;
}

.max {
  background: linear-gradient(160deg, #111, #d40f1a 54%, #ffc13b);
}

.regular {
  background: linear-gradient(160deg, #6a1014, #df2730 54%, #f5bd43);
}

.masri {
  background: linear-gradient(160deg, #181818, #b7171c 48%, #f3f0dc 49%, #111 67%);
}

.watermelon {
  background: linear-gradient(160deg, #0b3e2b, #21b96e 48%, #f13542 49%, #111);
}

.mint {
  background: linear-gradient(160deg, #0f1a18, #38c486 52%, #eafef4);
  color: #102018;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-text,
.result-label,
.theme-pill {
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
  color: var(--muted);
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 700;
}

.quiz-screen {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 12px;
  align-content: start;
}

.question-card {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(244, 180, 58, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(17, 12, 12, 0.76), rgba(63, 18, 20, 0.5)),
    radial-gradient(circle at 50% 0%, rgba(244, 180, 58, 0.22), transparent 12rem);
  backdrop-filter: blur(14px);
  box-shadow: 0 22px 42px rgba(0, 0, 0, 0.34);
}

.question-card h2 {
  min-height: auto;
  max-width: 12.5em;
  font-size: clamp(1.35rem, 6vw, 1.95rem);
  line-height: 1.15;
  text-align: center;
  text-wrap: balance;
}

.question-kicker {
  border-radius: 999px;
  background: rgba(244, 180, 58, 0.16);
  color: #f7d996;
  padding: 5px 11px;
  font-size: 0.82rem;
  font-weight: 900;
}

.answers {
  position: relative;
  z-index: 5;
  top: auto;
  left: auto;
  width: min(82vw, 318px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  direction: ltr;
  transform: none;
}

.answer-card {
  display: grid;
  min-height: 72px;
  place-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(255, 231, 171, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 45%),
    linear-gradient(135deg, #ffe39b, #eda439 58%, #ca2b30);
  color: #170808;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.36);
  font-size: clamp(1.25rem, 6vw, 1.85rem);
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
  pointer-events: none;
  transition: transform 160ms ease, border-color 160ms ease, filter 160ms ease;
}

.answer-card.is-active {
  border-color: #fff2c4;
  filter: brightness(1.12) saturate(1.18);
  transform: translateY(-4px) scale(1.04);
}

.answer-card.is-armed {
  box-shadow: 0 0 0 5px rgba(244, 180, 58, 0.28), 0 18px 34px rgba(0, 0, 0, 0.42);
}

.pack-orbit {
  display: flex;
  width: min(96vw, 560px);
  height: 185px;
  align-items: center;
  justify-content: center;
  gap: 0;
  perspective: 700px;
}

.pack-orbit img {
  position: relative;
  inset: auto;
  width: clamp(48px, 9vw, 76px);
  height: clamp(86px, 16vw, 122px);
  margin-inline: clamp(-13px, -2vw, -7px);
  border-radius: 8px;
  object-fit: cover;
  object-position: center;
  box-shadow: none;
  transform-origin: center;
  animation: revealCard 1.2s infinite ease-in-out;
}

.pack-orbit img:nth-child(1) {
  transform: translateY(12px) rotate(-12deg);
}

.pack-orbit img:nth-child(2) {
  transform: translateY(-2px) rotate(-6deg);
  animation-delay: 100ms;
}

.pack-orbit img:nth-child(3) {
  transform: translateY(-10px) scale(1.08);
  animation-delay: 200ms;
}

.pack-orbit img:nth-child(4) {
  transform: translateY(-2px) rotate(6deg);
  animation-delay: 300ms;
}

.pack-orbit img:nth-child(5) {
  transform: translateY(-10px) scale(1.08);
  animation-delay: 400ms;
}

.pack-orbit img:nth-child(6) {
  transform: translateY(-2px) rotate(6deg);
  animation-delay: 500ms;
}

.pack-orbit img:nth-child(7) {
  transform: translateY(12px) rotate(12deg);
  animation-delay: 600ms;
}

.pack-orbit img:nth-child(8) {
  transform: translateY(20px) rotate(15deg);
  animation-delay: 700ms;
}

.pack-orbit img:nth-child(9) {
  transform: translateY(26px) rotate(18deg);
  animation-delay: 800ms;
}

.loading-screen h2 {
  font-size: 2rem;
}

.result-screen {
  position: absolute;
  inset: 0;
  min-height: auto;
  justify-content: center;
  padding-top: 92px;
  gap: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(244, 180, 58, 0.2), transparent 13rem),
    radial-gradient(circle at 82% 86%, rgba(211, 24, 32, 0.24), transparent 15rem),
    linear-gradient(160deg, rgba(31, 19, 17, 1), rgba(5, 5, 5, 1));
}

.result-screen .top-bar {
  position: absolute;
  z-index: 3;
  top: 24px;
  right: 20px;
  left: 20px;
}

.result-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  width: auto;
  aspect-ratio: auto;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(244, 180, 58, 0.2), transparent 13rem),
    radial-gradient(circle at 82% 86%, rgba(211, 24, 32, 0.24), transparent 15rem),
    linear-gradient(160deg, rgba(31, 19, 17, 0.98), rgba(5, 5, 5, 0.98));
  box-shadow: none;
}

.result-content {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(100%, 390px);
  gap: 18px;
  justify-items: center;
  align-content: center;
}

.result-photo,
.result-photo-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.result-photo {
  object-fit: cover;
  opacity: 0;
  background: rgba(0, 0, 0, 0.62);
}

.result-photo.has-photo {
  opacity: 0;
}

.result-photo-shade {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.36) 72%, rgba(0, 0, 0, 0.72)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 6px);
}

.result-pack {
  position: relative;
  top: auto;
  display: grid;
  width: min(66vw, 250px);
  min-height: 320px;
  place-items: center;
  overflow: hidden;
  padding: 18px 16px 54px;
  border: 1px solid rgba(255, 234, 184, 0.5);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 241, 205, 0.92)),
    radial-gradient(circle at 50% 12%, rgba(244, 180, 58, 0.24), transparent 10rem);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  animation: revealPack 520ms ease both;
}

.result-pack img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.result-pack span {
  position: absolute;
  right: 14px;
  bottom: 12px;
  left: 14px;
  display: block;
  border-radius: 8px;
  background: linear-gradient(135deg, #1c1110, #7d1518);
  color: #fff7e9;
  padding: 10px 8px;
  font-size: 0.98rem;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.22);
}

.result-copy {
  width: min(100%, 360px);
  border: 1px solid rgba(255, 234, 184, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(35, 20, 19, 0.88), rgba(10, 7, 7, 0.7)),
    radial-gradient(circle at 50% 0%, rgba(244, 180, 58, 0.18), transparent 12rem);
  padding: 18px 16px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  text-align: center;
}

.result-screen h2 {
  max-width: none;
  font-size: clamp(2rem, 8vw, 2.75rem);
  line-height: 1.08;
  text-wrap: balance;
}

.result-screen p {
  max-width: none;
  margin-top: 10px;
  color: var(--ink);
  font-size: clamp(1rem, 4vw, 1.18rem);
  line-height: 1.55;
  white-space: pre-line;
  text-wrap: balance;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 16px;
}

.result-action {
  min-height: 48px;
  border: 1px solid rgba(255, 231, 171, 0.78);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 42%),
    linear-gradient(135deg, #ffe39c, #eda53a 58%, #cf2b2f);
  color: #170808;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.34);
  font: inherit;
  font-size: 0.98rem;
  font-weight: 900;
}

.result-action:disabled {
  cursor: wait;
  filter: saturate(0.65) brightness(0.86);
  opacity: 0.75;
}

[hidden] {
  display: none !important;
}

@keyframes smokeBurst {
  0% {
    opacity: 0;
    transform: scale(0.85) rotate(0deg);
  }
  45% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.35) rotate(9deg);
  }
}

@keyframes calmFade {
  0% {
    opacity: 0;
    transform: translateY(14px);
  }
  42% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes packFloat {
  50% {
    translate: 0 -9px;
  }
}

@keyframes revealCard {
  50% {
    translate: 0 -10px;
    filter: brightness(1.12);
  }
}

@keyframes revealPack {
  from {
    opacity: 0;
    transform: scale(0.55) rotate(-8deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@media (min-width: 700px) {
  .phone-shell {
    width: 100vw;
    min-height: auto;
    height: 100vh;
    aspect-ratio: auto;
    border-inline: 0;
  }

  .screen {
    padding: 32px 56px;
  }

  .quiz-screen {
    max-width: 980px;
    margin: 0 auto;
    grid-template-rows: auto auto auto;
  }

  .question-card {
    width: min(760px, 72vw);
    margin: 26px auto 0;
  }

  .answers {
    width: min(560px, 60vw);
  }

  .question-card h2 {
    font-size: clamp(2rem, 4vw, 3rem);
  }

  .answer-card {
    min-height: 86px;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
  }

  .intro-fruits {
    right: max(-18px, 3vw);
    bottom: 56px;
    width: min(36vw, 500px);
    opacity: 0.92;
  }

  .result-screen {
    padding: 120px 72px 72px;
  }

  .result-screen .top-bar {
    right: 72px;
    left: 72px;
  }

  .result-content {
    width: min(100%, 980px);
    grid-template-columns: minmax(300px, 420px) minmax(360px, 520px);
    gap: clamp(32px, 6vw, 76px);
    align-items: center;
    justify-content: center;
  }

  .result-pack {
    width: min(31vw, 360px);
    min-height: min(48vh, 460px);
    padding: 24px 22px 64px;
  }

  .result-pack span {
    right: 18px;
    bottom: 16px;
    left: 18px;
    font-size: 1.08rem;
  }

  .result-copy {
    width: 100%;
    padding: 34px 34px 32px;
    text-align: start;
  }

  html[dir="rtl"] .result-copy {
    text-align: right;
  }

  html[dir="ltr"] .result-copy {
    text-align: left;
  }

  .result-screen h2 {
    font-size: clamp(3rem, 5vw, 5.3rem);
    line-height: 0.98;
  }

  .result-screen p {
    margin-top: 20px;
    font-size: clamp(1.2rem, 1.6vw, 1.65rem);
    line-height: 1.45;
  }

  .result-actions {
    grid-template-columns: 1fr 1fr;
    margin-top: 24px;
  }
}
