/* =============================================
   Kid AI App — Main Stylesheet
   ============================================= */

:root {
  --bg-primary: #0F0F1A;
  --bg-card: #1A1A2E;
  --bg-card2: #16213E;
  --accent: #7C3AED;
  --accent2: #EC4899;
  --accent3: #06B6D4;
  --gold: #F59E0B;
  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --border: rgba(255,255,255,0.08);
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 30px rgba(124,58,237,0.3);
  --nav-height: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text);
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---- App Shell ---- */
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 430px;
  margin: 0 auto;
  position: relative;
  background: var(--bg-primary);
}

.screen {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
  scroll-behavior: smooth;
}

.screen::-webkit-scrollbar { display: none; }

/* ---- Bottom Navigation ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: calc(var(--nav-height) + var(--safe-bottom));
  background: rgba(26,26,46,0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  padding-top: 10px;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s;
  padding: 6px 0;
  border-radius: var(--radius-sm);
}

.nav-item .nav-icon { font-size: 24px; }
.nav-item .nav-label { font-size: 10px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.5px; }

.nav-item.active .nav-icon { filter: drop-shadow(0 0 8px var(--accent)); }
.nav-item.active .nav-label { color: var(--accent); }

/* ---- Header ---- */
.screen-header {
  padding: 20px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.screen-title {
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  letter-spacing: 0.3px;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  box-shadow: 0 4px 20px rgba(124,58,237,0.4);
}

.btn-secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-gold {
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  color: white;
  box-shadow: 0 4px 20px rgba(245,158,11,0.4);
}

/* ---- Buddy Video ---- */
.buddy-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.buddy-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ---- Pill Tabs ---- */
.pill-tabs {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 50px;
  border: 1px solid var(--border);
}

.pill-tab {
  flex: 1;
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  transition: all 0.2s;
  text-align: center;
}

.pill-tab.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 10px rgba(124,58,237,0.4);
}

/* ---- Scroll Row ---- */
.scroll-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}

.scroll-row::-webkit-scrollbar { display: none; }
.scroll-row > * { scroll-snap-align: start; flex-shrink: 0; }

/* ---- Animations ---- */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(124,58,237,0.3); }
  50% { box-shadow: 0 0 40px rgba(124,58,237,0.6); }
}

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

@keyframes pop-in {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.float { animation: float 3s ease-in-out infinite; }
.pop-in { animation: pop-in 0.3s ease-out forwards; }

/* ---- Stars background ---- */
.stars-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.stars-bg::before, .stars-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 70%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 50% 40%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 80%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 10%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 20% 90%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1px 1px at 60% 60%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(2px 2px at 80% 30%, rgba(255,255,255,0.3) 0%, transparent 100%);
}

/* ---- Badge / Chip ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 700;
}

.badge-purple { background: rgba(124,58,237,0.2); color: #A78BFA; border: 1px solid rgba(124,58,237,0.3); }
.badge-pink   { background: rgba(236,72,153,0.2); color: #F9A8D4; border: 1px solid rgba(236,72,153,0.3); }
.badge-cyan   { background: rgba(6,182,212,0.2);  color: #67E8F9; border: 1px solid rgba(6,182,212,0.3); }
.badge-gold   { background: rgba(245,158,11,0.2); color: #FCD34D; border: 1px solid rgba(245,158,11,0.3); }
.badge-green  { background: rgba(34,197,94,0.2);  color: #86EFAC; border: 1px solid rgba(34,197,94,0.3); }

/* ---- Loading spinner ---- */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Responsive for desktop preview ---- */
@media (min-width: 430px) {
  body { background: #050510; }
  #app { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}
