@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

/* ========== Theme Variables ========== */
:root {
  --green-50: #f1f8e9;
  --green-100: #e8f5e9;
  --green-200: #c8e6c9;
  --green-300: #a5d6a7;
  --green-400: #81c784;
  --green-500: #66bb6a; /* primary accent */
  --green-600: #43a047; /* primary button */
  --green-700: #2e7d32; /* deep salad */
  /* Accent palette (salad-inspired, not only green) */
  --accent-tomato: #ff6b6b; /* tomato red */
  --accent-carrot: #ffa62b; /* carrot orange */
  --accent-lemon: #ffd93d; /* lemon yellow */
  --accent-fresh-green: #6bcb77; /* fresh green highlight */
  --accent-info: #2196f3; /* professional blue for hints */
  --accent-yellow: var(--accent-lemon);
  --text-strong: #eaf7ea;
  --text-muted: #cfe8d0;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.2);
  --glass-shadow: 0 20px 60px rgba(0, 0, 0, 0.35),
    0 2px 10px rgba(0, 0, 0, 0.25);

  /* Dynamic gradient (JS updates --bg-gradient) */
  --bg-gradient: linear-gradient(135deg, #2e7d32 0%, #43a047 50%, #66bb6a 100%);
}

/* ========== Global Layout ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, Ubuntu,
    'Helvetica Neue', Arial, sans-serif;
  color: var(--text-strong);
  display: grid;
  place-items: center;
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  background-size: 200% 200%;
  animation: bgFloat 22s ease-in-out infinite;
  transition: background-image 800ms ease;
  overflow: hidden;
}

/* Subtle decorative vignette for depth */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
      1000px 600px at 10% 10%,
      rgba(255, 255, 255, 0.06),
      transparent 60%
    ),
    radial-gradient(
      900px 500px at 90% 90%,
      rgba(0, 0, 0, 0.18),
      transparent 65%
    );
}

/* Centered quiz card (glassmorphism) */
.centered {
  width: min(92vw, 720px);
  max-height: min(86vh, 900px);
  overflow-y: auto; /* Scroll if content is too long on small screens */
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.06)
  );
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 22px;
  padding: clamp(18px, 5vw, 28px);
  transform: translateY(0);
  animation: cardEnter 640ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

/* Page container interior scroll area if needed */
.scrollable {
  max-height: 60vh;
  overflow-y: auto;
  scrollbar-gutter: stable;
  margin-bottom: 1rem;
}

/* ========== Typography ========== */
h1 {
  margin: 0 0 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  color: var(--text-strong);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  position: relative;
  line-height: 1.2;
}

/* Salad leaf flair */
h1::before {
  content: '🥗';
  margin-right: 10px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
  transform: translateY(1px) rotate(-8deg);
  display: inline-block;
}

p {
  color: var(--text-muted);
  margin: 0 0 16px;
  line-height: 1.55;
}

/* ========== Inputs ========== */
input[type='text'],
input[type='search'],
input[type='email'] {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.14),
    rgba(255, 255, 255, 0.06)
  );
  color: var(--text-strong);
  outline: none;
  transition: transform 160ms ease, box-shadow 200ms ease,
    border-color 200ms ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 1px 0 rgba(0, 0, 0, 0.15);
  margin: 10px 0 6px;
}

input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

input:focus {
  transform: translateY(-1px) scale(1.02);
  border-color: rgba(102, 187, 106, 0.7);
  box-shadow: 0 0 0 6px rgba(102, 187, 106, 0.12),
    0 14px 30px rgba(0, 0, 0, 0.25);
}

/* ========== Answer List ========== */
ul {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 10px;
}

ul li {
  position: relative;
  border-radius: 14px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #fff59d, #fff176); /* Lemon yellow base */
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #3e2723; /* dark for contrast on lemon */
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  letter-spacing: 0.25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  transition: transform 140ms ease, box-shadow 180ms ease, background 240ms ease,
    filter 200ms ease;
  will-change: transform;
}

ul li:hover {
  background: linear-gradient(
    135deg,
    var(--answer-hover-accent, var(--accent-lemon)),
    var(--answer-hover-accent, var(--accent-lemon))
  ); /* brighter lemon on hover */
  transform: translateY(-2px) scale(1.015) rotate(-0.25deg);
  box-shadow: 0 10px 24px
    color-mix(
      in lab,
      var(--answer-hover-accent, #ffd93d) 35%,
      rgba(0, 0, 0, 0.2)
    );
  filter: brightness(1.04);
}

ul li:active {
  transform: translateY(0) scale(0.99);
}

/* Show check/cross icons when inline colors are applied by logic */
ul li[style*='green']::after,
ul li[style*='red']::after {
  content: attr(data-badge);
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
}

ul li[style*='green'] {
  /* Harmonize inline green with our theme, keep logic intact */
  background: linear-gradient(
    180deg,
    rgba(46, 125, 50, 0.9),
    rgba(67, 160, 71, 0.85)
  ) !important;
  border-color: rgba(102, 187, 106, 0.75);
  box-shadow: 0 0 0 2px rgba(102, 187, 106, 0.35),
    0 16px 34px rgba(46, 125, 50, 0.45);
}

ul li[style*='green']::after {
  content: '✓';
  color: #e8f5e9;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}

ul li[style*='red'] {
  background: linear-gradient(
    180deg,
    rgba(244, 67, 54, 0.85),
    rgba(211, 47, 47, 0.85)
  ) !important;
  border-color: rgba(244, 67, 54, 0.6);
  box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.25),
    0 16px 34px rgba(211, 47, 47, 0.35);
}

ul li[style*='red']::after {
  content: '✕';
  color: #fff3f3;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}

/* ========== Buttons ========== */
button {
  --btn-bg: linear-gradient(135deg, var(--green-600), var(--green-500));
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  color: #0b1e0b;
  background: var(--btn-bg);
  background-size: 140% 140%;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  text-transform: capitalize;
  box-shadow: 0 6px 20px rgba(46, 125, 50, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  /* Hover interactions ~200ms */
  transition: transform 200ms ease, box-shadow 200ms ease,
    background-position 200ms ease, filter 200ms ease;
}

button::before {
  content: '🌿';
  font-size: 16px;
  transform: translateY(1px) rotate(-10deg);
}

/* Function-specific button classes */
.btn-primary {
  --btn-bg: linear-gradient(135deg, var(--accent-fresh-green), #3fbf6b);
  color: #0b1e0b;
  padding: 14px 20px; /* Slightly larger for primary */
  box-shadow: 0 8px 24px rgba(59, 191, 107, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-warning {
  --btn-bg: linear-gradient(135deg, var(--accent-carrot), #ff8c00);
  color: #2b1200;
  border: 1px dashed rgba(255, 165, 0, 0.6); /* Dashed for caution */
}

.btn-info {
  --btn-bg: linear-gradient(135deg, var(--accent-info), #1976d2);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-info:hover {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

button:hover {
  background-position: 100% 0%;
  transform: translateY(-2px) rotate(-0.35deg) scale(1.02);
  box-shadow: 0 14px 32px rgba(46, 125, 50, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 0 6px
      color-mix(
        in lab,
        var(--answer-hover-accent, rgba(102, 187, 106, 0.18)) 30%,
        transparent
      );
  filter: saturate(1.05);
}

/* Icon overrides for specific buttons */
#next-question-button::before,
.btn-primary::before {
  content: '➡️';
  font-size: 16px;
  transform: translateY(0px);
}

#avoid-question-button::before,
.btn-warning::before {
  content: '⚠️';
  font-size: 16px;
  transform: translateY(0px);
}

#eliminate-two-answers-button::before,
.btn-info::before {
  content: '💡';
  font-size: 16px;
  transform: translateY(0px);
}

button:active {
  transform: translateY(0) scale(0.98);
}

/* Emphasize primary actions by id (available from constants) */
#start-quiz-button {
  --btn-bg: linear-gradient(135deg, var(--green-600), var(--green-500));
}
#next-question-button {
  /* Fresh green */
  --btn-bg: linear-gradient(135deg, var(--accent-fresh-green), #3fbf6b);
  color: #0b1e0b;
}
#avoid-question-button {
  /* Carrot */
  --btn-bg: linear-gradient(135deg, var(--accent-carrot), #ff8c00);
  color: #2b1200;
}
#eliminate-two-answers-button {
  /* Info blue */
  --btn-bg: linear-gradient(135deg, var(--accent-info), #1976d2);
  color: #ffffff;
}
#reset-quiz-button {
  --btn-bg: linear-gradient(135deg, #ffeb3b, #a5d6a7);
  color: #163516;
}

/* Rules Button on Welcome */
#rules-button {
  --btn-bg: linear-gradient(135deg, var(--accent-lemon), #ffcc02);
  color: #3e2723;
  padding: 10px 16px;
  font-size: 14px;
  margin-top: 8px;
}

#rules-button::before {
  content: '📋';
  font-size: 14px;
  margin-right: 4px;
}

/* ========== Micro-interactions: Ripple ========== */
.ripple {
  position: absolute;
  pointer-events: none;
  border-radius: 999px;
  transform: scale(0);
  opacity: 0.6;
  background: radial-gradient(
    circle closest-side,
    rgba(255, 255, 255, 0.45),
    rgba(255, 255, 255, 0) 70%
  );
  animation: ripple 650ms ease-out forwards;
  mix-blend-mode: screen;
}

/* ========== Page Transition Helpers ========== */
.fade-in {
  /* Smooth but snappy ~360ms per preference */
  animation: fadeInUp 360ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}
.fade-out {
  animation: fadeOutDown 320ms ease both;
}

/* ========== End Page ========== */
.end-page {
  text-align: center;
}

.end-page h1::before {
  content: '🥬';
  margin-right: 10px;
  transform: translateY(1px) rotate(-6deg);
}

/* ========== Scrollbar Styling ========== */
.scrollable::-webkit-scrollbar,
.centered::-webkit-scrollbar {
  width: 10px;
}
.scrollable::-webkit-scrollbar-track,
.centered::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}
.scrollable::-webkit-scrollbar-thumb,
.centered::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    rgba(102, 187, 106, 0.6),
    rgba(67, 160, 71, 0.6)
  );
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.15);
}

/* ========== Responsive ========== */
@media (max-width: 520px) {
  .centered {
    padding: 16px;
  }
  button {
    width: 100%;
    justify-content: center;
  }
}

/* ========== Keyframes ========== */
@keyframes bgFloat {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes cardEnter {
  0% {
    transform: translateY(12px) scale(0.985);
    opacity: 0;
  }
  60% {
    transform: translateY(-2px) scale(1.005);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.995);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeOutDown {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(6px) scale(0.995);
  }
}

@keyframes ripple {
  to {
    transform: scale(1);
    opacity: 0;
  }
}

/* Gentle animated salad gradient shift */
@keyframes saladShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Soft up/down float for the glass card */
@keyframes cardFloat {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-8px);
  }
}

/* ===== Light Surface Overrides (when background is very light/near white) ===== */
body.light-surface h1 {
  color: #000; /* Make question title text black for contrast */
  text-shadow: none; /* Remove shadow on light bg */
}

body.light-surface button {
  color: #000 !important; /* Make all button labels black for contrast */
  text-shadow: none;
}

/* ===== Next button error state and shake feedback (appended) ===== */
.btn-error {
  background: linear-gradient(135deg, #f44336, #e53935) !important;
  color: #fff !important;
  box-shadow: 0 8px 20px rgba(244, 67, 54, 0.4) !important;
}
.btn-error:hover {
  background: linear-gradient(135deg, #ef5350, #e53935) !important;
  transform: translateY(-2px) rotate(0deg);
  box-shadow: 0 10px 25px rgba(244, 67, 54, 0.45) !important;
}
.shake {
  animation: incorrectShake 0.45s ease;
}

/* ===== Salad Quiz Landing Page (scoped, non-destructive) ===== */
.landing {
  position: relative;
  min-height: 100vh; /* Full viewport height */
  display: flex; /* Center content */
  align-items: center;
  justify-content: center;
  isolation: isolate; /* Card shadows above background layers */
  margin: 0;
  padding: 0;
}

/* Vertical gradient background from #4CAF50 to #2E7D32 with subtle animated shift */
.landing::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to bottom, #4caf50 0%, #2e7d32 100%);
  background-size: 200% 200%;
  animation: saladShift 28s ease-in-out infinite;
}

/* Subtle depth behind the card (spotlight + faint “noise” speckles) */
.landing::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
      800px 500px at 20% 10%,
      rgba(255, 255, 255, 0.06),
      transparent 60%
    ),
    radial-gradient(
      900px 600px at 80% 90%,
      rgba(0, 0, 0, 0.18),
      transparent 65%
    ),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.015) 0,
      rgba(255, 255, 255, 0.015) 1px,
      transparent 1px,
      transparent 2px
    ); /* ultra subtle grain */
}

/* Main card container with glassmorphism */
.landing .card {
  width: clamp(400px, 90vw, 500px); /* 400-500px responsive range */
  padding: 40px; /* Required padding */
  border-radius: 20px; /* Rounded corners */
  background: rgba(255, 255, 255, 0.1); /* Glass background */
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37); /* Subtle shadow */
  position: relative;
  z-index: 1; /* keep card above floating emojis */
  text-align: center;
  color: #fff;
  /* Gentle floating drift for the whole card */
  animation: cardFloat 7s ease-in-out infinite alternate;
}

/* Floating lettuce icons at top-center, overlapping the card */
.landing .float-icons {
  position: fixed; /* cover entire viewport */
  inset: 0;
  transform: none;
  display: block;
  pointer-events: none;
  z-index: 0;
}

.landing .float-icons .icon {
  font-size: 24px; /* ~24px as requested */
  line-height: 1;
  /* Randomized gentle drift using CSS variables set in JS */
  animation-name: leafRandom;
  animation-duration: var(--dur, 2s);
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-delay: var(--delay, 0s); /* 0s, .5s, 1s stagger via inline style */
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}

/* Random drift path using per-icon variables:
   Position: --x1/--y1, --x2/--y2
   Rotation: --r0/--r1/--r2 (deg)
   Scale:    --s0/--s1/--s2
*/
@keyframes leafRandom {
  0% {
    transform: translate(0px, 0px) rotate(var(--r0, 0deg)) scale(var(--s0, 1));
  }
  25% {
    transform: translate(
        calc(var(--x1, 0px) * 0.5),
        calc(var(--y1, -10px) * 0.5)
      )
      rotate(calc(var(--r1, 8deg) * 0.5)) scale(calc(var(--s1, 1.06) * 0.5 + 1));
  }
  50% {
    transform: translate(var(--x1, 0px), var(--y1, -10px))
      rotate(var(--r1, 8deg)) scale(var(--s1, 1.06));
  }
  75% {
    transform: translate(
        calc(var(--x2, 0px) + var(--x1, 0px) * 0.5),
        calc(var(--y2, 8px) + var(--y1, -10px) * 0.5)
      )
      rotate(calc(var(--r2, -8deg) + var(--r1, 8deg) * 0.5))
      scale(calc(var(--s2, 0.96) + var(--s1, 1.06) * 0.5));
  }
  100% {
    transform: translate(var(--x2, 0px), var(--y2, 8px))
      rotate(var(--r2, -8deg)) scale(var(--s2, 0.96));
  }
}

/* Title: white, bold, Arial, size 32px, centered, with emojis inline */
.landing .title {
  margin: 10px 0 16px;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 32px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Professional entrance + parallax tilt for the welcome card */
.landing .card {
  transform-style: preserve-3d;
  --rx: 0deg;
  --ry: 0deg;
  --mx: 50%;
  --my: 0%;
  transform: perspective(1000px) rotateX(var(--ry)) rotateY(var(--rx))
    translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform 600ms cubic-bezier(0.2, 0.75, 0.25, 1),
    box-shadow 600ms cubic-bezier(0.2, 0.75, 0.25, 1), opacity 500ms ease;
}

/* when JS adds .enter on mount */
.landing .card.enter {
  transform: perspective(1000px) rotateX(var(--ry)) rotateY(var(--rx))
    translateY(0) scale(1);
  opacity: 1;
}

/* Subtle sheen and salad-themed overlay reacting to mouse */
.landing .card::after {
  content: '';
  position: absolute;
  inset: -1px;
  pointer-events: none;
  border-radius: 20px;
  background: linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.08),
      rgba(255, 255, 255, 0)
    ),
    radial-gradient(
      600px 300px at var(--mx, 50%) var(--my, 0%),
      rgba(255, 255, 255, 0.06),
      rgba(255, 255, 255, 0) 60%
    );
  transition: background-position 200ms ease, opacity 300ms ease;
  opacity: 0.9;
}

/* Lift and subtle emphasis on hover */
.landing .card:hover {
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
}

.landing .title .t-emoji {
  font-size: 32px; /* Larger lettuce emoji before "Welcome" */
  transform: translateY(2px) rotate(-6deg);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}

/* Input field: centered, 80% width, rounded, semi-transparent */
.landing #user-name-input {
  width: 80%;
  margin: 20px auto 0; /* Margin below title */
  display: block;
  padding: 12px;
  border-radius: 20px;
  border: none;
  outline: none;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  text-align: center;
  font-size: 16px;
}

.landing #user-name-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

/* Button: centered, green, rounded, hover darken */
.landing #start-quiz-button {
  margin: 20px auto 0; /* Margin below input */
  display: inline-block;
  padding: 12px 40px;
  border-radius: 20px;
  background: #4caf50;
  color: #fff;
  font-size: 16px;
  border: none;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
  box-shadow: 0 8px 22px rgba(76, 175, 80, 0.35);
}

/* subtle pulse to invite interaction */
@keyframes btnPulse {
  0%,
  100% {
    transform: translateY(0);
    box-shadow: 0 8px 22px rgba(76, 175, 80, 0.35);
  }
  50% {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(76, 175, 80, 0.42);
  }
}

.landing #start-quiz-button:hover {
  background: #388e3c; /* Darken on hover */
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(56, 142, 60, 0.45);
}

.landing #start-quiz-button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 3px;
}

.landing #start-quiz-button:active {
  transform: translateY(0);
}

/* Responsive title size on very small screens */
@media (max-width: 480px) {
  .landing .title {
    font-size: 26px;
  }
  .landing .title .t-emoji {
    font-size: 28px;
  }
}

/* ===== Question Page Theming (salad backgrounds + contrast) ===== */
body.question-surface #user-interface h1,
body.question-surface #user-interface button {
  color: #fff !important; /* keep title and buttons white on question pages */
  text-shadow: none;
}
/* Force score widget and hint tracker to black for clarity */
body.question-surface #user-interface .score-widget,
body.question-surface #user-interface .score-widget * {
  color: #000 !important;
}
body.question-surface #user-interface .hint-tracker,
body.question-surface #user-interface .hint-tracker * {
  color: #000 !important;
}

/* Subtle accent border/glow on question card hover */
body.question-surface #user-interface.centered:hover {
  border-color: color-mix(
    in lab,
    var(--answer-hover-accent, #ffd93d) 45%,
    rgba(255, 255, 255, 0.22)
  );
  box-shadow: var(--glass-shadow),
    0 0 0 6px
      color-mix(in lab, var(--answer-hover-accent, #ffd93d) 14%, transparent);
}

body.question-surface #user-interface ul li {
  color: #000 !important; /* answers back to black by request */
}

/* If the chosen background is very light (lemon/near white), switch to black text */
body.question-surface.question-light #user-interface h1,
body.question-surface.question-light #user-interface ul li,
body.question-surface.question-light #user-interface button {
  color: #000 !important; /* improve readability on light backgrounds */
}

/* ===== Salad Quiz Landing Hero Enhancements (fresh, modern, fun) ===== */

/* Subtitle under the hero title */
.landing .subtitle {
  color: var(--text-muted);
  margin: -4px 0 8px;
  font-weight: 400;
  letter-spacing: 0.2px;
}

/* Three floating lettuce leaves above the title */
.landing .leaves {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 28px;
  margin: 2px 0 6px;
  pointer-events: none;
}

.landing .leaves .leaf {
  display: inline-block;
  line-height: 1;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
  transform-origin: center bottom;
  animation: leafBob var(--dur, 3s) ease-in-out infinite;
  will-change: transform;
}

@keyframes leafBob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* Background particles/waves layer for subtle healthy vibes */
.bg-particles {
  position: fixed;
  inset: 0;
  z-index: 0; /* Below card (z=1) but above ::before/::after (z=-1) */
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: soft-light;
  background: radial-gradient(
      6px 6px at 12% 22%,
      rgba(255, 255, 255, 0.1),
      transparent 60%
    ),
    radial-gradient(
      8px 8px at 28% 78%,
      rgba(255, 255, 255, 0.09),
      transparent 60%
    ),
    radial-gradient(
      5px 5px at 68% 30%,
      rgba(255, 255, 255, 0.1),
      transparent 60%
    ),
    radial-gradient(
      7px 7px at 88% 62%,
      rgba(255, 255, 255, 0.11),
      transparent 60%
    ),
    radial-gradient(
      6px 6px at 42% 12%,
      rgba(255, 255, 255, 0.08),
      transparent 60%
    );
  background-repeat: no-repeat;
  animation: particleDrift 24s ease-in-out infinite;
}

@keyframes particleDrift {
  0% {
    transform: translateY(0);
    filter: hue-rotate(0deg);
    background-position: 0px 0px, 0px 0px, 0px 0px, 0px 0px, 0px 0px;
  }
  50% {
    transform: translateY(-6px);
    filter: hue-rotate(-4deg);
    background-position: 18px -14px, -22px 12px, 16px 9px, -16px -18px,
      10px 18px;
  }
  100% {
    transform: translateY(0);
    filter: hue-rotate(0deg);
    background-position: 0px 0px, 0px 0px, 0px 0px, 0px 0px, 0px 0px;
  }
}

/* Title typography override to use Poppins (clean, modern) */
.landing .title {
  font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, Ubuntu,
    'Helvetica Neue', Arial, sans-serif;
}

/* Start button: large, rounded, green gradient, glowing hover, ripple compatible */
.landing #start-quiz-button {
  width: min(90vw, 460px);
  padding: 14px 44px;
  border-radius: 28px;
  font-size: 18px;
  background: linear-gradient(
    135deg,
    var(--green-600),
    var(--green-500)
  ) !important;
  color: #ffffff !important;
  box-shadow: 0 10px 26px rgba(27, 94, 32, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 0 0 0 rgba(102, 187, 106, 0);
  transition: background 220ms ease, transform 160ms ease, box-shadow 240ms ease,
    filter 200ms ease;
}

.landing #start-quiz-button:hover {
  background: linear-gradient(135deg, #2e7d32, #1b5e20) !important;
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(27, 94, 32, 0.55),
    0 0 0 6px rgba(102, 187, 106, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  filter: brightness(1.03);
}

.landing #start-quiz-button:active {
  transform: translateY(0) scale(0.985);
}

/* Input: rounded, semi-transparent, centered (glass style already present) */
.landing #user-name-input {
  width: min(90vw, 460px);
  padding: 14px 18px;
  border-radius: 18px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.18),
    rgba(255, 255, 255, 0.08)
  );
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #eaf7ea;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 1px 0 rgba(0, 0, 0, 0.12);
  transition: transform 160ms ease, box-shadow 220ms ease,
    border-color 200ms ease, background 220ms ease;
}

.landing #user-name-input:focus {
  transform: translateY(-1px) scale(1.02);
  border-color: rgba(102, 187, 106, 0.7);
  box-shadow: 0 0 0 6px rgba(102, 187, 106, 0.12),
    0 14px 30px rgba(0, 0, 0, 0.25);
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  body,
  .landing::before,
  .landing::after,
  .bg-particles,
  .landing .card,
  .landing .leaves .leaf {
    animation: none !important;
    transition: none !important;
  }
}

/* ===== Landing Overrides and Welcome Mode (take precedence by appending at EOF) ===== */

/* Neutralize the outer glass container on welcome so background/particles breathe */
#user-interface.centered.welcome-mode {
  width: 100%;
  max-height: none;
  overflow: visible;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: none;
}

/* Clean typography override for the hero title (ensure Poppins is used) */
#user-interface .landing .title {
  font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, Ubuntu,
    'Helvetica Neue', Arial, sans-serif;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

/* Subtitle tone (soft, supportive) */
#user-interface .landing .subtitle {
  color: var(--text-muted);
  margin: -2px 0 6px;
  font-weight: 400;
  letter-spacing: 0.2px;
}

/* Input: rounded, semi-transparent glass with gentle focus ring */
#user-interface .landing #user-name-input {
  width: min(90vw, 460px);
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.18),
    rgba(255, 255, 255, 0.08)
  );
  color: #eaf7ea;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 1px 0 rgba(0, 0, 0, 0.12);
  transition: transform 160ms ease, box-shadow 220ms ease,
    border-color 200ms ease, background 220ms ease;
}
#user-interface .landing #user-name-input:focus {
  transform: translateY(-1px) scale(1.02);
  border-color: rgba(102, 187, 106, 0.7);
  box-shadow: 0 0 0 6px rgba(102, 187, 106, 0.12),
    0 14px 30px rgba(0, 0, 0, 0.25);
}

/* Start button: large, rounded, green gradient, glowing hover; ripple already provided by JS */
#user-interface .landing #start-quiz-button {
  width: min(90vw, 460px);
  padding: 14px 44px;
  border-radius: 28px;
  font-size: 18px;
  background: linear-gradient(
    135deg,
    var(--green-600),
    var(--green-500)
  ) !important;
  color: #ffffff !important;
  box-shadow: 0 10px 26px rgba(27, 94, 32, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 0 0 0 rgba(102, 187, 106, 0);
  transition: background 220ms ease, transform 160ms ease, box-shadow 240ms ease,
    filter 200ms ease;
}
#user-interface .landing #start-quiz-button:hover {
  background: linear-gradient(135deg, #2e7d32, #1b5e20) !important;
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(27, 94, 32, 0.55),
    0 0 0 6px rgba(102, 187, 106, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  filter: brightness(1.03);
}
#user-interface .landing #start-quiz-button:active {
  transform: translateY(0) scale(0.985);
}

/* Respect reduced motion: also stop hero layers */
@media (prefers-reduced-motion: reduce) {
  #user-interface.centered.welcome-mode,
  #user-interface .landing .card,
  #user-interface .bg-particles,
  #user-interface .landing .leaves .leaf {
    animation: none !important;
    transition: none !important;
  }
}

/* === Alignment fixes for welcome input + start button === */
/* B1: We make the card a flex box. This helps us center things inside. */
#user-interface .landing .card {
  display: flex; /* B1: put items in a column */
  flex-direction: column; /* B1: vertical layout */
  align-items: center; /* B1: center items left-right */
}

/* B1: This box holds the input and the start button. We center it. */
#user-interface .landing .actions {
  display: flex; /* B1: stack input and button */
  flex-direction: column;
  align-items: center;
  gap: 12px; /* B1: small space between them */
  width: 100%;
  max-width: 460px; /* Constrain inner content to card, avoid overflow */
  margin: 0 auto; /* Center actions container horizontally */
  margin-top: auto; /* B1: push from top */
  margin-bottom: auto; /* B1: push from bottom -> moves to center */
}

/* B1: Make input and button same width and centered */
#user-interface .landing .actions > #user-name-input,
#user-interface .landing .actions > #start-quiz-button {
  width: 100%; /* Fill actions container, respect max-width */
  margin: 0; /* Container handles centering */
  display: block;
}

/* ===== End Page Styling (prize system) ===== */
.end-page {
  text-align: center;
  color: #1a1a1a; /* Dark text for professionalism and readability */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); /* Strong shadow for contrast on backgrounds */
}

.end-page .end-title,
.end-page .end-subtitle,
.end-page .end-copy {
  color: #1a1a1a !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) !important;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.end-page .score-badge {
  color: #000 !important;
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(0, 0, 0, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.end-page .prize-box {
  color: #1a1a1a !important;
}

.end-page .prize-box .prize-name,
.end-page .prize-box .prize-desc {
  color: #1a1a1a !important;
  text-shadow: none;
}

.end-page .end-title {
  margin: 0 0 6px;
  font-weight: 700;
  letter-spacing: 0.3px;
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  color: var(--text-strong);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35),
    0 0 12px
      color-mix(in lab, var(--answer-hover-accent, #ffd93d) 55%, transparent);
}

.end-page .end-subtitle {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-weight: 600;
}

.end-page .score-badge {
  display: inline-block;
  padding: 8px 14px;
  margin: 6px auto 10px;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.18),
    rgba(255, 255, 255, 0.08)
  );
  border: 1px solid
    color-mix(
      in lab,
      var(--answer-hover-accent, #ffd93d) 45%,
      rgba(255, 255, 255, 0.22)
    );
  color: #eaf7ea;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 10px 24px rgba(0, 0, 0, 0.28),
    0 0 0 6px
      color-mix(in lab, var(--answer-hover-accent, #ffd93d) 14%, transparent);
}

.end-page .end-copy {
  color: var(--text-muted);
  margin: 10px auto 12px;
  max-width: 560px;
}

.end-page .end-reset-btn {
  margin-top: 16px;
}

/* Prize card */
.prize-box {
  width: min(92vw, 560px);
  margin: 12px auto 0;
  padding: 16px 18px;
  border-radius: 16px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.14),
    rgba(255, 255, 255, 0.08)
  );
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: var(--glass-shadow);
  text-align: center;
  animation: fadeInUp 420ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.prize-box .prize-emoji {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 6px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}

.prize-box .prize-name {
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.prize-box .prize-desc {
  color: var(--text-muted);
  margin: 0;
}

/* Accent-tinted glow for prize box on end page */
.end-page .prize-box {
  box-shadow: var(--glass-shadow),
    0 0 0 6px
      color-mix(in lab, var(--answer-hover-accent, #ffd93d) 18%, transparent);
}

.prize-box.prize-none {
  border-style: dashed;
  opacity: 0.95;
}

/* Rules Modal Styles */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.modal.show {
  display: flex;
}

.modal-content {
  position: relative;
  max-width: 520px;
  width: min(92vw, 520px);
  max-height: 76vh;
  overflow-y: auto;
  padding: 24px 24px 20px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98),
    rgba(250, 253, 251, 0.96)
  );
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 20px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.15);
  color: #111;
  text-align: left;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: fadeInUp 300ms cubic-bezier(0.2, 0.75, 0.25, 1);
}
.modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  background: linear-gradient(90deg, #2e7d32, #66bb6a);
  box-shadow: 0 2px 8px rgba(102, 187, 106, 0.35);
  pointer-events: none;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 28px;
  color: #333;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 200ms ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.modal-close:hover {
  background: rgba(211, 47, 47, 0.1);
  color: #d32f2f;
  border-color: #d32f2f;
  transform: scale(1.1);
}

.modal h2 {
  margin: 0 0 16px;
  font-size: 1.4rem;
  font-weight: 600;
  color: #0d3b1e;
  text-align: center;
}
.modal h2::after {
  content: '';
  display: block;
  width: 56px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #2e7d32, #66bb6a);
  box-shadow: 0 2px 8px rgba(102, 187, 106, 0.4);
}

.rules-list {
  list-style: none;
  padding: 0;
  margin: 16px 0;
  text-align: left;
  display: grid;
  gap: 12px;
}
.rules-list li + li {
  border-top: none;
}

.rules-list li {
  position: relative;
  padding: 16px 20px 16px 56px;
  color: #ffffff;
  font-size: 16px;
  line-height: 1.6;
  font-weight: 700;
  background: linear-gradient(135deg, var(--green-600), var(--green-500));
  border: none;
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(27, 94, 32, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 0 0 0 rgba(102, 187, 106, 0);
  transition: transform 160ms ease, box-shadow 220ms ease, background 200ms ease,
    filter 180ms ease;
}

.rules-list li:hover {
  background: linear-gradient(135deg, #2e7d32, #1b5e20);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 18px 36px rgba(27, 94, 32, 0.55),
    0 0 0 6px rgba(102, 187, 106, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  filter: brightness(1.03);
}

.rules-list li::before {
  content: '✓';
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #2e7d32;
  box-shadow: 0 3px 8px rgba(76, 175, 80, 0.35);
}

@media (max-width: 520px) {
  .modal-content {
    padding: 20px;
    margin: 20px;
  }
}

/* Hint Tracker Styles */
.hint-tracker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.14),
    rgba(255, 255, 255, 0.08)
  );
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 8px 18px rgba(0, 0, 0, 0.25);
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
}

.hint-tracker .hint-label {
  text-transform: uppercase;
  opacity: 0.9;
  letter-spacing: 0.5px;
}

.hint-tracker .hint-used {
  font-weight: 700;
  color: var(--accent-info);
}
/* Make hint button flash red when hints are 0 (class is added by JS) */
#eliminate-two-answers-button.btn-error {
  --btn-bg: linear-gradient(135deg, #f44336, #e53935) !important;
  color: #fff !important;
}

/* ===== Quiz Header Layout (structured, responsive) ===== */
.quiz-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.quiz-header h1 {
  margin: 0;
}

/* ===== Professional Score Widget ===== */
.score-widget {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.14),
    rgba(255, 255, 255, 0.08)
  );
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 8px 18px rgba(0, 0, 0, 0.25);
}
.score-widget .score-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  opacity: 0.9;
  text-transform: uppercase;
}
.score-widget .score-values {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 700;
}
.score-widget .score-current {
  font-size: 20px;
  line-height: 1;
  min-width: 1.5ch;
  text-align: right;
}
.score-widget .score-sep {
  opacity: 0.75;
}
.score-widget .score-total {
  opacity: 0.9;
}

/* Score bump feedback */
.score-widget.score-bump {
  /* Consistent with 300–400ms range */
  animation: scoreBump 360ms cubic-bezier(0.2, 0.75, 0.25, 1);
}
@keyframes scoreBump {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1),
      0 8px 18px rgba(0, 0, 0, 0.25);
  }
  40% {
    transform: translateY(-1px) scale(1.06);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12),
      0 14px 28px rgba(0, 0, 0, 0.3);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1),
      0 8px 18px rgba(0, 0, 0, 0.25);
  }
}

/* Prize ladder removed */

/* ===== Answer Actions Row ===== */
.actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ===== Hint/Elimination Polished Effects ===== */
button.hint-used {
  --btn-bg: linear-gradient(135deg, #bdbdbd, #9e9e9e) !important;
  color: #1a1a1a !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25) !important;
}
button.hint-used::before {
  content: '🔒';
  transform: translateY(1px);
}

/* Disabled buttons general tone */
button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  filter: saturate(0.9) brightness(0.95);
}

button.hint-used {
  --btn-bg: linear-gradient(135deg, #bdbdbd, #9e9e9e) !important;
  color: #1a1a1a !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25) !important;
  animation: fadeOutDown 300ms ease;
}

button.hint-used::before {
  content: '🔒';
  transform: translateY(1px);
}

/* Answer elimination animation */
.eliminate-out {
  animation: eliminateOut 420ms cubic-bezier(0.2, 0.75, 0.25, 1) forwards;
  transform-origin: center;
}
@keyframes eliminateOut {
  0% {
    opacity: 1;
    transform: translateX(0) scale(1);
    filter: blur(0px);
  }
  100% {
    opacity: 0;
    transform: translateX(8px) scale(0.92);
    filter: blur(3px);
  }
}

/* Welcome/Question header spacing fix */
.quiz-header + #prize-panel {
  margin-top: 6px;
}

/* Reduced motion: disable cosmetic animations */
@media (prefers-reduced-motion: reduce) {
  .score-widget,
  .prize-ladder .ladder-item.current,
  .eliminate-out {
    animation: none !important;
    transition: none !important;
  }
}

/* ===== Creative Progress Bar with Prize Marks ===== */

/* Progress bar wrapper */
.progress-wrap {
  position: relative;
  width: 100%;
  margin: 6px 0 10px;
}

/* Progress marks: per-question "balls" positioned along the bar */
.progress-marks {
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  margin: 12px 0 16px;
}
.progress-marks .ball {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 280ms ease, filter 280ms ease, opacity 280ms ease,
    box-shadow 280ms ease;
  opacity: 0.98;
  backdrop-filter: blur(2px);
}
.progress-marks .ball:hover {
  transform: scale(1.12);
  filter: saturate(1.08) brightness(1.04);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Ball state colors */
.progress-marks .ball.state-unanswered {
  background: linear-gradient(180deg, #bdbdbd, #9e9e9e);
  opacity: 0.6;
  border-color: rgba(255, 255, 255, 0.5);
}
.progress-marks .ball.state-correct {
  background: linear-gradient(180deg, #4caf50, #43a047);
  border-color: rgba(76, 175, 80, 0.8);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.progress-marks .ball.state-wrong {
  background: linear-gradient(180deg, #f44336, #e53935);
  border-color: rgba(244, 67, 54, 0.8);
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.progress-marks .ball.state-hinted-only {
  background: linear-gradient(180deg, #2196f3, #1976d2);
  border-color: rgba(33, 150, 243, 0.8);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.progress-marks .ball.state-hinted-correct {
  background: linear-gradient(90deg, #2196f3 0% 50%, #4caf50 50% 100%);
  border-color: rgba(76, 175, 80, 0.8);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.progress-marks .ball.state-hinted-wrong {
  background: linear-gradient(90deg, #2196f3 0% 50%, #f44336 50% 100%);
  border-color: rgba(244, 67, 54, 0.8);
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.progress-marks .ball.state-avoided {
  background: linear-gradient(180deg, #ff9800, #f57c00);
  border-color: rgba(255, 152, 0, 0.8);
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Progress bar removed - only using balls now */
.progress-bar {
  display: none;
}
.progress-fill {
  display: none;
}
/* ===== Prize System Enhancements (progress, prize pop, salad bowl, confetti) ===== */

/* Per-question Prize Pop */
.prize-pop {
  position: relative; /* anchor confetti */
  margin: 8px 0 6px;
  min-height: 0;
  display: grid;
  place-items: center;
}
.prize-pop .prize-pop-card {
  display: inline-grid;
  place-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.14),
    rgba(255, 255, 255, 0.08)
  );
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: var(--glass-shadow);
  text-align: center;
  animation: prizePopIn 520ms cubic-bezier(0.2, 0.75, 0.25, 1);
}
.prize-pop .prize-pop-card .prize-emoji {
  font-size: 32px;
  line-height: 1;
  margin-bottom: 4px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}
.prize-pop .prize-pop-card .prize-title {
  font-weight: 700;
  letter-spacing: 0.3px;
}
.prize-pop .prize-pop-card .prize-msg {
  margin: 2px 0 0;
  color: var(--text-muted);
}
.prize-pop .prize-pop-card.correct {
  box-shadow: 0 0 0 2px rgba(102, 187, 106, 0.18) inset, var(--glass-shadow);
}
.prize-pop .prize-pop-card.fail {
  box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.18) inset, var(--glass-shadow);
}
@keyframes prizePopIn {
  0% {
    transform: translateY(6px) scale(0.96);
    opacity: 0;
  }
  60% {
    transform: translateY(-2px) scale(1.04);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

/* Cumulative Salad Bowl */
.salad-bowl {
  display: grid;
  grid-auto-flow: row;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  min-height: 36px;
  padding: 8px;
  border-radius: 14px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.06)
  );
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.salad-bowl .ingredient {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  font-size: 20px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.15);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  animation: ingredientPop 520ms cubic-bezier(0.2, 0.75, 0.25, 1);
}
@keyframes ingredientPop {
  0% {
    transform: translateY(6px) scale(0.8);
    opacity: 0;
  }
  60% {
    transform: translateY(-2px) scale(1.08);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

/* Floating salad ingredients on question pages */
.float-ingredients {
  position: fixed;
  inset: 0;
  z-index: 0; /* keep behind card content */
  pointer-events: none;
}
.float-ingredients .icon {
  position: absolute;
  top: var(--top, 50%);
  left: var(--left, 50%);
  transform: translate(-50%, -50%);
  animation-name: leafRandom;
  animation-duration: var(--dur, 4s);
  animation-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);
  animation-iteration-count: infinite;
  animation-delay: var(--delay, 0s);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25))
    drop-shadow(
      0 0 8px
        color-mix(in lab, var(--answer-hover-accent, #ffd93d) 35%, transparent)
    );
  color: color-mix(
    in lab,
    var(--answer-hover-accent, #ffd93d) 80%,
    transparent
  );
  transform-origin: center;
}

/* Answer feedback animations */
.correct-bounce {
  animation: correctBounce 520ms cubic-bezier(0.2, 0.75, 0.25, 1);
}
@keyframes correctBounce {
  0% {
    transform: scale(0.98);
  }
  50% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}
.incorrect-wilt {
  animation: incorrectWilt 520ms ease;
}
@keyframes incorrectWilt {
  0% {
    transform: none;
    filter: none;
  }
  100% {
    transform: rotate(-2deg) scale(0.96);
    filter: grayscale(0.2) brightness(0.9);
  }
}

/* Missing keyframes for .shake (used on errors and hint feedback) */
@keyframes incorrectShake {
  0% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-4px);
  }
  40% {
    transform: translateX(4px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(3px);
  }
  100% {
    transform: translateX(0);
  }
}

/* Confetti effect anchored to prize-pop */
.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}
.confetti-piece {
  position: absolute;
  top: 0;
  width: 6px;
  height: 10px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 2px;
  background: linear-gradient(180deg, #ffeb3b, #66bb6a);
  opacity: 0.95;
  animation: confettiFall 1.1s ease-out forwards;
}
@keyframes confettiFall {
  0% {
    transform: translateY(-8px) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    transform: translateY(140px) rotate(320deg);
    opacity: 0;
  }
}

/* Final page styles */
/*******************************/

.result-gif-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.result-gif {
  width: 300px;
  height: auto;
  opacity: 0;
  animation: fadeIn 0.8s forwards;
}

.result-text {
  font-size: 1.2rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 2px #000;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}
/*******************************/

.progress-marks {
  pointer-events: auto;
}
.progress-marks .ball {
  pointer-events: auto;
  cursor: pointer;
}

.ball.active {
  transform: scale(0.8);
  border: 2px solid red;
  box-shadow: 0 0 6px red;
  transition: transform 0.2s, border 0.2s, box-shadow 0.2s; /* smooth animation */
}

.ball {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: gray;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
  position: relative;
}
