/* Inline Game Section Logic */
.game-container-inline {
    width: 100%;
    transition: opacity 0.5s ease;
    margin-top: 2rem;
}

.game-container-inline.hidden {
    opacity: 0;
    display: none;
}

.game-content-card {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    min-height: 500px;
    background: var(--bg-panel);
    border: 1px solid var(--primary-color);
    border-radius: 20px;
    padding: 3rem;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.4);
    text-align: center;
    overflow-x: hidden;
    overflow-y: auto;
    will-change: transform, opacity;
}

.btn-back {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
    min-width: 44px;
    min-height: 44px;
}

.btn-back:hover {
    background: var(--primary-color);
    color: var(--bg-dark);
}

.spreads-grid {
    transition: opacity 0.5s ease;
}

.spreads-grid.hidden {
    opacity: 0;
    display: none;
}

.modal-title {
    color: var(--primary-color);
    margin-bottom: 2rem;
}

.game-stage {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.game-stage.active {
    display: flex;
    animation: fadeIn 0.5s forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Card Stack */
.deck-container-intro {
    width: 120px;
    height: 180px;
    position: relative;
    margin: 2rem auto;
}

.card-back-stack {
    width: 100%;
    height: 100%;
    background-image: url('../assets/hero-bg.png');
    background-size: cover;
    background-position: center;
    border: 2px solid var(--primary-dark);
    border-radius: 10px;
    box-shadow: 5px 5px 0 #1a0b2e;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    color: var(--primary-color);
}

.card-back-stack::before,
.card-back-stack::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: inherit;
    border: inherit;
    border-radius: inherit;
    z-index: -1;
}

.card-back-stack::before {
    transform: translate(5px, 5px);
    opacity: 0.8;
}

.card-back-stack::after {
    transform: translate(10px, 10px);
    opacity: 0.6;
}

/* Shuffle Animation */
.shuffle-animation {
    width: 100%;
    height: 300px;
    position: relative;
}

/* Fan Spread */
.modal-slots {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 2rem;
    width: 100%;
}

.modal-slot {
    width: 100px;
    height: 160px;
    border: 1px dashed rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: all 0.3s ease;
}

.modal-slot.filled {
    border: 1px solid var(--primary-color);
    background: rgba(255, 255, 255, 0.05);
}

.card-spread {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 200px;
    perspective: 1000px;
    margin-top: 1rem;
    overflow-x: auto;
    padding: 20px 0;
}

/* Updated spread item for smoother hover */
.spread-item {
    width: 80px;
    height: 130px;
    background-image: url('../assets/hero-bg.png');
    background-size: cover;
    background-position: center;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    margin: 0 -30px;
    cursor: pointer;
    transition: transform 0.3s ease, margin 0.3s ease;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.5);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    color: var(--primary-color);
    flex-shrink: 0;
    will-change: transform;
}

.spread-item:hover {
    transform: translateY(-20px) scale(1.1);
    z-index: 100;
    margin: 0 -10px;
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

/* Result 3 Cards */
.result-display-3card {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    width: 100%;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    padding: 1rem;
}

.result-card-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 150px;
}

.card-position-label {
    font-size: 0.8rem;
    color: var(--secondary-color);
    font-weight: bold;
    text-transform: uppercase;
}

.result-card-container {
    perspective: 1000px;
    width: 140px;
    height: 220px;
}

.tarot-card {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    will-change: transform;
}

.tarot-card .face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.tarot-card .face.front {
    transform: rotateY(0deg);
    background: #fff;
    border: 2px solid var(--primary-color);
}

.tarot-card .face.back {
    transform: rotateY(180deg);
    background-image: url('../assets/hero-bg.png');
    background-size: cover;
    background-position: center;
    border: 1px solid var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    color: var(--primary-color);
}

.tarot-card.revealed {
    transform: rotateY(0deg);
}

.tarot-card {
    transform: rotateY(180deg);
}

.result-text-3card {
    max-width: 600px;
    text-align: center;
    color: var(--text-muted);
    width: 100%;
}

#result-narrative-text {
    line-height: 1.6;
    margin-bottom: 2rem;
    font-size: 1rem;
}

@media (max-width: 768px) {
    .game-content-card {
        padding: 3rem 1.5rem 1.5rem;
        min-height: 400px;
    }

    .modal-title {
        font-size: 1.5rem;
    }

    .modal-slots {
        gap: 10px;
    }

    .modal-slot {
        width: 80px;
        height: 130px;
    }

    .result-card-container {
        width: 100px;
        height: 160px;
    }

    .result-card-wrapper {
        width: 100px;
    }

    .card-spread {
        height: 180px;
        justify-content: flex-start;
        padding-left: 30px;
        padding-right: 30px;
        margin-left: -1.5rem;
        margin-right: -1.5rem;
        width: calc(100% + 3rem);
        -webkit-overflow-scrolling: touch;
    }

    .spread-item {
        width: 65px;
        height: 100px;
        margin: 0 -20px;
    }
}