:root {
    --primary: #d4af37;
    /* Gold */
    --primary-dark: #b5952d;
    --bg-dark: #070913;
    --bg-card: rgba(20, 24, 44, 0.8);
    --text-light: #f5f5f5;
    --text-muted: #a0a5b5;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: 'Prompt', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    background-image: radial-gradient(circle at center, #13172e 0%, #070913 100%);
}

#particles-js {
    position: fixed;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    top: 0;
    left: 0;
    pointer-events: none;
}

.container {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    font-family: 'Cinzel', serif;
    font-size: 3.5rem;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.2rem;
    color: var(--text-muted);
    letter-spacing: 2px;
}

/* Tarot Card 3D Flip & Floating */
.tarot-scene {
    width: 260px;
    height: 420px;
    perspective: 1000px;
    margin-bottom: 3rem;
}

.card-container {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* floating animation */
    animation: floating 4s ease-in-out infinite;
}

@keyframes floating {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-15px);
    }

    100% {
        transform: translateY(0px);
    }
}

.card-container.flipped {
    transform: rotateY(180deg);
    animation: none;
    /* Stop floating when flipped */
}

/* Add a glowing effect to the card */
.card-container::before {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background: repeating-conic-gradient(from 0deg,
            transparent 0deg,
            rgba(255, 215, 0, 0.12) 10deg,
            transparent 20deg);
    -webkit-mask-image: radial-gradient(circle at center, black 0%, transparent 40%);
    mask-image: radial-gradient(circle at center, black 0%, transparent 40%);
    z-index: -2;
    opacity: 0;
    transition: opacity 2s ease-in-out;
    pointer-events: none;
    mix-blend-mode: screen;
}

.card-container::after {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    bottom: -40px;
    left: -40px;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.8) 0%, rgba(212, 175, 55, 0.5) 40%, transparent 70%);
    z-index: -1;
    opacity: 0;
    transition: opacity 2s ease-in-out;
    border-radius: 20px;
    filter: blur(20px);
    mix-blend-mode: screen;
}

.card-container.glow::before {
    opacity: 1;
    animation: holyRaySpin 30s linear infinite;
}

.card-container.glow::after {
    opacity: 1;
    animation: holyGlowPulse 4s infinite alternate ease-in-out;
}

@keyframes holyGlowPulse {
    0% {
        transform: scale(0.92);
        opacity: 0.5;
        filter: blur(15px);
    }

    100% {
        transform: scale(1.15);
        opacity: 1;
        filter: blur(35px);
    }
}

@keyframes holyRaySpin {
    0% {
        transform: rotate(0deg) scale(1);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* When spinning fast during draw */
.card-container.spinning {
    animation: spinRotate 1s ease-in-out;
}

@keyframes spinRotate {
    0% {
        transform: rotateY(0deg) scale(1) translateY(0);
    }

    50% {
        transform: rotateY(360deg) scale(1.1) translateY(-20px);
        filter: brightness(1.5);
    }

    100% {
        transform: rotateY(720deg) scale(1) translateY(0);
        filter: brightness(1);
    }
}

.card {
    width: 100%;
    height: 100%;
    position: absolute;
    transform-style: preserve-3d;
    pointer-events: none;
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8), 0 0 20px rgba(212, 175, 55, 0.2);
    border: 2px solid rgba(212, 175, 55, 0.5);
    background-color: #000;
}

.card-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.card-front {
    transform: rotateY(180deg);
}

/* Controls */
.controls {
    margin-bottom: 2rem;
    position: relative;
    z-index: 10;
}

.mystic-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #111;
    border: none;
    padding: 1.2rem 3.5rem;
    font-size: 1.3rem;
    font-family: 'Prompt', sans-serif;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.4);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
}

.mystic-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transition: left 0.5s ease;
}

.mystic-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(212, 175, 55, 0.7);
}

.mystic-btn:hover::before {
    left: 100%;
}

.mystic-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
}

.mystic-btn:disabled {
    background: #333;
    color: #666;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.mystic-btn.outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    margin-top: 1.5rem;
}

.mystic-btn.outline:hover {
    background: rgba(212, 175, 55, 0.15);
}

/* Results */
.result-box {
    background: var(--bg-card);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 20px;
    padding: 3rem;
    width: 100%;
    backdrop-filter: blur(15px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(212, 175, 55, 0.1) inset;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease-in-out, transform 1s ease-in-out;
    pointer-events: none;
}

.result-box.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.card-title {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    text-align: center;
    border-bottom: 2px solid rgba(212, 175, 55, 0.2);
    padding-bottom: 1.5rem;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.badges-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 2rem;
}

.badge {
    background: rgba(212, 175, 55, 0.1);
    color: var(--primary);
    padding: 0.4rem 1.2rem;
    border-radius: 50px;
    font-size: 0.95rem;
    border: 1px solid rgba(212, 175, 55, 0.3);
    font-weight: 400;
}

.meaning-section {
    margin-bottom: 1rem;
}

.long-text {
    text-align: left;
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-light);
    font-weight: 300;
    text-indent: 2rem;
    margin-bottom: 2rem;
}

.advice-section {
    background: rgba(212, 175, 55, 0.05);
    border-left: 4px solid var(--primary);
    padding: 1.5rem;
    border-radius: 0 10px 10px 0;
    text-align: left;
    margin-bottom: 2.5rem;
}

.advice-section h3 {
    color: var(--primary);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.advice-section p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-light);
    font-weight: 300;
}

.aspects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.aspect-card {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 15px;
    padding: 2rem 1.5rem;
    text-align: center;
    transition: all 0.4s ease;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.aspect-card:hover {
    transform: translateY(-8px);
    border-color: rgba(212, 175, 55, 0.5);
    background: rgba(20, 24, 44, 0.9);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(212, 175, 55, 0.2) inset;
}

.aspect-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
}

.aspect-card h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 400;
}

.aspect-card p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-light);
    font-weight: 300;
}

.hidden {
    display: none !important;
}

#resetBtn {
    display: block;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .tarot-scene {
        width: 220px;
        height: 350px;
    }

    .logo {
        font-size: 2.8rem;
    }

    .result-box {
        padding: 2rem;
    }

    .card-title {
        font-size: 2rem;
    }
}