/* Cơ bản cho toàn bộ giao diện */
body {
    font-family: 'Comic Sans MS', 'Roboto', Arial, sans-serif; /* Thay đổi font chữ vui tươi hơn */
    line-height: 1.6;
    background-color: #fff0f5; /* Màu nền hồng nhạt (Lavender Blush) */
    color: #5d5d5d;
    margin: 0;
    /* Xóa display: flex; ở đây để mặc định là một cột */
}

/* Khi vào game, kích hoạt giao diện 2 cột */
body.game-view {
    display: flex;
}

/* Wrapper cho nội dung chính (cột bên phải) */
.main-content-wrapper {
    flex-grow: 1; /* Cho phép cột này mở rộng để lấp đầy không gian còn lại */
    padding: 20px;
    min-width: 0; /* THÊM: Đảm bảo flex item không bị tràn */
    box-sizing: border-box; /* Đảm bảo padding không làm tăng kích thước */
}

/* Tiêu đề chính */
h1 {
    font-size: 2.2rem;
    color: #ff69b4; /* Màu hồng đậm (Hot Pink) */
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* === Nút Trợ giúp === */
#help-button {
    position: absolute;
    top: 25px;
    right: 25px;
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
    font-weight: bold;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

/* === Modal Chung === */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 30px;
    border: 3px solid #ffc0cb;
    border-radius: 20px;
    width: 80%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    animation: fadeIn 0.4s;
}

.modal-content h2 {
    color: #ff69b4;
    text-align: center;
    margin-top: 0;
}

.modal-content ul {
    list-style-type: none;
    padding: 0;
}
.modal-content li {
    margin-bottom: 15px;
}
.modal-content li p {
    margin: 5px 0 0 15px;
    font-size: 0.95rem;
}


.close-button {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: black;
}

@keyframes fadeIn {
    from {opacity: 0; transform: scale(0.9);}
    to {opacity: 1; transform: scale(1);}
}

/* === Kiểu riêng cho Modal Cảnh báo === */
.alert-style {
    border-color: #f44336; /* Màu đỏ cảnh báo */
    max-width: 450px;
}
.alert-style h2 {
    color: #f44336;
}
.alert-style p {
    font-size: 1.1rem;
    text-align: center;
}


/* === Khu vực tiến trình === */
#progress-section {
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
    padding: 20px;
    margin-bottom: 25px;
    border: 2px dashed #ffc0cb;
    text-align: center;
}

#progress-title {
    font-size: 1.6rem;
    font-weight: bold;
    color: #8e44ad; /* Màu tím */
    margin-bottom: 15px;
}

#progress-counter {
    font-size: 1.2rem;
    font-weight: bold;
    color: #da70d6; /* Orchid */
    margin-top: 15px;
}

/* Khung chứa nội dung hiển thị */
#display-container {
    background-color: #ffffff;
    border-radius: 20px; /* Bo tròn nhiều hơn */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    padding: 25px;
    margin-bottom: 20px;
    border: 2px dashed #ffc0cb; /* Viền hồng chấm (Pink) */
    word-wrap: break-word; /* THÊM: Đảm bảo văn bản xuống dòng */
}

/* Khung chứa tiêu đề */
#title-container {
    font-size: 1.8rem;
    font-weight: bold;
    color: #da70d6; /* Màu tím (Orchid) */
    text-align: center;
    margin-bottom: 20px;
}

/* Ngân hàng từ (cột bên trái) */
#word-bank {
    display: none; /* Mặc định ẩn */
}

/* Chỉ hiển thị ngân hàng từ khi ở chế độ game */
body.game-view #word-bank {
    display: flex;
    flex: 0 0 300px;
    height: 100vh;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 20px;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    border-right: 3px solid #ffb6c1;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    box-sizing: border-box;
}


/* Từ trong ngân hàng từ */
.word {
    padding: 12px 20px;
    background: linear-gradient(145deg, #ffb6c1, #ff9aab); /* Gradient hồng (Light Pink) */
    color: #ffffff;
    border-radius: 25px; /* Bo tròn hình viên thuốc */
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    box-shadow: 0 4px 8px rgba(255, 105, 180, 0.3);
}

.word:hover {
    background: linear-gradient(145deg, #ff9aab, #ffb6c1);
    transform: scale(1.1) rotate(2deg); /* Hiệu ứng nảy lên và xoay nhẹ */
    box-shadow: 0 6px 12px rgba(255, 105, 180, 0.4);
}

/* Chỗ trống cần điền từ */
.drop-zone {
    padding: 12px;
    background-color: #fce4ec; /* Màu hồng rất nhạt */
    border: 2px dashed #ff85a2;
    border-radius: 15px;
    min-width: 120px;
    display: inline-block;
    text-align: center;
    color: #ff69b4;
    font-weight: bold;
    margin: 10px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-zone:hover {
    background-color: #f8bbd0;
    border-color: #ff69b4;
    transform: scale(1.05);
}


/* Các nút kiểm tra và chuyển bài */
button {
    background: linear-gradient(45deg, #87ceeb, #9370db); /* Gradient Xanh da trời đến Tím */
    color: #ffffff;
    padding: 15px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 30px; /* Bo tròn hình viên thuốc */
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    margin: 10px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 0 5px 10px rgba(147, 112, 219, 0.4);
}

button:hover {
    transform: translateY(-4px) scale(1.05); /* Hiệu ứng nổi lên */
    box-shadow: 0 8px 15px rgba(147, 112, 219, 0.5);
}

button:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 3px 6px rgba(147, 112, 219, 0.4);
}


/* === Kết quả kiểm tra === */
#result {
    margin-top: 20px;
    text-align: center;
    background-color: #ffffff;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border: 2px dashed #9370db; /* Viền tím */
    
    /* Animation */
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
    /* Ẩn ban đầu */
    height: 0;
    overflow: hidden;
    padding: 0;
}

#result.show {
    opacity: 1;
    transform: scale(1);
    height: auto; /* Chiều cao tự động khi hiển thị */
    padding: 25px; /* Thêm lại padding */
}

#result h2 {
    font-size: 2rem;
    color: #8e44ad;
    margin: 0 0 10px 0;
}

#result p {
    font-size: 1.2rem;
    color: #5d5d5d;
    margin: 0;
}


/* Bảng thống kê học tập */
#stats-container {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    border: 2px solid #e1bee7; /* Viền màu tím nhạt */
}

#stats-container table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

#stats-container th, #stats-container td {
    padding: 12px;
    border: 1px solid #f3e5f5;
    text-align: center;
}

#stats-container th {
    background-color: #f3e5f5; /* Tím oải hương rất nhạt */
    font-weight: bold;
    color: #8e44ad;
}

#stats-container td {
    color: #555;
}

#stats-container p {
    font-size: 1.1rem;
    color: #da70d6;
    font-weight: bold;
    text-align: center;
    margin-top: 10px;
}

/* === CẬP NHẬT: Chỉnh màu trạng thái đúng/sai === */
.correct {
    background-color: #e8f5e9; /* Xanh lá cây nhạt */
    color: #2e7d32;
    border: 2px solid #a5d6a7;
}

.incorrect {
    background-color: #ffcdd2; /* Đỏ nhạt */
    border: 2px solid #ef9a9a;
    padding: 10px;
    text-align: left; /* Căn lề trái để dễ đọc */
}

/* Câu trả lời sai của người dùng */
.user-answer-incorrect {
    display: block;
    text-decoration: line-through;
    color: #c62828;
    margin-bottom: 8px; /* Khoảng cách giữa câu sai và câu đúng */
}

/* Câu trả lời đúng được hiển thị */
.correct-answer-shown {
    display: block;
    color: #2e7d32;
    font-weight: bold;
}

/* Thêm dấu tích trước câu đúng */
.correct-answer-shown::before {
    content: '✔ ';
    margin-right: 5px;
}


/* Danh sách file */
#file-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#file-list li {
    padding: 15px 20px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fafafa, #f1f1f1);
    color: #2c3e50;
    border-radius: 15px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
    border-left: 5px solid #ffc0cb; /* Dải màu hồng bên trái */
}

#file-list li:hover {
    background-color: #ffffff;
    transform: translateX(5px);
    border-left: 5px solid #ff69b4;
}

#file-list a {
    text-decoration: none;
    color: inherit;
}

/* Thanh tiến trình */
.progress-bar-container {
  width: 100%;
  background-color: #fce4ec;
  border: 1px solid #f8bbd0;
  border-radius: 30px;
  overflow: hidden;
  height: 25px;
  margin-top: 10px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(45deg, #ffb6c1, #ff69b4);
  transition: width 0.4s ease-in-out;
  text-align: center;
  line-height: 25px;
  color: white;
  font-weight: bold;
}