:root {
  --bg: #0c0f14;
  --bg-elev: #141a22;
  --bg-elev-2: #1a222d;
  --line: #2a3544;
  --text: #e8eef6;
  --muted: #8b9bb0;
  --accent: #7c6cff;
  --accent-2: #3dd6c6;
  --warn: #f0a35e;
  --danger: #ff6b7a;
  --radius: 16px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(124, 108, 255, 0.18), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(61, 214, 198, 0.12), transparent 55%),
    var(--bg);
}

body { line-height: 1.5; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  background: rgba(12, 15, 20, 0.7);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; gap: 0.75rem; align-items: center; }
.mark {
  width: 2.25rem; height: 2.25rem; display: grid; place-items: center;
  border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b0d12; font-weight: 700;
}
.brand-title { font-weight: 700; letter-spacing: -0.02em; }
.brand-sub { color: var(--muted); font-size: 0.8rem; }
.pill {
  font-size: 0.75rem; color: var(--muted); border: 1px solid var(--line);
  padding: 0.35rem 0.7rem; border-radius: 999px; background: var(--bg-elev);
}

.main {
  width: min(880px, calc(100% - 2rem));
  margin: 1.5rem auto 2rem;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 1rem;
  border-top: 1px solid var(--line);
}

.panel {
  background: linear-gradient(180deg, rgba(26, 34, 45, 0.95), rgba(20, 26, 34, 0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.center { text-align: center; }
.error-panel { border-color: rgba(255, 107, 122, 0.4); }

.hero h1, .results h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0.4rem 0 1rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--accent-2);
  font-weight: 600;
  margin: 0;
}

.lede { color: #c4d0e0; font-size: 1.05rem; max-width: 52ch; }

.feature-list {
  margin: 1.25rem 0 1.5rem;
  padding-left: 1.1rem;
  color: var(--muted);
}
.feature-list li { margin: 0.4rem 0; }
.feature-list strong { color: var(--text); }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  margin-top: 1.25rem;
}

.hint { color: var(--muted); font-size: 0.85rem; }
.mono { font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace; }

.btn {
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  color: var(--text);
  border-radius: 12px;
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); border-color: #3d4d63; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.primary {
  background: linear-gradient(135deg, #6b5cff, #4f7cff);
  border-color: transparent;
  color: white;
}
.btn.accent {
  background: linear-gradient(135deg, #1f9f93, #3dd6c6);
  border-color: transparent;
  color: #06221f;
}
.btn.ghost { background: transparent; }
.btn.lg { padding: 0.85rem 1.3rem; font-size: 1.02rem; }

.progress-bar, .bar {
  height: 8px; background: #0e141c; border-radius: 999px; overflow: hidden; border: 1px solid var(--line);
  margin-bottom: 0.25rem;
}
.progress-fill, .bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: inherit;
}

.prompt {
  margin: 1.25rem 0 0.45rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.quiz-cue {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
  max-width: 46ch;
}

.options { display: grid; gap: 0.65rem; }
.option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: start;
  text-align: left;
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #101722;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}
.option:hover:not(:disabled) { border-color: #4a5d78; transform: translateY(-1px); }
.option.selected {
  border-color: rgba(124, 108, 255, 0.8);
  background: linear-gradient(180deg, rgba(124, 108, 255, 0.16), rgba(16, 23, 34, 0.9));
  box-shadow: inset 0 0 0 1px rgba(124, 108, 255, 0.25);
}
.opt-key {
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  color: var(--accent-2);
  background: #0b121a;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
}
.opt-text { padding-top: 0.2rem; }

.nav-row {
  display: flex; justify-content: space-between; gap: 0.75rem;
  margin-top: 1.4rem; flex-wrap: wrap;
}
.nav-right { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.saving { color: var(--warn); font-size: 0.85rem; margin: 0.75rem 0 0; }

.composites {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin: 1.5rem 0;
}
.comp-card {
  background: #101722;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
}
.comp-label { color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; }
.comp-value { font-size: 2rem; font-weight: 700; margin: 0.2rem 0 0.6rem; letter-spacing: -0.03em; }

.section-title { margin: 1.5rem 0 0.25rem; letter-spacing: -0.02em; }
.dim-list { display: grid; gap: 1rem; margin-top: 1rem; }
.dim-row {
  background: #101722;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1rem;
}
.dim-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.6rem;
  align-items: baseline;
  margin-bottom: 0.45rem;
}
.dim-code {
  color: var(--accent-2);
  font-size: 0.8rem;
  background: #0b121a;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1rem 0.4rem;
}
.dim-name { font-weight: 600; }
.dim-score { color: var(--text); font-weight: 600; }
.dim-desc { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.88rem; }

.spinner {
  width: 2rem; height: 2rem; margin: 0 auto 1rem;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent-2);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
  .panel { padding: 1.15rem; }
  .topbar { padding: 0.85rem 1rem; }
  .pill { display: none; }
  .nav-row {
    flex-direction: column;
    align-items: stretch;
  }
  .nav-right {
    width: 100%;
  }
  .nav-right .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
  .nav-row > .btn.ghost {
    align-self: flex-start;
  }
}


.consistency-panel {
  margin-top: 1.5rem;
  padding: 1.15rem 1.2rem;
  border-radius: 14px;
  border: 1px solid rgba(61, 214, 198, 0.35);
  background:
    linear-gradient(180deg, rgba(61, 214, 198, 0.08), rgba(16, 23, 34, 0.95));
}
.consistency-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.7rem;
}
.consistency-title {
  margin: 0.25rem 0 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.consistency-score-wrap { text-align: right; }
.consistency-score-wrap .comp-value { margin: 0; color: var(--accent-2); }
.consistency-fill {
  background: linear-gradient(90deg, #2a9d8f, #3dd6c6 55%, #7c6cff);
}
.consistency-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}
.consistency-stats .stat {
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  background: #0b121a;
}
.section-subtitle {
  margin: 1.1rem 0 0.5rem;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.dim-list.compact { gap: 0.65rem; }
.dim-list.compact .dim-row { padding: 0.7rem 0.85rem; }


.confidence-panel {
  margin-top: 1.25rem;
  padding: 1.15rem 1.2rem;
  border-radius: 14px;
  border: 1px solid rgba(240, 163, 94, 0.4);
  background:
    linear-gradient(180deg, rgba(240, 163, 94, 0.1), rgba(16, 23, 34, 0.95));
}
.confidence-value { color: var(--warn) !important; }
.confidence-fill {
  background: linear-gradient(90deg, #c47a3a, #f0a35e 55%, #7c6cff);
}


/* —— Email magic-link modal —— */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(6, 8, 12, 0.72);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal-card {
  width: min(440px, 100%);
  background: linear-gradient(180deg, #1a222d, #121820);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem 1.3rem 1.35rem;
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.modal-title {
  margin: 0.2rem 0 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.icon-btn {
  padding: 0.35rem 0.55rem;
  min-width: 2rem;
}
.field-label {
  display: block;
  margin: 1rem 0 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}
.field-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0b121a;
  color: var(--text);
  font: inherit;
  padding: 0.75rem 0.9rem;
  outline: none;
}
.field-input:focus {
  border-color: rgba(124, 108, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.15);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.1rem;
  flex-wrap: wrap;
}
.form-error {
  color: var(--danger);
  font-size: 0.88rem;
  margin: 0.55rem 0 0;
}
.form-ok {
  color: var(--accent-2);
  font-size: 0.88rem;
  margin: 0.55rem 0 0;
}
.resume-hint {
  background: rgba(240, 163, 94, 0.12);
  border: 1px solid rgba(240, 163, 94, 0.35);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  color: #f3d2ae;
  margin: 0 0 1rem;
}


/* —— Four people —— */
.person-type-card {
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 1.35rem 1.4rem 1.25rem;
  margin-bottom: 0.5rem;
  background: #101722;
}
.person-headline {
  font-size: clamp(1.55rem, 3.5vw, 2.1rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0.35rem 0 0.85rem;
}
.person-message {
  font-size: 1.05rem;
  color: #d5deea;
  line-height: 1.55;
  margin: 0 0 0.85rem;
  max-width: 52ch;
}
.person-ps {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-style: italic;
  border-top: 1px dashed var(--line);
  padding-top: 0.75rem;
}
.type-trickster {
  border-color: rgba(124, 108, 255, 0.55);
  background:
    linear-gradient(145deg, rgba(124, 108, 255, 0.18), rgba(16, 23, 34, 0.95) 55%);
}
.type-trickster .person-headline { color: #c7bfff; }
.type-puzzle {
  border-color: rgba(240, 163, 94, 0.5);
  background:
    linear-gradient(145deg, rgba(240, 163, 94, 0.14), rgba(16, 23, 34, 0.95) 55%);
}
.type-puzzle .person-headline { color: #f3c896; }
.type-liar {
  border-color: rgba(255, 107, 122, 0.55);
  background:
    linear-gradient(145deg, rgba(255, 107, 122, 0.14), rgba(16, 23, 34, 0.95) 55%);
}
.type-liar .person-headline { color: #ffb0b8; }
.type-boring {
  border-color: rgba(139, 155, 176, 0.45);
  background:
    linear-gradient(145deg, rgba(139, 155, 176, 0.12), rgba(16, 23, 34, 0.95) 55%);
}
.type-boring .person-headline { color: #c5d0de; }

.disclaimer {
  margin-top: 1.25rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  max-width: 52ch;
}

/* Hide static boot splash once Yew has rendered */
body:has(.app-shell) #boot { display: none; }
