@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --primary-accent: #ff60a0;
  --secondary-accent: #8b5cf6; /* Lavender */
  --success-accent: #10b981; /* Mint */
  --bg-main: #fff0f5; /* Soft Pimsy Pink */
  --text-main: #0f172a; /* Deep Slate 900 */
  --text-muted: #64748b;
  --glass-bg: rgba(255, 255, 255, 0.5);
  --glass-border: rgba(255, 255, 255, 0.3);
}

body {
  margin: 0;
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(255, 96, 160, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--text-main);
  position: relative;
}

/* Subtle noise texture overlay */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.025;
  pointer-events: none;
  z-index: 10000;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 96, 160, 0.2);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 96, 160, 0.4);
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding: 0 12px 0;
  max-width: 1020px;
  width: 100%;
  margin: 0 auto;
  overflow-x: hidden;
  overflow-y: visible;
  position: relative;
  box-sizing: border-box;
}

/* On mobile, reserve space at the bottom for the fixed input bar.
   Use 100svh so the app height does NOT shrink when keyboard opens. */
@media (max-width: 640px) {
  .app {
    height: 100svh;
    padding: 0;
    overflow: hidden; /* Prevent body scroll */
  }

  .app-character {
    position: relative; /* Not fixed, just part of the flex */
    height: 45svh;
    flex: none;
    z-index: 10;
  }

  .app-chat {
    height: 55svh;
    margin-top: 0;
    max-height: 55svh;
    display: flex;
    flex-direction: column;
    background: transparent;
    overflow: visible; /* Allow floating elements to show */
  }

  /* When chat is hidden, let character fill space so input bar stays at bottom */
  .app-chat-hidden .app-character {
    height: auto;
    flex: 1;
  }
  .app-chat-hidden .app-chat {
    height: auto;
    max-height: none;
    flex: none;
  }
}

/* ── Character area ──────────────────────────────────────────────────────── */
.app-character {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1rem 0;
  flex-shrink: 0;
  border-radius: 12px 12px 0 0;
  overflow: visible;
  transition: flex 0.4s ease, justify-content 0.4s ease, padding 0.4s ease;
  /* Pimsy is the star — give her enough space but allow balance with chat */
  flex: 1 1 auto;
  min-height: 120px; 
  max-height: none;
  animation: pimsyFloat 6s ease-in-out infinite;
}

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

/* ── Chat area ───────────────────────────────────────────────────────────── */
.app-chat {
  display: flex;
  flex-direction: column;
  /* Chat is secondary — cap it so Pimsy stays dominant */
  max-height: 55vh;
  min-height: 0;
  overflow: visible;
  flex: 1 1 auto;
  flex-shrink: 0; 
  z-index: 50;
  background: transparent;
  margin-top: 0;
}

@media (max-width: 640px) {
  .app-chat {
    height: 55svh;
    max-height: 55svh;
    padding-bottom: 0;
    margin-top: 0;
  }
}

/* ── Chat toggle pill ────────────────────────────────────────────────────── */
.chat-toggle-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 5px 14px 5px 10px;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: background 0.2s ease, transform 0.15s ease;
  width: fit-content;
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 100;
}

.chat-toggle-pill:active {
  transform: scale(0.96);
}

.chat-toggle-pill-on {
  background: rgba(100, 116, 139, 0.08);
  color: #475569;
  border: 1.5px solid rgba(100, 116, 139, 0.18);
}

.chat-toggle-pill-off {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  color: white;
  border: 1.5px solid transparent;
  box-shadow: 0 2px 10px rgba(148, 163, 184, 0.25);
}

.toggle-track {
  width: 32px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  padding: 2px;
  transition: background 0.2s ease;
}

.toggle-track-on {
  background: rgba(100, 116, 139, 0.25);
}

.toggle-track-off {
  background: rgba(255, 255, 255, 0.35);
}

/* toggle thumb */
.toggle-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease;
}

.toggle-track-on .toggle-thumb {
  transform: translateX(14px);
}

.toggle-track-off .toggle-thumb {
  transform: translateX(0);
}

/* ── Start Overlay ───────────────────────────────────────────────────────── */
.start-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.start-card {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  padding: 3rem;
  border-radius: 32px;
  text-align: center;
  box-shadow: 
    0 20px 50px rgba(255, 120, 180, 0.1), 
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.5);
  max-width: 380px;
  width: 90%;
  animation: cardAppear 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

@keyframes cardAppear {
  from { opacity: 0; transform: translateY(40px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.start-card h1 {
  margin: 0 0 0.75rem;
  font-size: 1.8rem;
  background: linear-gradient(135deg, #ff60a0, #ff80b0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

.start-card p {
  margin: 0 0 2.5rem;
  font-size: 1.1rem;
  color: #475569;
  line-height: 1.5;
}

.start-button {
  background: linear-gradient(135deg, #ff80b0 0%, #ff60a0 100%);
  color: white;
  border: none;
  padding: 16px 48px;
  border-radius: 50px;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(255, 96, 160, 0.4);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.start-button::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.start-button:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 15px 40px rgba(255, 96, 160, 0.5);
}

.start-button:hover::after {
  opacity: 1;
}

.start-button:active {
  transform: translateY(1px) scale(0.98);
}

/* ══════════════════════════════════════════════════════════════════════════════
   EASTER EGG 2 — UFO Fly-by (Lottie version)
══════════════════════════════════════════════════════════════════════════════ */
@keyframes ufo-fly {
  0%   { transform: translateX(-150px) translateY(0px)   rotate(-6deg); opacity: 0; }
  6%   { opacity: 1; }
  30%  { transform: translateX(25vw)  translateY(-15px)  rotate(2deg);  }
  55%  { transform: translateX(50vw)  translateY(10px)   rotate(-3deg); }
  80%  { transform: translateX(75vw)  translateY(-10px)  rotate(2deg);  }
  94%  { opacity: 1; }
  100% { transform: translateX(110vw) translateY(0px)    rotate(6deg);  opacity: 0; }
}

@keyframes ufo-fly-vert {
  0%   { transform: translateY(-150px) translateX(0px)   rotate(84deg); opacity: 0; }
  6%   { opacity: 1; }
  30%  { transform: translateY(25vh)  translateX(-15px)  rotate(92deg);  }
  55%  { transform: translateY(50vh)  translateX(10px)   rotate(87deg); }
  80%  { transform: translateY(75vh)  translateX(-10px)  rotate(92deg);  }
  94%  { opacity: 1; }
  100% { transform: translateY(110vh) translateX(0px)    rotate(96deg);  opacity: 0; }
}

.ufo-flyby.ufo-horiz {
  animation: ufo-fly 4.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.ufo-flyby.ufo-vert {
  animation: ufo-fly-vert 4.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.ufo-flyby {
  position: fixed;
  z-index: 500;
  pointer-events: none;
  will-change: transform;
  filter: drop-shadow(0 4px 16px rgba(139, 92, 246, 0.5));
}

@media (max-width: 640px) {
  .ufo-flyby {
    transform: scale(0.6); /* Smaller UFO on mobile */
  }
  
  .ufo-flyby div {
    width: 180px !important;
    height: 180px !important;
  }
}