/* Khối đội hình ĐTCL - nền sáng theo theme, mỗi đội hình MỘT HÀNG GỌN bấm xổ chi tiết,
   theo khuôn trang lưu trữ của MetaTFTPlus (nguồn số liệu, dẫn ngay đầu khối).
   User chốt 06/11/2026: không cần nền tối, cần nhỏ gọn + nút xổ. */

.tg8dt {
  --dt-vien: var(--color-box-border, #e3e5ea);
  --dt-chu-mo: var(--color-text-secondary, #5f6368);
  --dt-vang: #9a6700;   /* số Hạng TB trên nền trắng */
  --dt-xanh: #1a7f37;   /* số Top 4 / Top 1 */
  --dt-sao: #e8a500;    /* sao của tướng cần 3 sao */
}

/* Thân bài của theme cho mọi <img> margin 10px trên dưới - hợp với ảnh minh hoạ, nhưng
   dán vào icon 13px thì hàng đồ phình gấp đôi và tên tướng lệch hàng nhau. */
.tg8dt img { margin: 0; }

.tg8dt-nguon { font-size: 13.5px; color: var(--dt-chu-mo); margin: 0 0 14px; }
.tg8dt-dan { color: var(--dt-chu-mo); margin: -2px 0 14px; font-size: 14px; }
.tg8dt-dem { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 11px; background: var(--color-primary-soft, #f3eef8); color: var(--color-primary, #58257B); font-size: 13px; line-height: 22px; text-align: center; vertical-align: 3px; }
.tg8dt-trong { padding: 14px 16px; background: var(--color-primary-soft, #f3eef8); border-radius: var(--radius, 6px); }

/* ------------------------------------------------------- bảng top */
.tg8dt-cuon { overflow-x: auto; margin: 0 0 10px; }
.tg8dt-bang { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14px; }
.tg8dt-bang th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--color-text-dark, #202124); background: var(--color-primary-soft, #f3eef8); padding: 8px 10px; border-bottom: 2px solid var(--color-primary, #58257B); white-space: nowrap; }
.tg8dt-bang td { padding: 9px 10px; border-bottom: 1px solid var(--dt-vien); font-variant-numeric: tabular-nums; }
.tg8dt-bang a { font-weight: 600; }

/* ------------------------------------------------------- huy hiệu bậc */
.tg8dt-bac {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 6px; flex: none;
  color: #fff; font-weight: 800; font-size: 14px;
}
.tg8dt-bac--nho { width: 22px; height: 22px; font-size: 12px; border-radius: 5px; }
.tg8dt-bac--s { background: #d93025; }
.tg8dt-bac--a { background: #e8710a; }
.tg8dt-bac--b { background: #1a73e8; }
.tg8dt-bac--c { background: #5f6368; }
.tg8dt-bac--d { background: #9aa0a6; }

/* ------------------------------------------------------- chú thích màu + thanh lọc */
/* chú thích bậc: mỗi bậc một dòng, nền dòng = đúng màu nền hàng đội hình cùng bậc */
.tg8dt-chu-thich { margin: 0 0 14px; }
.tg8dt-chu-thich__tieu-de { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: var(--color-text-dark, #202124); }
.tg8dt-chu-thich ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.tg8dt-chu-thich__o {
  display: flex; align-items: center; gap: 10px; margin: 0;
  padding: 6px 10px; border: 1px solid; border-radius: var(--radius, 6px);
  font-size: 13.5px; line-height: 1.45; color: var(--color-text-dark, #202124);
}
.tg8dt-chu-thich__o .tg8dt-bac { flex: none; }
.tg8dt-chu-thich__o b { font-weight: 700; }

/* Thanh lọc MỘT dòng: nửa trái ô tìm, nửa phải hai ô chọn thả xuống chia đôi. */
.tg8dt-loc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 10px; margin: 0 0 18px; padding: 10px 12px; border: 1px solid var(--dt-vien); border-radius: var(--radius, 6px); background: #fafafa; }
.tg8dt-loc__o,
.tg8dt-loc select {
  width: 100%; min-height: 40px; padding: 7px 12px;
  border: 1px solid var(--color-border-medium, #ccc); border-radius: var(--radius, 6px);
  font: inherit; font-size: 14px; background-color: #fff; color: var(--color-text-dark, #202124);
}
.tg8dt-loc__o:focus, .tg8dt-loc select:focus { outline: none; border-color: var(--color-primary, #58257B); }
.tg8dt-loc__chon { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
/* nhãn nhỏ "Lối chơi" / "Bậc" nằm GỌN TRONG ô, bên trái - không tốn thêm một dòng */
.tg8dt-loc__nhan { position: relative; display: block; margin: 0; }
.tg8dt-loc__nhan > span {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 12px; color: var(--dt-chu-mo); pointer-events: none;
}
.tg8dt-loc select {
  appearance: none; -webkit-appearance: none; cursor: pointer; font-weight: 600;
  padding-left: 72px; padding-right: 30px;
  /* mũi tên thả xuống tự vẽ, vì đã tắt mũi tên gốc để chữ không đè lên */
  background-image: linear-gradient(45deg, transparent 50%, #58257B 50%), linear-gradient(135deg, #58257B 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.tg8dt-loc__nhan:last-child select { padding-left: 46px; }
.tg8dt-loc select.dang-loc { border-color: var(--color-primary, #58257B); background-color: var(--color-primary-soft, #f3eef8); color: var(--color-primary, #58257B); }
.tg8dt-khong-khop { padding: 14px 16px; background: var(--color-primary-soft, #f3eef8); border-radius: var(--radius, 6px); }

/* ------------------------------------------------------- hàng đội hình (gập) */
.tg8dt-the { border: 1px solid var(--dt-vien); border-radius: var(--radius, 6px); background: #fff; margin: 0 0 10px; }
.tg8dt-the[open] { border-color: var(--color-primary-light, rgba(88,37,123,.5)); }
/* nền nhuộm NHẠT theo màu bậc - cùng họ với huy hiệu S/A/B/C/D để nhìn phát biết mạnh yếu */
.tg8dt-the--s { background: #fdefee; border-color: #f5c9c5; }
.tg8dt-the--a { background: #fdf4e7; border-color: #f3dcb6; }
.tg8dt-the--b { background: #edf3fd; border-color: #c8daf7; }
.tg8dt-the--c { background: #f3f4f6; border-color: #dcdfe4; }
.tg8dt-the--d { background: #f8f9fa; border-color: #e3e5ea; }
/* Hàng gập = 3 phần đứng giữa theo trục dọc: cột trái (tên + tộc hệ + tướng),
   lưới 4 số 2x2, mũi tên xổ. */
.tg8dt-hang { display: flex; align-items: center; gap: 16px; padding: 10px 14px 12px; cursor: pointer; list-style: none; position: relative; }
.tg8dt-hang::-webkit-details-marker { display: none; }
/* nền hàng đã nhuộm theo bậc nên hover chỉ phủ thêm một lớp mờ, màu nào cũng hợp */
.tg8dt-hang:hover { background: rgba(0, 0, 0, .03); }
.tg8dt-hang:focus-visible { outline: 2px solid var(--color-primary, #58257B); outline-offset: 1px; border-radius: var(--radius, 6px); }

.tg8dt-hang__trai { flex: 1 1 auto; min-width: 0; display: block; }
.tg8dt-hang__dau { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tg8dt .tg8dt-the__ten { margin: 0; font-size: 16px; line-height: 1.35; color: var(--color-text-dark, #202124); }
.tg8dt-chip { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--color-primary-soft, #f3eef8); color: var(--color-primary, #58257B); font-weight: 600; white-space: nowrap; }

/* 4 con số: lưới 2 hàng x 2 cột, cả khối tự đứng giữa nhờ align-items của .tg8dt-hang */
.tg8dt-so { display: grid; grid-template-columns: repeat(2, minmax(72px, auto)); gap: 10px 18px; margin: 0; text-align: center; flex: none; }
.tg8dt-so dd { margin: 0; font-size: 15px; font-weight: 700; color: var(--color-text-dark, #202124); font-variant-numeric: tabular-nums; }
.tg8dt-so dd.so-vang { color: var(--dt-vang); }
.tg8dt-so dd.so-xanh { color: var(--dt-xanh); }
.tg8dt-so dt { margin-top: 1px; font-size: 10.5px; color: var(--dt-chu-mo); white-space: nowrap; }
.tg8dt-xu { font-size: 10px; margin-left: 3px; vertical-align: 1px; }
.tg8dt-xu.len { color: #1a7f37; }
.tg8dt-xu.xuong { color: #d93025; }

/* mũi tên xổ: xoay khi mở */
.tg8dt-mui { flex: none; width: 26px; height: 26px; border: 1px solid var(--dt-vien); border-radius: 50%; position: relative; transition: transform .15s; }
.tg8dt-mui::before {
  content: ""; position: absolute; left: 8px; top: 7px; width: 8px; height: 8px;
  border-right: 2px solid var(--color-primary, #58257B); border-bottom: 2px solid var(--color-primary, #58257B);
  transform: rotate(45deg);
}
.tg8dt-the[open] .tg8dt-mui { transform: rotate(180deg); }

/* chip tộc hệ + dàn tướng, nằm dưới dòng tên trong cột trái */
.tg8dt-toc-he { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
/* icon tộc hệ là hình TRẮNG trên nền trong suốt nên chip bắt buộc nền sẫm;
   dùng luôn màu tím thương hiệu theo yêu cầu chủ dự án */
.tg8dt-toc-he__o {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 5px; background: var(--color-primary, #58257B);
  font-size: 11.5px; font-weight: 600; color: #fff;
}
.tg8dt-toc-he__anh { width: 13px; height: 13px; display: block; }
.tg8dt-tuong { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.tg8dt-tuong__o { display: flex; flex-direction: column; align-items: center; width: 46px; }
.tg8dt-sao { font-size: 11px; line-height: 12px; min-height: 12px; letter-spacing: -1px; color: #b8bdc4; }
.tg8dt-sao.sao-3 { color: var(--dt-sao); }
/* ảnh tướng gốc tự bo góc khá sâu, khung phải bo theo kẻo bốn góc hở trắng */
.tg8dt-tuong__khung { display: inline-flex; border-radius: 11px; border: 2px solid #6b7280; /* giá 1 */ }
.tg8dt-tuong__khung.gia-2 { border-color: #15803d; }
.tg8dt-tuong__khung.gia-3 { border-color: #1d4ed8; }
.tg8dt-tuong__khung.gia-4 { border-color: #7e22ce; }
.tg8dt-tuong__khung.gia-5 { border-color: #d97706; }
.tg8dt-tuong__anh { width: 40px; height: 40px; border-radius: 9px; display: block; object-fit: cover; }
/* đồ cốt lõi nép ngay chân avatar; giữ chiều cao kể cả khi trống cho tên thẳng hàng */
.tg8dt-do { display: flex; gap: 1px; margin-top: 2px; min-height: 13px; }
.tg8dt-do__anh { width: 13px; height: 13px; border-radius: 3px; border: 1px solid var(--dt-vien); display: block; }
.tg8dt-tuong__ten {
  margin-top: 1px; max-width: 46px; font-size: 10.5px; line-height: 14px; color: var(--dt-chu-mo);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
}
.chu-luc .tg8dt-tuong__ten { color: var(--color-text-dark, #202124); font-weight: 700; }

/* ô chữ cái tạm trong lúc icon chưa chép về máy */
.tg8dt-anh--cho { display: inline-flex; align-items: center; justify-content: center; background: var(--color-primary-soft, #f3eef8); color: var(--color-primary, #58257B); font-weight: 700; }
.tg8dt-tuong__anh.tg8dt-anh--cho { width: 40px; height: 40px; border-radius: 9px; font-size: 15px; }
.tg8dt-do__anh.tg8dt-anh--cho, .tg8dt-toc-he__anh.tg8dt-anh--cho { font-size: 8px; border-radius: 3px; }
.tg8dt-xo__mat.tg8dt-anh--cho { width: 44px; height: 44px; border-radius: 10px; font-size: 16px; }
.tg8dt-xo__item-anh.tg8dt-anh--cho { width: 28px; height: 28px; border-radius: 5px; font-size: 10px; }

/* ------------------------------------------------------- phần xổ ra */
.tg8dt-xo { padding: 14px 16px 16px; border-top: 1px solid var(--dt-vien); background: #fafafa; border-radius: 0 0 var(--radius, 6px) var(--radius, 6px); }
.tg8dt-xo__cot { margin: 0 0 14px; }
.tg8dt-xo h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .3px; color: var(--dt-chu-mo); }
/* lưới 3 cột cứng thay vì flex: mặt tướng - tên - đồ luôn thẳng cột qua mọi hàng,
   hết cảnh cột đồ của Vi lệch so với của Master Yi vì tên dài ngắn khác nhau.
   Mặt tướng 44px cho CÂN với khối đồ bên phải (icon 28px + dòng % ~ 45px cao),
   36px trông lọt thỏm - user chỉ ra 06/11. */
.tg8dt-xo__hang { display: grid; grid-template-columns: 48px 118px 1fr; align-items: center; gap: 12px; padding: 6px 0; }
.tg8dt-xo__mat { width: 44px; height: 44px; border-radius: 10px; display: block; object-fit: cover; }
.tg8dt-xo__ten { font-size: 14.5px; font-weight: 600; color: var(--color-text-dark, #202124); }
.tg8dt-xo__mon { display: flex; flex-wrap: wrap; gap: 10px; }
.tg8dt-xo__item { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.tg8dt-xo__item-anh { width: 28px; height: 28px; border-radius: 5px; border: 1px solid var(--dt-vien); display: block; }
.tg8dt-xo__item small { font-size: 11px; color: var(--dt-chu-mo); }
.tg8dt-xo__rate { font-size: 13.5px; color: var(--dt-chu-mo); }
.tg8dt-xo__nut { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 2px; }
.tg8dt-chep {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 6px 12px; border-radius: var(--radius, 6px);
  border: 1px solid var(--color-primary, #58257B); background: #fff; color: var(--color-primary, #58257B);
}
.tg8dt-chep:hover { background: var(--color-primary-soft, #f3eef8); }
.tg8dt-chep.da-chep { border-color: #1a7f37; background: #eaf6ec; color: #1a7f37; }
.tg8dt-xo__nguon { font-size: 13px; }

/* ------------------------------------------------------- điện thoại */
@media (max-width: 700px) {
  /* màn hẹp không đủ chỗ 50/50: ô tìm một dòng, hai ô chọn chia đôi dòng dưới */
  .tg8dt-loc { grid-template-columns: 1fr; }
  .tg8dt-hang { flex-wrap: wrap; padding: 10px 12px; gap: 10px; }
  /* màn hẹp: cột trái chiếm cả bề ngang, lưới 4 số xuống dưới vẫn 2x2 và giãn đều;
     mũi tên ghim góc trên phải để không bị đẩy xuống đáy */
  .tg8dt-hang__trai { flex: 1 1 100%; }
  .tg8dt-hang__dau { padding-right: 34px; }
  .tg8dt-so { flex: 1 1 100%; grid-template-columns: repeat(2, 1fr); gap: 8px 12px; }
  .tg8dt-mui { position: absolute; top: 10px; right: 12px; }
  .tg8dt-tuong__o { width: 42px; }
  .tg8dt-tuong__anh, .tg8dt-tuong__anh.tg8dt-anh--cho { width: 36px; height: 36px; border-radius: 8px; }
  .tg8dt-tuong__ten { max-width: 42px; font-size: 10px; }
  .tg8dt-xo__hang { grid-template-columns: 46px 88px 1fr; gap: 9px; }
  .tg8dt-xo__mat, .tg8dt-xo__mat.tg8dt-anh--cho { width: 42px; height: 42px; }
  .tg8dt-xo__ten { font-size: 13.5px; }
}
