:root {
  --gold: #e3b26a;
  --gold-bright: #f2cf84;
  --ivory: #f3e6cc;
  --soft: #e8dcc4;
  --muted: #a8998a;
  --card: #1a1a1a;
  --bar-track: #26211d;
  --display: 'Cormorant Garamond', Georgia, serif;
  --label: 'Cinzel', Georgia, serif;
  --body: 'EB Garamond', Georgia, serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--ivory);
  font-family: var(--body);
  overflow: hidden;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; touch-action: manipulation; cursor: pointer; }
a { color: var(--gold-bright); }
img { display: block; }
:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }

#app { position: fixed; inset: 0; display: flex; justify-content: center; background: #000; }

.frame {
  position: relative;
  width: 100%;
  max-width: calc(100vh * 0.62);
  max-width: calc(100dvh * 0.62);
  height: 100%;
  overflow: hidden;
  background: #000 center / 100% 100% no-repeat;
  animation: fade-in 0.38s ease-out;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.noscript { padding: 24px; text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 30px;
  font-family: var(--label);
  font-weight: 600;
  font-size: clamp(12px, 3.5vw, 15px);
  letter-spacing: 0.04em;
  text-align: center;
  text-decoration: none;
}

.btn-gold {
  border: 0;
  color: #1a1208;
  background: linear-gradient(#f6cf86, #e0a552 55%, #b9792e);
  box-shadow: 0 0 18px #e3a04055;
}

.btn-outline {
  border: 1.2px solid var(--gold);
  color: var(--gold);
  background: #00000099;
}

.btn:active { transform: scale(0.98); }

/* ---------- Intro ---------- */
.intro .lower {
  position: absolute;
  left: 8.4%;
  right: 8.4%;
  top: 47%;
  bottom: 8.5%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.3vh, 12px);
}
.intro.returning .lower { top: 40%; }
.intro.returning .fineprint { display: none; }

/* The title takes whatever height is left, so nothing overlaps on short screens. */
.intro .title {
  flex: 1 1 0;
  min-height: 0;
  width: 94%;
  object-fit: contain;
  object-position: center bottom;
}

.tagline {
  flex: none;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(19px, 5.4vw, 24px);
  line-height: 1.15;
  text-align: center;
  color: #f5f0e6;
  white-space: pre-line;
}

.intro .btn, .intro .fineprint { flex: none; }

.fineprint {
  padding: 0 7%;
  font-size: clamp(12px, 3.2vw, 13.5px);
  line-height: 1.25;
  text-align: center;
  color: var(--muted);
}

/* ---------- The six shadows ---------- */
.six .inner {
  position: absolute;
  left: 8.4%;
  right: 8.4%;
  top: 14.5%;
  bottom: 9%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 1.4vh, 14px);
}

.eyebrow {
  font-family: var(--label);
  font-weight: 600;
  font-size: clamp(12px, 3.4vw, 14px);
  letter-spacing: 0.14em;
  color: var(--gold);
  text-align: center;
}

.carousel {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  scroll-snap-align: center;
}

.six-copy {
  font-family: var(--label);
  font-weight: 600;
  font-size: clamp(15px, 4.5vw, 19px);
  line-height: 1.3;
  text-align: center;
  white-space: pre-line;
  color: var(--ivory);
}

/* ---------- Questions ---------- */
.question .head {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 14.8%;
  height: 12.4%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}
.section-title img { width: clamp(14px, 5vw, 22px); height: auto; flex: none; }
.section-title h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(22px, 6.8vw, 28px);
  line-height: 1.05;
  color: var(--ivory);
  text-align: center;
}

.question-text {
  font-size: clamp(14.5px, 4.1vw, 17px);
  line-height: 1.15;
  text-align: center;
  color: var(--soft);
}

.cards {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 28.8%;
  bottom: 19.5%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.row { display: flex; justify-content: center; gap: 8px; }

.card {
  position: relative;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: #0c0a08;
  overflow: hidden;
  transition: transform 0.18s ease-out, box-shadow 0.18s ease-out;
}
.card img { width: 100%; height: 100%; object-fit: fill; }
.card .name {
  position: absolute;
  left: 4%;
  right: 4%;
  top: var(--label-top, 83.8%);
  height: var(--label-height, 13%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--label);
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #f3e6cc;
  line-height: 1;
  white-space: nowrap;
}
.card:active, .card.chosen { transform: scale(1.04); box-shadow: 0 0 16px #f2cf8499; }

.progress {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 80.8%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.count-row {
  position: relative;
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* 44px tall tap area without pushing the row down. */
.back {
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  height: 44px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  font-family: var(--label);
  font-weight: 600;
  font-size: clamp(10.5px, 3vw, 12px);
  letter-spacing: 0.05em;
  color: var(--gold);
}
.progress .count { font-size: clamp(13px, 3.6vw, 15px); color: var(--soft); }
.progress .track { width: 100%; height: 4px; border-radius: 2px; background: var(--bar-track); overflow: hidden; }
.progress .fill { height: 100%; background: linear-gradient(90deg, #b9792e, var(--gold-bright)); }

/* ---------- Reveal ---------- */
.reveal .inner {
  position: absolute;
  inset: 0;
  padding: 0 14%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
}
.reveal .star { font-size: 42px; color: var(--gold-bright); animation: pulse 1.1s ease-in-out infinite; }
.reveal p { font-family: var(--display); font-size: clamp(22px, 6.4vw, 28px); line-height: 1.15; }
@keyframes pulse {
  0%, 100% { transform: scale(0.82); opacity: 0.55; }
  50% { transform: scale(1.12); opacity: 1; }
}

/* ---------- Result ---------- */
.result .scroll {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 13.5%;
  bottom: 10.5%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-mask-image: linear-gradient(#000 calc(100% - 20px), transparent);
  mask-image: linear-gradient(#000 calc(100% - 20px), transparent);
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 3px 22px;
  scrollbar-width: none;
}
.result .scroll::-webkit-scrollbar { display: none; }

.symbol {
  width: 100%;
  max-width: 340px;
  height: auto;
  aspect-ratio: 1;
  align-self: center;
  border: 1px solid var(--gold);
  border-radius: 8px;
  flex: none;
}

.identity { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.identity h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(32px, 9.6vw, 42px);
  line-height: 1.08;
  color: var(--ivory);
  text-shadow: 0 0 14px #e3b26a88;
}
.identity .subtitle { font-size: clamp(15px, 4.1vw, 17px); line-height: 1.2; color: var(--gold-bright); }
.identity .essence { font-size: clamp(15px, 4vw, 16.5px); line-height: 1.25; color: var(--ivory); }

.pill {
  padding: 5px 12px;
  border: 0.8px solid #e3b26a99;
  border-radius: 20px;
  background: #00000099;
  font-family: var(--label);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--gold);
}
.pill.pure { border: 1.2px solid var(--gold-bright); background: #e3b26a33; color: var(--gold-bright); }

.panel {
  flex: none;
  padding: 14px;
  border: 1px solid #e3b26a80;
  border-radius: 8px;
  background: #0f0d0bcc;
}
.panel h2 {
  margin-bottom: 8px;
  font-family: var(--label);
  font-weight: 600;
  font-size: 12.5px;
  line-height: 1.3;
  letter-spacing: 0.1em;
  color: var(--gold);
  text-align: center;
}
.panel p { font-size: 16px; line-height: 1.32; color: var(--soft); }
.panel p + p { margin-top: 10px; }
.panel .quiet { font-size: 14.5px; color: var(--muted); }
.panel .bright { font-size: 15px; color: var(--gold-bright); }

.weight {
  display: grid;
  grid-template-columns: 26% 1fr 13%;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ivory);
}
.weight.top { color: var(--gold-bright); font-weight: 500; }
.weight .bar { height: 11px; border-radius: 3px; background: var(--bar-track); overflow: hidden; }
.weight .bar span { display: block; height: 100%; }
.weight .pct { text-align: right; }

.soon {
  align-self: center;
  padding: 7px 16px;
  border: 1px dashed #e3b26a80;
  border-radius: 20px;
  font-family: var(--label);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--gold);
}

.stack { display: flex; flex-direction: column; gap: 10px; flex: none; }
.panel .stack { margin-top: 12px; }

details.help { flex: none; padding: 12px 14px; border: 1px solid #e3b26a55; border-radius: 8px; }
details.help summary { cursor: pointer; font-size: 15px; color: var(--gold-bright); }
details.help p { margin-top: 8px; font-size: 15px; line-height: 1.3; color: var(--soft); white-space: pre-line; }

/* ---------- Share sheet ---------- */
.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: #000000c4;
  animation: fade-in 0.2s ease-out;
}
.sheet {
  width: 100%;
  max-width: 460px;
  max-height: 92%;
  overflow-y: auto;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
  border: 1px solid #e3b26a80;
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: #120f0c;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sheet-top { display: flex; align-items: center; justify-content: space-between; }
.sheet-top h2 { font-family: var(--label); font-size: 14px; letter-spacing: 0.1em; color: var(--gold); }
.sheet-close { width: 44px; height: 44px; margin: -8px -8px -8px 0; border: 0; background: none; color: var(--soft); font-size: 22px; }
.sheet img.share-card { width: 62%; align-self: center; border-radius: 6px; border: 1px solid #e3b26a55; }
.sheet .hint { font-size: 14.5px; line-height: 1.25; color: var(--muted); text-align: center; }
.sheet .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet .grid .btn { font-size: 12px; padding: 8px 6px; }
.copied { min-height: 20px; font-size: 14.5px; color: var(--gold-bright); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .frame, .sheet-wrap { animation: none; }
  .reveal .star { animation: none; }
  .card { transition: none; }
}
