@font-face {
  font-family: "Cormorant Garamond";
  src: url("./fonts/CormorantGaramond.ttf") format("truetype");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("./fonts/CormorantGaramond-Italic.ttf") format("truetype");
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("./fonts/Inter.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #03040F;
  --ink: #ECE6D8;
  --ink-soft: rgba(236, 230, 216, 0.84);
  --ink-dim: rgba(236, 230, 216, 0.62);
  --gold: #F3CF7A;
  --gold-soft: #F6E7C4;
  --gold-deep: #C8913A;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, "SF Pro Text", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.45; cursor: default; }
img { border: 0; }

.lf-root {
  position: relative;
  min-height: 100dvh;
  min-height: 100svh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (min-width: 520px) {
  body { background: #010208; }
  .lf-root {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100dvh;
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.55);
  }
}

.neb, .stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.neb {
  background:
    radial-gradient(60% 32% at 16% 30%, rgba(160, 70, 90, 0.16), transparent 70%),
    radial-gradient(55% 28% at 88% 62%, rgba(40, 80, 200, 0.14), transparent 70%),
    radial-gradient(50% 24% at 50% 94%, rgba(255, 170, 70, 0.08), transparent 70%);
}
.stars {
  opacity: 0.7;
  background-image:
    radial-gradient(1px 1px at 20px 30px, #fff, transparent),
    radial-gradient(1px 1px at 140px 80px, rgba(255, 230, 180, 0.9), transparent),
    radial-gradient(1.5px 1.5px at 90px 160px, #cfe3ff, transparent),
    radial-gradient(1px 1px at 200px 210px, #fff, transparent),
    radial-gradient(1px 1px at 60px 250px, rgba(255, 220, 150, 0.8), transparent),
    radial-gradient(1.2px 1.2px at 180px 130px, rgba(200, 215, 255, 0.8), transparent);
  background-size: 240px 280px;
}

.screen {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  min-height: 100svh;
  overflow: hidden;
  background: var(--bg);
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bot);
}

.gold-text {
  background: linear-gradient(180deg, #FFF7E0 0%, #F3CF7A 55%, #C8913A 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 196, 100, 0.35));
}
.orn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--gold);
  font-size: 11px;
}
.orn i {
  display: block;
  height: 1px;
  width: 56px;
  background: linear-gradient(90deg, transparent, #F3CF7A);
}
.orn i:last-child { transform: scaleX(-1); }

.card {
  position: relative;
  border-radius: 20px;
  padding: 18px 16px 16px;
  background: linear-gradient(180deg, rgba(24, 28, 72, 0.62), rgba(8, 10, 30, 0.76));
  border: 1px solid rgba(243, 207, 122, 0.24);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 24px 60px rgba(0,0,0,0.45), 0 0 50px rgba(255,190,90,0.05);
}
.card:before {
  content: "";
  position: absolute;
  left: 24px; right: 24px; top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,224,160,0.95), transparent);
}
.cap {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(243, 207, 122, 0.78);
}
.h2 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 500;
  font-size: 28px;
  line-height: 1.1;
  color: #F6E7C4;
  letter-spacing: 0.01em;
}
.body { color: var(--ink-soft); font-size: 14px; line-height: 1.55; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid rgba(243, 207, 122, 0.45);
  background: rgba(255,255,255,0.03);
  color: #F6E7C4;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.card .btn, .wrap .btn, .center-msg .btn, .scan-copy > .btn { width: 100%; }
.btn.primary {
  background: linear-gradient(180deg, #FFE7AA, #D6973A);
  color: #1A1205;
  border-color: rgba(214, 151, 58, 0.8);
  box-shadow: 0 8px 24px rgba(214, 151, 58, 0.28);
}
.btn.quiet { opacity: 0.92; }
.btn.ghost {
  background: transparent;
  border-color: rgba(243, 207, 122, 0.28);
  min-height: 40px;
  font-size: 13px;
  font-weight: 600;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(243, 207, 122, 0.35);
  background: rgba(243, 207, 122, 0.08);
  color: #F8E9C6;
  font-size: 13px;
}

.field { display: flex; flex-direction: column; gap: 7px; }
.label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(236, 230, 216, 0.6);
}
.input {
  appearance: none;
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 16px;
  color: var(--ink);
  background: rgba(8, 10, 28, 0.7);
  border: 1px solid rgba(243, 207, 122, 0.32);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  outline: none;
}
.input:focus { border-color: rgba(243, 207, 122, 0.7); }

/* Name entry */
.hero {
  position: relative;
  height: min(300px, 36dvh);
  overflow: hidden;
  flex: 0 0 auto;
}
.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}
.hero-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(3,4,15,0.18) 0%, rgba(3,4,15,0) 28%, rgba(3,4,15,0.72) 74%, #03040F 100%);
  pointer-events: none;
}
.hero-txt {
  position: absolute;
  left: 0; right: 0; bottom: 22px;
  text-align: center;
  padding: 0 24px;
}
.title {
  font-family: "Cormorant Garamond", serif;
  font-weight: 500;
  font-size: 44px;
  line-height: 1.02;
  letter-spacing: 0.02em;
  margin: 0;
}
.sub {
  margin: 10px auto 0;
  max-width: 320px;
  color: rgba(236, 230, 216, 0.8);
  font-size: 14.5px;
  line-height: 1.55;
}
.wrap {
  position: relative;
  padding: 6px 18px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Scan screens */
.full-art, .scan-stage {
  position: absolute;
  inset: 0;
}
.full-art img, .scan-stage .cosmos {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  pointer-events: none;
}
.art-fade-top {
  position: absolute;
  left: 0; right: 0; top: 0; height: 140px;
  background: linear-gradient(180deg, rgba(3,4,15,0.7), transparent);
  pointer-events: none;
}
.art-fade-bot {
  position: absolute;
  left: 0; right: 0; bottom: 0; height: 420px;
  background: linear-gradient(180deg, transparent 0%, rgba(3,4,15,0.55) 40%, #03040F 78%);
  pointer-events: none;
}
.scan-copy {
  position: absolute;
  left: 18px; right: 18px; bottom: calc(24px + var(--safe-bot));
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
  z-index: 3;
}
.scan-lead {
  font-family: "Cormorant Garamond", serif;
  font-weight: 500;
  font-size: 28px;
  line-height: 1.15;
  color: #FFF1CF;
}
.scan-body { color: var(--ink-soft); font-size: 14.5px; line-height: 1.55; }
.progress {
  margin: 4px auto 0;
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: rgba(243, 207, 122, 0.16);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #C8913A, #FFE7AA);
  box-shadow: 0 0 12px rgba(243, 207, 122, 0.55);
  width: 0%;
}
.pct {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(243, 207, 122, 0.9);
}

/* Live meridian figure during the scan */
.fig-layer {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 1;
}
.fig-layer img {
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.fig-quiet { opacity: 0.32; }
.stage-idle .fig-layer {
  top: 30.2%;
  width: 42%;
  height: 45%;
}
.stage-scan .fig-layer {
  top: 45.6%;
  width: 46%;
  height: 48.6%;
}
.fig-mid, .fig-lit { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: contain; }
.fig-mid {
  -webkit-mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 calc(var(--lit, 0) * 55%),
    transparent calc(var(--lit, 0) * 80% + 8%)
  );
  mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 calc(var(--lit, 0) * 55%),
    transparent calc(var(--lit, 0) * 80% + 8%)
  );
  opacity: 0.85;
}
.fig-lit {
  -webkit-mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 calc(var(--lit, 0) * 45%),
    transparent calc(var(--lit, 0) * 70% + 6%)
  );
  mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 calc(var(--lit, 0) * 45%),
    transparent calc(var(--lit, 0) * 70% + 6%)
  );
}
.touch-target {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 8%;
  bottom: 38%;
  z-index: 2;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
}
.touch-target:focus { outline: none; }

/* Results */
.results {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 8px 16px 18px;
  display: flex;
  flex-direction: column;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.results-head { padding: 2px 4px 10px; text-align: center; }
.who {
  font-family: "Cormorant Garamond", serif;
  font-size: 26px;
  line-height: 1.15;
  color: #F6E7C4;
  font-weight: 500;
}
.stack { display: flex; flex-direction: column; gap: 7px; flex: 1; padding-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.affirm {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quote {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 16.5px;
  line-height: 1.35;
  color: #F3CF7A;
}
.sys-n { font-size: 14px; font-weight: 600; color: #F8E9C6; }
.sys-d { font-size: 12.5px; color: var(--ink-dim); line-height: 1.4; }
.disclaimer {
  margin-top: 2px; margin-bottom: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(243, 207, 122, 0.18);
  font-size: 11px;
  line-height: 1.45;
  color: rgba(236, 230, 216, 0.62);
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #1A1205;
  background: linear-gradient(180deg, #FFE7AA, #D6973A);
  margin-bottom: 6px;
}

.center-msg {
  position: absolute;
  left: 18px; right: 18px; bottom: calc(24px + var(--safe-bot));
  text-align: center;
  z-index: 3;
}

.steps {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 2px 0 8px;
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(243, 207, 122, 0.25);
}
.dot.on { background: #F3CF7A; box-shadow: 0 0 8px rgba(243, 207, 122, 0.7); }
.step-row { display: flex; gap: 8px; margin-top: 12px; }
.step-row .btn { flex: 1; }

.mer-wrap { display: flex; align-items: stretch; gap: 8px; }
.mer-fig {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.mer-fig .mer-svg, .mer-fig svg {
  width: 100%;
  height: auto;
  display: block;
  max-height: 46dvh;
}
.mer-fig .view {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(243,207,122,0.8);
  margin-top: 4px;
}
.legend { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.leg { display: flex; align-items: flex-start; gap: 10px; }
.swatch {
  width: 14px; height: 3px; border-radius: 99px; margin-top: 8px; flex: 0 0 14px;
  box-shadow: 0 0 8px currentColor;
}
.swatch.hi-a { background: #FFE7AA; color: #FFE7AA; }
.swatch.hi-b { background: #E8A090; color: #E8A090; }
.swatch.hi-c { background: #FFF7E0; color: #FFF7E0; }
.fig-card { padding: 10px 10px 12px !important; overflow: hidden; cursor: pointer; }
.fig-inline {
  display: flex;
  gap: 10px;
  align-items: center;
}
.fig-inline .mer-thumb {
  width: 76px;
  flex: 0 0 76px;
  height: 177px;
  overflow: hidden;
  position: relative;
}
.fig-inline .mer-thumb .mer-svg,
.fig-inline .mer-thumb svg {
  width: 76px;
  height: 177px;
  display: block;
}
.fig-card-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(243, 207, 122, 0.7);
  text-align: center;
  margin-top: 6px;
}

.top-back {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: 12px;
  z-index: 4;
  min-height: 36px;
  padding: 8px 14px;
  font-size: 13px;
}

.btn.text-link {
  min-height: 32px;
  padding: 4px 12px;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: rgba(243, 207, 122, 0.9);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.disclaimer { margin-bottom: 0; }
.mer-fig .mer-svg, .mer-fig svg { max-height: 40dvh; }

/* Birthdate picker */
.date-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.date-cell { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.date-day { flex: 0 0 22%; }
.date-year { flex: 0 0 30%; }
.date-cap {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(236, 230, 216, 0.5);
}
.date-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23F3CF7A' stroke-width='1.4' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 28px;
}
.privacy {
  margin: 12px 2px 0;
  font-size: 11px;
  line-height: 1.45;
  color: rgba(236, 230, 216, 0.58);
  text-align: center;
}

/* Scanning glow over the holographic figure */
.full-art.is-scanning .scan-glow,
.scan-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 1;
  background:
    radial-gradient(ellipse 55% 36% at 50% 18%, rgba(200, 210, 255, calc(var(--lit, 0) * 0.42)), transparent 68%),
    radial-gradient(ellipse 40% 28% at 50% 14%, rgba(243, 207, 122, calc(var(--lit, 0) * 0.28)), transparent 70%),
    linear-gradient(
      to bottom,
      rgba(255, 236, 180, calc(var(--lit, 0) * 0.22)) 0%,
      rgba(180, 200, 255, calc(var(--lit, 0) * 0.12)) calc(var(--lit, 0) * 48% + 8%),
      transparent calc(var(--lit, 0) * 72% + 14%)
    );
  mix-blend-mode: screen;
  animation: scanPulse 2.8s ease-in-out infinite;
}
@keyframes scanPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.18); }
}
.full-art { position: absolute; inset: 0; }
.full-art img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }


/* 64-tetrahedron grid scan stage */
.screen-scan {
  background:
    radial-gradient(ellipse 80% 50% at 50% 18%, rgba(50, 90, 160, 0.22), transparent 70%),
    var(--bg);
}
.scan-hero {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 54%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.58;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 48%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 48%, transparent 100%);
}
.scan-hero img {
  width: 100%;
  height: 120%;
  object-fit: cover;
  object-position: center 6%;
  display: block;
  filter: saturate(1.08) brightness(0.92);
}
.scan-hero.is-scanning { opacity: 0.48; }
.scan-hero-veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 62% 42% at 50% 46%, rgba(20, 50, 90, 0.08), transparent 70%),
    linear-gradient(180deg, rgba(3,4,15,0.2) 0%, transparent 16%, transparent 58%, #03040F 90%);
}
.scan-stage-grid {
  position: absolute;
  left: 0;
  right: 0;
  top: 6%;
  bottom: 30%;
  z-index: 2;
}
.tetra-wrap {
  width: 100%;
  height: 100%;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.tetra-grid {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: pointer;
  outline: none;
}
.screen-scan .scan-lead {
  color: #E8F6FF;
  text-shadow: 0 0 22px rgba(120, 200, 255, 0.35);
}
.screen-scan .pct {
  color: rgba(190, 230, 255, 0.88);
  letter-spacing: 0.16em;
}
.screen-scan .top-back {
  width: auto;
  color: rgba(220, 240, 255, 0.9);
  border-color: rgba(150, 200, 255, 0.28);
}
