@font-face {
  font-family: "Assistant";
  src: url("fonts/Assistant.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --night: #04110D;
  --ink: #091D19;
  --deep: #0E2A22;
  --forest: #294D40;
  --sage: #7A998A;
  --chalk: #F1ECD9;
  --acid: #D1ED6A;
  --acid-hot: #F4FBD2;
  --hair: rgba(122, 153, 138, 0.32);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(20px, 5vw, 40px);
  --lamp-drop: clamp(64px, 11svh, 120px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--night); }
body {
  margin: 0;
  background: var(--night);
  color: var(--chalk);
  font-family: "Assistant", system-ui, sans-serif;
  font-weight: 600;
  font-size: 18px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  caret-color: var(--acid);
  scrollbar-color: var(--forest) var(--night);
}
::selection { background: var(--acid); color: var(--ink); }
:focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* The room: one light source, everything else falls off into night. */
.room {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  padding: 0 var(--gutter) 40px;
  background:
    radial-gradient(ellipse 60% 48% at 50% 34%, var(--ink) 0%, transparent 100%),
    var(--night);
}

/* Lamp rig swings as one piece from the ceiling point. */
.rig {
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 100%;
  transform-origin: 50% 0;
  z-index: -1;
  pointer-events: none;
}
.cord {
  position: absolute;
  top: 0;
  left: -1px;
  width: 2px;
  height: var(--lamp-drop);
  background: var(--forest);
}
.shade {
  position: absolute;
  top: var(--lamp-drop);
  left: -46px;
  width: 92px;
  height: 40px;
  overflow: visible;
}
.shade-out { fill: var(--forest); }
.shade-in { fill: var(--deep); }
.bulb {
  position: absolute;
  top: calc(var(--lamp-drop) + 34px);
  left: -14px;
  width: 28px;
  height: 12px;
  border-radius: 0 0 14px 14px;
  background: var(--acid-hot);
}
.bulb::after {
  content: "";
  position: absolute;
  inset: -40px -60px;
  background: radial-gradient(closest-side, rgba(209, 237, 106, 0.42), rgba(209, 237, 106, 0.08) 55%, transparent);
}
.cone {
  position: absolute;
  top: calc(var(--lamp-drop) + 40px);
  left: -50vmax;
  width: 100vmax;
  height: 120svh;
  clip-path: polygon(46.4% 0, 53.6% 0, 72% 100%, 28% 100%);
  background: linear-gradient(rgba(241, 236, 217, 0.10), rgba(241, 236, 217, 0.035) 40%, transparent 72%);
  filter: blur(18px);
  transform-origin: 50% 0;
  transition: transform 900ms var(--ease), opacity 900ms var(--ease);
}
.room[data-state="result"] .cone { transform: scaleX(1.5); }

.pool {
  position: absolute;
  inset: auto 0 0;
  height: 70%;
  z-index: -2;
  background: radial-gradient(ellipse 46% 38% at 50% 52%, rgba(209, 237, 106, 0.07), transparent 70%);
  pointer-events: none;
}

.room.swing .rig { animation: swing 1100ms var(--ease); }
@keyframes swing {
  0% { transform: rotate(0); }
  18% { transform: rotate(-3.4deg); }
  46% { transform: rotate(1.8deg); }
  72% { transform: rotate(-0.6deg); }
  100% { transform: rotate(0); }
}

/* Header: compass at the start corner, progress ticks opposite. */
.bar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: max(18px, env(safe-area-inset-top));
}
.mark { width: 40px; height: 40px; display: block; }
.ticks {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  direction: rtl;
  opacity: 0;
  transition: opacity 400ms var(--ease);
}
.room:not([data-state="intro"]) .ticks { opacity: 1; }
.ticks li {
  width: 18px;
  height: 4px;
  background: var(--forest);
  transition: background-color 300ms var(--ease);
}
.ticks li.done { background: var(--chalk); }
.ticks li.now { background: var(--sage); }

/* Scenes sit in the pool of light under the lamp. */
.scene {
  position: relative;
  max-width: 34rem;
  margin: 0 auto;
  padding-top: calc(var(--lamp-drop) + 64px);
  text-align: center;
}
.scene.enter { animation: settle 700ms var(--ease); }
@keyframes settle {
  from { opacity: 0.2; transform: translateY(14px); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: none; }
}

h1, h2, h3 { font-weight: 800; margin: 0; text-wrap: balance; letter-spacing: -0.02em; }
h1 { font-size: clamp(46px, 12.5vw, 72px); line-height: 0.94; outline: none; }
h2 { font-size: clamp(30px, 7.6vw, 48px); line-height: 1.04; outline: none; }
h3 { font-size: clamp(26px, 6.4vw, 34px); line-height: 1.08; }

.sub {
  margin: 22px auto 0;
  max-width: 26em;
  color: var(--sage);
  font-size: clamp(18px, 4.6vw, 21px);
  text-wrap: pretty;
}

.go {
  display: block;
  width: 100%;
  max-width: 22rem;
  margin: 36px auto 0;
  padding: 18px 24px;
  border: 0;
  border-radius: 6px;
  background: var(--acid);
  color: var(--ink);
  font-weight: 800;
  font-size: 21px;
  transition: background-color 200ms var(--ease), transform 200ms var(--ease);
}
.go:active { transform: scale(0.98); }

.creed {
  margin: 64px auto 0;
  max-width: 30rem;
  padding-top: 22px;
  border-top: 1px solid var(--hair);
}
.creed blockquote {
  margin: 0;
  color: var(--chalk);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
  unicode-bidi: isolate;
}
.creed figcaption { margin-top: 8px; color: var(--sage); font-size: 16px; }

/* Quiz */
.answers {
  display: grid;
  gap: 10px;
  margin-top: 34px;
}
.answer {
  position: relative;
  width: 100%;
  padding: 17px 52px 17px 20px;
  border: 1px solid var(--forest);
  border-radius: 6px;
  background: rgba(9, 29, 25, 0.78);
  text-align: right;
  font-size: 19px;
  line-height: 1.3;
  transition: border-color 200ms var(--ease), background-color 200ms var(--ease), color 200ms var(--ease);
}
.answer::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 20px;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 1.5px solid var(--sage);
  border-radius: 50%;
  transition: background-color 200ms var(--ease), border-color 200ms var(--ease);
}
.answer[aria-pressed="true"] { border-color: var(--acid); color: var(--acid); }
.answer[aria-pressed="true"]::before { background: var(--acid); border-color: var(--acid); }
.room.busy .answer { pointer-events: none; }

.quiz-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 26px;
  color: var(--sage);
}
.back {
  padding: 10px 2px;
  border: 0;
  background: none;
  color: var(--sage);
  font-weight: 600;
  font-size: 17px;
  text-decoration: underline;
  text-decoration-color: var(--hair);
  text-underline-offset: 5px;
}
.count { font-variant-numeric: tabular-nums; font-size: 17px; }

/* Part title screens */
.part-count { margin: 0 0 10px; color: var(--sage); font-size: 17px; font-variant-numeric: tabular-nums; }
.part-title { font-size: clamp(46px, 12.5vw, 72px); line-height: 0.96; }

/* Typed answers */
.answer.multi::before { border-radius: 2px; }
.entry {
  display: block;
  width: 100%;
  margin-top: 30px;
  padding: 15px 16px;
  border: 1px solid var(--sage);
  border-radius: 6px;
  background: var(--ink);
  color: var(--chalk);
  font-size: 19px;
  line-height: 1.45;
  text-align: right;
  resize: vertical;
}
.entry[type="number"] { max-width: 9rem; margin-inline: auto; text-align: center; font-size: 28px; font-weight: 800; }
.entry:focus-visible { outline-offset: 0; border-color: var(--acid); }
.hint { margin: 10px 0 0; color: var(--sage); font-size: 16px; text-align: right; }
.entry[type="number"] + .hint { text-align: center; }
.go.next { margin-top: 24px; }
#q-error { text-align: center; }

/* Result */
.score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 0;
}
.score-n { font-size: clamp(76px, 22vw, 96px); font-weight: 800; line-height: 0.9; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.score span { color: var(--sage); font-size: 19px; }
.radar-wrap { margin: 16px auto 0; max-width: 26rem; }
.radar { display: block; width: 100%; height: auto; overflow: visible; }
.radar .ring { fill: none; stroke: var(--forest); stroke-width: 1; }
.radar .spoke { stroke: var(--forest); stroke-width: 1; }
.radar .shape { fill: rgba(209, 237, 106, 0.16); stroke: var(--acid); stroke-width: 2; stroke-linejoin: round; }
.radar .dot { fill: var(--acid); }
.radar .axis { fill: var(--chalk); font-family: inherit; font-size: 15px; font-weight: 800; }
.radar .axis-n { fill: var(--sage); font-weight: 600; font-size: 14px; }
.room[data-state="result"] .radar .shape,
.room[data-state="result"] .radar .dot { animation: grow 1100ms var(--ease) both; transform-origin: 0 0; }
@keyframes grow { from { transform: scale(0.2); opacity: 0; } }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.verdict {
  margin: 18px auto 0;
  color: var(--sage);
  font-size: clamp(19px, 4.8vw, 22px);
  line-height: 1.4;
  text-wrap: balance;
}
.verdict strong { color: var(--chalk); font-weight: 800; }
.draft { margin: 14px 0 0; color: var(--sage); font-size: 16px; }

.join { margin-top: 30px; text-align: right; }
.join-sub { margin: 10px 0 0; color: var(--sage); }
.join label {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  font-size: 16px;
  color: var(--sage);
}
.join input:not([type="checkbox"]) {
  width: 100%;
  padding: 15px 16px;
  border: 1px solid var(--sage);
  border-radius: 6px;
  background: var(--ink);
  color: var(--chalk);
  font-size: 19px;
}
.join input[dir="ltr"] { text-align: right; }
.join input::placeholder { color: var(--sage); opacity: 1; }
.join input:focus-visible { outline-offset: 0; border-color: var(--acid); }
.join input[aria-invalid="true"] { border-color: var(--chalk); }
.error { margin: 14px 0 0; color: var(--chalk); font-weight: 800; }
.join .go { max-width: none; margin-top: 26px; }
.fine { margin: 12px 0 0; color: var(--sage); font-size: 15px; }

.again { display: block; margin: 28px auto 0; }

.sign {
  display: flex;
  justify-content: center;
  margin-top: 80px;
  padding-bottom: env(safe-area-inset-bottom);
}
.sign img { width: 128px; height: auto; display: block; }
.room[data-state="quiz"] .sign { visibility: hidden; }

@media (min-width: 900px) {
  .scene { padding-top: calc(var(--lamp-drop) + 96px); }
  .answers { gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
}

#intro { max-width: 48rem; }

@media (hover: hover) {
  .go:hover { background: var(--acid-hot); }
  .answer:hover { border-color: var(--sage); background: rgba(14, 42, 34, 0.9); }
  .back:hover { color: var(--chalk); text-decoration-color: currentColor; }
  .join input:hover { border-color: var(--chalk); }
}

.join .check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 22px;
  color: var(--chalk);
  font-size: 17px;
  cursor: pointer;
}
.join .check input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  accent-color: var(--acid);
}
.resume { display: block; margin: 18px auto 0; }
#lead .sub { margin-top: 14px; }

.private {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: center;
  max-width: 22rem;
  margin: 18px auto 0;
  color: var(--chalk);
  font-size: 16px;
  line-height: 1.45;
  text-align: right;
}
.private svg {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 4px;
  fill: none;
  stroke: var(--sage);
  stroke-width: 1.5;
}

/* Honeypot for bots: off-screen, never seen or focused by people. */
.join .trap { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Reading pages (privacy policy): the same night, no lamp, one comfortable column. */
.doc {
  max-width: 42rem;
  margin: 0 auto;
  padding: 24px var(--gutter) 64px;
  font-weight: 400;
  font-size: 17px;
  line-height: 1.7;
}
.doc-bar { padding-bottom: 24px; }
.doc-bar a { display: inline-block; }
.doc h1 { margin: 8px 0 4px; font-size: clamp(30px, 6vw, 40px); font-weight: 800; line-height: 1.15; }
.doc h2 { margin: 40px 0 8px; font-size: 22px; font-weight: 800; }
.doc h3 { margin: 24px 0 4px; font-size: 18px; font-weight: 800; }
.doc p, .doc ul, .doc ol { margin: 10px 0; }
.doc ul, .doc ol { padding-inline-start: 1.3em; }
.doc li { margin: 4px 0; }
.doc strong { font-weight: 800; }
.doc a, .join .check a, .private a { color: var(--chalk); text-decoration: underline; text-decoration-color: var(--sage); text-underline-offset: 3px; }
.doc .table { overflow-x: auto; margin: 14px 0; }
.doc table { width: 100%; border-collapse: collapse; font-size: 16px; }
.doc th, .doc td { padding: 10px 12px; border-bottom: 1px solid var(--hair); text-align: right; vertical-align: top; }
.doc th { color: var(--sage); font-weight: 600; }
.doc-back { margin-top: 48px; }

.hint.note { margin-top: 2px; }
.sign { flex-direction: column; align-items: center; gap: 18px; }
.sign .legal { color: var(--sage); font-size: 14px; text-decoration: underline; text-decoration-color: var(--hair); text-underline-offset: 3px; }
