/* ============================================
   ChoreRewards - Vibrant Premium Design System
   For kids aged 7-16 - Elegant, Fun, Engaging
   ============================================ */

/* CSS Custom Properties - Vibrant Color Palette */
:root {
  /* Primary Colors - Vibrant Purple/Pink gradient family */
  --cr-primary: #6366f1;
  --cr-primary-light: #818cf8;
  --cr-primary-dark: #4f46e5;
  --cr-secondary: #ec4899;
  --cr-secondary-light: #f472b6;
  --cr-accent: #f59e0b;
  --cr-accent-light: #fbbf24;
  
  /* Success/Warning/Error - Vibrant variants */
  --cr-success: #10b981;
  --cr-success-light: #34d399;
  --cr-warning: #f59e0b;
  --cr-danger: #ef4444;
  --cr-info: #3b82f6;
  
  /* Background Gradients */
  --cr-gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --cr-gradient-sunset: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --cr-gradient-ocean: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --cr-gradient-forest: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  --cr-gradient-gold: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  --cr-gradient-cosmic: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  
  /* Glassmorphism */
  --cr-glass-bg: rgba(255, 255, 255, 0.85);
  --cr-glass-border: rgba(255, 255, 255, 0.3);
  --cr-glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  
  /* Spacing */
  --cr-radius-sm: 0.75rem;
  --cr-radius: 1rem;
  --cr-radius-lg: 1.5rem;
  --cr-radius-xl: 2rem;
  --cr-radius-full: 9999px;
  
  /* Typography */
  --cr-font-family: ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --cr-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --cr-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  --cr-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --cr-shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.15);
  
  /* Animation Timing */
  --cr-transition-fast: 150ms ease;
  --cr-transition: 300ms ease;
  --cr-transition-slow: 500ms ease;
}

/* Base Reset & Typography */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  min-height: 100%;
}

body {
  font-family: var(--cr-font-family);
  background: var(--cr-gradient-primary);
  min-height: 100vh;
  min-height: 100dvh;
  color: #1f2937;
  line-height: 1.6;
  overflow-x: hidden;
}

.cr-desktop-shell,
.cr-mobile-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.cr-shell-main,
.cr-mobile-main {
  flex: 1 0 auto;
  width: 100%;
}

.cr-mobile-main {
  min-height: 100vh;
  min-height: 100dvh;
}

@media (max-width: 1024px) {
  html, body {
    overflow-x: clip;
  }
}

/* ============================================
   PARENT MODE - Clean, Professional
   ============================================ */

body.cr-parent {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

body.cr-parent::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 400px;
  background: var(--cr-gradient-primary);
  opacity: 0.08;
  pointer-events: none;
  z-index: -1;
}

/* ============================================
   AUTH PAGES (Login/Signup)
   ============================================ */

body.cr-auth {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
}

body.cr-auth::before {
  content: none;
}

/* Hide ALL navigation on auth pages */
body.cr-auth nav.navbar,
body.cr-auth .cr-mobile-nav-toggle,
body.cr-auth #crMobileNav,
body.cr-auth .offcanvas-backdrop,
body.cr-auth #ptrIndicator {
  display: none !important;
}

body.cr-auth .cr-auth-viewport {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  overflow-y: auto;
}

body.cr-auth .cr-auth-messages {
  width: min(100%, 480px);
}

body.cr-auth main.container {
  width: 100%;
  max-width: 480px;
  padding: 0;
  margin: 0 auto;
}

body.cr-auth .cr-auth-shell {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

body.cr-auth .cr-auth-card {
  border: none;
  border-radius: var(--cr-radius-xl);
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  background: white;
  animation: cr-fade-in-up 0.6s ease;
  width: 100%;
}

body.cr-auth .cr-card-header {
  background: var(--cr-gradient-primary);
  padding: 1.75rem 2rem;
  border: none;
}

body.cr-auth .cr-card-header h1 {
  font-weight: 800;
  font-size: 1.5rem;
  color: white;
  margin: 0;
}

body.cr-auth .cr-auth-body {
  padding: 2rem;
  background: white;
}

body.cr-auth .form-label {
  font-weight: 700;
  color: #374151;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

body.cr-auth .form-control {
  border-radius: var(--cr-radius);
  border: 2px solid #e5e7eb;
  padding: 0.875rem 1rem;
  font-weight: 600;
  font-size: 1rem;
  transition: all var(--cr-transition);
  width: 100%;
}

body.cr-auth .form-control:focus {
  border-color: var(--cr-primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

/* Google Sign-in Button */
body.cr-auth .cr-auth-google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border-radius: var(--cr-radius);
  padding: 0.875rem 1rem;
  font-weight: 700;
  color: #374151;
  background: white;
  border: 2px solid #e5e7eb;
  box-shadow: var(--cr-shadow-sm);
  text-decoration: none;
  transition: all var(--cr-transition);
  width: 100%;
}

body.cr-auth .cr-auth-google-btn:hover {
  background: #f9fafb;
  border-color: var(--cr-primary-light);
  transform: translateY(-2px);
  box-shadow: var(--cr-shadow);
}

body.cr-auth .cr-auth-google-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: white;
  border-radius: var(--cr-radius-sm);
}

/* Auth page buttons */
body.cr-auth .btn-primary {
  background: var(--cr-gradient-primary);
  border: none;
  border-radius: var(--cr-radius);
  padding: 0.875rem 1.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  transition: all var(--cr-transition);
}

body.cr-auth .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

/* ============================================
   KID MODE - Vibrant, Playful, Premium
   ============================================ */

body.cr-kid {
  background: var(--cr-gradient-cosmic);
  font-family: var(--cr-font-family);
}

body.cr-kid::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255, 215, 0, 0.1) 0%, transparent 40%);
  pointer-events: none;
  z-index: -1;
  animation: cr-float 20s ease-in-out infinite;
}

body.cr-kid main.container {
  max-width: 800px;
  padding-top: 1rem !important;
}

body.cr-kid .navbar {
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: var(--cr-shadow-sm);
}

body.cr-kid .navbar-brand,
body.cr-kid .navbar .nav-link {
  color: #4b5563 !important;
  font-weight: 700;
}

body.cr-kid .navbar .nav-link:hover {
  color: var(--cr-primary) !important;
}

/* Kid Sun Shell - The main kid interface container */
body.cr-kid.cr-kid-sun {
  --cr-sun: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --cr-sun-soft: rgba(240, 147, 251, 0.2);
  --cr-sun-ring: rgba(245, 87, 108, 0.5);
  --cr-ink: #1f2937;
  --cr-ink-soft: #6b7280;
  --cr-surface: rgba(255, 255, 255, 0.95);
  --cr-surface-2: rgba(255, 255, 255, 0.9);
}

body.cr-kid.cr-kid-sun main.container.cr-main {
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Sun Shell Container */
.cr-kid-sun-shell {
  display: grid;
  gap: 1.25rem;
  animation: cr-fade-in-up 0.5s ease;
}

/* ============================================
   TOPBAR - Premium Glassmorphism Header
   ============================================ */

body.cr-kid.cr-kid-sun .cr-kid-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--cr-glass-bg);
  backdrop-filter: blur(20px);
  border: 2px solid var(--cr-glass-border);
  border-radius: var(--cr-radius-xl);
  box-shadow: var(--cr-glass-shadow);
  animation: cr-slide-in-down 0.5s ease;
}

body.cr-kid.cr-kid-sun .cr-kid-topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

body.cr-kid.cr-kid-sun .cr-kid-name {
  font-weight: 900;
  font-size: 1.35rem;
  background: var(--cr-gradient-sunset);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

body.cr-kid.cr-kid-sun .cr-kid-sub {
  color: var(--cr-ink-soft);
  font-size: 0.95rem;
  font-weight: 600;
}

/* Avatar Circle */
body.cr-kid.cr-kid-sun .cr-kid-circle {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--cr-radius-full);
  background: var(--cr-gradient-sunset);
  border: 3px solid white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(245, 87, 108, 0.3);
  overflow: hidden;
  flex: 0 0 auto;
  transition: transform var(--cr-transition);
}

body.cr-kid.cr-kid-sun .cr-kid-circle:hover {
  transform: scale(1.05) rotate(5deg);
}

body.cr-kid.cr-kid-sun .cr-kid-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Action Circles - Floating Action Buttons */
body.cr-kid.cr-kid-sun .cr-kid-action-circle {
  width: 3rem;
  height: 3rem;
  border-radius: var(--cr-radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: var(--cr-surface-2);
  font-size: 1.25rem;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--cr-transition);
  box-shadow: var(--cr-shadow-sm);
}

body.cr-kid.cr-kid-sun .cr-kid-action-circle:hover {
  transform: translateY(-3px) scale(1.1);
  box-shadow: var(--cr-shadow-lg);
}

body.cr-kid.cr-kid-sun .cr-kid-action-circle:active {
  transform: translateY(-1px) scale(1.05);
}

body.cr-kid.cr-kid-sun .cr-kid-action-circle.primary {
  background: var(--cr-gradient-sunset);
  border-color: rgba(255, 255, 255, 0.5);
  animation: cr-pulse-glow 2s ease-in-out infinite;
}

/* Badge on action buttons */
body.cr-kid.cr-kid-sun .cr-kid-action-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.4rem;
  border-radius: var(--cr-radius-full);
  background: var(--cr-gradient-sunset);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(245, 87, 108, 0.4);
  animation: cr-bounce 2s ease infinite;
}

/* File input hidden in action circle */
body.cr-kid.cr-kid-sun .cr-kid-action-circle .cr-file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Topbar Actions Container */
body.cr-kid.cr-kid-sun .cr-kid-topbar-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ============================================
   STAT BUBBLES - Vibrant Info Cards
   ============================================ */

body.cr-kid.cr-kid-sun .cr-kid-bubbles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 640px) {
  body.cr-kid.cr-kid-sun .cr-kid-bubbles {
    grid-template-columns: repeat(2, 1fr);
  }
  
  body.cr-kid.cr-kid-sun .cr-kid-bubbles .cr-kid-bubble.progress {
    grid-column: 1 / -1;
  }
}

body.cr-kid.cr-kid-sun .cr-kid-bubble {
  border-radius: var(--cr-radius-lg);
  background: var(--cr-glass-bg);
  backdrop-filter: blur(10px);
  border: 2px solid var(--cr-glass-border);
  box-shadow: var(--cr-glass-shadow);
  padding: 1.25rem 1rem;
  position: relative;
  overflow: hidden;
  transition: all var(--cr-transition);
}

body.cr-kid.cr-kid-sun .cr-kid-bubble:hover {
  transform: translateY(-4px);
  box-shadow: var(--cr-shadow-lg);
}

body.cr-kid.cr-kid-sun .cr-kid-bubble::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, var(--cr-sun-soft) 0%, transparent 70%);
  opacity: 0.6;
}

body.cr-kid.cr-kid-sun .cr-kid-bubble .label {
  position: relative;
  color: var(--cr-ink-soft);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

body.cr-kid.cr-kid-sun .cr-kid-bubble .value {
  position: relative;
  font-weight: 900;
  font-size: 1.75rem;
  background: var(--cr-gradient-sunset);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  margin-top: 0.25rem;
}

/* Progress Bubble */
body.cr-kid.cr-kid-sun .cr-kid-bubble.progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Mini Circle Button */
body.cr-kid.cr-kid-sun .cr-kid-mini-circle {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--cr-radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--cr-gradient-sunset);
  color: white;
  font-size: 1rem;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(245, 87, 108, 0.3);
  transition: all var(--cr-transition);
}

body.cr-kid.cr-kid-sun .cr-kid-mini-circle:hover {
  transform: scale(1.1) rotate(10deg);
}

/* Progress Ring */
body.cr-kid.cr-kid-sun .cr-kid-ring {
  width: 60px;
  height: 60px;
  border-radius: var(--cr-radius-full);
  background: conic-gradient(var(--cr-secondary) calc(var(--pct) * 1%), rgba(0, 0, 0, 0.08) 0);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

body.cr-kid.cr-kid-sun .cr-kid-ring > div {
  width: 46px;
  height: 46px;
  border-radius: var(--cr-radius-full);
  background: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.875rem;
  color: var(--cr-ink);
}

/* ============================================
   CHORE CARDS - Mission Cards
   ============================================ */

body.cr-kid.cr-kid-sun .cr-kid-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
}

body.cr-kid.cr-kid-sun .cr-kid-section-title h2 {
  font-size: 1.35rem;
  font-weight: 900;
  margin: 0;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

body.cr-kid.cr-kid-sun .cr-kid-chore {
  background: var(--cr-glass-bg);
  backdrop-filter: blur(20px);
  border-radius: var(--cr-radius-xl);
  border: 2px solid var(--cr-glass-border);
  box-shadow: var(--cr-glass-shadow);
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
  position: relative;
  transition: all var(--cr-transition);
  animation: cr-fade-in-up 0.4s ease backwards;
}

body.cr-kid.cr-kid-sun .cr-kid-chore:hover {
  transform: translateY(-3px);
  box-shadow: var(--cr-shadow-lg);
}

/* Stagger animation for chore cards */
body.cr-kid.cr-kid-sun .cr-kid-chore:nth-child(1) { animation-delay: 0.1s; }
body.cr-kid.cr-kid-sun .cr-kid-chore:nth-child(2) { animation-delay: 0.15s; }
body.cr-kid.cr-kid-sun .cr-kid-chore:nth-child(3) { animation-delay: 0.2s; }
body.cr-kid.cr-kid-sun .cr-kid-chore:nth-child(4) { animation-delay: 0.25s; }
body.cr-kid.cr-kid-sun .cr-kid-chore:nth-child(5) { animation-delay: 0.3s; }

/* Chore Header */
body.cr-kid.cr-kid-sun .cr-kid-chore-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
}

body.cr-kid.cr-kid-sun .cr-kid-chore-head > * {
  min-width: 0;
}

@media (max-width: 576px) {
  body.cr-kid.cr-kid-sun .cr-kid-chore-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
  }
  
  body.cr-kid.cr-kid-sun .cr-kid-chore-head > div:nth-child(2) {
    flex: 1 1 0;
    min-width: 0;
  }
  
  body.cr-kid.cr-kid-sun .cr-kid-chore-head > div:last-child {
    margin-left: auto;
  }
}

/* Chore Icon */
body.cr-kid.cr-kid-sun .cr-kid-chore-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--cr-radius-full);
  background: var(--cr-gradient-sunset);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 8px 20px rgba(245, 87, 108, 0.3);
  flex-shrink: 0;
}

body.cr-kid.cr-kid-sun .cr-kid-chore-title {
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--cr-ink);
  line-height: 1.3;
}

body.cr-kid.cr-kid-sun .cr-kid-chore-sub {
  color: var(--cr-ink-soft);
  font-size: 0.95rem;
  font-weight: 600;
}

/* Status Pills */
body.cr-kid.cr-kid-sun .cr-kid-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--cr-radius-full);
  padding: 0.5rem 1rem;
  font-weight: 800;
  font-size: 0.85rem;
  border: 2px solid transparent;
}

body.cr-kid.cr-kid-sun .cr-kid-pill.approved {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.3);
}

body.cr-kid.cr-kid-sun .cr-kid-pill.submitted {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.3);
}

body.cr-kid.cr-kid-sun .cr-kid-pill.rejected {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.3);
}

body.cr-kid.cr-kid-sun .cr-kid-pill.todo {
  background: rgba(99, 102, 241, 0.15);
  color: var(--cr-primary-dark);
  border-color: rgba(99, 102, 241, 0.3);
}

/* Chore Actions */
body.cr-kid.cr-kid-sun .cr-kid-chore-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
}

.cr-kid-upload-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  align-items: stretch;
  width: 100%;
}

.cr-kid-upload-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 0;
  white-space: nowrap;
}

.cr-kid-upload-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  white-space: nowrap;
}

body.cr-kid.cr-kid-sun .cr-kid-upload-chip,
body.cr-kid.cr-kid-sun .cr-kid-upload-submit {
  padding: 0.625rem 0.5rem;
  font-size: 0.75rem;
}

/* Primary Button - Gradient Action */
body.cr-kid.cr-kid-sun .cr-kid-primary-btn {
  border-radius: var(--cr-radius-full);
  border: none;
  background: var(--cr-gradient-sunset);
  color: white;
  font-weight: 900;
  padding: 0.875rem 1.75rem;
  font-size: 1.1rem;
  box-shadow: 0 8px 20px rgba(245, 87, 108, 0.35);
  transition: all var(--cr-transition);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

body.cr-kid.cr-kid-sun .cr-kid-primary-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

body.cr-kid.cr-kid-sun .cr-kid-primary-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 30px rgba(245, 87, 108, 0.45);
}

body.cr-kid.cr-kid-sun .cr-kid-primary-btn:hover::before {
  left: 100%;
}

body.cr-kid.cr-kid-sun .cr-kid-primary-btn:active {
  transform: translateY(-1px) scale(1.01);
}

/* Secondary Button */
body.cr-kid.cr-kid-sun .cr-kid-secondary-btn {
  border-radius: var(--cr-radius-full);
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.7);
  color: var(--cr-ink);
  font-weight: 800;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  transition: all var(--cr-transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

body.cr-kid.cr-kid-sun .cr-kid-secondary-btn:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
}

/* ============================================
   CELEBRATION ANIMATIONS
   ============================================ */

body.cr-kid.cr-kid-sun .cr-kid-chore.cr-celebrate {
  animation: cr-celebrate-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cr-celebrate-pop {
  0% { transform: scale(0.95); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* Confetti Canvas */
.cr-confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* ============================================
   MESSAGES - Enhanced Alerts
   ============================================ */

.cr-messages .alert {
  border: none;
  border-radius: var(--cr-radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: var(--cr-shadow);
  animation: cr-slide-in-right 0.4s ease;
}

.cr-messages .alert-success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(52, 211, 153, 0.15) 100%);
  color: #065f46;
  border-left: 4px solid #10b981;
}

.cr-messages .alert-danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(248, 113, 113, 0.15) 100%);
  color: #991b1b;
  border-left: 4px solid #ef4444;
}

.cr-messages .alert-warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(251, 191, 36, 0.15) 100%);
  color: #92400e;
  border-left: 4px solid #f59e0b;
}

.cr-messages .alert-info {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(96, 165, 250, 0.15) 100%);
  color: #1e40af;
  border-left: 4px solid #3b82f6;
}

.cr-message-icon {
  font-size: 1.25rem;
}

/* ============================================
   SCRATCH CARD - Game Element
   ============================================ */

.cr-scratch-card {
  position: relative;
  border-radius: var(--cr-radius-xl);
  overflow: hidden;
  background: white;
  border: 3px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--cr-shadow-lg);
  height: 280px;
}

@media (max-width: 520px) {
  .cr-scratch-card {
    height: 240px;
  }
}

.cr-scratch-under {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1.5rem;
  background: var(--cr-gradient-gold);
}

.cr-scratch-emoji {
  font-size: 5rem;
  line-height: 1;
  animation: cr-bounce 1s ease infinite;
}

.cr-scratch-text {
  margin-top: 1rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.cr-scratch-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: pointer;
  z-index: 2;
}

.cr-scratch-card.revealed .cr-scratch-canvas {
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms ease;
}

.cr-scratch-reveal {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 3;
  background: white;
  border: none;
  border-radius: var(--cr-radius-full);
  padding: 0.5rem 1rem;
  font-weight: 700;
  box-shadow: var(--cr-shadow);
}

/* ============================================
   STICKER BOOK
   ============================================ */

.cr-sticker-card {
  background: var(--cr-glass-bg);
  backdrop-filter: blur(10px);
  border: 2px solid var(--cr-glass-border);
  border-radius: var(--cr-radius-lg);
  box-shadow: var(--cr-glass-shadow);
  padding: 1.25rem 0.75rem;
  text-align: center;
  transition: all var(--cr-transition);
}

.cr-sticker-card:hover {
  transform: translateY(-5px) rotate(2deg);
  box-shadow: var(--cr-shadow-lg);
}

.cr-sticker-card .emoji {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 0.5rem;
  animation: cr-float 3s ease-in-out infinite;
}

.cr-sticker-card .title {
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--cr-ink);
  line-height: 1.2;
}

.cr-sticker-card.locked {
  opacity: 0.4;
  filter: grayscale(1);
  transform: none;
}

.cr-sticker-card.locked:hover {
  transform: none;
  box-shadow: var(--cr-glass-shadow);
}

.cr-sticker-card.locked .emoji {
  animation: none;
}

/* ============================================
   ACHIEVEMENT CARDS
   ============================================ */

.cr-achievement-card {
  background: var(--cr-glass-bg);
  backdrop-filter: blur(10px);
  border: 2px solid var(--cr-glass-border);
  border-radius: var(--cr-radius-xl);
  box-shadow: var(--cr-glass-shadow);
  padding: 1.5rem;
  text-align: center;
  transition: all var(--cr-transition);
  position: relative;
  overflow: hidden;
}

.cr-achievement-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--cr-shadow-lg);
}

.cr-achievement-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--cr-gradient-sunset);
}

.cr-achievement-card.locked::before {
  background: #d1d5db;
}

.cr-achievement-card .emoji {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: 0.75rem;
  display: block;
}

.cr-achievement-card .title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--cr-ink);
  margin-bottom: 0.5rem;
}

.cr-achievement-card .description {
  font-size: 0.9rem;
  color: var(--cr-ink-soft);
  margin-bottom: 1rem;
}

.cr-achievement-card .badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  border-radius: var(--cr-radius-full);
  font-size: 0.875rem;
  font-weight: 800;
}

.cr-achievement-card .badge.unlocked {
  background: var(--cr-gradient-sunset);
  color: white;
}

.cr-achievement-card .badge.locked {
  background: #e5e7eb;
  color: #6b7280;
}

/* Progress bar in achievement */
.cr-achievement-card .progress {
  height: 8px;
  border-radius: var(--cr-radius-full);
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.cr-achievement-card .progress-bar {
  border-radius: var(--cr-radius-full);
  background: var(--cr-gradient-sunset);
}

/* ============================================
   PARENT DASHBOARD CARDS
   ============================================ */

.cr-card-header {
  background: var(--cr-gradient-primary) !important;
  border: none !important;
  color: white;
}

.cr-card-hover {
  transition: all var(--cr-transition);
  border: none;
  border-radius: var(--cr-radius-lg);
  overflow: hidden;
  box-shadow: var(--cr-shadow);
}

.cr-card-hover:hover {
  transform: translateY(-5px);
  box-shadow: var(--cr-shadow-lg);
}

.cr-avatar {
  --cr-avatar-size: 3.5rem;
  width: var(--cr-avatar-size);
  height: var(--cr-avatar-size);
  font-size: calc(var(--cr-avatar-size) * 0.5);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--cr-radius-full);
  background: var(--cr-gradient-sunset);
  color: white;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(245, 87, 108, 0.3);
}

.cr-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--cr-radius-full);
}

.cr-level-badge {
  position: absolute;
  bottom: -0.25rem;
  right: -0.25rem;
  background: var(--cr-gradient-gold);
  border: 3px solid white;
  border-radius: var(--cr-radius-full);
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.875rem;
  color: #92400e;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* ============================================
   MOBILE NAVIGATION
   ============================================ */

.cr-mobile-nav-toggle {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 1060;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--cr-radius-full);
  background: var(--cr-gradient-sunset);
  border: 3px solid white;
  box-shadow: 0 8px 25px rgba(245, 87, 108, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all var(--cr-transition);
}

.cr-mobile-nav-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 35px rgba(245, 87, 108, 0.5);
}

.cr-mobile-nav-toggle .navbar-toggler-icon {
  width: 1.5rem;
  height: 1.5rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.5' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

#crMobileNav {
  width: 300px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-right: none;
  box-shadow: var(--cr-shadow-xl);
}

#crMobileNav .offcanvas-header {
  background: var(--cr-gradient-sunset);
  color: white;
  border: none;
}

#crMobileNav .offcanvas-title {
  font-weight: 800;
  font-size: 1.25rem;
}

#crMobileNav .btn-close {
  filter: brightness(0) invert(1);
}

#crMobileNav .nav-link {
  color: #374151;
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-left: 4px solid transparent;
  transition: all var(--cr-transition);
}

#crMobileNav .nav-link:hover {
  background: rgba(245, 87, 108, 0.08);
  color: var(--cr-secondary);
  border-left-color: var(--cr-secondary);
}

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

@keyframes cr-fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cr-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cr-slide-in-down {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cr-slide-in-right {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes cr-pulse-glow {
  0%, 100% { 
    box-shadow: 0 0 0 0 rgba(245, 87, 108, 0.4);
  }
  50% { 
    box-shadow: 0 0 20px 10px rgba(245, 87, 108, 0);
  }
}

@keyframes cr-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-10px) rotate(2deg); }
  50% { transform: translateY(-5px) rotate(0deg); }
  75% { transform: translateY(-15px) rotate(-2deg); }
}

@keyframes cr-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes cr-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.cr-text-gradient {
  background: var(--cr-gradient-sunset);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cr-bg-glass {
  background: var(--cr-glass-bg);
  backdrop-filter: blur(20px);
  border: 2px solid var(--cr-glass-border);
}

.cr-shadow-glow {
  box-shadow: 0 0 30px rgba(245, 87, 108, 0.3);
}

/* Proof photo preview */
.cr-proof-preview {
  max-width: 100px;
  max-height: 100px;
  border-radius: var(--cr-radius);
  border: 3px solid white;
  box-shadow: var(--cr-shadow);
}

/* History calendar */
.cr-history-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  margin-bottom: 0.5rem;
}

.cr-history-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}

.cr-history-day {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: var(--cr-radius);
  background: var(--cr-glass-bg);
  border: 2px solid var(--cr-glass-border);
  color: var(--cr-ink);
  text-decoration: none;
  font-weight: 800;
  font-size: 0.95rem;
  transition: all var(--cr-transition);
}

.cr-history-day:hover {
  transform: scale(1.1);
  background: white;
}

.cr-history-day.is-selected {
  background: var(--cr-gradient-sunset);
  color: white;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(245, 87, 108, 0.3);
}

.cr-history-day.has-activity::after {
  content: '';
  position: absolute;
  bottom: 6px;
  width: 6px;
  height: 6px;
  border-radius: var(--cr-radius-full);
  background: var(--cr-secondary);
}

/* ============================================
   RESPONSIVE DESIGN - Mobile First Approach
   ============================================ */

/* Large Desktop (1200px+) */
@media (min-width: 1200px) {
  body.cr-kid main.container {
    max-width: 900px;
  }
}

/* Desktop (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
  body.cr-kid main.container {
    max-width: 800px;
  }
}

/* Tablet (768px - 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
  body main.container {
    max-width: 720px;
  }
  
  body.cr-kid main.container {
    max-width: 700px;
  }
}

/* Mobile & Tablet (< 992px) */
@media (max-width: 991.98px) {
  body main.container {
    padding-bottom: 6rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* Ensure touch targets are at least 48px */
  .btn,
  .cr-kid-action-circle,
  .cr-kid-primary-btn,
  .cr-kid-secondary-btn,
  .nav-link {
    min-height: 48px;
    min-width: 48px;
  }
  
  /* Adjust auth page for mobile */
  body.cr-auth {
    padding: 0;
  }
  
  body.cr-auth main.container {
    max-width: 100%;
    padding: 0;
  }
  
  body.cr-auth .cr-auth-card {
    border-radius: 1.5rem;
  }
  
  body.cr-auth .cr-auth-body {
    padding: 1.5rem;
  }
}

/* Mobile (< 768px) */
@media (max-width: 767.98px) {
  /* Reduce font sizes slightly */
  body.cr-kid.cr-kid-sun .cr-kid-name {
    font-size: 1.1rem;
  }
  
  body.cr-kid.cr-kid-sun .cr-kid-section-title h2 {
    font-size: 1.15rem;
  }
  
  /* Smaller topbar elements */
  body.cr-kid.cr-kid-sun .cr-kid-circle {
    width: 2.75rem;
    height: 2.75rem;
  }
  
  body.cr-kid.cr-kid-sun .cr-kid-action-circle {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
  }
  
  /* Bubbles become 2-column */
  body.cr-kid.cr-kid-sun .cr-kid-bubbles {
    grid-template-columns: repeat(2, 1fr);
  }
  
  body.cr-kid.cr-kid-sun .cr-kid-bubble.progress {
    grid-column: 1 / -1;
  }
  
  /* Smaller chore icons */
  body.cr-kid.cr-kid-sun .cr-kid-chore-icon {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.25rem;
  }
  
  /* Smaller buttons */
  body.cr-kid.cr-kid-sun .cr-kid-primary-btn {
    padding: 0.625rem 1.25rem;
    font-size: 1rem;
  }
  
  body.cr-kid.cr-kid-sun .cr-kid-secondary-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  /* Parent pages adjustments */
  .cr-avatar {
    --cr-avatar-size: 2.75rem;
  }
  
  h1.h3 {
    font-size: 1.35rem;
  }
  
  /* Card padding reduction */
  .card-body.p-4 {
    padding: 1.25rem !important;
  }
  
  /* Form controls larger for touch */
  .form-control,
  .form-select {
    min-height: 48px;
    font-size: 16px; /* Prevent zoom on iOS */
  }
}

/* Small Mobile (< 576px) */
@media (max-width: 576px) {
  body.cr-kid.cr-kid-sun .cr-kid-topbar {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }
  
  body.cr-kid.cr-kid-sun .cr-kid-topbar-actions {
    width: 100%;
    justify-content: center;
  }
  
  body.cr-kid.cr-kid-sun .cr-kid-bubbles {
    gap: 0.5rem;
  }
  
  body.cr-kid.cr-kid-sun .cr-kid-bubble {
    padding: 0.75rem;
    border-radius: 1rem;
  }
  
  body.cr-kid.cr-kid-sun .cr-kid-bubble .value {
    font-size: 1.35rem;
  }
  
  body.cr-kid.cr-kid-sun .cr-kid-bubble .label {
    font-size: 0.7rem;
  }
  
  /* Chore cards more compact */
  body.cr-kid.cr-kid-sun .cr-kid-chore {
    padding: 1rem;
    border-radius: 1.25rem;
  }
  
  body.cr-kid.cr-kid-sun .cr-kid-chore-title {
    font-size: 1rem;
  }
  
  body.cr-kid.cr-kid-sun .cr-kid-chore-sub {
    font-size: 0.85rem;
  }
  
  /* Sticker grid smaller */
  .cr-sticker-card {
    padding: 0.75rem 0.5rem;
  }
  
  .cr-sticker-card .emoji {
    font-size: 2rem;
  }
  
  .cr-sticker-card .title {
    font-size: 0.75rem;
  }
  
  /* Progress ring smaller */
  body.cr-kid.cr-kid-sun .cr-kid-ring {
    width: 48px;
    height: 48px;
  }
  
  body.cr-kid.cr-kid-sun .cr-kid-ring > div {
    width: 36px;
    height: 36px;
    font-size: 0.75rem;
  }
  
  /* Mobile nav button */
  .cr-mobile-nav-toggle {
    width: 3rem;
    height: 3rem;
    bottom: 1rem;
    left: 1rem;
  }
  
  /* Auth page compact */
  body.cr-auth .cr-auth-shell {
    padding: 0;
  }
  
  body.cr-auth .cr-auth-body {
    padding: 1.25rem;
  }
  
  body.cr-auth .cr-card-header {
    padding: 1.25rem;
  }
}

/* Extra Small Mobile (< 375px) */
@media (max-width: 374.98px) {
  body.cr-kid.cr-kid-sun .cr-kid-bubbles {
    grid-template-columns: 1fr 1fr;
  }
  
  body.cr-kid.cr-kid-sun .cr-kid-bubble .value {
    font-size: 1.15rem;
  }
  
  /* Single column actions */
  body.cr-kid.cr-kid-sun .cr-kid-chore-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  body.cr-kid.cr-kid-sun .cr-kid-primary-btn,
  body.cr-kid.cr-kid-sun .cr-kid-secondary-btn {
    width: 100%;
    justify-content: center;
  }

  body.cr-kid.cr-kid-sun .cr-kid-upload-form {
    gap: 0.375rem;
  }

  body.cr-kid.cr-kid-sun .cr-kid-upload-chip,
  body.cr-kid.cr-kid-sun .cr-kid-upload-submit {
    padding: 0.5rem 0.35rem;
    font-size: 0.7rem;
  }
  
  /* Topbar stack vertically */
  body.cr-kid.cr-kid-sun .cr-kid-topbar-left {
    width: 100%;
  }
}

/* Landscape mode adjustments */
@media (max-height: 500px) and (orientation: landscape) {
  .cr-mobile-nav-toggle {
    bottom: 0.5rem;
    left: 0.5rem;
  }
  
  body main.container {
    padding-bottom: 4rem;
  }
}

/* High DPI / Retina screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .cr-avatar img,
  body.cr-kid.cr-kid-sun .cr-kid-circle img {
    image-rendering: -webkit-optimize-contrast;
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .cr-confetti-canvas {
    display: none !important;
  }
}

/* ============================================
   SAFE AREA SUPPORT (Notched Devices)
   ============================================ */

/* iOS Safe Area support */
@supports (padding: max(0px)) {
  body:not(.cr-auth) {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  
  .cr-mobile-nav-toggle {
    bottom: max(1.5rem, env(safe-area-inset-bottom));
    left: max(1.5rem, env(safe-area-inset-left));
  }
  
  body:not(.cr-auth) main.container {
    padding-bottom: max(6rem, env(safe-area-inset-bottom) + 5rem);
  }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

/* Prevent text selection on buttons (better touch feel) */
.cr-kid-action-circle,
.cr-kid-primary-btn,
.cr-kid-secondary-btn,
.cr-kid-mini-circle,
.cr-mobile-nav-toggle {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Smooth scrolling on iOS */
body {
  -webkit-overflow-scrolling: touch;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  body {
    background: white !important;
  }
  
  .cr-mobile-nav-toggle,
  #crMobileNav,
  .cr-confetti-canvas,
  .toast-container,
  .btn {
    display: none !important;
  }
  
  .card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}
