@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=DM+Sans:wght@400;500;600&display=swap');

body:has(.tarot-experience) {
    background: #090713;
}

body:has(.tarot-experience) .main {
    background:
        radial-gradient(circle at 18% 18%, rgba(61, 116, 129, 0.2), transparent 28rem),
        radial-gradient(circle at 82% 35%, rgba(123, 42, 65, 0.2), transparent 32rem),
        #090713;
    color: #f5edda;
    overflow: hidden;
}

body:has(.tarot-experience) .main > .container {
    max-width: 1480px;
    padding: 0;
}

.tarot-experience {
    --tarot-gold: #d8b66a;
    --tarot-cream: #f5edda;
    --tarot-wine: #7b2a41;
    --tarot-teal: #3d7481;
    --card-width: 76px;
    --card-height: 130px;
    position: relative;
    min-height: 900px;
    padding: 70px clamp(18px, 4vw, 64px) 90px;
    font-family: 'DM Sans', sans-serif;
    isolation: isolate;
}

.tarot-stars,
.tarot-stars::before {
    position: absolute;
    inset: 0;
    z-index: -1;
    content: '';
    pointer-events: none;
    background-image:
        radial-gradient(circle, rgba(245, 237, 218, 0.55) 0 1px, transparent 1.3px),
        radial-gradient(circle, rgba(216, 182, 106, 0.3) 0 1px, transparent 1.5px);
    background-position: 0 0, 37px 61px;
    background-size: 89px 89px, 127px 127px;
    mask-image: linear-gradient(to bottom, black 0%, transparent 84%);
}

.tarot-stars::before {
    transform: rotate(8deg) scale(1.05);
    opacity: 0.35;
}

.tarot-intro {
    width: min(820px, 100%);
    margin: 0 auto 36px;
    text-align: center;
    animation: tarot-rise 700ms ease both;
}

.tarot-kicker {
    margin-bottom: 8px;
    color: var(--tarot-gold);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.tarot-intro h1 {
    margin: 0;
    color: var(--tarot-cream);
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2.7rem, 6vw, 5.6rem);
    font-weight: 600;
    line-height: 0.95;
    letter-spacing: 0;
}

.tarot-intro > p:not(.tarot-kicker) {
    max-width: 650px;
    margin: 20px auto 0;
    color: #bdb5aa;
    font-size: 1rem;
}

.tarot-modes {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-top: 28px;
    padding: 5px;
    border: 1px solid rgba(216, 182, 106, 0.2);
    border-radius: 7px;
    background: rgba(7, 6, 15, 0.7);
}
 
.tarot-modes a {
    padding: 9px 14px;
    border-radius: 4px;
    color: #a9a197;
    font-size: 0.78rem;
    font-weight: 600;
}

.tarot-modes a:hover,
.tarot-modes a.is-active {
    background: rgba(216, 182, 106, 0.12);
    color: var(--tarot-cream);
}

.tarot-console {
    width: min(1320px, 100%);
    margin: 0 auto;
}

.tarot-primary,
.tarot-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 50px;
    padding: 0 20px;
    border: 1px solid var(--tarot-gold);
    border-radius: 5px;
    cursor: pointer;
    background: var(--tarot-gold);
    color: #17101a;
    font: 600 0.86rem 'DM Sans', sans-serif;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.tarot-primary:hover,
.tarot-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(216, 182, 106, 0.18);
}

.tarot-reading-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(1000px, 100%);
    min-height: 38px;
    margin: 0 auto;
    border-bottom: 1px solid rgba(216, 182, 106, 0.13);
    color: #a9a197;
    font-size: 0.78rem;
}

.tarot-reading-status strong {
    color: var(--tarot-gold);
    font-weight: 500;
}

.tarot-table {
    position: relative;
    height: 550px;
    margin-top: 10px;
    overflow: hidden;
    border-radius: 8px;
    background:
        radial-gradient(ellipse at center, rgba(61, 116, 129, 0.12), transparent 52%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent);
    perspective: 1200px;
}

.tarot-experience[data-tarot-mode="full"] .tarot-table { height: 550px; }

.tarot-table::after {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 0;
    width: min(92%, 620px);
    height: 470px;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.82) 0%, rgba(9, 7, 19, 0.68) 50%, transparent 76%);
    content: '';
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.88);
    transition: opacity 450ms ease, transform 550ms ease;
}

.tarot-table.has-revealed-card::after {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.tarot-experience[data-tarot-mode="full"] .tarot-table::after {
    top: auto;
    bottom: 0;
    height: 350px;
    transform: translateX(-50%) scale(0.88);
}

.tarot-experience[data-tarot-mode="full"] .tarot-table.has-revealed-card::after {
    transform: translateX(-50%) scale(1);
}

.tarot-orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(76vw, 920px);
    aspect-ratio: 2.1;
    border: 1px solid rgba(216, 182, 106, 0.08);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.tarot-orbit::before,
.tarot-orbit::after {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px solid rgba(216, 182, 106, 0.06);
    border-radius: 50%;
    content: '';
    transform: translate(-50%, -50%);
}

.tarot-orbit::before { width: 66%; height: 66%; }
.tarot-orbit::after { width: 9px; height: 9px; background: var(--tarot-gold); box-shadow: 0 0 22px var(--tarot-gold); }

.tarot-card {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--card-width);
    height: var(--card-height);
    padding: 0;
    border: 0;
    border-radius: 5px;
    cursor: default;
    background: transparent;
    transform: translate(-50%, -50%) rotate(var(--stack-r, 0deg));
    transform-style: preserve-3d;
    transition: transform 850ms cubic-bezier(0.2, 0.72, 0.2, 1), opacity 300ms ease;
}

.tarot-card-inner {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transition: transform 750ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.tarot-card-face {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border: 1px solid #b99652;
    border-radius: 5px;
    backface-visibility: hidden;
    box-shadow: 0 7px 16px rgba(0, 0, 0, 0.38);
}

.tarot-card-back {
    background:
    url('/images/tarot/card-back.webp') center / cover no-repeat,
        radial-gradient(circle at center, transparent 0 9px, #d8b66a 10px 11px, transparent 12px 21px, rgba(216, 182, 106, 0.6) 22px 23px, transparent 24px),
        conic-gradient(from 45deg at 50% 50%, #60243a, #172d3d, #60243a, #172d3d, #60243a);
}

.tarot-card-back::before {
    position: absolute;
    inset: 5px;
    border: 1px solid rgba(245, 237, 218, 0.72);
    border-radius: 3px;
    content: '';
}

.tarot-card-back::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    border: 1px solid var(--tarot-gold);
    content: '';
    transform: translate(-50%, -50%) rotate(45deg);
}

.tarot-card-front {
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotateY(180deg);
    background: #e8ddc5;
    color: #201825;
}

.tarot-card-front img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    object-fit: cover;
}

.tarot-face-fallback {
    display: grid;
    width: 100%;
    height: 100%;
    padding: 8px 5px;
    place-items: center;
    background:
        radial-gradient(circle at center, rgba(216, 182, 106, 0.45), transparent 42%),
        linear-gradient(155deg, #ede2c9, #c5d0c5);
    text-align: center;
}

.tarot-face-fallback i { color: #7b2a41; font-size: 1.25rem; }
.tarot-face-fallback small { font: 700 0.47rem 'DM Sans', sans-serif; line-height: 1.15; text-transform: uppercase; }

.tarot-table.is-spread .tarot-card {
    cursor: pointer;
    transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) rotate(var(--r));
}

.tarot-table.is-spread .tarot-card:hover,
.tarot-table.is-spread .tarot-card:focus-visible {
    z-index: 90;
    outline: none;
    transform: translate(calc(-50% + var(--x)), calc(-58% + var(--y))) rotate(0deg) scale(1.13);
    filter: brightness(1.12);
}

.tarot-table.is-spread .tarot-card.is-selected {
    z-index: 200;
    cursor: default;
    transform: translate(-50%, -50%) rotate(0deg) scale(1.9);
}

.tarot-selected-tray { display: none; }

.tarot-experience[data-tarot-mode="full"] .tarot-selected-tray {
    position: relative;
    z-index: 550;
    display: block;
    height: 0;
    margin-top: 0;
    overflow: visible;
    opacity: 0;
    transform: translateY(-30px);
    transition: height 450ms ease, margin-top 450ms ease, opacity 350ms ease, transform 450ms ease;
    pointer-events: none;
}

.tarot-experience[data-tarot-mode="full"] .tarot-selected-tray.has-cards {
    height: 180px;
    margin-top: 18px;
    opacity: 1;
    transform: translateY(0);
}

.tarot-experience[data-tarot-mode="full"] .tarot-selected-tray.has-cards::before {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(92%, 620px);
    height: 190px;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.88), rgba(9, 7, 19, 0.62) 52%, transparent 76%);
    content: '';
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.tarot-experience[data-tarot-mode="full"] .tarot-selected-tray .tarot-card {
    top: auto;
    bottom: 8px;
    left: 50%;
    z-index: 300;
    cursor: pointer;
    pointer-events: auto;
    transform: translateX(calc(-50% + var(--selected-x, 0px))) rotate(var(--selected-r, 0deg)) scale(1.12);
}

.tarot-experience[data-tarot-mode="full"] .tarot-selected-tray .tarot-card:hover,
.tarot-experience[data-tarot-mode="full"] .tarot-selected-tray .tarot-card:focus-visible,
.tarot-experience[data-tarot-mode="full"] .tarot-selected-tray .tarot-card.is-active {
    z-index: 550;
    outline: none;
    transform: translate(calc(-50% + var(--selected-x, 0px)), -28px) rotate(0deg) scale(1.3);
    filter: brightness(1.08);
}

.tarot-card.is-selected .tarot-card-inner {
    transform: rotateY(180deg);
}

.tarot-card.is-selected.is-reversed .tarot-card-inner {
    transform: rotateY(180deg) rotate(180deg);
}

.tarot-card.is-departing { opacity: 0; }

.tarot-table.is-shuffling .tarot-card {
    animation: tarot-shuffle 620ms ease-in-out both;
    animation-delay: var(--delay);
}

.tarot-results {
    position: relative;
    z-index: 2;
    display: grid;
    width: min(90%, 620px);
    gap: 3px;
    margin: 18px auto 0;
    text-align: center;
}

.tarot-experience.has-revealed-card .tarot-results::before,
.tarot-experience.has-revealed-card .tarot-actions::before {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: -1;
    width: min(100%, 440px);
    height: 88px;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.94) 0%, rgba(9, 7, 19, 0.82) 48%, transparent 76%);
    content: '';
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.tarot-card-number {
    margin: 0;
    color: var(--tarot-gold);
    font-size: 0.75rem;
}

.tarot-actions {
    position: relative;
    z-index: 2;
    display: grid;
    width: min(900px, 100%);
    margin: 18px auto 0;
    justify-items: center;
    gap: 8px;
    text-align: center;
}
.tarot-experience.has-revealed-card .tarot-actions::before { width: min(94%, 460px); height: 150px; }
.tarot-actions[hidden] { display: none; }
.tarot-actions .tarot-primary,
.tarot-actions .tarot-secondary { min-height: 42px; }
.tarot-secondary { background: transparent; color: var(--tarot-gold); }

.tarot-interpretation {
    width: min(900px, 100%);
    margin: 38px auto 24px;
    padding: clamp(24px, 4vw, 42px);
    border: 1px solid rgba(216, 182, 106, 0.24);
    border-radius: 7px;
    background:
        radial-gradient(circle at top, rgba(61, 116, 129, 0.14), transparent 55%),
        rgba(14, 11, 23, 0.92);
}

.tarot-interpretation h2 {
    color: var(--tarot-cream);
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1;
}

.tarot-meaning-feedback {
    margin-top: 12px;
    color: #ef9b9b;
    font-size: 0.8rem;
}

.tarot-meaning-loader {
    display: grid;
    min-height: 180px;
    margin-bottom: 24px;
    place-items: center;
    align-content: center;
    color: #bdb5aa;
}

.tarot-meaning-loader[hidden] { display: none; }

.tarot-meaning-loader span {
    width: 44px;
    height: 44px;
    margin-bottom: 14px;
    border: 1px solid rgba(216, 182, 106, 0.22);
    border-top-color: var(--tarot-gold);
    border-radius: 50%;
    animation: tarot-meaning-spin 850ms linear infinite;
}

.tarot-reading-question {
    margin: 18px auto;
    color: var(--tarot-gold);
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    font-style: italic;
}

.tarot-reading-summary {
    max-width: 680px;
    margin: 16px auto 26px;
    color: #bdb5aa;
}

.tarot-meaning-cards {
    display: grid;
    grid-template-columns: repeat(var(--result-count, 1), minmax(0, 1fr));
    gap: 12px;
    text-align: left;
}

.tarot-meaning-cards article {
    padding: 20px;
    border-left: 1px solid var(--tarot-gold);
    background: rgba(255, 255, 255, 0.025);
}

.tarot-meaning-cards h3 {
    margin-bottom: 8px;
    color: var(--tarot-cream);
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.45rem;
    letter-spacing: 0;
}

.tarot-meaning-cards article > p:last-child {
    color: #aaa197;
    font-size: 0.83rem;
    line-height: 1.65;
}

.tarot-reading-disclaimer {
    margin-top: 22px;
    color: #777169;
    font-size: 0.7rem;
}

@keyframes tarot-meaning-spin { to { transform: rotate(360deg); } }

.tarot-manifest {
    width: min(1040px, 100%);
    margin: 80px auto 0;
    padding-top: 22px;
    border-top: 1px solid rgba(216, 182, 106, 0.16);
    color: #aaa197;
}

.tarot-manifest > h2 {
    margin: 0 0 22px;
    color: var(--tarot-cream);
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0;
}

.tarot-manifest-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 0 24px;
}

.tarot-manifest-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.tarot-manifest-item summary {
    padding: 9px 24px 9px 0;
    color: var(--tarot-cream);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 500;
}

.tarot-manifest-item[open] summary { color: var(--tarot-gold); }

.tarot-manifest-item p {
    margin: 0;
    padding: 0 0 12px;
    color: #aaa197;
    font-size: 0.74rem;
    line-height: 1.6;
}

.tarot-faq {
    width: min(820px, 100%);
    margin: 90px auto 0;
}

.tarot-faq > h2 {
    margin-bottom: 26px;
    color: var(--tarot-cream);
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1;
}

.tarot-faq details {
    border-top: 1px solid rgba(216, 182, 106, 0.17);
}

.tarot-faq details:last-child {
    border-bottom: 1px solid rgba(216, 182, 106, 0.17);
}

.tarot-faq summary {
    padding: 18px 30px 18px 0;
    color: var(--tarot-cream);
    cursor: pointer;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.22rem;
    font-weight: 600;
}

.tarot-faq details p {
    max-width: 720px;
    padding: 0 0 20px;
    color: #aaa197;
    font-size: 0.88rem;
    line-height: 1.75;
}

@keyframes tarot-rise {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes tarot-shuffle {
    0%, 100% { transform: translate(-50%, -50%) rotate(var(--stack-r)); }
    45% { transform: translate(calc(-50% + var(--shuffle-x)), calc(-50% + var(--shuffle-y))) rotate(var(--shuffle-r)); }
}

@media (max-width: 760px) {
    .tarot-experience { --card-width: 60px; --card-height: 102px; padding-top: 45px; }
    .tarot-intro h1 { font-size: clamp(2.5rem, 13vw, 4rem); }
    .tarot-modes { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
    .tarot-modes a { display: grid; min-height: 48px; padding: 7px; place-items: center; line-height: 1.2; }
    .tarot-primary { width: 100%; }
    .tarot-table { height: 570px; margin-inline: -18px; border-radius: 0; }
    .tarot-experience[data-tarot-mode="full"] .tarot-table { height: 570px; }
    .tarot-results { margin-top: 14px; }
    .tarot-meaning-cards { grid-template-columns: 1fr; }
    .tarot-manifest-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .tarot-experience { --card-width: 54px; --card-height: 92px; }
    .tarot-table { height: 545px; }
    .tarot-table::after { width: 96%; height: 410px; }
    .tarot-table.is-spread .tarot-card.is-selected { transform: translate(-50%, -50%) rotate(0deg) scale(1.75); }
    .tarot-experience[data-tarot-mode="full"] .tarot-selected-tray {
        height: 0;
    }
    .tarot-experience[data-tarot-mode="full"] .tarot-selected-tray.has-cards { height: 165px; margin-top: 14px; }
    .tarot-experience[data-tarot-mode="full"] .tarot-selected-tray .tarot-card {
        bottom: 8px;
        transform: translateX(calc(-50% + var(--selected-x, 0px))) rotate(var(--selected-r, 0deg)) scale(1.08);
    }
    .tarot-experience[data-tarot-mode="full"] .tarot-selected-tray .tarot-card:hover,
    .tarot-experience[data-tarot-mode="full"] .tarot-selected-tray .tarot-card:focus-visible,
    .tarot-experience[data-tarot-mode="full"] .tarot-selected-tray .tarot-card.is-active {
        transform: translate(calc(-50% + var(--selected-x, 0px)), -24px) rotate(0deg) scale(1.22);
    }
    .tarot-actions { margin-top: 14px; gap: 10px; }
    .tarot-primary, .tarot-secondary { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
    .tarot-intro,
    .tarot-result,
    .tarot-card,
    .tarot-card-inner { animation: none !important; transition-duration: 1ms !important; }
}