/* Thiết lập chung */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-image: url('https://images.pexels.com/photos/176851/pexels-photo-176851.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2');
    color: #ecf0f1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.tarot-container {
    text-align: center;
    width: 100%;
    max-width: 1000px;
}

h1 {
    font-size: 2.5rem;
    color: #f1c40f;
    text-shadow: 2px 2px 4px #000;
}

/* Lưới chứa các lá bài */
.card-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

/* Kiểu dáng chung cho một lá bài (đóng vai trò sân khấu 3D) */
.card {
    width: 100px;
    height: 170px;
    cursor: pointer;
    position: relative;
    perspective: 1000px; 
}

/* Phần tử bên trong sẽ thực hiện việc lật */
.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

/* Khi lật, chỉ xoay phần tử .card-inner */
.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Mặt sau của lá bài */
.card-back {
    background-image: url('images/card-back.svg'); /* <-- Đường dẫn đến ảnh mới */
    background-size: cover; /* <-- Đảm bảo ảnh vừa vặn với lá bài */
    background-position: center; /* <-- Căn giữa ảnh */
    border: 2px solid #f1c40f; /* <-- Giữ lại đường viền đẹp */
}

/* Mặt trước của lá bài (chứa hình ảnh) */
.card-front {
    background-color: #fff;
    transform: rotateY(180deg);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.card-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Khu vực diễn giải */
#interpretation {
    margin-top: 20px;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    min-height: 100px;
    text-align: left;
}

#interpretation h3 {
    color: #f1c40f;
    margin-top: 0;
}

/* Nút Bói lại */
#reset-button {
    padding: 10px 20px;
    font-size: 1rem;
    color: #2c3e50;
    background-color: #f1c40f;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 20px;
    transition: background-color 0.3s;
}

#reset-button:hover {
    background-color: #f39c12;
}
/* ... (giữ nguyên toàn bộ code CSS hiện có của bạn) ... */


/* ===== PHẦN TỐI ƯU HÓA CHO DI ĐỘNG ===== */
@media (max-width: 600px) {
    body {
        padding: 10px; /* Giảm khoảng đệm của trang */
    }

    h1 {
        font-size: 2rem; /* Giảm kích thước tiêu đề một chút */
    }
    
    .card-grid {
        gap: 10px; /* Giảm khoảng cách giữa các lá bài */
    }

    /* Thu nhỏ kích thước lá bài để 4 lá vừa một hàng */
    .card {
        width: 75px;
        height: 128px;
    }

    #reading-spread {
        /* Đảm bảo 3 lá bài đã chọn cũng có khoảng cách phù hợp */
        gap: 15px;
    }
}