/* =============================================================================
   ILS Carry Animation CSS — Shared styles for +1 barrier-breaking animations
   Used by activities: 1a2_3 (Introducing 10,000), 1a2_5 (Introducing 1,00,000)
   All classes use the shared lnp- prefix.
   ============================================================================= */

/* ===== CARRY CONTAINER ===== */
.lnp-carry-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin: 18px auto;
  max-width: 440px;
}
.lnp-carry-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  width: 100%;
  padding: 2px 0;
}

/* ===== CARRY CELLS ===== */
.lnp-carry-cell {
  width: 48px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 900;
  font-family: "Courier New", monospace;
  color: #334155;
  position: relative;
}
.lnp-carry-cell.lnp-carry-digit {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  margin: 0 2px;
}
.lnp-carry-cell.lnp-carry-symbol {
  font-size: 24px;
  color: #6366f1;
  width: 36px;
}

/* ===== CARRY LINE (horizontal rule between addend and result) ===== */
.lnp-carry-line {
  width: 100%;
  height: 3px;
  background: #334155;
  margin: 4px 0;
  border-radius: 2px;
}

/* ===== RESULT CELL ===== */
.lnp-carry-cell.lnp-result-cell {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border-color: #6366f1;
  color: #4f46e5;
  animation: lnpCarryCellPop 0.4s ease;
}

/* ===== CARRY TINY (the small "1" carry indicator above digits) ===== */
.lnp-carry-cell .lnp-carry-tiny {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 700;
  color: #ef4444;
  background: #fef2f2;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #fca5a5;
  animation: lnpCarryBounce 0.5s ease;
}

/* ===== DIGIT BORN (new leading digit animation) ===== */
.lnp-digit-born {
  animation: lnpDigitBorn 0.8s ease;
}

/* ===== CARRY EXPLAIN BOX ===== */
.lnp-carry-explain {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: #475569;
  margin-top: 12px;
  padding: 12px 18px;
  background: #fffbeb;
  border: 2px solid #fcd34d;
  border-radius: 12px;
  max-width: 460px;
  line-height: 1.5;
}
.lnp-carry-explain strong {
  color: #b45309;
}

/* ===== NEW DIGIT BADGE ===== */
.lnp-new-digit-badge {
  display: inline-block;
  padding: 4px 14px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-weight: 800;
  font-size: 13px;
  border-radius: 20px;
  margin-top: 8px;
  animation: lnpCarryCellPop 0.5s ease;
}

/* =============================================================================
   KEYFRAME ANIMATIONS
   ============================================================================= */

@keyframes lnpCarryBounce {
  0% {
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
  }
  60% {
    transform: translateX(-50%) translateY(-5px);
    opacity: 1;
  }
  100% {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

@keyframes lnpCarryCellPop {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  70% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes lnpDigitBorn {
  0% {
    transform: scale(0);
    opacity: 0;
    background: #fef3c7;
  }
  50% {
    transform: scale(1.3);
    background: #fde68a;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* =============================================================================
   DARK MODE
   ============================================================================= */
.dark .lnp-carry-cell {
  color: #e2e8f0;
}
.dark .lnp-carry-cell.lnp-carry-digit {
  background: #1e293b;
  border-color: #334155;
}
.dark .lnp-carry-cell.lnp-carry-symbol {
  color: #818cf8;
}
.dark .lnp-carry-cell.lnp-result-cell {
  background: linear-gradient(135deg, #312e81, #3730a3);
  border-color: #6366f1;
  color: #a5b4fc;
}
.dark .lnp-carry-line {
  background: #64748b;
}
.dark .lnp-carry-cell .lnp-carry-tiny {
  background: #450a0a;
  color: #fca5a5;
  border-color: #7f1d1d;
}
.dark .lnp-carry-explain {
  background: #451a03;
  border-color: #78350f;
  color: #fcd34d;
}
.dark .lnp-carry-explain strong {
  color: #fbbf24;
}

/* =============================================================================
   RESPONSIVE — 480px breakpoint
   ============================================================================= */
@media (max-width: 480px) {
  .lnp-carry-cell {
    width: 38px;
    height: 44px;
    font-size: 22px;
  }
  .lnp-carry-cell.lnp-carry-symbol {
    font-size: 18px;
    width: 28px;
  }
  .lnp-carry-cell .lnp-carry-tiny {
    font-size: 10px;
    width: 15px;
    height: 15px;
    top: -6px;
  }
  .lnp-carry-explain {
    font-size: 13px;
    padding: 10px 14px;
  }
  .lnp-new-digit-badge {
    font-size: 11px;
    padding: 3px 10px;
  }
}
