/* ─────────────────────────────────────────────────────────────────────────
   Lion and Lamp — Story Quiz Module
   Full-screen cream/gold styling. Uses same tokens as main site.
   Load AFTER lion-and-lamp.css and player.css.
   ───────────────────────────────────────────────────────────────────────── */

.ll-quiz {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: #faf6e8;
  color: #1a1206;
  overflow-y: auto;
  display: none;
  font-family: var(--font-body, 'Boska', Georgia, serif);
}
.ll-quiz.is-open { display: block; }

.ll-quiz__inner {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2rem) 4rem;
}

.ll-quiz__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(26, 18, 6, 0.12);
  margin-bottom: 2rem;
}
.ll-quiz__brand {
  font-family: var(--font-display, 'Boska', Georgia, serif);
  font-weight: 700;
  font-size: 1.125rem;
  color: #7a5a10;
  letter-spacing: 0.02em;
}
.ll-quiz__close {
  background: none;
  border: 1px solid rgba(26, 18, 6, 0.2);
  border-radius: 9999px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1a1206;
  cursor: pointer;
  transition: all 200ms;
}
.ll-quiz__close:hover { border-color: #c9961a; color: #c9961a; }

.ll-quiz__progress {
  height: 4px;
  background: rgba(201, 150, 26, 0.18);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.ll-quiz__progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #e8b84a, #c9961a);
  transition: width 400ms cubic-bezier(0.16, 1, 0.3, 1);
}
.ll-quiz__progress-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7a5a10;
  margin-bottom: 2rem;
}

.ll-quiz__question {
  font-family: var(--font-display, 'Boska', Georgia, serif);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 2rem;
  color: #1a1206;
}

.ll-quiz__options {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 2rem;
}
.ll-quiz__option {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  background: #fff;
  border: 2px solid rgba(26, 18, 6, 0.12);
  text-align: left;
  font-size: 1rem;
  font-weight: 500;
  color: #1a1206;
  cursor: pointer;
  transition: all 200ms cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  line-height: 1.4;
}
.ll-quiz__option:hover:not(:disabled) {
  border-color: #c9961a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(201, 150, 26, 0.15);
}
.ll-quiz__option:focus-visible {
  outline: 2px solid #c9961a;
  outline-offset: 2px;
}
.ll-quiz__option:disabled { cursor: default; }

.ll-quiz__option-letter {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(201, 150, 26, 0.12);
  border: 1px solid rgba(201, 150, 26, 0.35);
  color: #7a5a10;
  font-family: var(--font-display, 'Boska', Georgia, serif);
  font-weight: 700;
  font-size: 0.9rem;
}
.ll-quiz__option-text { flex: 1; }

/* Correct answer state */
.ll-quiz__option.is-correct {
  background: linear-gradient(135deg, #d4f4dd, #a8e6b8);
  border-color: #5fb273;
  color: #0d3d1a;
  animation: llQuizPulseGreen 800ms ease-out;
}
.ll-quiz__option.is-correct .ll-quiz__option-letter {
  background: #5fb273;
  border-color: #4a8f5f;
  color: #fff;
}
@keyframes llQuizPulseGreen {
  0%   { transform: scale(1); box-shadow: 0 0 0 0 rgba(95, 178, 115, 0.6); }
  50%  { transform: scale(1.02); box-shadow: 0 0 0 12px rgba(95, 178, 115, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(95, 178, 115, 0); }
}

/* Incorrect answer state */
.ll-quiz__option.is-incorrect {
  background: #fef0e5;
  border-color: #e89a5a;
  color: #7a3d10;
  animation: llQuizShakeAmber 500ms ease-out;
}
.ll-quiz__option.is-incorrect .ll-quiz__option-letter {
  background: #e89a5a;
  border-color: #c97a3a;
  color: #fff;
}
@keyframes llQuizShakeAmber {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-6px); }
  30%      { transform: translateX(6px); }
  45%      { transform: translateX(-4px); }
  60%      { transform: translateX(4px); }
  75%      { transform: translateX(-2px); }
}

/* Reveal correct answer even when user chose wrong */
.ll-quiz__option.is-reveal-correct {
  background: #fbf3d8;
  border-color: #c9961a;
  border-style: dashed;
  color: #7a5a10;
}
.ll-quiz__option.is-reveal-correct .ll-quiz__option-letter {
  background: #e8b84a;
  border-color: #c9961a;
  color: #1a1206;
}

.ll-quiz__explanation {
  padding: 1.25rem;
  background: #fbf3d8;
  border-left: 3px solid #c9961a;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #4a3810;
  margin-bottom: 2rem;
  animation: llQuizFadeIn 400ms ease-out;
}
@keyframes llQuizFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ll-quiz__next {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  border-radius: 9999px;
  background: #c9961a;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: all 200ms;
}
.ll-quiz__next:hover { background: #a67810; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

/* Results screen */
.ll-quiz__results {
  text-align: center;
  padding: 2rem 0;
}
.ll-quiz__score-ring {
  width: 160px;
  height: 160px;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
  background: conic-gradient(#c9961a var(--score-pct, 0%), rgba(201, 150, 26, 0.15) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.ll-quiz__score-ring::before {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: #faf6e8;
}
.ll-quiz__score-num {
  position: relative;
  font-family: var(--font-display, 'Boska', Georgia, serif);
  font-size: 3rem;
  font-weight: 700;
  color: #1a1206;
  line-height: 1;
}
.ll-quiz__score-num .out-of { font-size: 1.25rem; color: #7a5a10; font-weight: 500; }

.ll-quiz__score-title {
  font-family: var(--font-display, 'Boska', Georgia, serif);
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a1206;
  margin-bottom: 0.5rem;
}
.ll-quiz__score-msg {
  font-size: 1.05rem;
  color: #4a3810;
  margin-bottom: 2rem;
  line-height: 1.5;
}

.ll-quiz__best-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(90deg, #fff3c8, #ffe08a);
  border: 1px solid #c9961a;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 700;
  color: #7a5a10;
  margin-bottom: 1.5rem;
}

.ll-quiz__results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 2rem;
}
.ll-quiz__btn-retry {
  padding: 0.875rem 1.5rem;
  border-radius: 9999px;
  background: #c9961a;
  color: #fff;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 200ms;
}
.ll-quiz__btn-retry:hover { background: #a67810; }
.ll-quiz__btn-back {
  padding: 0.875rem 1.5rem;
  border-radius: 9999px;
  background: none;
  color: #1a1206;
  font-weight: 600;
  border: 1px solid rgba(26, 18, 6, 0.25);
  cursor: pointer;
  transition: all 200ms;
}
.ll-quiz__btn-back:hover { border-color: #c9961a; color: #c9961a; }

/* Story-page CTA button to open the quiz */
.ll-quiz-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  background: rgba(232, 184, 74, 0.1);
  border: 1px solid rgba(232, 184, 74, 0.5);
  color: #e8b84a;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 200ms;
}
.ll-quiz-cta:hover {
  background: rgba(232, 184, 74, 0.2);
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .ll-quiz__option,
  .ll-quiz__explanation,
  .ll-quiz__progress-fill,
  .ll-quiz__next,
  .ll-quiz__btn-retry,
  .ll-quiz__btn-back {
    animation: none !important;
    transition: none !important;
  }
}
