/* KnixKids App Styles - matches landing page design tokens */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,wght@0,400;0,500;0,600;1,400&display=swap');

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

:root {
  --coral: #FF6B6B;
  --sunshine: #FFD93D;
  --sky: #6BCB77;
  --ocean: #4D96FF;
  --purple: #9B59B6;
  --dark: #1a1a2e;
  --cream: #FFF8F0;
  --text: #2d2d3f;
  --coral-light: rgba(255, 107, 107, 0.1);
  --ocean-light: rgba(77, 150, 255, 0.1);
  --sky-light: rgba(107, 203, 119, 0.1);
  --sunshine-light: rgba(255, 217, 61, 0.1);
  --purple-light: rgba(155, 89, 182, 0.1);
}

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: var(--cream);
  overflow-x: hidden;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: 'Syne', sans-serif;
}

/* ===== NAV BAR ===== */
.app-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 248, 240, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 16px 5vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-nav .logo {
  font-family: 'Syne', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--dark);
  text-decoration: none;
}

.app-nav .logo span {
  background: linear-gradient(135deg, var(--coral), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-nav .nav-cta {
  background: var(--coral);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 30px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

.app-nav .nav-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255, 107, 107, 0.3);
}

/* ===== CREATE PAGE ===== */
.create-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 24px 60px;
  background: linear-gradient(135deg, #FFF8F0 0%, #FFE8D6 30%, #FFDDD2 60%, #FFE8F0 100%);
  position: relative;
}

.create-page::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -100px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255, 107, 107, 0.12) 0%, transparent 70%);
  border-radius: 50%;
}

.create-card {
  background: white;
  border-radius: 28px;
  padding: 56px 48px;
  max-width: 540px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.08);
  position: relative;
  z-index: 2;
}

.create-card h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--dark);
}

.create-card .subtitle {
  color: #888;
  font-size: 1.05rem;
  margin-bottom: 36px;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #eee;
  border-radius: 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  color: var(--text);
  background: #fafafa;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.1);
  background: white;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #bbb;
}

.form-group .hint {
  font-size: 0.8rem;
  color: #aaa;
  margin-top: 6px;
}

/* Interest tags */
.interest-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.interest-tag {
  padding: 8px 16px;
  border-radius: 20px;
  border: 2px solid #eee;
  background: white;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
}

.interest-tag:hover {
  border-color: var(--coral);
  background: var(--coral-light);
}

.interest-tag.selected {
  border-color: var(--coral);
  background: var(--coral);
  color: white;
}

/* Submit button */
.btn-generate {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--coral), #ff8a8a);
  color: white;
  border: none;
  border-radius: 16px;
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-top: 8px;
}

.btn-generate:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 107, 107, 0.35);
}

.btn-generate:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ===== LOADING STATE ===== */
.loading-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: linear-gradient(135deg, #FFF8F0 0%, #FFE8D6 30%, #FFDDD2 60%, #FFE8F0 100%);
  text-align: center;
}

.loading-book {
  width: 120px;
  height: 120px;
  margin-bottom: 32px;
  position: relative;
}

.loading-book .book-anim {
  width: 100%;
  height: 100%;
  animation: bookBounce 2s ease-in-out infinite;
}

@keyframes bookBounce {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-15px) rotate(2deg); }
}

.loading-page h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 12px;
}

.loading-status {
  font-size: 1.1rem;
  color: #888;
  margin-bottom: 32px;
  min-height: 28px;
}

.loading-progress {
  width: 280px;
  height: 6px;
  background: rgba(0,0,0,0.06);
  border-radius: 3px;
  overflow: hidden;
}

.loading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--coral), var(--sunshine), var(--sky));
  background-size: 200% 100%;
  border-radius: 3px;
  width: 10%;
  transition: width 0.8s ease;
  animation: shimmer 2s ease-in-out infinite;
}

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

/* ===== STORY PAGE ===== */
.story-page {
  padding-top: 72px;
  min-height: 100vh;
  background: var(--cream);
}

.story-header {
  text-align: center;
  padding: 60px 24px 40px;
  background: linear-gradient(135deg, #FFF8F0 0%, #FFE8D6 30%, #FFDDD2 60%, #FFE8F0 100%);
  position: relative;
}

.story-header::after {
  content: '';
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  background: var(--cream);
  border-radius: 50%;
}

.story-badge {
  display: inline-block;
  background: white;
  border: 2px solid var(--coral);
  color: var(--coral);
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.story-header h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  color: var(--dark);
  line-height: 1.1;
  max-width: 700px;
  margin: 0 auto 16px;
}

.story-meta {
  color: #888;
  font-size: 0.95rem;
}

.story-meta strong {
  color: var(--coral);
}

/* Scenes */
.story-scenes {
  max-width: 720px;
  margin: 0 auto;
  padding: 60px 24px 80px;
}

.scene {
  margin-bottom: 64px;
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
}

.scene:nth-child(1) { animation-delay: 0.1s; }
.scene:nth-child(2) { animation-delay: 0.2s; }
.scene:nth-child(3) { animation-delay: 0.3s; }
.scene:nth-child(4) { animation-delay: 0.4s; }
.scene:nth-child(5) { animation-delay: 0.5s; }

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

.scene-illustration {
  width: 100%;
  aspect-ratio: 16/10;
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 28px;
  position: relative;
  background: linear-gradient(135deg, var(--coral-light), var(--ocean-light));
}

.scene-illustration img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Fallback illustration when no image */
.scene-illustration-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  position: relative;
}

.scene:nth-child(1) .scene-illustration { background: linear-gradient(135deg, #FFE8D6, #FFDDD2); }
.scene:nth-child(2) .scene-illustration { background: linear-gradient(135deg, #D6F5E0, #B8E8D0); }
.scene:nth-child(3) .scene-illustration { background: linear-gradient(135deg, #D6E8FF, #B8D4FF); }
.scene:nth-child(4) .scene-illustration { background: linear-gradient(135deg, #FFE8F0, #FFDDE8); }
.scene:nth-child(5) .scene-illustration { background: linear-gradient(135deg, #FFF3D6, #FFE8B8); }

.scene-number {
  font-family: 'Syne', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--coral);
  margin-bottom: 8px;
}

.scene h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--dark);
}

.scene-text {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #555;
}

.scene-text p {
  margin-bottom: 14px;
}

/* Story moral */
.story-moral {
  text-align: center;
  padding: 48px 32px;
  background: white;
  border-radius: 24px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.04);
  margin-bottom: 48px;
  border: 2px solid rgba(255, 217, 61, 0.3);
}

.story-moral .moral-label {
  font-family: 'Syne', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sunshine);
  margin-bottom: 12px;
}

.story-moral p {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--dark);
  font-style: italic;
  line-height: 1.6;
}

/* Share section */
.story-share {
  text-align: center;
  padding: 32px;
  margin-bottom: 48px;
}

.story-share h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--dark);
}

.share-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.share-btn {
  padding: 12px 24px;
  border-radius: 14px;
  border: 2px solid #eee;
  background: white;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.share-btn:hover {
  border-color: var(--coral);
  background: var(--coral-light);
}

.share-btn.copied {
  border-color: var(--sky);
  background: var(--sky-light);
  color: var(--sky);
}

/* New story CTA */
.new-story-cta {
  text-align: center;
  padding-bottom: 80px;
}

.btn-new-story {
  display: inline-block;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--coral), #ff8a8a);
  color: white;
  border: none;
  border-radius: 14px;
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-new-story:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 107, 107, 0.35);
}

/* Error state */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  background: var(--cream);
}

.error-page h2 {
  font-size: 1.8rem;
  color: var(--dark);
  margin-bottom: 12px;
}

.error-page p {
  color: #888;
  margin-bottom: 24px;
  font-size: 1.05rem;
}

/* Footer */
.app-footer {
  padding: 32px 5vw;
  background: white;
  border-top: 1px solid #eee;
  text-align: center;
}

.app-footer p {
  font-size: 0.85rem;
  color: #999;
}

.app-footer .brand {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  color: var(--dark);
  font-size: 1rem;
  margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 768px) {
  .create-card {
    padding: 40px 28px;
    border-radius: 20px;
  }

  .create-card h1 {
    font-size: 1.6rem;
  }

  .story-scenes {
    padding: 40px 16px 60px;
  }

  .scene-illustration {
    border-radius: 16px;
  }

  .scene h2 {
    font-size: 1.3rem;
  }

  .scene-text {
    font-size: 1rem;
  }
}
