/* =============================================================
   chuyende.css — bố cục 4 chuyên đề (22/11/2026)
   Màu riêng cho từng chuyên đề, dùng chung ở thanh thẻ và trang chủ:
   1 xanh dương · 2 tím · 3 xanh lá · 4 cam.
   ============================================================= */
:root { --cd1: #2563eb; --cd2: #7c3aed; --cd3: #15803d; --cd4: #ea580c;
        --cd1-nhat: #dbeafe; --cd2-nhat: #ede9fe; --cd3-nhat: #dcfce7; --cd4-nhat: #ffedd5; }

/* ---------------- thanh thẻ ---------------- */
.nav-nhom-cd { padding: 3px; gap: 4px; }
.nav-so { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
  font-size: .85rem; color: #fff; margin-right: 4px; flex: none; }
.nav-cd1 .nav-so { background: var(--cd1); } .nav-cd2 .nav-so { background: var(--cd2); }
.nav-cd3 .nav-so { background: var(--cd3); } .nav-cd4 .nav-so { background: var(--cd4); }
.nav-cd.is-active .nav-so { box-shadow: 0 0 0 2px #fff; }
.sub-nav-cd3 .sub-nav-btn.is-active { background: var(--cd3); }
.sub-nav-cd4 .sub-nav-btn.is-active { background: var(--cd4); }

/* ---------------- trang chủ: 4 thẻ chuyên đề ---------------- */
.nha-chao { grid-template-columns: 1fr auto; }
.nha-nghe { appearance: none; font: inherit; font-weight: 700; cursor: pointer; border: 2px solid var(--line); background: var(--paper);
  color: var(--green-900); border-radius: 999px; padding: 8px 16px; min-height: 46px; }
.nha-nghe:hover { background: var(--green-50); }
.nha-nghe-to { font-size: 1.05rem; }
.nha-luoi-cd { grid-template-columns: repeat(4, 1fr); }
.nha-cd { display: flex; flex-direction: column; background: var(--paper); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden;
  border-top: 8px solid var(--c); }
.nha-cd1 { --c: var(--cd1); --n: var(--cd1-nhat); } .nha-cd2 { --c: var(--cd2); --n: var(--cd2-nhat); }
.nha-cd3 { --c: var(--cd3); --n: var(--cd3-nhat); } .nha-cd4 { --c: var(--cd4); --n: var(--cd4-nhat); }
.nha-cd-vao { appearance: none; border: 0; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; padding: 0 0 12px; flex: 1; }
.nha-cd-vao:focus-visible { outline: 4px solid var(--focus); outline-offset: -4px; }
.nha-cd-hinh { display: flex; align-items: center; justify-content: center; height: 104px; font-size: 60px; background: var(--n); margin-bottom: 8px; }
.nha-cd-nhan { padding: 0 18px; font-size: .85rem; font-weight: 800; color: var(--c); display: flex; align-items: center; gap: 6px; }
.nha-cd-nhan b { width: 26px; height: 26px; border-radius: 50%; background: var(--c); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.nha-cd-ten { padding: 0 18px; font-weight: 800; font-size: 1.25rem; color: var(--green-950); }
.nha-cd-phu { padding: 0 18px; font-size: .9rem; color: var(--ink-soft); }
.nha-cd-cau { padding: 0 18px; font-size: 1rem; }
.nha-cd-nut { margin: 8px 18px 0; align-self: flex-start; background: var(--c); color: #fff; font-weight: 800; border-radius: 999px; padding: 9px 18px; }
.nha-cd-vao:hover .nha-cd-nut { filter: brightness(1.1); }
.nha-cd > .nha-nghe { margin: 0 18px 16px; align-self: flex-start; }
.nha-gv-bang { margin-top: 16px; }
.nha-gv-bang td:first-child b { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; background: var(--green-800); color: #fff;
  align-items: center; justify-content: center; margin-right: 6px; font-size: .85rem; }
@media (max-width: 1000px) { .nha-luoi-cd { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
  .nha-luoi-cd { grid-template-columns: 1fr; }
  .nha-chao { grid-template-columns: 1fr; }
  .nha-cd-hinh { height: 72px; font-size: 44px; }
}

/* ---------------- chuyên đề 1: kỹ năng an toàn ---------------- */
.at-luoi { display: grid; grid-template-columns: 290px 1fr; gap: 18px; align-items: start; }
.at-ben { display: grid; gap: 14px; }
.at-ds-bai { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.at-bai { appearance: none; width: 100%; font: inherit; text-align: left; cursor: pointer; display: flex; gap: 10px; align-items: center;
  border: 2px solid var(--line); background: var(--paper); border-radius: 12px; padding: 10px 12px; min-height: 52px; font-weight: 700; color: var(--green-950); }
.at-bai b { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--cd1-nhat); color: var(--cd1); display: flex; align-items: center; justify-content: center; }
.at-bai:hover { background: #f5f8ff; }
.at-bai.is-active { border-color: var(--cd1); background: var(--cd1-nhat); }
.at-bai.is-active b { background: var(--cd1); color: #fff; }
.at-nut-to { width: 100%; min-height: 50px; }
.at-nut-to.dang-bat { background: var(--cd1); color: #fff; }
.at-gv .row { gap: 8px; margin: 8px 0; }
.at-hang { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; font-size: .95rem; }
.at-hang input { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.at-trang { border-top: 8px solid var(--cd1); padding: 20px 24px; min-height: 520px; display: flex; flex-direction: column; }
.at-dau { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.at-ten-bai { font-weight: 800; color: var(--cd1); font-size: 1rem; }
.at-thoat-chieu { display: none; }
.at-nd { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 16px 0; }
.at-nd.la-trang { display: grid; grid-template-columns: minmax(180px, 38%) 1fr; gap: 28px; align-items: center; }
.at-tranh { font-size: clamp(64px, 10vw, 120px); line-height: 1.15; text-align: center; background: var(--cd1-nhat); border-radius: 20px;
  padding: 30px 10px; letter-spacing: 6px; word-break: break-all; }
/* ảnh cắt từ sách năng lực số (bài Đồ điện an toàn) */
.at-anh-sach { margin: 0; background: var(--paper); border: 3px solid var(--line); border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; }
.at-anh-sach img { display: block; width: 100%; max-height: 360px; object-fit: contain; background: #fff; }
.at-nguon { margin: 0; padding: 6px 10px; font-size: .78rem; color: var(--ink-soft); text-align: center; line-height: 1.35; }
.at-in-tranh img { width: 100px; max-height: 100px; object-fit: contain; }
.at-in-nguon { font-size: 8pt; color: #666; margin: 4px 0 0 !important; }
.at-chu h2 { font-size: 1.8rem; color: var(--green-950); margin-bottom: 12px; }
.at-chu p { font-size: 1.3rem; margin: 0 0 10px; }
.at-nghe { margin-top: 10px; }
.at-duoi { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.at-duoi .btn { min-width: 130px; min-height: 50px; }
.at-so { font-weight: 700; color: var(--ink-soft); }
.at-cham { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.at-cham button { appearance: none; font: inherit; font-weight: 700; width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--line); background: var(--paper); color: var(--ink-soft); }
.at-cham button.is-active { background: var(--cd1); border-color: var(--cd1); color: #fff; }
.at-cham .at-cham-hoi { border-color: var(--cd2); color: var(--cd2); }
.at-cham .at-cham-hoi.is-active { background: var(--cd2); color: #fff; }
.at-hoi-dau { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 8px; }
.at-nhan-hoi { background: var(--cd2-nhat); color: var(--cd2); font-weight: 800; padding: 6px 14px; border-radius: 999px; }
.at-dap-an { background: var(--amber-100); color: var(--amber-900); font-weight: 800; padding: 6px 14px; border-radius: 999px; }
.at-hoi { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.at-hoi-tranh { font-size: 56px; }
.at-hoi h2 { flex: 1 1 320px; font-size: 1.55rem; color: var(--green-950); margin: 0; }
.at-chon { display: grid; gap: 10px; }
.at-chon-nut { appearance: none; font: inherit; font-size: 1.2rem; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 14px;
  border: 3px solid var(--line); background: var(--paper); border-radius: 16px; padding: 12px 16px; min-height: 64px; color: var(--ink); }
.at-chon-nut b { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--green-50); display: flex; align-items: center; justify-content: center; }
.at-chon-hinh { font-size: 34px; flex: none; }
.at-chon-nut:hover { border-color: var(--cd1); }
.at-chon-nut.dung { border-color: #15803d; background: #dcfce7; }
.at-chon-nut.dung b { background: #15803d; color: #fff; }
.at-chon-nut.chua-dung { border-color: #f59e0b; background: #fffbeb; }
.at-phan-hoi { min-height: 1.6em; font-size: 1.15rem; margin: 12px 0 0; padding: 0; }
.at-phan-hoi.tot { color: #166534; }
.at-phan-hoi.nhac { color: var(--amber-900); }
/* trình chiếu: chữ lớn cho cả lớp */
.at-trang.dang-chieu { position: fixed; inset: 0; z-index: 4000; border-radius: 0; margin: 0; overflow: auto; padding: 3vh 5vw; }
.at-trang.dang-chieu .at-thoat-chieu { display: inline-flex; }
.at-trang.dang-chieu .at-chu h2 { font-size: 2.8rem; }
.at-trang.dang-chieu .at-chu p { font-size: 2rem; }
.at-trang.dang-chieu .at-hoi h2 { font-size: 2.4rem; }
.at-trang.dang-chieu .at-chon-nut { font-size: 1.7rem; min-height: 84px; }
@media (max-width: 860px) {
  .at-luoi { grid-template-columns: 1fr; }
  .at-nd.la-trang { grid-template-columns: 1fr; gap: 14px; }
  .at-tranh { padding: 16px 8px; }
  .at-anh-sach img { max-height: 220px; }
  .at-chu h2 { font-size: 1.45rem; } .at-chu p { font-size: 1.15rem; }
  .at-duoi .btn { min-width: 0; flex: 1; }
}
/* nhắc nghỉ mắt (cả phần mềm) */
.at-nghi { position: fixed; inset: 0; z-index: 5000; background: rgba(7, 39, 28, .7); display: flex; align-items: center; justify-content: center; padding: 16px; }
.at-nghi[hidden] { display: none; }
.at-nghi-than { background: var(--paper); border-radius: 24px; padding: 28px; max-width: 520px; width: 100%; text-align: center; box-shadow: var(--shadow-lg);
  border-top: 10px solid var(--cd1); }
.at-nghi-hinh { font-size: 64px; letter-spacing: 8px; }
.at-nghi-cau { font-size: 1.35rem; font-weight: 600; margin: 10px 0; }
.at-nghi-dem { font-size: 4rem; font-weight: 800; color: var(--cd1); line-height: 1.1; margin: 8px 0 16px; }

/* in bài */
#at-ban-in, #ap-ban-in { display: none; }
@media print {
  body.at-dang-in > *:not(#at-ban-in), body.ap-dang-in > *:not(#ap-ban-in) { display: none !important; }
  body.at-dang-in #at-ban-in, body.ap-dang-in #ap-ban-in { display: block !important; }
  body.at-dang-in, body.ap-dang-in { background: #fff; }
  .at-in-bai { break-after: page; font-size: 13pt; }
  .at-in-bai h1 { font-size: 18pt; border-bottom: 3px solid #2563eb; padding-bottom: 6px; }
  .at-in-trang { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: center; border: 1px solid #ccd; border-radius: 10px;
    padding: 10px 14px; margin: 8px 0; break-inside: avoid; }
  .at-in-tranh { font-size: 40px; text-align: center; }
  .at-in-trang h2 { font-size: 14pt; margin: 0 0 4px; }
  .at-in-trang p { margin: 2px 0; }
  .at-in-h-hoi { font-size: 15pt; margin-top: 18px; }
  .at-in-hoi { break-inside: avoid; margin: 8px 0; }
  .at-in-hoi ul { list-style: none; padding-left: 18px; margin: 4px 0; }
  .at-in-giai { color: #444; font-style: italic; margin: 2px 0 0 18px; }
  #ap-ban-in img { width: 100%; max-height: 100vh; object-fit: contain; }
}

/* ---------------- chuyên đề 2: làm áp phích ---------------- */
.ap-h3 { font-size: 1.05rem; color: var(--green-950); margin: 10px 0 8px; }
.ap-mau { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.ap-mau-nut { appearance: none; font: inherit; cursor: pointer; border: 3px solid var(--line); background: var(--nen); border-radius: 16px; min-width: 0; padding: 10px; text-align: center;
  aspect-ratio: 3 / 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--green-950); }
.ap-mau-nut span { font-size: 54px; }
.ap-mau-nut b { font-size: 1.1rem; }
.ap-mau-nut:hover { border-color: var(--cd2); }
.ap-ds { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.ap-ds-the { display: flex; gap: 6px; align-items: stretch; }
.ap-ds-mo { appearance: none; font: inherit; cursor: pointer; flex: 1; text-align: left; border: 2px solid var(--line); border-left: 10px solid var(--cd2);
  background: var(--paper); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.ap-ds-mo small { color: var(--ink-soft); }
.ap-thanh { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; background: var(--paper); border-radius: var(--radius-sm); padding: 10px;
  box-shadow: var(--shadow-sm); border-top: 6px solid var(--cd2); }
.ap-thanh input { flex: 1 1 200px; min-height: 42px; font: inherit; padding: 6px 12px; border: 2px solid var(--line); border-radius: 10px; }
.ap-bao { margin: 10px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--green-50); font-weight: 600; }
.ap-bao.canh-bao { background: var(--amber-100); color: var(--amber-900); }
.ap-luoi { display: grid; grid-template-columns: 96px 1fr 300px; gap: 14px; margin-top: 14px; align-items: start; }
.ap-cong-cu { display: grid; gap: 8px; position: sticky; top: 90px; }
.ap-cong-cu button { appearance: none; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; border: 2px solid var(--line); background: var(--paper);
  border-radius: 14px; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--green-950); min-height: 72px; }
.ap-cong-cu button span { font-size: 26px; }
.ap-cong-cu button:hover { border-color: var(--cd2); background: var(--cd2-nhat); }
.ap-o { min-width: 0; display: flex; justify-content: center; }
.ap-to { position: relative; overflow: hidden; box-shadow: var(--shadow-lg); touch-action: none; user-select: none; -webkit-user-select: none; }
.ap-to.khung-don { outline: 8px solid #0f5132; outline-offset: -8px; }
.ap-to.khung-doi { outline: 4px solid #b42318; outline-offset: -8px; }
.ap-to.khung-hoavan { border: 10px solid transparent; border-image: repeating-linear-gradient(90deg, #c92a2a 0 12px, #f4b400 12px 24px, #0b3d2c 24px 36px) 10; }
.ap-el { position: absolute; cursor: grab; line-height: 1.25; white-space: pre-wrap; word-wrap: break-word;
  font-family: "Segoe UI", Roboto, Arial, "Noto Sans", sans-serif; }
.ap-el.dang-chon { outline: 2px dashed var(--cd2); outline-offset: 3px; cursor: text; }
.ap-chu[contenteditable] { user-select: text; -webkit-user-select: text; }
.ap-anh { background: #e8ece9; display: flex; align-items: center; justify-content: center; overflow: hidden; text-align: center; color: var(--ink-soft); font-size: 14px; }
.ap-anh img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ap-hinh { line-height: 1; }
.ap-keo { position: absolute; left: -14px; top: -14px; width: 28px; height: 28px; border-radius: 50%; background: var(--cd2); color: #fff;
  font-size: 16px; line-height: 28px; text-align: center; cursor: move; font-weight: 400; font-style: normal; }
.ap-gian { position: absolute; right: -10px; bottom: -10px; width: 22px; height: 22px; border-radius: 6px; background: var(--cd2); cursor: nwse-resize; }
.ap-ben { display: grid; gap: 14px; }
.ap-bang .row { gap: 6px; margin: 6px 0; }
.ap-nhan { font-weight: 700; margin-top: 8px; }
.ap-mau-hang { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.ap-o-mau { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; }
.ap-o-mau.is-active { outline: 3px solid var(--cd2); outline-offset: 2px; }
.ap-dan { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 8px; }
.ap-dan button { appearance: none; font-size: 28px; border: 2px solid var(--line); background: var(--paper); border-radius: 10px; cursor: pointer; padding: 4px 0; }
.ap-buoc { padding-left: 20px; margin: 0; } .ap-buoc li { margin: 4px 0; }
.ap-meo ul { padding-left: 20px; margin: 0; } .ap-meo li { margin: 4px 0; }
.ap-xoa-hang { margin-top: 12px !important; border-top: 1px solid var(--line); padding-top: 10px; }
.ap-kho-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; max-height: 50vh; overflow: auto; margin-bottom: 10px; }
.ap-kho-luoi button { appearance: none; padding: 0; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; aspect-ratio: 1; background: #eee; }
.ap-kho-luoi img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 1100px) { .ap-luoi { grid-template-columns: 84px 1fr; } .ap-ben { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) {
  .ap-mau { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ap-mau-nut b { font-size: .95rem; }
  .ap-luoi { grid-template-columns: 1fr; }
  .ap-cong-cu { position: static; grid-template-columns: repeat(5, 1fr); }
  .ap-cong-cu button { min-height: 60px; font-size: .78rem; }
  .ap-ben { grid-template-columns: 1fr; }
}
