:root {
  --ui: Futura, "Century Gothic", "Trebuchet MS", sans-serif;
  --display: "Dahlia-MediumCondensed", "Dahlia", serif;
  --ink: #f6eab0;
  --ink-soft: #d8c895;
  --line: #f4eab6;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--ink);
  font-family: var(--ui);
  font-weight: 500;
}

body { overflow: hidden; }

button, input { font-family: inherit; color: inherit; }

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

.gold-line {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.gold-line span {
  position: absolute;
  top: 46%;
  left: 0;
  width: 34vw;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(233, 193, 122, 0.2) 28%, #e9c17a 72%, #fff6df);
  box-shadow: 0 0 12px rgba(233, 193, 122, 0.9), 0 0 28px rgba(233, 193, 122, 0.45);
  transform: translateX(-40vw);
}

.gold-line.is-on span {
  animation: gold-sweep 1.15s cubic-bezier(0.65, 0, 0.25, 1) forwards;
}

@keyframes gold-sweep {
  to { transform: translateX(112vw); }
}

.stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.ask, .spread {
  opacity: 0;
  pointer-events: none;
}

.ask {
  filter: blur(12px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1), filter 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.spread {
  filter: none;
  transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.ask.is-shown, .spread.is-shown {
  opacity: 1;
  filter: none;
}

.ask.is-shown .field,
.ask.is-shown .prompts,
.spread.is-shown .card,
.spread.is-shown .again { pointer-events: auto; }

.ask {
  position: absolute;
  left: 50%;
  top: 34.86%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(800px, calc(100% - 48px));
}

h1, h2 {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--ink);
}

h1 {
  margin: 0 0 48px;
  width: 100%;
  font-size: 40px;
  line-height: 1.2;
  text-align: center;
}

.field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.field input {
  flex: 1;
  width: auto;
  height: 48px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  background: transparent;
  padding: 8px 0 10px;
  font-size: 16px;
  letter-spacing: 0.04em;
  line-height: 1.4;
  color: var(--ink);
  caret-color: transparent;
  transition: border-color 0.35s ease;
}

.field input::placeholder {
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.field:focus-within {
  outline: none;
  box-shadow: none;
}

.field:focus-within input {
  border-bottom-color: #fff6d2;
  caret-color: var(--ink);
}

.field:focus-within input::placeholder { color: transparent; }

.glints {
  position: absolute;
  inset: -28px -18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.field:focus-within .glints { opacity: 1; }

.glints i,
.sparkles i {
  position: absolute;
  width: 7px;
  height: 7px;
  background: var(--ink);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.95));
  opacity: 0;
  animation: starlight 2.2s ease-in-out infinite;
}

.glints i:nth-child(1) { left: 8%; top: 18%; animation-delay: 0s; }
.glints i:nth-child(2) { left: 28%; top: 78%; animation-delay: 0.4s; }
.glints i:nth-child(3) { left: 52%; top: 8%; animation-delay: 0.9s; }
.glints i:nth-child(4) { left: 74%; top: 82%; animation-delay: 0.2s; }
.glints i:nth-child(5) { left: 90%; top: 22%; animation-delay: 1.2s; }
.glints i:nth-child(6) { left: 16%; top: 48%; width: 5px; height: 5px; animation-delay: 1.5s; }

.prompts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  width: 100%;
  margin-top: 28px;
  pointer-events: none;
}

.prompts button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.08em;
  line-height: 1.4;
  cursor: pointer;
  transition: color 0.35s ease;
}

.prompts button:hover { color: var(--ink); }

.send, .again {
  flex: none;
  margin: 0;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--line);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.23em;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.35s ease, border-color 0.35s ease;
}

.send:hover, .again:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.spread {
  position: absolute;
  inset: 0;
}

.cards {
  position: absolute;
  left: 50%;
  top: 29.2%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  width: max-content;
  perspective: 1400px;
}

.card {
  width: min(205px, calc((100vw - 96px) / 3), 20vh);
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  transform-style: preserve-3d;
}

.card.is-open { z-index: 5; }

.float {
  display: block;
  position: relative;
  transform-style: preserve-3d;
  transform-origin: center center;
}

.flare {
  position: absolute;
  inset: -18%;
  border-radius: 24px;
  background: radial-gradient(circle, rgba(255, 250, 236, 0.95), rgba(255, 236, 190, 0.28) 46%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  z-index: 4;
  mix-blend-mode: screen;
}

.tilt {
  display: block;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.45, 0.05, 0.2, 1);
  border-radius: 20px;
  box-shadow:
    0 0 16px rgba(255, 248, 230, 0.35),
    0 0 36px rgba(255, 236, 190, 0.22);
}

.sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.sparkles i:nth-child(1) { left: 18%; top: 12%; animation-delay: 0s; }
.sparkles i:nth-child(2) { left: 78%; top: 20%; animation-delay: 0.55s; }
.sparkles i:nth-child(3) { left: 46%; top: 42%; width: 5px; height: 5px; animation-delay: 1.1s; }
.sparkles i:nth-child(4) { left: 22%; top: 74%; animation-delay: 0.3s; }
.sparkles i:nth-child(5) { left: 70%; top: 82%; animation-delay: 1.4s; }

.card.is-open .tilt { transform: rotateY(180deg); }

.card .back,
.card .front {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 20px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card .front {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #071410;
  transform: rotateY(180deg);
}

.card:focus-visible, .send:focus-visible, .again:focus-visible {
  outline: 1px solid var(--line);
  outline-offset: 4px;
}

.reading {
  position: absolute;
  left: 50%;
  top: 72.85%;
  width: min(799px, calc(100% - 48px));
  margin: 0;
  text-align: center;
  opacity: 0;
  filter: blur(8px);
  transform: translateX(-50%) translateY(18px);
  transition: opacity 0.9s cubic-bezier(0.4, 0, 0.2, 1), transform 0.9s cubic-bezier(0.4, 0, 0.2, 1), filter 0.9s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.reading.is-in {
  opacity: 1;
  filter: none;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.reading h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.reading-name {
  margin: 10px 0 0;
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.reading p {
  margin: 8px 0 0;
  font-family: var(--ui);
  font-size: 13px;
  letter-spacing: 0.02em;
  line-height: 1.45;
}

.again { margin-top: 28px; }

.field.shake { animation: shake 0.4s var(--ease); }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@keyframes starlight {
  0%, 100% { opacity: 0; transform: scale(0.35) rotate(0deg); }
  40% { opacity: 1; transform: scale(1) rotate(18deg); }
  68% { opacity: 0; transform: scale(0.45) rotate(32deg); }
}

@keyframes shake {
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

@media (max-width: 980px) {
  h1 { font-size: 28px; margin-bottom: 32px; }
  .cards { gap: 0; }
  .card .front { width: 100%; height: 100%; }
  .reading { top: 68%; }
  .reading h2 { font-size: 18px; }
  .reading p { margin-top: 16px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .field.shake, .card, .glints i, .sparkles i { animation: none; }
  .ask, .spread, .reading, .tilt, .field, .gold-line span { transition: none; filter: none; animation: none; }
  .glints i, .sparkles i { opacity: 0.85; }
}
