:root {
  --bg: #0A1510;
  --card: #12271A;
  --card-border: #234A33;
  --fg: #F0FAF3;
  --muted: #93B8A2;
  --green: #34D399;
  --yellow: #FCD34D;
  --purple: #A78BFA;
  --pink: #F472B6;
  --blue: #38BDF8;
  --red: #F87171;
  --font-display: 'Fredoka', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Floating background blobs */
.blob {
  position: fixed;
  border-radius: 50%;
  opacity: 0.14;
  z-index: 0;
  animation: float 14s ease-in-out infinite alternate;
}
.b1 { width: 340px; height: 340px; background: var(--green); top: -80px; left: -80px; }
.b2 { width: 260px; height: 260px; background: var(--purple); bottom: -60px; right: -40px; animation-delay: -5s; }
.b3 { width: 180px; height: 180px; background: var(--yellow); top: 40%; right: 12%; animation-delay: -9s; }
@keyframes float {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(60px) scale(1.12); }
}

.game {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.screen {
  width: 100%;
  max-width: 480px;
  text-align: center;
  animation: rise 0.5s cubic-bezier(0.22, 0.9, 0.3, 1) both;
}
.screen.hidden { display: none; }
@keyframes rise {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: none; }
}

.logo {
  font-family: var(--font-display);
  font-size: clamp(3rem, 10vw, 4.2rem);
  font-weight: 700;
  margin: 0;
  color: var(--green);
  text-shadow: 0 4px 0 rgba(52,211,153,0.25);
  letter-spacing: 0.02em;
}
.tag { color: var(--muted); font-size: 1.05rem; margin: 0.75rem 0 2rem; }

/* Grade buttons */
.grades {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
}
.grade-btn {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  padding: 0.9rem 0;
  border-radius: 16px;
  border: 2px solid var(--card-border);
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.grade-btn:hover { transform: translateY(-3px); border-color: var(--green); }
.grade-btn:active { transform: scale(0.95); }
.grade-btn.picked {
  background: var(--green);
  color: #052015;
  border-color: var(--green);
  box-shadow: 0 6px 0 rgba(52,211,153,0.3);
}
.grade-btn:nth-child(2n):hover { border-color: var(--purple); }
.grade-btn:nth-child(2n).picked { background: var(--purple); border-color: var(--purple); box-shadow: 0 6px 0 rgba(167,139,250,0.3); }
.grade-btn:nth-child(3n):hover { border-color: var(--yellow); }
.grade-btn:nth-child(3n).picked { background: var(--yellow); border-color: var(--yellow); box-shadow: 0 6px 0 rgba(252,211,77,0.3); color: #3A2E05; }
.grade-btn:nth-child(4) { grid-column: 2 / 4; }
/* 7 buttons in 4-col grid: last one centered */

/* Big action button */
.big-btn {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  padding: 0.85rem 3rem;
  border: none;
  border-radius: 18px;
  background: var(--green);
  color: #052015;
  cursor: pointer;
  box-shadow: 0 6px 0 #0E8A5F;
  transition: transform 0.12s, box-shadow 0.12s, background 0.2s;
}
.big-btn:hover:not(:disabled) { background: #4EE3AD; }
.big-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 #0E8A5F; }
.big-btn:disabled { opacity: 0.4; cursor: default; box-shadow: none; }

.home-link {
  display: inline-block;
  margin-top: 2rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.home-link:hover { color: var(--green); }

/* Question screen */
.progress { margin-bottom: 1.5rem; }
.progress-label {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.progress-bar {
  height: 10px;
  background: var(--card);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--card-border);
}
.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--green), var(--blue));
  border-radius: 999px;
  transition: width 0.35s ease;
}

.question-card {
  background: var(--card);
  border: 2px solid var(--card-border);
  border-radius: 24px;
  padding: 2.25rem 1.75rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}
.question {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 9vw, 3.6rem);
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--fg);
}
.answer {
  display: block;
  width: 100%;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  text-align: center;
  padding: 0.75rem;
  margin-bottom: 1.5rem;
  border: 2px solid var(--card-border);
  border-radius: 14px;
  background: var(--bg);
  color: var(--yellow);
  outline: none;
  transition: border-color 0.2s;
}
.answer:focus { border-color: var(--green); }
.answer::placeholder { color: var(--muted); opacity: 0.5; }

.shake { animation: shake 0.3s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* Score screen */
.score-title {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--yellow);
  margin: 0 0 1.5rem;
}
.misses { margin-bottom: 1.75rem; }
.miss {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.6rem 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  text-align: left;
}
.miss .was { color: var(--red); }
.miss .right { color: var(--green); font-weight: 700; }
.all-right {
  color: var(--green);
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 1.75rem;
}

/* Confetti */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.confetti-piece {
  position: absolute;
  top: -16px;
  border-radius: 3px;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0.7; }
}

@media (max-width: 400px) {
  .grades { grid-template-columns: repeat(3, 1fr); }
  .grade-btn:nth-child(4) { grid-column: auto; }
}
