/* ==========================================================================
   GOTHIC TAROT WHEEL & 3D FLOATING TAROT SANCTUARY (ROTA FORTUNAE)
   Interactive spinning rose window dial with mechanical gear ratchets
   & live 3D levitating, double-sided, holographic interactive tarot cards.
   ========================================================================== */

/* The Rose Window Wheel Dial */
.rose-window-wrapper {
  cursor: pointer;
  position: relative;
  transition: transform 0.3s ease, filter 0.3s ease;
  user-select: none;
  z-index: 60;
  pointer-events: auto;
}

.rose-window-wrapper:hover {
  filter: drop-shadow(0 0 35px rgba(212, 175, 55, 0.6)) drop-shadow(0 0 50px rgba(138, 20, 46, 0.5));
  transform: scale(1.04);
}

.rose-wheel-interactive {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transition: transform 4.5s cubic-bezier(0.12, 0.8, 0.2, 1);
  transform-origin: center center;
  will-change: transform;
}

/* Wheel Pointer Marker (Gothic Bronze Arrow at 12 o'clock) */
.wheel-pointer {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 22px;
  z-index: 10;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px #000);
}

.wheel-pointer svg {
  width: 100%;
  height: 100%;
  fill: var(--gold-antique);
}

/* Spin Hint Pill */
.wheel-spin-hint {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 13, 24, 0.95);
  border: 1px solid var(--gold-antique);
  border-radius: 12px;
  padding: 2px 10px;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--gold-antique);
  white-space: nowrap;
  opacity: 0.85;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
  transition: all 0.3s ease;
}

.rose-window-wrapper:hover .wheel-spin-hint {
  opacity: 1;
  background: var(--purple-royal);
  box-shadow: 0 0 12px var(--gold-glow);
}

/* ==========================================================================
   LIVE 3D FLOATING TAROT SANCTUARY (MATERIALIZES OUT OF THE VOID)
   ========================================================================== */

.tarot-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: radial-gradient(circle at center, rgba(14, 8, 24, 0.92) 0%, rgba(3, 1, 6, 0.98) 85%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s;
  perspective: 1400px;
  overflow: hidden;
}

.tarot-modal-backdrop:not(.active) {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.tarot-modal-backdrop:not(.active) * {
  pointer-events: none !important;
}

.tarot-modal-backdrop.active {
  display: flex !important;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Celestial Portal Background Aura */
.tarot-portal-aura {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 620px;
  height: 620px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(146, 43, 179, 0.22) 0%,
    rgba(212, 175, 55, 0.12) 35%,
    rgba(26, 10, 40, 0) 70%
  );
  filter: blur(40px);
  pointer-events: none;
  animation: portalPulse 6s ease-in-out infinite alternate;
  z-index: 1;
}

@keyframes portalPulse {
  0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.6; }
  100% { transform: translate(-50%, -50%) scale(1.15); opacity: 0.95; }
}

/* Deep Space Live Interactive Cosmos Canvas */
.tarot-cosmos-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  cursor: default;
}

.tarot-modal-backdrop.active .tarot-cosmos-canvas {
  pointer-events: auto;
  cursor: default;
}

/* Stardust Sparks Around Portal (Superseded by Cosmos Canvas) */
.tarot-stardust-particles {
  display: none;
}

/* 3D Perspective Stage */
.tarot-3d-stage {
  position: relative;
  width: 340px;
  height: 560px;
  max-width: 90vw;
  max-height: 82vh;
  transform-style: preserve-3d;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* Floating Shadow beneath the card in 3D depth */
.tarot-card-shadow {
  position: absolute;
  bottom: -45px;
  left: 10%;
  width: 80%;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 70%);
  filter: blur(12px);
  transform: translateZ(-90px);
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
  z-index: 5;
}

/* The Levitating 3D Card Container */
.tarot-3d-card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  border-radius: 18px;
  outline: none;
  will-change: transform;
  touch-action: manipulation;
  transform: rotateY(180deg);
}

.tarot-3d-card.is-dragging {
  cursor: grabbing;
}

/* Entrance Animation: Materializing out of nowhere facedown */
.tarot-modal-backdrop.active .tarot-3d-card.materializing {
  animation: tarotMaterializeFromVoid 1.1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes tarotMaterializeFromVoid {
  0% {
    opacity: 0;
    transform: translate3d(0, 140px, -800px) rotateX(60deg) rotateY(180deg) scale(0.08);
  }
  50% {
    opacity: 0.9;
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotateX(0deg) rotateY(180deg) scale(1);
  }
}

/* Card Faces (Double-Sided 3D Architecture) */
.tarot-face {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 
    0 30px 80px rgba(0, 0, 0, 0.95),
    0 0 35px rgba(212, 175, 55, 0.3),
    inset 0 0 25px rgba(92, 30, 107, 0.3);
  display: flex;
  flex-direction: column;
}

/* Front Face (Arcanum Illustration & Prophecy) */
.tarot-face-front {
  background: linear-gradient(160deg, #1f132e 0%, #11091b 55%, #07040c 100%);
  border: 2px solid var(--gold-antique);
  transform: rotateY(0deg) translateZ(1px);
  -webkit-transform: rotateY(0deg) translateZ(1px);
}

/* Back Face (Gothic Sacred Geometry & Rota Fortunae Seal) */
.tarot-face-back {
  background: radial-gradient(circle at center, #2b133d 0%, #140921 70%, #08030e 100%);
  border: 2px solid var(--gold-antique);
  transform: rotateY(180deg) translateZ(1px);
  -webkit-transform: rotateY(180deg) translateZ(1px);
}

/* Dynamic State-Based Stacking & Hit Testing */
.tarot-3d-card:not(.is-faceup) .tarot-face-back,
.tarot-3d-card.is-facedown .tarot-face-back {
  z-index: 20;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.tarot-3d-card:not(.is-faceup) .tarot-face-front,
.tarot-3d-card.is-facedown .tarot-face-front {
  z-index: 1;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.tarot-3d-card.is-faceup .tarot-face-front {
  z-index: 20;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.tarot-3d-card.is-faceup .tarot-face-back {
  z-index: 1;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Explicit interactive cursor and clickability across entire card */
.tarot-3d-stage,
.tarot-3d-card,
.tarot-3d-card *,
.tarot-face-front,
.tarot-face-front *,
.tarot-face-back,
.tarot-face-back * {
  cursor: pointer !important;
}

.tarot-face-front *,
.tarot-face-back * {
  pointer-events: auto;
}

/* Holographic Foil Layer (Dynamic Rainbow Sheen) */
.tarot-holo-foil {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(
    135deg,
    rgba(255, 0, 128, 0.08) 0%,
    rgba(255, 215, 0, 0.16) 25%,
    rgba(0, 255, 255, 0.12) 50%,
    rgba(138, 43, 226, 0.14) 75%,
    rgba(255, 215, 0, 0.1) 100%
  );
  mix-blend-mode: color-dodge;
  pointer-events: none !important;
  opacity: 0.65;
  z-index: 10;
}

/* Specular Glare (Follows Mouse Angle in 3D) */
.tarot-specular-glare {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  pointer-events: none !important;
  z-index: 11;
  mix-blend-mode: overlay;
  transition: opacity 0.15s ease;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(255, 255, 255, 0.35) 0%,
    rgba(255, 255, 255, 0.05) 45%,
    transparent 70%
  );
}

/* Card Internal Frame & Tracery */
.tarot-card-frame {
  position: relative;
  height: 100%;
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(212, 175, 55, 0.4);
  margin: 6px;
  border-radius: 12px;
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.8);
  z-index: 2;
}

/* Ornate Corner Flourishes */
.tarot-corner {
  position: absolute;
  font-size: 11px;
  color: var(--gold-antique);
  opacity: 0.85;
  filter: drop-shadow(0 0 3px var(--gold-glow));
}
.c-tl { top: 6px; left: 8px; }
.c-tr { top: 6px; right: 8px; }
.c-bl { bottom: 6px; left: 8px; }
.c-br { bottom: 6px; right: 8px; }

/* Top Header Banner */
.tarot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px dashed rgba(212, 175, 55, 0.3);
  padding-bottom: 6px;
  margin-top: 2px;
}

.tarot-element-badge,
.tarot-suit-badge {
  font-family: var(--font-display);
  font-size: 8px;
  letter-spacing: 1.5px;
  color: var(--gold-bronze);
  text-transform: uppercase;
  font-weight: 700;
}

.tarot-numeral {
  font-family: var(--font-display);
  font-size: 11.5px;
  letter-spacing: 3px;
  color: #fff1cb;
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
  font-weight: 700;
}

/* Gothic Pointed Arch Artwork Chamber */
.tarot-artwork-chamber {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 8px auto 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--gold-antique);
  box-shadow: 
    0 0 25px rgba(212, 175, 55, 0.35),
    inset 0 0 30px rgba(0, 0, 0, 0.9);
  background: radial-gradient(circle at center, #351545 0%, #150921 70%, #09040e 100%);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tarot-artwork-aura {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.35) 0%, transparent 70%);
  animation: auraPulse 4s ease-in-out infinite alternate;
}

@keyframes auraPulse {
  0% { transform: scale(0.9); opacity: 0.5; }
  100% { transform: scale(1.15); opacity: 0.9; }
}

.tarot-artwork-icon {
  font-size: 64px;
  z-index: 2;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 8px rgba(212, 175, 55, 0.4));
  transition: transform 0.3s ease;
}

.tarot-3d-card:hover .tarot-artwork-icon {
  transform: scale(1.08);
}

/* Card Titles */
.tarot-card-identity {
  text-align: center;
  margin-top: 4px;
}

.tarot-title {
  font-family: var(--font-blackletter);
  font-size: 27px;
  font-weight: 400;
  color: var(--gold-antique);
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.5);
  line-height: 1.15;
  margin-bottom: 2px;
}

.tarot-subtitle {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 2.2px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Parchment Scroll Meaning */
.tarot-parchment-scroll {
  background: rgba(14, 9, 20, 0.75);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 6px 0;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
}

.tarot-meaning {
  font-family: var(--font-reading);
  font-size: 14.5px;
  line-height: 1.45;
  color: #ede3d1;
  font-style: italic;
  text-align: center;
}

/* Nocturnal Sleep Blessing Pill */
.tarot-blessing {
  background: linear-gradient(135deg, rgba(58, 22, 75, 0.6) 0%, rgba(26, 12, 38, 0.8) 100%);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 11.5px;
  color: #fff6db;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  margin-bottom: 2px;
}

.blessing-sparkle {
  color: var(--gold-bright);
  font-size: 12px;
}

/* Card Bottom Footer */
.tarot-card-footer {
  text-align: center;
  border-top: 1px dashed rgba(212, 175, 55, 0.2);
  padding-top: 6px;
}

.tarot-flip-hint {
  font-family: var(--font-display);
  font-size: 8.5px;
  letter-spacing: 1.5px;
  color: rgba(212, 175, 55, 0.7);
  text-transform: uppercase;
  transition: all 0.2s ease;
  pointer-events: none;
}

.tarot-3d-card:hover .tarot-flip-hint {
  color: #fff4d0;
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
}

/* ==========================================================================
   AUTHENTIC GOTHIC TAROT CARD BACK FACE
   ========================================================================== */

.tarot-back-frame {
  position: relative;
  height: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(212, 175, 55, 0.45);
  margin: 6px;
  border-radius: 12px;
  box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.9);
  background: repeating-linear-gradient(
    45deg,
    rgba(212, 175, 55, 0.03) 0px,
    rgba(212, 175, 55, 0.03) 2px,
    transparent 2px,
    transparent 12px
  );
  z-index: 2;
}

.tarot-back-corners {
  display: flex;
  width: 100%;
  justify-content: space-between;
  font-size: 12px;
  color: var(--gold-antique);
  opacity: 0.75;
}

.tarot-back-ornament {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: auto 0;
}

.tarot-back-rose-window {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 2px solid var(--gold-antique);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, #3b174f 0%, #170924 75%);
  box-shadow: 0 0 25px rgba(212, 175, 55, 0.4), inset 0 0 20px rgba(0, 0, 0, 0.9);
  margin-bottom: 16px;
  animation: backRoseSlowSpin 35s linear infinite;
}

@keyframes backRoseSlowSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.rose-spokes {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 1px dashed rgba(212, 175, 55, 0.5);
}

.rose-spokes::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(212, 175, 55, 0.35);
}

.rose-center-eye {
  font-size: 32px;
  filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.8));
}

.tarot-back-text {
  font-family: var(--font-blackletter);
  font-size: 30px;
  color: var(--gold-antique);
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
  margin-bottom: 2px;
}

.tarot-back-sub {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.tarot-back-runes {
  font-size: 13px;
  letter-spacing: 6px;
  color: rgba(212, 175, 55, 0.6);
}

.tarot-back-footer {
  font-family: var(--font-display);
  font-size: 9.5px;
  letter-spacing: 1.8px;
  color: var(--gold-antique);
  text-transform: uppercase;
  animation: backFooterGlow 2s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes backFooterGlow {
  0% { opacity: 0.75; transform: scale(0.98); }
  100% { opacity: 1; transform: scale(1.04); color: #fff8da; text-shadow: 0 0 10px rgba(212, 175, 55, 0.7); }
}

/* ==========================================================================
   FLOATING 3D INTERACTIVE CONTROLS TOOLBAR
   ========================================================================== */

.tarot-3d-toolbar {
  position: absolute;
  bottom: -68px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 50;
  white-space: nowrap;
}

.tarot-tool-btn {
  background: rgba(18, 11, 26, 0.92);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: #ede3d1;
  font-family: var(--font-display);
  font-size: 10.5px;
  letter-spacing: 1.2px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.tarot-tool-btn .tool-icon {
  font-size: 13px;
  transition: transform 0.25s ease;
}

.tarot-tool-btn:hover {
  background: #321547;
  border-color: var(--gold-antique);
  color: #fff6db;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.8), 0 0 12px var(--gold-glow);
}

.tarot-tool-btn:hover .tool-icon {
  transform: scale(1.18);
}

.tarot-tool-btn.unrevealed {
  background: linear-gradient(180deg, #872ca3 0%, #4c1260 100%);
  border-color: var(--gold-bright);
  color: #fff9e6;
  font-weight: 700;
  animation: revealBtnPulse 1.8s ease-in-out infinite alternate;
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.45);
}

@keyframes revealBtnPulse {
  0% { transform: translateY(0); box-shadow: 0 0 10px rgba(212, 175, 55, 0.3); }
  100% { transform: translateY(-2px); box-shadow: 0 0 22px rgba(212, 175, 55, 0.65); }
}

.tarot-tool-btn.highlight {
  background: linear-gradient(180deg, #6b2182 0%, #3e0f4f 100%);
  border-color: var(--gold-bright);
  color: #fff9e6;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8), 0 0 14px rgba(212, 175, 55, 0.35);
}

.tarot-tool-btn.highlight:hover {
  background: linear-gradient(180deg, #872ca3 0%, #511367 100%);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.9), 0 0 20px rgba(212, 175, 55, 0.55);
}

.tarot-tool-btn.dismiss:hover {
  border-color: #c94a5e;
  color: #ffb8c4;
}

/* Pulse Ripple when communing */
@keyframes communeAuraShockwave {
  0% { transform: scale(1); opacity: 1; box-shadow: 0 0 10px #d4af37; }
  100% { transform: scale(1.4); opacity: 0; box-shadow: 0 0 60px #da70d6; }
}

.tarot-artwork-chamber.communing::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--gold-bright);
  animation: communeAuraShockwave 1.2s ease-out;
  pointer-events: none;
}

/* Responsive tuning for small mobile screens */
@media (max-height: 700px) {
  .tarot-3d-stage {
    width: 290px;
    height: 480px;
  }
  .tarot-artwork-chamber {
    width: 105px;
    height: 105px;
    margin: 4px auto;
  }
  .tarot-artwork-icon {
    font-size: 48px;
  }
  .tarot-title {
    font-size: 22px;
  }
  .tarot-meaning {
    font-size: 13px;
    line-height: 1.35;
  }
  .tarot-3d-toolbar {
    bottom: -54px;
    gap: 6px;
  }
  .tarot-tool-btn {
    padding: 6px 10px;
    font-size: 9.5px;
  }
}
