:root {
  --bg: #0b0d12;
  --bg-soft: #11141c;
  --panel: #161b26;
  --line: #232a3a;
  --text: #e7ebf3;
  --text-soft: #a3acc2;
  --muted: #6c7591;
  --brand: #7c5cff;
  --brand-2: #4f46e5;
  --accent: #22d3ee;
  --user: #2a3147;
  --bot: #1a2031;
  --success: #10b981;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 800px at 20% -10%, rgba(124, 92, 255, 0.25), transparent 60%),
    radial-gradient(900px 700px at 100% 0%, rgba(34, 211, 238, 0.15), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,0.02));
}

/* Header */
.header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(11, 13, 18, 0.7);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}
.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 4px 14px rgba(124, 92, 255, 0.4);
}
.logo-text {
  font-size: 16px;
  letter-spacing: 0.2px;
}
.progress-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 140px;
}
.progress-bar {
  width: 140px;
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  border-radius: 999px;
  transition: width 0.4s ease;
}
.progress-text {
  font-size: 12px;
  color: var(--muted);
}

/* Chat */
.chat {
  padding: 24px 20px 120px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.msg {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 100%;
  animation: slideUp 0.35s ease both;
}
.msg-user {
  justify-content: flex-end;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(124, 92, 255, 0.3);
}
.bubble {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.55;
  font-size: 15px;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.msg-bot .bubble {
  background: var(--bot);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.msg-user .bubble {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(124, 92, 255, 0.3);
}
.bubble-text strong { color: #fff; font-weight: 700; }
.bubble-text a { color: var(--accent); }
.msg-user .bubble-text strong { color: #fff; }

/* Typing dots */
.typing .bubble { padding: 14px 18px; display: inline-flex; gap: 4px; }
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1.4s infinite;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

/* Composer */
.composer {
  position: sticky;
  bottom: 0;
  background: rgba(11, 13, 18, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 14px 20px env(safe-area-inset-bottom, 14px);
  min-height: 72px;
}
.composer .input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.composer input[type="text"],
.composer input[type="email"],
.composer input[type="tel"],
.composer textarea {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: none;
  min-height: 48px;
  max-height: 140px;
}
.composer input:focus,
.composer textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.2);
}
.btn {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  border: none;
  border-radius: 14px;
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
  white-space: nowrap;
}
.btn:hover { box-shadow: 0 6px 20px rgba(124, 92, 255, 0.4); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: var(--panel);
  border: 1px solid var(--line);
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.choice {
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 15px;
  font-family: inherit;
  transition: all 0.15s;
}
.choice:hover {
  border-color: var(--brand);
  background: rgba(124, 92, 255, 0.1);
  transform: translateX(4px);
}
.choice:active { transform: scale(0.98); }

.error {
  color: #ff7a7a;
  font-size: 13px;
  margin-top: 6px;
}

.success-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(34, 211, 238, 0.1));
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 16px;
  padding: 20px;
  margin-top: 8px;
}
.success-card h3 {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 16px;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes blink {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

/* Mobile */
@media (max-width: 640px) {
  .header { padding: 14px 16px; }
  .logo-text { display: none; }
  .progress-bar { width: 110px; }
  .chat { padding: 16px 14px 100px; }
  .bubble { max-width: 85%; font-size: 14.5px; }
  .composer { padding: 10px 14px env(safe-area-inset-bottom, 10px); }
  .btn { padding: 14px 16px; }
}
