/* "Góc của con" (goc.js) + hộp thầy ghi Góc (thay-goc.js). Dùng token của be.css; màu sao theo lý do lấy từ
   /lop/sao-mau.js (truyền qua --mau), màu nhóm huy hiệu từ bai-hoc.js. */

/* --- hai tab chính ------------------------------------------------------------------------------------------------ */
.tab-chinh { display: flex; gap: 10px; width: fit-content; max-width: 100%; margin: 4px 0 16px; }
.tab-chinh a {
  display: inline-flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 22px 4px 12px; border-radius: 18px;
  font: 900 1.12rem/1 var(--chu-to); color: var(--muc); text-decoration: none; white-space: nowrap; background: var(--the);
  box-shadow: inset 0 -5px 0 var(--vien), var(--bong); transition: transform .12s, box-shadow .12s, background-color .15s;
}
.tab-chinh a:hover { transform: translateY(-2px); }
.tab-chinh a:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 var(--vien); }
.tab-chinh a[aria-current="page"] { background: var(--nhan); color: var(--nhan-chu); box-shadow: inset 0 -5px 0 var(--nhan-dam), var(--bong); }
.tab-chinh img { width: 32px; height: 32px; filter: drop-shadow(0 2px 0 rgb(0 0 0 / .15)); }

/* --- bố cục ------------------------------------------------------------------------------------------------------- */
.o-trong { display: grid; justify-items: center; gap: 4px; text-align: center; }
.o-trong img { width: min(180px, 70%); height: auto; filter: invert(1); }   /* nét trắng trên khối màu */
.o-trong .trong { margin: 0; }
.goc-luoi { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, .9fr); gap: 16px; align-items: start; }
.goc-cot-trai, .goc-cot-phai { display: grid; gap: 16px; }
.man-goc .o-trang { padding: 18px; }
.man-goc .o-trang h2 { display: flex; align-items: center; gap: 8px; }
.man-goc .hai-cot { margin-top: 16px; }
.o-huy-hieu, .man-goc > .goc-noi-dung > .o-trang:last-child { margin-top: 16px; }
.dem { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px;
  background: var(--nhan); color: var(--nhan-chu); font: 800 .9rem/1 var(--chu); }
.phu-de { margin: -4px 0 8px; color: var(--mo); font-size: .9rem; }

/* --- thầy dặn ----------------------------------------------------------------------------------------------------- */
.ds-loi-dan { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ds-loi-dan li { padding: 12px 14px; border-radius: 16px 16px 16px 4px; background: var(--nen2); }
.ds-loi-dan li.moi { background: var(--nhan-nhat); }
.ds-loi-dan p { margin: 0; font-weight: 600; color: var(--muc); white-space: pre-line; overflow-wrap: anywhere; }
.ds-loi-dan small { display: block; margin-top: 4px; color: var(--mo); font-size: .8rem; }
.ds-loi-dan li:nth-child(n+4) { display: none; }

/* --- bài tập ------------------------------------------------------------------------------------------------------ */
.ds-bai-tap { list-style: none; margin: 0; padding: 0; }
.ds-bai-tap li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 2px; border-bottom: 1px dashed var(--vien); }
.ds-bai-tap li:last-child { border-bottom: 0; }
.bt-dau { flex: none; display: grid; place-items: center; width: 26px; height: 26px; margin-top: 1px; border: 2.5px solid var(--vien); border-radius: 8px; }
.bt-dau svg { width: 18px; height: 18px; fill: none; stroke: var(--nhan-chu); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ds-bai-tap li.xong .bt-dau { border-color: var(--tot); background: var(--tot); }
.bt-chu { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.bt-chu small { display: block; margin-top: 2px; font-weight: 600; font-size: .82rem; color: var(--mo); }
.ds-bai-tap li.xong .bt-chu { color: var(--mo); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.ds-bai-tap li.xong small { text-decoration: none; }

/* --- thẻ sao vẽ y như bản in (the-in.js) ----------------------------------------------------------------------------
   CSS chép từ cloudflare/public/lop/the-sao.html, đổi mm/pt thành bội số của --mm: thẻ in rộng 96 mm (A4 chia 4:
   (210 − 2·6 − 6) / 2), cao 139,5 mm; 1pt = 0,3528 mm. Khung .the-khung là container nên thẻ co giãn mà giữ tỉ lệ. */
@font-face { font-family: ChessGlyphs; src: url("/library/chess-glyphs.woff2") format("woff2"); unicode-range: U+2654-265F; }
.the-khung { container-type: inline-size; }
.the-khung .the {
  --mm: calc(100cqw / 96);
  position: relative; box-sizing: border-box; aspect-ratio: 96 / 139.5; display: flex; flex-direction: column; overflow: hidden;
  padding: calc(7 * var(--mm)) calc(6 * var(--mm)) calc(6 * var(--mm)); border: calc(.6 * var(--mm)) dashed #888;
  border-radius: calc(4 * var(--mm)); background: #fff; color: #000; font-family: "Be Vietnam Pro", Arial, sans-serif;
  font-weight: 400; line-height: normal; box-shadow: 0 3px 0 rgb(0 0 0 / .06), 0 10px 26px rgb(0 0 0 / .12);
}
.the-khung .the .nen { position: absolute; left: 5%; top: 16%; width: 90%; height: 80%; object-fit: contain; z-index: 0; pointer-events: none; }
.the-khung .the header, .the-khung .the .luoi, .the-khung .the .hh-hang { position: relative; z-index: 1; }
.the-khung .hh-hang { margin: calc(1.5 * var(--mm)) 0; }
.the-khung .hh-hang > span { display: block; font-size: calc(2.646 * var(--mm)); color: #333; margin-bottom: var(--mm); }
.the-khung .hh-o { display: grid; grid-template-columns: repeat(5, calc(15 * var(--mm))); justify-content: space-between; row-gap: calc(1.5 * var(--mm)); }
.the-khung .hh-o i { width: calc(15 * var(--mm)); height: calc(15 * var(--mm)); box-sizing: border-box; border: calc(.3 * var(--mm)) dashed #888;
  border-radius: calc(1.6 * var(--mm)); background: rgb(255 255 255 / .75); font-style: normal; }
.the-khung .hh-o i:has(.hh) { border: 0; background: none; }
.the-khung .the header { display: flex; justify-content: space-between; align-items: baseline; gap: calc(4 * var(--mm));
  border-bottom: calc(.4 * var(--mm)) solid #000; padding-bottom: calc(2 * var(--mm)); }
.the-khung .the header .ten { font-size: calc(6.703 * var(--mm)); font-weight: 700; }
.the-khung .the header .tu { font-size: calc(3.528 * var(--mm)); white-space: nowrap; }
.the-khung .luoi { display: grid; grid-template-columns: repeat(5, 1fr); gap: calc(.8 * var(--mm)) calc(3 * var(--mm));
  margin: calc(3 * var(--mm)) calc(5 * var(--mm)) auto; }
.the-khung .o { position: relative; display: flex; flex-direction: column; align-items: center; }
.the-khung .o svg { width: 62%; height: auto; display: block; }
.the-khung .o .ngay { width: 90%; height: calc(4 * var(--mm)); border-bottom: calc(.3 * var(--mm)) solid #555; text-align: center;
  font-size: calc(2.822 * var(--mm)); line-height: calc(5 * var(--mm)); margin-top: calc(.5 * var(--mm)); }
.the-khung .o .qua { position: absolute; right: calc(-2 * var(--mm)); top: calc(-2.5 * var(--mm)); width: calc(7.5 * var(--mm)); height: calc(7.5 * var(--mm)); }
.the-khung .the footer { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: var(--mm) calc(3 * var(--mm));
  font-size: calc(2.646 * var(--mm)); color: #222; border-top: calc(.2 * var(--mm)) solid #bbb; padding-top: calc(1.5 * var(--mm)); }
.the-khung .the footer span { display: inline-flex; align-items: center; gap: calc(.8 * var(--mm)); white-space: nowrap; }
.the-khung .the footer .cm { width: calc(3.6 * var(--mm)); height: calc(3.6 * var(--mm)); }

/* --- huy hiệu bài học như nhãn in (cloudflare/public/lop/huy-hieu.html, ô 15 mm) ----------------------------------- */
.hh { --mm: 5.6px; box-sizing: border-box; width: calc(15 * var(--mm)); height: calc(15 * var(--mm)); padding: calc(.9 * var(--mm));
  font-family: "Be Vietnam Pro", Arial, sans-serif; line-height: normal; }
.the-khung .hh { --mm: calc(100cqw / 96); }
.hh .vien { box-sizing: border-box; height: 100%; border: calc(.55 * var(--mm)) solid var(--m); border-radius: calc(1.6 * var(--mm));
  background: color-mix(in srgb, var(--m) 13%, white); display: flex; flex-direction: column; align-items: center;
  justify-content: space-between; padding: calc(.5 * var(--mm)) calc(.4 * var(--mm)) calc(.4 * var(--mm)); overflow: hidden; }
.hh .ma { font-size: calc(2.47 * var(--mm)); line-height: 1; color: var(--m); letter-spacing: .2px; }
.hh .quan { font-family: ChessGlyphs, "Segoe UI Symbol", sans-serif; font-size: calc(4.586 * var(--mm)); line-height: 1; color: var(--m); }
.hh .ten { font-size: calc(1.27 * var(--mm)); line-height: 1.12; text-align: center; color: #222; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; width: 100%; }
/* nhãn to trong ô "Bài con đã học": chữ tên bài phải đọc được trên màn hình (ở bản in chữ này chỉ 3,6pt) */
.ds-huy-hieu .hh .ten { font-size: 11px; -webkit-line-clamp: 3; }

/* --- thẻ đã đổi quà ----------------------------------------------------------------------------------------------- */
.ds-the-cu { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 16px; }
.ds-the-cu li { display: grid; gap: 8px; align-content: start; }
.ds-the-cu .the-khung { rotate: -1deg; }
.ds-the-cu li:nth-child(even) .the-khung { rotate: 1deg; }
.tc-chu { margin: 0; text-align: center; }
.tc-chu b { display: block; font: 800 1.05rem/1.2 var(--chu-to); } .tc-chu small { color: var(--mo); font-weight: 600; font-size: .82rem; }

/* --- kỳ lực, sách ------------------------------------------------------------------------------------------------- */
.o-ky-luc { text-align: center; }
.o-ky-luc h2 { justify-content: center; }
.o-the-sao { padding: 18px 18px 20px; }
.o-the-sao h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 1.3rem; }
.ts-con { margin: 14px 0 0; padding: 10px 14px; border-radius: 14px; background: var(--the); box-shadow: inset 0 -4px 0 var(--vien); font-weight: 800; color: var(--muc2); text-align: center; }
.ts-con b { color: var(--cta); }
.kl-so { margin: 2px 0 0; font: 900 3.4rem/1 var(--chu-to); font-variant-numeric: tabular-nums; color: var(--vang-nhan); text-shadow: 0 3px 0 var(--khoi-dam); }
.kl-hang { margin: 6px 0 2px; font-weight: 700; color: var(--muc2); }
.kl-dem { margin: 0 0 14px; font-size: .9rem; color: var(--mo); font-weight: 600; }
.kq-thang { color: var(--tot); } .kq-thua { color: var(--xau); }
.kl-nut { display: inline-flex; align-items: center; justify-content: center; width: 100%; text-decoration: none; }
.sach-dong { display: flex; gap: 14px; align-items: center; }
.sach-bia { flex: none; width: 72px; height: auto; border-radius: 6px; box-shadow: 0 3px 0 rgb(0 0 0 / .12), 0 6px 14px rgb(0 0 0 / .18); transform: rotate(-3deg); }
.sach-to { margin: 0; font: 900 1.7rem/1.1 var(--chu-to); color: var(--vang-nhan); }
.sach-trang { margin: 4px 0 0; font-weight: 600; color: var(--muc2); }
.sach-trang b { font: 800 1.15rem/1 var(--chu-to); color: var(--muc); }
.sach-phu { list-style: none; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px dashed var(--vien); display: grid; gap: 6px; font-size: .9rem; }
.sach-phu span { display: block; font-size: .78rem; color: var(--mo); font-weight: 700; }
.sach-phu b { font-family: var(--chu-to); }

/* --- huy hiệu bài đã học: nhãn in (the-in.js nhanHuyHieu), dưới là nhóm + ngày ------------------------------------- */
.ds-huy-hieu { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px 10px; }
.ds-huy-hieu li { display: grid; justify-items: center; gap: 4px; width: 90px; }
.ds-huy-hieu .hh { background: #fff; border-radius: 10px; }
.ds-huy-hieu small { font-size: .74rem; font-weight: 700; color: var(--mo); text-align: center; line-height: 1.2; }

/* --- lịch --------------------------------------------------------------------------------------------------------- */
.lich-tong { margin: 0 0 8px; color: var(--muc2); font-weight: 600; }
.lich-tong b { font: 800 1.2rem/1 var(--chu-to); color: var(--muc); }
.lich-dau { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.lich-dau b { font: 800 1.1rem/1 var(--chu-to); }
.lich-dau svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.lich-thu, .lich-luoi { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.lich-thu li { font-size: .75rem; font-weight: 800; color: var(--mo); padding: 4px 0; }
.lich-luoi li { height: clamp(38px, 10vw, 46px); display: grid; place-items: center; border-radius: 12px; font-weight: 700; font-size: .92rem;
  color: var(--muc2); font-variant-numeric: tabular-nums; }
.lich-luoi li.co_mat { background: #4cc46a; color: #fff; box-shadow: inset 0 -3px 0 #2f9a4b; }
.lich-luoi li.nghi { background: var(--nen2); color: var(--mo); text-decoration: line-through; }
.lich-luoi li.sap_toi { box-shadow: inset 0 0 0 2px var(--nhan); color: var(--nhan-dam); }
.lich-luoi li.hom-nay { outline: 3px solid var(--vang-nhan); outline-offset: 1px; }
.lich-chu-giai { list-style: none; margin: 10px 0 0; padding: 0; display: flex; gap: 14px; font-size: .82rem; color: var(--mo); font-weight: 600; }
.lich-chu-giai i { display: inline-block; width: 11px; height: 11px; margin-right: 5px; border-radius: 50%; vertical-align: -1px; }
.lich-chu-giai i.co_mat { background: #4cc46a; } .lich-chu-giai i.nghi { background: var(--vien); }
.lich-chu-giai i.sap_toi { background: transparent; box-shadow: inset 0 0 0 2px var(--nhan); }

/* --- danh sách ván (sổ biên bản, ván với bạn thú) ----------------------------------------------------------------- */
.ds-van { list-style: none; margin: 0; padding: 0; }
.ds-van li { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 4px 2px; border-bottom: 1px dashed var(--vien); }
.ds-van li:last-child { border-bottom: 0; }
.ds-van img { flex: none; }
.dv-ngay { flex: none; width: 46px; font: 800 .95rem/1 var(--chu-to); color: var(--mo); font-variant-numeric: tabular-nums; }
.dv-chu { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.dv-chu small { display: block; font-weight: 600; font-size: .8rem; color: var(--mo); }
.ds-van .kq-thang .dv-chu { color: var(--tot); } .ds-van .kq-thua .dv-chu { color: var(--xau); }
.ds-van .dv-chu small b { color: var(--muc2); }
.nut-pgn { flex: none; display: inline-grid; place-items: center; min-width: 52px; min-height: 44px; padding: 0 10px; border-radius: 12px;
  background: var(--nen2); font-size: .8rem; font-weight: 800; color: var(--muc2); text-decoration: none; }
.nut-pgn:hover { background: var(--nhan-nhat); color: var(--muc); }
.ds-van li.tai-het { justify-content: center; }
.ds-van li.tai-het .nut-nho { min-height: 44px; }
.ds-van li.tai-het a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; color: var(--nhan-dam); }
.man-goc .bao-loi { color: var(--xau); font-weight: 700; }

/* --- hộp thầy ghi Góc --------------------------------------------------------------------------------------------- */
.hop-goc-thay { width: min(640px, calc(100% - 24px)); max-height: calc(100dvh - 32px); }
.gt-khung { padding: 20px 22px 24px; display: grid; gap: 14px; }
.gt-dau { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gt-dau h2 { font-size: 1.5rem; }
.gt-dau .kq-dong { position: static; }
.gt-khung h3 { font-size: 1.1rem; margin-bottom: 6px; }
.gt-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gt-form textarea, .gt-form input:not([type=date]) { flex: 1 1 240px; min-height: 44px; padding: 10px 12px; border: 2px solid var(--vien); border-radius: 12px;
  font: inherit; background: var(--the); color: var(--muc); resize: vertical; }
.gt-form input[type=date] { min-height: 44px; padding: 0 8px; border: 2px solid var(--vien); border-radius: 12px; font: inherit; background: var(--the); color: var(--muc); }
.gt-form label:not(.an-chu) { font-size: .85rem; font-weight: 700; color: var(--mo); }
.gt-form .nut-nho { min-height: 44px; }
.gt-ds { list-style: none; margin: 8px 0 0; padding: 0; }
.gt-ds li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--vien); }
.gt-ds li > span, .gt-ds label { flex: 1; min-width: 0; overflow-wrap: anywhere; display: flex; gap: 8px; align-items: flex-start; }
.gt-ds small { display: block; color: var(--mo); font-size: .78rem; }
.gt-ds input[type=checkbox] { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--tot); }
.gt-ds li.xong label span { text-decoration: line-through; color: var(--mo); }
.gt-hh li b { flex: none; min-width: 52px; padding: 4px 8px; border-radius: 10px; border: 2px solid var(--mau); text-align: center; font-family: var(--chu-to); }
.nut-xoa { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--mo); cursor: pointer; }
.nut-xoa:hover { background: color-mix(in srgb, var(--xau) 12%, transparent); color: var(--xau); }
.nut-xoa svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }

/* --- màn hẹp ------------------------------------------------------------------------------------------------------ */
@media (max-width: 1099px) {
  .goc-luoi { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .goc-cot-giua { grid-column: 2; grid-row: 1 / span 2; }
  .goc-cot-phai { grid-column: 1; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 759px) {
  .goc-luoi { grid-template-columns: minmax(0, 1fr); }
  .goc-cot-giua, .goc-cot-phai { grid-column: auto; grid-row: auto; }
  .goc-cot-phai { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 599px) {
  .tab-chinh { width: 100%; }
  .tab-chinh a { flex: 1; justify-content: center; padding: 0 10px 4px; font-size: 1rem; }
  .man-goc .o-trang { padding: 16px 14px; }
  .kl-so { font-size: 3rem; }
}
