/* ===== Nujum Digital — mystical theme ===== */
:root {
  --bg-deep: #0b0618;
  --bg-mid: #1a1033;
  --bg-card: rgba(255, 255, 255, 0.05);
  --accent: #b18cff;
  --accent-2: #ff9de2;
  --accent-3: #6ee7ff;
  --gold: #ffd77a;
  --text: #f0eaff;
  --text-dim: #b7a8d9;
  --danger: #ff8f9e;
  --radius: 18px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

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

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 800px at 50% -10%, #2a1a55 0%, var(--bg-mid) 45%, var(--bg-deep) 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

/* ---------- Stars background ---------- */
.stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,255,255,.9), transparent),
    radial-gradient(1px 1px at 40% 70%, rgba(255,255,255,.7), transparent),
    radial-gradient(2px 2px at 60% 20%, rgba(255,255,255,.8), transparent),
    radial-gradient(1px 1px at 75% 55%, rgba(255,255,255,.6), transparent),
    radial-gradient(1.5px 1.5px at 90% 80%, rgba(255,255,255,.8), transparent),
    radial-gradient(1px 1px at 10% 85%, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 50% 45%, rgba(255,255,255,.5), transparent),
    radial-gradient(2px 2px at 30% 10%, rgba(255,255,255,.6), transparent);
  background-size: 100% 100%;
  animation: twinkle 6s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

/* ---------- Screens ---------- */
.screen {
  display: none;
  position: relative;
  z-index: 1;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 24px 60px;
  text-align: center;
  flex: 1;
}

.screen.active { display: block; animation: fadeUp 0.6s ease both; }

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

.section-title {
  font-size: clamp(1.6rem, 4.5vw, 2.1rem);
  background: linear-gradient(90deg, var(--gold), var(--accent-2), var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 6px;
}

.subtitle { color: var(--text-dim); margin-bottom: 28px; }

/* ---------- Crystal ball ---------- */
.crystal-ball {
  width: 180px;
  height: 180px;
  margin: 0 auto 28px;
  position: relative;
}

.ball-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e6d9ff 0%, #a06bff 45%, #4a2a8f 75%, #241253 100%);
  box-shadow:
    0 0 45px rgba(160, 107, 255, 0.65),
    0 0 90px rgba(160, 107, 255, 0.35),
    inset 0 -8px 22px rgba(0, 0, 0, 0.45);
  animation: float 5s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.ball-shine {
  position: absolute;
  top: 22px;
  left: 34px;
  width: 46px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.95), rgba(255,255,255,0));
  transform: rotate(-25deg);
  filter: blur(1px);
}

.ball-vapor {
  position: absolute;
  bottom: 10px;
  left: 50%;
  width: 70px;
  height: 70px;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 60%, rgba(255, 214, 255, 0.5), rgba(160,107,255,0.15) 55%, transparent 70%);
  filter: blur(6px);
  animation: vapor 3.5s ease-in-out infinite;
}

@keyframes vapor {
  0%, 100% { opacity: 0.4; transform: translateX(-50%) scale(0.9); }
  50% { opacity: 0.9; transform: translateX(-50%) scale(1.15); }
}

/* ---------- Title ---------- */
.title {
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, var(--gold) 0%, var(--accent-2) 50%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(177, 140, 255, 0.35);
  margin-bottom: 10px;
}

.tagline { color: var(--text-dim); max-width: 460px; margin: 0 auto 32px; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  font-size: 1.05rem;
  padding: 14px 30px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-primary {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #1a1033;
  box-shadow: 0 6px 24px rgba(177, 140, 255, 0.45);
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(177, 140, 255, 0.6); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.btn-ghost:hover { color: var(--text); border-color: var(--accent); }

.actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }

/* ---------- Form ---------- */
form { text-align: left; background: var(--bg-card); border: 1px solid rgba(255,255,255,0.08); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); backdrop-filter: blur(6px); }

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 7px;
  letter-spacing: 0.02em;
}

.field input, .field select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(177, 140, 255, 0.25);
}

.field select option { background: var(--bg-mid); color: var(--text); }

form .btn { width: 100%; margin-top: 6px; }

.error { color: var(--danger); font-size: 0.9rem; margin: 4px 0 12px; }

/* ---------- Tarot fan ---------- */
.tarot-fan {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 30px 0 20px;
  perspective: 900px;
}

.tarot-card {
  width: 120px;
  height: 190px;
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
  animation: dealIn 0.5s ease both;
}

.tarot-card:nth-child(2) { animation-delay: 0.25s; }
.tarot-card:nth-child(3) { animation-delay: 0.5s; }

@keyframes dealIn {
  from { opacity: 0; transform: translateY(60px) rotate(8deg); }
  to { opacity: 1; transform: none; }
}

.tarot-card:hover { transform: translateY(-8px); }

.tarot-card.flipped { transform: rotateY(180deg); }

.tarot-card.flipped:hover { transform: rotateY(180deg) translateY(-8px); }

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  text-align: center;
}

.card-back {
  background: repeating-linear-gradient(45deg, #2c1a55 0 10px, #241346 10px 20px);
  border: 2px solid var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.card-back::before {
  content: "✦";
  font-size: 2.2rem;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 215, 122, 0.8);
}

.card-front {
  background: linear-gradient(160deg, #fdf6ff 0%, #e9d8ff 60%, #d3b8ff 100%);
  color: #2b1b52;
  border: 2px solid var(--gold);
  transform: rotateY(180deg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.card-front .card-emoji { font-size: 2.6rem; line-height: 1; margin-bottom: 8px; }
.card-front .card-name { font-weight: 700; font-size: 0.85rem; line-height: 1.25; }
.card-front .card-suit { font-size: 0.72rem; color: #6b4fa8; margin-top: 5px; text-transform: uppercase; letter-spacing: 0.08em; }

.card-front.reversed::after {
  content: "↕ Terbalik";
  position: absolute;
  bottom: 6px;
  font-size: 0.62rem;
  color: #b3547e;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.draw-hint { color: var(--text-dim); font-style: italic; min-height: 24px; }

/* ---------- Result ---------- */
.cards-revealed {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 22px 0;
}

.mini-card {
  width: 90px;
  border-radius: 10px;
  padding: 10px 6px;
  background: linear-gradient(160deg, #fdf6ff, #d3b8ff);
  color: #2b1b52;
  border: 2px solid var(--gold);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.mini-card .card-emoji { font-size: 1.8rem; display: block; }
.mini-card .card-name { font-size: 0.68rem; font-weight: 700; line-height: 1.2; display: block; margin-top: 4px; }
.mini-card .card-suit { font-size: 0.6rem; color: #6b4fa8; display: block; margin-top: 2px; }

.reading {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 22px 24px;
  text-align: left;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.reading p { white-space: pre-line; }

.luck {
  margin-top: 20px;
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(255, 215, 122, 0.12), rgba(255, 157, 226, 0.12));
  border: 1px dashed rgba(255, 215, 122, 0.5);
  color: var(--gold);
  font-weight: 600;
}

/* ---------- Footer & misc ---------- */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 22px;
  color: rgba(183, 168, 217, 0.6);
  font-size: 0.85rem;
}

.disclaimer { color: var(--text-dim); font-size: 0.8rem; margin-top: 18px; opacity: 0.8; }
.small { font-size: 0.78rem; }

@media (max-width: 480px) {
  .tarot-card { width: 100px; height: 160px; }
  .screen { padding: 32px 18px 50px; }
}
