/* ============ Path Scribe ============ */

:root {
  --bg: #0b0a14;
  --bg-panel: rgba(22, 20, 38, 0.72);
  --ink: #ece7f6;
  --ink-dim: #a89fc4;
  --gold: #e3c46e;
  --gold-bright: #f6e3a1;
  --violet: #8b6fd8;
  --line: rgba(227, 196, 110, 0.25);
  --radius: 18px;
  font-size: 16px;
}

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

html, body {
  min-height: 100%;
}

body {
  background: radial-gradient(ellipse at 50% -20%, #1d1836 0%, var(--bg) 55%);
  color: var(--ink);
  font-family: "Jost", system-ui, sans-serif;
  font-weight: 300;
  line-height: 1.6;
  overflow-x: hidden;
}

/* --- twinkling star field --- */
.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(255,255,255,.7) 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 12%, rgba(255,255,255,.5) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 32% 68%, rgba(246,227,161,.6) 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 55%, rgba(255,255,255,.45) 50%, transparent 51%),
    radial-gradient(1px 1px at 55% 35%, rgba(255,255,255,.5) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 8% 82%, rgba(139,111,216,.6) 50%, transparent 51%),
    radial-gradient(1px 1px at 66% 88%, rgba(255,255,255,.4) 50%, transparent 51%),
    radial-gradient(1px 1px at 42% 8%, rgba(246,227,161,.5) 50%, transparent 51%);
  animation: twinkle 7s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .5; } to { opacity: 1; } }

.page {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.hidden { display: none !important; }

/* --- panels --- */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 5vw, 2.75rem);
  backdrop-filter: blur(8px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.eyebrow {
  color: var(--gold);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-size: 0.75rem;
  margin-bottom: 1rem;
  text-align: center;
}

h1 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 500;
  font-size: clamp(2.2rem, 7vw, 3.4rem);
  line-height: 1.1;
  text-align: center;
  margin-bottom: 1.25rem;
}
h1 em {
  font-style: italic;
  background: linear-gradient(100deg, var(--gold-bright), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  color: var(--ink-dim);
  text-align: center;
  max-width: 46ch;
  margin: 0 auto 2rem;
}
.lede strong { color: var(--gold-bright); font-weight: 400; }

/* --- forms --- */
.birth-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-width: 380px;
  margin: 0 auto;
}

.birth-form label span {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.4rem;
}

input[type="text"],
input[type="date"],
input[type="email"] {
  width: 100%;
  background: rgba(10, 8, 20, 0.6);
  border: 1px solid rgba(168, 159, 196, 0.35);
  border-radius: 10px;
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  padding: 0.8rem 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  color-scheme: dark;
}
input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(227, 196, 110, 0.18);
}

.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  border-radius: 999px;
  padding: 0.85rem 1.9rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  border: none;
  color: #1c1503;
  background: linear-gradient(120deg, var(--gold-bright), var(--gold) 60%, #caa452);
  box-shadow: 0 8px 26px rgba(227, 196, 110, 0.35);
}
.btn-primary:hover { box-shadow: 0 10px 32px rgba(227, 196, 110, 0.5); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(168, 159, 196, 0.4);
  color: var(--ink-dim);
}
.btn-ghost:hover { border-color: var(--ink-dim); color: var(--ink); }

/* --- numbers row --- */
.numbers-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.astro-row {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-top: -0.75rem;
}

.number-card {
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 0.5rem;
  background: rgba(10, 8, 20, 0.45);
}
.number-card .num {
  font-family: "Cormorant Garamond", serif;
  font-size: 2.2rem;
  line-height: 1;
  color: var(--gold-bright);
}
.number-card .num.master { text-shadow: 0 0 18px rgba(246, 227, 161, 0.8); }
.number-card .num.glyph {
  font-family: "Jost", system-ui, sans-serif;
  font-size: 1.9rem;
}
.number-card .label {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* --- canvas --- */
.canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #080712;
}
#stage { width: 100%; height: 100%; display: block; }

.canvas-veil {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.6rem;
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  background: linear-gradient(transparent, rgba(8, 7, 18, 0.85));
  transition: opacity 0.6s;
}
.canvas-veil.done { opacity: 0; }

.reading {
  margin: 1.4rem auto 0;
  max-width: 52ch;
  text-align: center;
  color: var(--ink-dim);
  font-family: "Cormorant Garamond", serif;
  font-size: 1.15rem;
  font-style: italic;
}

.stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  justify-content: center;
  margin-top: 1.6rem;
}

/* --- modal --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 4, 12, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 50;
}

.modal {
  position: relative;
  width: min(440px, 100%);
  background: #171430;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2.2rem 1.9rem;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.modal h2 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 500;
  font-size: 1.8rem;
  margin-bottom: 0.7rem;
}
.modal p { color: var(--ink-dim); font-size: 0.95rem; margin-bottom: 1.2rem; }

.modal-close {
  position: absolute;
  top: 0.7rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--ink-dim);
  font-size: 1.6rem;
  cursor: pointer;
}
.modal-close:hover { color: var(--ink); }

.email-form { display: flex; flex-direction: column; gap: 0.8rem; }
.form-note { font-size: 0.75rem !important; margin: 0 !important; opacity: 0.7; }
.form-error {
  color: #f08a8a;
  font-size: 0.85rem !important;
  margin: 0 !important;
}

.modal-success p {
  color: var(--gold-bright);
  font-family: "Cormorant Garamond", serif;
  font-size: 1.3rem;
}

.saved-image-link {
  display: block;
  margin-top: 1rem;
  color: var(--ink-dim);
  font-size: 0.85rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.saved-image-link:hover {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* --- footer --- */
.footer {
  text-align: center;
  color: rgba(168, 159, 196, 0.5);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
}
