/* --- Variables --- */
:root {
  --bg: #0a0a0a;
  --burgundy: #8b0000;
  --accent: #c41e3a;
  --text: #f5f0eb;
  --text-muted: rgba(245, 240, 235, 0.72);
  --correct: #2d6a4f;
  --correct-glow: rgba(45, 106, 79, 0.55);
  --wrong: #9b2226;
  --wrong-glow: rgba(155, 34, 38, 0.5);
  --gold: #d4af37;
  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Cormorant Garamond", "Times New Roman", serif;
  --radius: 12px;
  --transition-screen: 0.55s ease;
  --transition-fast: 0.25s ease;
}

/* --- Reset / base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 112.5%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.55;
  overflow-x: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Progress bar --- */
.progress-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(139, 0, 0, 0.25);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.progress-wrap.is-visible {
  opacity: 1;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--burgundy), var(--accent), var(--gold));
  transition: width 0.65s cubic-bezier(0.33, 1, 0.68, 1);
  box-shadow: 0 0 12px rgba(196, 30, 58, 0.45);
}

/* --- Layout --- */
.app {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem 2rem;
  padding-top: calc(1.25rem + 6px);
}

.screen {
  width: 100%;
  max-width: 36rem;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  position: absolute;
  left: 0;
  right: 0;
  visibility: hidden;
  transition:
    opacity var(--transition-screen),
    transform var(--transition-screen),
    visibility 0s linear 0.55s;
}

.screen--active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  position: relative;
  visibility: visible;
  transition:
    opacity var(--transition-screen),
    transform var(--transition-screen),
    visibility 0s linear 0s;
}

.screen[hidden] {
  display: none !important;
}

.screen__inner {
  text-align: center;
}

.fade-in {
  animation: fadeInUp 0.7s ease forwards;
}

.screen--active .fade-in {
  animation: fadeInUp 0.75s ease 0.08s forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Typography --- */
.title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.85rem, 5vw, 2.5rem);
  letter-spacing: 0.02em;
  margin: 0 0 1.25rem;
  color: var(--text);
  text-shadow: 0 0 40px rgba(196, 30, 58, 0.15);
}

.title--results {
  margin-bottom: 0.75rem;
}

.lead {
  font-size: clamp(1.1rem, 3.2vw, 1.35rem);
  color: var(--text-muted);
  margin: 0 0 2rem;
  max-width: 28ch;
  margin-left: auto;
  margin-right: auto;
}

.lead em {
  color: var(--accent);
  font-style: italic;
  font-weight: 600;
}

.emoji {
  display: inline-block;
}

/* --- Buttons --- */
.btn {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.9rem 1.75rem;
  border: 1px solid rgba(196, 30, 58, 0.5);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(139, 0, 0, 0.45), rgba(10, 10, 10, 0.9));
  color: var(--text);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    transform 0.15s ease;
}

.btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: linear-gradient(145deg, rgba(196, 30, 58, 0.35), rgba(10, 10, 10, 0.85));
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--start {
  padding: 1rem 2.25rem;
  font-size: 1.05rem;
}

.btn--glow {
  animation: glowPulse 2.4s ease-in-out infinite;
  box-shadow:
    0 0 20px rgba(196, 30, 58, 0.35),
    0 0 48px rgba(139, 0, 0, 0.25);
}

@keyframes glowPulse {
  0%,
  100% {
    box-shadow:
      0 0 18px rgba(196, 30, 58, 0.3),
      0 0 40px rgba(139, 0, 0, 0.2);
  }
  50% {
    box-shadow:
      0 0 32px rgba(196, 30, 58, 0.55),
      0 0 64px rgba(139, 0, 0, 0.35);
  }
}

.btn--next {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.btn--ticket {
  margin-top: 1.5rem;
  border-color: var(--gold);
  background: linear-gradient(145deg, rgba(212, 175, 55, 0.2), rgba(10, 10, 10, 0.92));
}

.btn--ticket:hover:not(:disabled) {
  border-color: var(--gold);
  background: linear-gradient(145deg, rgba(212, 175, 55, 0.3), rgba(10, 10, 10, 0.88));
}

/* --- Quiz --- */
.quiz-meta {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1rem;
}

.question {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.15rem, 3.5vw, 1.35rem);
  line-height: 1.4;
  margin: 0 0 1.5rem;
  text-align: left;
}

.answers {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
}

.answer-btn {
  width: 100%;
  display: block;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  text-align: left;
  padding: 1rem 1.1rem;
  margin-bottom: 0.65rem;
  border: 1px solid rgba(245, 240, 235, 0.12);
  border-radius: var(--radius);
  background: rgba(20, 20, 20, 0.85);
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  transform: translateX(-10px);
  animation: answerReveal 0.55s ease forwards;
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast),
    box-shadow 0.35s ease;
}

.answer-btn:hover:not(:disabled) {
  border-color: rgba(196, 30, 58, 0.45);
  background: rgba(35, 15, 20, 0.6);
}

.answer-btn:disabled {
  cursor: default;
}

@keyframes answerReveal {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.answer-btn--correct {
  opacity: 1 !important;
  transform: translateX(0) !important;
  border-color: var(--correct) !important;
  background: rgba(45, 106, 79, 0.25) !important;
  box-shadow: 0 0 0 2px var(--correct-glow), inset 0 0 24px rgba(45, 106, 79, 0.15);
  animation: correctFlash 0.65s ease forwards;
}

.answer-btn--wrong {
  opacity: 1 !important;
  border-color: var(--wrong) !important;
  background: rgba(155, 34, 38, 0.2) !important;
  box-shadow: 0 0 0 2px var(--wrong-glow);
  animation: shakeWrong 0.5s ease;
}

@keyframes correctFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(45, 106, 79, 0.8);
  }
  40% {
    box-shadow: 0 0 24px 8px rgba(45, 106, 79, 0.45);
  }
  100% {
    box-shadow: 0 0 0 2px var(--correct-glow), inset 0 0 24px rgba(45, 106, 79, 0.15);
  }
}

@keyframes shakeWrong {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(8px);
  }
  60% {
    transform: translateX(-6px);
  }
  80% {
    transform: translateX(6px);
  }
}

.feedback {
  margin-top: 1.5rem;
  padding: 1.1rem 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(196, 30, 58, 0.25);
  background: linear-gradient(160deg, rgba(139, 0, 0, 0.12), transparent);
  text-align: left;
  animation: fadeInUp 0.45s ease;
}

.feedback__text {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  color: var(--text-muted);
}

/* --- Results --- */
.score {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  margin: 0;
  color: var(--text);
}

.results-hint {
  margin: 1rem 0 0;
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* --- Decorative subtle vignette --- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(139, 0, 0, 0.12), transparent 55%),
    radial-gradient(ellipse 100% 80% at 50% 100%, rgba(196, 30, 58, 0.06), transparent 50%);
  z-index: -1;
}

@media (min-width: 480px) {
  .app {
    padding: 2rem 1.5rem 2.5rem;
    padding-top: calc(2rem + 6px);
  }

  .question {
    text-align: center;
  }

  .answers {
    text-align: center;
  }

  .answer-btn {
    text-align: center;
  }

  .feedback {
    text-align: center;
  }

  .feedback__text {
    text-align: center;
  }
}
