/* Grow Kit AR - Kids-Friendly Modern Styles */


* {
  box-sizing: border-box;
}

/* Vibrant kids color palette */
:root {
  --primary-green: #4ADE30;
  --secondary-orange: #FF9F43;
  --accent-pink: #FF6B9D;
  --accent-yellow: #FFD93D;
  --accent-purple: #A855F7;
  --accent-blue: #38BDF8;
  --dark-green: #166534;
  --soft-white: #FFFEF7;
  --bubble-gum: #FFE4EC;
  --sky-blue: #E0F4FF;
}

/* Safe area insets for notched devices */
body {
  margin: 0;
  overflow: hidden;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 50%, #A5D6A7 100%);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

#arScene {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ========== UI OVERLAY - Kid Friendly ========== */
#uiOverlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  text-align: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 70%, transparent 100%);
  pointer-events: auto;
  width: 100%;
}

/* Fun scene indicator dots */
#sceneIndicator {
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.scene-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #D1D5DB;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 3px solid transparent;
}

.scene-dot.active {
  background: var(--primary-green);
  transform: scale(1.4);
  border-color: white;
  box-shadow: 0 4px 12px rgba(74, 222, 48, 0.4);
}

.scene-dot.completed {
  background: var(--secondary-orange);
}

/* Fun title with emoji feel */
#sceneTitle {
  margin: 0 0 6px;
  font-size: clamp(1.3rem, 5vw, 1.6rem);
  font-weight: 800;
  color: var(--dark-green);
  text-shadow: 0 2px 8px rgba(22, 101, 52, 0.1);
  letter-spacing: -0.5px;
}

#sceneInstruction {
  margin: 0 0 16px;
  font-size: clamp(0.95rem, 3.5vw, 1.1rem);
  color: #6B7280;
  line-height: 1.5;
  max-width: 100%;
  padding: 0 10px;
  font-weight: 500;
}

/* ========== BIG KID-FRIENDLY BUTTONS ========== */
#controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 0 5px;
}

#controls button {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  min-width: 80px;
  min-height: 56px;
  touch-action: manipulation;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  -webkit-tap-highlight-color: transparent;
  border-radius: 16px;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
}

/* Back button - secondary */
#prevBtn {
  background: linear-gradient(135deg, #F3F4F6 0%, #E5E7EB 100%);
  color: #4B5563;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  width: 80px;
}

#prevBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

#prevBtn:active {
  transform: scale(0.95);
}

#prevBtn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

/* Next button - main action */
#nextBtn {
  background: linear-gradient(135deg, var(--primary-green) 0%, #22C55E 100%);
  color: white;
  box-shadow: 0 6px 20px rgba(74, 222, 48, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  width: 120px;
}

#nextBtn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(74, 222, 48, 0.5);
}

#nextBtn:active {
  transform: scale(0.95);
}

#nextBtn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

/* Audio toggle - same size as other buttons */
#audioToggle {
  background: linear-gradient(135deg, var(--accent-yellow) 0%, #FBBF24 100%);
  color: var(--dark-green);
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
  font-size: 20px;
  width: 80px;
}

#audioToggle:hover {
  transform: translateY(-2px);
}

#audioToggle:active {
  transform: scale(0.95);
}

#audioToggle.muted {
  background: linear-gradient(135deg, #E5E7EB 0%, #D1D5DB 100%);
  box-shadow: none;
}

/* ========== LOADING SCREEN ========== */
#loadingScreen {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #E8F5E9 0%, var(--sky-blue) 100%);
  z-index: 100;
}

.loading-content {
  text-align: center;
}

.loading-emoji {
  font-size: 64px;
  margin-bottom: 20px;
  animation: bounce 1s ease-in-out infinite;
}

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

.loading-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--dark-green);
  margin-bottom: 8px;
}

.loading-text {
  font-size: 16px;
  color: #6B7280;
  margin-bottom: 30px;
}

.loading-progress {
  width: 200px;
  height: 12px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 20px;
  overflow: hidden;
  margin: 0 auto;
}

.loading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-green), var(--accent-yellow));
  border-radius: 20px;
  animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
  0% { width: 0%; margin-left: 0%; }
  50% { width: 70%; margin-left: 15%; }
  100% { width: 0%; margin-left: 100%; }
}

#loadingScreen.hidden {
  display: none;
}

/* ========== MARKER STATUS TOAST ========== */
#markerStatus {
  position: fixed;
  top: calc(20px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--accent-pink) 0%, #EC4899 100%);
  color: white;
  border-radius: 30px;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 100;
  max-width: calc(100% - 40px);
  box-shadow: 0 6px 25px rgba(236, 72, 153, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
}

#markerStatus.visible {
  opacity: 1;
  transform: translateX(-50%) scale(1.05);
}

#markerStatus::before {
  content: '✨';
  font-size: 20px;
}

/* ========== DEBUG PANEL - Simplified ========== */
#debugPanel {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  color: #374151;
  padding: 12px;
  border-radius: 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  z-index: 1000;
  pointer-events: auto;
  max-height: 40vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

#debugPanel.hidden {
  display: none;
}

#debugToggle {
  background: linear-gradient(135deg, var(--accent-purple) 0%, #9333EA 100%);
  color: white;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  width: 100%;
}

.debug-value.success {
  color: var(--primary-green);
  font-weight: 700;
}

.debug-value.warning {
  color: var(--secondary-orange);
  font-weight: 700;
}

.debug-value.error {
  color: #EF4444;
  font-weight: 700;
}

/* ========== LANDSCAPE MODE ========== */
@media screen and (orientation: landscape) and (max-height: 500px) {
  #uiOverlay {
    padding: 10px;
    bottom: 10px;
  }

  #sceneTitle {
    font-size: 1.2rem;
    margin-bottom: 4px;
  }

  #sceneInstruction {
    font-size: 0.9rem;
    margin-bottom: 10px;
  }

  #controls button {
    padding: 10px 20px;
    min-height: 48px;
    font-size: 14px;
  }
}

/* ========== SMALL PHONES ========== */
@media screen and (max-width: 360px) {
  #uiOverlay {
    padding: 12px 10px;
  }

  #sceneTitle {
    font-size: 1.2rem;
  }

  #sceneInstruction {
    font-size: 0.9rem;
  }

  #controls button {
    padding: 10px 16px;
    font-size: 14px;
    min-width: 60px;
  }

  #markerStatus {
    font-size: 14px;
    padding: 12px 20px;
  }
}

/* ========== TABLETS ========== */
@media screen and (min-width: 768px) {
  #uiOverlay {
    bottom: 40px;
    padding: 24px 40px;
    max-width: 500px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  }

  #sceneTitle {
    font-size: 1.8rem;
  }

  #sceneInstruction {
    font-size: 1.1rem;
  }

  #controls button {
    padding: 16px 32px;
    font-size: 18px;
    min-width: 90px;
  }

  #debugPanel {
    max-width: 350px;
    left: calc(20px + env(safe-area-inset-left, 0px));
    right: auto;
  }
}

/* ========== ANIMATIONS ========== */
@keyframes pop-in {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  70% {
    transform: scale(1.05);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

/* Add sparkle animation to buttons on hover */
#nextBtn:not(:disabled):hover {
  animation: wiggle 0.5s ease-in-out;
}