/* ================================
   CSS VARIABLES
   ================================ */
:root {
  --plum: #3B143F;
  --plum-mid: #5C2361;
  --plum-light: #8B4A93;
  --bg: #F7F3F9;
  --bg-card: #FFFFFF;
  --gold: #C9963A;
  --gold-hover: #B8861F;
  --charcoal: #2D2D2D;
  --text-muted: #705A74;
  --border: #E4D9EC;

  --tier-green: #1A6B3C;
  --tier-green-bg: #DCFCE7;
  --tier-yellow: #92680A;
  --tier-yellow-bg: #FEF9C3;
  --tier-orange: #C4440E;
  --tier-orange-bg: #FFF0E6;
  --tier-red: #B91C1C;
  --tier-red-bg: #FEE2E2;

  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --shadow-sm: 0 1px 4px rgba(59,20,63,0.08);
  --shadow-md: 0 4px 20px rgba(59,20,63,0.12);
  --shadow-lg: 0 8px 40px rgba(59,20,63,0.18);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 24px;
  --max-width: 640px;
  --transition: 0.2s ease;
}

/* ================================
   RESET & BASE
   ================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--charcoal);
  min-height: 100vh;
  line-height: 1.6;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ================================
   PROGRESS BAR
   ================================ */
.progress-container {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border);
}

.progress-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.progress-bar-track {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--plum), var(--plum-light));
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

.progress-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.hidden {
  display: none !important;
}

/* ================================
   SCREEN
   ================================ */
.screen {
  flex: 1;
  padding: 32px 20px 72px;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  animation: fadeSlideIn 0.3s ease forwards;
}

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

/* ================================
   LOGO
   ================================ */
.logo-area {
  text-align: center;
  margin-bottom: 28px;
}

.logo-wordmark {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--plum);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.7;
}

/* ================================
   INTRO SCREEN
   ================================ */
.intro-eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}

.intro-headline {
  font-size: clamp(2rem, 7vw, 2.8rem);
  font-weight: 700;
  color: var(--plum);
  line-height: 1.12;
  margin-bottom: 16px;
}

.intro-subheadline {
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--charcoal);
  margin-bottom: 20px;
  font-style: italic;
  line-height: 1.5;
}

.intro-body {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  line-height: 1.75;
}

.intro-meta {
  display: flex;
  gap: 18px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.intro-meta-item {
  font-size: 0.83rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.intro-meta-item::before {
  content: '✓';
  color: var(--gold);
  font-weight: 700;
}

/* ================================
   BUTTONS
   ================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--plum);
  color: #fff;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  padding: 16px 32px;
  border: none;
  border-radius: 99px;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  box-shadow: var(--shadow-md);
  width: 100%;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.btn-primary:hover {
  background: var(--plum-mid);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: var(--shadow-sm) !important;
}

.btn-primary.btn-gold {
  background: var(--gold);
}

.btn-primary.btn-gold:hover {
  background: var(--gold-hover);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--plum);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 14px 24px;
  border: 2px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  text-decoration: none;
}

.btn-secondary:hover {
  border-color: var(--plum);
  background: rgba(59,20,63,0.04);
}

/* ================================
   BACK BUTTON
   ================================ */
.btn-back {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  margin-bottom: 20px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color var(--transition);
}

.btn-back:hover {
  color: var(--plum);
}

/* ================================
   SYSTEM HEADER
   ================================ */
.system-header {
  text-align: center;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.system-icon {
  font-size: 2.6rem;
  margin-bottom: 8px;
  display: block;
}

.system-name {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--plum);
  margin-bottom: 5px;
}

.system-tagline {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.5;
}

/* ================================
   QUESTION CARDS
   ================================ */
.questions-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}

.question-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.question-card.answered {
  border-color: var(--plum);
  box-shadow: var(--shadow-sm);
}

.question-text {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--charcoal);
  margin-bottom: 14px;
}

.rating-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.rating-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: var(--font);
  min-height: 62px;
  -webkit-tap-highlight-color: transparent;
}

.rating-btn:hover {
  border-color: var(--plum-light);
  background: rgba(59,20,63,0.05);
  transform: translateY(-1px);
}

.rating-btn:active {
  transform: scale(0.97);
}

.rating-btn.selected {
  background: var(--plum);
  border-color: var(--plum);
  transform: none;
}

.rating-number {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--plum);
  line-height: 1;
}

.rating-btn.selected .rating-number {
  color: #fff;
}

.rating-label {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.25;
  font-weight: 500;
}

.rating-btn.selected .rating-label {
  color: rgba(255,255,255,0.8);
}

/* ================================
   EMAIL SCREEN
   ================================ */
.email-screen-header {
  text-align: center;
  margin-bottom: 32px;
}

.email-screen-eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}

.email-screen-headline {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--plum);
  margin-bottom: 10px;
  line-height: 1.2;
}

.email-screen-sub {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font);
  font-size: 1rem;
  color: var(--charcoal);
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus {
  border-color: var(--plum);
  box-shadow: 0 0 0 3px rgba(59,20,63,0.08);
}

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 18px 0 24px;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--plum);
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
}

.checkbox-group label {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
  cursor: pointer;
}

.privacy-note {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 12px;
  opacity: 0.8;
}

.error-msg {
  background: var(--tier-red-bg);
  color: var(--tier-red);
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.83rem;
  margin-bottom: 16px;
  display: none;
}

.error-msg.visible {
  display: block;
}

/* ================================
   RESULTS SCREEN
   ================================ */
.results-header {
  text-align: center;
  margin-bottom: 32px;
}

.results-greeting {
  font-size: 1.1rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 10px;
  letter-spacing: 0;
  text-transform: none;
}

.results-score {
  font-size: 4.5rem;
  font-weight: 700;
  color: var(--plum);
  line-height: 1;
  margin-bottom: 4px;
}

.results-score-denom {
  font-size: 1.6rem;
  color: var(--text-muted);
  font-weight: 400;
}

.results-score-sub {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.tier-badge {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 99px;
  font-size: 0.95rem;
  font-weight: 600;
}

.tier-green  { background: var(--tier-green-bg);  color: var(--tier-green); }
.tier-yellow { background: var(--tier-yellow-bg); color: var(--tier-yellow); }
.tier-orange { background: var(--tier-orange-bg); color: var(--tier-orange); }
.tier-red    { background: var(--tier-red-bg);    color: var(--tier-red); }

/* ================================
   SCORE BARS
   ================================ */
.score-bars-section {
  margin-bottom: 32px;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.score-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}

.score-bar-icon {
  font-size: 1rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.score-bar-name {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--charcoal);
  width: 108px;
  flex-shrink: 0;
  line-height: 1.3;
}

.score-bar-track {
  flex: 1;
  height: 10px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--plum-mid), var(--plum-light));
  width: 0%;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-bar-row.weakest .score-bar-fill {
  background: linear-gradient(90deg, var(--gold-hover), var(--gold));
}

.score-bar-row.weakest .score-bar-name {
  color: var(--plum);
  font-weight: 700;
}

.score-bar-num {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  width: 20px;
  text-align: right;
  flex-shrink: 0;
}

.score-bar-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 6px;
  opacity: 0.7;
}

.score-bar-row.threads-bar {
  opacity: 0.45;
}

.threads-inline-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.6;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ================================
   WEAKEST SYSTEM CARD
   ================================ */
.weakest-card {
  background: var(--bg-card);
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-bottom: 24px;
}

.weakest-eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 10px;
  letter-spacing: 0;
  text-transform: none;
}

.weakest-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--plum);
  margin-bottom: 14px;
  line-height: 1.25;
}

.weakest-bottleneck {
  font-size: 0.92rem;
  color: var(--charcoal);
  line-height: 1.75;
  margin-bottom: 20px;
}

.quick-win-box {
  background: #FDF8F0;
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px;
  margin-bottom: 20px;
}

.quick-win-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 7px;
}

.quick-win-text {
  font-size: 0.88rem;
  color: var(--charcoal);
  line-height: 1.65;
}

.download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--plum);
  color: #fff;
  padding: 14px 20px;
  border-radius: 99px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 14px;
  transition: background var(--transition), transform var(--transition);
  box-shadow: var(--shadow-sm);
}

.download-btn:hover {
  background: var(--plum-mid);
  transform: translateY(-1px);
}

.spellbook-link {
  display: block;
  text-align: center;
  font-size: 0.83rem;
  color: var(--plum);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ================================
   FEW MORE THINGS SECTION
   ================================ */
.few-more-things {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ritual-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
  font-style: italic;
}

.explore-inline {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.threads-secondary-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ================================
   TIE NOTICE
   ================================ */
.tie-notice {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 20px;
  padding: 0;
}

/* ================================
   MICRO-SYSTEM CTA
   ================================ */
.micro-cta {
  background: #FDF8F0;
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px;
  margin-top: 20px;
}

.micro-cta-intro {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 8px;
  letter-spacing: 0;
  text-transform: none;
}

.micro-cta-name {
  font-size: 0.88rem;
  color: var(--charcoal);
  line-height: 1.65;
  margin-bottom: 12px;
}

.micro-cta-link {
  display: inline-block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--plum);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.micro-cta-link:hover {
  color: var(--plum-mid);
}

/* ================================
   EXPLORE LINK (inline)
   ================================ */
.explore-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--plum);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.explore-link:hover {
  color: var(--plum-mid);
}

/* ================================
   CTA CONTEXT
   ================================ */
.cta-context {
  font-size: 0.92rem;
  color: var(--charcoal);
  line-height: 1.6;
  margin-bottom: 14px;
  text-align: center;
}


/* ================================
   DIVIDER
   ================================ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 28px 0;
}

/* ================================
   CTA SECTION
   ================================ */
.cta-section {
  margin-bottom: 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ================================
   SHARE SECTION
   ================================ */
.share-section {
  margin-bottom: 40px;
}

.share-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 99px;
  font-size: 0.83rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--charcoal);
  transition: all var(--transition);
  font-family: var(--font);
}

.share-btn:hover {
  border-color: var(--plum);
  color: var(--plum);
}

/* ================================
   FOOTER
   ================================ */
.quiz-footer {
  text-align: center;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.quiz-footer p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer-link {
  background: none;
  border: none;
  color: var(--plum);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font-family: var(--font);
  font-size: inherit;
  padding: 0;
}

/* ================================
   LOADING OVERLAY
   ================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(247,243,249,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  z-index: 500;
  backdrop-filter: blur(2px);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--plum);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 0.92rem;
  color: var(--text-muted);
  font-weight: 500;
}

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

/* ================================
   RESPONSIVE
   ================================ */
@media (max-width: 360px) {
  .rating-label {
    font-size: 0.56rem;
  }

  .score-bar-name {
    width: 88px;
    font-size: 0.72rem;
  }
}

@media (min-width: 600px) {
  .screen {
    padding: 40px 28px 80px;
  }

  .intro-headline {
    font-size: 3rem;
  }

  .btn-primary,
  .btn-secondary {
    width: auto;
    min-width: 260px;
  }

  .cta-section .btn-primary,
  .cta-section .btn-secondary {
    width: 100%;
  }
}
