:root {
    --chu-chinh: #4A3F35;    /* Nâu trầm dễ đọc */
    --thuy-chinh: #3A6D8C;   /* Xanh dương cổ phong */
    --thuy-nhat: rgba(58, 109, 140, 0.1); 
    --vien-co: #C8B6A6;      
    --dung: #2e7d32; 
    --sai: #c62828;  
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Lora', serif; 
    /* Dùng ảnh phong cảnh Nhật Bản làm nền chính toàn trang */
    background-image: url('image_5a219a.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--chu-chinh);
    display: flex;
    min-height: 100vh;
}

/* === THANH BÊN CỬA SỔ === */
.sidebar {
    width: 280px; 
    /* Dùng ảnh sách bên cửa sổ làm nền thanh bên */
    background-image: url('image_5a1e00.jpg');
    background-size: cover;
    background-position: bottom;
    /* Phủ một lớp sáng mờ để ảnh không lấn át chữ */
    box-shadow: inset 0 0 0 2000px rgba(253, 250, 246, 0.65);
    border-right: 2px solid var(--vien-co);
    position: fixed; height: 100vh; left: 0; top: 0; padding: 30px 0;
    z-index: 100;
}
.logo { text-align: center; padding: 0 20px 20px 20px; border-bottom: 1px dashed var(--vien-co); margin-bottom: 20px; }
.logo h2 { color: var(--thuy-chinh); font-size: 24px; font-weight: 600; }
.logo p { color: var(--chu-chinh); font-style: italic; font-size: 15px; margin-top: 5px; opacity: 0.8;}
.level-list { list-style: none; }
.level-list li { padding: 15px 30px; cursor: pointer; font-size: 17px; font-weight: 600; transition: 0.3s; border-left: 4px solid transparent; color: var(--chu-chinh); }
.level-list li:hover { background-color: rgba(255, 255, 255, 0.5); border-left: 4px solid var(--thuy-chinh); color: var(--thuy-chinh); }

/* === NỘI DUNG CHÍNH (Phủ nền kính mờ) === */
.main-content { margin-left: 280px; padding: 50px; width: calc(100% - 280px); position: relative; z-index: 10; }

.welcome-section, .quiz-container { 
    /* Lớp nền kính mờ (Glassmorphism) giúp nội dung nổi bật trên nền phong cảnh */
    background: rgba(255, 255, 255, 0.88); 
    backdrop-filter: blur(8px);
    border: 1px solid var(--vien-co); 
    border-radius: 12px; 
    padding: 40px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); 
}

.center-title { text-align: center; font-size: 36px; color: var(--chu-chinh); font-weight: 600; margin-bottom: 10px; }
.center-subtitle { text-align: center; font-size: 18px; color: var(--thuy-chinh); font-style: italic; margin-bottom: 30px; border-bottom: 1px dashed var(--vien-co); padding-bottom: 20px;}

/* Bảng chọn (Grid) */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; margin-top: 30px; }
.type-card { background: rgba(255, 255, 255, 0.6); border: 1px solid var(--thuy-chinh); color: var(--chu-chinh); padding: 20px; border-radius: 6px; text-align: center; font-size: 18px; font-weight: 600; cursor: pointer; transition: 0.3s; font-family: 'Lora', serif; }
.type-card:hover { background: var(--thuy-chinh); color: white; transform: translateY(-3px); box-shadow: 0 5px 15px rgba(58, 109, 140, 0.3); }

/* Khối câu hỏi */
.question-block { margin-bottom: 35px; padding-bottom: 25px; border-bottom: 1px dashed var(--vien-co); }
.chinese-text { font-family: 'Noto Serif SC', serif; font-size: 22px; color: #111; font-weight: 500; }
.words-container { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.word-chip { background: #FFF; border: 1px solid var(--thuy-chinh); color: var(--thuy-chinh); padding: 8px 16px; border-radius: 4px; font-family: 'Noto Serif SC', serif; font-size: 18px; }
.answer-input { width: 100%; padding: 15px; font-size: 18px; font-family: 'Noto Serif SC', serif; border: 1px solid var(--vien-co); border-radius: 4px; background-color: rgba(255, 255, 255, 0.8); outline: none; transition: 0.3s; color: var(--chu-chinh); }
.answer-input:focus { border-color: var(--thuy-chinh); background-color: #FFF; }
.btn-submit { background: var(--thuy-chinh); color: white; border: none; padding: 14px 35px; font-size: 18px; font-family: 'Lora', serif; cursor: pointer; border-radius: 6px; transition: 0.3s; font-weight: 600; }
.btn-submit:hover { background: #264e66; }

/* Trạng thái chấm điểm hiển thị trên Web */
.result-box { margin-top: 15px; padding: 12px; border-radius: 4px; font-weight: bold; display: none; }
.correct { color: var(--dung); background: rgba(46, 125, 50, 0.1); border: 1px solid var(--dung); display: block;}
.incorrect { color: var(--sai); background: rgba(198, 40, 40, 0.1); border: 1px solid var(--sai); display: block;}
/* Giao diện khối Đoạn văn đọc hiểu */
.passage-box {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--vien-co);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: inset 0 0 20px rgba(200, 182, 166, 0.2);
    border-left: 6px solid var(--thuy-chinh);
}

.passage-label {
    font-weight: 600;
    color: var(--thuy-chinh);
    margin-bottom: 15px;
    font-size: 18px;
    border-bottom: 1px dashed var(--vien-co);
    padding-bottom: 10px;
}

.passage-text {
    font-family: 'Noto Serif SC', serif;
    font-size: 20px;
    color: #222;
    line-height: 2; /* Khoảng cách dòng rộng để dễ đọc Hán tự */
    text-align: justify;
}

.mcq-option {
    padding: 10px 0;
    font-family: 'Noto Serif SC', serif;
    font-size: 18px;
    color: var(--chu-chinh);
    cursor: pointer;
}
/* Nút Loa âm thanh tự động */
.btn-audio {
    background: var(--thuy-chinh);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Lora', serif;
    box-shadow: 0 4px 10px rgba(58, 109, 140, 0.3);
    transition: 0.2s;
}
.btn-audio:hover { background: #2a526b; transform: scale(1.05); }

/* Giao diện Nhìn tranh đặt câu */
.question-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 2px solid var(--vien-co);
}

/* Giao diện Ghép Nối (Nối câu/Nối từ) */
.matching-container {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    margin-top: 20px;
}
.match-column { flex: 1; display: flex; flex-direction: column; gap: 15px; }
.match-item {
    padding: 15px;
    border: 2px solid var(--thuy-nhat);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Noto Serif SC', serif;
    font-size: 18px;
    text-align: center;
    transition: 0.3s;
}
.match-item:hover { border-color: var(--thuy-chinh); }
.match-item.selected { background: var(--thuy-chinh); color: white; border-color: var(--thuy-chinh); }
.match-item.matched { background: #e8f5e9; color: var(--dung); border-color: #a5d6a7; cursor: not-allowed; opacity: 0.8;}
.match-select { width: 100%; padding: 10px; font-family: 'Noto Serif SC', serif; font-size:16px; border: 1px solid var(--vien-co); border-radius:4px; outline:none; margin-top: 10px;}
/* ==========================================
   GIAO DIỆN DÀNH RIÊNG CHO ĐIỆN THOẠI BẢNG / MOBILE 
============================================= */

/* Nút bấm Menu và Màng che (Chỉ hiện trên điện thoại) */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    background: var(--thuy-chinh);
    color: white;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    z-index: 1001; /* Luôn nổi lên trên cùng */
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    font-weight: 600;
    font-size: 16px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99; /* Nằm dưới sidebar nhưng trên nội dung */
}

/* ÁP DỤNG KHI MÀN HÌNH NHỎ HƠN 768px (Cỡ điện thoại/Ipad nhỏ) */
@media screen and (max-width: 768px) {
    /* Hiện nút Menu */
    .mobile-menu-btn {
        display: block;
    }

    /* Đẩy sidebar ra khỏi màn hình (giấu đi) */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 100;
        width: 260px; /* Nhỏ lại chút cho vừa điện thoại */
    }

    /* Class này được bật lên bằng JS khi bấm nút Menu */
    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Hiện màng đen khi sidebar được mở */
    .sidebar.active ~ .sidebar-overlay {
        display: block;
    }

    /* Giải phóng khu vực nội dung chính */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 75px 15px 20px 15px; /* Để padding-top 75px chừa chỗ cho nút Menu */
    }

    /* Thu nhỏ các thành phần cho vừa màn hình điện thoại */
    .welcome-section, .quiz-container {
        padding: 20px;
    }
    .center-title {
        font-size: 26px;
    }
    .center-subtitle {
        font-size: 14px;
    }
    .chinese-text {
        font-size: 18px;
    }
    .mcq-option {
        font-size: 16px;
    }
    .word-chip {
        font-size: 16px;
        padding: 6px 12px;
    }
    .answer-input {
        font-size: 16px;
        padding: 10px;
    }
    .type-grid {
        grid-template-columns: 1fr; /* Trải dài các nút bấm từ trên xuống dưới */
    }
    .matching-container {
        flex-direction: column; /* Dạng Nối thẻ trên đt sẽ xếp dọc */
        gap: 15px;
    }
}