/* ── Reset & Base ─────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --matcha-dark: #4a7c59;
  --matcha: #6b9e78;
  --matcha-light: #a8d5ba;
  --matcha-pale: #d4edda;
  --cream: #fdf6ec;
  --cream-dark: #f5e6cc;
  --brown: #8b6f47;
  --brown-light: #c9a96e;
  --text: #3d3d3d;
  --text-light: #6b6b6b;
  --white: #ffffff;
  --shadow: rgba(74, 124, 89, 0.15);
  --radius: 20px;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
}

body {
  font-family: "Quicksand", sans-serif;
  background: linear-gradient(160deg, var(--cream) 0%, var(--matcha-pale) 50%, var(--cream) 100%);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-x: hidden;
}

/* floating background blobs */
body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  opacity: 0.25;
  z-index: 0;
  pointer-events: none;
}

body::before {
  width: 300px;
  height: 300px;
  background: var(--matcha-light);
  top: -80px;
  right: -60px;
  animation: float 8s ease-in-out infinite;
}

body::after {
  width: 200px;
  height: 200px;
  background: var(--cream-dark);
  bottom: -40px;
  left: -40px;
  animation: float 10s ease-in-out infinite reverse;
}

@keyframes float {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(15px, -20px) scale(1.05);
  }
}

/* ── Container ───────────────────────────────── */
.quiz-container {
  position: relative;
  width: 100%;
  max-width: 460px;
  min-height: 560px;
  z-index: 1;
}

/* ── Screens ─────────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 560px;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 32px var(--shadow);
  padding: 2rem 1.5rem;
  animation: fadeSlideIn var(--transition) both;
}

.screen.active {
  display: flex;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Intro Screen ────────────────────────────── */
.intro-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.matcha-icon {
  font-size: 4rem;
  animation: wiggle 2s ease-in-out infinite;
}

@keyframes wiggle {

  0%,
  100% {
    transform: rotate(0deg);
  }

  25% {
    transform: rotate(-6deg);
  }

  75% {
    transform: rotate(6deg);
  }
}

.intro-content h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--matcha-dark);
  line-height: 1.3;
}

.subtitle {
  font-size: 1rem;
  color: var(--text-light);
  font-weight: 500;
}

/* ── Buttons ─────────────────────────────────── */
.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  padding: 0.85rem 2rem;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, var(--matcha) 0%, var(--matcha-dark) 100%);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(74, 124, 89, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(74, 124, 89, 0.4);
  transform: translateY(-1px);
}

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

.btn-secondary {
  background: var(--white);
  color: var(--matcha-dark);
  border: 2px solid var(--matcha-light);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--matcha-pale);
}

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

/* ── Progress Bar ────────────────────────────── */
.progress-bar-container {
  width: 100%;
  height: 6px;
  background: var(--cream-dark);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--matcha-light), var(--matcha-dark));
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ── Question ────────────────────────────────── */
.question-content {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.question-number {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--matcha);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.question-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--matcha-dark);
  text-align: center;
  margin-bottom: 1.5rem;
  line-height: 1.4;
  min-height: 3em;
}

/* ── Answers ─────────────────────────────────── */
.answers-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.answer-btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  padding: 0.9rem 1.2rem;
  border: 2px solid var(--matcha-light);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.answer-btn:hover {
  border-color: var(--matcha);
  background: rgba(168, 213, 186, 0.2);
}

.answer-btn.selected {
  border-color: var(--matcha-dark);
  background: var(--matcha-pale);
  color: var(--matcha-dark);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(74, 124, 89, 0.15);
}

/* ── Nav Buttons ─────────────────────────────── */
.nav-buttons {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  margin-top: 1.5rem;
}

.nav-buttons .btn {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

/* ── Result Screen ───────────────────────────── */
.result-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
}

.result-emoji {
  font-size: 4.5rem;
  animation: pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes pop {
  from {
    transform: scale(0);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.result-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--matcha-dark);
}

.result-description {
  font-size: 0.95rem;
  color: var(--text-light);
  line-height: 1.6;
  max-width: 340px;
}

/* ── Loading Screen ─────────────────────────── */
.loading-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem 0;
}

.loading-cups {
  position: relative;
  width: 120px;
  height: 120px;
  animation: spinContainer 3s linear infinite;
}

.loading-cup {
  position: absolute;
  font-size: 2.2rem;
  top: 50%;
  left: 50%;
  --angle: calc(var(--i) * 120deg);
  transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-40px) rotate(calc(-1 * var(--angle)));
  animation: cupBounce 1.2s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.2s);
}

@keyframes spinContainer {
  to {
    transform: rotate(360deg);
  }
}

@keyframes cupBounce {

  0%,
  100% {
    scale: 1;
  }

  50% {
    scale: 1.25;
  }
}

.loading-whisk {
  display: flex;
  justify-content: center;
}

.whisk-circle {
  width: 40px;
  height: 40px;
  border: 3px solid var(--matcha-light);
  border-top-color: var(--matcha-dark);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--matcha-dark);
  min-height: 1.5em;
  transition: opacity 0.3s ease;
}

.loading-dots {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--matcha);
  animation: dotBounce 1.4s ease-in-out infinite;
}

.dot:nth-child(2) {
  animation-delay: 0.2s;
}

.dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotBounce {

  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  40% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* ── Responsive tweaks ───────────────────────── */
@media (min-width: 480px) {
  .screen {
    padding: 2.5rem 2rem;
  }

  .intro-content h1 {
    font-size: 1.8rem;
  }
}