﻿.tarot-launch-btn {
  position: relative;
  overflow: hidden;
}

.tarot-launch-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.24) 45%, transparent 78%);
  transform: translateX(-120%);
  transition: transform 0.72s ease;
}

.tarot-launch-btn:hover::after {
  transform: translateX(120%);
}

.tarot-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 120, 90, 0.18), transparent 24%),
    radial-gradient(circle at 82% 14%, rgba(108, 90, 255, 0.18), transparent 28%),
    rgba(12, 10, 17, 0.78);
  backdrop-filter: blur(16px);
}

.tarot-modal[data-stage="idle"],
.tarot-modal[data-stage="shuffling"],
.tarot-modal[data-stage="picking"],
.tarot-modal[data-stage="result"] {
  display: flex;
}

.tarot-modal[hidden] {
  display: none !important;
}

.tarot-backdrop {
  position: absolute;
  inset: 0;
}

.tarot-panel {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  max-height: min(90vh, 940px);
  overflow: auto;
  border-radius: 32px;
  padding: 24px;
  color: #fff7f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(circle at top right, rgba(255, 126, 96, 0.18), transparent 28%),
    linear-gradient(160deg, #18111f 0%, #24172d 34%, #0e1220 100%);
  box-shadow: 0 34px 90px rgba(7, 5, 13, 0.55);
}

.tarot-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.tarot-head .eyebrow {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 240, 230, 0.88);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tarot-head h3 {
  margin: 8px 0 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.tarot-close {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.tarot-body {
  display: grid;
  gap: 18px;
}

.tarot-stage {
  display: none;
  border-radius: 28px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03)),
    rgba(10, 11, 19, 0.52);
}

.tarot-modal[data-stage="idle"] .stage-setup,
.tarot-modal[data-stage="shuffling"] .stage-shuffle,
.tarot-modal[data-stage="picking"] .stage-pick,
.tarot-modal[data-stage="result"] .stage-result {
  display: block;
}

.tarot-label,
.tarot-subtitle {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 800;
  color: rgba(255, 242, 232, 0.88);
}

.tarot-question {
  width: 100%;
  min-height: 92px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(9, 11, 18, 0.56);
  color: #fff5ee;
  padding: 14px 16px;
  resize: vertical;
  margin-bottom: 14px;
}

.tarot-spreads {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.tarot-spread {
  border-radius: 22px;
  padding: 16px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(18, 17, 30, 0.75);
  color: #fff8f3;
  cursor: pointer;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.tarot-spread:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 155, 124, 0.44);
}

.tarot-spread.active {
  border-color: rgba(255, 157, 132, 0.9);
  box-shadow: 0 0 0 1px rgba(255, 157, 132, 0.3), 0 14px 34px rgba(255, 114, 73, 0.18);
}

.tarot-spread strong {
  display: block;
  margin-bottom: 6px;
  font-size: 18px;
}

.tarot-spread span,
.tarot-note {
  color: rgba(255, 243, 236, 0.76);
  line-height: 1.55;
}

.tarot-primary,
.tarot-secondary {
  border: 0;
  border-radius: 16px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 800;
}

.tarot-primary {
  background: linear-gradient(135deg, #ff7c57, #ff4e2f);
  color: #fff;
}

.tarot-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.tarot-stack {
  position: relative;
  width: 240px;
  height: 332px;
  margin: 8px auto 18px;
  perspective: 1600px;
}

.tarot-stack-card {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 214, 191, 0.26), transparent 20%),
    radial-gradient(circle at 70% 68%, rgba(129, 96, 255, 0.28), transparent 24%),
    linear-gradient(145deg, #281533, #160f25 50%, #0d1019 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
  transform:
    translateY(calc(var(--layer, 0) * 2px))
    rotateZ(calc(var(--layer, 0) * -1.6deg))
    rotateX(10deg);
  animation: tarotShuffle 1.08s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

.tarot-stack-card::after {
  content: "TAROT";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 236, 225, 0.88);
  font-size: 34px;
  letter-spacing: 0.22em;
}

.tarot-pick-grid {
  width: 100%;
  min-height: 310px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0;
  padding: 24px 24px 10px;
  perspective: 2000px;
}

.tarot-pick-grid.is-fanned .tarot-pick-card {
  margin-left: -62px;
}

.tarot-pick-grid.is-fanned .tarot-pick-card:first-child {
  margin-left: 0;
}

.tarot-pick-card {
  position: relative;
  width: 160px;
  height: 258px;
  cursor: pointer;
  perspective: 1800px;
  border: 0;
  background: transparent;
  padding: 0;
  transform-style: preserve-3d;
  transition: transform 0.28s ease, filter 0.28s ease;
  transform:
    rotateZ(var(--fan-angle, 0deg))
    translateY(var(--fan-rise, 0px))
    translateX(var(--fan-shift, 0px));
}

.tarot-pick-card:hover {
  z-index: 8;
  filter: drop-shadow(0 22px 34px rgba(0, 0, 0, 0.34));
  transform:
    rotateZ(var(--fan-angle, 0deg))
    translateY(calc(var(--fan-rise, 0px) - 20px))
    translateX(var(--fan-shift, 0px))
    rotateY(10deg);
}

.tarot-pick-card.picked {
  z-index: 9;
  transform: rotateZ(0deg) translateY(-34px) translateX(0);
}

.tarot-pick-card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.95s cubic-bezier(0.22, 1, 0.36, 1);
}

.tarot-pick-card.revealed .tarot-pick-card-inner {
  transform: rotateY(180deg) rotateZ(calc(var(--fan-angle, 0deg) * -0.2));
}

.tarot-pick-card-face {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  overflow: hidden;
  backface-visibility: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.tarot-pick-card-back {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 214, 191, 0.26), transparent 20%),
    radial-gradient(circle at 70% 68%, rgba(129, 96, 255, 0.28), transparent 24%),
    linear-gradient(145deg, #281533, #160f25 50%, #0d1019 100%);
}

.tarot-pick-card-back::after {
  content: "TAROT";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 236, 225, 0.88);
  font-size: 24px;
  letter-spacing: 0.18em;
}

.tarot-pick-card-front {
  background: #fff;
  transform: rotateY(180deg);
}

.tarot-pick-card-front img,
.tarot-picked-figure img,
.tarot-chat-card-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tarot-picked-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 14px;
}

.tarot-picked-card {
  display: grid;
  gap: 10px;
}

.tarot-picked-figure {
  height: 248px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #fff;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.26);
}

.tarot-picked-caption {
  display: grid;
  gap: 4px;
  color: rgba(255, 243, 236, 0.84);
}

.tarot-result-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.tarot-chat-summary {
  display: grid;
  gap: 12px;
}

.tarot-chat-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.tarot-chat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 10px;
}

.tarot-chat-card {
  display: grid;
  gap: 8px;
}

.tarot-chat-card-figure {
  height: 150px;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

.tarot-chat-card-caption {
  display: grid;
  gap: 3px;
  font-size: 12px;
}

@keyframes tarotShuffle {
  0%,
  100% {
    transform:
      translateY(calc(var(--layer, 0) * 2px))
      rotateZ(calc(var(--layer, 0) * -1.6deg))
      rotateX(10deg);
  }
  50% {
    transform:
      translateY(calc(var(--layer, 0) * -6px))
      rotateZ(calc(var(--layer, 0) * 2.2deg))
      rotateX(18deg);
  }
}

@media (max-width: 900px) {
  .tarot-spreads {
    grid-template-columns: 1fr;
  }

  .tarot-pick-grid.is-fanned .tarot-pick-card {
    margin-left: -88px;
  }
}

@media (max-width: 640px) {
  .tarot-panel {
    padding: 18px;
    border-radius: 24px;
  }

  .tarot-pick-grid {
    min-height: 270px;
    padding: 12px 0 6px;
  }

  .tarot-pick-card {
    width: 128px;
    height: 208px;
  }

  .tarot-pick-grid.is-fanned .tarot-pick-card {
    margin-left: -84px;
  }
}
