/* ==========================================================================
   Elena Minna Edu - Seguin Board & Montessori Bank UI Engine
   ========================================================================== */

/* Main Seguin Container */
.seguin-container {
  background: linear-gradient(145deg, #fbf7ee 0%, #f4ebd8 100%);
  border: 4px solid #c89b68;
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 10px 25px rgba(139, 90, 43, 0.15), inset 0 2px 6px rgba(255, 255, 255, 0.6);
  max-width: 1020px;
  margin: 0 auto 30px auto;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Mode Switch Tabs */
.seguin-modes-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 16px;
}

.seguin-mode-tab {
  background: #ffffff;
  color: #1e3a8a;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 8px 16px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.06);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.seguin-mode-tab:hover {
  border-color: #3b82f6;
  transform: translateY(-2px);
}

.seguin-mode-tab.active {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #ffffff;
  border-color: #1d4ed8;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.seguin-mode-tab.active.tab-purple {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  border-color: #6d28d9;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35);
}

.seguin-mode-tab.active.tab-gold {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #d97706;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

/* Instruction / Challenge Banner */
.seguin-instruction-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff9eb;
  border: 2px dashed #d97706;
  border-radius: 14px;
  padding: 10px 16px;
  margin-bottom: 16px;
  box-sizing: border-box;
}

.seguin-instruction-text {
  color: #854d0e;
  font-weight: 800;
  font-size: 1.05rem;
  margin: 0;
  line-height: 1.4;
  flex: 1;
}

.seguin-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.seguin-btn-action {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 6px rgba(217, 119, 6, 0.3);
  transition: transform 0.1s, filter 0.1s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.seguin-btn-action:hover {
  filter: brightness(1.08);
}

.seguin-btn-action:active {
  transform: translateY(2px);
}

.seguin-btn-purple {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  box-shadow: 0 3px 6px rgba(109, 40, 217, 0.3);
}

.seguin-btn-green {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 3px 6px rgba(16, 185, 129, 0.3);
}

/* Challenge Target Card */
.challenge-target-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border: 2px solid #818cf8;
  border-radius: 14px;
  padding: 8px 16px;
  margin-bottom: 16px;
  box-shadow: 0 3px 8px rgba(99, 102, 241, 0.15);
}

.challenge-target-label {
  font-size: 1.1rem;
  font-weight: 800;
  color: #3730a3;
}

.challenge-target-num {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  color: #1e1b4b;
  background: #ffffff;
  padding: 2px 14px;
  border-radius: 10px;
  border: 2px solid #6366f1;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
  letter-spacing: 2px;
}

/* Layout Grid / Flex for Boards */
.seguin-board-view {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
  width: 100%;
  box-sizing: border-box;
}

/* Wooden Board Frame */
.wooden-frame {
  background: linear-gradient(135deg, #f5e6ca 0%, #e8d2ab 100%);
  border: 4px solid #9c6644;
  border-radius: 16px;
  padding: 12px;
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.15), 0 6px 16px rgba(0, 0, 0, 0.08);
  flex: 1 1 480px;
  max-width: 580px;
  min-width: 0;
  box-sizing: border-box;
}

/* Individual Slot (Row) */
.seguin-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 6px 12px;
  margin-bottom: 8px;
  box-sizing: border-box;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  min-height: 48px;
  user-select: none;
}

.seguin-slot:last-child {
  margin-bottom: 0;
}

.seguin-slot:hover {
  border-color: #3b82f6;
  background: #f8fafc;
  transform: translateX(2px);
}

.seguin-slot.slot-selected {
  border-color: #f59e0b;
  background: #fffbeb;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.45);
  transform: scale(1.01);
}

.seguin-slot.slot-target-highlight {
  border-color: #10b981;
  background: #ecfdf5;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.45);
  animation: pulseGreen 1.5s infinite;
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Number Display */
.slot-number {
  font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #1e3a8a;
  min-width: 52px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.slot-number .ten-part {
  color: #1e3a8a;
}

.slot-number .unit-part {
  color: #94a3b8;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.slot-number .unit-part.placed {
  font-weight: 900;
  display: inline-block;
  animation: slotPop 0.35s ease;
}

@keyframes slotPop {
  0% { transform: scale(0.6); }
  70% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Bead Bar Container */
.bead-bar-container {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* Golden Ten Bar */
.bead-bar-golden {
  display: inline-flex;
  gap: 2px;
  background: linear-gradient(180deg, #d4a373 0%, #b08968 100%);
  padding: 3px 5px;
  border-radius: 10px;
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.4), 0 2px 4px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

/* Vertical Golden Ten Bar (Montessori columns) */
.bead-bar-vertical-golden {
  display: inline-flex;
  flex-direction: column;
  gap: 1.5px;
  background: linear-gradient(180deg, #d4a373 0%, #b08968 100%);
  padding: 3px 2px;
  border-radius: 6px;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.4), 0 2px 4px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

/* Decade Bars Group in Seguin II */
.decade-bars-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  max-width: 100%;
}

/* Individual Bead */
.bead {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: inset -1px -1px 2px rgba(0, 0, 0, 0.3), inset 1px 1px 2px rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}

.bead-vertical {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  box-shadow: inset -1px -1px 2px rgba(0, 0, 0, 0.3), inset 1px 1px 2px rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}

.bead-golden {
  background: radial-gradient(circle at 35% 35%, #fde047, #d97706);
}

/* Unit Beads Wrapper */
.unit-beads {
  display: inline-flex;
  min-width: 10px;
  flex-shrink: 0;
}

.unit-bead-pill {
  display: inline-flex;
  gap: 2px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 3px 5px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  animation: beadAppear 0.3s ease;
}

.unit-bead-pill-vertical {
  display: inline-flex;
  flex-direction: column;
  gap: 1.5px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 3px 2px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  animation: beadAppear 0.3s ease;
}

@keyframes beadAppear {
  0% { opacity: 0; transform: scale(0.7); }
  100% { opacity: 1; transform: scale(1); }
}

/* Unit Tiles Rack Container */
.unit-tiles-container {
  flex: 0 0 260px;
  max-width: 300px;
  background: #ffffff;
  border: 3px dashed #94a3b8;
  border-radius: 16px;
  padding: 16px;
  box-sizing: border-box;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.unit-tiles-title {
  font-size: 1.05rem;
  margin-top: 0;
  margin-bottom: 12px;
  color: #1e3a8a;
  font-weight: 800;
  text-align: center;
}

.unit-tiles-rack {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  justify-items: center;
}

.unit-tile {
  width: 56px;
  height: 56px;
  color: #ffffff;
  font-size: 1.6rem;
  font-weight: 900;
  font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  border-radius: 14px;
  border: 3px solid rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.15), inset 0 2px 4px rgba(255, 255, 255, 0.35);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s, opacity 0.2s;
  user-select: none;
}

.unit-tile:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.unit-tile:active {
  transform: translateY(2px) scale(0.96);
}

.unit-tile.tile-used {
  opacity: 0.45;
  filter: grayscale(30%);
  border-style: dashed;
}

/* ==========================================================================
   MONTESSORI BANK (LA BANCA MONTESSORI - SISTEMA DECIMALE)
   ========================================================================== */

.bank-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.bank-header-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid #f59e0b;
  border-radius: 16px;
  padding: 12px 18px;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.15);
  flex-wrap: wrap;
  gap: 10px;
}

.bank-target-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bank-target-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #92400e;
}

.bank-target-display {
  font-family: 'Fredoka', sans-serif;
  font-size: 2rem;
  font-weight: 900;
  color: #1e3a8a;
  background: #ffffff;
  padding: 4px 18px;
  border-radius: 12px;
  border: 3px solid #d97706;
  letter-spacing: 3px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.bank-columns-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

/* Individual Decimal Column Card */
.bank-col {
  background: #ffffff;
  border: 3px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s;
  min-height: 280px;
  box-sizing: border-box;
}

.bank-col-thousands { border-color: #10b981; background: #f0fdf4; }
.bank-col-hundreds  { border-color: #ef4444; background: #fef2f2; }
.bank-col-tens      { border-color: #3b82f6; background: #eff6ff; }
.bank-col-units     { border-color: #10b981; background: #f0fdf4; }

.bank-col-header {
  text-align: center;
  margin-bottom: 8px;
  width: 100%;
}

.bank-col-symbol {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.4rem;
  font-weight: 900;
  display: block;
}

.bank-col-thousands .bank-col-symbol { color: #047857; }
.bank-col-hundreds .bank-col-symbol  { color: #b91c1c; }
.bank-col-tens .bank-col-symbol      { color: #1d4ed8; }
.bank-col-units .bank-col-symbol     { color: #047857; }

.bank-col-name {
  font-size: 0.8rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Stepper Controls (+ / -) */
.bank-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
  width: 100%;
}

.bank-btn-step {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  font-size: 1.3rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: transform 0.1s, filter 0.1s;
  user-select: none;
}

.bank-btn-step:active {
  transform: scale(0.92);
}

.bank-btn-minus {
  background: linear-gradient(135deg, #94a3b8, #64748b);
}

.bank-btn-plus {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.bank-btn-plus.plus-green {
  background: linear-gradient(135deg, #10b981, #059669);
}

.bank-btn-plus.plus-red {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.bank-col-count {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.6rem;
  font-weight: 900;
  min-width: 28px;
  text-align: center;
  color: #1e293b;
}

/* Bank Visual Tray */
.bank-visual-tray {
  flex: 1;
  width: 100%;
  background: rgba(255, 255, 255, 0.85);
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  padding: 8px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 170px;
  max-height: 220px;
  overflow: hidden;
  box-sizing: border-box;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.03);
}

/* 3x3 Structured Grid for Cubes, Plates, and Beads */
.bank-tray-grid-3x3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  justify-items: center;
  align-items: center;
  width: 100%;
  max-width: 160px;
  margin: auto;
}

/* Structured Layout for 10-Bars */
.bank-tray-grid-bars {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 165px;
  margin: auto;
}

/* Authentic Montessori Golden Bead Pieces in Bank */
.bank-piece-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  animation: pieceDrop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: transform 0.15s ease;
  user-select: none;
  cursor: pointer;
}

.bank-piece-wrapper:hover {
  transform: scale(1.12) translateY(-2px);
}

/* 1000 Golden Cube (Isometric 3D) */
.bank-montessori-cube {
  display: block;
  width: 48px;
  height: 48px;
  max-width: 100%;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.2));
  transition: filter 0.2s;
}

.bank-piece-wrapper:hover .bank-montessori-cube {
  filter: drop-shadow(0 5px 8px rgba(217, 119, 6, 0.4));
}

/* 100 Golden Plate (10x10 Bead Square) */
.bank-montessori-square {
  display: block;
  width: 48px;
  height: 48px;
  max-width: 100%;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.18));
}

.bank-piece-wrapper:hover .bank-montessori-square {
  filter: drop-shadow(0 5px 8px rgba(217, 119, 6, 0.35));
}

/* 10 Golden Bar (10 Beads Wire) */
.bank-montessori-bar {
  display: block;
  width: 48px;
  height: 14px;
  max-width: 100%;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.15));
}

.bank-piece-wrapper:hover .bank-montessori-bar {
  filter: drop-shadow(0 4px 6px rgba(217, 119, 6, 0.35));
}

/* 1 Golden Unit Bead */
.bank-montessori-unit {
  display: block;
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

.bank-piece-wrapper:hover .bank-montessori-unit {
  filter: drop-shadow(0 3px 5px rgba(217, 119, 6, 0.45));
}

@keyframes pieceDrop {
  0% { transform: translateY(-15px) scale(0.7); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Bank Bottom Verification Bar */
.bank-verify-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 16px;
  padding: 10px 18px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  flex-wrap: wrap;
  gap: 10px;
}

.bank-current-sum {
  font-size: 1.1rem;
  font-weight: 800;
  color: #475569;
}

.bank-current-num {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.6rem;
  font-weight: 900;
  color: #1e3a8a;
  letter-spacing: 2px;
}

.bank-verify-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 10px 24px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  transition: transform 0.1s, filter 0.1s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bank-verify-btn:hover {
  filter: brightness(1.08);
}

.bank-verify-btn:active {
  transform: translateY(2px);
}

/* Responsive Breakpoints */
@media (max-width: 820px) {
  .bank-columns-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .bank-col {
    padding: 8px 4px;
    min-height: 240px;
  }

  .bank-btn-step {
    width: 30px;
    height: 30px;
    font-size: 1.1rem;
  }

  .bank-col-count {
    font-size: 1.3rem;
  }

  .bank-piece-cube {
    width: 38px;
    height: 34px;
    font-size: 0.65rem;
  }

  .bank-piece-square {
    width: 36px;
    height: 36px;
    font-size: 0.65rem;
  }

  .bank-piece-bar {
    width: 36px;
    height: 12px;
  }
}

@media (max-width: 768px) {
  .seguin-container {
    padding: 12px;
    border-width: 3px;
    border-radius: 16px;
  }
  
  .seguin-instruction-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 8px;
    padding: 8px 12px;
  }

  .seguin-banner-actions {
    justify-content: center;
  }

  .seguin-board-view {
    flex-direction: column;
    align-items: center;
    gap: 14px;
  }

  .wooden-frame {
    max-width: 100%;
    padding: 8px;
    flex: 1 1 100%;
    width: 100%;
  }

  .unit-tiles-container {
    flex: 1 1 100%;
    max-width: 100%;
    width: 100%;
    padding: 12px 8px;
  }

  .unit-tiles-rack {
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
  }

  .unit-tile {
    width: 48px;
    height: 48px;
    font-size: 1.35rem;
  }

  .slot-number {
    font-size: 1.25rem;
    min-width: 42px;
  }

  .bead {
    width: 8px;
    height: 8px;
  }

  .bead-vertical {
    width: 6px;
    height: 6px;
  }

  .bead-bar-golden {
    padding: 2px 4px;
    gap: 1.5px;
  }

  .bead-bar-vertical-golden {
    padding: 2px 1.5px;
    gap: 1px;
  }
}

@media (max-width: 520px) {
  .bank-columns-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .bank-col {
    min-height: 200px;
  }

  .bank-header-card {
    flex-direction: column;
    text-align: center;
    padding: 10px;
  }

  .bank-target-group {
    flex-direction: column;
    gap: 6px;
  }

  .bank-verify-bar {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }

  .bank-verify-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .unit-tiles-rack {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }

  .unit-tile {
    width: 40px;
    height: 40px;
    font-size: 1.15rem;
    border-radius: 10px;
  }

  .slot-number {
    font-size: 1.1rem;
    min-width: 34px;
    letter-spacing: 1px;
  }

  .bead {
    width: 7px;
    height: 7px;
  }

  .bead-vertical {
    width: 5px;
    height: 5px;
  }

  .seguin-slot {
    padding: 4px 6px;
    gap: 4px;
  }
}

/* ==========================================================================
   MONTESSORI MATHEMATICS SUITE - EXTENDED MATERIALS
   1. Multiplication Bead Board (Tavola dei Piolini 10x10)
   2. Unit Division Board (Tavola della Divisione 9x9)
   3. Grand Operations with Exchange (Grandi Addizioni e Cambi)
   4. Addition Strip Board (Tavola delle Strisce 1-18)
   ========================================================================== */

/* --- Top Navigation Tabs --- */
.montessori-tabs-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 12px 0 16px;
}

.montessori-tab-btn {
  padding: 8px 14px;
  font-size: 0.92rem;
  font-weight: 800;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

.montessori-tab-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}

.montessori-tab-btn.active {
  transform: scale(1.04);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.9), 0 8px 18px rgba(0,0,0,0.18);
}

/* ==========================================================================
   1. MULTIPLICATION BEAD BOARD (TAVOLA DEI PIOLINI 10x10)
   ========================================================================== */
.mult-board-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 840px;
  margin: 0 auto;
  width: 100%;
}

.mult-controls-card {
  background: white;
  border-radius: 20px;
  padding: 14px 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  border: 2px solid #f3e8ff;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
}

.mult-selector-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mult-selector-label {
  font-size: 1.05rem;
  font-weight: 800;
  color: #581c87;
}

.mult-tabellina-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.mult-pill-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 2px solid #e9d5ff;
  background: #faf5ff;
  color: #6b21a8;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mult-pill-btn:hover {
  background: #f3e8ff;
  transform: scale(1.08);
}

.mult-pill-btn.active {
  background: #9333ea;
  color: white;
  border-color: #7e22ce;
  box-shadow: 0 4px 10px rgba(147, 51, 234, 0.35);
}

.mult-formula-banner {
  background: linear-gradient(135deg, #fdf4ff 0%, #fae8ff 100%);
  border: 2px solid #e879f9;
  border-radius: 16px;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(232, 121, 249, 0.15);
}

.mult-formula-text {
  font-size: 1.4rem;
  font-weight: 900;
  color: #a21caf;
  letter-spacing: 1px;
}

.mult-wooden-board {
  background: linear-gradient(135deg, #edd2ac 0%, #dab584 50%, #c4965c 100%);
  border: 10px solid #8c531b;
  border-radius: 24px;
  box-shadow: inset 0 4px 12px rgba(0,0,0,0.3), 0 12px 32px rgba(0,0,0,0.22);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  user-select: none;
  max-width: 100%;
  overflow-x: auto;
  align-items: center;
}

.mult-board-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 540px;
}

.mult-card-slot {
  width: 42px;
  height: 42px;
  min-width: 42px;
  background: white;
  border: 3px solid #dc2626;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 900;
  color: #dc2626;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.mult-numbers-row {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  flex: 1;
}

.mult-col-header-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}

.mult-disc-slot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px dashed rgba(140, 83, 27, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mult-red-disc {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ef4444 0%, #b91c1c 80%, #7f1d1d 100%);
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  animation: popIn 0.25s ease;
}

.mult-col-num {
  font-size: 1.05rem;
  font-weight: 900;
  color: #4a2800;
}

.mult-board-body {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  max-width: 540px;
}

.mult-row-numbers {
  display: grid;
  grid-template-rows: repeat(10, 1fr);
  gap: 6px;
  width: 42px;
  min-width: 42px;
}

.mult-row-num {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 900;
  color: #713f12;
}

.mult-grid-10x10 {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  background: rgba(140, 83, 27, 0.15);
  padding: 10px;
  border-radius: 16px;
  border: 2px solid rgba(140, 83, 27, 0.3);
  flex: 1;
}

.mult-hole {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #713f12 0%, #9a5317 60%, #b46d29 100%);
  box-shadow: inset 0 3px 6px rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.mult-bead {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8a8a 0%, #ef4444 35%, #dc2626 70%, #991b1b 100%);
  box-shadow: 0 3px 6px rgba(0,0,0,0.35), inset 0 -2px 4px rgba(0,0,0,0.3);
  animation: beadDrop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes beadDrop {
  0% { transform: scale(0) translateY(-8px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* ==========================================================================
   2. UNIT DIVISION BOARD (TAVOLA DELLA DIVISIONE 9x9)
   ========================================================================== */
.div-board-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 840px;
  margin: 0 auto;
  width: 100%;
}

.div-controls-card {
  background: white;
  border-radius: 20px;
  padding: 14px 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  border: 2px solid #dcfce7;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
}

.div-green-board {
  background: linear-gradient(135deg, #2d6a4f 0%, #1b4332 100%);
  border: 10px solid #081c15;
  border-radius: 24px;
  box-shadow: inset 0 4px 12px rgba(0,0,0,0.4), 0 12px 32px rgba(0,0,0,0.25);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 100%;
  overflow-x: auto;
  align-items: center;
}

.div-board-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 500px;
}

.div-skittles-row {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
  background: rgba(8, 28, 21, 0.4);
  padding: 8px 10px;
  border-radius: 14px;
  flex: 1;
}

.div-skittle-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 48px;
}

.div-skittle {
  width: 24px !important;
  height: 36px !important;
  max-width: 24px;
  max-height: 36px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
  animation: popIn 0.3s ease;
}

.div-skittle-num {
  font-size: 0.95rem;
  font-weight: 900;
  color: #74c69d;
}

.div-board-body {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  max-width: 500px;
}

.div-row-numbers {
  display: grid;
  grid-template-rows: repeat(9, 1fr);
  gap: 6px;
  width: 32px;
  min-width: 32px;
}

.div-row-num {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 900;
  color: #74c69d;
}

.div-grid-9x9 {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
  background: rgba(8, 28, 21, 0.25);
  padding: 10px;
  border-radius: 16px;
  flex: 1;
}

.div-hole {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #081c15 0%, #1b4332 70%, #2d6a4f 100%);
  box-shadow: inset 0 3px 6px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.div-hole.div-hole-active {
  background: radial-gradient(circle at 50% 50%, #064e3b 0%, #059669 70%, #34d399 100%);
  box-shadow: 0 0 0 3px #10b981, inset 0 2px 4px rgba(0,0,0,0.4);
  cursor: pointer;
  animation: holePulse 1.2s infinite alternate ease-in-out;
}

@keyframes holePulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 2px #34d399; }
  100% { transform: scale(1.08); box-shadow: 0 0 0 5px #10b981, 0 0 12px rgba(16, 185, 129, 0.7); }
}

.div-skittle-slot.clickable {
  cursor: pointer;
  transition: transform 0.15s ease;
}

.div-skittle-slot.clickable:hover {
  transform: translateY(-4px);
}

.div-bead {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #a7f3d0 0%, #34d399 35%, #059669 70%, #064e3b 100%);
  box-shadow: 0 3px 6px rgba(0,0,0,0.35), inset 0 -2px 4px rgba(0,0,0,0.3);
  animation: beadDrop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.div-bowl-container {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f0fdf4;
  border-radius: 16px;
  padding: 8px 16px;
  border: 2px solid #bbf7d0;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.div-bowl-container:hover {
  transform: scale(1.03);
}

.div-bowl-icon {
  font-size: 1.8rem;
}

.div-bowl-info {
  display: flex;
  flex-direction: column;
}

.div-bowl-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #065f46;
}

.div-bowl-count {
  font-size: 1.3rem;
  font-weight: 900;
  color: #047857;
}

/* Division Interactive Quiz & Reflection Card */
.div-quiz-card {
  background: #ffffff;
  border: 3px solid #10b981;
  border-radius: 20px;
  padding: 18px 24px;
  width: 100%;
  box-shadow: 0 10px 28px rgba(16, 185, 129, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.div-quiz-prompt {
  font-size: 1.2rem;
  font-weight: 900;
  color: #065f46;
}

.div-quiz-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.div-quiz-btn {
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  color: white;
  font-size: 1.35rem;
  font-weight: 900;
  border: none;
  border-radius: 14px;
  padding: 10px 22px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(4, 120, 87, 0.35);
  transition: all 0.15s ease;
  min-width: 60px;
}

.div-quiz-btn:hover {
  transform: translateY(-3px) scale(1.08);
  box-shadow: 0 8px 18px rgba(4, 120, 87, 0.45);
}

.div-quiz-btn:active {
  transform: translateY(1px);
}

/* ==========================================================================
   3. GRAND OPERATIONS WITH EXCHANGE (GRANDI ADDIZIONI CON IL CAMBIO)
   ========================================================================== */
.bank-ops-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.bank-ops-addends-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.bank-addend-card {
  background: white;
  border-radius: 20px;
  padding: 16px;
  border: 2px solid #e0e7ff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bank-addend-title {
  font-size: 1.1rem;
  font-weight: 900;
  color: #3730a3;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bank-addend-num {
  font-size: 1.6rem;
  font-weight: 900;
  color: #4338ca;
  background: #eef2ff;
  padding: 2px 12px;
  border-radius: 10px;
}

.bank-addend-tray {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: #fafaf9;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 8px;
  min-height: 48px;
}

.bank-exchange-banner {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 2px dashed #f59e0b;
  border-radius: 18px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.bank-col.needs-exchange {
  border: 3px solid #f59e0b !important;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.45) !important;
  animation: exchangePulse 1.4s infinite alternate ease-in-out;
}

.bank-exchange-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  font-size: 1.05rem;
  font-weight: 900;
  padding: 10px 22px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bank-exchange-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 22px rgba(217, 119, 6, 0.5);
}

.bank-exchange-btn.pulse {
  animation: exchangePulse 1.2s infinite alternate ease-in-out;
}

@keyframes exchangePulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  100% { transform: scale(1.08); box-shadow: 0 0 0 12px rgba(245, 158, 11, 0); }
}

/* ==========================================================================
   4. ADDITION STRIP BOARD (TAVOLA DELLE STRISCE 1-18)
   ========================================================================== */
.strips-board-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 880px;
  margin: 0 auto;
  width: 100%;
}

.strips-wooden-board {
  background: #fdfaf4;
  border: 8px solid #a16207;
  border-radius: 20px;
  box-shadow: inset 0 3px 8px rgba(0,0,0,0.1), 0 10px 26px rgba(0,0,0,0.15);
  padding: 16px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-x: auto;
}

.strips-top-numbers {
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  border-bottom: 2px solid #ca8a04;
  padding-bottom: 6px;
}

.strips-top-num {
  font-size: 0.95rem;
  font-weight: 900;
  text-align: center;
  color: #1d4ed8;
}

.strips-top-num.num-above-10 {
  color: #dc2626;
}

.strips-top-num.num-10 {
  color: #dc2626;
  border-right: 2px solid #dc2626;
  font-weight: 900;
}

.strips-work-area {
  min-height: 140px;
  background: white;
  border: 2px dashed #ca8a04;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.strips-divider-10-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc((10 / 18) * 100%);
  width: 2px;
  background: #dc2626;
  z-index: 2;
  pointer-events: none;
}

.strips-row {
  display: flex;
  align-items: center;
  min-height: 38px;
  background: #fefce8;
  border-radius: 8px;
  border: 1px solid #fef08a;
  padding: 4px;
}

.strip-item {
  height: 34px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 900 !important;
  color: white !important;
  border-radius: 6px !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15) !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  font-size: 1rem !important;
  border: none !important;
}

.strip-blue {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
}

.strip-red {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%) !important;
}

.strips-racks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
}

.strips-rack-card {
  background: white;
  border-radius: 18px;
  padding: 14px;
  border: 2px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.strips-rack-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #334155;
  margin-bottom: 4px;
}

/* Responsiveness for Montessori Extended Materials */
@media (max-width: 768px) {
  .mult-grid-10x10, .div-grid-9x9 {
    gap: 4px;
    padding: 6px;
  }
  .mult-hole, .div-hole {
    width: 26px;
    height: 26px;
  }
  .mult-bead, .div-bead {
    width: 20px;
    height: 20px;
  }
  .bank-ops-addends-grid, .strips-racks-grid {
    grid-template-columns: 1fr;
  }
}


