/* Тарот: a night-blue table, the deck that shuffles and fans, and the card faces. Everything else reuses style.css. */
.tarot-hint { text-align: center; font-family: var(--serif); font-style: italic; color: var(--bone); min-height: 1.7em; margin: 0 0 8px; }
.tarot-stage {
  position: relative; padding: 18px 12px 0; border-radius: var(--radius); margin-bottom: 16px;
  background: radial-gradient(120% 90% at 50% 10%, #3a3170, #1f1a3d 55%, #120f24);
  border: 1px solid #4b4380;
  box-shadow: inset 0 0 0 6px #19152f, inset 0 0 0 7px #b8863b55, inset 0 30px 60px #0005;
}
/* A few stars that breathe */
.tarot-stage::before {
  content: ''; position: absolute; inset: 8px; pointer-events: none; animation: tarot-twinkle 3.5s ease-in-out infinite alternate;
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 82% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 64% 46%, #f6dfa6 50%, transparent 51%), radial-gradient(1px 1px at 28% 58%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 92% 70%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 8% 84%, #f6dfa6 50%, transparent 51%),
    radial-gradient(1px 1px at 46% 90%, #fff 50%, transparent 51%);
}
@keyframes tarot-twinkle { from { opacity: .25; } to { opacity: .9; } }

.tarot-slots { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-bottom: 12px; }
.tarot-well { aspect-ratio: 5 / 7; border-radius: 11px; border: 1px dashed #e0ad4d55; background: #0003; }
.tarot-well:has(.tarot-card) { border-color: transparent; background: none; }
.tarot-cap { display: block; min-height: 3.4em; margin-top: 6px; text-align: center; font-family: var(--serif); font-size: .8rem; line-height: 1.25; color: var(--bone); overflow-wrap: anywhere; }
.tarot-cap small { display: block; font: 600 .68rem/1.5 system-ui, sans-serif; letter-spacing: .04em; color: var(--gold); }

.tarot-card { display: block; position: relative; width: 100%; aspect-ratio: 5 / 7; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.tarot-card:disabled { cursor: default; }

/* The deck: every card hangs from one point far below it, so turning a card swings it along an arc */
.tarot-deck { position: relative; height: 176px; transition: height .6s var(--ease), opacity .5s; }
.tarot-deck .tarot-card {
  position: absolute; left: 50%; top: 22px; width: 64px; margin-left: -32px;
  transform-origin: 50% 260px;
  transform: rotate(var(--a, 0deg)) translateY(var(--lift, 0px));
  transition: transform .7s var(--ease) var(--d, 0ms), opacity .4s;
}
.tarot-deck.fanned .tarot-card:active, .tarot-deck.fanned .tarot-card:focus-visible { --lift: -14px; }
@media (hover: hover) { .tarot-deck.fanned .tarot-card:hover { --lift: -14px; } }
/* Before the shuffle the stack itself is the button: it lifts under the pointer and breathes to invite a tap. */
.tarot-deck:not(.fanned):not(.gone) .tarot-card { cursor: pointer; }
.tarot-deck:not(.fanned):not(.gone):hover .tarot-card, .tarot-deck:not(.fanned):not(.gone):focus-within .tarot-card { --lift: -6px; }
@media (prefers-reduced-motion: no-preference) {
  .tarot-deck:not(.fanned):not(.gone) { animation: tarot-breathe 2.4s ease-in-out infinite; }
}
@keyframes tarot-breathe { 50% { transform: translateY(-4px); } }
.tarot-deck.gone { height: 0; opacity: 0; pointer-events: none; }
.tarot-deck.gone .tarot-card { --lift: 90px; }

.tarot-flip { display: block; position: absolute; inset: 0; border-radius: 9px; filter: drop-shadow(0 5px 5px #0008); }
.tarot-well .tarot-flip { border-radius: 11px; }
.tarot-back, .tarot-face {
  position: absolute; inset: 0; border-radius: inherit;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: transform .8s var(--ease);
}
.tarot-back { transform: perspective(600px) rotateY(0deg); }
.tarot-face { transform: perspective(600px) rotateY(-180deg); }
.flipped .tarot-back { transform: perspective(600px) rotateY(180deg); }
.flipped .tarot-face { transform: perspective(600px) rotateY(0deg); }
/* A turning card rises off the table and its gold rim flares */
.flipped .tarot-flip { animation: tarot-rise .9s var(--ease); box-shadow: 0 0 22px #e0ad4d55; }
@keyframes tarot-rise {
  45% { transform: translateY(-12px) scale(1.12); box-shadow: 0 0 44px 6px #e0ad4dcc; }
}
.tarot-spark { position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; border-radius: 50%; background: #ffe7a8; box-shadow: 0 0 8px 2px #e0ad4d; opacity: 0; pointer-events: none; z-index: 2; }

/* Back: an ivory edge around night blue with a gold lattice and a medallion */
.tarot-back {
  border: 3px solid var(--bone);
  background:
    repeating-linear-gradient(45deg, #e0ad4d33 0 1px, transparent 1px 7px),
    repeating-linear-gradient(-45deg, #e0ad4d33 0 1px, transparent 1px 7px),
    linear-gradient(160deg, #4a3f8f, #2a2357 55%, #1b1640);
  box-shadow: inset 0 0 0 1px #b8863b;
}
.tarot-back::before {
  content: ''; position: absolute; inset: 0; margin: auto; width: 38%; aspect-ratio: 1; rotate: 45deg;
  background: #221c4a; border: 1px solid var(--gold); box-shadow: inset 0 0 0 3px #221c4a, inset 0 0 0 4px #e0ad4d99;
}
.tarot-back::after { content: ''; position: absolute; inset: 0; margin: auto; width: 9%; aspect-ratio: 1; rotate: 45deg; background: var(--gold); }

/* Face: dark lacquer with a gold rim. The picture is a line drawing: gold for the major cards, the suit's colour for the rest */
.tarot-face {
  overflow: hidden; color: var(--gold);
  background: radial-gradient(circle at 50% 45%, #3a2d18, #1b1510 75%);
  border: 1px solid var(--gold); box-shadow: inset 0 0 0 3px #1b1510;
}
.tarot-face.s0 { color: #ee6a4c; background: radial-gradient(circle at 50% 45%, #3d1c14, #1b1510 75%); }
.tarot-face.s1 { color: #86c3da; background: radial-gradient(circle at 50% 45%, #14303b, #14151b 75%); }
.tarot-face.s2 { color: #d5d9e2; background: radial-gradient(circle at 50% 45%, #2b2e3a, #15151a 75%); }
.tarot-art { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 3px color-mix(in srgb, currentColor 55%, transparent)); }
.tarot-art text { fill: var(--bone); stroke: none; font: 700 11px var(--serif); }
.tarot-frame { stroke-width: 1; opacity: .55; }
.tarot-pip { fill: currentColor; stroke: none; }
/* As the card turns its lines are drawn in and its marks land one after another */
.tarot-line { stroke-dasharray: 1; stroke-dashoffset: 1; }
.flipped .tarot-line { animation: tarot-draw 1.5s .45s ease-in-out forwards; }
.flipped .tarot-pip { animation: tarot-pop .5s calc(.5s + var(--i) * 80ms) var(--ease) backwards; }
@keyframes tarot-draw { to { stroke-dashoffset: 0; } }
@keyframes tarot-pop { from { scale: 0; opacity: 0; } 60% { scale: 1.25; } }
/* A band of light crosses the face once it has turned */
.tarot-face::after { content: ''; position: absolute; inset: 0; translate: -130% 0; background: linear-gradient(115deg, transparent 35%, #fff6 50%, transparent 65%); }
.flipped .tarot-face::after { animation: tarot-shine 1.1s .55s ease-out; }
@keyframes tarot-shine { to { translate: 130% 0; } }

/* Waiting cards hover over the table; while one turns, the others dim */
.tarot-well .tarot-card:not(.flipped) { animation: tarot-float 2.2s ease-in-out infinite alternate; }
.tarot-slot:nth-child(2) .tarot-card { animation-delay: -.7s; }
.tarot-slot:nth-child(3) .tarot-card { animation-delay: -1.4s; }
@keyframes tarot-float { to { translate: 0 -6px; } }
.tarot-well:has(.tarot-card) { animation: tarot-land .8s .45s ease-out; }
@keyframes tarot-land { from { box-shadow: 0 0 0 0 #e0ad4dcc; } to { box-shadow: 0 0 0 18px #e0ad4d00; } }
.tarot-slot { transition: opacity .4s, filter .4s; }
.revealing .tarot-slot:not(.active) { opacity: .35; filter: blur(1.5px); }
.tarot-card.flipped { cursor: default; }
.tarot-card.flipped .tarot-flip { transition: transform .18s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .tarot-stage::before, .tarot-well .tarot-card { animation: none; }
  .tarot-deck, .tarot-deck .tarot-card, .tarot-back, .tarot-face { transition: none; }
}
