/* =====================================================================
   truonghoc.info.vn — Giao diện
   Tông xanh dương và cam đất, gợi bảng tin trường học.
   Mọi tên lớp có hậu tố -th hoặc tiền tố riêng để không trùng với các
   site khác trong hệ thống. Xem Plan.md §11.
   ===================================================================== */

:root {
  --xanh: #1d5fa8;
  --xanh-dam: #164a84;
  --xanh-mo: #eaf2fb;
  --xanh-vien: #b9d2ec;
  --cam: #d98324;
  --cam-mo: #fdf2e3;
  --luc: #2e7d52;
  --do-nhe: #c0392b;

  --nen-th: #f7f9fc;
  --trang-th: #ffffff;
  --ngam-th: #eef2f8;
  --vien-th: #dde5ef;
  --vien-dam-th: #c3d0e0;

  --chu-th: #1b2733;
  --chu-vua-th: #4a5868;
  --chu-nhat-th: #78869a;

  --de-th: "Be Vietnam Pro", system-ui, sans-serif;
  --than-th: "Be Vietnam Pro", system-ui, sans-serif;
  --so-th: "JetBrains Mono", ui-monospace, monospace;

  --g1: 4px; --g2: 8px; --g3: 12px; --g4: 16px;
  --g5: 20px; --g6: 32px; --g7: 48px; --g8: 64px;

  --vat1: 8px; --vat2: 14px; --vat3: 20px;
  --nen-bong: 0 1px 3px rgba(27, 39, 51, .07);
  --nen-bong-day: 0 8px 28px rgba(27, 39, 51, .13);
  --nhanh-th: 140ms ease;
  --vua-th: 240ms ease;
  --cao-dau-th: 66px;
  --rong-th: 1200px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--than-th);
  font-size: 16px;
  line-height: 1.65;
  color: var(--chu-th);
  background: var(--nen-th);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--de-th);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 var(--g3);
  color: var(--chu-th);
}
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.75rem); }
h3 { font-size: 1.08rem; }
p { margin: 0 0 var(--g3); }

a { color: var(--xanh); text-decoration: none; transition: color var(--nhanh-th); }
a:hover { color: var(--xanh-dam); text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* Kích thước MẶC ĐỊNH cho mọi SVG nội tuyến.
   BẮT BUỘC giữ: thiếu rule này SVG giãn hết khung flex hoặc ô lưới. */
svg { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }

:focus-visible { outline: 2px solid var(--xanh); outline-offset: 2px; border-radius: 3px; }

.an-nghe-th {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.an-nghe-th:focus {
  position: fixed; top: var(--g3); left: var(--g3);
  width: auto; height: auto; clip: auto;
  padding: var(--g3) var(--g4); margin: 0;
  background: var(--xanh); color: #fff; border-radius: var(--vat1); z-index: 200;
}

.vung-th { max-width: var(--rong-th); margin: 0 auto; padding: 0 var(--g5); }

/* --- 2. Thanh điều hướng --------------------------------------------- */

.mai-th {
  position: sticky; top: 0; z-index: 100;
  background: rgba(247, 249, 252, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--vien-th);
}
.mai-trong-th {
  display: flex; align-items: center; gap: var(--g5);
  height: var(--cao-dau-th);
}

.hieu-th { display: flex; align-items: center; gap: var(--g2); flex-shrink: 0; }
/* display:block + px cố định, KHÔNG dựa vào flex-shrink: khi khối này nằm
   trong lưới grid (chân trang) thì SVG con sẽ phình hết chiều rộng cột. */
.hieu-bieu-th {
  display: block; width: 32px; height: 32px;
  color: var(--xanh); flex-shrink: 0;
}
.hieu-bieu-th svg { width: 32px; height: 32px; display: block; }
.hieu-chu-th {
  font-family: var(--de-th); font-size: 1.16rem; font-weight: 700;
  color: var(--chu-th); line-height: 1.1;
}
.hieu-phu-th { color: var(--xanh); }

/* PHẢI có display:flex. Thiếu dòng này thì form tìm kiếm và thẻ ul xuống
   dòng kiểu block, ô tìm kiếm đè lên logo. */
.lai-th {
  flex: 1; min-width: 0;
  display: flex; align-items: center; justify-content: flex-end;
  gap: var(--g3);
}
.lai-day-th {
  display: flex; align-items: center; gap: var(--g1);
  list-style: none; margin: 0; padding: 0; order: 1;
}
.lai-day-th a {
  display: block; padding: 8px var(--g3);
  font-size: .9rem; font-weight: 500;
  color: var(--chu-vua-th); border-radius: var(--vat1);
  white-space: nowrap; text-decoration: none;
  transition: background var(--nhanh-th), color var(--nhanh-th);
}
.lai-day-th a:hover { background: var(--ngam-th); color: var(--chu-th); text-decoration: none; }
.lai-day-th a.dang-o-th { background: var(--xanh-mo); color: var(--xanh-dam); font-weight: 600; }

.nut-lai-th {
  display: none; width: 40px; height: 40px; padding: 8px;
  background: none; border: 1px solid var(--vien-dam-th);
  border-radius: var(--vat1); color: var(--chu-th); cursor: pointer;
}
.nut-lai-th svg { width: 100%; height: 100%; }

/* --- 3. Menu con ------------------------------------------------------ */

.co-muc-th { position: relative; display: flex; align-items: center; }
.co-muc-th > a { padding-right: 4px; }

.muc-nut-th {
  display: grid; place-items: center;
  width: 22px; height: 22px; padding: 3px; margin-left: -2px;
  color: var(--chu-nhat-th); background: none; border: none;
  border-radius: 50%; cursor: pointer;
  transition: transform var(--nhanh-th), color var(--nhanh-th);
}
.muc-nut-th svg { width: 100%; height: 100%; }
.co-muc-th:hover .muc-nut-th, .co-muc-th.muc-mo-th .muc-nut-th { color: var(--xanh); }
.co-muc-th.muc-mo-th .muc-nut-th { transform: rotate(180deg); }

.muc-bang-th {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 96;
  min-width: 270px; padding: var(--g2);
  list-style: none; margin: 0;
  background: var(--trang-th);
  border: 1px solid var(--vien-th); border-radius: var(--vat2);
  box-shadow: var(--nen-bong-day);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity var(--nhanh-th), transform var(--nhanh-th), visibility var(--nhanh-th);
}
.co-muc-th.muc-mo-th > .muc-bang-th {
  opacity: 1; visibility: visible; transform: translateY(0);
}
/* Rê chuột chỉ ở thiết bị THẬT SỰ có con trỏ — máy tính bảng không có */
@media (hover: hover) and (pointer: fine) {
  .co-muc-th:hover > .muc-bang-th,
  .co-muc-th:focus-within > .muc-bang-th {
    opacity: 1; visibility: visible; transform: translateY(0);
  }
}
/* Vùng đệm nối mục cha với menu con */
.co-muc-th::after {
  content: ''; position: absolute; top: 100%; left: 0;
  width: 100%; height: 10px;
}
.muc-bang-th a {
  display: block; padding: 9px var(--g3);
  border-radius: var(--vat1);
  color: var(--chu-th); text-decoration: none; white-space: normal;
}
.muc-bang-th a:hover { background: var(--ngam-th); text-decoration: none; }
.muc-bang-th a.dang-o-th { background: var(--xanh-mo); }
.muc-ten-th { display: block; font-size: .9rem; font-weight: 600; }
.muc-chu-th {
  display: block; margin-top: 1px;
  font-size: .78rem; line-height: 1.35; color: var(--chu-nhat-th);
}

/* --- 4. Ô tìm kiếm ---------------------------------------------------- */

.soi-th {
  position: relative; flex-shrink: 0;
  display: flex; align-items: center; justify-content: flex-end;
  height: 40px; order: 2;
}
.soi-o-th {
  /* Thu về 0 chứ KHÔNG dùng display:none — cần giữ trong luồng bố cục */
  width: 0; min-width: 0; min-height: 40px;
  padding: 8px 40px 8px 0; border: 1px solid transparent;
  font-family: inherit; font-size: .9rem; color: var(--chu-th);
  background: var(--ngam-th);
  border-radius: 100px; opacity: 0; pointer-events: none;
  transition: width var(--vua-th), padding var(--vua-th),
              opacity var(--nhanh-th), background var(--nhanh-th), border-color var(--nhanh-th);
}
.soi-o-th::placeholder { color: var(--chu-nhat-th); }
.soi-th.soi-mo-th .soi-o-th {
  width: 240px; padding-left: var(--g3); opacity: 1; pointer-events: auto;
}
.soi-th.soi-mo-th .soi-o-th:focus {
  outline: none; background: var(--trang-th);
  border-color: var(--xanh-vien); box-shadow: 0 0 0 3px var(--xanh-mo);
}
.soi-nut-th {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center;
  width: 40px; height: 40px; padding: 10px;
  color: var(--chu-vua-th); background: none;
  border: 1px solid var(--vien-dam-th); border-radius: 50%; cursor: pointer;
  transition: color var(--nhanh-th), background var(--nhanh-th), border-color var(--nhanh-th);
}
.soi-nut-th:hover { color: var(--xanh); background: var(--xanh-mo); border-color: var(--xanh-vien); }
.soi-th.soi-mo-th .soi-nut-th { border-color: transparent; width: 36px; height: 36px; right: 2px; }
.soi-nut-th svg { width: 100%; height: 100%; }

.soi-goi-th {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 95;
  width: 320px; max-height: 340px; overflow-y: auto;
  background: var(--trang-th);
  border: 1px solid var(--vien-th); border-radius: var(--vat2);
  box-shadow: var(--nen-bong-day); display: none;
}
.soi-goi-th.goi-ra-th { display: block; }
.soi-goi-th a {
  display: block; padding: var(--g3) var(--g4);
  font-size: .9rem; color: var(--chu-th); text-decoration: none;
  border-bottom: 1px solid var(--vien-th);
}
.soi-goi-th a:last-child { border-bottom: none; }
.soi-goi-th a:hover, .soi-goi-th a.goi-sang-th {
  background: var(--xanh-mo); color: var(--xanh-dam); text-decoration: none;
}
.goi-nho-th { display: block; font-size: .78rem; color: var(--chu-nhat-th); }
.goi-rong-th {
  padding: var(--g4); font-size: .88rem; color: var(--chu-nhat-th); text-align: center;
}

/* --- 5. Bố cục chung -------------------------------------------------- */

.tang-th { padding: var(--g7) 0; }
.tang-sang-th { background: var(--trang-th); }
.dinh-tang-th {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--g4); margin-bottom: var(--g5);
}
.dinh-tang-th p { color: var(--chu-vua-th); margin: 0; }

.hai-ben-th {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--g7);
  align-items: start;
}
.canh-th { position: sticky; top: calc(var(--cao-dau-th) + var(--g4)); }

.nhan-nho-th {
  display: inline-block; padding: 5px var(--g3);
  font-size: .76rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--xanh-dam); background: var(--xanh-mo);
  border: 1px solid var(--xanh-vien); border-radius: 100px;
  margin-bottom: var(--g3);
}

.bia-th {
  padding: var(--g7) 0 var(--g6);
  background: linear-gradient(165deg, var(--xanh-mo), var(--nen-th) 65%);
  border-bottom: 1px solid var(--vien-th);
}

/* --- 6. Nút và biểu mẫu ----------------------------------------------- */

.bam-th {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--g2);
  min-height: 44px; padding: 10px 22px;
  font-family: inherit; font-size: .94rem; font-weight: 600;
  border: 1px solid transparent; border-radius: 100px;
  cursor: pointer; text-decoration: none;
  transition: background var(--nhanh-th), color var(--nhanh-th), border-color var(--nhanh-th);
}
.bam-chinh-th { background: var(--xanh); color: #fff; }
.bam-chinh-th:hover { background: var(--xanh-dam); color: #fff; text-decoration: none; }
.bam-vien-th { background: var(--trang-th); color: var(--chu-th); border-color: var(--vien-dam-th); }
.bam-vien-th:hover { border-color: var(--xanh-vien); color: var(--xanh); text-decoration: none; }

.phieu-th {
  display: grid; gap: var(--g4);
  padding: var(--g5); background: var(--trang-th);
  border: 1px solid var(--vien-th); border-radius: var(--vat2);
}
.hang-ba-th { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--g3); }
.hang-hai-th { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--g3); }
.hang-bon-th { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--g3); }
.o-nhap-th label {
  display: block; margin-bottom: 5px;
  font-size: .82rem; font-weight: 600; color: var(--chu-vua-th);
}
.o-nhap-th input, .o-nhap-th select {
  width: 100%; min-height: 44px; padding: 10px var(--g3);
  font-family: inherit; font-size: .95rem; color: var(--chu-th);
  background: var(--nen-th); border: 1px solid var(--vien-dam-th);
  border-radius: var(--vat1);
}
.o-nhap-th input:focus, .o-nhap-th select:focus {
  outline: none; border-color: var(--xanh-vien); box-shadow: 0 0 0 3px var(--xanh-mo);
}
.chu-nhap-th { font-size: .82rem; color: var(--chu-nhat-th); margin: 0; }

/* --- 7. Khối kết quả -------------------------------------------------- */

.ketqua-th {
  margin-top: var(--g5); padding: var(--g5);
  background: var(--xanh-mo); border: 1px solid var(--xanh-vien);
  border-radius: var(--vat2);
}
.ketqua-to-th {
  font-family: var(--de-th); font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 700; color: var(--xanh-dam); margin: 0 0 var(--g2);
  line-height: 1.1;
}
.ketqua-nho-th { font-size: .92rem; color: var(--chu-vua-th); margin: 0; }
.ketqua-loi-th {
  padding: var(--g4); background: #fdecea;
  border: 1px solid #f0bcb5; border-radius: var(--vat1);
  color: #9a2a1e; font-size: .9rem;
}
.ketqua-dat-th { color: var(--luc); font-weight: 700; }
.ketqua-chua-th { color: var(--do-nhe); font-weight: 700; }

/* Bảng chi tiết cách tính — giúp người dùng hiểu kết quả từ đâu ra */
.buoc-th { list-style: none; margin: var(--g4) 0 0; padding: 0; display: grid; gap: var(--g2); }
.buoc-o-th {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--g3); padding: var(--g3);
  background: var(--trang-th); border: 1px solid var(--vien-th);
  border-radius: var(--vat1); font-size: .9rem;
}
.buoc-o-th span { color: var(--chu-vua-th); }
.buoc-o-th b { font-family: var(--so-th); color: var(--chu-th); white-space: nowrap; }
.buoc-nhan-th { color: var(--cam) !important; font-weight: 600; }

/* --- 8. Bảng ---------------------------------------------------------- */

.bang-th { width: 100%; border-collapse: collapse; background: var(--trang-th); font-size: .92rem; }
.bang-th th, .bang-th td { padding: var(--g3); text-align: left; border-bottom: 1px solid var(--vien-th); }
.bang-th th {
  font-size: .78rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--chu-nhat-th); background: var(--ngam-th);
}
.bang-th td b { color: var(--xanh-dam); font-family: var(--so-th); }
/* Bảng rộng PHẢI cuộn trong khung riêng, thân trang không được cuộn ngang */
.bang-vo-th { overflow-x: auto; border: 1px solid var(--vien-th); border-radius: var(--vat2); }

/* --- 9. Thẻ ----------------------------------------------------------- */

.luoi-th {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--g4);
}
.the-th {
  display: block; padding: var(--g5);
  background: var(--trang-th);
  border: 1px solid var(--vien-th); border-radius: var(--vat2);
  color: var(--chu-th); text-decoration: none;
  transition: border-color var(--nhanh-th), box-shadow var(--nhanh-th), transform var(--nhanh-th);
}
.the-th:hover {
  border-color: var(--xanh-vien); box-shadow: var(--nen-bong-day);
  transform: translateY(-2px); text-decoration: none;
}
.the-th h3 { margin: var(--g2) 0 4px; }
.the-th p { font-size: .88rem; color: var(--chu-vua-th); margin: 0; }
.the-nhan-th {
  display: inline-block; padding: 3px 9px;
  font-size: .7rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; border-radius: 100px;
  color: var(--xanh-dam); background: var(--xanh-mo);
}
.the-cam-th { color: #8a5210; background: var(--cam-mo); }

.bieu-vuong-th {
  display: grid; place-items: center;
  width: 42px; height: 42px; margin-bottom: var(--g3);
  color: var(--xanh); background: var(--xanh-mo); border-radius: var(--vat1);
}
.bieu-vuong-th svg { width: 22px; height: 22px; }

/* --- 10. Thẻ trường --------------------------------------------------- */

.truong-the-th {
  display: block; padding: var(--g4) var(--g5);
  background: var(--trang-th);
  border: 1px solid var(--vien-th); border-radius: var(--vat2);
  color: var(--chu-th); text-decoration: none;
  transition: border-color var(--nhanh-th), box-shadow var(--nhanh-th);
}
.truong-the-th:hover {
  border-color: var(--xanh-vien); box-shadow: var(--nen-bong); text-decoration: none;
}
.truong-dinh-th {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--g3); margin-bottom: var(--g2);
}
.truong-ten-th { font-family: var(--de-th); font-weight: 700; font-size: 1rem; }
.truong-dia-th { font-size: .85rem; color: var(--chu-nhat-th); margin: 0 0 var(--g2); }
.truong-so-th {
  display: flex; flex-wrap: wrap; gap: var(--g3);
  font-size: .82rem; color: var(--chu-vua-th);
}
.truong-so-th span { display: inline-flex; align-items: center; gap: 5px; }
.truong-so-th b { font-family: var(--so-th); color: var(--xanh-dam); }

/* Nhãn cấp học, mỗi cấp một màu để phân biệt nhanh */
.cap-nhan-th {
  display: inline-block; padding: 2px 8px; flex-shrink: 0;
  font-size: .7rem; font-weight: 600; border-radius: 100px;
  background: var(--ngam-th); color: var(--chu-vua-th);
}
.cap-dai-hoc-th { background: var(--xanh-mo); color: var(--xanh-dam); }
.cap-thpt-th { background: var(--cam-mo); color: #8a5210; }
.cap-cao-dang-th { background: #e8f3ec; color: var(--luc); }

/* Nhãn cho biết bản ghi đã kiểm chứng hay chưa — BẮT BUỘC hiển thị */
.kiem-nhan-th {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .74rem; color: var(--chu-nhat-th);
}
.kiem-roi-th { color: var(--luc); }

/* --- 11. Lưu ý nguồn -------------------------------------------------- */

/* BẮT BUỘC hiện ở mọi trang có số liệu trường. Xem Plan.md §3.2. */
.nguon-khoi-th {
  display: flex; gap: var(--g3); align-items: flex-start;
  padding: var(--g4); margin-top: var(--g5);
  background: var(--cam-mo);
  border: 1px solid #f0d6ad;
  border-left: 3px solid var(--cam);
  border-radius: var(--vat1);
}
.nguon-khoi-th p { margin: 0; font-size: .85rem; line-height: 1.55; color: #7a4c10; }
.nguon-bieu-th { color: var(--cam); flex-shrink: 0; margin-top: 2px; }

/* Dòng nguồn nhỏ dưới mỗi số liệu */
.nguon-dong-th {
  font-size: .76rem; color: var(--chu-nhat-th);
  margin: var(--g2) 0 0; font-style: italic;
}

/* --- 12. Hỏi đáp ------------------------------------------------------ */

.hoi-day-th { display: grid; gap: var(--g2); }
.hoi-o-th { background: var(--trang-th); border: 1px solid var(--vien-th); border-radius: var(--vat1); }
.hoi-o-th summary {
  padding: var(--g3) var(--g4); cursor: pointer;
  font-weight: 600; font-size: .95rem; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: var(--g3);
}
.hoi-o-th summary::-webkit-details-marker { display: none; }
.hoi-o-th summary::after { content: '+'; font-size: 1.2rem; color: var(--xanh); flex-shrink: 0; }
.hoi-o-th[open] summary::after { content: '−'; }
.hoi-noi-th { padding: 0 var(--g4) var(--g4); }
.hoi-noi-th p { margin: 0; font-size: .92rem; color: var(--chu-vua-th); }

/* --- 13. Bài viết ----------------------------------------------------- */

.bai-than-th { font-size: 1.04rem; line-height: 1.78; }
.bai-than-th h2 { margin: var(--g6) 0 var(--g3); }
.bai-than-th p { margin-bottom: var(--g4); }
.bai-than-th a { text-decoration: underline; }
.bai-dau-th {
  display: flex; flex-wrap: wrap; gap: var(--g4);
  padding-bottom: var(--g4); margin-bottom: var(--g5);
  border-bottom: 1px solid var(--vien-th);
  font-size: .85rem; color: var(--chu-nhat-th);
}
.bai-dau-th span { display: inline-flex; align-items: center; gap: 6px; }

/* --- 14. Đường dẫn ---------------------------------------------------- */

.loi-di-th { padding: var(--g4) 0 0; font-size: .84rem; }
.loi-di-th ol {
  display: flex; flex-wrap: wrap; gap: var(--g2);
  list-style: none; margin: 0; padding: 0; color: var(--chu-nhat-th);
}
.loi-di-th li + li::before { content: '/'; margin-right: var(--g2); color: var(--vien-dam-th); }

/* --- 15. Khối trống và lỗi -------------------------------------------- */

.rong-th, .hong-th {
  padding: var(--g6) var(--g5); text-align: center;
  background: var(--trang-th);
  border: 1px dashed var(--vien-dam-th); border-radius: var(--vat2);
}
.hong-th { border-style: solid; border-color: #f0bcb5; background: #fdecea; }
.hong-th h3 { color: #9a2a1e; }
.hong-cach-th { font-size: .88rem; color: var(--chu-vua-th); margin: 0; }

/* --- 16. Chân trang --------------------------------------------------- */

.day-th {
  margin-top: var(--g8);
  background: #16324f; color: #c5d4e3;
  padding: var(--g7) 0 var(--g5);
}
.day-th h3 { color: #fff; font-size: .86rem; text-transform: uppercase; letter-spacing: .05em; }
.day-th a { color: #c5d4e3; font-size: .9rem; }
.day-th a:hover { color: #fff; }
.day-luoi-th { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: var(--g5); }
.day-dau-th {
  display: flex; align-items: center; gap: var(--g3);
  margin-bottom: var(--g4); text-decoration: none;
}
.day-dau-th:hover { text-decoration: none; }
/* Ép lại kích thước: trong lưới grid không có flex container để co lại */
.day-hieu-th .hieu-bieu-th { display: block; width: 38px; height: 38px; color: #fff; }
.day-hieu-th .hieu-bieu-th svg { width: 38px; height: 38px; }
.day-ten-th { display: block; line-height: 1.25; }
.day-ten-th b {
  display: block; font-family: var(--de-th);
  font-size: 1.1rem; font-weight: 700; color: #fff;
}
.day-ten-th em {
  display: block; font-style: normal; font-family: var(--so-th);
  font-size: .78rem; color: #8ca3bb; margin-top: 1px;
}
.day-dau-th:hover .day-ten-th em { color: #c5d4e3; }
.day-hieu-th p { font-size: .88rem; line-height: 1.6; color: #a8bccf; }
.day-thu-th { font-family: var(--so-th); font-size: .84rem !important; }
.day-cot-th ul { list-style: none; margin: 0; padding: 0; }
.day-cot-th li + li { margin-top: 6px; }
.day-duoi-th {
  display: flex; flex-wrap: wrap; gap: var(--g3);
  align-items: center; justify-content: space-between;
  margin-top: var(--g6); padding-top: var(--g4);
  border-top: 1px solid rgba(255, 255, 255, .13);
  font-size: .84rem; color: #8ca3bb;
}
.day-duoi-th p { margin: 0; }

/* --- 17. Đáp ứng ------------------------------------------------------ */

@media (max-width: 1040px) {
  .hai-ben-th { grid-template-columns: 1fr; }
  .canh-th { position: static; }
  .day-luoi-th { grid-template-columns: repeat(3, 1fr); }
  .day-hieu-th { grid-column: 1 / -1; }
  .hang-bon-th { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 880px) {
  .nut-lai-th { display: block; }
  .lai-th {
    position: fixed; inset: var(--cao-dau-th) 0 auto 0;
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    gap: 0;
    max-height: calc(100vh - var(--cao-dau-th)); overflow-y: auto;
    padding: var(--g3) var(--g4) var(--g5);
    background: var(--trang-th); border-bottom: 1px solid var(--vien-th);
    box-shadow: var(--nen-bong-day);
    transform: translateY(-100%); opacity: 0; pointer-events: none;
    transition: transform var(--vua-th), opacity var(--vua-th);
  }
  .lai-th.lai-ra-th { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .lai-day-th { flex-direction: column; gap: 2px; }
  .lai-day-th a { padding: 12px var(--g3); font-size: 1rem; }

  .co-muc-th { flex-wrap: wrap; }
  .co-muc-th > a { flex: 1; }
  .muc-nut-th { width: 40px; height: 40px; padding: 10px; margin-left: 0; }
  .co-muc-th::after { content: none; }
  .muc-bang-th {
    position: static; order: 3; width: 100%;
    min-width: 0; padding: 0 0 var(--g2) var(--g3);
    border: none; box-shadow: none; background: none;
    transform: none; transition: none;
    display: none; opacity: 1; visibility: visible;
  }
  .co-muc-th.muc-mo-th > .muc-bang-th { display: block; }
  .co-muc-th:hover > .muc-bang-th, .co-muc-th:focus-within > .muc-bang-th { display: none; }
  .co-muc-th.muc-mo-th:hover > .muc-bang-th,
  .co-muc-th.muc-mo-th:focus-within > .muc-bang-th { display: block; }

  .soi-th { width: 100%; margin-bottom: var(--g3); order: -1; height: auto; }
  .soi-o-th, .soi-th.soi-mo-th .soi-o-th {
    width: 100%; padding-left: var(--g3);
    opacity: 1; pointer-events: auto; border-color: var(--vien-th);
  }
  .soi-nut-th, .soi-th.soi-mo-th .soi-nut-th {
    width: 36px; height: 36px; right: 3px; border-color: transparent;
  }
  .soi-goi-th { width: 100%; }
}

@media (max-width: 620px) {
  body { font-size: 15px; }
  .vung-th { padding: 0 var(--g4); }
  .tang-th { padding: var(--g6) 0; }
  .dinh-tang-th { flex-direction: column; align-items: flex-start; gap: var(--g2); }
  /* Biểu mẫu nhập điểm xếp một cột cho dễ bấm trên điện thoại */
  .hang-ba-th, .hang-hai-th, .hang-bon-th { grid-template-columns: 1fr; }
  .day-luoi-th { grid-template-columns: repeat(2, 1fr); }

  /* Cỡ chữ tối thiểu 0.65rem (~10px) — xem Plan.md §10 */
  .truong-so-th { font-size: .78rem; }
  .cap-nhan-th { font-size: .68rem; }
  .kiem-nhan-th { font-size: .7rem; }
  .nguon-dong-th { font-size: .72rem; }
  .buoc-o-th { font-size: .85rem; }
  .ketqua-to-th { font-size: 1.9rem; }
  /* Hai môn một hàng ở màn hẹp vẫn dễ nhập hơn một cột dài */
  .hang-diem-th { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* --- 18. In ----------------------------------------------------------- */

@media print {
  .mai-th, .day-th, .canh-th, .soi-th, .phieu-th { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .hai-ben-th { grid-template-columns: 1fr; }
  .ketqua-th { break-inside: avoid; border-color: #999; }
  a { color: #000; text-decoration: none; }
  .nguon-khoi-th { border-color: #999; }
}

/* --- 19. Tôn trọng lựa chọn giảm chuyển động -------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
