/* 塔羅牌展示區 */
.tarot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    padding: 20px;
}

.tarot-card {
    width: 180px;
    height: 300px;
    perspective: 1000px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transform-style: preserve-3d;
}

/* 桌面版懸停翻轉 */
.tarot-card:hover .card-inner {
    transform: rotateY(180deg);
    transition: transform 0.8s;
}

/* 手機版點擊翻轉 */
.card-inner.is-flipped {
    transform: rotateY(180deg);
    transition: transform 0.8s;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.card-front {
    background-color: #fff;
}

.card-back {
    position: relative; /* 讓偽元素定位正確 */
    background-color: #ffffff; /* 背景色（不透明） */
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-size: 14px;
    line-height: 1.4;
    color: #000000; /* 確保文字清晰 */
    overflow: hidden; /* 防止偽元素超出邊界 */
}

/* 背景圖片（單獨控制透明度） */
.card-back::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url(../../images/card_back.png) center / cover no-repeat;
    opacity: 0.15; /* 圖片透明度 50% */
    z-index: 0; /* 確保在背景色下方 */
}

/* 確保文字在圖片上方 */
.card-back > * {
    position: relative;
    z-index: 1;
}

/* Modal 樣式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    background-color: #fff;
    margin: 20px auto;
    padding: 25px;
    width: 90%;
    max-width: 600px;
    border-radius: 12px;
    position: relative;
    max-height: 90vh;
}

.close {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    transition: color 0.3s;
}

.close:hover {
    color: #333;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tarot-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .tarot-card {
        width: 150px;
        height: 250px;
    }
}