:root {
  --bg: #a1ab69;
  --card: #ffffff;
  --text: #1f2d3d;
  --primary: #a1ab69;
  --primary-dark: #7f8a4e;
  --secondary: #f5a623;
  --correct: #2ecc71;
  --incorrect: #ff5a5f;
  --muted: #7b8a9a;
  --shadow: 0 10px 30px rgba(45, 156, 219, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Baloo 2", system-ui, sans-serif;
  background: linear-gradient(135deg, #c8d091 0%, #a1ab69 50%, #7f8a4e 100%);
  color: var(--text);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.app {
  width: min(920px, 100%);
}

.quiz-logo {
  display: block;
  width: clamp(256px, 30vw, 306px);
  height: auto;
  margin: 24px 0 0;
  opacity: 0.8;
  animation: fadeInLogo 1s ease;
}

.background-image {
  position: fixed;
  opacity: 0.16;
  z-index: -1;
  pointer-events: none;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.background-image-left {
  top: 15vh;
  left: -20vw;
  width: 65vw;
  height: 100vh;
}

.background-image-right {
  bottom: 5vh;
  right: -5vw;
  width: 42vw;
  height: auto;
}

@keyframes fadeInLogo {
  from {
    opacity: 0;
  }
  to {
    opacity: 0.8;
  }
}

.card {
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(45, 156, 219, 0.15), 0 10px 20px rgba(0, 0, 0, 0.1);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: fadeIn 300ms ease;
}

#start-screen {
  min-height: 410px;
  padding: 36px;
}

#start-screen.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#result-screen {
  min-height: 410px;
  padding: 36px;
}

#result-screen.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#result-screen h1 {
  font-size: 2.75rem;
}

#start-screen .subtitle {
  font-size: calc(1.3rem + 3px);
}

#start-screen .instructions {
  font-size: calc(1.05rem + 3px);
}

#start-screen #start-btn {
  font-size: calc(1.12rem + 3px);
  padding: 16px 30px;
  align-self: center;
}

h1,
h2 {
  margin: 0 0 10px;
  text-align: center;
}

.subtitle,
.instructions {
  text-align: center;
}

.subtitle {
  margin: 0 0 8px;
  color: var(--primary-dark);
  font-size: 1.3rem;
}

.instructions {
  margin: 0 auto 24px;
  max-width: 650px;
  color: var(--muted);
  font-size: 1.05rem;
}

.quiz-topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.pill {
  background: #eef7ff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 700;
}

.pill.score {
  background: #fff6e5;
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: rgba(238, 247, 255, 0.8);
  border-radius: 6px;
  margin-bottom: 24px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 6px;
  width: 0%;
  transition: width 0.5s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.question {
  margin-bottom: 8px;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1.25;
}

.question-subtitle {
  margin: 0 0 18px;
  font-size: 1rem;
  color: var(--muted);
  font-weight: 500;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.answer-btn {
  border: 2px solid transparent;
  background: linear-gradient(135deg, #f7fbff 0%, #e8f4fd 100%);
  color: var(--text);
  border-radius: 16px;
  padding: 18px;
  font-size: 1.1rem;
  font-family: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.answer-btn:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  border-color: rgba(161, 171, 105, 0.3);
}

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

.answer-btn.correct {
  background: #e9fff1;
  border-color: var(--correct);
}

.answer-btn.incorrect {
  background: #ffeef0;
  border-color: var(--incorrect);
}

.feedback {
  min-height: 32px;
  margin: 18px 0 8px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
}

.feedback.correct {
  color: #189a4b;
  animation: pop 260ms ease;
}

.feedback.incorrect {
  color: #d93036;
  animation: shake 260ms ease;
}

.explanation-box {
  display: none;
  margin: 12px 0 12px;
  padding: 16px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, #f6f7ef 0%, #e8f0d8 100%);
  border: 2px solid rgba(161, 171, 105, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.explanation-box.visible {
  display: block;
  animation: fadeIn 220ms ease;
}

.explanation-title {
  margin: 0 0 8px;
  text-align: center;
  font-size: calc(1.08rem + 3px);
  font-weight: 700;
  letter-spacing: 0.4px;
}

.explanation-text {
  margin: 0;
  color: #3d4727;
  font-size: 1rem;
  line-height: 1.35;
}

.actions {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.btn {
  border: 0;
  border-radius: 50px;
  padding: 14px 26px;
  font-size: 1.12rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn:active:not(:disabled) {
  transform: translateY(0) scale(1.02);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.secondary {
  background: var(--secondary);
  color: #fff;
}

.result-message,
.final-score {
  text-align: center;
  font-size: 1.25rem;
}

.result-message {
  font-size: calc(1.25rem + 4px);
  color: var(--primary-dark);
}

.final-score-label {
  margin: 6px 0 6px;
  text-align: center;
  font-size: 1.2rem;
  color: #000;
}

.final-score {
  margin: 0 0 18px;
  font-size: 1.95rem;
  font-weight: 700;
}

.score-good {
  color: #189a4b;
}

.score-bad {
  color: #d93036;
}

@keyframes pop {
  0% {
    transform: scale(0.94);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

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

.confetti {
  position: fixed;
  top: -10px;
  width: 10px;
  height: 10px;
  background-color: var(--primary);
  opacity: 1;
  animation: fall 4s ease forwards;
  z-index: 1000;
}

.confetti:nth-child(odd) {
  background-color: var(--secondary);
}

.confetti:nth-child(3n) {
  background-color: var(--correct);
}

.confetti:nth-child(4n) {
  background-color: #ff6b6b;
}

.confetti:nth-child(5n) {
  background-color: #4ecdc4;
}

@keyframes fall {
  0% {
    transform: translateX(0) translateY(0) rotate(0deg);
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translateX(var(--drift, 0px)) translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

.screen.fade-out {
  animation: fadeOut 300ms ease;
}

@media (max-width: 700px) {
  .card {
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 15px 30px rgba(45, 156, 219, 0.15), 0 5px 15px rgba(0, 0, 0, 0.1);
  }

  #start-screen {
    min-height: 370px;
    padding: 28px;
    transform: translateY(35px);
  }

  #result-screen {
    min-height: 370px;
    padding: 28px;
  }

  #start-screen h1 {
    font-size: 2.15rem;
  }

  .answers {
    grid-template-columns: 1fr;
  }

  .answer-btn {
    font-size: 1.05rem;
    padding: 16px;
  }

  .btn {
    width: 100%;
  }

  .quiz-topbar {
    flex-direction: column;
  }

  .progress-bar {
    height: 10px;
    margin-bottom: 20px;
  }

  .background-image-left {
    left: -20vw;
    width: 65vw;
    opacity: 0.12;
  }

  .background-image-right {
    right: -5vw;
    width: 45vw;
    opacity: 0.12;
  }
}

/* Tablets */
@media (max-width: 1024px) {
  .background-image-left {
    left: -18vw;
    width: 60vw;
  }

  .background-image-right {
    right: -4vw;
    width: 40vw;
  }
}

/* Small screens */
@media (max-width: 768px) {
  .background-image-left {
    left: -25vw;
    width: 70vw;
  }

  .background-image-right {
    right: -8vw;
    width: 50vw;
  }
}
