/* ==========================================================================
   PINTAR MATH KIDS - DESIGN SYSTEM & MAIN STYLES (RESPONSIVE IPAD/MOBILE)
   ========================================================================== */

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

:root {
  /* Color Palette Tokens */
  --primary-teal: #2EC4B6;
  --primary-teal-dark: #1F9C92;
  --primary-teal-light: #E6FAFA;
  
  --coral-accent: #FF9F1C;
  --coral-dark: #D97E00;
  
  --sunny-yellow: #FFBF69;
  --sunny-yellow-dark: #E09B30;
  
  --soft-purple: #9D4EDD;
  --purple-light: #F3E8FF;
  
  --bg-sky: #EDF7F6;
  --bg-card: #FFFFFF;
  
  --text-main: #2B2D42;
  --text-muted: #6C757D;
  
  --success-green: #2A9D8F;
  --success-light: #E8F8F5;
  
  --alert-red: #E76F51;
  --alert-light: #FDF2F0;

  /* Fonts */
  --font-heading: 'Fredoka', 'Outfit', system-ui, -apple-system, sans-serif;
  --font-body: 'Fredoka', system-ui, -apple-system, sans-serif;

  /* Shadows */
  --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(46, 196, 182, 0.15);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.12);
  --shadow-3d-teal: 0 6px 0 var(--primary-teal-dark);
  --shadow-3d-coral: 0 6px 0 var(--coral-dark);
  --shadow-3d-yellow: 0 6px 0 var(--sunny-yellow-dark);

  /* Radius */
  --radius-sm: 16px;
  --radius-md: 24px;
  --radius-lg: 36px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* CSS Reset & Touch Optimizations */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  height: -webkit-fill-available;
  overflow: hidden;
  font-family: var(--font-body);
  background-color: var(--bg-sky);
  color: var(--text-main);
  touch-action: manipulation;
  overscroll-behavior: none;
}

/* App Container - Responsive Viewport Constraint for iPad/Tablet/Mobile */
#app-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* Dynamic Mobile Viewport Height Fix */
  max-width: 1024px; /* iPad Landscape Max Width */
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #E0F7F6 0%, #FFFFFF 100%);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.08);
}

/* Background Animated Bubbles/Clouds */
.bg-decorations {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-full);
  filter: blur(2px);
  animation: floatCloud 25s linear infinite;
}

.cloud-1 {
  width: 160px;
  height: 60px;
  top: 8%;
  left: -180px;
}

.cloud-2 {
  width: 220px;
  height: 80px;
  top: 22%;
  left: -240px;
  animation-delay: 10s;
}

.cloud-3 {
  width: 130px;
  height: 50px;
  top: 65%;
  left: -150px;
  animation-delay: 18s;
}

@keyframes floatCloud {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(100vw + 300px)); }
}

/* Screen Wrapper */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: clamp(12px, 3vw, 24px);
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* Global Animations */
@keyframes pulseGlow {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 8px rgba(255, 159, 28, 0.4)); }
  50% { transform: scale(1.04); filter: drop-shadow(0 0 16px rgba(255, 159, 28, 0.8)); }
}

@keyframes bounceSlow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes shakeWrong {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

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

.animate-pop {
  animation: popIn 0.4s var(--transition-bounce) forwards;
}

.animate-bounce {
  animation: bounceSlow 2s ease-in-out infinite;
}

.animate-shake {
  animation: shakeWrong 0.4s ease-in-out;
}
