/* =================================================================
   ADVANCED MATHEMATICS — DESIGN SYSTEM & STYLES (2026)
   Aesthetic: Kid-Friendly Glassmorphism, Vibrant Gradients, Micro-animations
   ================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800;900&display=swap');

:root {
  /* Color Palette */
  --primary-indigo: #6366f1;
  --primary-indigo-dark: #4f46e5;
  --pink-accent: #ec4899;
  --green-accent: #22c55e;
  --amber-accent: #f59e0b;
  --purple-accent: #8b5cf6;
  --cyan-accent: #06b6d4;

  /* Surfaces & Ink */
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  --surface-card: rgba(255, 255, 255, 0.94);
  --surface-glass: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.6);
  --ink-dark: #0f172a;
  --ink-muted: #64748b;
  --ink-light: #f8fafc;

  /* Shadows & Radius */
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.15);
  --shadow-card: 0 12px 30px rgba(99, 102, 241, 0.12);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.4);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;

  /* Typography Fluid Scale - Mobile Managed */
  --font-h1: clamp(1.6rem, 5.2vw, 2.5rem);
  --font-h2: clamp(1.2rem, 3.8vw, 1.8rem);
  --font-h3: clamp(1.05rem, 3vw, 1.4rem);
  --font-body: clamp(0.9rem, 2vw, 1rem);
  --font-sm: clamp(0.75rem, 1.8vw, 0.88rem);

  /* Animation Timings */
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  color: var(--ink-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  font-size: var(--font-body);
  line-height: 1.5;
}

/* ==========================================
   TOP BAR & NAVIGATION
   ========================================== */
/* ==========================================
   TOP BAR & NAVIGATION — MOBILE RESPONSIVE 3D
   ========================================== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  text-decoration: none;
  font-weight: 900;
  font-size: clamp(16px, 4vw, 22px);
  transition: transform 0.2s ease;
}

.brand-btn:hover {
  transform: scale(1.04);
}

.brand-logo {
  width: clamp(34px, 8vw, 44px);
  height: clamp(34px, 8vw, 44px);
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.4);
}

.stats-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.08) 100%);
  color: white;
  padding: 6px 12px;
  border-radius: 50px;
  font-size: clamp(11px, 2.8vw, 14px);
  font-weight: 800;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 4px 10px rgba(0, 0, 0, 0.2);
}

.stat-pill span {
  font-size: 16px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.1));
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  color: white;
  font-size: 16px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

.icon-btn:active {
  transform: scale(0.92);
}

/* ==========================================
   APP SCREENS CONTAINER
   ========================================== */
.app-container {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 12px 36px;
}

.screen {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================
   SCREEN 1: HOME SCREEN (4D KIDS DESIGN)
   ========================================== */
.hero-header {
  text-align: center;
  color: white;
  margin-bottom: 24px;
}

.hero-title {
  font-size: var(--font-h1);
  font-weight: 900;
  background: linear-gradient(135deg, #a5b4fc 0%, #f472b6 50%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
  text-shadow: 0 4px 20px rgba(165, 180, 252, 0.3);
}

.hero-subtitle {
  font-size: var(--font-body);
  color: #cbd5e1;
  font-weight: 600;
}

/* 4D / 3D KIDS ARCADE TOY OPERATION CARDS */
.operations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.operation-card {
  background: var(--surface-card);
  border-radius: 28px;
  padding: 24px;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.9),
    0 14px 28px rgba(0, 0, 0, 0.22),
    0 0 0 1px var(--card-color, #6366f1);
  cursor: pointer;
  transition: all 0.22s var(--ease-bounce);
  position: relative;
  overflow: hidden;
  border-bottom: 8px solid var(--card-color, #4338ca);
  display: flex;
  flex-direction: column;
}

/* 4D Glossy Top Reflection Line */
.operation-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 45%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.05) 100%);
  border-radius: 24px 24px 100px 100px;
  pointer-events: none;
}

.operation-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.95),
    0 22px 42px rgba(0, 0, 0, 0.35),
    0 0 20px var(--card-color-light, rgba(99, 102, 241, 0.4));
}

.operation-card:active {
  transform: translateY(2px) scale(0.98);
  border-bottom-width: 4px;
}

.card-header-icon {
  width: 68px;
  height: 68px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--card-color, #6366f1), var(--card-color-light, #818cf8));
  color: #ffffff;
  font-size: 34px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.8),
    0 8px 18px rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.4);
}

.card-title {
  font-size: var(--font-h2);
  font-weight: 900;
  color: var(--ink-dark);
  margin-bottom: 4px;
}

.card-stats {
  font-size: var(--font-sm);
  color: var(--ink-muted);
  font-weight: 700;
  margin-bottom: 16px;
}

.progress-track {
  height: 14px;
  background: #e2e8f0;
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 14px;
  border: 2px solid rgba(0, 0, 0, 0.08);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--card-color, #6366f1), #818cf8);
  border-radius: 20px;
  transition: width 0.4s ease;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.6);
}

transition: width 0.6s ease;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-muted);
}

/* 4D KIDS ARCADE METHOD CARDS & BUTTONS */
.method-card {
  background: var(--surface-card) !important;
  border-radius: 28px !important;
  padding: 24px !important;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.9),
    0 14px 28px rgba(0, 0, 0, 0.22) !important;
  transition: all 0.22s var(--ease-bounce) !important;
  position: relative !important;
  overflow: hidden !important;
  border-bottom: 7px solid #4f46e5 !important;
  border-top: 1.5px solid rgba(255, 255, 255, 0.8) !important;
  display: flex !important;
  flex-direction: column !important;
}

.method-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.65) 0%, rgba(255, 255, 255, 0.05) 100%);
  border-radius: 24px 24px 80px 80px;
  pointer-events: none;
}

.method-card:hover {
  transform: translateY(-6px) scale(1.02) !important;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.95),
    0 20px 38px rgba(0, 0, 0, 0.3) !important;
}

.method-card:active {
  transform: translateY(2px) scale(0.98) !important;
  border-bottom-width: 3px !important;
}

/* Math Journey Summary Box */
.journey-banner {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 28px;
  color: white;

}

.journey-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.journey-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 20px;
}

.journey-stat-card {
  background: rgba(255, 255, 255, 0.1);
  padding: 16px;
  border-radius: var(--radius-md);
  text-align: center;
}

.journey-stat-val {
  font-size: 1.8rem;
  font-weight: 900;
  color: #fbbf24;
}

.journey-stat-lbl {
  font-size: 0.85rem;
  color: #cbd5e1;
  font-weight: 600;
  margin-top: 4px;
}

/* ==========================================
   SCREEN 2: OPERATION / METHOD SELECTION
   ========================================== */
.nav-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.back-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 10px 20px;
  border-radius: 50px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateX(-4px);
}

.section-heading {
  font-size: 18px;
  font-weight: 900;
  color: white !important;
}

.methods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.method-card {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.3s var(--ease-bounce);
}

.method-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.15);
}

.method-icon-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.method-emoji {
  font-size: 32px;
  width: 52px;
  height: 52px;
  background: #f1f5f9;
  border-radius: 14px;
  display: grid;
  place-items: center;
}

.method-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink-dark);
}

.method-desc {
  font-size: 0.9rem;
  color: var(--ink-muted);
  line-height: 1.4;
  margin-bottom: 18px;
}

.btn-start {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, var(--primary-indigo), var(--primary-indigo-dark));
  color: white;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
  transition: all 0.2s ease;
}

.btn-start:hover {
  transform: scale(1.02);
  filter: brightness(1.1);
}

/* ==========================================
   SCREEN 3 & 4: LESSON & VISUALIZATION
   ========================================== */
.lesson-card-wrapper {

  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.lesson-step-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  background: #f1f5f9;
  padding: 10px 16px;
  border-radius: 50px;
}

.step-indicator {
  font-weight: 800;
  color: var(--primary-indigo);
  font-size: 0.9rem;
}

.difficulty-tag {
  background: #e0e7ff;
  color: var(--primary-indigo-dark);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.8rem;
}

/* Strategy Selector / Solve Another Way */
.alt-methods-panel {
  margin-bottom: 20px;
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  width: 100%;
  box-sizing: border-box;
}

.alt-title {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--ink-dark);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.alt-chips-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.alt-chip {
  background: white;
  border: 1px solid #cbd5e1;
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.alt-chip.active {
  background: var(--primary-indigo);
  color: white;
  border-color: var(--primary-indigo);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Question Banner */
.question-banner {
  text-align: center;
  margin-bottom: 24px;
}

.question-text {
  font-size: 2.2rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 1px;
}

/* Vertical Column Calculation Visualization */
.vertical-calc-board {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 16px 0 24px;
  font-family: 'Courier New', Courier, monospace;
  width: 100%;
  overflow-x: auto;
}

.column-table {
  border-collapse: collapse;
  font-size: 2.5rem;
  font-weight: 900;
}

.column-table td {
  padding: 4px 12px;
  text-align: center;
  position: relative;
}

.carry-row td {
  font-size: 1.3rem;
  color: #ef4444;
  height: 32px;
}

.carry-badge {
  background: #fee2e2;
  color: #dc2626;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  animation: popIn 0.3s var(--ease-bounce);
}

.active-column {
  background: #fef08a !important;
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(234, 179, 8, 0.4);
}

.calc-line {
  border-top: 4px solid var(--ink-dark);
}

/* Visual Explanation Box */
.step-explanation-box {
  background: #eff6ff;
  border-left: 6px solid var(--primary-indigo);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 16px;
  font-size: 1rem;
  font-weight: 600;
  color: #1e3a8a;
  margin-bottom: 24px;
  width: 100%;
  box-sizing: border-box;
  animation: slideInRight 0.3s ease;
}

/* Digital Notebook / School Copy View 📝 */
.notebook-paper-container {
  background: #fdfbf7;
  background-image:
    linear-gradient(90deg, transparent 44px, #ef4444 44px, #ef4444 46px, transparent 46px),
    linear-gradient(#e2e8f0 1px, transparent 1px);
  background-size: 100% 100%, 100% 32px;
  border-radius: 16px;
  border: 2px solid #cbd5e1;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 24px 20px 24px 54px;
  position: relative;
  width: 100%;
  max-width: 580px;
  margin: 16px auto;
  box-sizing: border-box;
  font-family: 'Courier New', Courier, monospace;
}

.notebook-header-tag {
  position: absolute;
  top: 8px;
  right: 16px;
  font-size: 0.8rem;
  font-weight: 800;
  color: #ef4444;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.notebook-step-line {
  line-height: 32px;
  font-size: 1.15rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.notebook-carry-badge {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fee2e2;
  color: #dc2626;
  border: 1.5px solid #ef4444;
  font-size: 0.85rem;
  font-weight: 900;
}

.notebook-final-ans {
  border-bottom: 4px double #16a34a;
  color: #15803d;
  font-weight: 900;
  padding: 2px 6px;
}

/* Interactive Canvas Scratchpad */
.scratchpad-wrapper {
  position: relative;
  width: 100%;
  margin-top: 16px;
}

.scratchpad-canvas {
  background: rgba(253, 251, 247, 0.6);
  border: 2px dashed #94a3b8;
  border-radius: 14px;
  cursor: crosshair;
  touch-action: none;
  width: 100%;
  height: 160px;
}

.scratchpad-tools {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: center;
}

.scratch-tool-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  background: white;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

/* Interactive Input Controls */
.answer-control-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.input-row {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 380px;
  box-sizing: border-box;
}

.answer-input {
  flex: 1;
  min-width: 0;
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 3px solid #cbd5e1;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.answer-input:focus {
  border-color: var(--primary-indigo);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.btn-check {
  padding: 0 20px;
  background: var(--green-accent);
  color: white;
  font-size: 1.05rem;
  font-weight: 800;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(34, 197, 94, 0.35);
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-check:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
}

.hints-btn {
  background: #fef3c7;
  color: #d97706;
  border: 2px solid #fcd34d;
  padding: 10px 24px;
  border-radius: 50px;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.hints-btn:hover {
  background: #fde68a;
}

/* Diagnostic Feedback Box */
.feedback-box {
  display: none;
  width: 100%;
  max-width: 500px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  text-align: center;
  margin-top: 12px;
}

.feedback-box.correct {
  display: block;
  background: #dcfce7;
  color: #15803d;
  border: 2px solid #86efac;
}

.feedback-box.error {
  display: block;
  background: #ffe4e6;
  color: #be123c;
  border: 2px solid #fecdd3;
}

/* ==========================================
   REWARD & CELEBRATION MODAL
   ========================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.reward-modal-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
  transform: scale(0.8);
  transition: transform 0.4s var(--ease-bounce);
}

.modal-overlay.active .reward-modal-card {
  transform: scale(1);
}

.trophy-emoji {
  font-size: 80px;
  animation: popIn 0.6s var(--ease-bounce);
}

.reward-title {
  font-size: 2rem;
  font-weight: 900;
  color: var(--ink-dark);
  margin: 12px 0 6px;
}

.reward-sub {
  font-size: 1rem;
  color: var(--ink-muted);
  margin-bottom: 24px;
}

.stars-earned-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 40px;
  margin-bottom: 24px;
}

.badge-unlocked-banner {
  background: #fef3c7;
  border: 2px dashed #f59e0b;
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 24px;
  font-weight: 800;
  color: #92400e;
}

.btn-next-lesson {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--green-accent), #16a34a);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.15rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(34, 197, 94, 0.4);
}

/* Animations */
@keyframes popIn {
  0% {
    transform: scale(0);
  }

  80% {
    transform: scale(1.2);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* On-Screen Kid-Friendly Mobile Keypad */
.mobile-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 380px;
  margin: 16px 0;
  padding: 12px;
  background: #f1f5f9;
  border-radius: var(--radius-md);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.05);
}

.keypad-btn {
  height: 52px;
  background: white;
  border: 2px solid #cbd5e1;
  border-radius: 14px;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink-dark);
  cursor: pointer;
  box-shadow: 0 4px 0 #94a3b8;
  transition: all 0.1s ease;
  display: grid;
  place-items: center;
  touch-action: manipulation;
}

.keypad-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #94a3b8;
  background: #e0e7ff;
}

.keypad-symbol {
  background: #e0e7ff;
  color: var(--primary-indigo-dark);
  border-color: #a5b4fc;
}

.keypad-backspace {
  grid-column: span 1;
  background: #ffe4e6;
  color: #be123c;
  border-color: #fecdd3;
  box-shadow: 0 4px 0 #fda4af;
  font-size: 0.95rem;
}

.keypad-submit {
  grid-column: span 2;
  background: var(--green-accent);
  color: white;
  border-color: #16a34a;
  box-shadow: 0 4px 0 #15803d;
  font-size: 1.1rem;
}

.keypad-submit:active {
  background: #16a34a;
}

/* Comprehensive Mobile & Responsive Rules */
@media (max-width: 640px) {
  .top-bar {
    padding: 10px 12px;
  }

  .brand-btn span {
    font-size: 16px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
  }

  .stats-bar {
    gap: 6px;
  }

  .stat-pill {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 20px;
  }

  .stat-pill span {
    font-size: 14px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .app-container {
    padding: 16px 10px 30px;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .operations-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .operation-card {
    padding: 16px 12px;
  }

  .card-header-icon {
    width: 48px;
    height: 48px;
    font-size: 24px;
    margin-bottom: 10px;
  }

  .card-title {
    font-size: 1.15rem;
  }

  .card-stats {
    font-size: 0.78rem;
  }

  .journey-banner {
    padding: 16px 12px;
  }

  .journey-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .journey-stat-val {
    font-size: 1.4rem;
  }

  .methods-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .method-card {
    padding: 16px;
  }

  /* 4-in-1 All-in-One Quad Math Sheet (जोड़, घटाना, गुणा, भाग) */
  .quad-worksheet-board {
    background: white;
    border: 4px solid #1e3a8a;
    border-radius: 16px;
    padding: 16px;
    max-width: 650px;
    margin: 0 auto 20px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.15);
  }

  .quad-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    border: 2px solid #3b82f6;
    border-radius: 8px;
    overflow: hidden;
  }

  .quad-box {
    padding: 16px 12px;
    text-align: center;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 200px;
  }

  .quad-box:nth-child(1) {
    border-right: 2px solid #3b82f6;
    border-bottom: 2px solid #3b82f6;
  }

  .quad-box:nth-child(2) {
    border-bottom: 2px solid #3b82f6;
  }

  .quad-box:nth-child(3) {
    border-right: 2px solid #3b82f6;
  }

  .quad-hindi-heading {
    font-size: 1.8rem;
    font-weight: 900;
    color: #dc2626;
    /* Red heading like in image */
    margin-bottom: 8px;
    letter-spacing: 1px;
  }

  .quad-calc-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.6rem;
    font-weight: 900;
    color: #1e3a8a;
    margin-bottom: 12px;
  }

  /* Interactive Column Math Notebook Styling ✏️ */
  /* Interactive Column Math Notebook Styling ✏️ (4D Kids Design) */
  .column-notebook-board {
    background: #ffffff;
    background-image:
      linear-gradient(90deg, transparent 28px, rgba(239, 68, 68, 0.4) 28px, rgba(239, 68, 68, 0.4) 30px, transparent 30px),
      linear-gradient(#f1f5f9 1px, transparent 1px);
    background-size: 100% 100%, 100% 32px;
    border-radius: 24px;
    border: 4px solid #334155;
    box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.9),
      0 14px 32px rgba(0, 0, 0, 0.25);
    padding: 16px 12px;
    max-width: 540px;
    width: 100%;
    margin: 0 auto 20px;
    box-sizing: border-box;
    font-family: 'Fredoka', 'Poppins', sans-serif;
    text-align: center;
  }

  .notebook-op-selector {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
  }

  .op-select-btn {
    background: linear-gradient(180deg, #ffffff 0%, #e2e8f0 100%);
    border: 2px solid #94a3b8;
    color: #0f172a;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 800;
    font-size: clamp(11px, 2.8vw, 13px);
    cursor: pointer;
    box-shadow: 0 3px 0 #94a3b8;
    transition: all 0.15s ease;
    user-select: none;
    touch-action: manipulation;
  }

  .op-select-btn.active {
    background: linear-gradient(180deg, #6366f1 0%, #4338ca 100%);
    color: white;
    border-color: #312e81;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6), 0 4px 10px rgba(67, 56, 202, 0.4);
  }

  .op-select-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #94a3b8;
  }

  .digit-select-btn {
    background: #ffffff;
    border: 2px solid #cbd5e1;
    color: #334155;
    padding: 4px 12px;
    border-radius: 16px;
    font-weight: 800;
    font-size: clamp(11px, 2.5vw, 12px);
    cursor: pointer;
    box-shadow: 0 2px 0 #cbd5e1;
    transition: all 0.15s ease;
  }

  .digit-select-btn.active {
    background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border-color: #1e40af;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6), 0 3px 8px rgba(37, 99, 235, 0.4);
  }

  .column-grid-align {
    display: inline-grid;
    gap: 4px;
    justify-items: center;
    align-items: center;
    margin: 10px auto;
  }

  .place-header-cell {
    font-size: clamp(11px, 2.8vw, 13px);
    font-weight: 900;
    color: #4338ca;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .digit-cell-static {
    width: clamp(34px, 9vw, 44px);
    height: clamp(36px, 9vw, 44px);
    height: 44px;
    display: grid;
    place-items: center;
    font-size: 1.8rem;
    font-weight: 900;
    color: #0f172a;
  }

  .digit-cell-input {
    width: 44px;
    height: 44px;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 900;
    color: #1d4ed8;
    background: #eff6ff;
    border: 2px solid #3b82f6;
    border-radius: 10px;
    outline: none;
    font-family: inherit;
  }

  .digit-cell-input:focus {
    background: #dbeafe;
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
  }

  .carry-cell-input {
    width: 34px;
    height: 34px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 900;
    color: #dc2626;
    background: #fee2e2;
    border: 2px dashed #ef4444;
    border-radius: 50%;
    outline: none;
    font-family: inherit;
  }

  .borrow-cell-input {
    width: 34px;
    height: 34px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 900;
    color: #be185d;
    background: #fce7f3;
    border: 2px dashed #ec4899;
    border-radius: 50%;
    outline: none;
    font-family: inherit;
  }

  /* Vedantu / Indian School Waterfall Long Division Board ➗ */
  .vedantu-div-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: auto;
    padding: 16px 8px;
    width: 100%;
  }

  .vedantu-div-grid {
    display: inline-grid;
    gap: 4px;
    align-items: center;
    justify-items: center;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.5rem;
    font-weight: 900;
    color: #0f172a;
  }

  .vedantu-quotient-cell {
    width: 34px;
    height: 38px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 900;
    color: #16a34a;
    /* Green quotient text matching image */
    background: #f0fdf4;
    border: 2px solid #22c55e;
    border-radius: 8px;
    outline: none;
    font-family: inherit;
  }

  .vedantu-quotient-static {
    font-size: 1.6rem;
    font-weight: 900;
    color: #16a34a;
    /* Green quotient text */
  }

  .vedantu-sub-cell {
    width: 32px;
    height: 34px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 800;
    color: #b91c1c;
    /* Dark red subtraction text */
    background: #fef2f2;
    border: 1.5px solid #f87171;
    border-radius: 6px;
    outline: none;
    font-family: inherit;
  }

  .vedantu-sub-bar {
    border-bottom: 3px solid #991b1b;
    width: 100%;
  }

  .vedantu-remainder-tag {
    color: #2563eb;
    font-size: 0.95rem;
    font-weight: 900;
    white-space: nowrap;
    margin-left: 8px;
  }

  /* Real School Long Division Board */
  .long-div-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: 'Courier New', Courier, monospace;
    margin: 16px 0;
  }

  .long-div-table {
    border-collapse: collapse;
    font-size: 1.6rem;
    font-weight: 900;
    color: #0f172a;
  }

  .long-div-table td {
    padding: 4px 8px;
    text-align: center;
  }

  .question-text {
    font-size: 1.8rem;
  }

  .column-table {
    font-size: 1.9rem;
  }

  .column-table td {
    padding: 2px 8px;
  }

  .step-explanation-box {
    padding: 14px;
    font-size: 0.95rem;
  }

  .input-row {
    flex-direction: row;
  }

  .answer-input {
    font-size: 1.4rem;
    padding: 8px 12px;
  }

  .btn-check {
    padding: 0 18px;
    font-size: 1rem;
  }

  .mobile-keypad {
    gap: 8px;
    padding: 8px;
  }

  .keypad-btn {
    height: 46px;
    font-size: 1rem;
  }

  .reward-modal-card {
    padding: 28px 18px;
  }

  .trophy-emoji {
    font-size: 60px;
  }

  .reward-title {
    font-size: 1.5rem;
  }
}

/* Math Thinking Lab Mode Selector Bar */
.lab-modes-bar {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 8px 4px 16px;
  margin-bottom: 24px;
  scrollbar-width: none;
}

.lab-modes-bar button {
  color: #fff !important;
}

.lab-modes-bar::-webkit-scrollbar {
  display: none;
}

.mode-tab-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #000;
  padding: 10px 18px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.mode-tab-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.mode-tab-btn.active {
  background: linear-gradient(135deg, var(--primary-indigo), var(--purple-accent));
  border-color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

/* ================================================================
   SCHOOL NOTEBOOK COLUMN MATH — AUTHENTIC STYLE
   ================================================================ */

.notebook-board-wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 4px 24px;
}

/* ── Operation Selector ─────────────────────────────────────────── */
.nb-op-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.nb-op-btn {
  background: linear-gradient(180deg, #ffffff 0%, #e2e8f0 100%);
  border: 2.5px solid #94a3b8;
  border-radius: 16px;
  padding: 10px 4px 8px;
  font-size: 11px;
  font-weight: 800;
  color: #1e293b;
  cursor: pointer;
  box-shadow: 0 4px 0 #94a3b8;
  transition: all 0.12s ease;
  line-height: 1.3;
  text-align: center;
  touch-action: manipulation;
  user-select: none;
}

.nb-op-btn small {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #475569;
}

.nb-op-btn.active {
  background: linear-gradient(180deg, #6366f1 0%, #4338ca 100%);
  border-color: #312e81;
  color: white;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.5), 0 4px 0 #312e81;
}

.nb-op-btn.active small {
  color: #c7d2fe;
}

.nb-op-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #94a3b8;
}

/* ── Digit Selector ─────────────────────────────────────────────── */
.nb-digit-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.nb-label {
  font-size: 12px;
  font-weight: 800;
  color: #fff;
}

#labGameTitle {
  color: #fff;
}

.nb-digit-btn {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 16px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 800;
  color: #334155;
  cursor: pointer;
  box-shadow: 0 2px 0 #cbd5e1;
  transition: all 0.12s ease;
  touch-action: manipulation;
}

.nb-digit-btn.active {
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  border-color: #1e40af;
  color: white;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.5), 0 2px 0 #1e40af;
}

/* ── Notebook Paper ─────────────────────────────────────────────── */
.notebook-paper {
  background: #fff;
  background-image:
    linear-gradient(90deg, transparent 30px, rgba(239, 68, 68, 0.35) 30px, rgb(239 68 68 / 0%) 29px, transparent 22px), linear-gradient(#e8edf5 1px, transparent 1px);
  background-size: 100% 100%, 100% 36px;
  border-radius: 16px;
  border: 3px solid #334155;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  padding: 10px;
  margin-bottom: 14px;
  font-family: 'Patrick Hand', 'Kalam', 'Comic Sans MS', cursive, sans-serif;
  overflow-x: auto;
}

/* Question Tag at top of notebook */
.nb-question-tag {
  font-size: clamp(14px, 4vw, 17px);
  font-weight: 900;
  color: #1e293b;
  margin-bottom: 14px;
  text-align: center;
  font-family: 'Fredoka', 'Poppins', sans-serif;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 10px;
  padding: 6px 12px;
  border-left: 4px solid #6366f1;
}

/* ── Problem Grid (nb-problem) ──────────────────────────────────── */
.nb-problem {
  display: grid;
  grid-template-columns: 36px repeat(calc(var(--nb-cols, 4) - 1), 1fr);
  gap: 0 4px;
  justify-items: center;
  align-items: center;
  max-width: 360px;
  margin: 0 auto;
}

/* Carry / borrow row */
.nb-row {
  display: contents;
}

.nb-row-carry .nb-carry-input,
.nb-row-borrow .nb-borrow-input {
  position: relative;
}

/* ── Cells ──────────────────────────────────────────────────────── */
.nb-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
}

.nb-num {
  font-size: clamp(22px, 6vw, 30px);
  font-weight: 900;
  color: #0f172a;
  width: 36px;
  height: 42px;
  text-align: center;
}

.nb-zero-shift {
  font-size: clamp(18px, 5vw, 24px);
  color: #94a3b8;
  width: 36px;
  height: 42px;
}

.nb-op-cell {
  width: 36px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nb-op-sym {
  font-size: 26px;
  font-weight: 900;
  color: #6366f1;
}

/* Horizontal line under addend/subtrahend */
.nb-divider {
  height: 3px;
  background: #1e293b;
  border-radius: 2px;
  margin: 4px 0;
  width: 100%;
  grid-column: 1 / -1;
}

/* ── Input styles ───────────────────────────────────────────────── */
.nb-carry-input {
  width: 22px;
  height: 22px;
  border: 2px dashed #ef4444;
  border-radius: 50%;
  background: #fff5f5;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: #ef4444;
  outline: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nb-borrow-input {
  width: 28px;
  height: 22px;
  border: 2px dashed #f59e0b;
  border-radius: 8px;
  background: #fffbeb;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  color: #b45309;
  outline: none;
  padding: 0;
}

.nb-input {
  width: 36px;
  height: 40px;
  border: 2px solid #94a3b8;
  border-bottom: 3px solid #6366f1;
  border-radius: 8px;
  background: #f0f4ff;
  text-align: center;
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 900;
  color: #1e293b;
  outline: none;
  padding: 0;
  font-family: 'Poppins', sans-serif;
  transition: border-color 0.15s, background 0.15s;
}

.nb-input:focus {
  border-color: #6366f1;
  background: #ede9fe;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.nb-final-input {
  background: #fef9c3;
  border-color: #eab308;
  border-bottom-color: #92400e;
}

.nb-partial-input {
  background: #f0fdf4;
  border-color: #86efac;
  border-bottom-color: #15803d;
}

/* Hint text */
.nb-hint {
  font-size: 11px;
  color: #64748b;
  font-style: italic;
  text-align: center;
  margin-top: 10px;
  padding: 6px;
  background: rgba(99, 102, 241, 0.06);
  border-radius: 8px;
}

/* ── Multiplication partial labels ──────────────────────────────── */
.nb-partials-block {
  max-width: 360px;
  margin: 10px auto 0;
}

.nb-partial-label {
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  padding-left: 38px;
  margin-top: 12px;
  margin-bottom: 2px;
}

.nb-row-partial {
  /* just part of the grid display, already handled */
}

/* ── Division layout ────────────────────────────────────────────── */
.nb-div-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  padding: 10px;
  background: #f8fafc;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
}

.nb-div-box {
  display: flex;
  align-items: stretch;
  font-size: 22px;
  font-weight: 900;
  color: #0f172a;
}

.nb-div-dividend {
  padding: 4px 12px 4px 8px;
  border-top: 3px solid #0f172a;
  border-right: 3px solid #0f172a;
}

.nb-div-bar {
  width: 3px;
  background: transparent;
}

.nb-div-divisor {
  padding: 4px 8px;
  font-size: 18px;
}

.nb-div-quotient-label {
  font-size: 12px;
  font-weight: 800;
  color: #475569;
}

.nb-div-final-q,
.nb-div-final-r {
  width: 54px !important;
  height: 38px !important;
  border: 2px solid #15803d;
  border-radius: 8px;
  background: #f0fdf4;
  font-size: 18px;
  font-weight: 900;
  color: #15803d;
}

.nb-div-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nb-div-step {
  background: #f8fafc;
  border-radius: 12px;
  padding: 10px 12px;
  border-left: 4px solid #6366f1;
}

.nb-div-step-label {
  font-size: 12px;
  font-weight: 800;
  color: #6366f1;
  margin-bottom: 6px;
}

.nb-div-step-work {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nb-div-work-num {
  font-size: 18px;
  font-weight: 900;
  color: #1e293b;
}

.nb-div-work-op {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
}

.nb-div-work-rem {
  font-size: 13px;
  font-weight: 700;
  color: #b45309;
}

.nb-div-q-input,
.nb-div-s-input,
.nb-div-r-input {
  width: 36px !important;
  height: 34px !important;
  border: 2px solid #94a3b8;
  border-radius: 6px;
  background: #fff;
  font-size: 15px;
  font-weight: 800;
  color: #1e293b;
  text-align: center;
}

.nb-div-q-input {
  background: #f0fdf4;
  border-color: #15803d;
  color: #15803d;
}

.nb-div-s-input {
  background: #fef3c7;
  border-color: #92400e;
}

.nb-div-r-input {
  background: #fef9c3;
  border-color: #854d0e;
}

/* ── Action Buttons ─────────────────────────────────────────────── */
.nb-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 6px;
  flex-wrap: wrap;
}

.nb-btn-check {
  background: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
  color: white;
  border: none;
  border-radius: 16px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #14532d;
  transition: all 0.12s ease;
  touch-action: manipulation;
}

.nb-btn-check:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #14532d;
}

.nb-btn-new {
  background: linear-gradient(180deg, #f59e0b 0%, #b45309 100%);
  color: white;
  border: none;
  border-radius: 16px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #78350f;
  transition: all 0.12s ease;
  touch-action: manipulation;
}

.nb-btn-new:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #78350f;
}

.nb-result {
  border-radius: 14px;
  font-weight: 800;
  text-align: center;
  margin-top: 12px;
  padding: 14px;
  font-size: 1rem;
}

.nb-carry-input.has-carry {
  background: #ef4444 !important;
  color: #ffffff !important;
  border-style: solid !important;
  font-weight: 900 !important;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nb-borrow-input.has-borrow {
  background: #f59e0b !important;
  color: #ffffff !important;
  border-style: solid !important;
  font-weight: 900 !important;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }

  80% {
    transform: scale(1.25);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ── Clean School Division Styles ──────────────────────────────── */
.nb-div-header {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 14px;
  border: 2.5px solid #cbd5e1;
}

.nb-div-box {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 24px;
  font-weight: 900;
  color: #0f172a;
  padding: 6px 14px;
  background: #ffffff;
  border-radius: 10px;
  border: 2px solid #94a3b8;
}

.nb-div-divisor {
  color: #4338ca;
  font-weight: 900;
  padding-right: 2px;
}

.nb-div-bracket {
  color: #1e293b;
  font-weight: 900;
  font-size: 26px;
  line-height: 1;
}

.nb-div-dividend {
  border-top: 3px solid #1e293b;
  padding: 2px 6px 0 4px;
  letter-spacing: 2px;
  color: #0f172a;
  font-weight: 900;
}

.nb-div-quotient-label {
  font-size: 13px;
  font-weight: 800;
  color: #334155;
}

.nb-div-final-q {
  width: 64px !important;
  height: 42px !important;
  border: 2.5px solid #16a34a !important;
  border-radius: 10px !important;
  background: #f0fdf4 !important;
  font-size: 22px !important;
  font-weight: 900 !important;
  color: #15803d !important;
  text-align: center !important;
}

.nb-div-final-r {
  width: 54px !important;
  height: 42px !important;
  border: 2.5px solid #2563eb !important;
  border-radius: 10px !important;
  background: #eff6ff !important;
  font-size: 22px !important;
  font-weight: 900 !important;
  color: #1d4ed8 !important;
  text-align: center !important;
}

/* ── Interactive School Division (Matching Reference Diagram) ────── */
.div-stage-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
  background: #fdfbf7;
  border-radius: 16px;
  border: 3px solid #e2e8f0;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.03);
  margin-bottom: 16px;
  font-family: 'Poppins', 'Inter', sans-serif;
}

.div-diagram {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  padding: 10px 20px;
}

/* Quotient Row (Yellow) */
.div-quotient-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 90px;
  margin-bottom: 6px;
}

.div-q-inputs {
  display: flex;
  gap: 6px;
}

.div-q-box {
  width: 38px;
  height: 42px;
  border: 3px solid #eab308;
  border-radius: 10px;
  background: #fef9c3;
  color: #ca8a04;
  font-size: 24px;
  font-weight: 900;
  text-align: center;
  outline: none;
  transition: all 0.2s ease;
}

.div-q-box:focus {
  border-color: #ca8a04;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.5);
  transform: scale(1.05);
}

.div-q-box.correct {
  background: #ca8a04 !important;
  color: #ffffff !important;
  border-color: #a16207 !important;
}

/* Label Tags */
.div-label-tag {
  font-size: 13px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.q-tag {
  color: #ca8a04;
  background: #fef08a;
}

.d-tag {
  color: #2563eb;
  background: #dbeafe;
}

.dd-tag {
  color: #dc2626;
  background: #fee2e2;
}

.rem-tag {
  color: #16a34a;
  background: #dcfce7;
}

/* Main Bracket Row */
.div-main-bracket-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  position: relative;
}

.div-divisor-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.div-divisor-num {
  font-size: 32px;
  font-weight: 900;
  color: #2563eb;
  /* Blue */
  padding-right: 4px;
  line-height: 1;
}

/* Division Bracket Line */
.div-bracket-sym {
  font-size: 42px;
  font-weight: 900;
  color: #475569;
  line-height: 1;
  transform: scaleY(1.2) translateY(-2px);
}

.div-dividend-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
}

.div-top-bar {
  height: 4px;
  background: #475569;
  width: 100%;
  border-radius: 2px;
  margin-bottom: 2px;
}

.div-dividend-num {
  font-size: 34px;
  font-weight: 900;
  color: #dc2626;
  /* Red */
  letter-spacing: 4px;
  line-height: 1;
  padding-left: 4px;
}

/* Step Rows (Revealed Step-by-Step) */
.div-step-row {
  margin-left: 94px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 8px;
  animation: fadeInDown 0.3s ease;
}

.div-sub-line {
  font-size: 26px;
  font-weight: 900;
  color: #334155;
  letter-spacing: 3px;
}

.div-line-divider {
  width: 100%;
  height: 3px;
  background: #334155;
  margin: 4px 0;
}

.div-rem-line {
  font-size: 28px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.div-bring-down-arrow {
  color: #2563eb;
  font-weight: 900;
  animation: bounce 1s infinite;
}

/* Final Remainder Green Box */
.div-final-remainder {
  font-size: 32px;
  font-weight: 900;
  color: #16a34a;
  /* Green */
  margin-left: 94px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: popIn 0.4s ease;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── 100+ Short Practice Tab Styles (25 Categories) ─────────────── */
.qp-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 680px;
  margin: 0 auto;
}

.qp-cat-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 4px 12px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.qp-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  color: #334155;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.qp-cat-chip:hover {
  transform: translateY(-2px);
  border-color: var(--cat-color, #6366f1);
}

.qp-cat-chip.active {
  background: var(--cat-color, #6366f1);
  color: #ffffff;
  border-color: var(--cat-color, #6366f1);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.qp-card {
  background: #ffffff;
  border-radius: 20px;
  border: 3px solid #cbd5e1;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  text-align: center;
}

.qp-cat-badge {
  display: inline-block;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 12px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.qp-question-text {
  font-size: clamp(22px, 5vw, 32px);
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 20px;
  line-height: 1.3;
}

.qp-input-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
}

.qp-input {
  width: 100%;
  max-width: 280px;
  height: 52px;
  border: 3px solid #6366f1;
  border-radius: 14px;
  font-size: 24px;
  font-weight: 900;
  text-align: center;
  color: #0f172a;
  outline: none;
  background: #f8fafc;
}

.qp-input:focus {
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.qp-btn-check {
  background: linear-gradient(180deg, #16a34a 0%, #15803d 100%);
  color: #ffffff;
  border: none;
  padding: 0 24px;
  height: 52px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #14532d;
  transition: transform 0.1s ease;
}

.qp-btn-check:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #14532d;
}

.qp-actions-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.qp-btn-next {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 0 #b45309;
}

.qp-btn-hint {
  background: #f1f5f9;
  color: #475569;
  border: 2px solid #cbd5e1;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}