/* ==========================================================================
   Dark Triad Test — Stylesheet
   Self-contained. Dark, clinical, slightly unsettling.
   ========================================================================== */

:root {
  --bg: #060608;
  --surface: rgba(255,255,255,0.03);
  --border: rgba(255,255,255,0.07);
  --text: #ededf0;
  --muted: rgba(255,255,255,0.35);
  --font-mono: 'JetBrains Mono','Fira Code','Courier New',monospace;
  --font-sans: -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  --n-color: #c084fc;   /* narcissism — purple */
  --m-color: #60a5fa;   /* machiavellianism — blue */
  --p-color: #f87171;   /* psychopathy — red */
}

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

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

a {
  color: inherit;
}

/* --------------------------------------------------------------------------
   Root container
   -------------------------------------------------------------------------- */
#dark-root {
  max-width: 600px;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.5rem 1.25rem;
  margin: auto;
}

/* --------------------------------------------------------------------------
   Screen wrapper
   -------------------------------------------------------------------------- */
.dark-screen {
  width: 100%;
  animation: screenIn 0.4s ease both;
}

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

/* --------------------------------------------------------------------------
   Tag / label
   -------------------------------------------------------------------------- */
.dark-tag {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin: 0;
}

/* --------------------------------------------------------------------------
   Mono utility
   -------------------------------------------------------------------------- */
.mono {
  font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   Intro screen
   -------------------------------------------------------------------------- */
.dark-title {
  font-size: clamp(4rem, 16vw, 7.5rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.04em;
  margin: 0.75rem 0 1.5rem;
  color: white;
}

.dark-intro-desc {
  font-size: 0.92rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.75;
  max-width: 46ch;
  margin: 0;
}

/* Traits preview row */
.dark-traits-preview {
  display: flex;
  gap: 1.5rem;
  margin: 1.25rem 0;
}

.trait-preview {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.trait-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.trait-dot-sm {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dark-warning {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.7;
  margin: 1.5rem 0;
}

.dark-taken-wrap {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 1.75rem;
}

.dark-taken {
  color: var(--text);
}

.dark-fine {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.2);
  margin-top: 1rem;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.dark-btn {
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}

.dark-btn-primary {
  background: white;
  color: #060608;
  border: none;
}

.dark-btn-primary:hover {
  background: #d4d4d8;
}

.dark-btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.18);
}

.dark-btn-outline:hover {
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.04);
}

.dark-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

/* --------------------------------------------------------------------------
   Quiz screen header + progress
   -------------------------------------------------------------------------- */
.dark-quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.dark-progress {
  font-size: 0.65rem;
  color: var(--muted);
}

.dark-trait-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dark-trait-name {
  font-size: 0.65rem;
  color: var(--muted);
}

.dark-progress-bar-wrap {
  height: 2px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  margin-bottom: 2rem;
}

.dark-progress-bar {
  height: 100%;
  background: white;
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* --------------------------------------------------------------------------
   Quiz body — statement + scale
   -------------------------------------------------------------------------- */
.dark-body {
  /* spacing container */
}

.dark-statement {
  font-size: clamp(1.1rem, 3vw, 1.3rem);
  font-weight: 500;
  line-height: 1.6;
  margin: 0 0 2rem;
  min-height: 4rem;
}

.dark-scale-label {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.85rem;
}

.dark-scale {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

.dark-scale-option {
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
  background: none;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Size graduation — smallest on ends, largest in middle */
.dark-scale-option:nth-child(1),
.dark-scale-option:nth-child(5) {
  width: 40px;
  height: 40px;
}

.dark-scale-option:nth-child(2),
.dark-scale-option:nth-child(4) {
  width: 46px;
  height: 46px;
}

.dark-scale-option:nth-child(3) {
  width: 54px;
  height: 54px;
}

.dark-scale-option:hover {
  border-color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.06);
}

.dark-scale-option.selected {
  background: white;
  border-color: white;
}

.dark-scale-option.disabled {
  pointer-events: none;
  opacity: 0.4;
}

.scale-num {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  line-height: 1;
}

.dark-scale-option.selected .scale-num {
  color: #060608;
}

.dark-scale-ends {
  display: flex;
  justify-content: space-between;
  margin-top: 0.6rem;
  font-size: 0.6rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   Calculating screen
   -------------------------------------------------------------------------- */
.dark-spinner {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(255,255,255,0.08);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin-bottom: 1.5rem;
}

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

.dark-calc-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.dark-calc-track {
  height: 1px;
  background: rgba(255,255,255,0.07);
  max-width: 240px;
  width: 100%;
  margin: 0 auto;
}

.dark-calc-fill {
  height: 100%;
  background: rgba(255,255,255,0.4);
  width: 0;
  transition: width 0.5s ease;
}

.dark-calc-sub {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.2);
  margin-top: 1rem;
}

/* --------------------------------------------------------------------------
   Result screen — archetype
   -------------------------------------------------------------------------- */
.dark-archetype-name {
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 900;
  margin: 0.25rem 0 0.5rem;
  line-height: 1.1;
  color: white;
}

.dark-archetype-sub {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
}

/* --------------------------------------------------------------------------
   Scores grid
   -------------------------------------------------------------------------- */
.dark-scores-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.5rem 0;
}

.score-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.score-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.score-trait-name {
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-sans);
}

.score-pct {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.score-track {
  height: 4px;
  background: rgba(255,255,255,0.07);
  border-radius: 2px;
  overflow: hidden;
}

.score-fill {
  height: 100%;
  border-radius: 2px;
  width: 0;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.score-fill.n { background: var(--n-color); }
.score-fill.m { background: var(--m-color); }
.score-fill.p { background: var(--p-color); }

.score-desc {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Result description + truth
   -------------------------------------------------------------------------- */
.dark-result-desc {
  font-size: 0.9rem;
  line-height: 1.8;
  color: rgba(255,255,255,0.7);
  margin: 0;
}

.dark-truth {
  border-left: 2px solid rgba(255,255,255,0.12);
  padding-left: 1rem;
  margin: 1.25rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.7;
  font-style: normal;
}

/* --------------------------------------------------------------------------
   Breakdown cells
   -------------------------------------------------------------------------- */
.dark-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}

.breakdown-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
  text-align: center;
}

.bc-pct {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1;
}

.bc-label {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.2rem;
  font-family: var(--font-mono);
}

.bc-desc {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.4rem;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Divider
   -------------------------------------------------------------------------- */
.dark-divider {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}

/* --------------------------------------------------------------------------
   Footer links
   -------------------------------------------------------------------------- */
.dark-footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.dark-back {
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: none;
  transition: color 0.15s;
}

.dark-back:hover {
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Mobile adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 500px) {
  .dark-actions {
    flex-direction: column;
  }

  .dark-actions .dark-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .dark-breakdown {
    grid-template-columns: 1fr;
  }

  .dark-traits-preview {
    flex-wrap: wrap;
    gap: 1rem;
  }
}

@media (max-width: 700px) and (min-width: 501px) {
  .dark-breakdown {
    grid-template-columns: 1fr 1fr;
  }
}
