/* ============================================
   FirstStepMath – Main Stylesheet
   ============================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --purple:   #6C63FF;  --purple-dk: #5a53e6;
  --orange:   #FF6B35;  --orange-dk: #e55a25;
  --teal:     #4ECDC4;  --teal-dk:   #3ab5ac;
  --yellow:   #FFE66D;
  --prek:     #FF6B9D;
  --kinder:   #4A90E2;
  --grade1:   #7B5EA7;
  --grade2:   #E67E22;
  --white:    #ffffff;
  --bg:       #f5f7ff;
  --gray:     #6c757d;
  --dark:     #1a1a2e;
  --shadow:   0 4px 20px rgba(0,0,0,0.10);
  --shadow-lg:0 10px 40px rgba(0,0,0,0.15);
  --radius:   18px;
}

html { scroll-behavior: smooth; }
body { font-family: 'Nunito', sans-serif; color: var(--dark); background: var(--white); line-height: 1.5; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* === Touch Improvements === */
* { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 24px; border-radius: 50px; border: none; cursor: pointer;
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 0.95rem;
  text-decoration: none; transition: all 0.2s; white-space: nowrap;
  touch-action: manipulation; user-select: none;
}
.btn-primary  { background: var(--orange); color: #fff; }
.btn-primary:hover, .btn-primary:active { background: var(--orange-dk); transform: translateY(-2px); }
.btn-outline  { background: transparent; border: 2px solid var(--orange); color: var(--orange); }
.btn-outline:hover, .btn-outline:active { background: var(--orange); color: #fff; }
.btn-hero {
  background: var(--yellow); color: var(--dark);
  font-size: 1.1rem; padding: 15px 36px;
  box-shadow: 0 6px 20px rgba(255,230,109,0.5);
}
.btn-hero:hover, .btn-hero:active { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(255,230,109,0.6); }

/* ============================================ HEADER */
.header { position: sticky; top: 0; z-index: 100; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; height: 68px; display: flex; align-items: center; gap: 24px; }
.logo { text-decoration: none; font-family: 'Fredoka One', cursive; font-size: 1.75rem; line-height: 1; display:flex; align-items:center; }
.logo-img { height: 52px; width: auto; display: block; }
.logo-first { color: var(--orange); }
.logo-math  { color: var(--teal); }
.main-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.nav-link { text-decoration: none; color: var(--dark); font-weight: 700; padding: 8px 14px; border-radius: 8px; transition: background 0.2s; font-size: 0.92rem; }
.nav-link:hover { background: var(--bg); }
.nav-link-store { color: var(--orange) !important; }
.hamburger { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; margin-left: auto; color: var(--dark); touch-action: manipulation; }

/* ============================================ HERO */
.hero {
  background: linear-gradient(135deg, #4776E6 0%, #8E54E9 100%);
  padding: 80px 48px; display: flex; align-items: center; justify-content: center;
  gap: 64px; flex-wrap: wrap; position: relative; overflow: hidden; min-height: 520px;
}
/* Banner hero override */
.hero.hero-banner {
  background: #fff !important; padding: 0 !important; display: block !important;
  min-height: unset !important; overflow: hidden; gap: 0; flex-wrap: unset;
}
.hero-banner-img {
  width: 100%; display: block; height: auto; object-fit: contain;
}
.hero-banner-cta {
  background: linear-gradient(135deg, #4776E6 0%, #8E54E9 100%);
  display: flex; align-items: center; justify-content: center; gap: 40px;
  padding: 24px 48px; flex-wrap: wrap;
}
@media(max-width:600px) {
  .hero.hero-banner { display: none; }
}
.hero::before { content: ''; position: absolute; width: 700px; height: 700px; background: rgba(255,255,255,0.05); border-radius: 50%; top: -300px; right: -200px; pointer-events: none; }
.hero-content { color: #fff; max-width: 520px; position: relative; z-index: 1; }
.hero-badge { display: inline-block; background: rgba(255,255,255,0.2); padding: 6px 16px; border-radius: 50px; font-size: 0.85rem; font-weight: 700; margin-bottom: 20px; }
.hero-title { font-family: 'Fredoka One', cursive; font-size: 3.2rem; line-height: 1.15; margin-bottom: 18px; text-shadow: 2px 3px 0 rgba(0,0,0,0.12); }
.hero-subtitle { font-size: 1.15rem; opacity: 0.92; margin-bottom: 32px; font-weight: 600; }
.hero-stats { display: flex; align-items: center; gap: 20px; margin-top: 32px; background: rgba(255,255,255,0.15); padding: 16px 24px; border-radius: 16px; width: fit-content; }
.stat { display: flex; flex-direction: column; align-items: center; }
.stat strong { font-family: 'Fredoka One', cursive; font-size: 1.5rem; }
.stat span { font-size: 0.78rem; opacity: 0.85; font-weight: 700; }
.stat-divider { width: 1px; height: 32px; background: rgba(255,255,255,0.4); }
.hero-art { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.mascot-wrap { position: relative; }
.mascot { font-size: 7rem; display: block; animation: float 3s ease-in-out infinite; filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2)); }
.mascot-shadow { width: 80px; height: 16px; background: rgba(0,0,0,0.15); border-radius: 50%; margin: -8px auto 0; filter: blur(4px); animation: shadowPulse 3s ease-in-out infinite; }
.hero-bubble { position: absolute; background: #fff; border-radius: 16px; padding: 10px 16px; font-family: 'Fredoka One', cursive; font-size: 1rem; color: var(--dark); box-shadow: var(--shadow); white-space: nowrap; }
.bubble-1 { top: -20px; left: -140px; animation: floatAlt 3.5s ease-in-out infinite; color: var(--orange); }
.bubble-2 { top: 20px; right: -130px; animation: floatAlt 4s ease-in-out 0.5s infinite; color: var(--grade1); }
.bubble-3 { bottom: 40px; left: -130px; animation: floatAlt 3.2s ease-in-out 1s infinite; color: var(--teal-dk); }
@keyframes float    { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-14px)} }
@keyframes floatAlt { 0%,100%{transform:translateY(0) rotate(-2deg)} 50%{transform:translateY(-8px) rotate(2deg)} }
@keyframes shadowPulse { 0%,100%{transform:scaleX(1);opacity:.5} 50%{transform:scaleX(0.75);opacity:.3} }

/* ============================================ HOW IT WORKS */
.how-section { padding: 72px 0; background: var(--bg); }
.section-title { font-family: 'Fredoka One', cursive; font-size: 2rem; text-align: center; margin-bottom: 8px; }
.section-subtitle { text-align: center; color: var(--gray); font-weight: 600; margin-bottom: 40px; }
.steps-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; }
.step-card { background: #fff; border-radius: var(--radius); padding: 36px 28px; text-align: center; box-shadow: var(--shadow); transition: transform 0.2s; }
.step-card:hover { transform: translateY(-4px); }
.step-icon { font-size: 2.8rem; margin-bottom: 16px; }
.step-card h3 { font-family: 'Fredoka One', cursive; font-size: 1.2rem; margin-bottom: 8px; }
.step-card p { color: var(--gray); font-weight: 600; font-size: 0.95rem; }

/* ============================================ GRADE TABS */
.grades-section { padding: 72px 0 24px; background: #fff; }
.grade-tabs { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.grade-tab { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 32px; border-radius: 20px; border: 3px solid #e8e8e8; background: #fff; cursor: pointer; transition: all 0.22s; min-width: 140px; touch-action: manipulation; }
.grade-tab-icon { font-size: 2rem; }
.grade-tab-label { font-family: 'Fredoka One', cursive; font-size: 1.05rem; color: var(--dark); }
.grade-tab-desc  { font-size: 0.75rem; font-weight: 700; color: var(--gray); }
.grade-tab:hover { border-color: var(--orange); transform: translateY(-3px); }
.grade-tab.active[data-grade="prek"]         { background: var(--prek);   border-color: var(--prek);   box-shadow: 0 6px 20px rgba(255,107,157,0.45); }
.grade-tab.active[data-grade="kindergarten"] { background: var(--kinder); border-color: var(--kinder); box-shadow: 0 6px 20px rgba(74,144,226,0.45); }
.grade-tab.active[data-grade="grade1"]       { background: var(--grade1); border-color: var(--grade1); box-shadow: 0 6px 20px rgba(123,94,167,0.45); }
.grade-tab.active[data-grade="grade2"]       { background: var(--grade2); border-color: var(--grade2); box-shadow: 0 6px 20px rgba(230,126,34,0.45); }
.grade-tab.active .grade-tab-label,
.grade-tab.active .grade-tab-desc { color: #fff; }

/* ============================================ TOPICS GRID */
.topics-section { padding: 32px 0 80px; background: var(--bg); }
.grade-intro { text-align: center; margin-bottom: 28px; font-family: 'Fredoka One', cursive; font-size: 1.1rem; color: var(--gray); }
.topics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 20px; }
.topic-card { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); cursor: pointer; text-decoration: none; color: var(--dark); transition: all 0.25s; display: flex; flex-direction: column; touch-action: manipulation; }
.topic-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.topic-card:active { transform: scale(0.98); }
.topic-card-top { height: 110px; display: flex; align-items: center; justify-content: center; font-size: 3.5rem; }
.topic-card-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.topic-card-title { font-family: 'Fredoka One', cursive; font-size: 1.05rem; }
.topic-card-meta  { display: flex; align-items: center; justify-content: space-between; }
.topic-card-count { font-size: 0.78rem; font-weight: 700; color: var(--gray); }
.topic-standard   { font-size: 0.7rem; font-weight: 800; color: #fff; background: var(--gray); padding: 2px 7px; border-radius: 20px; }
.difficulty-dots  { display: flex; gap: 3px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #e0e0e0; }
.dot.on { background: var(--teal); }

.card-prek         .topic-card-top { background: linear-gradient(135deg,#ffecd2,#fcb69f); }
.card-prek         .topic-standard { background: var(--prek); }
.card-kindergarten .topic-card-top { background: linear-gradient(135deg,#bde0fe,#a2d2ff); }
.card-kindergarten .topic-standard { background: var(--kinder); }
.card-grade1       .topic-card-top { background: linear-gradient(135deg,#d8b4fe,#e0aaff); }
.card-grade1       .topic-standard { background: var(--grade1); }
.card-grade2       .topic-card-top { background: linear-gradient(135deg,#fde68a,#fca5a5); }
.card-grade2       .topic-standard { background: var(--grade2); }

/* ============================================ FOOTER */
.footer { background: var(--dark); color: rgba(255,255,255,0.8); padding: 60px 0 0; }
.footer-top { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; padding-bottom: 40px; }
.footer-brand p { margin-top: 12px; font-size: 0.9rem; opacity: 0.7; }
.footer-logo .logo-first { color: var(--orange); }
.footer-logo .logo-math  { color: var(--teal); }
.footer-links-group { display: flex; flex-direction: column; gap: 10px; }
.footer-links-group h4 { color: #fff; font-weight: 800; margin-bottom: 4px; font-size: 0.9rem; }
.footer-links-group a { color: rgba(255,255,255,0.65); text-decoration: none; font-size: 0.88rem; font-weight: 600; transition: color 0.2s; }
.footer-links-group a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding: 20px 0; text-align: center; font-size: 0.82rem; opacity: 0.5; }

/* ============================================ QUIZ PAGE */
body.quiz-page { background: #eef2ff; min-height: 100vh; }
.quiz-header { background: #fff; height: 64px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 2px 10px rgba(0,0,0,0.08); position: sticky; top: 0; z-index: 50; }
.back-btn { text-decoration: none; color: var(--orange); font-weight: 800; font-size: 0.95rem; padding: 8px 14px; border-radius: 8px; transition: background 0.2s; touch-action: manipulation; }
.back-btn:hover { background: var(--bg); }
.quiz-score-display { display: flex; align-items: center; gap: 6px; font-family: 'Fredoka One', cursive; font-size: 1.5rem; color: var(--orange); }
.score-star { font-size: 1.3rem; }

.quiz-main { max-width: 700px; margin: 0 auto; padding: 28px 20px 60px; }
.quiz-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.quiz-topic-label { font-family: 'Fredoka One', cursive; font-size: 1.2rem; color: var(--orange); }
.quiz-counter { font-weight: 800; color: var(--gray); font-size: 0.9rem; }
.quiz-standard { font-size: 0.72rem; font-weight: 800; color: #fff; background: var(--gray); padding: 2px 8px; border-radius: 20px; margin-left: 8px; }

.progress-track { height: 14px; background: #d0d7f5; border-radius: 7px; overflow: hidden; margin-bottom: 24px; }
.progress-fill { height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--teal), var(--orange)); transition: width 0.45s cubic-bezier(0.4,0,0.2,1); }

.question-card { background: #fff; border-radius: 26px; padding: 36px 32px; box-shadow: var(--shadow-lg); min-height: 360px; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.question-text { font-family: 'Fredoka One', cursive; font-size: 1.6rem; text-align: center; color: var(--dark); line-height: 1.3; }

/* Visual Box — container for all visual types */
.visual-box { background: var(--bg); border-radius: 16px; padding: 20px 24px; min-width: 240px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; }
.visual-box[data-empty="true"] { display: none; }
.visual-emoji { font-size: 2.4rem; letter-spacing: 4px; text-align: center; }

/* === 10-Frame === */
.tenframe-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tenframe-label { font-family: 'Fredoka One', cursive; font-size: 0.85rem; color: var(--gray); }
.tenframe {
  display: inline-flex; flex-direction: column; gap: 4px;
  padding: 10px; border: 3px solid #333; border-radius: 8px; background: #fff;
}
.tf-row { display: flex; gap: 4px; }
.tf-cell {
  width: 42px; height: 42px; border: 2px solid #888; border-radius: 50%;
  background: #f5f5f5; transition: background 0.1s;
}
.tf-cell.red    { background: #e74c3c; border-color: #c0392b; box-shadow: inset 0 2px 4px rgba(0,0,0,0.2); }
.tf-cell.yellow { background: #f1c40f; border-color: #d4ac0d; box-shadow: inset 0 2px 4px rgba(0,0,0,0.15); }
.tf-cell.blue   { background: #3498db; border-color: #2980b9; box-shadow: inset 0 2px 4px rgba(0,0,0,0.2); }
.tf-cell.crossed { background: #f5f5f5; position: relative; }
.tf-cell.crossed::after { content: '✕'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1rem; color: #e74c3c; font-weight: 900; }

/* Two 10-frames side by side */
.tenframe-pair { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; justify-content: center; }
.tenframe-pair .tenframe-wrap { align-items: center; }

/* === Number Line === */
.numberline-wrap { width: 100%; max-width: 440px; overflow: visible; }
.numberline-wrap svg { width: 100%; height: auto; overflow: visible; }

/* === Equation Display === */
.equation-display {
  font-family: 'Fredoka One', cursive; font-size: 2.4rem;
  color: var(--dark); text-align: center; padding: 12px 24px;
  background: #fff; border-radius: 12px; border: 3px solid #dde3ff;
}
.equation-display .blank {
  display: inline-block; min-width: 44px; border-bottom: 4px solid var(--orange);
  color: var(--orange); text-align: center;
}

/* === Base-10 Blocks === */
.base10-wrap { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; justify-content: center; }
.b10-rod {
  display: flex; flex-direction: column; gap: 1px;
  border: 2px solid #2980b9;
}
.b10-rod-cell { width: 22px; height: 22px; background: #3498db; border: 1px solid #2471a3; }
.b10-unit { width: 22px; height: 22px; background: #e74c3c; border: 2px solid #c0392b; border-radius: 3px; }
.b10-hundred {
  display: grid; grid-template-columns: repeat(10,1fr); gap: 1px;
  border: 2px solid #27ae60; padding: 2px;
}
.b10-hundred-cell { width: 10px; height: 10px; background: #2ecc71; }

/* === Answer Buttons (Touch-Optimized) === */
.answers-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; }
.answer-btn {
  padding: 16px 14px; border-radius: 16px; border: 3px solid #dde3ff;
  background: #fff; font-family: 'Fredoka One', cursive; font-size: 1.35rem;
  cursor: pointer; color: var(--dark); transition: border-color 0.15s, background 0.15s, transform 0.1s;
  min-height: 64px; touch-action: manipulation; user-select: none;
  -webkit-tap-highlight-color: transparent;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.ans-text { flex: 1; text-align: center; }
.ans-speak {
  flex-shrink: 0; font-size: 0.95rem; opacity: 0.35; cursor: pointer;
  padding: 4px; border-radius: 50%; transition: opacity 0.15s, background 0.15s;
  line-height: 1;
}
.answer-btn:hover .ans-speak,
.answer-btn:focus .ans-speak { opacity: 0.8; }
.ans-speak:hover { opacity: 1 !important; background: rgba(0,0,0,0.06); }
.answer-btn:hover:not(:disabled) { border-color: var(--orange); background: #fff8f5; }
.answer-btn:active:not(:disabled) { transform: scale(0.96); background: #ffe8e0; }
.answer-btn.correct { background: #d4edda; border-color: #28a745; color: #155724; }
.answer-btn.wrong   { background: #f8d7da; border-color: #dc3545; color: #721c24; }
.answer-btn:disabled { cursor: default; }

/* Wide answers (for longer text like equations) */
.answers-grid.wide { grid-template-columns: 1fr; }
.answers-grid.wide .answer-btn { font-size: 1.2rem; }

/* === Feedback Overlay === */
.feedback-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: none; align-items: flex-end; justify-content: center; z-index: 200; padding: 0 16px 40px; }
.feedback-overlay.show { display: flex; }
.feedback-card { background: #fff; border-radius: 28px; padding: 40px 40px 36px; text-align: center; max-width: 420px; width: 100%; animation: slideUp 0.35s cubic-bezier(0.175,0.885,0.32,1.275); }
@keyframes slideUp { from{transform:translateY(100px);opacity:0} to{transform:translateY(0);opacity:1} }
.feedback-emoji { font-size: 4.5rem; margin-bottom: 12px; }
.feedback-msg   { font-family: 'Fredoka One', cursive; font-size: 1.5rem; margin-bottom: 24px; color: var(--dark); line-height: 1.3; }
.btn-next { background: var(--orange); color: #fff; font-size: 1.05rem; padding: 16px 36px; width: 100%; min-height: 56px; border-radius: 14px; }
.btn-next:hover, .btn-next:active { background: var(--orange-dk); }

/* === End Screen === */
.end-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; z-index: 300; padding: 24px; }
.end-card { background: #fff; border-radius: 28px; padding: 56px 48px; text-align: center; max-width: 440px; width: 100%; animation: popIn 0.4s cubic-bezier(0.175,0.885,0.32,1.275); }
@keyframes popIn { from{transform:scale(0.6);opacity:0} to{transform:scale(1);opacity:1} }
.end-stars { font-size: 2.8rem; letter-spacing: 10px; margin-bottom: 16px; }
.end-title { font-family: 'Fredoka One', cursive; font-size: 2rem; margin-bottom: 8px; }
.end-score { color: var(--gray); font-weight: 700; margin-bottom: 32px; }
.end-btns  { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn-retry  { background: var(--teal); color: #fff; }
.btn-retry:hover, .btn-retry:active  { background: var(--teal-dk); transform: translateY(-2px); }
.btn-topics { background: var(--orange); color: #fff; }
.btn-topics:hover, .btn-topics:active { background: var(--orange-dk); transform: translateY(-2px); }

/* ============================================ RESPONSIVE */
@media (max-width: 900px) {
  .footer-top { grid-template-columns: 1fr 1fr; }
  .steps-grid  { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto; }
}
@media (max-width: 768px) {
  .hero { padding: 56px 24px; gap: 40px; min-height: unset; }
  .hero-title { font-size: 2.3rem; }
  .hero-bubble { display: none; }
  .main-nav { display: none; }
  .hamburger { display: block; }
  .topics-grid { grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 14px; }
  .grade-tab { padding: 14px 20px; min-width: 120px; }
  .grade-tab-label { font-size: 0.95rem; }
  .question-card { padding: 24px 18px; }
  .answer-btn { font-size: 1.2rem; padding: 18px 10px; }
  .question-text { font-size: 1.3rem; }
  .footer-top { grid-template-columns: 1fr; gap: 24px; }
  .tf-cell { width: 36px; height: 36px; }
}
/* ============================================
   INTERACTIVE ACTIVITIES
   ============================================ */

/* Shared container */
.activity-container {
  display: flex; flex-direction: column; align-items: center;
  gap: 20px; width: 100%;
}

/* ── Cross-Off Subtraction ── */
.co-grid {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center; padding: 8px;
}
.co-item {
  font-size: 3rem; line-height: 1; width: 68px; height: 68px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px; background: var(--bg); cursor: pointer;
  position: relative; user-select: none; touch-action: manipulation;
  transition: opacity 0.25s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.co-item:active { transform: scale(0.92); }
.co-item.crossed { opacity: 0.35; cursor: default; }
.co-item.crossed::after {
  content: "✕"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; font-weight: 900; color: #e74c3c;
  pointer-events: none;
}
.co-progress {
  font-family: 'Fredoka One', cursive; font-size: 1.25rem;
  text-align: center; background: var(--bg); padding: 12px 28px;
  border-radius: 16px; line-height: 1.6;
}
.co-count { color: var(--orange); font-size: 1.5rem; }
.co-result {
  font-family: 'Fredoka One', cursive; font-size: 1.5rem;
  color: var(--teal-dk); animation: popIn 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
}

/* ── Tap-to-Add ── */
.tap-add-wrap { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.tap-group {
  background: var(--bg); border-radius: 18px; padding: 16px 20px;
  border: 2px solid #e0e8ff;
}
.tap-group.group-a { border-color: var(--teal); }
.tap-group.group-b { border-color: var(--orange); cursor: pointer; }
.tap-group-label {
  font-weight: 800; font-size: 0.82rem; color: var(--gray);
  margin-bottom: 10px; text-align: center; letter-spacing: 0.5px; text-transform: uppercase;
}
.tap-group-items {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; min-height: 56px;
}
.tap-item { font-size: 2.4rem; line-height: 1; display: inline-block; }
.tap-item.moveable {
  cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  animation: pulseGlow 1.8s ease-in-out infinite;
  border-radius: 8px; padding: 2px;
}
.tap-item.moveable:active { transform: scale(0.85); }
.tap-item.moved { opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.tap-item.bounce-in { animation: bounceIn 0.35s cubic-bezier(0.175,0.885,0.32,1.275); }
.tap-hint {
  text-align: center; font-family: 'Fredoka One', cursive;
  font-size: 1rem; color: var(--orange); letter-spacing: 0.5px;
}
.tap-total {
  font-family: 'Fredoka One', cursive; font-size: 2rem;
  color: var(--teal-dk); text-align: center; margin-top: 8px;
}
.tap-total .t-num { display: inline-block; }
.tap-total .t-num.bounce { animation: quickBounce 0.3s ease; }

/* ── Pattern Completion ── */
.pattern-display {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; justify-content: center;
  background: var(--bg); padding: 20px 24px; border-radius: 18px; width: 100%;
}
.pattern-item { font-size: 2.6rem; line-height: 1; }
.pattern-blank {
  width: 60px; height: 60px; border: 3px dashed var(--orange);
  border-radius: 14px; background: #fff8f5;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; animation: blinkBorder 1.6s ease-in-out infinite;
}
.pattern-blank.filled {
  border-style: solid; border-color: var(--teal);
  background: #f0fffe; animation: none;
}
.pattern-choices {
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
}
.pattern-choice {
  width: 76px; height: 76px; border: 3px solid #dde3ff; border-radius: 18px;
  font-size: 2.4rem; cursor: pointer; background: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, transform 0.12s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.pattern-choice:hover { border-color: var(--orange); transform: scale(1.06); }
.pattern-choice:active { transform: scale(0.94); }
.pattern-choice.correct { border-color: #28a745; background: #d4edda; }
.pattern-choice.wrong   { border-color: #dc3545; background: #f8d7da; }
.pattern-choice:disabled { cursor: default; }

/* ── Cross-off Check/Reset buttons ── */
.co-btn-row {
  display: flex; gap: 10px; justify-content: center; width: 100%; margin-top: 8px;
}
.co-check-btn {
  flex: 1; padding: 13px; border-radius: 50px; border: none;
  background: var(--teal); color: #fff;
  font-family: 'Fredoka One', cursive; font-size: 1.05rem;
  cursor: pointer; transition: all 0.15s; touch-action: manipulation;
}
.co-check-btn:disabled { background: #ccd0e0; cursor: default; }
.co-check-btn:not(:disabled):hover { background: var(--teal-dk); transform: translateY(-2px); }
.co-reset-btn {
  padding: 13px 18px; border-radius: 50px;
  border: 2px solid #dde3ff; background: #f5f7ff;
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 0.9rem;
  color: var(--gray); cursor: pointer; transition: all 0.15s; touch-action: manipulation;
}
.co-reset-btn:hover { border-color: var(--orange); color: var(--orange); }

/* ── Tap-to-Count ── */
.count-hint-text {
  text-align: center; font-family: 'Fredoka One', cursive; font-size: 1rem;
  color: var(--gray); margin-bottom: 10px;
}
.count-grid {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  padding: 8px;
}
.count-item {
  width: 74px; height: 74px; border-radius: 18px;
  background: var(--bg); border: 3px solid #dde3ff;
  font-size: 2.4rem; cursor: pointer; position: relative;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, transform 0.12s;
  touch-action: manipulation; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.count-item:active { transform: scale(0.9); }
.count-item.tapped {
  border-color: var(--teal); background: #e8fffe;
  animation: countPop 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
}
.count-badge {
  position: absolute; top: -10px; right: -10px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--orange); color: #fff;
  font-family: 'Fredoka One', cursive; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  animation: bounceIn 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
}
.count-display {
  text-align: center; margin-top: 8px;
}
.count-display #countNum {
  font-family: 'Fredoka One', cursive; font-size: 3.5rem;
  color: var(--teal-dk); display: inline-block;
  transition: transform 0.15s;
}
.count-display #countNum.pop { animation: quickBounce 0.3s ease; }
@keyframes countPop {
  0%  { transform: scale(0.8); }
  60% { transform: scale(1.12); }
  100%{ transform: scale(1); }
}

/* ── Keyframes for interactive activities ── */
@keyframes pulseGlow {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,107,53,0); transform: scale(1); }
  50%      { box-shadow: 0 0 0 8px rgba(255,107,53,0.2); transform: scale(1.08); }
}
@keyframes bounceIn {
  0%   { transform: scale(0.3); opacity: 0; }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes quickBounce {
  0%,100% { transform: scale(1); }
  40%     { transform: scale(1.35); }
}
@keyframes blinkBorder {
  0%,100% { border-color: var(--orange); }
  50%     { border-color: rgba(255,107,53,0.3); }
}

@media (max-width: 480px) {
  .hero-stats { flex-direction: column; gap: 12px; }
  .stat-divider { width: 60px; height: 1px; }
  .end-card { padding: 36px 24px; }
  .feedback-card { padding: 32px 20px; }
  .answers-grid { gap: 10px; }
  .tf-cell { width: 32px; height: 32px; }
  .equation-display { font-size: 1.8rem; }
  .co-item { width: 58px; height: 58px; font-size: 2.5rem; }
  .pattern-choice { width: 64px; height: 64px; font-size: 2rem; }
  .pattern-item { font-size: 2.2rem; }
  .tap-item { font-size: 2rem; }
}

/* ============================================
   MATH TOOLS PANEL
   ============================================ */

/* Floating trigger button */
.tools-fab {
  position: fixed; bottom: 24px; right: 20px; z-index: 900;
  display: flex; align-items: center; gap: 7px;
  background: var(--teal); color: #fff;
  border: none; border-radius: 50px; padding: 13px 20px;
  font-family: 'Fredoka One', cursive; font-size: 1.05rem;
  cursor: pointer; box-shadow: 0 6px 20px rgba(78,205,196,0.45);
  transition: transform 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
}
.tools-fab:hover  { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(78,205,196,0.5); }
.tools-fab:active { transform: scale(0.95); }

/* Backdrop */
.tools-backdrop {
  position: fixed; inset: 0; z-index: 910;
  background: rgba(10,10,30,0.45);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.tools-backdrop.show { opacity: 1; pointer-events: all; }

/* Panel – bottom sheet */
.tools-panel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 920;
  background: #fff; border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.18);
  max-height: 80vh; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  overflow: hidden;
}
.tools-panel.open { transform: translateY(0); }

/* Panel header */
.tools-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 10px; border-bottom: 1px solid #eef0ff;
  flex-shrink: 0;
}
.tools-panel-title {
  font-family: 'Fredoka One', cursive; font-size: 1.2rem; color: var(--dark);
}
.tools-close {
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: #f0f2ff; font-size: 1rem; cursor: pointer; color: var(--gray);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s; touch-action: manipulation;
}
.tools-close:hover { background: #e0e4ff; }

/* Tab strip – scrollable */
.tools-tabs {
  display: flex; gap: 4px; padding: 10px 16px 10px;
  overflow-x: auto; flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tools-tabs::-webkit-scrollbar { display: none; }

.tool-tab-btn {
  flex: 0 0 auto; min-width: 62px; padding: 7px 10px;
  border: 2px solid #e8eaff; border-radius: 14px; background: #f5f7ff;
  font-family: 'Nunito', sans-serif; font-size: 0.75rem; font-weight: 700;
  color: var(--gray); cursor: pointer; text-align: center; line-height: 1.3;
  transition: all 0.15s; touch-action: manipulation;
}
.tool-tab-btn small { font-size: 0.65rem; display: block; }
.tool-tab-btn.active {
  background: var(--teal); border-color: var(--teal); color: #fff;
  box-shadow: 0 3px 10px rgba(78,205,196,0.35);
}
.tool-tab-btn:not(.active):hover { border-color: var(--teal); color: var(--teal-dk); }

/* Scrollable content area */
.tools-body {
  flex: 1; overflow-y: auto; padding: 16px 18px 24px;
  -webkit-overflow-scrolling: touch;
}
.tool-pane { display: none; }
.tool-pane.active { display: block; }

/* ── Shared tool primitives ── */
.tool-hint {
  text-align: center; font-size: 0.82rem; color: var(--gray);
  margin-bottom: 10px;
}
.tool-hint-empty {
  color: #b0b8d0; font-size: 0.82rem; font-style: italic;
}
.tool-clear-btn {
  margin-top: 12px; width: 100%; padding: 10px;
  border: 2px solid #e8eaff; border-radius: 50px; background: #f5f7ff;
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 0.85rem;
  color: var(--gray); cursor: pointer; transition: all 0.15s;
  touch-action: manipulation;
}
.tool-clear-btn:hover { border-color: #dc3545; color: #dc3545; background: #fff0f0; }

/* Shared stepper (+/-) */
.stp {
  width: 34px; height: 34px; border-radius: 50%; border: none;
  font-size: 1.2rem; font-weight: 800; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.1s; touch-action: manipulation;
  font-family: 'Fredoka One', cursive;
}
.stp.plus  { background: var(--teal);   color: #fff; }
.stp.minus { background: #f0f2ff;       color: var(--gray); }
.stp:active { transform: scale(0.88); }
.stp-val {
  font-family: 'Fredoka One', cursive; font-size: 1.25rem;
  min-width: 32px; text-align: center; color: var(--dark);
}

/* ── BASE 10 BLOCKS ── */
.b10-workspace {
  min-height: 64px; background: #f5f7ff; border-radius: 14px;
  padding: 10px 12px; display: flex; flex-wrap: wrap;
  align-items: flex-end; gap: 6px; margin-bottom: 10px;
}
/* Visual: hundreds flat */
.b10v-flat { display: flex; flex-direction: column; gap: 1px; }
.b10v-row  { display: flex; gap: 1px; }
.b10v-cell { width: 5px; height: 5px; background: #4A90E2; border-radius: 1px; }
/* Visual: tens rod */
.b10v-rod  { display: flex; flex-direction: column; gap: 1px; }
.b10v-rod-cell { width: 7px; height: 7px; background: #2ecc71; border-radius: 1px; }
/* Visual: ones unit */
.b10v-unit { width: 9px; height: 9px; background: #e67e22; border-radius: 2px; }

.b10-equation {
  text-align: center; margin: 4px 0 12px;
  font-family: 'Fredoka One', cursive; font-size: 1rem; color: var(--dark);
}
.b10eq { padding: 2px 8px; border-radius: 8px; font-size: 0.9rem; }
.b10eq.h { background: #d6e8ff; color: #2c5eaa; }
.b10eq.t { background: #d4f5e7; color: #1e7a4a; }
.b10eq.o { background: #fde8d0; color: #a05010; }
.b10-total { font-size: 1.3rem; color: var(--orange); }

.b10-controls { display: flex; gap: 8px; justify-content: center; }
.b10-col { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; }
.b10-swatch {
  width: 44px; height: 44px; border-radius: 10px;
}
.b10c-h { background: #4A90E2; }
.b10c-t {
  background: #2ecc71; width: 16px; height: 44px; border-radius: 6px;
}
.b10c-o { background: #e67e22; width: 14px; height: 14px; border-radius: 3px; }
.b10-col-label { font-size: 0.72rem; font-weight: 800; color: var(--gray); text-align: center; }
.b10-stepper { display: flex; align-items: center; gap: 5px; }

/* ── TEN FRAME ── */
.tf-double-toggle { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }
.tf-range-btn {
  padding: 6px 14px; border-radius: 50px; border: 2px solid #dde3ff;
  background: #f5f7ff; font-weight: 700; font-size: 0.8rem; cursor: pointer;
  transition: all 0.15s; touch-action: manipulation;
}
.tf-range-btn.active { background: var(--orange); border-color: var(--orange); color: #fff; }

.tf-tool-frame {
  display: flex; flex-direction: column; gap: 4px;
  align-items: center; margin-bottom: 12px;
}
.tf-tool-row { display: flex; gap: 4px; }
.tf-tool-cell {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid #d0d8ff; background: #f0f2ff;
  cursor: pointer; transition: all 0.15s;
  touch-action: manipulation;
}
.tf-tool-cell.filled { background: #e74c3c; border-color: #c0392b; }
.tf-tool-cell:hover:not(.filled) { border-color: var(--orange); background: #ffe8e0; }

.tf-count-row {
  text-align: center; font-family: 'Fredoka One', cursive;
  font-size: 1rem; color: var(--dark); margin-top: 4px;
}
.tf-filled { color: #e74c3c; }

/* ── NUMBER LINE ── */
.nl-range-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }
.nl-rng-btn {
  padding: 6px 14px; border-radius: 50px; border: 2px solid #dde3ff;
  background: #f5f7ff; font-weight: 700; font-size: 0.8rem; cursor: pointer;
  transition: all 0.15s; touch-action: manipulation;
}
.nl-rng-btn.active { background: var(--teal); border-color: var(--teal); color: #fff; }

.nl-scroll-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nl-tool-svg { width: 100%; min-width: 280px; display: block; }
.nl-dot { cursor: pointer; }

.nl-marked-row {
  text-align: center; font-size: 0.85rem; color: var(--dark); margin: 8px 0 0;
  min-height: 22px;
}
.nl-marked-row strong { color: var(--orange); }

/* ── 100 CHART ── */
.chart-skip-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; flex-wrap: wrap; }
.chart-skip-btn {
  padding: 6px 14px; border-radius: 50px; border: 2px solid #dde3ff;
  background: #f5f7ff; font-weight: 700; font-size: 0.78rem; cursor: pointer;
  transition: all 0.15s; touch-action: manipulation;
}
.chart-skip-btn:hover { background: var(--teal); border-color: var(--teal); color: #fff; }

.chart-grid {
  display: grid; grid-template-columns: repeat(10, 1fr);
  gap: 2px; margin-bottom: 4px;
}
.chart-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 0.7rem;
  border-radius: 6px; background: #f0f2ff; border: none; cursor: pointer;
  transition: background 0.12s, color 0.12s; touch-action: manipulation;
  color: var(--dark);
}
.chart-cell.hl { background: var(--orange); color: #fff; }
.chart-cell:hover:not(.hl) { background: #dde3ff; }

/* ── COUNTERS ── */
.ctr-color-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }
.ctr-color-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent;
  cursor: pointer; transition: transform 0.12s, border-color 0.12s;
  touch-action: manipulation;
}
.ctr-color-btn.active { border-color: var(--dark); transform: scale(1.15); }
.ctr-add-btn {
  display: block; width: 100%; padding: 11px;
  border-radius: 50px; border: 2px dashed var(--teal);
  background: #f0fffe; color: var(--teal-dk); font-weight: 800; font-size: 0.95rem;
  cursor: pointer; margin-bottom: 12px; transition: all 0.15s;
  font-family: 'Fredoka One', cursive; touch-action: manipulation;
}
.ctr-add-btn:hover { background: var(--teal); color: #fff; border-style: solid; }

.ctr-workspace {
  min-height: 72px; background: #f5f7ff; border-radius: 14px;
  padding: 10px; display: flex; flex-wrap: wrap; gap: 8px;
  align-items: center; justify-content: flex-start; margin-bottom: 6px;
}
.ctr-dot {
  width: 38px; height: 38px; border-radius: 50%;
  cursor: pointer; transition: transform 0.12s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  touch-action: manipulation;
}
.ctr-dot:hover { transform: scale(1.15); }
.ctr-dot:active { transform: scale(0.88); }
.ctr-total { text-align: center; font-family: 'Fredoka One', cursive; font-size: 1rem; color: var(--dark); }

/* ── NUMBER BONDS ── */
.bonds-diagram {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  margin: 8px 0;
}
.bonds-whole { display: flex; flex-direction: column; align-items: center; }
.bonds-circle {
  width: 78px; height: 78px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; border: 3px solid #b0b8d0; background: #f5f7ff;
}
.whole-circle { border-color: var(--orange); background: #fff5f0; }
.part-circle  { border-color: var(--teal);   background: #f0fffe; }
.bonds-num    { font-family: 'Fredoka One', cursive; font-size: 1.5rem; line-height: 1; }
.bonds-step   {
  width: 22px; height: 22px; border-radius: 50%; border: none;
  font-size: 0.9rem; font-weight: 800; cursor: pointer;
  background: #eef0ff; color: var(--gray); touch-action: manipulation;
  line-height: 1;
}
.bonds-step:active { transform: scale(0.85); }
.bonds-label  {
  font-size: 0.72rem; font-weight: 800; color: var(--gray);
  text-align: center; margin-top: 4px;
}

/* SVG-drawn lines between circles */
.bonds-lines  {
  display: flex; justify-content: center; position: relative;
  width: 200px; height: 40px;
}
.bonds-line {
  position: absolute; top: 0; width: 2px; background: #b0b8d0;
  height: 100%; transform-origin: top center;
}
.left-line  { left: 50%; transform: rotate(-30deg); }
.right-line { left: 50%; transform: rotate(30deg); }

.bonds-parts { display: flex; gap: 40px; }
.bonds-part  { display: flex; flex-direction: column; align-items: center; }

.bonds-parts-row {
  display: flex; gap: 32px; justify-content: center;
}
.bonds-part-wrap { display: flex; flex-direction: column; align-items: center; }
.bonds-check {
  margin-top: 10px; font-weight: 700; font-size: 0.85rem;
  padding: 6px 14px; border-radius: 10px; min-height: 24px;
  text-align: center;
}
.bonds-check.correct   { color: #1a7a3a; background: #d4f5e4; }
.bonds-check.incorrect { color: #7a1a1a; background: #f5d4d4; }

/* ── PLAY MONEY ── */
.money-total-display {
  text-align: center; font-family: 'Fredoka One', cursive; font-size: 1.5rem;
  color: var(--orange); background: #fff8f0; border-radius: 14px;
  padding: 10px; margin-bottom: 12px;
}
.money-rows { display: flex; flex-direction: column; gap: 10px; }
.money-row  {
  display: flex; align-items: center; gap: 12px;
  background: #f5f7ff; border-radius: 14px; padding: 8px 12px;
}
.money-coin-preview {
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 0.75rem; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.money-coin-info { flex: 1; }
.money-coin-name { font-weight: 800; font-size: 0.85rem; color: var(--dark); }
.money-coin-val  { font-size: 0.75rem; color: var(--gray); }
.money-stepper   { display: flex; align-items: center; gap: 6px; }

/* ── ANALOG CLOCK ── */
.clock-wrap { display: flex; justify-content: center; margin-bottom: 8px; }
.clock-svg  { width: 180px; height: 180px; }
.clock-time-display {
  text-align: center; font-family: 'Fredoka One', cursive; font-size: 2rem;
  color: var(--dark); margin-bottom: 10px;
  background: #f5f7ff; border-radius: 14px; padding: 6px;
}
.clock-controls { display: flex; gap: 20px; justify-content: center; margin-bottom: 10px; }
.clock-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.clock-col-label { font-size: 0.75rem; font-weight: 800; color: var(--gray); }
.clock-stepper { display: flex; align-items: center; gap: 6px; }
.clock-presets { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.clock-preset-btn {
  padding: 6px 12px; border-radius: 50px; border: 2px solid #dde3ff;
  background: #f5f7ff; font-weight: 700; font-size: 0.8rem; cursor: pointer;
  transition: all 0.15s; touch-action: manipulation;
}
.clock-preset-btn:hover { background: var(--teal); border-color: var(--teal); color: #fff; }

/* Tools tab scroll arrow */
.tools-tabs-wrap {
  position: relative; flex-shrink: 0;
  border-bottom: 1px solid #eef0ff;
}
.tools-scroll-arrow {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 36px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(to right, transparent, #fff 60%);
  border: none; font-size: 1.1rem; color: var(--gray); cursor: pointer;
  pointer-events: all; transition: color 0.15s; z-index: 2;
  touch-action: manipulation;
}
.tools-scroll-arrow:hover { color: var(--teal-dk); }
.tools-scroll-arrow.hidden { display: none; }

/* Desktop: wider panel */
@media (min-width: 600px) {
  .tools-panel {
    left: auto; right: 0; bottom: 0; top: 0;
    width: 400px; border-radius: 24px 0 0 24px;
    max-height: 100vh;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.34,1.2,0.64,1);
  }
  .tools-panel.open { transform: translateX(0); }
  .tf-tool-cell { width: 48px; height: 48px; }
}

/* ============================================
   TAP-ADD EQUATION DISPLAY
   ============================================ */
.tap-equation {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: 'Fredoka One', cursive; font-size: 2.2rem;
  background: #f0f2ff; border-radius: 16px; padding: 12px 20px;
  margin-bottom: 14px; border: 2px solid #dde3ff;
}
.tap-eq-a    { color: var(--teal); }
.tap-eq-plus { color: var(--dark); }
.tap-eq-b    { color: var(--orange); min-width: 36px; text-align: center; }
.tap-eq-eq   { color: var(--dark); }
.tap-eq-ans  { color: var(--purple); min-width: 36px; text-align: center; }
@keyframes eqPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}
.eq-pop { animation: eqPop 0.3s ease; }

/* ============================================
   LOGIN GATE (30-question modal)
   ============================================ */
.login-gate {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(10,10,40,0.75); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-gate-card {
  background: #fff; border-radius: 28px; padding: 44px 36px;
  text-align: center; max-width: 420px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: slideUp 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
}
.gate-emoji { font-size: 3.5rem; margin-bottom: 12px; }
.gate-title { font-family: 'Fredoka One', cursive; font-size: 2rem; color: var(--dark); margin-bottom: 10px; }
.gate-sub   { font-size: 1rem; color: #555; line-height: 1.6; margin-bottom: 28px; }
.gate-btn   { width: 100%; padding: 16px; font-size: 1.2rem; border-radius: 14px; text-decoration: none; display: block; }
.gate-note  { font-size: 0.8rem; color: #aaa; margin-top: 14px; }
