/* ───────────── صفحه‌ی ۵ پرسش: صحنه‌های تصویری + کارت شیشه‌ای ───────────── */
html:has(.page-quiz) { overflow-x: hidden; }
.page-quiz { overflow-x: hidden; background: #050201; }
.page-quiz .ambient { background: #050201; }

/* صحنه‌ها: کراس‌فید نرم بین تصاویر */
.scenes { position: fixed; inset: 0; z-index: -2; overflow: hidden; background: #050201; }
.scene {
  position: absolute; inset: 0; opacity: 0; z-index: 0;
  background-image: var(--img); background-size: cover; background-position: var(--pos, 50% 55%); background-repeat: no-repeat;
  transform: scale(1.06); will-change: opacity, transform;
}
.scene.is-prev { opacity: 1; z-index: 1; }
.scene.is-on { opacity: 1; z-index: 2; transition: opacity 1.5s ease; animation: drift 28s ease-in-out infinite alternate; }
.scene.is-first { animation: scene-first 2.2s ease both, drift 28s 2.2s ease-in-out infinite alternate; }
@keyframes drift { from { transform: scale(1.06) translate3d(0, 0, 0); } to { transform: scale(1.16) translate3d(-1.2%, -.8%, 0); } }
@keyframes scene-first { from { opacity: 0; } to { opacity: 1; } }
/* خوانایی: سایه‌ی نرم بالا و پایین */
.scenes::after {
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(40, 12, 62, .55) 0%, rgba(40, 12, 62, .04) 26%, rgba(60, 14, 70, .06) 58%, rgba(36, 10, 56, .72) 100%),
    radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(30, 8, 48, .42) 100%);
}
.scenes.is-flare::before { content: ""; position: absolute; inset: 0; z-index: 4; background: radial-gradient(60% 50% at 50% 55%, rgba(255, 150, 50, .3), transparent 70%); animation: flare .8s ease-out both; }
@keyframes flare { from { opacity: 1; } to { opacity: 0; } }
.scene--1 { --pos: 38% 55%; } .scene--2 { --pos: 35% 55%; } .scene--3 { --pos: 40% 55%; } .scene--4 { --pos: 0% 55%; } .scene--5 { --pos: 33% 55%; }
@media (max-aspect-ratio: 1/1) { .scene, .scene--4 { background-image: var(--img-m); --pos: 50% 40%; } }

#embers { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; opacity: .75; }

.quiz-shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding-top: var(--safe-t); position: relative; }
.quiz-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 6px; }

/* پیام «رایگان»: اول پررنگ، بعد از چند ثانیه جمع می‌شود (نشان بالای صفحه می‌ماند) */
.promise {
  display: flex; align-items: center; gap: 12px; margin: 6px auto 0; width: min(calc(100% - 32px), 560px);
  padding: 10px 16px; border-radius: 16px; font-size: .86rem; line-height: 1.7; overflow: hidden; max-height: 120px;
  background: linear-gradient(110deg, rgba(40, 18, 6, .66), rgba(60, 14, 8, .6));
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 179, 71, .45); color: var(--milk);
  animation: promise-in .9s .4s var(--ease) both; position: relative; z-index: 5;
  transition: max-height .8s var(--ease), opacity .8s, margin .8s, padding .8s, border-width .8s;
}
.promise.is-compact { max-height: 0; opacity: 0; margin-top: 0; padding-block: 0; border-width: 0; }
.promise p { margin: 0; } .promise strong { display: block; font-weight: 800; color: #ffe2b8; }
.promise span:not(.promise__spark) { color: var(--milk-dim); }
.promise__spark { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--gold); box-shadow: 0 0 14px 4px rgba(255, 179, 71, .7); animation: pulse 2s infinite; }
@keyframes promise-in { from { opacity: 0; transform: translateY(-12px); } }
@keyframes pulse { 50% { transform: scale(1.5); opacity: .6; } }

.stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; padding: 10px 14px 6px; min-height: 0; }

/* کارت شیشه‌ای پرسش */
.qcard {
  position: relative; z-index: 3; width: min(100%, 460px);
  padding: 16px 16px 12px; border-radius: 26px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .04)), rgba(16, 6, 3, .58);
  border: 1px solid rgba(255, 255, 255, .22);
  -webkit-backdrop-filter: blur(22px) saturate(150%); backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.qcard__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.qcard__count { font-size: .78rem; color: var(--milk-dim); font-weight: 700; white-space: nowrap; }
.qcard__bars { display: flex; gap: 5px; flex: 1; max-width: 150px; }
.qcard__bars i { flex: 1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .2); overflow: hidden; position: relative; }
.qcard__bars i::after { content: ""; position: absolute; inset: 0; background: var(--grad-fire); transform: scaleX(0); transform-origin: right; transition: transform .6s var(--ease); }
.qcard__bars i.is-done::after, .qcard__bars i.is-now::after { transform: scaleX(1); }
.qcard__bars i.is-now::after { opacity: .6; animation: pulse-bar 1.6s infinite; }
@keyframes pulse-bar { 50% { opacity: 1; } }

.qcard__body { position: relative; }
.qtitle { font-size: clamp(1rem, 3.9vw, 1.2rem); font-weight: 800; line-height: 1.75; margin-bottom: 12px; text-shadow: 0 2px 14px rgba(0, 0, 0, .5); }
.qopts { display: grid; gap: 8px; }
.qopt {
  display: flex; align-items: center; gap: 11px; width: 100%; min-height: 48px; padding: 9px 12px;
  text-align: right; font-size: clamp(.88rem, 3.4vw, .96rem); line-height: 1.6; font-weight: 500;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18); border-radius: 15px;
  transition: background .25s, border-color .25s, transform .25s var(--ease), box-shadow .25s;
}
.qopt__n { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-size: .78rem; font-weight: 800; background: rgba(255, 255, 255, .14); transition: .25s; }
.qopt:hover, .qopt:focus-visible { background: rgba(255, 255, 255, .16); border-color: rgba(255, 220, 160, .6); transform: translateY(-1px); }
.qopt.is-picked { background: linear-gradient(120deg, rgba(255, 179, 71, .45), rgba(255, 79, 109, .4)); border-color: #ffd9a0; box-shadow: 0 0 28px rgba(255, 150, 40, .5); transform: scale(1.015); }
.qopt.is-picked .qopt__n { background: var(--grad-fire); color: #1b0804; }
.qopt.was { border-color: rgba(255, 220, 160, .55); }
.qcard__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; min-height: 28px; }
.qback { background: none; border: 0; padding: 4px 2px; font-size: .82rem; color: var(--milk-dim); font-weight: 600; }
.qback:hover { color: var(--milk); }
.qhint { font-size: .74rem; color: var(--milk-faint); margin-inline-start: auto; text-align: left; }

/* انتقال نرم بین پرسش‌ها (RTL: خروج به چپ، ورود از راست) */
.qbody-in { animation: q-in .6s var(--ease) both; }
.qbody-out { animation: q-out .32s ease-in both; pointer-events: none; }
.qbody-in-back { animation: q-in-back .6s var(--ease) both; }
.qbody-out-back { animation: q-out-back .32s ease-in both; pointer-events: none; }
@keyframes q-in { from { opacity: 0; transform: translateX(34px); filter: blur(4px); } }
@keyframes q-out { to { opacity: 0; transform: translateX(-34px); filter: blur(4px); } }
@keyframes q-in-back { from { opacity: 0; transform: translateX(-34px); filter: blur(4px); } }
@keyframes q-out-back { to { opacity: 0; transform: translateX(34px); filter: blur(4px); } }
.qopts .qopt { animation: opt-in .5s var(--ease) both; }
.qopts .qopt:nth-child(1) { animation-delay: .05s; } .qopts .qopt:nth-child(2) { animation-delay: .1s; }
.qopts .qopt:nth-child(3) { animation-delay: .15s; } .qopts .qopt:nth-child(4) { animation-delay: .2s; }
@keyframes opt-in { from { opacity: 0; transform: translateY(10px); } }

/* نتیجه */
.qresult { text-align: center; display: grid; gap: 12px; justify-items: center; }
.qresult__orb { width: 74px; height: 74px; border-radius: 50%; background: radial-gradient(circle at 32% 28%, #fff3c2, var(--a) 40%, var(--b) 100%); box-shadow: 0 0 40px var(--a), 0 0 90px var(--b); animation: beat 3.6s ease-in-out infinite; }
.qresult small { color: var(--milk-dim); font-size: .8rem; font-weight: 600; }
.qresult h2 { font-size: 1.5rem; font-weight: 900; line-height: 1.3; }
.qresult p { font-size: .92rem; color: var(--milk-dim); }
.qresult ul { list-style: none; padding: 0; margin: 2px 0 0; display: grid; gap: 4px; text-align: right; font-size: .84rem; color: var(--milk); width: 100%; }
.qresult li::before { content: "✦ "; color: var(--gold); }
.qresult .btn { margin-top: 6px; }

.quiz-bottom { display: flex; justify-content: space-between; gap: 12px; padding: 8px 20px calc(14px + var(--safe-b)); font-size: .8rem; color: var(--milk-dim); position: relative; z-index: 5; text-shadow: 0 1px 8px rgba(0, 0, 0, .8); }
.quiz-bottom a { text-decoration: underline; text-underline-offset: 4px; }

/* کارت همیشه دقیقاً وسط صفحه است (همه‌ی اندازه‌ها) */
@media (min-width: 900px) {
  .qcard { width: 460px; padding: 22px 22px 14px; }
  .qopt { min-height: 52px; }
  .promise { font-size: .92rem; }
}
@media (max-width: 380px) {
  .qhint { display: none; }
  .quiz-bottom span { display: none; } .quiz-bottom { justify-content: center; }
  .promise { font-size: .8rem; padding: 8px 12px; }
}
/* موبایل افقی/کوتاه: کارت در جریان صفحه، صفحه اسکرول می‌شود */
@media (max-height: 620px) and (orientation: landscape) {
  .page-quiz { overflow-y: auto; }
  .qcard { margin: 8px auto; }
}
