:root {
  /* Disney Pixar EXTREMELY Vibrant Palette */
  --bg-gradient-top: #00DBDE;
  --bg-gradient-bottom: #FC00FF;
  --text-main: #1C3144;
  --text-light: #4A637D;
  
  --color-primary: #FF416C; /* Candy Pink/Red */
  --color-primary-dark: #D4214D;
  
  --color-secondary: #FFD166; /* Sunny Yellow */
  --color-secondary-dark: #DFA626;
  
  --color-blue: #00B4D8; /* Sky Blue */
  --color-green: #06D6A0; /* Lime Green */
  --color-purple: #9D4EDD; /* Bright Purple */
  
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.9);
  --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  --glass-blur: blur(15px);
  
  --border-radius-xl: 28px;
  --border-radius-md: 20px;
  --border-radius-sm: 14px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(145deg, var(--bg-gradient-top), #6AD2FF, var(--bg-gradient-bottom));
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
}

h1, h2, h3, h4, h5 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: transparent;
  overflow: hidden; /* Important for floating emojis */
}

/* Typography Utility */
.section-title {
  font-size: 1.6rem;
  margin: 1.5rem 0 1rem;
  padding: 0 1.2rem;
  color: white;
  text-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.glass-card {
  background: white;
  border-radius: var(--border-radius-xl);
  border: 4px solid white;
  box-shadow: 0 8px 0 rgba(0,0,0,0.1);
  padding: 1.2rem;
  margin: 0 1.2rem;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.2rem 1rem;
  z-index: 10;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar img {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  border: 4px solid var(--color-secondary);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.greeting h1 {
  font-size: 1.4rem;
  color: white;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  margin-bottom: 2px;
}

.greeting p {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.9);
  font-weight: 800;
}

.settings-btn {
  background: white;
  border: none;
  font-size: 1.8rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-purple);
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0,0,0,0.1);
}
.settings-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.1);
}

.content {
  flex: 1;
  padding-bottom: 100px;
  overflow-y: auto;
}

.view {
  display: none;
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.view.active {
  display: block;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.hero-devotional {
  background: #FFFFFF;
  border: 4px solid var(--color-secondary);
  box-shadow: 0 8px 0 var(--color-secondary-dark);
}

.hero-devotional .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.badge {
  background: var(--color-secondary);
  color: #8B4513;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 3px 0 var(--color-secondary-dark);
}

.hero-devotional h3 {
  font-size: 1.8rem;
  margin-bottom: 10px;
  color: var(--color-primary);
}

.hero-devotional p {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-light);
  line-height: 1.4;
  margin-bottom: 20px;
}

.audio-player {
  background: #f0f4f8;
  padding: 15px;
  border-radius: var(--border-radius-md);
  border: 2px solid #e1e8f0;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.play-btn {
  background: var(--color-primary);
  color: white;
  border: none;
  width: 65px;
  height: 65px;
  border-radius: 50%;
  font-size: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--color-primary-dark);
  flex-shrink: 0;
  transition: all 0.1s;
}

.play-btn:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 var(--color-primary-dark);
}

.progress-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-bar {
  flex: 1;
  height: 14px;
  background: #d8e2ed;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--color-green);
  width: 0%;
  border-radius: 10px;
  transition: width 0.1s linear;
}

.grid-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 0 1.2rem;
  margin-top: 25px;
}

.grid-menu-3 {
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.grid-menu-3 .action-card {
  padding: 1.2rem 0.6rem;
}

.grid-menu-3 .card-icon {
  width: 54px;
  height: 54px;
  font-size: 2rem;
  margin-bottom: 10px;
}

.grid-menu-3 h4 { font-size: 1rem; }
.grid-menu-3 p  { font-size: 0.75rem; }

.grid-menu-4 {
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-menu-4 .action-card {
  padding: 1.2rem 0.8rem;
}

.grid-menu-4 .card-icon {
  width: 58px;
  height: 58px;
  font-size: 2.2rem;
  margin-bottom: 10px;
}

.grid-menu-4 h4 { font-size: 1.05rem; }
.grid-menu-4 p  { font-size: 0.78rem; }

.action-card {
  margin: 0;
  padding: 1.8rem 1rem;
  text-align: center;
  cursor: pointer;
}

.quiz-card    { border: 4px solid var(--color-purple); box-shadow: 0 8px 0 #7A35B3; }
.stories-card { border: 4px solid var(--color-blue);   box-shadow: 0 8px 0 #008AA8; }
.puzzle-card  { border: 4px solid var(--color-primary); box-shadow: 0 8px 0 var(--color-primary-dark); }
.ws-card      { border: 4px solid var(--color-green);  box-shadow: 0 8px 0 #04A87B; }

.action-card:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.2) !important;
}

.card-icon {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 15px;
  font-size: 2.5rem;
  color: white;
  box-shadow: 0 6px 0 rgba(0,0,0,0.15);
}

.bg-purple { background: var(--color-purple); }
.bg-blue { background: var(--color-blue); }
.bg-green { background: var(--color-green); }
.bg-yellow { background: var(--color-secondary); }
.bg-pink { background: var(--color-primary); }

.action-card h4 {
  font-size: 1.25rem;
  margin-bottom: 6px;
}
.action-card p {
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 700;
}

.featured-image {
  margin-top: 30px;
  padding: 0 1.2rem;
  text-align: center;
}
.pixar-img {
  width: 100%;
  max-width: 340px;
  border-radius: var(--border-radius-xl);
  box-shadow: 0 12px 0 rgba(0,0,0,0.15);
  border: 6px solid white;
}

.stories-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.story-item {
  display: flex;
  align-items: center;
  padding: 16px;
  gap: 16px;
  border: 4px solid white;
  box-shadow: 0 8px 0 rgba(0,0,0,0.1);
}

.story-item.david { border-color: var(--color-purple); box-shadow: 0 6px 0 var(--color-purple); }
.story-item.noah { border-color: var(--color-blue); box-shadow: 0 6px 0 var(--color-blue); }
.story-item.creation { border-color: var(--color-green); box-shadow: 0 6px 0 var(--color-green); }

.story-item:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.1);
}

.story-thumb {
  width: 65px;
  height: 65px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
  flex-shrink: 0;
  box-shadow: 0 4px 0 rgba(0,0,0,0.1);
}
.story-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--border-radius-md);
}

.story-info { flex: 1; }
.story-info h4 { font-size: 1.3rem; margin-bottom: 4px; color: var(--text-main); }
.story-info p { font-size: 0.9rem; color: var(--text-light); font-weight: 700;}

.btn-icon {
  background: #f0f4f8;
  border: 2px solid #d8e2ed;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--color-primary);
  box-shadow: 0 4px 0 #d8e2ed;
}

.btn {
  border: none;
  padding: 16px 24px;
  border-radius: var(--border-radius-md);
  font-family: inherit;
  font-weight: 800;
  font-size: 1.2rem;
  cursor: pointer;
  width: 100%;
  transition: all 0.1s;
}
.btn-primary { 
  background: var(--color-primary); 
  color: white; 
  box-shadow: 0 6px 0 var(--color-primary-dark); 
}
.btn-primary:active { 
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--color-primary-dark); 
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  background: white;
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  padding-bottom: env(safe-area-inset-bottom, 15px);
  border-top-left-radius: 30px;
  border-top-right-radius: 30px;
  box-shadow: 0 -8px 25px rgba(0,0,0,0.1);
  z-index: 100;
}

.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: #a0b2c1;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.nav-item ion-icon {
  font-size: 1.8rem;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.nav-item.active { color: var(--color-primary); }
.nav-item.active ion-icon {
  transform: translateY(-8px) scale(1.1);
  color: var(--color-primary);
  filter: drop-shadow(0 4px 4px rgba(255, 65, 108, 0.3));
}

#story-reader-content {
  background: white;
  border-radius: var(--border-radius-xl);
  padding: 24px;
  margin: 1.2rem;
  border: 4px solid var(--color-blue);
  box-shadow: 0 8px 0 #008AA8;
}
#story-reader-content h2 {
  font-size: 2rem;
  color: var(--color-blue);
  margin-bottom: 20px;
  text-align: center;
}
#story-reader-content .story-body {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 25px;
}
.story-image {
  width: 100%;
  border-radius: var(--border-radius-md);
  margin-bottom: 20px;
  border: 4px solid white;
  box-shadow: 0 6px 0 rgba(0,0,0,0.1);
}
.back-btn {
  background: var(--color-secondary);
  color: #8B4513;
  margin-bottom: -10px;
  margin-left: 1.2rem;
  margin-top: 1rem;
  display: inline-block;
  padding: 10px 20px;
  border-radius: 20px;
  font-weight: 800;
  box-shadow: 0 4px 0 var(--color-secondary-dark);
}

/* =========================================================
   FLOATING VISUAL EFFECTS (MAGIC WORD ANIMATIONS) 
========================================================= */
.floating-effect {
  position: absolute;
  font-size: 4rem;
  z-index: 999;
  pointer-events: none;
  filter: drop-shadow(0 5px 15px rgba(0,0,0,0.3));
  opacity: 0;
}

@keyframes floatUp {
  0% { transform: translateY(0) scale(0.5) rotate(-15deg); opacity: 0; }
  20% { opacity: 1; transform: translateY(-50px) scale(1.2) rotate(10deg); }
  80% { opacity: 1; transform: translateY(-200px) scale(1) rotate(-10deg); }
  100% { transform: translateY(-250px) scale(0) rotate(15deg); opacity: 0; }
}

@keyframes pop {
  0% { transform: scale(0.2); opacity: 0; }
  30% { transform: scale(1.5); opacity: 1; }
  70% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(3); opacity: 0; }
}

@keyframes roarShake {
  0% { transform: scale(0.5) translateX(0); opacity: 0; }
  20% { transform: scale(1.8) translateX(-10px); opacity: 1; }
  40% { transform: scale(1.8) translateX(10px); }
  60% { transform: scale(1.8) translateX(-10px); }
  80% { transform: scale(1.8) translateX(10px); opacity: 1; }
  100% { transform: scale(2) translateX(0); opacity: 0; }
}

@keyframes twinkle {
  0% { transform: scale(0) rotate(0deg); opacity: 0; }
  50% { transform: scale(2) rotate(180deg); opacity: 1; filter: drop-shadow(0 0 20px #FFD166); }
  100% { transform: scale(0) rotate(360deg); opacity: 0; }
}

@keyframes wave {
  0% { transform: translateX(-50px) translateY(0); opacity: 0; }
  30% { transform: translateX(0) translateY(-30px); opacity: 1; }
  70% { transform: translateX(50px) translateY(10px); opacity: 1; }
  100% { transform: translateX(100px) translateY(-20px); opacity: 0; }
}

.anim-floatUp { animation: floatUp 2.5s ease-out forwards; }
.anim-pop { animation: pop 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.anim-roarShake { animation: roarShake 1.5s ease-in-out forwards; }
.anim-twinkle { animation: twinkle 2s ease-in-out forwards; }
.anim-wave { animation: wave 2.5s ease-in-out forwards; }
