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

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius: 0.5rem;
  
  /* Light Mode Colors */
  --color-background: #ffffff;
  --color-foreground: #2c1f3d;
  --color-primary: hsl(250, 50%, 55%);
  --color-primary-hover: hsl(250, 50%, 45%);
  --color-accent: hsl(0, 70%, 55%);
  --color-accent-hover: hsl(0, 70%, 45%);
  --color-border: hsl(240, 13%, 85%);
  --color-card: hsl(240, 15%, 97%);
  --color-muted: hsl(240, 13%, 45%);
  --color-error: hsl(0, 70%, 55%);
  --color-success: hsl(140, 60%, 45%);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.dark {
  --color-background: hsl(240, 20%, 12%);
  --color-foreground: hsl(250, 35%, 85%);
  --color-primary: hsl(250, 35%, 75%);
  --color-primary-hover: hsl(250, 35%, 65%);
  --color-accent: hsl(0, 50%, 75%);
  --color-accent-hover: hsl(0, 50%, 65%);
  --color-border: hsl(240, 14%, 25%);
  --color-card: hsl(240, 18%, 16%);
  --color-muted: hsl(240, 14%, 65%);
  --color-error: hsl(0, 50%, 70%);
  --color-success: hsl(140, 40%, 65%);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
}

body {
  font-family: var(--font-sans);
  line-height: 1.6;
  color: var(--color-foreground);
  background-color: var(--color-background);
  min-height: 100vh;
  transition: background-color 0.3s, color 0.3s;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
}

h1 {
  font-size: 2.5rem;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

h2 {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1rem;
  letter-spacing: -0.025em;
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--color-muted);
}

.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--color-foreground);
}

input[type="text"],
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-background);
  color: var(--color-foreground);
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: var(--font-sans);
  line-height: 1.5;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.answer-textarea {
  resize: vertical;
  min-height: 80px;
}

.button {
  display: inline-block;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  color: white;
  background-color: var(--color-primary);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  min-height: 44px;
}

.button:hover {
  background-color: var(--color-primary-hover);
}

.button:active {
  transform: scale(0.98);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button-full {
  width: 100%;
}

.button-secondary {
  background-color: var(--color-card);
  color: var(--color-foreground);
  border: 2px solid var(--color-border);
}

.button-secondary:hover {
  background-color: #f3f4f6;
}

.progress-header {
  position: sticky;
  top: 0;
  background: var(--color-background);
  padding: 1rem 0;
  border-bottom: 2px solid var(--color-border);
  z-index: 10;
  margin-bottom: 2rem;
}

.progress-bar {
  width: 100%;
  height: 0.5rem;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: var(--color-primary);
  transition: width 0.3s ease-out;
}

.progress-text {
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  color: var(--color-muted);
}

.question-card {
  margin: 2rem 0;
}

.question-text {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.75;
  margin-bottom: 1.5rem;
  color: var(--color-foreground);
}

.answer-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.answer-button {
  padding: 1.25rem;
  text-align: left;
  background: var(--color-background);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  min-height: 60px;
  font-size: 1rem;
  color: var(--color-foreground);
}

.answer-button:hover {
  border-color: var(--color-primary);
  background: rgba(59, 130, 246, 0.05);
}

.answer-button.selected {
  border-color: var(--color-primary);
  border-width: 3px;
  background: rgba(59, 130, 246, 0.1);
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
}

.error-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid var(--color-error);
  color: #991b1b;
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.loading {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-muted);
}

.spinner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.spinner {
  border: 4px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-right-color: var(--color-primary);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
  margin: 0 auto;
}

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

.loading-message {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--color-foreground);
  margin-bottom: 0.5rem;
  animation: fadeIn 0.5s ease-in;
}

.loading-tip {
  font-size: 0.9375rem;
  color: var(--color-muted);
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.6;
  animation: fadeIn 0.5s ease-in;
}

.loading-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  animation: pulse 1.5s ease-in-out infinite;
}

.loading-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

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

.persona-badge {
  display: inline-flex;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  color: white;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.report-summary {
  font-size: 1.125rem;
  line-height: 1.875;
  margin-bottom: 2rem;
  color: var(--color-foreground);
}

.chart-container {
  max-width: 500px;
  margin: 2rem auto;
  padding: 1.5rem;
}

.insights-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin: 2rem 0;
}

@media (min-width: 768px) {
  .insights-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  h1 {
    font-size: 3rem;
  }
  
  .container {
    padding: 3rem 1.5rem;
  }
  
  .card {
    padding: 3rem;
  }
}

.insight-card {
  padding: 2rem;
  background: var(--color-background);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
}

.insight-card h3 {
  font-size: 1.125rem;
  margin-bottom: 1rem;
}

.insight-list {
  list-style: none;
  padding: 0;
}

.insight-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.insight-list li:last-child {
  border-bottom: none;
}

.insight-list li::before {
  content: "•";
  color: var(--color-primary);
  font-weight: bold;
  display: inline-block;
  width: 1.5em;
  margin-left: -1.5em;
}

.trust-signal {
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-top: 2rem;
  opacity: 0.7;
}

.helper-text {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-top: 0.25rem;
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-card);
  border: 2px solid var(--color-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.theme-toggle:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  transform: scale(1.05);
}

.theme-toggle:hover svg {
  color: white;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  color: var(--color-foreground);
  transition: color 0.3s;
}

.theme-toggle .sun-icon {
  display: none;
}

.theme-toggle .moon-icon {
  display: block;
}

.dark .theme-toggle .sun-icon {
  display: block;
}

.dark .theme-toggle .moon-icon {
  display: none;
}