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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-2: #23273a;
  --border: #2e3347;
  --text: #e8eaf0;
  --text-muted: #8891aa;
  --accent: #6366f1;
  --accent-hover: #4f52d4;
  --success: #10b981;
  --error: #ef4444;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 80px;
}

/* Screens */
.screen { display: none; width: 100%; max-width: 680px; }
.screen.active { display: flex; flex-direction: column; gap: 24px; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
}
.card.center { text-align: center; }

/* Intro */
#screen-intro .card h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 16px;
}
.subtitle { color: var(--text-muted); margin-bottom: 28px; }

.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-group input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font);
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus { border-color: var(--accent); }

/* Auth identity */
.auth-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 20px;
}
.auth-label { font-size: 0.8rem; color: var(--text-muted); }
.auth-email { font-size: 0.875rem; font-weight: 500; color: var(--accent); }

/* Buttons */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  padding: 14px 28px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  width: 100%;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font);
  padding: 14px 28px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--border); color: var(--text); }

/* Progress */
.assessment-header { display: flex; flex-direction: column; gap: 8px; }
.progress-bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}
.progress-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
}

/* Question card */
.question-card { display: flex; flex-direction: column; gap: 20px; }
.dimension-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: fit-content;
}
.question-card h2 {
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.5;
}

/* Options */
.options-container { display: flex; flex-direction: column; gap: 10px; }

.option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
}
.option:hover { border-color: var(--accent); }
.option.selected {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
}

.option-key {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 1px;
}
.option.selected .option-key {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.option-label { font-size: 0.95rem; color: var(--text); line-height: 1.5; }

/* Nav buttons */
.nav-buttons { display: flex; gap: 12px; }
.nav-buttons .btn-primary { flex: 1; }
.nav-buttons .btn-secondary { width: auto; flex-shrink: 0; }

/* Results */
.results-header { text-align: center; }
.results-header h1 { font-size: 2rem; font-weight: 700; margin-bottom: 8px; }

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 600px) {
  .results-grid { grid-template-columns: 1fr; }
}

.chart-card { display: flex; align-items: center; justify-content: center; }
.chart-card canvas { max-width: 100%; }

.scores-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 16px; }
.scores-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.score-row { display: flex; flex-direction: column; gap: 4px; }
.score-row-header { display: flex; justify-content: space-between; align-items: center; }
.score-label { font-size: 0.875rem; font-weight: 500; }
.score-value { font-size: 0.875rem; font-weight: 600; color: var(--accent); }
.score-bar-bg {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}
.scores-note p { font-size: 0.8rem; color: var(--text-muted); }

.dimension-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .dimension-detail { grid-template-columns: 1fr; }
}
.dimension-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.dimension-card h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 8px; }
.dimension-card p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }

/* Misc */
.icon-lg { font-size: 3rem; margin-bottom: 16px; }
.muted { color: var(--text-muted); font-size: 0.9rem; }
.error-msg { color: var(--error); font-size: 0.875rem; }
.error-msg.hidden { display: none; }

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 23, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.overlay.hidden { display: none; }
.overlay-inner { text-align: center; color: var(--text-muted); }
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
