/* /css/games/dhammaQuizGame.css */
/* [PHIÊN BẢN CUỐI CÙNG] */

/* --- 1. Loading & Menu Chung --- */
.dhamma-loading {
    display: flex; align-items: center; justify-content: center;
    height: 100%; font-size: 1.5rem; color: var(--color-primary-cyan);
    animation: pulse 2s infinite;
}
.dhamma-loading.error { color: var(--color-accent-red); animation: none; }
/* --- 2. Menu Hybrid (Carousel Cấp 1, 3, 4) --- */
.hybrid-menu {
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Header ở trên */
    align-items: center;
    height: 100%;
    width: 100%;
    padding-top: 20px;
    overflow: hidden;
    position: relative;
    background: transparent; /* Nền trong suốt */
}

.level-navigator {
    display: flex; 
    align-items: center; 
    justify-content: center;
    gap: 2rem; 
    margin-bottom: 10px; 
    z-index: 20;
    flex-shrink: 0; 
}
.level-navigator h2 { 
    margin: 0; 
    text-align: center; 
    min-width: 300px; 
    font-size: 2.8rem; 
    text-shadow: 0 0 15px rgba(0, 229, 255, 0.8);
}

/* [FIX] Wrapper căn giữa */
.hybrid-menu .domain-cards-wrapper {
    position: relative; 
    width: 100%; 
    flex-grow: 1; /* Chiếm hết khoảng trống dọc còn lại */
    display: flex; 
    align-items: center; /* Căn giữa theo chiều dọc */
    justify-content: center; /* Căn giữa theo chiều ngang */
    perspective: 1200px; 
    z-index: 10;
    padding-bottom: 40px;
}
/* [FIX] Stage KHÔNG DÙNG flexbox */
.hybrid-menu .domain-carousel-stage {
    position: relative; 
    width: 100%; 
    height: 100%; 
    transform-style: preserve-3d;
    /* Đã xóa display:flex */
}

/* [FIX] Thẻ DÙNG position: absolute và margin (230x345px) */
.hybrid-menu .domain-card {
    position: absolute;
    width: 230px;  
    height: 345px; 
    
    /* Căn giữa các thẻ về 1 điểm (để JS xoay) */
    top: 50%;
    left: 50%;
    margin-left: -115px; /* (width / 2) */
    margin-top: -172.5px; /* (height / 2) */
    
    background: rgba(15, 23, 42, 0.9); 
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    display: flex; 
    flex-direction: column;
    overflow: hidden; 
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                opacity 0.4s, filter 0.4s, box-shadow 0.4s;
    backface-visibility: hidden;
    transform-origin: center center; 
}
.hybrid-menu .domain-card.active {
    border: 2px solid var(--vuc-color);
    box-shadow: 0 0 30px rgba(0,0,0,0.6), 0 0 20px var(--vuc-color);
    z-index: 50;
    filter: brightness(1.1);
}

/* Căn chỉnh nội dung bên trong thẻ (giữ nguyên) */
.hybrid-menu .card-content {
    padding: 1.5rem;
    align-items: center;
    justify-content: center; 
    text-align: center;
}
.hybrid-menu .domain-card .domain-name { 
    font-size: 1.3rem; 
    margin-top: auto; 
    line-height: 1.2;
}
.hybrid-menu .domain-card .domain-desc { 
    font-size: 0.8rem; 
    -webkit-line-clamp: 3; 
    min-height: 3rem; 
    color: var(--color-text-secondary);
}
.hybrid-menu .domain-card .domain-number {
    position: absolute;
    top: 10px; right: 15px;
    font-size: 3.5rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.08);
    padding: 0; background: transparent; border: none; line-height: 1;
}
.hybrid-menu .topic-actions { 
    margin-top: 1.5rem; 
    flex-direction: column; 
    width: 100%;
    gap: 0.5rem;
}
.hybrid-menu .domain-number .fa-video { 
    font-size: 3rem;
}

/* Căn chỉnh nút điều hướng (giữ nguyên) */
.hybrid-menu .carousel-nav-btn {
    width: 55px; height: 55px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white; border-radius: 50%;
    cursor: pointer; z-index: 60;
    transition: all 0.2s; font-size: 1.4rem;
    backdrop-filter: blur(4px);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}
.hybrid-menu #sig-carousel-prev { left: 5%; }
.hybrid-menu #sig-carousel-next { right: 5%; }

/* --- 4. Logic Khóa (Lock) --- */
.topic-actions button.locked {
    opacity: 0.4; cursor: not-allowed; background: transparent !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
    box-shadow: none !important;
}
.topic-actions button.locked:hover { transform: none; }
.topic-actions button.locked .fa-lock { margin-right: 0.35rem; }

.domain-card.is-locked {
    opacity: 0.5; cursor: not-allowed; filter: grayscale(80%);
}
.domain-card.is-locked:hover {
    transform: none !important; filter: grayscale(80%);
    box-shadow: none !important;
}
.domain-card.is-locked::before,
.domain-card.is-locked::after { display: none !important; }

.card-lock-icon {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 0.5rem; font-size: 1.5rem;
    color: var(--color-text-secondary); margin-top: 1rem;
    opacity: 0.7; height: 60px;
}
.card-lock-icon .lock-text { font-size: 0.9rem; font-weight: 600; }

/* --- 5. Giao diện Game Chính (Đồng hồ, Combo...) --- */
#dhamma-container {
    display: flex; flex-direction: column;
    width: 100%; height: 100%; padding: 1.5rem;
    color: var(--color-text-primary); position: relative; overflow: hidden;
}
#dhamma-container.flash-green { animation: flash-green 0.3s ease-out; }
#dhamma-container.flash-red { animation: flash-red 0.3s ease-out; }

/* --- 4. Header (Đồng hồ, Điểm) --- */
#dhamma-header {
    display: flex;
    justify-content: space-between; /* <-- SỬA DÒNG NÀY */
    align-items: center; /* <-- THÊM DÒNG NÀY */
    flex-shrink: 0;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--color-bg-panel-transparent);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}
.header-left { 
    display: flex; 
    gap: 1rem;
    flex: 1; /* Cho phép co giãn */
}
.help-actions { 
    display: flex; 
    gap: 0.75rem;
    flex: 1; /* Cho phép co giãn */
    justify-content: center; /* Căn giữa */
}
.stat-bubble {
    font-size: 0.9rem; font-weight: 600; padding: 0.3rem 0.75rem;
    border-radius: 20px; background: rgba(0,0,0,0.2);
}
.stat-bubble.correct { color: var(--color-accent-green); }
.stat-bubble.wrong { color: var(--color-accent-red); }
.stat-bubble.skipped { color: var(--color-text-secondary); }
#dhamma-timer-container {
    font-size: 1.75rem; font-weight: 700; font-family: var(--font-title);
    color: var(--color-primary-cyan); display: flex; align-items: center; gap: 0.5rem;
    flex: 1;justify-content: flex-end;
}

/* --- 5. Khu vực Câu hỏi (Giữa) --- */
#dhamma-question-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Chỉ căn giữa Lưới */
    align-items: center;
    overflow-y: auto;
    padding: 1rem;
}

.dhamma-answers-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 1.5rem; width: 100%; max-width: 1000px;
}
.dhamma-answers-grid .choice-option {
    background: var(--color-bg-panel); border: 2px solid var(--color-border);
    color: var(--color-text-secondary); padding: 1.5rem 1rem;
    font-size: 1rem; border-radius: 8px; text-align: left;
    transition: all 0.2s ease-out; cursor: pointer;
}
.dhamma-answers-grid .choice-option:hover {
    border-color: var(--color-primary-cyan); color: var(--color-text-primary);
}
.dhamma-answers-grid .choice-option.selected {
    border-color: var(--color-primary-cyan); background: rgba(0, 229, 255, 0.1);
    color: var(--color-primary-cyan); box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}
.dhamma-answers-grid .choice-option.hint-removed {
    opacity: 0.3; pointer-events: none; background: rgba(255, 0, 0, 0.1);
}

/* --- 6. Footer (Nút bấm) --- */
#dhamma-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    position: relative;
}
#dhamma-confirm-btn { padding: 0.75rem 2rem; font-size: 1.1rem; }

/* --- 6. Hiệu ứng COMBO & Video --- */
#dhamma-streak-popup {
    position: absolute; top: 40%; left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    font-size: 3rem; font-family: var(--font-title); font-weight: 700;
    z-index: 50; opacity: 0; pointer-events: none;
    transition: all 0.3s ease-out; text-shadow: 0 0 10px #000;
}
#dhamma-streak-popup.correct { color: var(--color-primary-cyan); }
#dhamma-streak-popup.wrong { color: var(--color-accent-red); }
#dhamma-streak-popup.info { color: var(--color-accent-yellow); }
#dhamma-streak-popup.neutral { color: var(--color-text-secondary); }
#dhamma-streak-popup.show {
    opacity: 1; transform: translate(-50%, -50%) scale(1);
    animation: fadeOutUp 1.5s ease-out forwards;
}

#dhamma-combo-counter {
    position: absolute; right: 1.5rem; bottom: 1.5rem;
    margin-bottom: 0; font-family: var(--font-title);
    font-size: 1.5rem; font-weight: 700; padding: 0.5rem 1rem;
    border-radius: 8px; opacity: 0;
    transform: translateY(10px); transition: all 0.3s ease-out;
}
#dhamma-combo-counter.visible { opacity: 1; transform: translateY(0); }
#dhamma-combo-counter.correct {
    color: var(--color-primary-cyan); background: rgba(0, 229, 255, 0.1);
    border: 1px solid var(--color-primary-cyan);
}
#dhamma-combo-counter.wrong {
    color: var(--color-accent-red); background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--color-accent-red);
}

.video-responsive-wrapper {
    position: relative; overflow: hidden; width: 100%;
    padding-top: 56.25%; background: #000;
}
.video-responsive-wrapper iframe {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; border: none;
}

/* --- 7. Animations --- */
@keyframes fadeOutUp {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -100%) scale(1.2); }
}
@keyframes flash-green {
    0%, 100% { box-shadow: inset 0 0 0 0 rgba(16, 185, 129, 0); }
    50% { box-shadow: inset 0 0 100px 50px rgba(16, 185, 129, 0.4); }
}
@keyframes flash-red {
    0%, 100% { box-shadow: inset 0 0 0 0 rgba(239, 68, 68, 0); }
    50% { box-shadow: inset 0 0 100px 50px rgba(239, 68, 68, 0.4); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; } 50% { opacity: 0.6; }
}

/* --- 8. CSS HỘP CÂU HỎI HOLOGRAM --- */
#dhamma-question-box-container {
    padding: 1rem 0;
    flex-shrink: 0; /* Không bị co lại */
}

.hologram-question-box {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    text-align: center;
    position: relative;
    color: #FFF;
    border: 2px solid rgba(0, 229, 255, 0.6);
    background: rgba(0, 30, 70, 0.7);
    backdrop-filter: blur(10px);
    clip-path: polygon(0 10px, 10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px));
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.3) inset;
}
.hologram-question-box .question-text {
    position: relative;
    z-index: 4;
    animation: text-flicker 5s linear infinite;
    font-size: 1.75rem; /* Tăng kích cỡ */
    line-height: 1.6;
}
.hologram-question-box .question-text::before,
.hologram-question-box .question-text::after {
    content: attr(data-text); 
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    overflow: hidden;
}
.hologram-question-box .question-text::before {
    left: 2px;
    text-shadow: -2px 0 #ff00c1; 
    animation: glitch-anim-1 3s infinite linear alternate-reverse;
}
.hologram-question-box .question-text::after {
    left: -2px;
    text-shadow: -2px 0 #00ffff;
    animation: glitch-anim-2 2s infinite linear alternate-reverse;
}
.hologram-question-box .hologram-scanline {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 229, 255, 0.1) 0px,
        rgba(0, 229, 255, 0.1) 1px,
        transparent 1px,
        transparent 4px
    );
    animation: scanlines-move 0.5s linear infinite;
    pointer-events: none;
}
.hologram-question-box::before,
.hologram-question-box::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 229, 255, 0.1);
    z-index: 1;
    opacity: 0.7;
    mix-blend-mode: overlay;
    pointer-events: none;
}
.hologram-question-box::before {
    animation: glitch-anim-h 3s infinite linear alternate-reverse;
}
.hologram-question-box::after {
    animation: glitch-anim-v 4s infinite linear alternate-reverse;
}

/* Keyframes cho Glitch (Copy từ sageIntellectGame.css) */
@keyframes glitch-anim-1 {
    0% { clip-path: inset(40% 0 60% 0); } 20% { clip-path: inset(90% 0 10% 0); }
    40% { clip-path: inset(20% 0 80% 0); } 60% { clip-path: inset(70% 0 30% 0); }
    80% { clip-path: inset(50% 0 50% 0); } 100% { clip-path: inset(10% 0 90% 0); }
}
@keyframes glitch-anim-2 {
    0% { clip-path: inset(80% 0 20% 0); } 20% { clip-path: inset(15% 0 85% 0); }
    40% { clip-path: inset(60% 0 40% 0); } 60% { clip-path: inset(35% 0 65% 0); }
    80% { clip-path: inset(5% 0 95% 0); } 100% { clip-path: inset(95% 0 5% 0); }
}
@keyframes text-flicker {
    0%, 10%, 14%, 40%, 70%, 76%, 100% { opacity: 1; text-shadow: 0 0 8px rgba(0, 229, 255, 0.8); }
    12%, 74% { opacity: 0.6; text-shadow: none; }
}
@keyframes scanlines-move {
    to { background-position: 0 8px; }
}
@keyframes glitch-anim-h {
    0% { clip-path: inset(0 0 80% 0); transform: translateX(5px); }
    20% { clip-path: inset(40% 0 50% 0); transform: translateX(-5px); }
    40% { clip-path: inset(10% 0 60% 0); transform: translateX(3px); }
    60% { clip-path: inset(70% 0 5% 0); transform: translateX(-3px); }
    80% { clip-path: inset(30% 0 30% 0); transform: translateX(5px); }
    100% { clip-path: inset(5% 0 80% 0); transform: translateX(-5px); }
}
@keyframes glitch-anim-v {
    0% { clip-path: inset(0 80% 0 0); transform: translateY(3px); }
    30% { clip-path: inset(0 50% 0 40%); transform: translateY(-3px); }
    60% { clip-path: inset(0 60% 0 10%); transform: translateY(5px); }
    90% { clip-path: inset(0 5% 0 70%); transform: translateY(-5px); }
}