/* ─── Variables ─────────────────────────────────────────────── */
:root {
  --bg: #111111;
  --red: #cc0000;
  --red-dim: #8a0000;
  --white: #f0f0f0;
  --gray: #888888;
  --gray-light: #bbbbbb;
  --card: #1a1a1a;
  --card-border: #2a2a2a;
  --max: 780px;
  --font-head: Georgia, 'Times New Roman', serif;
  --font-body: Arial, Helvetica, sans-serif;
}

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
}
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Stars (home page) ─────────────────────────────────────── */
.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.stars span {
  position: absolute;
  background: var(--white);
  border-radius: 50%;
  opacity: 0;
  animation: twinkle linear infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0; }
  50%       { opacity: 0.7; }
}

/* ─── Navigation ────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  background: rgba(17,17,17,.95);
  backdrop-filter: blur(6px);
  z-index: 10;
}
.nav-back {
  color: var(--gray-light);
  font-size: 14px;
  letter-spacing: .5px;
  transition: color .2s;
}
.nav-back:hover { color: var(--white); text-decoration: none; }
.nav-date {
  font-size: 12px;
  color: var(--red);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-family: var(--font-head);
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-block;
  background: var(--red);
  color: var(--white);
  border: none;
  padding: 14px 36px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .2s, transform .1s;
  text-decoration: none;
  border-radius: 0;
  -webkit-appearance: none;
}
.btn:hover { background: #a80000; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-large { padding: 16px 48px; font-size: 14px; }
.btn-sm { padding: 10px 24px; font-size: 12px; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--gray);
  color: var(--gray-light);
}
.btn-outline:hover { border-color: var(--white); color: var(--white); background: transparent; }

/* ─── HOME PAGE ─────────────────────────────────────────────── */
.page-home {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
}
.home-wrap {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 60px 32px;
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.home-badge {
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--red);
  font-family: var(--font-head);
  margin-bottom: 24px;
  text-transform: uppercase;
}
.home-badge::before,
.home-badge::after { content: ' ★ '; }
.home-title {
  font-family: var(--font-head);
  font-size: clamp(32px, 6vw, 64px);
  font-weight: normal;
  line-height: 1.2;
  margin-bottom: 24px;
  letter-spacing: -1px;
}
.home-sub {
  font-size: 16px;
  color: var(--gray-light);
  max-width: 560px;
  margin: 0 auto 40px;
  line-height: 1.8;
}
/* Orbit decoration */
.home-orbit {
  position: absolute;
  width: 300px;
  height: 300px;
  bottom: -100px;
  right: -80px;
  opacity: .06;
  pointer-events: none;
}
.orbit-ring {
  position: absolute;
  inset: 0;
  border: 1px solid var(--white);
  border-radius: 50%;
}
.orbit-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  top: 50%;
  left: 0;
  transform: translate(-50%, -50%);
  animation: orbit-rotate 6s linear infinite;
  transform-origin: 150px 0;
}
@keyframes orbit-rotate {
  from { transform: rotate(0deg) translateX(150px) translateY(-50%); }
  to   { transform: rotate(360deg) translateX(150px) translateY(-50%); }
}

/* ─── PROGRESS BAR ───────────────────────────────────────────── */
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 32px;
  background: var(--bg);
  border-bottom: 1px solid var(--card-border);
  height: 36px;
}
.progress-track {
  flex: 1;
  height: 3px;
  background: var(--card-border);
  border-radius: 0;
}
.progress-fill {
  height: 100%;
  background: var(--red);
  transition: width .4s ease;
  width: 0%;
}
.progress-label {
  font-size: 11px;
  color: var(--gray);
  letter-spacing: 1px;
  white-space: nowrap;
}

/* ─── QUIZ PAGE ─────────────────────────────────────────────── */
.page-quiz { min-height: 100vh; display: flex; flex-direction: column; }
.quiz-wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 40px 32px 80px;
  flex: 1;
  width: 100%;
}

/* Step container */
.step-container { min-height: 400px; }
.step-container.fade-in { animation: fadeUp .3s ease both; }
.step-section {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 16px;
  font-family: var(--font-head);
}
.step-title {
  font-family: var(--font-head);
  font-size: clamp(20px, 3.5vw, 28px);
  font-weight: normal;
  margin-bottom: 28px;
  line-height: 1.35;
  color: var(--white);
}

/* Options grid */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 32px;
}
.opt-btn {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--gray-light);
  padding: 14px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  border-radius: 0;
  -webkit-appearance: none;
}
.opt-btn:hover {
  border-color: var(--gray);
  color: var(--white);
  background: #222;
}
.opt-btn.selected {
  border-color: var(--red);
  background: #1e0808;
  color: var(--white);
}
.multi-hint {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--gray);
  margin-top: 4px;
  letter-spacing: .3px;
}

/* Step navigation */
.step-nav {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.btn-back { min-width: 110px; }
.btn-next { min-width: 140px; }
.btn-next:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.btn-next:disabled:hover { background: var(--red); }

/* Old textarea fields (kept for compatibility) */
.field { display: flex; flex-direction: column; gap: 10px; }
.field-label {
  font-size: 15px;
  color: var(--gray-light);
  line-height: 1.5;
}
.field-hint {
  display: block;
  font-size: 13px;
  color: var(--gray);
  margin-top: 4px;
}
.field-textarea {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--white);
  padding: 16px;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  resize: vertical;
  width: 100%;
  transition: border-color .2s;
  border-radius: 0;
  -webkit-appearance: none;
}
.field-textarea:focus {
  outline: none;
  border-color: var(--red);
}
.field-textarea::placeholder { color: #555; }
.field-textarea.is-invalid { border-color: #c00; }
.field-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.field-error { font-size: 13px; color: #ff4444; min-height: 18px; }
.field-counter { font-size: 12px; color: var(--gray); }
.field-counter.near-limit { color: #ff8800; }
.field-counter.at-limit { color: #ff4444; }

/* ─── Loader ─────────────────────────────────────────────────── */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 60px 20px;
}
.loader[hidden] { display: none !important; }
.loader-orbit {
  position: relative;
  width: 64px;
  height: 64px;
}
.loader-ring {
  position: absolute;
  inset: 0;
  border: 2px solid var(--card-border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
}
.loader-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text {
  color: var(--gray);
  font-size: 14px;
  text-align: center;
  line-height: 1.8;
  letter-spacing: .5px;
}

/* ─── Error box ──────────────────────────────────────────────── */
.error-box {
  background: #1e0a0a;
  border: 1px solid #440000;
  padding: 24px 32px;
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.error-box[hidden] { display: none !important; }
.error-box p { color: #ff8888; font-size: 15px; }

/* ─── RESULT PAGE ────────────────────────────────────────────── */
.page-result { min-height: 100vh; }
.result-wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 48px 32px 80px;
}
.result-wrap[hidden] { display: none !important; }

/* Archetype header */
.arch-header {
  margin-bottom: 40px;
  animation: fadeUp .4s ease both;
}
.arch-label {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 16px;
  font-family: var(--font-head);
}
.arch-name {
  font-family: var(--font-head);
  font-size: clamp(28px, 5vw, 48px);
  font-weight: normal;
  line-height: 1.15;
  margin-bottom: 10px;
  color: var(--white);
}
.arch-sub {
  font-size: 16px;
  color: var(--gray);
  font-style: italic;
}

/* Scales */
.scales {
  background: var(--card);
  border: 1px solid var(--card-border);
  padding: 24px;
  margin-bottom: 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fadeUp .4s .1s ease both;
}
.scale-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  align-items: center;
  gap: 16px;
}
.scale-label {
  font-size: 12px;
  color: var(--gray);
  letter-spacing: .3px;
  white-space: nowrap;
}
.scale-track {
  height: 6px;
  background: #2a2a2a;
  position: relative;
}
.scale-fill {
  height: 100%;
  width: 0%;
  transition: width 1s ease;
}
.scale-fill--blue  { background: #4488cc; }
.scale-fill--red   { background: var(--red); }
.scale-fill--green { background: #447755; }

/* Body text */
.arch-body {
  margin-bottom: 40px;
  animation: fadeUp .4s .2s ease both;
}
.arch-body p {
  font-size: 16px;
  line-height: 1.85;
  color: var(--gray-light);
  margin-bottom: 18px;
}

/* kept for compatibility */
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 48px;
}
.result-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  padding: 28px 24px;
  animation: fadeUp .5s ease both;
}
.result-card:nth-child(2) { animation-delay: .15s; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
.card-label {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gray);
  font-family: var(--font-head);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--card-border);
}
.card-label--red { color: var(--red); }
.card-body {
  font-size: 15px;
  line-height: 1.8;
  color: var(--gray-light);
}
.card-body p + p { margin-top: 14px; }

/* Quote section */
.quote-section { margin-bottom: 40px; animation: fadeUp .5s .3s ease both; }
.quote-divider {
  height: 1px;
  background: var(--card-border);
  margin-bottom: 28px;
}
.quote-label {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 16px;
}
.quote-text {
  font-style: italic;
  font-size: 17px;
  color: var(--gray-light);
  line-height: 1.8;
  font-family: var(--font-head);
  margin-bottom: 10px;
}
.quote-source {
  font-size: 12px;
  color: var(--gray);
  font-style: normal;
  letter-spacing: .3px;
}

.result-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  animation: fadeUp .5s .4s ease both;
}

/* ─── ABOUT PAGE ─────────────────────────────────────────────── */
.page-about main { padding: 48px 32px 80px; }
.about-wrap { max-width: var(--max); margin: 0 auto; }
.about-title {
  font-family: var(--font-head);
  font-size: 36px;
  font-weight: normal;
  margin-bottom: 40px;
}
.about-section { margin-bottom: 36px; }
.about-section h2 {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: normal;
  color: var(--red);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--card-border);
}
.about-section p { color: var(--gray-light); margin-bottom: 12px; }
.about-list {
  color: var(--gray-light);
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ─── Footer ─────────────────────────────────────────────────── */
.footer {
  position: relative;
  z-index: 1;
  padding: 24px 32px;
  text-align: center;
  border-top: 1px solid var(--card-border);
}
.footer-link { font-size: 13px; color: var(--gray); letter-spacing: .5px; }
.footer-link:hover { color: var(--white); text-decoration: none; }

/* ─── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--card);
  border: 1px solid var(--red);
  color: var(--white);
  padding: 12px 28px;
  font-size: 14px;
  letter-spacing: .5px;
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
  z-index: 100;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .nav { padding: 16px 20px; }
  .home-wrap { padding: 48px 20px; }
  .home-orbit { display: none; }
  .progress-wrap { padding: 0 20px; }
  .quiz-wrap { padding: 28px 20px 60px; }
  .page-result main,
  .page-about main { padding: 32px 20px 60px; }
  .step-title { font-size: 20px; }
  .options-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .opt-btn { padding: 12px 12px; font-size: 13px; }
  .about-title { font-size: 26px; }
  .result-title { font-size: 22px; }
  .result-grid { grid-template-columns: 1fr; }
  .result-card { padding: 20px 18px; }
  .result-actions { flex-direction: column; }
  .btn-large { width: 100%; text-align: center; }
  .step-nav { flex-direction: row; }
}
@media (max-width: 360px) {
  .options-grid { grid-template-columns: 1fr; }
}
