* {
  box-sizing: border-box;
}

body {
  font-family: "Comic Sans MS", "Segoe UI", Arial, sans-serif;
  background: linear-gradient(135deg, #1e3a8a 0%, #312e81 25%, #4c1d95 50%, #1e293b 75%, #1e3a8a 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%; }
}

.card {
  width: 100%;
  max-width: 440px;
  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;
  border-radius: 10px;
  border: 2px solid #c7d2fe;
  background: #eef2ff;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
}

.lvl-btn.active {
  background: linear-gradient(135deg, #4f46e5, #312e81);
  border-color: #312e81;
  color: #fff;
  font-weight: 700;
}

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

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

.stat .label { font-size: 12px; color: #4338ca; font-weight: 700; }
.stat .value { font-size: 22px; font-weight: 800; color: #312e81; margin-top: 2px; }

.question-box {
  background: #f5f5ff;
  border: 1px solid #c7d2fe;
  border-radius: 14px;
  padding: 20px 16px;
  text-align: center;
}

#prompt {
  font-size: 16px;
  font-weight: 700;
  color: #312e81;
  margin-bottom: 16px;
}

.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 280px;
  margin: 0 auto 16px;
}

.ttt-cell {
  aspect-ratio: 1 / 1;
  border: 2px solid #c7d2fe;
  border-radius: 12px;
  background: #fff;
  font-size: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, transform 0.1s ease;
}

.ttt-cell:hover:not(:disabled):not(.filled) {
  background: #eef2ff;
  transform: scale(1.04);
}

.ttt-cell:disabled {
  cursor: default;
}

.ttt-cell.win-cell {
  background: #fde68a;
  border-color: #f59e0b;
}

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

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

.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: #4f46e5; color: #fff; }
.check-btn:hover { background: #4338ca; }
#fireworks-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}