/* ==========================================================
   MindScope | stylesheet
   Palette: deep navy / violet, psychological & minimal
   ========================================================== */

:root {
  --bg: #0a0c16;
  --bg-2: #10132422;
  --surface: #141728;
  --surface-2: #1b1f36;
  --border: #2a2e4a;
  --text: #eceaf6;
  --text-dim: #a6a8c2;
  --text-faint: #6e7192;
  --violet: #7c6fea;
  --violet-soft: #7c6fea33;
  --indigo: #4e7fff;
  --rose: #e8779c;
  --gradient: linear-gradient(135deg, #7c6fea 0%, #4e7fff 100%);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --shadow: 0 20px 60px -20px rgba(20, 10, 60, 0.55);
  --font-display: "Georgia", "Times New Roman", serif;
  --font-body: "Avenir Next", "Segoe UI", sans-serif;
}

body.light {
  --bg: #f3f1fb;
  --surface: #ffffff;
  --surface-2: #f7f5fd;
  --border: #e2def6;
  --text: #201c3b;
  --text-dim: #524c77;
  --text-faint: #8a84ac;
  --shadow: 0 20px 50px -25px rgba(90, 70, 160, 0.35);
}

* {
  box-sizing: border-box;
  hyphens: none;
}

html,
body {
  margin: 0;
  padding: 0;
  max-width: 100vw;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  letter-spacing: -0.015em;
  line-height: 1.55;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  hyphens: none;
  transition:
    background 0.4s ease,
    color 0.4s ease;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(600px circle at 15% 10%, #4e3fea22, transparent 55%),
    radial-gradient(500px circle at 85% 30%, #4e7fff1c, transparent 55%);
}
body.light .bg-glow {
  background:
    radial-gradient(600px circle at 15% 10%, #7c6fea1a, transparent 55%),
    radial-gradient(500px circle at 85% 30%, #4e7fff14, transparent 55%);
}

.hidden {
  display: none !important;
}

/* ---------- topbar ---------- */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px clamp(18px, 5vw, 56px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--gradient);
  transform: rotate(45deg);
  box-shadow: 0 8px 20px -8px rgba(124, 111, 234, 0.8);
}
.brand-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
}
.topbar-actions {
  display: flex;
  gap: 10px;
}
.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
  min-width: 46px;
  min-height: 42px;
  padding: 10px 15px;
  border-radius: 999px;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease,
    box-shadow 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.02em;
}
.icon-btn:hover {
  border-color: var(--violet);
  color: var(--text);
  box-shadow: 0 8px 18px -12px rgba(124, 111, 234, 0.9);
}
.icon-btn:active {
  transform: scale(0.98);
}
#themeToggleBtn {
  padding-inline: 12px;
}

.theme-icon {
  width: 17px;
  height: 17px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon path,
.theme-icon circle {
  vector-effect: non-scaling-stroke;
}

/* ---------- layout ---------- */
main {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 80px);
}
.screen {
  display: none;
  padding: 10px clamp(18px, 5vw, 56px) 70px;
}
.screen.active {
  display: block;
  animation: fadeIn 0.45s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .screen.active {
    animation: none;
  }
}

@media (max-width: 620px) {
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .brand-name {
    font-size: 1.25rem;
  }

  .meta-row {
    flex-wrap: wrap;
    gap: 14px 18px;
  }

  .meta-divider {
    display: none;
  }

  .btn-large,
  .results-actions .btn,
  .history-actions .btn {
    display: block;
    width: 100%;
    margin: 0 0 12px;
  }

  .results-actions,
  .history-actions {
    flex-direction: column;
  }
}

/* ---------- home ---------- */
#homeScreen.active {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 82vh;
}
.home-card {
  max-width: 640px;
  width: 100%;
  text-align: left;
}
.eyebrow {
  font-size: 0.88rem;
  color: var(--text-faint);
  margin: 0 0 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.home-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.6rem, 7vw, 4rem);
  line-height: 1.05;
  margin: 0 0 14px;
}
.home-title em {
  font-style: italic;
  color: var(--violet);
}
.home-subtitle {
  font-size: 1.18rem;
  color: var(--text-dim);
  max-width: 46ch;
  margin: 0 0 30px;
}
.meta-row {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 28px;
}
.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.meta-value {
  font-family: var(--font-body);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1.1;
}
.meta-label {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.meta-divider {
  width: 1px;
  height: 30px;
  background: var(--border);
}
.home-copy {
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 1.04rem;
  line-height: 1.7;
  max-width: 58ch;
  margin: 0 0 32px;
}
.disclaimer {
  margin-top: 28px;
  font-size: 0.92rem;
  color: var(--text-faint);
  border-left: 2px solid var(--border);
  padding-left: 12px;
  max-width: 54ch;
  line-height: 1.7;
}

/* ---------- buttons ---------- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 13px 26px;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease,
    border-color 0.2s ease;
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 12px 30px -10px #4e3fea66;
}
.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}
.btn-primary:not(:disabled):hover {
  box-shadow: 0 16px 36px -8px #4e3fea88;
}
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
}
.btn-ghost:hover {
  border-color: var(--violet);
  color: var(--text);
}
.btn-danger-ghost {
  background: transparent;
  border: 1px solid #6b2e42;
  color: #e88fa8;
  border-radius: 999px;
  padding: 13px 26px;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger-ghost:hover {
  border-color: var(--rose);
}
.btn-large {
  padding: 15px 30px;
  font-size: 0.98rem;
  margin-right: 12px;
}

/* ---------- quiz ---------- */
.quiz-topline {
  max-width: 680px;
  margin: 20px auto 0;
}
.progress-track {
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--gradient);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.question-counter {
  display: block;
  margin-top: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.quiz-card {
  max-width: 680px;
  margin: 26px auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 5vw, 44px);
  box-shadow: var(--shadow);
}
.question-text {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  line-height: 1.35;
  letter-spacing: -0.02em;
  margin: 0 0 30px;
}
.choices-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.choice {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.12s ease;
}
.choice:hover {
  border-color: var(--violet);
  transform: translateX(2px);
}
.choice-letter {
  flex: 0 0 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-faint);
  transition: all 0.18s ease;
}
.choice-text {
  font-size: 1.02rem;
  color: var(--text-dim);
  line-height: 1.45;
}
.choice.selected {
  border-color: var(--violet);
  background: var(--violet-soft);
}
.choice.selected .choice-letter {
  background: var(--gradient);
  border-color: transparent;
  color: #fff;
}
.choice.selected .choice-text {
  color: var(--text);
}

.quiz-nav {
  max-width: 680px;
  margin: 22px auto 0;
  display: flex;
  justify-content: space-between;
}

/* ---------- results ---------- */
.results-wrap {
  max-width: 880px;
  margin: 10px auto 0;
}
.archetype-name {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.7rem);
  margin: 4px 0 10px;
}
.archetype-desc {
  color: var(--text-dim);
  font-size: 1.04rem;
  max-width: 64ch;
  line-height: 1.7;
  margin: 0 0 36px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 4vw, 30px);
}
.panel-title {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
}
.results-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
@media (max-width: 760px) {
  .results-grid {
    grid-template-columns: 1fr;
  }
}

.chart-row {
  margin-bottom: 16px;
}
.chart-row:last-child {
  margin-bottom: 0;
}
.chart-row-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 6px;
  color: var(--text-dim);
}
.chart-row-top strong {
  color: var(--text);
  font-weight: 600;
}
.chart-bar-track {
  height: 9px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.chart-bar-fill {
  height: 100%;
  border-radius: 999px;
  width: 0%;
  background: var(--gradient);
  transition: width 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.highlights-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.highlights-list li {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-dim);
  padding-left: 16px;
  border-left: 2px solid var(--violet);
}

.detail-sections {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}
@media (max-width: 760px) {
  .detail-sections {
    grid-template-columns: 1fr;
  }
}
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
}
.detail-card h4 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  color: var(--text);
}
.detail-card p {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-dim);
  margin: 0;
}

.strengths-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 24px;
}
@media (max-width: 760px) {
  .strengths-panel {
    grid-template-columns: 1fr;
  }
}
.bullet-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.7;
}

.profile-note {
  font-size: 0.8rem;
  color: var(--text-faint);
  max-width: 66ch;
  line-height: 1.6;
  margin: 0 0 24px;
}

.compare-banner {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  font-size: 0.86rem;
  color: var(--text-dim);
  margin-bottom: 24px;
  line-height: 1.6;
}

.results-actions {
  display: flex;
  gap: 12px;
}

/* ---------- history ---------- */
.history-wrap {
  max-width: 720px;
  margin: 10px auto 0;
}
.section-heading {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.8rem;
  letter-spacing: -0.04em;
  margin: 4px 0 28px;
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}
.history-empty {
  color: var(--text-faint);
  font-size: 0.92rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 30px;
  text-align: center;
}
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  gap: 14px;
  flex-wrap: wrap;
}
.history-item-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.history-item-archetype {
  font-family: var(--font-display);
  font-size: 1.05rem;
}
.history-item-date {
  font-size: 0.78rem;
  color: var(--text-faint);
}
.history-item-actions {
  display: flex;
  gap: 8px;
}
.history-actions {
  display: flex;
  gap: 12px;
}

/* ---------- scrollbar niceties ---------- */
::selection {
  background: var(--violet-soft);
}
