:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #242442;
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b8;
  --accent: #6C63FF;
  --accent-hover: #5A52E0;
  --accent-light: rgba(108, 99, 255, 0.15);
  --border-color: rgba(255, 255, 255, 0.08);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Role colors */
  --color-driver: #FF6B35;
  --color-explorer: #FFD700;
  --color-navigator: #4ECDC4;
  --color-analyst: #7B68EE;
  --color-connector: #FF69B4;
  --color-guardian: #3CB371;
  --color-integrator: #87CEEB;
  --color-builder: #DEB887;
}

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

html {
  overflow-y: scroll; /* Stable scrollbar to eliminate jitter */
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.container {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px;
  flex: 1;
}

.view {
  width: 100%;
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 1;
  transform: translateY(0);
}

/* Global hidden utility */
.hidden {
  display: none !important;
}

/* Button styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  min-height: 48px;
  width: 100%;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(108, 99, 255, 0.4);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 99, 255, 0.6);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: var(--radius-full);
  border: 1px solid var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Landing View */
.landing-content {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.landing-hero {
  text-align: center;
  padding: 20px 0 10px;
}

.logo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--accent);
  margin-bottom: 20px;
  text-transform: uppercase;
  text-decoration: none;
  display: inline-block;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.cta-btn {
  margin-bottom: 12px;
}

.hero-meta {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.landing-roles-section h2,
.landing-card-section h2,
.landing-preview-section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.roles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.role-badge {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 14px 16px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  transition: transform 0.2s ease;
}

.role-badge:hover {
  transform: translateY(-2px);
  border-color: var(--role-color);
}

.role-badge-emoji {
  font-size: 1.3rem;
}

.landing-card-section,
.landing-preview-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
}

.landing-card-section p {
  color: var(--text-secondary);
}

.preview-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-list li {
  color: var(--text-secondary);
}

.preview-list strong {
  color: var(--text-primary);
}

/* Test View Layout & Anti-Jitter */
.test-wrapper {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 8px;
}

.test-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.question-body {
  min-height: 480px; /* Fixed vertical baseline preventing page expansion/jitter */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.question-title-area {
  min-height: 90px;
  margin-bottom: 20px;
}

.question-title {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 6px;
}

.question-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 18px;
  color: var(--text-primary);
  font-size: 0.98rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.2s ease;
  line-height: 1.4;
  min-height: 60px; /* Standardized card height */
}

.option-card:hover {
  border-color: var(--accent);
  background: rgba(108, 99, 255, 0.08);
  transform: translateY(-2px);
}

.option-card.selected {
  border-color: var(--accent);
  background: var(--accent-light);
  transform: scale(0.99);
}

.option-marker {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.option-card.selected .option-marker {
  background: var(--accent);
  border-color: var(--accent);
}

/* Question Transition Animations */
.question-body.slide-out {
  opacity: 0;
  transform: translateY(-10px);
}

.question-body.slide-in {
  animation: questionSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Loading View */
.loading-wrapper {
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  text-align: center;
}

.spinner-ring {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

/* Result View */
.result-wrapper {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-top: 12px;
}

.result-header {
  text-align: center;
  padding: 24px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 2px solid var(--role-color);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.role-emoji {
  font-size: 3.5rem;
  margin-bottom: 8px;
}

.role-label {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.role-title {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--role-color);
  margin-bottom: 8px;
}

.role-tagline {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-style: italic;
}

.signature-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.sig-secondary {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.sig-title {
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.sig-summary {
  color: var(--text-secondary);
  font-style: italic;
}

.profile-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
}

.profile-card h3 {
  font-size: 1.2rem;
  margin-bottom: 16px;
}

.profile-bars-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-bar-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  font-weight: 500;
}

.bar-score {
  font-weight: 700;
  color: var(--text-primary);
}

.bar-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.insights-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.insight-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.insight-box h4 {
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.strengths-box ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.strengths-box li::before {
  content: "• ";
  color: var(--accent);
  font-weight: bold;
}

.blindspot-box p {
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Deep Insight Form */
.deep-insight-section {
  background: linear-gradient(180deg, #1c1c36 0%, #151528 100%);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 28px 22px;
  box-shadow: 0 8px 24px rgba(108, 99, 255, 0.2);
}

.deep-insight-badge {
  display: inline-block;
  background: var(--accent-light);
  color: #a8a3ff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.deep-insight-section h3 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.deep-desc {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.deep-features-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
  font-size: 0.95rem;
}

.lead-form .form-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lead-input {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.lead-input:focus {
  border-color: var(--accent);
}

.form-trust {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 10px;
}

.lead-success {
  background: rgba(60, 179, 113, 0.15);
  border: 1px solid var(--color-guardian);
  padding: 24px 20px;
  border-radius: var(--radius);
  text-align: center;
}

.lead-success .success-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.lead-success h4 {
  font-size: 1.2rem;
  color: #a3e6b5;
  margin-bottom: 6px;
}

.lead-success p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

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

.share-actions-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 20px;
}

/* Legal Documents Layout */
.legal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  margin-top: 24px;
}

.legal-content h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.legal-content .last-updated {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.legal-content h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 24px 0 10px;
  color: var(--accent);
}

.legal-content p, .legal-content ul {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.legal-content ul {
  padding-left: 20px;
}

/* Footer & Legal Links */
footer {
  width: 100%;
  padding: 36px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

footer p {
  margin-bottom: 8px;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

@media (min-width: 480px) {
  .lead-form .form-row {
    flex-direction: row;
  }
  .lead-form .btn {
    width: auto;
    white-space: nowrap;
  }
}
