:root {
  --gold: #e8c873;
  --gold-bright: #ffe9a8;
  --indigo: #2a2150;
  --violet: #8b6cff;
  --violet-soft: #b9a4ff;
  --ink: #07060f;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #04030a;
  color: #efeaff;
  font-family: "Cormorant Garamond", "Iowan Old Style", Georgia, "Times New Roman", serif;
  -webkit-font-smoothing: antialiased;
  cursor: default;
  user-select: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#cam {
  position: fixed;
  width: 2px;
  height: 2px;
  opacity: 0;
  pointer-events: none;
  top: 0; left: 0;
}

/* ---------- Hand preview ---------- */
#handPreview {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 220px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(139, 108, 255, 0.35);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5), 0 0 24px rgba(139,108,255,0.18);
  background: rgba(8, 6, 20, 0.55);
  backdrop-filter: blur(4px);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .8s ease, transform .8s ease;
  z-index: 5;
}
#handPreview.show { opacity: 0.92; transform: translateY(0); }
#handCanvas { display: block; width: 100%; height: auto; transform: scaleX(-1); }
#handLabel {
  position: absolute;
  top: 6px; left: 8px;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--violet-soft);
  font-family: ui-sans-serif, system-ui, sans-serif;
  opacity: 0.7;
}

/* ---------- Intro ---------- */
#intro {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 20;
  background: radial-gradient(ellipse at center, rgba(20,12,45,0.35), rgba(4,3,10,0.92) 70%);
  transition: opacity 1.1s ease;
}
#intro.gone { opacity: 0; pointer-events: none; }
#intro h1 {
  font-size: clamp(42px, 9vw, 104px);
  font-weight: 500;
  letter-spacing: clamp(8px, 3vw, 26px);
  color: var(--gold);
  text-shadow: 0 0 30px rgba(232,200,115,0.45), 0 0 80px rgba(139,108,255,0.25);
}
#intro .sub {
  font-size: clamp(15px, 2.4vw, 22px);
  font-style: italic;
  color: var(--violet-soft);
  opacity: 0.85;
  margin-bottom: 22px;
}
#intro .tiny {
  font-size: 12px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  color: rgba(185, 164, 255, 0.5);
  margin-top: 18px;
  letter-spacing: 0.4px;
}
#intro button {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border: none;
  padding: 14px 34px;
  border-radius: 40px;
  cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease;
  box-shadow: 0 0 0 rgba(232,200,115,0);
}
#intro button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 40px rgba(232,200,115,0.4);
}
#intro button.ghost {
  background: transparent;
  color: var(--violet-soft);
  border: 1px solid rgba(139,108,255,0.4);
  box-shadow: none;
  padding: 11px 26px;
  font-size: 13px;
}
#intro button.ghost:hover { box-shadow: 0 8px 24px rgba(139,108,255,0.25); }

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  top: 22px;
  left: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 6;
  transition: opacity .6s ease;
}
#hud.hidden { opacity: 0; pointer-events: none; }
.gesture {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  letter-spacing: 0.6px;
  color: rgba(220, 212, 255, 0.55);
  display: flex;
  align-items: center;
  gap: 9px;
  transition: color .35s ease, transform .35s ease;
}
.gesture .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(139,108,255,0.35);
  box-shadow: 0 0 0 rgba(139,108,255,0);
  transition: all .35s ease;
}
.gesture.active { color: var(--gold-bright); transform: translateX(3px); }
.gesture.active .dot {
  background: var(--gold);
  box-shadow: 0 0 14px rgba(232,200,115,0.9);
}

/* ---------- Whisper (state text) ---------- */
#whisper {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(16px, 2.5vw, 22px);
  font-style: italic;
  letter-spacing: 2px;
  color: var(--violet-soft);
  text-shadow: 0 0 22px rgba(139,108,255,0.5);
  opacity: 0;
  transition: opacity .8s ease;
  text-align: center;
  pointer-events: none;
  z-index: 6;
}
#whisper.show { opacity: 0.9; }

/* ---------- Reading overlay ---------- */
#reading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  z-index: 7;
  opacity: 0;
  transition: opacity 1s ease;
  padding: 0 8vw;
}
#reading.show { opacity: 1; }
#reading.hidden { display: none; }
.reading-num {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  letter-spacing: 8px;
  color: var(--gold);
  opacity: 0.8;
  margin-bottom: 6px;
}
.reading-name {
  font-size: clamp(34px, 6vw, 68px);
  font-weight: 500;
  letter-spacing: 4px;
  color: var(--gold-bright);
  text-shadow: 0 0 36px rgba(232,200,115,0.5);
  /* sit above the card which floats in lower-center */
  margin-top: -34vh;
}
.reading-divider { color: var(--violet); margin: 10px 0; font-size: 18px; opacity: 0.8; }
.reading-meaning {
  max-width: 620px;
  font-size: clamp(16px, 2.3vw, 22px);
  line-height: 1.55;
  font-style: italic;
  color: rgba(225, 218, 255, 0.85);
}
.reading-hint {
  margin-top: 26px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(185,164,255,0.5);
}

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 12, 40, 0.9);
  border: 1px solid rgba(139,108,255,0.4);
  color: var(--violet-soft);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  letter-spacing: 0.5px;
  padding: 12px 20px;
  border-radius: 10px;
  z-index: 30;
  max-width: 80vw;
  text-align: center;
  transition: opacity .5s ease, transform .5s ease;
}
#toast.hidden { opacity: 0; transform: translateX(-50%) translateY(-12px); pointer-events: none; }
