:root {
    --primary-color: #2e003e;
    --secondary-color: #3d155f;
    --accent-color: #df9c28;
    /* Gold */
    --text-color: #e0d0e0;
    --card-width: 200px;
    --card-height: 350px;
    --font-main: 'Cinzel', serif;
    /* Mystical font */
    --font-body: 'Lato', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: radial-gradient(circle at center, var(--secondary-color), var(--primary-color));
    color: var(--text-color);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Center vertically */
    overflow-x: hidden;
    padding: 20px;
}

/* Background Stars/Mist Effect (Optional enhancement) */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MDAiIGhlaWdodD0iNDAwIj48Y2lyY2xlIGN4PSIyMDAiIGN5PSIyMDAiIHI9IjEiIGZpbGw9IndoaXRlIiBvcGFjaXR5PSIwLjUiLz48L3N2Zz4=');
    /* Simple star pattern placeholder */
    opacity: 0.3;
    pointer-events: none;
    z-index: -1;
}

header {
    text-align: center;
    padding: 2rem;
    margin-bottom: 2rem;
    animation: fadeInDown 1s ease-out;
}

h1 {
    font-family: var(--font-main);
    font-size: 3rem;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(223, 156, 40, 0.5);
    letter-spacing: 2px;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

/* Controls */
.controls {
    margin-bottom: 2rem;
    z-index: 10;
}

.btn-mystic {
    background: transparent;
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    padding: 10px 30px;
    font-family: var(--font-main);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 15px rgba(223, 156, 40, 0.2);
}

.btn-mystic:hover {
    background: var(--accent-color);
    color: var(--primary-color);
    box-shadow: 0 0 25px rgba(223, 156, 40, 0.6);
    transform: translateY(-2px);
}

/* Card Container */
.tarot-table {
    display: flex;
    justify-content: center;
    align-items: center;
    /* Align items vertically in the row */
    gap: 2rem;
    flex-wrap: wrap;
    padding: 2rem;
    perspective: 1000px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* Registration Form */
.form-container {
    background: rgba(46, 0, 62, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent-color);
    padding: 2.5rem;
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    margin-bottom: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    animation: fadeInDown 1s ease-out;
}

.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.form-group label {
    font-family: var(--font-main);
    color: var(--accent-color);
    font-size: 1.2rem;
    letter-spacing: 1px;
}

.form-group input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(223, 156, 40, 0.3);
    padding: 12px 15px;
    border-radius: 10px;
    color: var(--text-color);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 10px rgba(223, 156, 40, 0.2);
}

.topic-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.topic-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(223, 156, 40, 0.4);
    color: var(--text-color);
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.topic-btn:hover {
    background: rgba(223, 156, 40, 0.1);
    transform: translateY(-3px);
    border-color: var(--accent-color);
}

.topic-btn.selected {
    background: var(--accent-color);
    color: var(--primary-color);
    box-shadow: 0 0 15px rgba(223, 156, 40, 0.5);
    border-color: var(--accent-color);
}

.form-container .btn-mystic {
    width: 100%;
    margin-top: 1rem;
}

.optional label::after {
    content: " (opcional)";
    font-size: 0.8rem;
    opacity: 0.6;
    font-family: var(--font-body);
}

/* Meaning Display */
.meaning-container {
    margin-top: 2rem;
    padding: 2rem;
    background: rgba(30, 0, 45, 0.9);
    border: 1.5px solid var(--accent-color);
    border-radius: 15px;
    max-width: 850px;
    width: 100%;
    text-align: center;
    min-height: 120px;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(223, 156, 40, 0.1);
}

.meaning-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.meaning-title {
    font-family: var(--font-main);
    color: var(--accent-color);
    font-size: 1.8rem;
    margin-bottom: 1rem;
    text-shadow: 0 0 5px rgba(223, 156, 40, 0.3);
}

.meaning-text {
    font-size: 1.1rem;
    line-height: 1.8;
    text-align: left;
    max-width: 90%;
    margin: 0 auto;
}

.meaning-text p {
    margin-bottom: 1.2rem;
}

.meaning-text strong {
    color: var(--accent-color);
}

/* Loader for the "Bot" thinking */
.loader {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(223, 156, 40, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    margin: 20px auto;
    animation: spin 1s ease-in-out infinite;
    filter: drop-shadow(0 0 10px var(--accent-color));
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Card Flip Logic */
.card-container {
    width: var(--card-width);
    height: var(--card-height);
    cursor: pointer;
    background-color: transparent;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-radius: 15px;
}

.card-container:hover .card-inner {
    box-shadow: 0 15px 40px rgba(223, 156, 40, 0.2);
}

.card-container.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 15px;
    overflow: hidden;
    border: 2px solid var(--accent-color);
}

.card-front {
    background-color: #1a1a1a;
    background-image: url('img/22.png');
    /* Default back of card image from original */
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* If the original back image is transparent or needs a background */
.card-front::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
}

.card-back {
    background-color: #fff;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.card-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    :root {
        --card-width: 140px;
        --card-height: 245px;
    }

    .tarot-table {
        gap: 1rem;
    }

    h1 {
        font-size: 2rem;
    }
}