/* ==========================================================================
   Kids Finger Tracing ABC & 123 - Stylesheet
   Color Palette: Vibrant Magenta -> Purple -> Indigo (Image 2 Theme)
   ========================================================================== */

:root {
  --primary-pink: #ec4899;
  --primary-purple: #a855f7;
  --primary-indigo: #6366f1;
  --bg-gradient-start: #d946ef;
  --bg-gradient-mid: #9333ea;
  --bg-gradient-end: #6366f1;
}

body {
  font-family: 'Fredoka', 'Outfit', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #d946ef 0%, #c026d3 30%, #8b5cf6 70%, #6366f1 100%);
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* Background floating decorative elements */
.floating-bubble {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.15;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.1));
  animation: floatBubble 14s infinite ease-in-out;
}

@keyframes floatBubble {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-30px) rotate(180deg);
  }
}

/* Glassmorphism Card Panels */
.glass-panel {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 4px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 20px 40px -15px rgba(76, 29, 149, 0.35), 0 0 20px 0 rgba(236, 72, 153, 0.15);
}

.glass-pill {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid rgba(255, 255, 255, 0.4);
}

.glass-pill:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Main Worksheet Card (Image 1 Style) */
.worksheet-card {
  background: #ffffff;
  border: 4px solid #1e293b;
  border-radius: 28px;
  box-shadow: 0 16px 32px -8px rgba(30, 41, 59, 0.25), inset 0 0 0 4px #f1f5f9;
  position: relative;
  overflow: hidden;
}

/* Cartoon Finger Pointer */
#animated-finger {
  position: absolute;
  pointer-events: none;
  transform: translate(-18px, -18px);
  z-index: 40;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3));
}

.finger-body {
  animation: fingerWiggle 2s infinite ease-in-out;
}

@keyframes fingerWiggle {
  0%, 100% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(-4deg) scale(1.05);
  }
}

/* Touch Ripple */
.finger-ripple {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(236, 72, 153, 0.4);
  border: 2px solid #ec4899;
  top: -6px;
  left: -6px;
  opacity: 0;
  pointer-events: none;
}

.animate-ping-once {
  animation: pingRipple 0.6s cubic-bezier(0, 0, 0.2, 1) forwards;
}

@keyframes pingRipple {
  0% {
    transform: scale(0.3);
    opacity: 0.9;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* Celebration bounce for the card */
.letter-bounce-celebrate {
  animation: cardCelebration 0.9s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardCelebration {
  0%, 100% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.06) rotate(-2deg);
  }
  60% {
    transform: scale(1.04) rotate(2deg);
  }
  80% {
    transform: scale(1.02) rotate(-1deg);
  }
}

/* Custom Scrollbar for letter drawer */
.custom-scrollbar::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.45);
  border-radius: 9999px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.7);
}

/* Interactive mode pen glow */
.interactive-mode-active {
  cursor: crosshair;
}

/* Star Rating Badges */
.star-badge {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

/* ==========================================================================
   Fullscreen Drawing Stage Mode
   ========================================================================== */
#draw-stage-wrapper.fullscreen-mode,
:fullscreen #draw-stage-wrapper,
:-webkit-full-screen #draw-stage-wrapper {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
  background: linear-gradient(135deg, #c026d3 0%, #9333ea 40%, #7c3aed 70%, #4f46e5 100%) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 8px 12px 12px 12px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

#draw-stage-wrapper.fullscreen-mode #fs-top-bar,
:fullscreen #draw-stage-wrapper #fs-top-bar,
:-webkit-full-screen #draw-stage-wrapper #fs-top-bar {
  display: flex !important;
  flex-wrap: nowrap !important;
}

#draw-stage-wrapper.fullscreen-mode #fs-bottom-bar,
:fullscreen #draw-stage-wrapper #fs-bottom-bar,
:-webkit-full-screen #draw-stage-wrapper #fs-bottom-bar {
  display: flex !important;
  flex-wrap: nowrap !important;
}

@media (max-width: 480px) {
  #fs-top-bar, #fs-bottom-bar {
    padding-left: 6px !important;
    padding-right: 6px !important;
    gap: 6px !important;
  }
}

#draw-stage-wrapper.fullscreen-mode #btn-fs-prev,
#draw-stage-wrapper.fullscreen-mode #btn-fs-next,
:fullscreen #draw-stage-wrapper #btn-fs-prev,
:fullscreen #draw-stage-wrapper #btn-fs-next,
:-webkit-full-screen #draw-stage-wrapper #btn-fs-prev,
:-webkit-full-screen #draw-stage-wrapper #btn-fs-next {
  display: flex !important;
}

#draw-stage-wrapper.fullscreen-mode #stage-card,
:fullscreen #draw-stage-wrapper #stage-card,
:-webkit-full-screen #draw-stage-wrapper #stage-card {
  height: calc(100vh - 130px) !important;
  max-height: 800px !important;
  width: auto !important;
  max-width: 92vw !important;
  aspect-ratio: 3 / 3.8 !important;
  border-radius: 32px !important;
  box-shadow: 0 30px 60px -15px rgba(15, 23, 42, 0.6), inset 0 0 0 4px #f8fafc !important;
}

@media (max-height: 600px) {
  #draw-stage-wrapper.fullscreen-mode #stage-card,
  :fullscreen #draw-stage-wrapper #stage-card,
  :-webkit-full-screen #draw-stage-wrapper #stage-card {
    height: calc(100vh - 100px) !important;
    max-height: 480px !important;
  }
}

/* Character Completion Picture Overlay Animation */
.completion-pop-in {
  animation: popInBounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes popInBounce {
  0% {
    opacity: 0;
    transform: scale(0.65) translateY(24px);
  }
  70% {
    transform: scale(1.04) translateY(-4px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Fullscreen modal real photo scaling */
#draw-stage-wrapper.fullscreen-mode #comp-photo-wrapper,
:fullscreen #draw-stage-wrapper #comp-photo-wrapper,
:-webkit-full-screen #draw-stage-wrapper #comp-photo-wrapper {
  max-width: 420px !important;
  height: 240px !important;
}


