:root {
    --mo-purple: #6a11cb;
    --mo-gold: #ffdf00;
    --mo-glass: rgba(255, 255, 255, 0.1);
    --mo-border: rgba(255, 255, 255, 0.2);
}

#mo-main-container {
    max-width: 900px;
    margin: 40px auto;
    background: linear-gradient(135deg, #24243e 0%, #0f0c29 100%);
    border-radius: 30px;
    padding: 40px 20px;
    color: #fff;
    font-family: 'Quicksand', sans-serif;
    box-shadow: 0 25px 50px rgba(0,0,0,0.6);
}

.mo-panel { display: none; text-align: center; }
.mo-panel.active { display: block; animation: moFadeIn 0.5s forwards; }

/* Ảnh Intro rung nhẹ */
.mo-intro-card {
    width: 130px;
    margin: 0 auto 30px;
    border-radius: 10px;
    border: 3px solid #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: moShake 4s infinite ease-in-out;
    display: block;
}

/* Ô chọn Select đẹp hơn */
.mo-form-group { max-width: 600px; margin: 0 auto; }
.mo-input {
    width: 100%;
    background: var(--mo-glass);
    border: 1px solid var(--mo-border);
    padding: 12px 20px;
    border-radius: 15px;
    color: #fff;
    margin-bottom: 15px;
    font-size: 16px;
    appearance: none; /* Ẩn mũi tên mặc định */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
}

/* Hiệu ứng trải bài */
#mo-deck-wrap { position: relative; height: 320px; margin-bottom: 30px; }
.mo-card-hidden {
    width: 75px; height: 115px;
    background: url('../images/card-back-new.jpg') center/cover;
    border-radius: 8px;
    position: absolute;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    opacity: 0;
    transform: translateY(30px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.mo-card-hidden.mo-dealt { opacity: 1; transform: translateY(0); }
.mo-playing-back { background-image: url('../images/card-back-playing.jpg') !important; }

/* Khi chọn bài: Lá bài bay lên và biến mất */
.mo-card-hidden.mo-picked {
    transform: translateY(-100px) scale(1.5) !important;
    opacity: 0;
    pointer-events: none;
}

/* Tìm đoạn #mo-cards-summary cũ và thay bằng: */
#mo-cards-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); /* Tăng độ rộng tối thiểu */
    gap: 25px;
    margin-bottom: 30px;
    align-items: stretch; /* Ép các ô cao bằng nhau dù chữ dài hay ngắn */
}

.mo-res-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 20px;
    border: 1px solid var(--mo-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.mo-res-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 15px;
    border: 1px solid var(--mo-border);
    height: 100%; /* Đảm bảo các ô cao bằng nhau */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mo-res-card img {
    width: 120px; /* Thu nhỏ lại một chút cho cân đối */
    height: auto;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
}

.mo-res-card h4 {
    font-size: 15px;
    color: var(--mo-gold);
    margin: 0 0 10px 0;
    min-height: 40px; /* Ép tiêu đề có khoảng trống bằng nhau */
    display: flex;
    align-items: center;
    justify-content: center;
}

.mo-summary-text {
    font-size: 13px;
    line-height: 1.6;
    color: #bbb;
    text-align: center; /* Đổi sang center cho giống các app bói bài hiện đại */
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word; /* Tránh vỡ khung */
}

/* Hiệu ứng lật ảnh cho Tarot ngược */
.mo-img-down {
    transform: rotate(180deg);
}

/* Nút bấm */
.mo-btn-glow {
    background: linear-gradient(45deg, #6a11cb, #2575fc);
    border: none; padding: 15px 45px; border-radius: 50px;
    color: #fff; font-weight: bold; cursor: pointer;
    box-shadow: 0 10px 20px rgba(106, 17, 203, 0.3);
}
.mo-btn-outline { background: rgba(255,255,255,0.1); border: 1px solid var(--mo-border); padding: 10px 25px; border-radius: 10px; color: #fff; cursor: pointer; }

@keyframes moShake { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-3deg); } 40% { transform: rotate(3deg); } }
@keyframes moFadeIn { from { opacity: 0; } to { opacity: 1; } }
/* Nếu bói nhanh, cho nút bấm cách ảnh intro một khoảng vừa phải */
#mo-main-container[data-fast="true"] #mo-btn-start {
    margin-top: 20px;
}
/* Cụm 3 lá bài Intro cho bói 3 lá */
.mo-intro-deck {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
    min-height: 180px;
}

.mo-intro-deck .mo-intro-card {
    margin: 0 -35px; /* Giảm margin âm để các lá bài xếp chồng lên nhau đẹp hơn */
    display: inline-block;
}

/* Kiểu cho đoạn mô tả intro */
.mo-intro-description {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.mo-related-item:hover {
    background: rgba(106, 17, 203, 0.4) !important;
    border-color: var(--mo-gold) !important;
    transform: translateX(5px);
}

.mo-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
    gap: 15px;
    justify-content: center;
}

/* 1. Đảm bảo tất cả các panel mặc định phải ẩn */
#mo-main-container .mo-panel {
    display: none !important;
}

/* 2. Chỉ hiển thị khi có class .active */
#mo-main-container .mo-panel.active {
    display: block !important;
}

/* 3. Riêng panel kết quả, khi active thì dùng flex để căn giữa các nút */
#mo-main-container #mo-result-area.active {
    display: flex !important;
    flex-direction: column;
    align-items: center;
}

/* Đảm bảo các phần tử bên trong kết quả chiếm đủ chiều rộng */
#mo-cards-summary, 
.mo-related-readings, 
.mo-disclaimer-box {
    width: 100%;
}

#mo-cards-summary {
    width: 100%; /* Đảm bảo grid chiếm hết chiều ngang */
}

/* Wrapper cho nút Reveal để chắc chắn nó ở giữa */
.mo-reveal-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 25px 0;
}

#mo-btn-reveal {
    margin: 0 auto !important; /* Force center */
    display: block;
}

/* Trạng thái Loading của nút */
.mo-btn-glow.mo-loading {
    pointer-events: none;
    position: relative;
    color: transparent !important; /* Ẩn chữ gốc của nút (XEM LUẬN GIẢI CHI TIẾT) */
}

/* Hiển thị chữ "Đang xử lý..." */
.mo-btn-glow.mo-loading::before {
    content: "Đang xử lý...";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff !important;
    font-size: 15px;
    font-weight: 500;
    /* Đẩy chữ sang trái một chút để chừa chỗ cho spinner bên phải */
    padding-right: 25px; 
}

/* Hiển thị vòng xoay (Spinner) */
.mo-btn-glow.mo-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    /* Căn chỉnh spinner nằm ngay sau chữ "Đang xử lý..." */
    left: calc(50% + 45px); 
    margin-top: -9px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: moSpin 0.8s linear infinite;
}

@keyframes moSpin {
    to { transform: rotate(360deg); }
}