

:root {
  --yellow:   #FFE135;
  --orange:   #FF7043;
  --pink:     #FF4D9E;
  --purple:   #7C3AED;
  --blue:     #2196F3;
  --teal:     #00BCD4;
  --green:    #4CAF50;
  --lime:     #CDDC39;
  --white:    #FFFFFF;
  --dark:     #1A1035;
  --card-bg:  #FFFFFF;
  --radius:   20px;
  --shadow:   0 8px 32px rgba(0,0,0,0.13);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(135deg, #1A1035 0%, #2D1B69 40%, #0D47A1 100%);
  min-height: 100vh;
  color: var(--dark);
  overflow-x: hidden;
}

/* ── FLOATING BG EMOJIS ── */
.bg-emojis {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.float-emoji {
  position: absolute;
  font-size: clamp(1.4rem, 4vw, 2.5rem);
  opacity: 0.18;
  animation: floatUp linear infinite;
  user-select: none;
}

@keyframes floatUp {
  0%   { transform: translateY(110vh) rotate(0deg);   opacity: 0.18; }
  100% { transform: translateY(-15vh) rotate(360deg); opacity: 0; }
}

/* ── HERO ── */
.hero {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 3.5rem 2rem 2.5rem;
  text-align: center;
  flex-wrap: wrap;
}

.hero-content { max-width: 620px; }

.hero-badge {
  display: inline-block;
  background: var(--yellow);
  color: var(--dark);
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  padding: 0.35rem 1.1rem;
  border-radius: 100px;
  margin-bottom: 1rem;
  box-shadow: 0 4px 0 #c8a000;
  letter-spacing: 0.04em;
}

.hero-title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2.2rem, 7vw, 4rem);
  color: var(--white);
  line-height: 1.1;
  text-shadow: 4px 4px 0 var(--purple), 0 0 40px rgba(255,225,53,0.4);
  margin-bottom: 0.8rem;
}

.hero-sub {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: rgba(255,255,255,0.85);
  font-weight: 700;
}

.hero-mascot {
  font-size: clamp(4rem, 12vw, 8rem);
  animation: wobble 3s ease-in-out infinite;
  filter: drop-shadow(0 8px 24px rgba(255,77,158,0.5));
}

.bounce {
  display: inline-block;
  animation: bounceIcon 1.5s ease-in-out infinite;
}

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

@keyframes wobble {
  0%, 100% { transform: rotate(-6deg) scale(1); }
  50%       { transform: rotate(6deg) scale(1.08); }
}

/* ── TABS NAV ── */
.tab-nav {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0 1rem 1.5rem;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Fredoka One', cursive;
  font-size: 1.05rem;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  background: rgba(255,255,255,0.15);
  color: var(--white);
  border: 2px solid rgba(255,255,255,0.2);
  backdrop-filter: blur(8px);
  transition: all 0.22s ease;
  box-shadow: 0 4px 0 rgba(0,0,0,0.2);
}

.tab-btn:hover {
  background: rgba(255,255,255,0.3);
  transform: translateY(-3px);
  box-shadow: 0 7px 0 rgba(0,0,0,0.2);
}

.tab-btn.active {
  background: var(--yellow);
  color: var(--dark);
  border-color: #c8a000;
  transform: translateY(-4px);
  box-shadow: 0 6px 0 #c8a000;
}

/* ── MAIN CONTENT CARD ── */
.main-content {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto 3rem;
  padding: 0 1rem;
}

.tab-panel {
  display: none;
  background: var(--card-bg);
  border-radius: 28px;
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow), 0 0 0 4px rgba(255,255,255,0.08);
  animation: popIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

.tab-panel.active { display: block; }

@keyframes popIn {
  from { transform: scale(0.94) translateY(12px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

/* ── SECTION HEADER ── */
.section-header {
  text-align: center;
  margin-bottom: 2rem;
}

.section-header h2 {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  color: var(--purple);
  margin-bottom: 0.3rem;
}

.section-header p {
  font-size: 1.05rem;
  color: #666;
  font-weight: 700;
}

/* ── NUMBER PICKER (Tables) ── */
.picker-label {
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem;
  color: var(--dark);
  text-align: center;
  margin-bottom: 1rem;
}

.number-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.num-pill {
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 5px 0 rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.num-pill:hover {
  transform: translateY(-4px) scale(1.1);
  box-shadow: 0 9px 0 rgba(0,0,0,0.15);
}

.num-pill.active {
  transform: translateY(-6px) scale(1.15);
  outline: 4px solid var(--yellow);
  outline-offset: 2px;
}

/* ── TABLE DISPLAY ── */
.table-display {
  min-height: 200px;
}

.table-empty {
  text-align: center;
  padding: 3rem;
  color: #aaa;
}

.empty-icon { font-size: 3rem; margin-bottom: 0.5rem; }

.table-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1.6rem;
  text-align: center;
  margin-bottom: 1.2rem;
  color: var(--purple);
}

.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.7rem;
}

.table-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.2rem;
  border-radius: 14px;
  font-family: 'Fredoka One', cursive;
  font-size: 1.15rem;
  box-shadow: 0 4px 0 rgba(0,0,0,0.1);
  animation: slideIn 0.3s ease both;
  color: #fff;
}

.table-row .eq { opacity: 0.75; font-size: 0.9rem; }
.table-row .answer { font-size: 1.4rem; }

@keyframes slideIn {
  from { transform: translateX(-20px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

/* ── COUNT CONTROLS ── */
.count-controls {
  background: #F8F0FF;
  border-radius: 18px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.control-row label {
  font-family: 'Fredoka One', cursive;
  font-size: 1.05rem;
  color: var(--purple);
  min-width: 110px;
}

.num-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.num-input-wrap input {
  width: 75px;
  text-align: center;
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem;
  border: 3px solid var(--purple);
  border-radius: 12px;
  padding: 0.4rem;
  outline: none;
  color: var(--purple);
}

.num-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: var(--purple);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.15s;
}
.num-btn:hover { transform: scale(1.15); }

.step-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.chip {
  padding: 0.35rem 0.9rem;
  border-radius: 100px;
  border: 2px solid var(--purple);
  background: #fff;
  color: var(--purple);
  font-family: 'Fredoka One', cursive;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.18s;
}
.chip:hover { background: #EDE9FE; }
.chip.active { background: var(--purple); color: #fff; }

/* ── GO BUTTON ── */
.go-btn {
  display: block;
  margin: 1rem auto 0;
  padding: 0.85rem 2.5rem;
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
  border: none;
  border-radius: 100px;
  background: linear-gradient(135deg, var(--green), var(--teal));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 0 #007a68, var(--shadow);
  transition: all 0.2s;
}
.go-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 0 #007a68, var(--shadow);
}
.go-btn:active { transform: translateY(1px); box-shadow: 0 3px 0 #007a68; }

.go-btn--red {
  background: linear-gradient(135deg, var(--orange), var(--pink));
  box-shadow: 0 6px 0 #b71c1c, var(--shadow);
}
.go-btn--red:hover { box-shadow: 0 10px 0 #b71c1c, var(--shadow); }

/* ── NUMBER TRAIN (counting display) ── */
.number-train {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  padding-top: 0.5rem;
}

.train-car {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.train-num {
  font-family: 'Fredoka One', cursive;
  font-size: 1.25rem;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 5px 0 rgba(0,0,0,0.15);
  animation: popBounce 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
  cursor: default;
  transition: transform 0.2s;
}

.train-num:hover {
  transform: translateY(-6px) scale(1.1);
}

.train-wheel { font-size: 1.1rem; }

@keyframes popBounce {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ── QUIZ ── */
.quiz-setup {
  text-align: center;
}

.quiz-type-grid {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.quiz-type-card {
  width: 130px;
  height: 110px;
  border-radius: 20px;
  border: 3px solid transparent;
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  color: #fff;
  box-shadow: 0 6px 0 rgba(0,0,0,0.15);
}

.quiz-type-card:nth-child(1) { background: linear-gradient(135deg, var(--purple), var(--blue)); box-shadow: 0 6px 0 #1565C0; }
.quiz-type-card:nth-child(2) { background: linear-gradient(135deg, var(--green), var(--teal));  box-shadow: 0 6px 0 #007a68; }
.quiz-type-card:nth-child(3) { background: linear-gradient(135deg, var(--orange), var(--pink)); box-shadow: 0 6px 0 #b71c1c; }
.quiz-type-card:nth-child(4) { background: linear-gradient(135deg, var(--pink), var(--purple)); box-shadow: 0 6px 0 #6a1b9a; }

.quiz-type-card:hover {
  transform: translateY(-6px) scale(1.06);
  box-shadow: 0 12px 0 rgba(0,0,0,0.18);
}

.quiz-hud {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.8rem 1rem;
  background: var(--purple);
  border-radius: 16px;
  color: #fff;
  font-family: 'Fredoka One', cursive;
  font-size: 1.05rem;
}

.score-hud { color: var(--yellow); }

.question-card {
  background: linear-gradient(135deg, #F3E8FF, #E0F2FE);
  border-radius: 24px;
  padding: 2rem;
  text-align: center;
  margin-bottom: 1rem;
  min-height: 220px;
}

.question-text {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  color: var(--purple);
  margin-bottom: 1.5rem;
}

.answer-choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}

.choice-btn {
  font-family: 'Fredoka One', cursive;
  font-size: 1.4rem;
  padding: 0.85rem;
  border-radius: 16px;
  border: 3px solid rgba(255,255,255,0.7);
  cursor: pointer;
  transition: all 0.18s;
  color: #fff;
  box-shadow: 0 5px 0 rgba(0,0,0,0.12);
}

.choice-btn:hover:not(:disabled) {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 9px 0 rgba(0,0,0,0.12);
}

.choice-btn:disabled { opacity: 0.75; cursor: not-allowed; transform: none; }

.choice-btn.correct { background: var(--green) !important; border-color: #2e7d32; box-shadow: 0 5px 0 #1b5e20; }
.choice-btn.wrong   { background: var(--orange) !important; border-color: #bf360c; opacity: 0.6; }

.feedback {
  font-family: 'Fredoka One', cursive;
  font-size: 1.5rem;
  min-height: 2rem;
  margin-top: 0.8rem;
}

.skip-btn {
  display: block;
  margin: 0 auto;
  padding: 0.65rem 2rem;
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  box-shadow: 0 4px 0 #1565C0;
  transition: all 0.2s;
}
.skip-btn:hover { transform: translateY(-3px); }

/* ── QUIZ RESULT ── */
.quiz-result {
  text-align: center;
  padding: 2rem;
  animation: popIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

.result-emoji { font-size: 5rem; animation: bounceIcon 1s ease-in-out infinite; }

.quiz-result h3 {
  font-family: 'Fredoka One', cursive;
  font-size: 2.2rem;
  color: var(--purple);
  margin: 0.5rem 0;
}

.quiz-result p { font-size: 1.1rem; color: #555; margin-bottom: 1rem; }

.result-score {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  color: var(--orange);
  margin-bottom: 1.5rem;
}

/* ── FOOTER ── */
.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem;
  color: rgba(255,255,255,0.55);
  font-weight: 700;
  font-size: 0.95rem;
}

/* ── CONFETTI CANVAS ── */
#confettiCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .tab-panel { padding: 1.5rem 1rem; }
  .hero { padding: 2rem 1rem 1.5rem; }
  .control-row label { min-width: 80px; }
  .quiz-type-card { width: 110px; height: 95px; font-size: 0.95rem; }
  .table-grid { grid-template-columns: 1fr; }
}