:root {
  --bg: #f6f7fb;
  --ink: #14213d;
  --muted: #637083;
  --surface: #ffffff;
  --line: rgba(189, 149, 214, 0.42);
  --primary: #8a1fb3;
  --primary-dark: #3d0a50;
  --accent: #d946ef;
  --good: #16a34a;
  --bad: #dc2626;
  --soft-good: #dcfce7;
  --soft-bad: #fee2e2;
  --shadow: 0 22px 60px rgba(61, 10, 80, 0.18);
}

@property --score-percent {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Cairo", system-ui, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(217, 70, 239, 0.24), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(138, 31, 179, 0.16), transparent 30rem),
    linear-gradient(145deg, #fbf7ff 0%, #f3e8ff 48%, #fff7ff 100%);
}

button {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.view {
  display: none;
  animation: viewIn 0.36s ease both;
}

.view.active {
  display: block;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar,
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  line-height: 1.15;
  letter-spacing: 0;
}

.signature {
  width: fit-content;
  margin: 12px 0 0;
  color: var(--primary-dark);
  direction: ltr;
  font-family: "Pacifico", cursive;
  font-size: clamp(1.45rem, 3vw, 2.25rem);
  line-height: 1.2;
  text-align: left;
  text-shadow: 0 10px 22px rgba(138, 31, 179, 0.18);
  white-space: nowrap;
}

.subject-name {
  width: fit-content;
  margin: 12px 0 0;
  padding: 8px 14px;
  color: var(--primary-dark);
  border: 1px solid rgba(138, 31, 179, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  font-size: clamp(1rem, 2vw, 1.18rem);
  font-weight: 800;
}

.signature::after {
  content: "";
  display: block;
  width: 78%;
  height: 2px;
  margin-top: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), transparent);
}

.hero-band {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  align-items: center;
  margin: 22px 0 24px;
  padding: 26px;
  border: 1px solid rgba(138, 31, 179, 0.2);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(243, 232, 255, 0.5));
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.spark {
  display: inline-flex;
  margin-bottom: 10px;
  color: var(--accent);
  font-weight: 800;
}

.hero-band h2 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2.8vw, 2rem);
  line-height: 1.45;
}

.prayer-line {
  color: #1f2937;
  font-family: "Amiri", "Cairo", serif;
  font-size: clamp(1.7rem, 4.4vw, 3.25rem);
  font-weight: 700;
  text-wrap: balance;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-box {
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(14px);
}

.stat-box strong {
  display: block;
  font-size: 1.55rem;
  line-height: 1.2;
}

.stat-box span {
  color: var(--muted);
  font-size: 0.86rem;
}

.chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.chapter-card {
  display: flex;
  min-height: 230px;
  padding: 20px;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(20, 33, 61, 0.08);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.chapter-card:hover {
  transform: translateY(-4px);
  border-color: rgba(138, 31, 179, 0.42);
  box-shadow: var(--shadow);
}

.chapter-card h3 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.chapter-card p {
  color: var(--muted);
  line-height: 1.7;
}

.chapter-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.score-pill {
  padding: 5px 10px;
  color: #075985;
  font-weight: 800;
  border-radius: 999px;
  background: #e0f2fe;
}

.empty-state {
  display: none;
  padding: 24px;
  color: var(--muted);
  border: 1px dashed rgba(138, 31, 179, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  font-weight: 700;
  line-height: 1.9;
}

.empty-state.show {
  display: block;
}

.primary-btn,
.ghost-btn,
.icon-text-btn {
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.primary-btn {
  color: white;
  background: var(--primary);
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(138, 31, 179, 0.26);
}

.primary-btn:hover:not(:disabled),
.ghost-btn:hover,
.icon-text-btn:hover {
  transform: translateY(-2px);
}

.primary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
}

.chapter-actions {
  display: grid;
  gap: 10px;
}

.ghost-btn,
.icon-text-btn {
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  font-weight: 800;
}

.quiz-title-block {
  text-align: left;
}

.progress-wrap {
  margin-bottom: 18px;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 800;
}

.streak-badge {
  padding: 5px 11px;
  color: var(--primary-dark);
  border: 1px solid rgba(217, 70, 239, 0.28);
  border-radius: 999px;
  background: rgba(250, 232, 255, 0.86);
}

.progress-track {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: #e2e8f0;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.36s ease;
}

.quiz-card,
.result-panel,
.review-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.quiz-card {
  padding: clamp(18px, 4vw, 34px);
}

.question-text {
  min-height: 80px;
  margin-bottom: 20px;
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 800;
  line-height: 1.5;
}

.question-media {
  display: none;
  margin-bottom: 18px;
}

.question-media img {
  display: block;
  width: min(100%, 720px);
  max-height: 420px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.essay-answer {
  display: none;
  width: 100%;
  min-height: 150px;
  margin-bottom: 14px;
  padding: 14px 16px;
  resize: vertical;
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  line-height: 1.6;
}

.essay-answer:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(138, 31, 179, 0.14);
}

.answers-list {
  display: grid;
  gap: 12px;
}

.answer-btn {
  width: 100%;
  min-height: 58px;
  padding: 14px 16px;
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  text-align: right;
  font-weight: 700;
  line-height: 1.5;
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.answer-btn:hover:not(:disabled) {
  transform: translateX(-4px);
  border-color: var(--primary);
}

.answer-btn.correct {
  color: #14532d;
  border-color: var(--good);
  background: var(--soft-good);
  animation: pop 0.22s ease both;
}

.answer-btn.wrong {
  color: #7f1d1d;
  border-color: var(--bad);
  background: var(--soft-bad);
  animation: shake 0.24s ease both;
}

.answer-btn:disabled {
  cursor: default;
}

@keyframes pop {
  50% {
    transform: scale(1.015);
  }
}

@keyframes shake {
  25% {
    transform: translateX(5px);
  }
  50% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(3px);
  }
}

.feedback-box {
  min-height: 56px;
  margin: 16px 0;
  color: var(--muted);
  font-weight: 800;
}

.feedback-box.good {
  color: var(--good);
}

.feedback-box.bad {
  color: var(--bad);
}

.result-panel {
  padding: clamp(22px, 5vw, 40px);
  margin-bottom: 18px;
}

.result-score {
  display: grid;
  place-items: center;
  width: min(15rem, 72vw);
  aspect-ratio: 1;
  margin: 22px auto 16px;
  color: var(--primary-dark);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.92) 0 58%, transparent 59%),
    conic-gradient(var(--primary) 0deg, var(--accent) calc(var(--score-percent, 0) * 3.6deg), rgba(216, 180, 254, 0.34) 0deg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 24px 70px rgba(61, 10, 80, 0.18);
  font-size: clamp(2.2rem, 7vw, 4.3rem);
  font-weight: 800;
  animation: scoreReveal 0.9s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.result-score span {
  display: block;
}

.result-score small {
  display: block;
  margin-top: -0.2rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.motivation {
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 700;
}

.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.review-section {
  padding: 24px;
}

.review-section h2 {
  margin-bottom: 16px;
  font-size: 1.35rem;
}

.mistakes-list {
  display: grid;
  gap: 12px;
}

.mistake-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mistake-item strong {
  display: block;
  margin-bottom: 8px;
}

.mistake-item p {
  margin-bottom: 6px;
  color: var(--muted);
}

.empty-review {
  padding: 16px;
  color: #14532d;
  border-radius: 8px;
  background: var(--soft-good);
  font-weight: 800;
}

.streak-celebration {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.streak-celebration.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.streak-break-moment {
  position: fixed;
  inset: 0;
  z-index: 49;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

.streak-break-moment.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.streak-break-moment::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(21, 5, 28, 0.12);
  backdrop-filter: blur(2px);
}

.streak-break-card {
  position: relative;
  display: grid;
  place-items: center;
  width: min(18rem, calc(100vw - 2rem));
  min-height: 18rem;
  padding: 1rem;
  color: #fff;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.22), transparent 38%),
    radial-gradient(circle at center, rgba(138, 31, 179, 0.28), transparent 68%);
  box-shadow: none;
  text-align: center;
  animation: sadCardIn 0.42s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.sad-face {
  font-size: clamp(5.4rem, 22vw, 9.5rem);
  line-height: 1;
  filter:
    drop-shadow(0 14px 30px rgba(0, 0, 0, 0.22))
    drop-shadow(0 0 28px rgba(138, 31, 179, 0.36));
  animation:
    sadWobble 0.78s ease-in-out infinite alternate,
    sadPulse 1.5s ease-in-out infinite;
}

.streak-break-card strong {
  margin-top: 0.25rem;
  font-size: clamp(1.35rem, 5vw, 2rem);
  line-height: 1.2;
  text-shadow: 0 3px 18px rgba(61, 10, 80, 0.42);
}

.streak-break-card p {
  margin: 0.35rem 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 800;
}

.streak-celebration::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 148, 25, 0.28), transparent 13rem),
    radial-gradient(circle at 50% 50%, rgba(217, 70, 239, 0.14), transparent 22rem),
    rgba(21, 5, 28, 0.16);
  backdrop-filter: blur(3px);
}

.streak-burst {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto auto;
  place-items: center;
  width: min(24rem, calc(100vw - 2rem));
  min-height: 24rem;
  padding: 1rem 1rem 2rem;
  color: #fff;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  text-align: center;
  overflow: visible;
  opacity: 0;
  transform: scale(0.68);
}

.streak-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.streak-confetti i {
  position: absolute;
  top: -2rem;
  left: calc(var(--x) * 1%);
  width: 0.65rem;
  height: 1.05rem;
  border-radius: 0.18rem;
  background: var(--c);
  box-shadow: 0 0 14px color-mix(in srgb, var(--c), transparent 35%);
  opacity: 0;
  transform: translateY(-2rem) rotate(0deg);
}

.streak-celebration.show .streak-confetti i {
  animation: confettiFall var(--d) linear var(--delay) infinite;
}

.streak-confetti i:nth-child(1) { --x: 6; --c: #ffd166; --d: 2.8s; --delay: 0s; }
.streak-confetti i:nth-child(2) { --x: 13; --c: #f97316; --d: 3.2s; --delay: 0.2s; }
.streak-confetti i:nth-child(3) { --x: 21; --c: #f0abfc; --d: 2.7s; --delay: 0.45s; }
.streak-confetti i:nth-child(4) { --x: 28; --c: #ffffff; --d: 3.4s; --delay: 0.1s; }
.streak-confetti i:nth-child(5) { --x: 36; --c: #fb7185; --d: 3s; --delay: 0.7s; }
.streak-confetti i:nth-child(6) { --x: 43; --c: #ffd166; --d: 2.9s; --delay: 0.35s; }
.streak-confetti i:nth-child(7) { --x: 51; --c: #f97316; --d: 3.3s; --delay: 0.62s; }
.streak-confetti i:nth-child(8) { --x: 59; --c: #f0abfc; --d: 2.8s; --delay: 0.18s; }
.streak-confetti i:nth-child(9) { --x: 66; --c: #ffffff; --d: 3.5s; --delay: 0.48s; }
.streak-confetti i:nth-child(10) { --x: 72; --c: #fb7185; --d: 3s; --delay: 0.88s; }
.streak-confetti i:nth-child(11) { --x: 79; --c: #ffd166; --d: 2.7s; --delay: 0.22s; }
.streak-confetti i:nth-child(12) { --x: 86; --c: #f97316; --d: 3.35s; --delay: 0.58s; }
.streak-confetti i:nth-child(13) { --x: 93; --c: #f0abfc; --d: 2.95s; --delay: 0.04s; }
.streak-confetti i:nth-child(14) { --x: 17; --c: #ffffff; --d: 3.6s; --delay: 1s; }
.streak-confetti i:nth-child(15) { --x: 48; --c: #ffd166; --d: 3.1s; --delay: 1.15s; }
.streak-confetti i:nth-child(16) { --x: 82; --c: #fb7185; --d: 2.9s; --delay: 1.25s; }

.streak-celebration.show .streak-burst {
  animation: streakEnter 0.48s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.streak-burst::before,
.streak-burst::after {
  content: "";
  position: absolute;
  top: 1.7rem;
  width: 15rem;
  height: 15rem;
  border: 2px solid rgba(255, 183, 77, 0.28);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 245, 204, 0.2), transparent 34%),
    radial-gradient(circle, rgba(255, 109, 0, 0.18), transparent 62%);
  box-shadow:
    0 0 40px rgba(255, 115, 0, 0.28),
    0 0 86px rgba(217, 70, 239, 0.18);
  animation: streakRing 1.8s ease-out infinite;
}

.streak-burst::after {
  animation-delay: 0.22s;
}

.streak-flame {
  position: relative;
  z-index: 1;
  align-self: end;
  width: clamp(8rem, 28vw, 14rem);
  height: clamp(10rem, 32vw, 17rem);
  margin-bottom: -0.4rem;
  filter:
    drop-shadow(0 0 14px rgba(255, 236, 179, 0.95))
    drop-shadow(0 0 40px rgba(255, 109, 0, 0.72))
    drop-shadow(0 0 84px rgba(217, 70, 239, 0.5));
  animation: flameSpinIn 0.72s cubic-bezier(0.2, 0.9, 0.2, 1) both, flameFloat 2.1s ease-in-out infinite 0.72s;
}

.streak-flame::before,
.streak-flame::after {
  content: "";
  position: absolute;
  inset: 16% 18%;
  z-index: -1;
  border-radius: 50%;
  background: rgba(255, 167, 38, 0.42);
  filter: blur(24px);
  animation: corePulse 0.95s ease-in-out infinite alternate;
}

.streak-flame::after {
  inset: 8% 6%;
  background: rgba(217, 70, 239, 0.22);
  filter: blur(44px);
  animation-duration: 1.35s;
}

.flame {
  position: absolute;
  left: 50%;
  bottom: 0;
  display: block;
  transform-origin: 50% 92%;
  clip-path: polygon(
    50% 0%,
    63% 13%,
    66% 28%,
    79% 20%,
    93% 41%,
    98% 67%,
    84% 100%,
    16% 100%,
    2% 67%,
    8% 43%,
    24% 24%,
    34% 10%
  );
  mix-blend-mode: screen;
}

.flame-main {
  width: 78%;
  height: 92%;
  background:
    radial-gradient(circle at 50% 70%, rgba(255, 255, 255, 0.58), transparent 0 13%, rgba(255, 209, 102, 0.82) 14% 26%, transparent 27%),
    radial-gradient(circle at 50% 84%, #ff4d00 0 18%, transparent 42%),
    linear-gradient(180deg, #fff176 0%, #ffb000 27%, #ff6d00 58%, #d946ef 100%);
  transform: translateX(-50%) scaleX(0.98);
  box-shadow:
    inset 0 -1.8rem 2.8rem rgba(255, 255, 255, 0.18),
    0 0 48px rgba(255, 118, 0, 0.78);
  animation: flameBody 0.82s ease-in-out infinite alternate;
}

.flame-left {
  width: 43%;
  height: 64%;
  left: 32%;
  background: linear-gradient(180deg, #fff3b0 0%, #ffb703 36%, #fb5607 82%);
  transform: translateX(-50%) scaleX(0.92);
  opacity: 0.88;
  animation: flameLeft 0.74s ease-in-out infinite alternate;
}

.flame-right {
  width: 44%;
  height: 68%;
  left: 68%;
  background: linear-gradient(180deg, #fff1a8 0%, #ff9f1c 38%, #ff006e 100%);
  transform: translateX(-50%) scaleX(0.94);
  opacity: 0.82;
  animation: flameRight 0.9s ease-in-out infinite alternate;
}

.flame-core {
  width: 34%;
  height: 52%;
  background: linear-gradient(155deg, #fffdf0 0%, #ffe066 42%, #ff9f1c 100%);
  transform: translateX(-50%) scaleX(0.92);
  filter: blur(0.3px);
  animation: flameCore 0.68s ease-in-out infinite alternate;
}

.streak-burst strong {
  position: relative;
  z-index: 1;
  margin-top: 0.2rem;
  color: #fff;
  font-size: clamp(1.35rem, 5vw, 2.1rem);
  font-weight: 800;
  line-height: 1.25;
  text-shadow:
    0 2px 14px rgba(61, 10, 80, 0.42),
    0 0 24px rgba(255, 255, 255, 0.22);
}

.streak-burst p {
  position: relative;
  z-index: 1;
  margin: 0.35rem 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: clamp(1rem, 3vw, 1.18rem);
  font-weight: 800;
  text-shadow: 0 2px 12px rgba(61, 10, 80, 0.34);
}

.streak-burst strong::before,
.streak-burst strong::after,
.streak-burst p::before,
.streak-burst p::after {
  content: "";
  position: absolute;
  bottom: 7.6rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #ffd166;
  box-shadow:
    0 0 12px #ffd166,
    0 -4.8rem 0 rgba(255, 255, 255, 0.72),
    2.9rem -2.9rem 0 rgba(255, 152, 0, 0.88),
    -3.5rem -3.6rem 0 rgba(255, 224, 130, 0.82);
  opacity: 0;
  animation: sparkRise 1.65s ease-in-out infinite;
}

.streak-burst strong::before {
  left: 32%;
}

.streak-burst strong::after {
  right: 31%;
  animation-delay: 0.38s;
}

.streak-burst p::before {
  left: 42%;
  animation-delay: 0.72s;
}

.streak-burst p::after {
  right: 42%;
  animation-delay: 1.05s;
}

@keyframes scoreReveal {
  from {
    --score-percent: 0;
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes streakEnter {
  0% {
    opacity: 0;
    transform: scale(0.62) rotate(-8deg);
  }
  70% {
    opacity: 1;
    transform: scale(1.12) rotate(3deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes streakRing {
  from {
    opacity: 0.8;
    transform: scale(0.35);
  }
  to {
    opacity: 0;
    transform: scale(1.55);
  }
}

@keyframes flameDance {
  from {
    transform: translateY(0) rotate(-3deg) scale(1);
  }
  to {
    transform: translateY(-8px) rotate(3deg) scale(1.08);
  }
}

@keyframes flameGlow {
  0%,
  100% {
    filter:
      drop-shadow(0 0 10px rgba(255, 236, 179, 0.92))
      drop-shadow(0 0 28px rgba(255, 152, 0, 0.78))
      drop-shadow(0 0 58px rgba(217, 70, 239, 0.42));
  }
  50% {
    filter:
      drop-shadow(0 0 18px rgba(255, 245, 204, 1))
      drop-shadow(0 0 46px rgba(255, 109, 0, 0.92))
      drop-shadow(0 0 86px rgba(217, 70, 239, 0.58));
  }
}

@keyframes flameSpinIn {
  0% {
    opacity: 0;
    transform: rotate(-180deg) scale(0.25);
  }
  68% {
    opacity: 1;
    transform: rotate(12deg) scale(1.16);
  }
  100% {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
}

@keyframes flameBody {
  from {
    transform: translateX(-50%) translateY(0) scaleX(0.96) scaleY(1);
  }
  to {
    transform: translateX(-50%) translateY(-0.35rem) scaleX(1.04) scaleY(1.08);
  }
}

@keyframes flameLeft {
  from {
    transform: translateX(-50%) translateY(0) scaleX(0.9) scaleY(0.98);
  }
  to {
    transform: translateX(-56%) translateY(-0.72rem) scaleX(1.06) scaleY(1.08);
  }
}

@keyframes flameRight {
  from {
    transform: translateX(-50%) translateY(0.1rem) scaleX(0.92) scaleY(0.96);
  }
  to {
    transform: translateX(-44%) translateY(-0.85rem) scaleX(1.08) scaleY(1.08);
  }
}

@keyframes flameCore {
  from {
    transform: translateX(-50%) translateY(0.1rem) scaleX(0.86) scaleY(0.92);
    opacity: 0.82;
  }
  to {
    transform: translateX(-50%) translateY(-0.55rem) scaleX(1.04) scaleY(1.12);
    opacity: 1;
  }
}

@keyframes flameFloat {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -0.35rem;
  }
}

@keyframes corePulse {
  from {
    opacity: 0.55;
    transform: scale(0.84);
  }
  to {
    opacity: 0.92;
    transform: scale(1.12);
  }
}

@keyframes sparkRise {
  0% {
    opacity: 0;
    transform: translateY(1.2rem) scale(0.4);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-5.4rem) scale(1);
  }
}

@keyframes confettiFall {
  0% {
    opacity: 0;
    transform: translateY(-2rem) rotate(0deg);
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(calc(100vh + 3rem)) rotate(540deg);
  }
}

@keyframes sadCardIn {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.86);
  }
  70% {
    opacity: 1;
    transform: translateY(0) scale(1.06);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sadWobble {
  from {
    transform: translateY(0) rotate(-5deg) scale(1);
  }
  to {
    transform: translateY(-0.35rem) rotate(5deg) scale(1.04);
  }
}

@keyframes sadPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.82;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 18px;
  }

  .topbar,
  .quiz-header,
  .hero-band {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .stats-strip {
    grid-template-columns: 1fr;
  }

  .quiz-title-block {
    text-align: right;
  }
}
