/* Psy-Tests (base copied from Chapter Shifter) — cosmic dark, matches homepage / qr/ / s/ */

:root {
  --bg:         #03040f;
  --bg2:        #080a1c;
  --bg3:        #0d1030;
  --purple:     #8b5cf6;
  --purple-dim: #5b21b6;
  --cyan:       #22d3ee;
  --gold:       #fbbf24;
  --gold-deep:  #f59e0b;
  --gold-light: #fde68a;
  --rose:       #f472b6;
  --text:       #e2e8f0;
  --muted:      #94a3b8;
  --border:     rgba(139,92,246,0.18);
  --card:       rgba(10,12,35,0.85);
  --red:        #f87171;
  --nav-h:      64px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100%;
}

button, a, input, textarea, select { font-family: inherit; }
button { touch-action: manipulation; }

#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.nebula {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.nebula::before,
.nebula::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}
.nebula::before {
  width: 60vw; height: 60vw;
  top: -20vw; left: -10vw;
  background: radial-gradient(ellipse, rgba(139,92,246,0.12) 0%, transparent 70%);
  animation: nebulaDrift 30s ease-in-out infinite alternate;
}
.nebula::after {
  width: 50vw; height: 50vw;
  bottom: -10vw; right: -5vw;
  background: radial-gradient(ellipse, rgba(34,211,238,0.09) 0%, transparent 70%);
  animation: nebulaDrift 40s ease-in-out infinite alternate-reverse;
}
@keyframes nebulaDrift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(3vw, 4vh) scale(1.08); }
}

.page { position: relative; z-index: 2; }

.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: var(--nav-h);
  background: rgba(3,4,15,0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-logo {
  font-family: Cinzel, serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-logo:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}
.logo-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 0 8px var(--purple);
  display: inline-block;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.7); }
}
.site-nav nav { display: flex; gap: 1.5rem; }
.site-nav nav a {
  font-family: Cinzel, serif;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.1em;
}
.site-nav nav a:hover,
.site-nav nav a[aria-current="page"] { color: var(--text); }
.site-nav nav a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s, box-shadow 0.25s, transform 0.25s, border-color 0.25s;
  border: none;
  background: transparent;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.btn-primary {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 0 20px rgba(139,92,246,0.35);
}
.btn-primary:hover:not(:disabled) {
  background: #7c3aed;
  box-shadow: 0 0 32px rgba(139,92,246,0.55);
  transform: translateY(-1px);
}
.btn-ghost {
  border: 1px solid var(--border);
  background: rgba(139,92,246,0.08);
}
.btn-ghost:hover:not(:disabled) {
  border-color: rgba(139,92,246,0.45);
  background: rgba(139,92,246,0.18);
}


main.page {
  padding: calc(var(--nav-h) + 2.75rem) 2rem 4rem;
  max-width: 1280px;
  margin: 0 auto;
}
.hero { margin-bottom: 2.25rem; max-width: 760px; }
.eyebrow {
  font-size: 0.72rem; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--purple); font-weight: 500; margin-bottom: 1rem;
}
.hero h1 {
  font-family: Cinzel, serif;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  font-weight: 700; letter-spacing: 0.06em; line-height: 1.08;
  background: linear-gradient(135deg, #fff 0%, var(--purple) 50%, var(--cyan) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.9rem;
}
.lede {
  font-family: "Playfair Display", serif; font-style: italic;
  color: var(--muted); font-size: 1.12rem; line-height: 1.6;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.4rem 1.25rem 1.5rem;
  box-shadow: 0 0 40px rgba(91,33,182,0.12);
  min-width: 0;
}
.panel-title {
  font-family: Cinzel, serif;
  font-size: 1.05rem; font-weight: 600; letter-spacing: 0.08em;
  color: var(--gold);
  text-shadow: 0 0 14px rgba(251,191,36,0.25);
  margin-bottom: 0.9rem;
}
.field-label {
  display: block;
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; margin-bottom: 0.5rem;
}
.hint { margin-top: 0.7rem; font-size: 0.82rem; color: var(--muted); line-height: 1.55; }
.hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem; color: var(--gold-light);
  background: rgba(251,191,36,0.08); padding: 0 0.25rem; border-radius: 3px;
}
.status { margin-top: 0.5rem; font-size: 0.82rem; color: var(--cyan); min-height: 1.2em; }
.status.err { color: var(--red); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 0.85rem; }

/* ── Psy-Tests ── */
main.page { max-width: 1040px; }
.skip { position: absolute; left: -999px; top: 0; z-index: 50; background: var(--gold); color: #000; padding: .5rem 1rem; }
.skip:focus { left: 1rem; top: .5rem; }
a { color: var(--cyan); }
.h1-sm { font-size: clamp(1.8rem, 5vw, 2.6rem) !important; }
.crumbs { font-size: .82rem; color: var(--muted); margin-bottom: 1.2rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.disclaimer, .note-box { background: rgba(139,92,246,.08); border: 1px solid var(--border); border-left: 3px solid var(--purple); border-radius: 8px; padding: .8rem 1rem; font-size: .88rem; color: var(--muted); margin-bottom: 1.5rem; }
.disclaimer strong { color: var(--gold-light); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.card { display: flex; flex-direction: column; gap: .35rem; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.2rem; text-decoration: none; color: var(--text); transition: border-color .2s, box-shadow .2s, transform .2s; }
.card:hover, .card:focus-visible { border-color: var(--purple); box-shadow: 0 0 28px rgba(139,92,246,.3); transform: translateY(-2px); outline: none; }
.card h2 { font-family: Cinzel, serif; color: var(--gold); font-size: 1.05rem; letter-spacing: .05em; line-height: 1.3; }
.card p { font-size: .88rem; color: var(--muted); line-height: 1.5; }
.card-sub { color: var(--cyan) !important; }
.count { margin-top: auto; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--purple); padding-top: .4rem; }
.panel { margin-bottom: 1.25rem; }
.qform { padding: 1.5rem; }
.instructions { margin-bottom: .9rem; line-height: 1.6; }
.stem { font-weight: 600; color: var(--gold-light); margin: .6rem 0 1rem; }
.matrix { margin: 1rem 0 1.4rem; }
.mx-head { display: grid; grid-template-columns: minmax(0, 2.2fr) repeat(var(--n), minmax(0, 1fr)); gap: .3rem; font-size: .72rem; color: var(--muted); text-align: center; position: sticky; top: var(--nav-h); background: rgba(8,10,28,.96); padding: .5rem 0; z-index: 3; border-bottom: 1px solid var(--border); }
.q { border: 0; display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, var(--n)fr); align-items: center; gap: .3rem; padding: .55rem 0; border-bottom: 1px solid rgba(139,92,246,.1); }
.q legend { float: left; width: 100%; padding-right: .8rem; font-size: .95rem; line-height: 1.45; }
.q { grid-template-columns: minmax(0, 2.2fr) repeat(var(--n), minmax(0, 1fr)); }
.q legend { grid-column: 1; }
.q .opts { display: contents; }
.qn { color: var(--muted); font-size: .8rem; }
.q.missing { background: rgba(248,113,113,.08); box-shadow: inset 3px 0 0 var(--red); }
.opt { position: relative; display: flex; justify-content: center; align-items: center; cursor: pointer; min-height: 44px; border-radius: 8px; }
.opt input { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(148,163,184,.55); background: transparent; cursor: pointer; transition: all .15s; }
.opt input:checked { border-color: var(--cyan); background: radial-gradient(circle, var(--cyan) 0 45%, transparent 50%); box-shadow: 0 0 12px rgba(34,211,238,.5); }
.opt input:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.opt:hover input { border-color: var(--purple); }
.opt-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.matrix:not(:has(.mx-head)) .opt-label, .q:only-child .opt-label { position: static; width: auto; height: auto; clip: auto; white-space: normal; font-size: .78rem; color: var(--muted); margin-left: .4rem; }
.matrix:not(:has(.mx-head)) .q { grid-template-columns: 1fr; }
.matrix:not(:has(.mx-head)) .opts { display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.matrix:not(:has(.mx-head)) .opt { justify-content: flex-start; }
@media (max-width: 760px) {
  .mx-head { display: none; }
  .q { grid-template-columns: 1fr !important; }
  .q .opts { display: flex; flex-direction: column; gap: .2rem; }
  .opt { justify-content: flex-start; padding: .2rem .5rem; border: 1px solid rgba(139,92,246,.15); }
  .opt-label { position: static; width: auto; height: auto; clip: auto; white-space: normal; font-size: .88rem; color: var(--text); margin-left: .6rem; }
  .opt:has(input:checked) { border-color: var(--cyan); background: rgba(34,211,238,.06); }
  main.page { padding-left: 1rem; padding-right: 1rem; }
}
.free textarea, input[type=email], select { width: 100%; background: rgba(3,4,15,.8); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: .65rem .8rem; font-size: 1rem; }
.free { margin-top: 1rem; }
.submit-row { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; margin-top: 1.2rem; flex-wrap: wrap; }
.progress { position: sticky; bottom: 0; z-index: 5; height: 30px; background: rgba(8,10,28,.95); border: 1px solid var(--border); border-radius: 15px; overflow: hidden; margin: 0 0 1.25rem; }
.progress .bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--purple), var(--cyan)); transition: width .25s; opacity: .55; }
.progress .ptext { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .78rem; }
.help { border-radius: 12px; padding: 1.2rem 1.3rem; margin-bottom: 1.25rem; }
.help h2 { font-family: Cinzel, serif; font-size: 1.1rem; margin-bottom: .5rem; }
.help.crisis { background: rgba(127,29,29,.35); border: 2px solid var(--red); }
.help.crisis h2 { color: #fecaca; }
.help.support { background: rgba(34,211,238,.06); border: 1px solid rgba(34,211,238,.35); }
.help.support h2 { color: var(--cyan); }
.res { list-style: none; margin: .7rem 0; display: grid; gap: .5rem; }
.res li { display: flex; flex-wrap: wrap; gap: .2rem .8rem; background: rgba(3,4,15,.5); padding: .55rem .8rem; border-radius: 8px; }
.res-links a { color: var(--gold-light); font-weight: 600; }
.outside { font-size: .88rem; color: var(--muted); }
.modal-bg { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal { max-width: 600px; width: 100%; max-height: 92vh; overflow: auto; background: var(--bg2); border-radius: 14px; padding: .4rem; text-align: right; }
.modal .help { text-align: left; margin: 0 0 .6rem; }
.modal .btn { margin: 0 .8rem .8rem; }
.chart { width: 100%; height: auto; margin: .8rem 0 1rem; }
.chart .cl { fill: var(--text); font-size: 13px; font-family: Inter, sans-serif; }
.chart .cv { fill: var(--gold); font-size: 14px; font-weight: 600; font-family: Inter, sans-serif; }
.chart .cx { fill: var(--muted); font-size: 11px; }
.chart .track { fill: rgba(148,163,184,.15); }
.chart .tick { stroke: rgba(251,191,36,.6); stroke-width: 2; }
.chart .normband { fill: rgba(251,191,36,.16); }
.chart .normmean { stroke: var(--gold); stroke-width: 2; stroke-dasharray: 3 2; }
.chart .dot { fill: #fff; stroke: var(--cyan); stroke-width: 3; }
.tablewrap { overflow-x: auto; }
.scores { width: 100%; border-collapse: collapse; font-size: .9rem; }
.scores th, .scores td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid rgba(139,92,246,.15); vertical-align: top; }
.scores thead th { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.scores .sv { font-weight: 600; color: var(--gold); white-space: nowrap; }
.rnote { display: block; font-weight: 400; font-size: .74rem; color: var(--muted); margin-top: .2rem; }
.muted { color: var(--muted); }
.bands { list-style: none; display: grid; gap: .4rem; margin: .6rem 0; }
.bands li { padding: .5rem .8rem; border: 1px solid var(--border); border-radius: 8px; font-size: .9rem; }
.bands li.on { border-color: var(--gold); background: rgba(251,191,36,.08); }
.br { color: var(--muted); font-variant-numeric: tabular-nums; }
.bx { display: block; color: var(--muted); font-size: .84rem; margin-top: .2rem; }
.you { color: var(--gold); font-style: normal; font-size: .8rem; }
.defs dt { font-weight: 600; color: var(--gold-light); margin-top: .5rem; }
.defs dd { color: var(--muted); font-size: .9rem; }
.panel p + p { margin-top: .6rem; }
.credits p { font-size: .88rem; }
.credits details { margin-top: .6rem; font-size: .85rem; }
.src { margin: .4rem 0 0 1.2rem; word-break: break-word; }
.mailrow input { flex: 1 1 240px; }
.normpick { max-width: 520px; }
.foot { position: relative; z-index: 2; max-width: 1040px; margin: 0 auto; padding: 1.5rem 2rem 3rem; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--border); }
.foot p + p { margin-top: .4rem; }
@media (max-width: 480px) { .site-nav nav { display: none; } }
.topic { font-family: Cinzel, serif; font-size: .95rem; color: var(--gold-light); margin: .9rem 0 .2rem; }
.optq { color: var(--muted); font-size: .8rem; }
.instructions.sect { margin-top: 1.4rem; font-weight: 500; color: var(--gold-light); }
.free-opts { display: flex !important; flex-wrap: wrap; gap: .3rem .9rem; }
.freeq { grid-template-columns: 1fr !important; }
.freeq .opt { justify-content: flex-start; }
.freeq .opt-label { position: static; width: auto; height: auto; clip: auto; margin-left: .4rem; font-size: .85rem; }
.crisis-link { font-size: .88rem; color: var(--muted); margin: 0 0 1.25rem; }
.fsec + .fsec { margin-top: 1.6rem; padding-top: .4rem; border-top: 1px solid rgba(139,92,246,.18); }
.sec-title { font-family: Cinzel, serif; color: var(--gold); font-size: 1rem; margin-bottom: .4rem; }
.copyright { font-size: .78rem; color: var(--muted); margin-top: 1rem; }
.gen-wrap { margin-top: 2rem; }
