/* ============================================
   Financial Literacy Test — Standalone Styles
   Mirrors AJ Smith website design tokens
   ============================================ */

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

:root {
  --bg-primary:    #0B0F14;
  --bg-secondary:  #111827;
  --card-bg:       #171F2A;
  --gold:          #C9A227;
  --gold-dim:      rgba(201,162,39,0.12);
  --gold-glow:     rgba(201,162,39,0.25);
  --green:         #3FA37D;
  --red:           #E05252;
  --text-primary:  #F8FAFC;
  --text-secondary:#CBD5E1;
  --text-muted:    #94A3B8;
  --border:        #2D3748;
  --border-gold:   rgba(201,162,39,0.3);
  --radius:        12px;
  --radius-sm:     8px;
  --font-serif:    Georgia, 'Times New Roman', serif;
  --font-sans:     'Segoe UI', system-ui, -apple-system, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Navbar ── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(11,15,20,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: 64px;
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.nav-back {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-back:hover { color: var(--gold); }

/* ── Layout ── */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}
.container.narrow {
  max-width: 640px;
}

/* ── Steps ── */
.step {
  display: none;
  padding: 120px 0 80px;
  min-height: 100vh;
}
.step.active { display: block; }

/* ── Step header elements ── */
.step-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
}
.step-badge::before {
  content: '';
  display: block;
  width: 24px; height: 2px;
  background: var(--gold);
  border-radius: 2px;
}
.step-headline {
  font-family: var(--font-serif);
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.step-sub {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 560px;
  margin-bottom: 32px;
}
.divider {
  width: 48px; height: 2px;
  background: var(--gold);
  border-radius: 2px;
  margin-bottom: 32px;
}

/* ── Intro Form ── */
.info-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 480px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form-group label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  text-transform: uppercase;
}
.form-group input {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-sans);
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
.form-group input::placeholder { color: var(--text-muted); }
.form-group input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
.form-group input.input-error { border-color: var(--red); }
.field-note {
  font-size: 12px;
  color: var(--text-muted);
}
.privacy-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: -8px;
}

/* ── Buttons ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gold);
  color: var(--bg-primary);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.1s;
  align-self: flex-start;
}
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary.btn-large { padding: 16px 36px; font-size: 15px; }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--text-primary);
  border: 1.5px solid var(--gold);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}
.btn-secondary:hover { background: var(--gold-dim); }
.arrow { display: inline-block; transition: transform 0.2s; }
.btn-primary:hover .arrow { transform: translateX(4px); }

/* ── Quiz Header ── */
.quiz-header {
  margin-bottom: 48px;
}
.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}
.progress-bar-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  max-width: 300px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
}
.progress-label {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Question Cards ── */
#questions-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 48px;
}

.question-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  transition: border-color 0.2s;
}
.question-card.unanswered {
  border-color: var(--red);
  box-shadow: 0 0 0 1px rgba(224,82,82,0.2);
}
.question-card.answered {
  border-color: rgba(201,162,39,0.2);
}

.question-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.question-number {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}
.question-category {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}
.question-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.55;
  margin-bottom: 20px;
}

/* ── Choices ── */
.choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.choice-label {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.choice-label:hover {
  border-color: var(--border-gold);
  background: var(--gold-dim);
}
.choice-label input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}
.choice-letter {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  margin-top: 1px;
}
.choice-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  transition: color 0.15s;
}
.choice-label.selected {
  border-color: var(--gold);
  background: var(--gold-dim);
}
.choice-label.selected .choice-letter {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg-primary);
}
.choice-label.selected .choice-text {
  color: var(--text-primary);
}

/* ── Submit Zone ── */
.submit-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 0 24px;
  border-top: 1px solid var(--border);
}
.quiz-error {
  background: rgba(224,82,82,0.1);
  border: 1px solid rgba(224,82,82,0.3);
  border-radius: var(--radius-sm);
  color: #F87171;
  font-size: 14px;
  padding: 12px 20px;
  text-align: center;
}
.quiz-error.hidden { display: none; }

/* ── Results ── */
.results-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  text-align: center;
  margin-bottom: 28px;
}
.results-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.score-display {
  font-family: var(--font-serif);
  font-size: 80px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 20px;
  transition: color 0.4s;
}
.score-display.pass { color: var(--green); }
.score-display.fail { color: var(--red); }

.score-bar-wrap { margin-bottom: 24px; }
.score-bar-track {
  position: relative;
  height: 6px;
  background: var(--border);
  border-radius: 6px;
  overflow: visible;
  max-width: 400px;
  margin: 0 auto;
}
.score-bar-fill {
  height: 100%;
  border-radius: 6px;
  width: 0%;
  transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}
.score-bar-fill.pass { background: var(--green); }
.score-bar-fill.fail { background: var(--red); }
.score-bar-threshold {
  position: absolute;
  top: -4px;
  left: 75%;
  width: 2px;
  height: 14px;
  background: var(--gold);
  border-radius: 2px;
}
.score-bar-threshold::after {
  content: '75%';
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--gold);
  font-weight: 700;
  white-space: nowrap;
}
.result-message {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 480px;
  margin: 0 auto;
}

.results-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
}
.results-meta-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
}
.meta-icon {
  color: var(--green);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.results-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Loading state ── */
.loading-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid transparent;
  border-top-color: var(--bg-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 640px) {
  .step { padding: 96px 0 60px; }
  .question-card { padding: 20px; }
  .results-card { padding: 28px 20px; }
  .score-display { font-size: 64px; }
  .results-actions { flex-direction: column; }
  .btn-primary, .btn-secondary { justify-content: center; }
  .progress-bar-wrap { flex-direction: column; align-items: flex-start; gap: 8px; }
  .progress-bar-track { max-width: 100%; width: 100%; }
  .step-sub { font-size: 15px; }
}
@media (max-width: 400px) {
  .question-text { font-size: 15px; }
  .choice-text { font-size: 13px; }
}
