:root {
  --bg: #0b1020;
  --phone: #11162a;
  --bubble-me: #6c5ce7;
  --bubble-them: #1e2440;
  --accent: #6c5ce7;
  --accent-2: #00d2a8;
  --text: #eef1ff;
  --muted: #8b93b8;
  --line: #232a4a;
  --radius: 20px;
  --display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

.hidden { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow-x: hidden;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: radial-gradient(1200px 800px at 70% -10%, #1b2350 0%, var(--bg) 55%);
  color: var(--text);
}

/* ---- Split stage: app on the left, pitch on the right ---- */
.stage {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 44%) 1fr;
}
.app-side {
  display: grid;
  place-items: center;
  min-width: 0;        /* prevent grid blowout from the phone's width */
  padding: 24px;
}
.pitch-side {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 48px clamp(28px, 5vw, 80px);
  background:
    radial-gradient(700px 500px at 120% 0%, rgba(108,92,231,.18), transparent 60%),
    radial-gradient(600px 500px at 90% 110%, rgba(0,210,168,.12), transparent 60%);
}

/* ---- Pitch / landing copy ---- */
.pitch { max-width: 560px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -.4px;
  padding: 7px 14px 7px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.03);
}
.brand-mark { font-size: 20px; }
.headline {
  font-family: var(--display);
  font-size: clamp(44px, 6.4vw, 74px);
  line-height: 1.0;
  letter-spacing: -2px;
  margin: 26px 0 14px;
  font-weight: 700;
}
.headline .hl {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subhead {
  font-size: clamp(17px, 1.8vw, 20px);
  line-height: 1.5;
  color: #c4c9e8;
  margin: 0 0 30px;
  max-width: 30ch;
}

/* ---- Pitch carousel ---- */
.carousel {
  position: relative;
  overflow: hidden;
  margin: 0 0 30px;
  min-height: 92px;
}
.carousel-track {
  display: flex;
  transition: transform .55s cubic-bezier(.22, .61, .36, 1);
}
.cslide { min-width: 100%; padding: 2px; }
.cs-title {
  font-family: var(--display);
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 600;
  letter-spacing: -.4px;
  margin: 0 0 8px;
  color: #fff;
}
.cs-body { margin: 0; font-size: 16px; line-height: 1.55; color: #aab0d6; max-width: 42ch; }
.carousel-dots { display: flex; gap: 7px; margin-top: 18px; }
.dot {
  width: 7px; height: 7px;
  padding: 0;
  border: none;
  border-radius: 99px;
  background: var(--line);
  cursor: pointer;
  transition: width .25s ease, background .25s ease;
}
.dot.active { width: 22px; background: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .carousel-track { transition: none; }
}
.pitch-foot { margin-top: 4px; color: var(--text); font-size: 15px; font-weight: 600; }
.fineprint {
  margin: 18px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 46ch;
}

/* ---- Phone shell ---- */
.phone {
  width: 100%;
  max-width: 420px;
  height: min(820px, 90vh);
  background: var(--phone);
  border: 1px solid var(--line);
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
  position: relative;
}

/* ---- Top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(120deg, #1a2147, #161c38);
  border-bottom: 1px solid var(--line);
}
.avatar {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  font-size: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 50%;
}
.who .name { font-weight: 700; font-size: 16px; }
.who .status { font-size: 12px; color: var(--muted); }
.topbar .ghost-btn { margin-left: auto; }

.ghost-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 15px;
  cursor: pointer;
}
.ghost-btn:hover { color: var(--text); border-color: var(--accent); }
.ghost-btn.wide { flex: 1; }

/* ---- Thread ---- */
.thread {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px 8px;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
}
.thread::-webkit-scrollbar { width: 0; }

.msg {
  max-width: 74%;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;        /* keep full size; let the thread scroll instead */
  overflow: hidden;
  animation: pop .22s ease-out;
}
@keyframes pop {
  from { transform: translateY(8px) scale(.96); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.them { align-self: flex-start; align-items: flex-start; }

.msg .frame {
  padding: 5px;
  border-radius: var(--radius);
  background: var(--bubble-them);
  border: 1px solid var(--line);
}
.msg.me .frame { background: var(--bubble-me); border-color: transparent; }
.msg img {
  display: block;
  width: 100%;
  max-width: 260px;
  border-radius: 15px;
}
.msg .time { font-size: 10px; color: var(--muted); margin: 4px 6px 0; }

.empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.empty .big { font-size: 40px; display: block; margin-bottom: 10px; }
.empty .empty-title { display: block; color: var(--text); font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.empty .empty-sub { display: inline-block; font-size: 12.5px; color: #6c7299; }

/* typing indicator */
.typing .frame { padding: 14px 16px; }
.dots { display: inline-flex; gap: 4px; }
.dots i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
  animation: blink 1.2s infinite;
}
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* ---- Moderation toast ---- */
.toast {
  position: absolute;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  max-width: 86%;
  z-index: 30;
  background: #3a1726;
  border: 1px solid #7a2740;
  color: #ffd7e0;
  padding: 11px 16px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
  animation: toastIn .2s ease-out;
}
.toast.hidden { display: none; }
@keyframes toastIn {
  from { transform: translate(-50%, 10px); opacity: 0; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}

/* ---- Composer ---- */
.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: #0f1430;
}
.mode-toggle {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
}
.mode-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 38px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  cursor: pointer;
  transition: color .12s ease, background .12s ease, transform .08s ease;
}
.mode-btn .ic { width: 22px; height: 22px; }
.mode-btn.active { background: var(--accent); color: #fff; }
.mode-btn:active { transform: scale(.9); }
.gif-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .5px;
  line-height: 1;
  padding: 2px 4px;
  border: 1.7px solid currentColor;
  border-radius: 5px;
}

.composer-input {
  flex: 1;
  min-width: 0;
  padding: 13px 15px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  font-size: 15px;
}
.composer-input:focus { outline: none; border-color: var(--accent); }

.composer-send {
  width: 46px; height: 46px;
  flex: none;
  display: grid; place-items: center;
  border: none;
  border-radius: 14px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transition: transform .08s ease;
}
.composer-send svg { width: 21px; height: 21px; }
.composer-send:active { transform: scale(.92); }

/* ---- Bottom sheet ---- */
.sheet { position: absolute; inset: 0; z-index: 20; }
.sheet.hidden { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.sheet-body {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 88%;
  background: var(--phone);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  animation: slideUp .25s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-grip {
  width: 44px; height: 5px; border-radius: 3px;
  background: var(--line);
  margin: 10px auto 4px;
  cursor: pointer;
}

.panel { padding: 6px 16px 20px; overflow-y: auto; }
.panel.hidden { display: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head h2 { font-size: 17px; margin: 6px 0; }

.seg { display: flex; background: #0f1430; border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg-btn {
  border: none; background: transparent; color: var(--muted);
  padding: 7px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.seg-btn.active { background: var(--accent); color: #fff; }

/* template grid */
.template-grid, .gif-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.template-grid img, .gif-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  cursor: pointer;
  background: #0f1430;
  transition: transform .1s ease, border-color .1s ease;
}
.template-grid img:hover, .gif-grid img:hover { transform: scale(1.04); border-color: var(--accent); }

/* editor */
.meme-editor.hidden { display: none; }
.preview-wrap { display: grid; place-items: center; margin-bottom: 12px; }
.meme-preview {
  max-width: 100%;
  max-height: 320px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #0f1430;
}
.text-inputs { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.text-inputs input {
  width: 100%;
  padding: 12px 14px;
  background: #0f1430;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
}
.text-inputs input:focus { outline: none; border-color: var(--accent); }

.editor-actions { display: flex; gap: 10px; }
.send-btn {
  flex: 2;
  padding: 13px;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.send-btn:active { transform: scale(.98); }

/* gif search */
.gif-searchbar { margin-bottom: 12px; }
.gif-searchbar input {
  width: 100%;
  padding: 13px 16px;
  background: #0f1430;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  font-size: 15px;
}
.gif-searchbar input:focus { outline: none; border-color: var(--accent-2); }
.grid-status { text-align: center; color: var(--muted); font-size: 13px; padding: 14px; }

.spinner {
  width: 22px; height: 22px; margin: 18px auto;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Ephemeral message fade-out ---- */
.msg {
  transition: opacity .45s ease, transform .45s ease,
              max-height .45s ease, margin-bottom .45s ease;
}
.msg.leaving {
  opacity: 0;
  transform: scale(.9);
  max-height: 0 !important;   /* JS sets a px start value so this animates */
  margin-bottom: 0;
  pointer-events: none;
}

/* ---- Live Demo badge (above the phone) ---- */
.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 7px 14px;
  background: rgba(0, 210, 168, .10);
  border: 1px solid rgba(0, 210, 168, .35);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text);
  max-width: 100%;
}
.demo-badge .demo-badge-sub { color: var(--muted); font-weight: 500; }
.pulse {
  width: 9px; height: 9px; flex: none;
  border-radius: 50%;
  background: #22e0b0;
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 224, 176, .55); }
  70%  { box-shadow: 0 0 0 8px rgba(34, 224, 176, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 224, 176, 0); }
}

/* ---- Hero CTA pointing at the demo ---- */
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 28px;
  padding: 11px 16px;
  background: rgba(108, 92, 231, .12);
  border: 1px solid rgba(108, 92, 231, .4);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background .15s ease, transform .08s ease;
}
.hero-cta:hover { background: rgba(108, 92, 231, .22); }
.hero-cta:active { transform: scale(.98); }
.hero-cta-arrow { font-size: 18px; display: inline-block; animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-4px); } }

/* ---- Example situation chips (above composer) ---- */
.chips {
  display: flex;
  gap: 8px;
  padding: 10px 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  white-space: nowrap;
  padding: 8px 13px;
  border-radius: 999px;
  background: #0f1430;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color .12s ease, transform .08s ease;
}
.chip:hover { border-color: var(--accent); }
.chip:active { transform: scale(.96); }

/* ---- Situation prompt bubble (what the user described) ---- */
.msg.prompt { align-self: flex-end; align-items: flex-end; }
.msg.prompt .ptext {
  background: var(--bubble-me);
  color: #fff;
  padding: 9px 13px;
  border-radius: 16px 16px 4px 16px;
  font-size: 13.5px;
  line-height: 1.4;
}

/* ---- "Detected" interpretation row ---- */
.detect {
  align-self: flex-start;
  max-width: 88%;
  margin-bottom: 12px;
  flex-shrink: 0;
  background: var(--bubble-them);
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 4px;
  padding: 11px 13px;
  animation: pop .22s ease-out;
}
.detect-label { font-size: 10.5px; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .6px; }
.detect-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.detect-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(108, 92, 231, .16);
  border: 1px solid rgba(108, 92, 231, .35);
  font-size: 12px; font-weight: 600; color: var(--text);
}

/* ---- Feedback row ---- */
.feedback { align-self: flex-start; max-width: 88%; margin-bottom: 12px; flex-shrink: 0; }
.feedback-q { font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.fb-btns { display: flex; gap: 7px; flex-wrap: wrap; }
.fb-btn {
  padding: 7px 11px; border-radius: 10px; cursor: pointer;
  background: #0f1430; border: 1px solid var(--line); color: var(--text); font-size: 12.5px;
  transition: border-color .12s ease, transform .08s ease;
}
.fb-btn:hover { border-color: var(--accent); }
.fb-btn:active { transform: scale(.95); }
.fb-btn.chosen { border-color: var(--accent-2); background: rgba(0, 210, 168, .14); }
.fb-extra { margin-top: 8px; display: flex; gap: 6px; }
.fb-extra input {
  flex: 1; padding: 9px 11px; border-radius: 10px;
  background: #0f1430; border: 1px solid var(--line); color: var(--text); font-size: 12.5px;
}
.fb-extra input:focus { outline: none; border-color: var(--accent); }
.fb-done { margin-top: 7px; font-size: 12px; color: var(--accent-2); }

/* ---- Validation survey (non-blocking, bottom-right) ---- */
.survey-card {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  z-index: 60;
  background: var(--phone);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 18px 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
  animation: slideUp .3s ease-out;
}
.survey-close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; color: var(--muted);
  font-size: 20px; line-height: 1; cursor: pointer;
}
.survey-close:hover { color: var(--text); }
.survey-title { font-family: var(--display); font-weight: 700; font-size: 17px; margin-bottom: 10px; }
.survey-q { font-size: 13px; color: var(--text); font-weight: 600; margin: 14px 0 8px; }
.survey-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.survey-opt {
  padding: 7px 11px; border-radius: 999px; cursor: pointer;
  background: #0f1430; border: 1px solid var(--line); color: var(--text); font-size: 12.5px;
  transition: border-color .12s ease, background .12s ease;
}
.survey-opt:hover { border-color: var(--accent); }
.survey-opt.chosen { border-color: var(--accent-2); background: rgba(0, 210, 168, .15); }
.survey-checks { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.survey-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text); cursor: pointer; }
.survey-check input { accent-color: var(--accent); }
.survey-email {
  width: 100%; margin-top: 14px; padding: 10px 12px;
  background: #0f1430; border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-size: 13px;
}
.survey-email:focus { outline: none; border-color: var(--accent); }
.survey-submit {
  width: 100%; margin-top: 12px; padding: 11px;
  border: none; border-radius: 12px; cursor: pointer;
  font-size: 14px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.survey-submit:active { transform: scale(.98); }
.survey-thanks { padding: 18px 6px; text-align: center; font-size: 15px; font-weight: 600; color: var(--accent-2); }

/* ---- Responsive: stack to one column ---- */
@media (max-width: 900px) {
  .stage { grid-template-columns: 1fr; }
  /* lead with the pitch (what it is), then the demo below */
  .pitch-side { order: 1; padding: 32px 22px 18px; }
  .app-side { order: 2; padding: 0 0 36px; }
  .pitch { max-width: 640px; margin: 0 auto; }
  .phone { width: calc(100vw - 24px); max-width: 460px; height: min(760px, 86vh); }
  /* app sits below the pitch on mobile -> point the CTA arrow down */
  .hero-cta-arrow { transform: rotate(-90deg); animation: none; }
}
