* {
  box-sizing: border-box;
}

:root {
  --bg-1: #0f0b16;
  --bg-2: #120d1f;
  --bg-3: #0b0812;

  --card: rgba(20, 14, 31, 0.86);
  --card-strong: rgba(24, 17, 38, 0.94);
  --card-soft: rgba(255, 255, 255, 0.04);

  --white: #fff7fd;
  --white-90: rgba(255, 247, 253, 0.9);
  --white-75: rgba(255, 247, 253, 0.75);
  --white-65: rgba(255, 247, 253, 0.65);
  --white-50: rgba(255, 247, 253, 0.5);
  --white-35: rgba(255, 247, 253, 0.35);
  --white-18: rgba(255, 247, 253, 0.18);
  --white-10: rgba(255, 247, 253, 0.1);
  --white-08: rgba(255, 247, 253, 0.08);
  --white-06: rgba(255, 247, 253, 0.06);

  --pink: #ff4fc8;
  --pink-2: #ff4fa3;
  --purple: #b845ff;
  --purple-2: #c15cff;
  --green: #40d97a;
  --gold: #f0c27f;

  --accent: linear-gradient(135deg, #ff4fa3, #c15cff);
  --accent-soft: linear-gradient(135deg, rgba(255, 79, 163, 0.18), rgba(193, 92, 255, 0.12));

  --shadow-card: 0 25px 90px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 10px 26px rgba(193, 92, 255, 0.35);
  --shadow-glow-strong: 0 14px 36px rgba(193, 92, 255, 0.5);

  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(255, 105, 180, 0.2), transparent 30%),
    radial-gradient(circle at bottom, rgba(167, 139, 250, 0.18), transparent 25%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 45%, var(--bg-3) 100%);
  color: var(--white);
  min-height: 100vh;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: pageFade 0.7s ease;
}

.app-shell {
  width: 100%;
  display: flex;
  justify-content: center;
}

.phone-frame {
  width: 100%;
  max-width: 430px;
}

.chat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: min(92vh, 920px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--card);
  backdrop-filter: blur(24px);
  box-shadow:
    var(--shadow-card),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: cardRise 0.75s ease;
}

/* TOPBAR */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--white-06);
  background: rgba(255, 255, 255, 0.02);
  z-index: 3;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-wrap {
  position: relative;
  width: 48px;
  height: 48px;
}

.avatar {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.12);
}

.online-dot {
  position: absolute;
  right: 1px;
  bottom: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid #1a1228;
  box-shadow: 0 0 0 0 rgba(64, 217, 122, 0.35);
  animation: onlinePulse 1.7s infinite;
}

.topbar-text h1 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-text p {
  margin: 4px 0 0;
  color: #bdaed3;
  font-size: 0.84rem;
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.topbar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

/* LANGUAGE SWITCH */
.lang-switch {
  display: flex;
  gap: 4px;
}

.lang-switch button {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.85);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(6px);
}

.lang-switch button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.lang-switch button.active {
  background: var(--accent);
  border: none;
  color: white;
  box-shadow: 0 4px 12px rgba(255, 79, 200, 0.3);
}

/* CHEMISTRY */
.chemistry-wrap {
  padding: 12px 14px 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01));
  border-bottom: 1px solid var(--white-06);
}

.chemistry-card {
  padding: 14px 14px 12px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 8px 24px rgba(0, 0, 0, 0.18);
}

.chemistry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.chemistry-label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f1b4dd;
}

.chemistry-value {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--white);
}

.chemistry-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  position: relative;
}

.chemistry-fill {
  width: 12%;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  box-shadow:
    0 0 18px rgba(255, 79, 163, 0.45),
    0 0 28px rgba(193, 92, 255, 0.28);
  transition: width 0.45s ease;
}

.chemistry-subline {
  margin-top: 10px;
  min-height: 18px;
  font-size: 0.82rem;
  color: #dbcde9;
  line-height: 1.35;
}

.unlock-milestones {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.milestone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 7px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #b9abc9;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.24s ease;
}

.milestone.active {
  color: white;
  background: var(--accent-soft);
  border-color: rgba(255, 79, 163, 0.24);
  box-shadow: 0 0 16px rgba(255, 79, 163, 0.14);
}

/* INTRO - HIDDEN */
.intro-card {
  display: none;
}

.intro-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 120, 190, 0.2), transparent 60%);
  pointer-events: none;
  animation: glowPulse 2.5s infinite;
}

.hero {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 20%;
  display: block;
  filter: saturate(1.06);
}

.intro-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      180deg,
      rgba(11, 8, 18, 0.10) 0%,
      rgba(11, 8, 18, 0.30) 35%,
      rgba(11, 8, 18, 0.90) 100%
    );
}

.intro-content {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 10px;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 5px;
  color: #f1b4dd;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.intro-content h2 {
  margin: 0 0 4px;
  font-size: 0.84rem;
  line-height: 1.25;
  font-weight: 800;
  color: var(--white);
  max-width: 92%;
}

.intro-subtext {
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.3;
  color: #dbcde9;
  max-width: 92%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* CHAT */
.chat {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015) 0%, rgba(255, 255, 255, 0) 100%);
}

.chat::-webkit-scrollbar {
  width: 8px;
}

.chat::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.date-divider {
  display: flex;
  justify-content: center;
  margin: 0 0 6px;
}

.date-divider span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  color: #b9abc9;
  background: rgba(255, 255, 255, 0.05);
}

.message {
  max-width: 78%;
  padding: 12px 14px;
  border-radius: 18px;
  line-height: 1.45;
  font-size: 0.96rem;
  word-wrap: break-word;
  white-space: pre-wrap;
  animation: bubbleIn 0.28s ease;
  transition: transform 0.12s ease;
}

.message:hover {
  transform: translateY(-1px);
}

.message.ai {
  align-self: flex-start;
  border-bottom-left-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.06));
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.message.user {
  align-self: flex-end;
  border-bottom-right-radius: 8px;
  background: var(--accent);
  color: white;
  box-shadow: 0 10px 24px rgba(193, 92, 255, 0.22);
}

.message.has-image {
  padding: 10px;
}

.chat-image {
  display: block;
  width: 100%;
  max-width: 220px;
  border-radius: 14px;
  margin-bottom: 8px;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  cursor: zoom-in;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.chat-image:hover {
  transform: scale(1.02);
  opacity: 0.98;
}

.image-caption {
  margin-top: 4px;
  line-height: 1.4;
}

/* PHOTO BUTTON */
.photo-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.18s ease, transform 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.photo-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* PHOTO PAYWALL */
.photo-paywall {
  margin-top: 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 79, 163, 0.18), rgba(193, 92, 255, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px;
  animation: paywallFade 0.3s ease;
}

.photo-paywall-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.photo-paywall-lock {
  font-size: 1.6rem;
}

.photo-paywall-text {
  font-size: 0.92rem;
  color: var(--white);
  line-height: 1.5;
}

/* TYPING INDICATOR */
.message.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
  width: auto;
  min-width: 64px;
  max-width: 80px;
  min-height: unset;
  height: auto;
  white-space: normal;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--white-75);
  opacity: 0.5;
  flex-shrink: 0;
  animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* BOTTOM */
.bottom-area {
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
}

.status {
  min-height: 18px;
  margin: 0 2px 10px;
  color: #b9abc9;
  font-size: 0.82rem;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.input-row input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--white);
  font-size: 0.98rem;
}

.input-row input::placeholder {
  color: #a594ba;
}

.input-row button {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  color: white;
  font-size: 1rem;
  background: var(--accent);
  box-shadow: 0 8px 22px rgba(193, 92, 255, 0.28);
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.input-row button:hover {
  transform: translateY(-1px);
}

.input-row button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* PAYWALL */
.paywall {
  display: none;
  margin-top: 12px;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(
    180deg,
    rgba(255, 79, 163, 0.22),
    rgba(193, 92, 255, 0.16)
  );
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 10px 40px rgba(193, 92, 255, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: paywallFade 0.4s ease;
}

.paywall-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.paywall-text {
  margin-bottom: 12px;
}

.paywall-title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff4fb;
}

.paywall-subtitle {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #e4d7f1;
}

.paywall-benefits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 12px;
  color: #f6eafb;
  font-size: 0.82rem;
  font-weight: 600;
}

.unlock-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border-radius: 16px;
  padding: 15px 16px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: white;
  text-decoration: none;
  background: var(--accent);
  box-shadow:
    var(--shadow-glow),
    0 0 0 rgba(255, 79, 163, 0);
  transition: transform 0.16s ease, box-shadow 0.2s ease;
  animation: ctaPulse 2.4s infinite;
}

.unlock-link:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    var(--shadow-glow-strong),
    0 0 18px rgba(255, 79, 163, 0.35);
}

.paywall-note {
  margin-top: 10px;
  font-size: 0.78rem;
  text-align: center;
  color: #cbbbe0;
  opacity: 0.9;
}

/* IMAGE MODAL */
.image-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 6, 18, 0.92);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.image-modal.visible {
  opacity: 1;
}

.image-modal-img {
  max-width: min(92vw, 560px);
  max-height: 88vh;
  border-radius: 20px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
  animation: zoomIn 0.25s ease;
}

.image-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}

.image-modal-close:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.04);
}

/* ANIMATIONS */
@keyframes pageFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cardRise {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@keyframes glowPulse {
  0% { opacity: 0.35; }
  50% { opacity: 0.75; }
  100% { opacity: 0.35; }
}

@keyframes paywallFade {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ctaPulse {
  0% {
    box-shadow:
      0 10px 26px rgba(193, 92, 255, 0.35),
      0 0 0 rgba(255, 79, 163, 0);
  }
  50% {
    box-shadow:
      0 12px 32px rgba(193, 92, 255, 0.45),
      0 0 22px rgba(255, 79, 163, 0.35);
  }
  100% {
    box-shadow:
      0 10px 26px rgba(193, 92, 255, 0.35),
      0 0 0 rgba(255, 79, 163, 0);
  }
}

@keyframes zoomIn {
  from {
    transform: scale(0.92);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes onlinePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(64, 217, 122, 0.35);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(64, 217, 122, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(64, 217, 122, 0);
  }
}

/* MOBILE */
@media (max-width: 520px) {
  body {
    padding: 0;
  }

  .phone-frame {
    max-width: 100%;
  }

  .chat-card {
    height: 100vh;
    border-radius: 0;
    border: 0;
  }

  .topbar {
    padding: 14px 14px 12px;
  }

  .chemistry-wrap {
    padding: 10px 12px;
  }

  .unlock-milestones {
    grid-template-columns: repeat(2, 1fr);
  }

  .intro-card {
    display: none;
  }

  .hero {
    object-position: 50% 17%;
  }

  .intro-content {
    left: 14px;
    right: 14px;
    bottom: 8px;
  }

  .eyebrow {
    font-size: 0.54rem;
    margin-bottom: 4px;
  }

  .intro-content h2 {
    max-width: 100%;
    font-size: 0.78rem;
    margin-bottom: 3px;
    line-height: 1.2;
  }

  .intro-subtext {
    font-size: 0.64rem;
    max-width: 100%;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .message {
    max-width: 86%;
  }

  .chat-image {
    max-width: 200px;
  }

  .paywall-benefits {
    flex-direction: column;
    gap: 6px;
  }

  .image-modal {
    padding: 16px;
  }

  .image-modal-img {
    max-width: 96vw;
    max-height: 84vh;
    border-radius: 16px;
  }
}

/* EMAIL LOGIN MODAL */
.email-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(7, 7, 12, 0.92);
  backdrop-filter: blur(12px);
}

.email-modal.visible {
  display: flex;
}

.email-modal-inner {
  width: 100%;
  max-width: 360px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid rgba(255, 79, 163, 0.2);
  border-radius: 28px;
  padding: 36px 28px;
  text-align: center;
  box-shadow: 0 20px 80px rgba(0,0,0,0.5), 0 0 40px rgba(255,79,163,0.1);
  animation: cardRise 0.4s ease;
}

.email-modal-icon {
  font-size: 2.4rem;
  margin-bottom: 14px;
}

.email-modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 8px;
  font-family: inherit;
  letter-spacing: -0.01em;
}

.email-modal-sub {
  font-size: 0.88rem;
  color: var(--white-50);
  margin-bottom: 22px;
  line-height: 1.5;
}

.email-modal-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--white-18);
  background: rgba(255,255,255,0.06);
  color: var(--white);
  font-size: 0.96rem;
  outline: none;
  margin-bottom: 12px;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.email-modal-input:focus {
  border-color: rgba(255, 79, 163, 0.5);
}

.email-modal-input::placeholder {
  color: var(--white-35);
}

.email-modal-btn {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #ff4fa3, #c15cff);
  color: white;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.16s ease, opacity 0.16s ease;
  box-shadow: 0 8px 24px rgba(255, 79, 163, 0.3);
}

.email-modal-btn:hover {
  transform: translateY(-1px);
}

.email-modal-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.email-modal-error {
  margin-top: 10px;
  font-size: 0.84rem;
  color: #ff6b9d;
  line-height: 1.4;
}

.email-modal-skip {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--white-35);
  cursor: pointer;
  transition: color 0.2s ease;
}

.email-modal-skip:hover {
  color: var(--white-65);
}
