* {
  box-sizing: border-box;
}

body {
  font-family: "Comic Sans MS", "Segoe UI", Arial, sans-serif;
  background: linear-gradient(135deg, #0c4a6e 0%, #0e7490 25%, #0f766e 50%, #134e4a 75%, #0c4a6e 100%);
  background-size: 300% 300%;
  animation: gradientShift 14s ease infinite;
  position: relative;
  overflow-x: hidden;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

#fireworks-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

.card {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 24px;
  padding: 24px 20px 32px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 1;
}

.levels { display: flex; gap: 8px; margin-bottom: 20px; }

.lvl-btn {
  flex: 1;
  padding: 10px 6px;
  border-radius: 10px;
  border: 2px solid #a5f3fc;
  background: #ecfeff;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

.lvl-btn.active {
  background: linear-gradient(135deg, #06b6d4, #0e7490);
  border-color: #155e75;
  color: #fff;
  font-weight: 700;
}

.stats { display: flex; gap: 10px; margin-bottom: 20px; }

.stat {
  flex: 1;
  background: #cffafe;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.stat .label { font-size: 12px; color: #0e7490; font-weight: 700; }
.stat .value { font-size: 22px; font-weight: 800; color: #164e63; margin-top: 2px; }

.question-box {
  background: #f0fdff;
  border: 1px solid #a5f3fc;
  border-radius: 14px;
  padding: 18px 14px;
  text-align: center;
}

#prompt {
  font-size: 15px;
  font-weight: 700;
  color: #164e63;
  margin-bottom: 14px;
}

/* ---------- Cards ---------- */
.mm-board {
  display: grid;
  gap: 8px;
  margin: 0 auto 14px;
}

.mm-card {
  min-width: 0;
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: 12px;
  padding: 0;
  font-family: inherit;
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(160deg, #06b6d4, #0e7490);
  box-shadow: 0 4px 0 #155e75;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease;
}

.mm-card:hover:not(:disabled):not(.up) { transform: translateY(-2px); }

.mm-card.up.question {
  background: #fef3c7;
  color: #92400e;
  box-shadow: 0 4px 0 #f59e0b;
  font-size: 17px;
}

.mm-card.up.answer {
  background: #dcfce7;
  color: #166534;
  box-shadow: 0 4px 0 #22c55e;
  font-size: 24px;
}

.mm-card.matched {
  opacity: 0.75;
  box-shadow: none;
  transform: scale(0.96);
}

.mm-card:disabled { cursor: default; }

.mm-board.cols-5 .mm-card { font-size: 20px; border-radius: 10px; }
.mm-board.cols-5 .mm-card.up.question { font-size: 14px; }
.mm-board.cols-5 .mm-card.up.answer { font-size: 20px; }

#feedback {
  min-height: 20px;
  font-weight: 700;
  font-size: 14px;
}

.feedback-correct { color: #15803d; }
.feedback-wrong { color: #dc2626; }

.actions { display: flex; margin-top: 16px; }

.action-btn {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.check-btn { background: #0e7490; color: #fff; }
.check-btn:hover { background: #155e75; }