:root {
  --bg-primary: #0b0f19;
  --bg-surface: #111827;
  --bg-elevated: #1a2234;
  --border: #1f2d42;
  --border-light: #263450;
  --text-primary: #e5e7eb;
  --text-secondary: #8896ab;
  --text-muted: #4b5e78;
  --accent: #c8a04e;
  --accent-hover: #dab55e;
  --accent-muted: rgba(200, 160, 78, 0.15);
  --accent-subtle: rgba(200, 160, 78, 0.08);
  --error: #e05252;
  --error-bg: #1c0f0f;
  --error-border: #3a1515;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

/* ── NAV ── */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-logo {
  font-size: 18px;
  color: var(--accent);
}

.nav-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.nav-title-light {
  font-weight: 400;
  color: var(--accent);
}

.nav-cta {
  padding: 8px 20px;
  background: var(--accent);
  color: var(--bg-primary);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.nav-cta:hover {
  background: var(--accent-hover);
  color: var(--bg-primary);
  transform: translateY(-1px);
}

/* ── HERO ── */

.hero {
  padding-top: 140px;
  padding-bottom: 80px;
  text-align: center;
  background: radial-gradient(ellipse 80% 50% at 50% -20%, var(--accent-subtle), transparent);
}

.hero-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px;
}

.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.5px;
  margin-bottom: 32px;
  background: var(--accent-subtle);
}

.hero-title {
  font-size: 52px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -2px;
  color: var(--text-primary);
  margin-bottom: 24px;
}

.hero-title-accent {
  color: var(--accent);
}

.hero-desc {
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 40px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 40px;
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: -0.2px;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--bg-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(200, 160, 78, 0.2);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary svg {
  transition: transform 0.2s ease;
}

.btn-primary:hover svg {
  transform: translateX(3px);
}

.hero-note {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── FEATURES ── */

.features {
  padding: 80px 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.features-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.section-title {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.section-sub {
  text-align: center;
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 48px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.feature-card {
  padding: 28px 24px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(20px);
}

.feature-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.feature-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 28px;
  color: var(--accent);
  margin-bottom: 16px;
  opacity: 0.7;
}

.feature-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.2px;
}

.feature-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── HOW IT WORKS ── */

.how-it-works {
  padding: 80px 24px;
}

.how-inner {
  max-width: 900px;
  margin: 0 auto;
}

.steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  margin-top: 48px;
}

.step {
  text-align: center;
  flex: 1;
  padding: 0 24px;
}

.step-num {
  font-size: 36px;
  font-weight: 800;
  color: var(--accent);
  opacity: 0.4;
  margin-bottom: 16px;
  letter-spacing: -1px;
}

.step h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.step p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.step-divider {
  width: 48px;
  height: 1px;
  background: var(--border);
  margin-top: 32px;
  flex-shrink: 0;
}

/* ── DISCLAIMER ── */

.disclaimer {
  padding: 40px 24px;
  background: var(--accent-subtle);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.disclaimer-inner {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.disclaimer-icon {
  font-size: 22px;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
}

.disclaimer p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.disclaimer strong {
  color: var(--accent);
}

/* ── FOOTER ── */

.footer {
  padding: 32px 24px;
  text-align: center;
}

.footer p {
  font-size: 12px;
  color: var(--text-muted);
}

.footer a {
  color: var(--text-muted);
  transition: color 0.2s;
}

.footer a:hover {
  color: var(--accent);
}

/* ── CHAT LAYOUT ── */

.chat-app {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.chat-header {
  background: var(--bg-surface);
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.chat-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  flex-shrink: 0;
  transition: all 0.15s;
}

.chat-back:hover {
  background: var(--bg-elevated);
  color: var(--accent);
  border-color: var(--accent-muted);
}

.chat-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-title-light {
  font-weight: 400;
  color: var(--accent);
}

.chat-title-logo {
  color: var(--accent);
  font-size: 16px;
}

.chat-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.chat-new-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-new-btn:hover {
  background: var(--bg-elevated);
  color: var(--accent);
  border-color: var(--accent-muted);
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg-primary);
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── CHAT MESSAGES ── */

.chat-msg {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 10px;
  line-height: 1.5;
  animation: msgIn 0.25s ease;
}

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

.chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--bg-primary);
  border-bottom-right-radius: 3px;
  font-weight: 500;
}

.chat-msg.assistant {
  align-self: flex-start;
  background: var(--bg-surface);
  color: #cdd5e0;
  border-bottom-left-radius: 3px;
  border: 1px solid var(--border);
}

.chat-msg.welcome {
  align-self: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-align: center;
  max-width: 85%;
}

.chat-msg.error {
  align-self: flex-start;
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-border);
}

.chat-msg p {
  margin-bottom: 6px;
  font-size: 14px;
}

.chat-msg p:last-child {
  margin-bottom: 0;
}

.chat-msg ul,
.chat-msg ol {
  margin-left: 18px;
  margin-bottom: 6px;
  font-size: 14px;
}

/* ── MARKDOWN BODY ── */

.markdown-body {
  font-size: 14px;
  line-height: 1.7;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin-top: 14px;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
}

.markdown-body h2 {
  font-size: 16px;
}

.markdown-body h3 {
  font-size: 15px;
}

.markdown-body p {
  margin-bottom: 8px;
}

.markdown-body p:last-child {
  margin-bottom: 0;
}

.markdown-body strong {
  font-weight: 600;
  color: var(--accent);
}

.markdown-body ul,
.markdown-body ol {
  margin-left: 20px;
  margin-bottom: 8px;
}

.markdown-body li {
  margin-bottom: 4px;
}

.markdown-body code {
  background: var(--bg-primary);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 13px;
  color: var(--accent);
}

.markdown-body pre {
  background: var(--bg-primary);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 8px;
  font-size: 13px;
  border: 1px solid var(--border);
}

.markdown-body pre code {
  background: none;
  padding: 0;
  color: #b0b8c8;
}

.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  margin: 8px 0;
  color: var(--text-secondary);
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

/* ── SOURCES ── */

.source-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
  font-style: italic;
}

.source-list {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.source-item {
  font-size: 11px;
  color: var(--text-muted);
  padding: 3px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.source-item::before {
  content: '•';
  color: var(--accent);
}

/* ── LOADING ── */

.chat-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  color: var(--text-muted);
  font-size: 13px;
}

.chat-loading.hidden {
  display: none;
}

.chat-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── INPUT AREA ── */

.chat-input-area {
  padding: 16px 20px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
}

#chat-form {
  display: flex;
  gap: 8px;
}

#message-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.15s;
  background: var(--bg-primary);
  color: var(--text-primary);
}

#message-input:focus {
  border-color: var(--accent);
  background: var(--bg-elevated);
}

#message-input::placeholder {
  color: var(--text-muted);
}

#send-btn {
  padding: 12px 22px;
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

#send-btn:hover {
  background: var(--accent-hover);
}

#send-btn:active {
  background: #a88540;
}

#send-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: var(--accent);
}

.chat-char-counter {
  text-align: right;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── RESPONSIVE ── */

@media (max-width: 768px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .steps {
    flex-direction: column;
    align-items: center;
    gap: 24px;
  }

  .step-divider {
    width: 1px;
    height: 24px;
    margin-top: 0;
  }
}

@media (max-width: 600px) {
  .hero {
    padding-top: 120px;
    padding-bottom: 56px;
  }

  .hero-title {
    font-size: 36px;
    letter-spacing: -1.5px;
  }

  .hero-desc {
    font-size: 15px;
  }

  .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 14px 32px;
    font-size: 15px;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .feature-card {
    padding: 20px;
  }

  .disclaimer-inner {
    flex-direction: column;
    gap: 8px;
  }

  .chat-header {
    padding: 14px 16px;
  }

  .chat-title {
    font-size: 16px;
  }

  .chat-msg {
    max-width: 92%;
    padding: 12px 14px;
  }

  .chat-body {
    padding: 12px;
  }

  #chat-form {
    flex-direction: column;
    gap: 6px;
  }

  #send-btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
  }

  .chat-input-area {
    padding: 12px;
  }

  .section-title {
    font-size: 24px;
  }
}
