@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
/* 1. Cấu hình chung & Hình nền */
:root {
    --text-color: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.1); 
    /* THÊM DÒNG NÀY: Nền kính tối hơn cho modal kết quả */
    --glass-bg-dark: rgba(20, 20, 35, 0.9); 
    --glass-border: 1px solid rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --blur-strength: blur(12px);
    --accent-color: #00d2ff; 
    /* THÊM 2 DÒNG NÀY: Màu đúng/sai cho bảng kết quả */
    --success-color: #2ecc71; 
    --error-color: #e74c3c;
}
/* Áp dụng font cho toàn bộ web, bao gồm cả nút bấm và ô nhập liệu */
body, button, input, textarea, select {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    height: 100vh;
    color: var(--text-color);
    overflow: hidden;
    /* HÌNH NỀN: Bạn có thể thay link ảnh khác ở đây */
    background-image: url('pic.gif');

    /* Giúp ảnh bao phủ toàn màn hình */
    background-size: cover; 

    /* Căn giữa ảnh */
    background-position: center;

    /* Không lặp lại ảnh nếu ảnh quá nhỏ */
    background-repeat: no-repeat;

    /* Giữ cố định ảnh nền khi cuộn chuột (tạo hiệu ứng đẹp) */
    background-attachment: fixed;
    
    /* Màu nền dự phòng nếu ảnh lỗi */
    background-color: #1a1a1a;
    /* background: linear-gradient(135deg, #0f0c29, #302b63, #24243e); */
    background-size: cover;
}

/* 2. Modal Chào mừng (Kính mờ) */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); /* Nền tối để nổi bật modal */
    display: flex; justify-content: center; align-items: center;
    z-index: 1000;
    backdrop-filter: blur(1px);
}

.modal-content {
    /* 1. Màu nền tối đen, có độ trong suốt 90% để tệp với nền sau */
    background-color: rgba(20, 35, 30, 0.9); 
    
    /* Hoặc nếu thích hiệu ứng mờ kính (Glassmorphism) thì thêm dòng này: */
    backdrop-filter: blur(5px);

    /* 2. Màu chữ trắng để nổi bật trên nền tối */
    color: #ffffff;

    /* 3. Bo góc tròn trịa hơn cho hiện đại */
    border-radius: 16px;

    /* 4. Thêm viền mỏng sáng nhẹ để khung không bị chìm hẳn vào nền tối */
    border: 1px solid rgba(255, 255, 255, 0.15);

    /* 5. Đổ bóng đậm giúp khung nổi lên trên */
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);

    /* Các thuộc tính canh chỉnh vị trí (giữ nguyên hoặc chỉnh tùy ý) */
    margin: 10% auto;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    text-align: center;
}

.hidden { display: none !important; }

.quiz-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    text-align: left;
}
.setting-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #fff !important;
    font-size: 0.9rem;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
}
.setting-option input { accent-color: var(--accent-color); }

/* Áp dụng cho cả nút Bắt đầu và nút Xử lý file */
#start-btn, #process-btn {
    /* Đổi từ màu tím sang gradient Xanh Neon chủ đạo */
    background: linear-gradient(135deg, #00d2ff 0%, #0078ff 100%);
    
    color: #fff;
    border: none;
    padding: 12px 40px;
    font-size: 16px;
    font-weight: 800; /* Chữ đậm hơn */
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    border-radius: 50px;
    margin-top: 20px;
    
    /* Hiệu ứng phát sáng màu xanh */
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.4);
    transition: all 0.3s ease;
    width: 100%; /* Full chiều rộng cho đẹp */
}

#start-btn:hover, #process-btn:hover {
    transform: translateY(-2px); /* Nhấc nhẹ nút lên */
    box-shadow: 0 0 30px rgba(0, 210, 255, 0.7); /* Sáng mạnh hơn khi di chuột */
}
#start-btn:hover { transform: scale(1.05); }

/* 3. Layout Chính */
.main-container {
    display: flex;
    height: 100vh;
    background: rgba(0, 0, 0, 0.2); /* Lớp phủ tối nhẹ toàn màn hình */
}

/* Cột Trái: Câu hỏi */
.question-area {
    flex: 3;
    padding: 40px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* Scrollbar đẹp hơn */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

/* Tiêu đề & Chữ */
h3, label {
    color: #149bb9 !important; /* Màu xanh chủ đạo */
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1.1em;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

/* Nút Đáp Án (Hiệu ứng kính) */
.option-btn {
    display: block; width: 100%; text-align: left;
    padding: 18px 25px; margin-bottom: 15px;
    
    /* Style Kính */
    background: var(--glass-bg);
    backdrop-filter: var(--blur-strength);
    border: var(--glass-border);
    border-radius: 15px;
    color: white;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-btn:hover {
    background: rgba(20, 35, 30, 0.9);
    transform: translateX(10px); /* Di chuyển nhẹ sang phải */
    border-color: var(--accent-color);
}

/* Trạng thái Đúng/Sai */
.correct-answer { 
    background: rgba(40, 167, 69, 0.6) !important; /* Xanh lá trong suốt */
    border-color: #28a745 !important;
    box-shadow: 0 0 15px rgba(40, 167, 69, 0.5);
}
.wrong-answer { 
    background: rgba(220, 53, 69, 0.6) !important; /* Đỏ trong suốt */
    border-color: #dc3545 !important;
    box-shadow: 0 0 15px rgba(220, 53, 69, 0.5);
}
.disabled { pointer-events: none; opacity: 0.8; }
.option-btn:disabled { cursor: default; opacity: 0.8; }
.option-btn:disabled:hover { transform: none; }
#feedback { margin-top: 15px; font-weight: bold; }
.feedback-correct { color: var(--success-color); }
.feedback-wrong { color: var(--error-color); }

/* Khung Giải thích */
.explanation-box {
    margin-top: 25px; padding: 20px;
    background: rgba(0, 210, 255, 0.1); /* Xanh neon rất nhạt */
    border-left: 4px solid var(--accent-color);
    border-radius: 0 10px 10px 0;
    color: #e0f7fa;
    display: none; /* Mặc định ẩn */
    animation: slideIn 0.5s ease;
}
.explanation-title { color: var(--accent-color); font-weight: bold; text-transform: uppercase; font-size: 0.9em; display: block; margin-bottom: 5px; }

@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Cột Phải: Sidebar (Tấm kính dọc) */
.sidebar {
    flex: 1;
    max-width: 350px;
    
    /* Dùng màu nền tối giống hệt Modal (rgba 20, 35, 30) */
    background: rgba(20, 24, 30, 0.95); 
    
    backdrop-filter: blur(10px);
    
    /* Viền trái màu xanh nhẹ để ngăn cách với nội dung */
    border-left: 1px solid rgba(0, 210, 255, 0.15);
    
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
}

.grid-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 12px;
    overflow-y: auto;
    padding-right: 5px;
    margin-top: 20px;
}

/* Các ô tròn số câu */
/* Ô số bình thường (chưa làm) */
.q-circle {
    width: 40px; height: 40px;
    padding: 0;
    display: flex; justify-content: center; align-items: center;
    
    /* Nền rất tối */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    
    border-radius: 10px; /* Bo góc vuông nhẹ (squircle) nhìn hiện đại hơn tròn hẳn */
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
    color: #888;
    transition: 0.2s;
}

.q-circle:hover {
    border-color: #00d2ff;
    color: #fff;
}

/* Ô đang chọn (Active) - QUAN TRỌNG */
.q-circle.active { 
    border: 1px solid #00d2ff; 
    background: rgba(0, 210, 255, 0.2); /* Nền xanh trong suốt */
    color: #fff;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

/* Ô đã làm đúng/sai (giữ nguyên màu xanh lá/đỏ nhưng làm dịu lại cho hợp nền tối) */
.q-circle.done-correct { background: rgba(46, 204, 113, 0.2); border-color: #2ecc71; color: #2ecc71; }
.q-circle.done-wrong { background: rgba(231, 76, 60, 0.2); border-color: #e74c3c; color: #e74c3c; }

/* Nút Điều hướng */
.navigation-buttons button {
    padding: 12px 25px;
    cursor: pointer;
    
    /* Nền tối thẫm */
    background: rgba(20, 24, 30, 0.85);
    
    color: rgba(255, 255, 255, 0.8);
    
    /* Viền mỏng */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 600;
}

.navigation-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    /* Đẩy 2 nút ra 2 đầu trái phải */
    justify-content: space-between; 
    
    /* Giảm khoảng cách với hộp bên trên xuống còn 10px (bạn có thể chỉnh số này) */
    margin-top: 5px;
    
    /* Bỏ border và padding cũ đi cho nút sát lên trên hơn */
    border-top: none;
    padding-top: 0;
}
.navigation-buttons button:hover { background:rgba(20, 24, 30, 0.85);; }
.navigation-buttons button:disabled { opacity: 0.45; cursor: default; }
.navigation-buttons #finish-round-btn { margin-left: auto; }
.summary .nav-btn { width: 100%; padding: 12px; cursor: pointer; }
.primary-action {
    background: linear-gradient(135deg, #00d2ff, #0078ff);
    color: #fff;
    border: 0;
    border-radius: 10px;
    font-weight: 700;
}

/* Tùy chỉnh thanh cuộn (Webkit) */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }

/* --- STYLE CHO MODAL KẾT QUẢ (MỚI) --- */

/* Áp dụng hiệu ứng kính mờ cho bảng kết quả */
#result-modal .modal-content {
    background: var(--glass-bg-dark); /* Nền kính tối */
    backdrop-filter: var(--blur-strength);
    -webkit-backdrop-filter: var(--blur-strength);
    border: 1px solid rgba(0, 210, 255, 0.3); /* Viền xanh neon nhẹ */
    box-shadow: 0 0 30px rgba(0, 210, 255, 0.2), inset 0 0 20px rgba(0, 210, 255, 0.05); /* Hiệu ứng phát sáng */
    border-radius: 30px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    /* Hiệu ứng hiện ra (pop-in) */
    animation: modalPopIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPopIn {
    from { opacity: 0; transform: scale(0.8) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

#result-modal h2 {
    font-size: 2.2rem;
    margin-bottom: 30px;
    
    /* 1. Định nghĩa màu nền gradient */
    background: linear-gradient(to right, #fff, var(--accent-color));
    
    /* 2. Cắt nền theo chữ (Dòng cũ - hỗ trợ Chrome/Safari) */
    -webkit-background-clip: text; 
    
    /* 3. THÊM DÒNG NÀY (Chuẩn quốc tế - hỗ trợ Firefox/Edge mới) */
    background-clip: text; 
    
    /* 4. Làm chữ trong suốt để lộ nền gradient bên dưới */
    -webkit-text-fill-color: transparent;
    /* Có thể thêm dòng này để chắc ăn hơn */
    color: transparent; 
    
    text-shadow: 0 0 15px rgba(0, 210, 255, 0.4);
}

/* Layout thống kê (chia 2 cột) */
.result-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    padding: 20px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.stat-item { display: flex; flex-direction: column; align-items: center; }

/* Số liệu lớn */
.stat-value {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.2;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* Nhãn nhỏ bên dưới */
.stat-label { font-size: 0.9rem; color: #aaa; text-transform: uppercase; letter-spacing: 1px; margin-top: 5px; }

/* Màu sắc riêng cho từng chỉ số */
#final-correct { color: var(--success-color); text-shadow: 0 0 15px rgba(46, 204, 113, 0.4); }
#final-wrong { color: var(--error-color); text-shadow: 0 0 15px rgba(231, 76, 60, 0.4); }
#final-unanswered { color: #f1c40f; }

/* Phần tổng điểm */
.total-score-box { font-size: 1.5rem; margin-bottom: 30px; }
#final-score { color: white; font-weight: bold; font-size: 2rem; margin-left: 10px; text-shadow: 0 0 10px rgba(255,255,255,0.5); }

/* Nút bấm trong modal */
#result-modal .nav-btn { width: 100%; margin-bottom: 12px; font-size: 1.1rem; padding: 15px; }
/* Style cho nút phụ (Xem lại bài) */
.secondary-action {
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
}
.secondary-action:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: white !important;
    box-shadow: none !important;
}
/* --- THÊM ĐOẠN NÀY ĐỂ Ô CHỌN FILE ĐẸP HƠN --- */
#file-upload {
    width: 100%;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05); /* Nền mờ nhẹ */
    border: 2px dashed rgba(255, 255, 255, 0.3); /* Viền nét đứt */
    border-radius: 10px;
    color: #ccc;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box; /* Đảm bảo padding không làm vỡ khung */
}

#file-upload:hover {
    border-color: var(--accent-color); /* Hover đổi màu viền xanh */
    background: rgba(0, 210, 255, 0.1);
    color: white;
}
/* Tạo một cái hộp tối màu bao quanh riêng câu hỏi */
/* 1. Sửa lại khung chứa câu hỏi cho thoáng hơn */
#question-content {
    background: rgba(20, 24, 30, 0.85);
    
    /* Tăng padding lên: Trên/Dưới 40px, Trái/Phải 40px */
    padding: 40px; 
    border-radius: 16px;
    margin-bottom: 25px;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    
    /* Thêm dòng này để chắc chắn chữ được căn giữa theo chiều dọc nếu nội dung ngắn */
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-bottom: 20px !important;
}

/* Tìm nút đáp án đầu tiên và đẩy nó cách xa dòng câu hỏi phía trên ra */
.option-btn:first-of-type {
    margin-top: 20px !important; /* Bạn chỉnh số 60px này lớn/nhỏ tùy ý */
}

@media (max-width: 700px) {
    body { height: auto; min-height: 100vh; overflow: auto; }
    .main-container { min-height: 100vh; height: auto; flex-direction: column; }
    .question-area { padding: 20px; overflow: visible; }
    .sidebar { max-width: none; border-left: 0; border-top: 1px solid rgba(0, 210, 255, 0.15); }
    .modal { overflow-y: auto; }
    .modal-content { margin: 20px auto; padding: 24px; }
    #question-content { padding: 24px; }
}
