/* Kids iPad App Modern Theme */
:root {
  --primary: #FF5E7E;
  --primary-light: #FFA8BA;
  --secondary: #48DBFB;
  --accent: #FECA57;
  --success: #1DD1A1;
  --purple: #9B59B6;
  --bg-gradient: linear-gradient(135deg, #FFF0F5 0%, #E8F5E9 50%, #E3F2FD 100%);
  --card-bg: rgba(255, 255, 255, 0.95);
  --text-dark: #2D3436;
  --text-muted: #636E72;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-bouncy: 0 10px 25px -5px rgba(255, 94, 126, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 20px 35px -5px rgba(255, 94, 126, 0.35), 0 12px 15px -8px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: 'Fredoka', 'Quicksand', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  color: var(--text-dark);
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 20px);
  padding-top: env(safe-area-inset-top, 0px);
}

/* Background floating cute bubbles */
.bubbles-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  opacity: 0.25;
  animation: floatUp 16s infinite linear;
}

@keyframes floatUp {
  0% { transform: translateY(105vh) scale(0.8) rotate(0deg); opacity: 0; }
  20% { opacity: 0.3; }
  80% { opacity: 0.3; }
  100% { transform: translateY(-15vh) scale(1.2) rotate(360deg); opacity: 0; }
}

/* App Header */
header {
  position: relative;
  z-index: 10;
  padding: 24px 20px 16px;
  max-width: 1300px;
  margin: 0 auto;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-icon {
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, #FFE066, #FF9900);
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  box-shadow: 0 8px 18px rgba(255, 153, 0, 0.35);
  animation: gentlePulse 3s infinite ease-in-out;
}

@keyframes gentlePulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.06) rotate(4deg); }
}

.app-title {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #FF477E, #9B59B6, #00D2D3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
  line-height: 1.15;
}

.app-subtitle {
  font-size: 1.05rem;
  font-weight: 600;
  color: #718096;
}

/* Star Counter Badge */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.star-counter-badge {
  background: #FFF;
  padding: 10px 20px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #D97706;
  border: 3px solid #FDE68A;
  box-shadow: 0 6px 16px rgba(245, 159, 0, 0.15);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.star-counter-badge:hover {
  transform: scale(1.05);
}

.btn-icon {
  background: #FFF;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 2px solid #E2E8F0;
  transition: all 0.2s;
}

.btn-icon:active {
  transform: scale(0.92);
}

/* Category Filter Pills */
.filters-bar {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 14px 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.filters-bar::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.9);
  padding: 10px 22px;
  border-radius: 50px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: #4A5568;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.filter-btn.active {
  background: linear-gradient(135deg, #FF6B8B, #FF8E53);
  color: #FFF;
  border-color: #FF6B8B;
  box-shadow: 0 8px 20px rgba(255, 107, 139, 0.4);
  transform: scale(1.04);
}

/* Video Grid for iPad */
.grid-container {
  position: relative;
  z-index: 10;
  max-width: 1300px;
  margin: 0 auto;
  padding: 10px 20px 40px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

@media (min-width: 768px) {
  .grid-container {
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 28px;
  }
}

@media (min-width: 1100px) {
  .grid-container {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Habit Card */
.habit-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-bouncy);
  border: 4px solid #FFF;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.habit-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-hover);
}

.habit-card:active {
  transform: scale(0.96);
}

.card-thumb-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 aspect ratio */
  background: #E2E8F0;
  overflow: hidden;
}

.card-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.habit-card:hover .card-thumb {
  transform: scale(1.08);
}

/* Play Overlay Badge */
.play-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 66px;
  height: 66px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--primary);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.habit-card:hover .play-badge {
  transform: translate(-50%, -50%) scale(1.18);
  background: var(--primary);
  color: #FFF;
}

/* Card Number Badge */
.card-number {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  color: #FFF;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 4px 14px;
  border-radius: 30px;
  border: 2px solid rgba(255, 255, 255, 0.6);
}

/* Card Completed Star Check */
.card-star-status {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #FFF;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  opacity: 0.35;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.habit-card.completed .card-star-status {
  opacity: 1;
  background: #FECA57;
  transform: scale(1.1) rotate(12deg);
}

.card-info {
  padding: 16px 18px 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.card-emoji {
  font-size: 1.8rem;
  line-height: 1;
}

.card-title {
  font-size: 1.22rem;
  font-weight: 700;
  color: #2D3748;
  line-height: 1.25;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 2px dashed #EDF2F7;
}

.badge-pill {
  font-size: 0.88rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  background: #EBF8FF;
  color: #2B6CB0;
}

.habit-card.completed .badge-pill {
  background: #E6FFFA;
  color: #234E52;
}

/* ========================================================
   FULLSCREEN KID VIDEO PLAYER MODAL
   ======================================================== */
.player-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #0B0E14;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.player-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.player-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: max(16px, env(safe-area-inset-top)) 24px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 20;
  background: linear-gradient(to bottom, rgba(0,0,0,0.85), transparent);
  transition: opacity 0.3s;
}

.btn-back {
  background: #FF5E7E;
  color: #FFF;
  border: none;
  padding: 12px 24px;
  border-radius: 50px;
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(255, 94, 126, 0.4);
  transition: transform 0.2s;
}

.btn-back:active {
  transform: scale(0.92);
}

.player-current-title {
  color: #FFF;
  font-size: 1.4rem;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  max-width: 55%;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-header-actions {
  display: flex;
  gap: 12px;
}

.btn-lock {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  color: #FFF;
  border: 2px solid rgba(255, 255, 255, 0.4);
  padding: 10px 18px;
  border-radius: 50px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-lock.locked {
  background: #E53E3E;
  border-color: #FC8181;
}

/* Video Canvas Area */
.video-wrapper {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  height: 100%;
}

video#mainVideo {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Giant Big Play Pause Center Overlay */
.big-play-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 110px;
  height: 110px;
  background: rgba(255, 94, 126, 0.88);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  color: #FFF;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 15;
}

.big-play-center.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

/* Bottom Controls */
.player-bottom-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 16px 24px max(20px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: opacity 0.3s;
}

.progress-track {
  width: 100%;
  height: 14px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #FF6B8B, #FECA57);
  border-radius: 10px;
  transition: width 0.1s linear;
}

.controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.playback-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-ctrl {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.35);
  color: #FFF;
  min-width: 58px;
  height: 58px;
  padding: 0 16px;
  border-radius: 50px;
  font-family: inherit;
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ctrl.main-play {
  background: #FECA57;
  color: #2D3436;
  border: none;
  font-size: 1.8rem;
  width: 68px;
  height: 68px;
  box-shadow: 0 6px 20px rgba(254, 202, 87, 0.5);
}

.btn-ctrl:active {
  transform: scale(0.9);
}

.time-display {
  color: #FFF;
  font-size: 1.15rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

/* Kid Lock Overlay */
.lock-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  border: 3px solid #FECA57;
  color: #FFF;
  padding: 18px 30px;
  border-radius: 30px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  z-index: 50;
  display: none;
  animation: fadeInOut 2.5s forwards;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translate(-50%, -45%); }
  15% { opacity: 1; transform: translate(-50%, -50%); }
  85% { opacity: 1; transform: translate(-50%, -50%); }
  100% { opacity: 0; transform: translate(-50%, -55%); }
}

/* Celebration Overlay */
.celebration-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.92);
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
}

.celebration-overlay.active {
  display: flex;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.celebration-star {
  font-size: 90px;
  animation: spinStar 2s infinite ease-in-out;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 25px rgba(254, 202, 87, 0.8));
}

@keyframes spinStar {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.2) rotate(15deg); }
}

.celebration-title {
  color: #FFF;
  font-size: 2.6rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.celebration-subtitle {
  color: #FECA57;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 32px;
}

.celebration-actions {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-celebration {
  background: linear-gradient(135deg, #1DD1A1, #10AC84);
  color: #FFF;
  border: none;
  padding: 16px 36px;
  border-radius: 50px;
  font-family: inherit;
  font-size: 1.35rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(29, 209, 161, 0.5);
  transition: transform 0.2s;
}

.btn-celebration.replay {
  background: linear-gradient(135deg, #FF6B8B, #FF8E53);
  box-shadow: 0 8px 24px rgba(255, 107, 139, 0.5);
}

.btn-celebration:active {
  transform: scale(0.92);
}
