@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Lora:ital,wght@0,400;0,600;1,400&family=Montserrat:wght@400;500;600&display=swap');

.tarot-game-container {
    max-width: 900px;
    margin: 0 auto;
    font-family: 'Lora', Georgia, serif;
    color: #e0d5c1;
}

.tarot-game-inner {
    background: radial-gradient(circle at center, #1a1025 0%, #0d0614 100%);
    padding: 60px 30px;
    border-radius: 16px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    text-align: center;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), inset 0 0 40px rgba(100, 50, 150, 0.2);
    margin-bottom: 40px;
    overflow: hidden;
}

/* Add a subtle mystic overlay pattern */
.tarot-game-inner::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url('data:image/svg+xml;utf8,%3Csvg width="100" height="100" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M50 0 L100 50 L50 100 L0 50" fill="none" stroke="rgba(212,175,55,0.03)" stroke-width="1" /%3E%3C/svg%3E');
    background-size: 100px 100px;
    pointer-events: none;
    z-index: 0;
}

.tarot-cards-area {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 50px;
    perspective: 1500px;
    z-index: 2;
    position: relative;
}

.tarot-card-wrapper {
    flex: 1;
    max-width: 220px;
    /* Use exact image ratio to prevent cropping */
    aspect-ratio: 594 / 919;
    height: auto;
    cursor: pointer;
    perspective: 1200px;
}

.tarot-card {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}

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

.tarot-card.flipped.reversed-card .tarot-card-back img {
    transform: rotateZ(180deg);
}

.tarot-card-front, .tarot-card-back {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    top: 0;
    left: 0;
    border-radius: 12px; /* Matches most card edges */
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    background: transparent;
}

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

/* Image scaling fixed */
.tarot-card-front img, .tarot-card-back img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* NOT cropped */
    display: block;
    transition: filter 0.5s ease;
    border-radius: 12px;
}

/* Adding a mystic glow on hover and after flip */
.tarot-card-wrapper:hover .tarot-card:not(.flipped) .tarot-card-front img {
    filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.5));
}

.tarot-card.flipped.reversed-card .tarot-card-back img {
    filter: drop-shadow(0 0 20px rgba(220, 53, 69, 0.5));
}

.tarot-card.flipped:not(.reversed-card) .tarot-card-back img {
    filter: drop-shadow(0 0 20px rgba(40, 167, 69, 0.5));
}

/* Badges styling upgrades */
.tarot-card.flipped.reversed-card .tarot-card-back::after {
    content: "ODWRÓCONA (NIE)";
    position: absolute;
    bottom: -15px; /* pop out the bottom slightly */
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #7a1b24, #d9534f);
    color: #fff;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 11px;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    letter-spacing: 1.5px;
    pointer-events: none;
    box-shadow: 0 5px 15px rgba(217, 83, 79, 0.6), inset 0 1px 1px rgba(255,255,255,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    opacity: 0;
    animation: fadeInBadge 0.6s 1s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
}

.tarot-card.flipped:not(.reversed-card) .tarot-card-back::after {
    content: "NORMALNA (TAK)";
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #1b5e20, #28a745);
    color: #fff;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 11px;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    letter-spacing: 1.5px;
    pointer-events: none;
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.6), inset 0 1px 1px rgba(255,255,255,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    opacity: 0;
    animation: fadeInBadge 0.6s 1s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
}

@keyframes fadeInBadge {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.tarot-instruction {
    font-size: 1.25em;
    color: #d4af37;
    margin-top: 30px;
    font-family: 'Cinzel', serif;
    cursor: pointer;
    transition: all 0.4s;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
    z-index: 2;
    position: relative;
    letter-spacing: 1px;
}

.tarot-instruction:hover {
    color: #fff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
}

.tarot-result-area {
    position: absolute;
    top: 50%; /* center in the middle of cards */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    z-index: 10;
    pointer-events: none; /* let clicks pass through to reload */
}

.tarot-result-box {
    background: rgba(15, 10, 20, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #d4af37;
    padding: 25px 50px;
    border: 1px solid rgba(212, 175, 55, 0.5);
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.9), 0 0 30px rgba(212, 175, 55, 0.2);
    display: inline-block;
    animation: burstIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes burstIn {
    0% { transform: scale(0.5); opacity: 0; filter: blur(10px); }
    70% { transform: scale(1.05); opacity: 1; filter: blur(0px); }
    100% { transform: scale(1); opacity: 1; filter: blur(0px); }
}

.tarot-result-label {
    display: block;
    font-size: 1em;
    margin-bottom: 10px;
    font-family: 'Lora', serif;
    font-style: italic;
    color: #a09783;
}

.tarot-result-text {
    margin: 0;
    font-size: 2.2em;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Modify text color based on result set by JS inline but we'll adapt dynamically if needed.
   Actually JS hardcodes background color. I will remove the JS hardcoded bg color and use CSS classes! */

.tarot-info-section {
    text-align: left;
    margin-top: 40px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 12px;
    border-top: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    font-family: 'Montserrat', sans-serif;
    color: #4a2b6b; /* ciemny fiolet */
}

.tarot-info-section h3 {
    font-family: 'Cinzel', serif;
    color: #3e1b5e; /* deeper ciemny fiolet for headings */
    font-size: 1.6em;
    margin-top: 0;
    margin-bottom: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(62, 27, 94, 0.2);
    padding-bottom: 10px;
}

.tarot-info-section p {
    line-height: 1.8;
    margin-bottom: 20px;
    font-size: 1.05em;
    color: #4a2b6b;
}

.tarot-info-section ul {
    list-style-type: none;
    margin-left: 0;
    margin-bottom: 25px;
    padding: 0;
}

.tarot-info-section li {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #4a2b6b;
    position: relative;
    padding-left: 30px;
}

.tarot-info-section li strong {
    color: #3e1b5e;
    font-weight: 600;
}

.tarot-info-section li::before {
    content: "✦";
    position: absolute;
    left: 0;
    top: 2px;
    color: #3e1b5e;
}

@media (max-width: 600px) {
    .tarot-cards-area {
        gap: 15px;
    }
    .tarot-info-section h3 {
        font-size: 1.3em;
    }
    .tarot-result-box {
        padding: 20px 30px;
    }
    .tarot-result-text {
        font-size: 1.6em;
    }
}
