/* Intergalactic Night Circus — theme tokens */
:root {
  /* Palette pulled from the event invitation */
  --night: #070b17;
  --night-2: #0f1a2c;
  --nebula-teal: #1d4a5a;
  --nebula-amber: #7a3f18;
  --ink: #f6ead2;
  --ink-dim: #c9b896;
  --gold: #f0c06a;
  --gold-deep: #b9822f;
  --tent-a: #7a1f2b;   /* big-top burgundy */
  --tent-b: #ecd6ab;   /* big-top cream */
  --card: rgba(10, 17, 32, 0.74);
  --card-edge: rgba(240, 192, 106, 0.38);
  --accent: var(--gold); /* swapped per archetype on the result screen */
  --radius: 14px;
  --display: "Cinzel Decorative", "Cinzel", serif;
  --caps: "Cinzel", "Trajan Pro", serif;
  --body: "EB Garamond", Georgia, serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

body {
  min-height: 100dvh;
  font-family: var(--body);
  color: var(--ink);
  background:
    radial-gradient(90% 55% at 30% 8%, rgba(29,74,90,.85) 0%, transparent 65%),
    radial-gradient(70% 45% at 95% 30%, rgba(122,63,24,.55) 0%, transparent 70%),
    radial-gradient(80% 50% at 0% 75%, rgba(122,63,24,.45) 0%, transparent 70%),
    radial-gradient(90% 50% at 70% 100%, rgba(29,74,90,.6) 0%, transparent 70%),
    var(--night);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

#stars {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Gold celestial frame, echoing the invitation border */
.frame {
  position: fixed; inset: 8px;
  pointer-events: none;
  z-index: 2;
  border: 1px solid rgba(240,192,106,.55);
  border-radius: 4px;
}
.frame::before {
  content: ""; position: absolute; inset: 4px;
  border: 1px dashed rgba(240,192,106,.25);
}
.frame .moon {
  position: absolute; width: 22px; height: 22px;
  color: var(--gold);
  background: var(--night);
  border-radius: 50%;
  padding: 2px;
}
.frame .tl { top: -11px; left: -11px; }
.frame .tr { top: -11px; right: -11px; transform: scaleX(-1); }
.frame .bl { bottom: -11px; left: -11px; transform: scaleY(-1); }
.frame .br { bottom: -11px; right: -11px; transform: scale(-1); }

/* Swag of carnival bulbs across the top */
.lights {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 40px;
  z-index: 3;
  pointer-events: none;
}
.lights circle { fill: #ffd98a; filter: drop-shadow(0 0 4px #ffb547); animation: bulb 2.4s ease-in-out infinite alternate; }
.lights circle:nth-child(odd) { animation-delay: -1.2s; }
@keyframes bulb { from { opacity: .55; } to { opacity: 1; } }

main {
  position: relative; z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(52px + env(safe-area-inset-top)) 24px calc(36px + env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
}

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
  gap: 18px;
}
.screen.is-active { display: flex; animation: rise .5s cubic-bezier(.2,.8,.2,1) both; }

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

/* ---------- Intro ---------- */
.eyebrow {
  margin: 0;
  font-family: var(--caps);
  font-size: 12px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold);
}

.marquee { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tent { width: min(230px, 60vw); height: auto; filter: drop-shadow(0 0 22px rgba(240,192,106,.35)); }

h1 { margin: 0; font-family: var(--display); font-weight: 400; line-height: .95; }
h1, .result-name { font-variant-ligatures: no-common-ligatures no-discretionary-ligatures; font-feature-settings: "liga" 0, "dlig" 0, "calt" 0, "clig" 0; }
h1 span { display: block; }
.title-small { font-family: var(--caps); font-size: 18px; color: var(--ink-dim); letter-spacing: .3em; text-transform: uppercase; }
.title-big {
  font-size: clamp(30px, 9.4vw, 52px);
  font-weight: 700;
  background: linear-gradient(180deg, #fff6d6 0%, var(--gold) 45%, var(--gold-deep) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 30px rgba(240,192,106,.25);
}
.title-mid {
  font-size: clamp(26px, 8vw, 42px);
  font-weight: 700;
  color: var(--gold);
  margin-top: 6px;
}

.lede { margin: 0; max-width: 34ch; font-size: 19px; line-height: 1.5; color: var(--ink-dim); }
.fineprint { margin: 0; font-size: 15px; color: var(--ink-dim); opacity: .85; }

/* ---------- Buttons ---------- */
.btn {
  font: 700 15px/1 var(--caps);
  letter-spacing: .1em;
  text-transform: uppercase;
  border: 0;
  border-radius: 999px;
  padding: 18px 30px;
  min-height: 56px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  color: #2a1500;
  background: linear-gradient(180deg, #ffe3a3, var(--gold) 50%, var(--gold-deep));
  box-shadow: 0 0 0 2px rgba(255,255,255,.15) inset, 0 8px 28px rgba(240,192,106,.35);
}
.btn-secondary {
  color: var(--ink);
  background: transparent;
  box-shadow: 0 0 0 1.5px var(--card-edge) inset;
}
.btn-ghost {
  font: 500 17px var(--body);
  color: var(--ink-dim);
  background: none; border: 0; padding: 8px 4px; cursor: pointer;
  min-width: 64px; text-align: left;
}
.btn-ghost[disabled] { visibility: hidden; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- Question ---------- */
#screen-question { justify-content: flex-start; padding-top: 8px; }

.q-header {
  width: 100%;
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  align-items: center;
}
.q-count { font-family: var(--caps); font-size: 13px; color: var(--ink-dim); text-align: right; letter-spacing: .08em; }

.progress { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; gap: 10px; }
.progress li {
  width: 14px; height: 14px;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  background: rgba(201,184,150,.3);
  transition: background .3s, transform .3s;
}
.progress li.done { background: var(--gold); }
.progress li.current { background: var(--tent-b); transform: scale(1.3); }

.q-prompt {
  margin: 10px 0 4px;
  font-family: var(--caps);
  font-weight: 700;
  font-size: clamp(22px, 6vw, 30px);
  line-height: 1.25;
  color: var(--gold);
  outline: none;
}

.answers { width: 100%; display: flex; flex-direction: column; gap: 10px; }

.answer {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  text-align: left;
  font: 500 18px/1.3 var(--body);
  color: var(--ink);
  padding: 14px 16px;
  min-height: 60px;
  border-radius: var(--radius);
  border: 1px solid var(--card-edge);
  background: var(--card);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s;
  animation: rise .45s cubic-bezier(.2,.8,.2,1) both;
}
.answer:hover { border-color: var(--gold); }
.answer:active { transform: scale(.985); }
.answer .bullet {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  font: 400 14px var(--caps);
  color: var(--gold);
  border: 1.5px solid var(--card-edge);
}
.answer.is-selected {
  border-color: var(--gold);
  background: linear-gradient(90deg, rgba(240,192,106,.24), rgba(10,17,32,.85));
  box-shadow: 0 0 24px rgba(240,192,106,.28);
}
.answer.is-selected .bullet { background: var(--gold); color: #2a1500; border-color: var(--gold); }

/* ---------- Reveal ---------- */
.crystal {
  width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, #ffe3a3 16%, #3f8a9a 48%, #0f1a2c 78%);
  box-shadow: 0 0 60px rgba(240,192,106,.5), inset 0 -12px 30px rgba(0,0,0,.5);
  position: relative;
  animation: pulse 1.2s ease-in-out infinite alternate;
}
.crystal span {
  position: absolute; inset: -18px; border-radius: 50%;
  border: 2px dashed rgba(240,192,106,.6);
  animation: spin 3s linear infinite;
}
.reveal-text { font-family: var(--caps); font-size: 20px; color: var(--gold); margin: 8px 0 0; }
@keyframes pulse { to { transform: scale(1.06); box-shadow: 0 0 90px rgba(240,192,106,.75), inset 0 -12px 30px rgba(0,0,0,.5); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Result ---------- */
.result-card {
  width: 100%;
  padding: 26px 22px 20px;
  border-radius: 26px;
  background:
    radial-gradient(90% 60% at 50% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    var(--card);
  border: 1.5px solid color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 0 50px color-mix(in srgb, var(--accent) 22%, transparent), 0 20px 50px rgba(0,0,0,.4);
  display: flex; flex-direction: column; align-items: center;
}

.ring {
  position: relative;
  width: 170px; height: 170px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 15%, transparent), 0 0 40px color-mix(in srgb, var(--accent) 55%, transparent);
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 18%, var(--night)) 0%, var(--night) 70%);
  animation: emblem-in .9s cubic-bezier(.2,1.4,.4,1) both;
}
.ring::before {
  content: ""; position: absolute; inset: -20px; border-radius: 50%;
  border: 1.5px dotted color-mix(in srgb, var(--accent) 70%, transparent);
  animation: spin 24s linear infinite;
}
.spotlight {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, rgba(255,255,255,.22), transparent 60%);
}
.emblem { width: 110px; height: 110px; position: relative; color: var(--accent); filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 70%, transparent)); }
@keyframes emblem-in { from { opacity: 0; transform: scale(.5) rotate(-20deg); } to { opacity: 1; transform: none; } }

.result-article { margin: 22px 0 0; font-family: var(--caps); font-size: 13px; letter-spacing: .25em; text-transform: uppercase; color: var(--ink-dim); }
.result-name {
  margin: 4px 0 0;
  font-family: var(--display); font-weight: 700;
  font-size: clamp(28px, 8.4vw, 40px);
  line-height: 1.05;
  color: var(--accent);
  text-shadow: 0 0 24px color-mix(in srgb, var(--accent) 50%, transparent);
}
.result-tagline { margin: 8px 0 0; font-family: var(--caps); font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--tent-b); }
.result-desc { margin: 16px 0 0; font-size: 19px; line-height: 1.55; color: var(--ink); max-width: 36ch; }
.result-footer {
  margin: 20px 0 0; padding-top: 14px; width: 100%;
  border-top: 1px dashed color-mix(in srgb, var(--accent) 40%, transparent);
  font-family: var(--caps); font-size: 13px; color: var(--gold); letter-spacing: .12em;
}

.result-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
