/*
 * Giao diện trang công cụ.
 *
 * Dùng lại biến của theme (--color-primary, --radius...) nên trang công cụ không lạc
 * khỏi phần còn lại của site. Có giá trị dự phòng sau mỗi var() để nếu theme đổi tên
 * biến thì trang vẫn đọc được chứ không mất màu.
 *
 * BA ĐIỂM QUYẾT ĐỊNH TRẢI NGHIỆM, cố ý ưu tiên hơn vẻ đẹp:
 *  1. Mọi thứ bấm được đều cao ít nhất 44px trên điện thoại - chạm hụt một ô kí tự nhỏ
 *     là chép nhầm, mà người đọc không nhìn ra mình vừa chép gì.
 *  2. Ô nhập dùng font-size 16px: dưới mức đó Safari trên iPhone tự phóng to cả trang
 *     khi người đọc chạm vào ô.
 *  3. Kí tự hiển thị ở cỡ lớn (22px trở lên) vì nhiều kí tự chỉ khác nhau vài nét.
 */

.tg8cc-trang {
  max-width: 1000px;
  margin: 0 auto;
  /* Lưới chặn cuối: kí tự trang trí vẽ bằng font của điện thoại có thể rộng hơn trên máy
     tính, thứ gì lỡ tràn thì bị cắt chứ không làm cả trang vuốt ngang được. Dùng clip,
     không dùng hidden: hidden biến khối thành khung cuộn và làm hỏng thanh A-Z dính. */
  overflow-x: clip;
}

.tg8cc-duong { margin-bottom: 10px; }

/* ----------------------------------------------------------------- đầu trang */
.tg8cc-dau { margin-bottom: 18px; }
.tg8cc-h1 {
  font-size: 28px; line-height: 1.25; font-weight: 700;
  color: var(--color-text-dark, #202124); margin: 0 0 10px;
}
.tg8cc-tom {
  font-size: 15.5px; line-height: 25px; color: var(--color-text, rgba(0,0,0,.87));
  margin: 0 0 12px; text-align: left;
}
.tg8cc-hua {
  display: flex; flex-wrap: wrap; gap: 6px 8px;
  list-style: none; margin: 0; padding: 0;
}
.tg8cc-hua li {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px 4px 9px;
  border: 1px solid var(--color-box-border, #e3e5ea);
  border-radius: var(--radius, 6px);
  background: #fff; font-size: 13px; color: var(--color-text-secondary, #5f6368);
}
.tg8cc-hua li::before {
  content: ""; width: 14px; height: 14px; flex: none;
  background: var(--color-primary, #58257B);
  -webkit-mask: no-repeat center/14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E");
  mask: no-repeat center/14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E");
}

/* ----------------------------------------------------------------- tiêu đề chung */
.tg8cc-h2 {
  font-size: 20px; line-height: 30px; font-weight: 700;
  color: var(--color-text-dark, #202124); margin: 26px 0 8px;
}
.tg8cc-h3 {
  font-size: 16px; line-height: 24px; font-weight: 700;
  color: var(--color-text-dark, #202124); margin: 18px 0 8px;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.tg8cc-h3__so { font-size: 12.5px; font-weight: 400; color: var(--color-text-secondary, #5f6368); }
.tg8cc-dan {
  font-size: 14.5px; line-height: 23px; color: var(--color-text-secondary, #5f6368);
  margin: 0 0 12px; text-align: left;
}

/* ----------------------------------------------------------------- khối tạo tên */
.tg8cc-tao {
  margin: 0 0 24px; padding: 18px;
  border: 1px solid var(--color-box-border, #e3e5ea);
  border-radius: var(--radius, 6px);
  background: linear-gradient(180deg, var(--color-primary-soft, #f3eef8), #fff 120px);
}
.tg8cc-tao__nhan {
  display: block; font-size: 14px; font-weight: 700;
  color: var(--color-text-dark, #202124); margin-bottom: 6px;
}
.tg8cc-tao__o { position: relative; }
.tg8cc-tao__input {
  width: 100%; min-height: 52px; padding: 10px 44px 10px 14px;
  border: 2px solid var(--color-primary, #58257B);
  border-radius: var(--radius, 6px);
  background: #fff; color: var(--color-text-dark, #202124);
  font: inherit; font-size: 18px; font-weight: 700;
}
.tg8cc-tao__input:focus { outline: 2px solid var(--color-primary, #58257B); outline-offset: 2px; }
.tg8cc-tao__xoa {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: var(--radius, 6px);
  background: none; color: var(--color-text-secondary, #5f6368);
  font-size: 24px; line-height: 1; cursor: pointer;
}
.tg8cc-tao__xoa:hover { background: #f1f1f4; color: var(--color-text-dark, #202124); }
.tg8cc-tao__mota {
  margin: 8px 0 0; font-size: 13.5px; line-height: 21px;
  color: var(--color-text-secondary, #5f6368); text-align: left;
}
.tg8cc-tao__mau {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 10px; font-size: 13px; color: var(--color-text-secondary, #5f6368);
}
.tg8cc-chip {
  min-height: 32px; padding: 4px 12px;
  border: 1px solid var(--color-box-border, #e3e5ea);
  border-radius: 999px; background: #fff;
  font: inherit; font-size: 13.5px; color: var(--color-text-dark, #202124); cursor: pointer;
}
.tg8cc-chip:hover { border-color: var(--color-primary, #58257B); color: var(--color-primary, #58257B); }
.tg8cc-tao__dau-viet {
  margin-top: 12px; padding: 10px 12px;
  border-left: 3px solid var(--color-primary, #58257B);
  border-radius: var(--radius, 6px); background: #fff;
  font-size: 13.5px; line-height: 21px;
}
.tg8cc-lien {
  padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 13.5px; color: var(--color-link-body, #1a73e8); text-decoration: underline;
}

/* ô xem trước tên đã ghép */
.tg8cc-xem {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px;
  margin-top: 12px; padding: 12px 14px;
  border: 2px solid var(--color-primary, #58257B); border-radius: var(--radius, 6px);
  background: var(--color-primary-soft, #f3eef8);
}
.tg8cc-xem__nhan { grid-column: 1; font-size: 12px; font-weight: 700; color: var(--color-text-secondary, #5f6368); text-transform: uppercase; letter-spacing: .4px; }
.tg8cc-xem__ket {
  grid-column: 1; padding: 0; border: 0; background: none; text-align: left; cursor: pointer;
  font: inherit; font-size: 24px; line-height: 34px; font-weight: 700;
  color: var(--color-text-dark, #202124); overflow-wrap: anywhere;
}
.tg8cc-xem__ket:focus-visible { outline: 2px solid var(--color-primary, #58257B); outline-offset: 2px; }
.tg8cc-xem__chep {
  grid-column: 2; grid-row: 1 / -1; flex: none;
  padding: 8px 14px; border-radius: var(--radius, 6px);
  background: var(--color-primary, #58257B); color: #fff; font-size: 13px; font-weight: 700; white-space: nowrap;
}
.tg8cc-xem.da-chep { border-color: #1a7f37; }
.tg8cc-xem.da-chep .tg8cc-xem__chep { background: #1a7f37; }

/* ba ô chọn kí tự đầu / giữa / cuối */
.tg8cc-ghep { margin-top: 14px; }
.tg8cc-ghep__dau .tg8cc-h3 { margin-top: 0; }
.tg8cc-ghep__hang { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* Ba vị trí, ba màu. Người đọc nhìn một cái là biết mình đang chọn cho ô nào, không
   phải đọc lại nhãn. Cả ba màu đều đủ tối để chữ trắng đọc được khi nằm trên nền màu,
   và đủ tương phản với nền trắng của trang. */
.tg8cc-ghep__cot { min-width: 0; --mau: var(--color-primary, #58257B); --mau-nhat: #f3eef8; }
.tg8cc-ghep__cot[data-vi-tri="giua"]  { --mau: #0e7490; --mau-nhat: #e6f4f7; }
.tg8cc-ghep__cot[data-vi-tri="cuoi"]  { --mau: #be185d; --mau-nhat: #fdeaf1; }

.tg8cc-ghep__nhan { display: block; margin-bottom: 5px; font-size: 15px; font-weight: 700; color: var(--mau); }
.tg8cc-ghep__nhan small { display: block; font-size: 12px; font-weight: 400; color: var(--color-text-secondary, #5f6368); }
.tg8cc-ghep__nut {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-height: 48px; padding: 6px 12px;
  border: 2px solid var(--mau); border-radius: var(--radius, 6px);
  background: var(--mau-nhat); font: inherit; cursor: pointer;
}
.tg8cc-ghep__nut:hover { filter: brightness(.97); }
.tg8cc-ghep__nut[aria-expanded="true"] { background: var(--mau); }
.tg8cc-ghep__nut[aria-expanded="true"] .tg8cc-ghep__dang { color: #fff; }
.tg8cc-ghep__nut[aria-expanded="true"] .tg8cc-ghep__mui { border-color: #fff; }
.tg8cc-ghep__dang {
  font-size: 20px; line-height: 26px; color: var(--color-text-dark, #202124);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.tg8cc-ghep__dang.trong { font-size: 12.5px; color: var(--color-text-secondary, #5f6368); }
.tg8cc-ghep__mui {
  flex: none; width: 8px; height: 8px; margin-top: -4px;
  border-right: 2px solid var(--mau);
  border-bottom: 2px solid var(--mau); transform: rotate(45deg);
}
.tg8cc-ghep__nut[aria-expanded="true"] .tg8cc-ghep__mui { margin-top: 3px; transform: rotate(-135deg); }
.tg8cc-ghep__luoi {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); gap: 5px;
  max-height: 232px; overflow-y: auto; margin-top: 6px; padding: 8px;
  border: 2px solid var(--mau); border-radius: var(--radius, 6px);
  background: #fff; scrollbar-width: thin;
}
.tg8cc-ghep__luoi[hidden] { display: none; }
.tg8cc-ghep__i {
  display: flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 3px;
  border: 1px solid var(--color-box-border, #e3e5ea); border-radius: var(--radius, 6px);
  background: #fff; font: inherit; font-size: 18px; line-height: 1.2;
  color: var(--color-text-dark, #202124); cursor: pointer;
}
.tg8cc-ghep__i:hover { border-color: var(--mau); background: var(--mau-nhat); }
.tg8cc-ghep__i.dang-chon { border-color: var(--mau); background: var(--mau); color: #fff; }
.tg8cc-ghep__i em { font-size: 11px; font-style: normal; color: var(--color-text-secondary, #5f6368); }
.tg8cc-ghep__i.dang-chon em { color: #fff; }
.tg8cc-ghep__i--bo { grid-column: 1 / -1; min-height: 36px; font-size: 13px; color: var(--color-text-secondary, #5f6368); }
.tg8cc-ghep__i--bo:hover { color: var(--mau); }
.tg8cc-ghep__nutngang { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tg8cc-ghep__phu {
  min-height: 38px; padding: 0 14px;
  border: 1px solid var(--color-box-border, #e3e5ea); border-radius: var(--radius, 6px);
  background: #fff; font: inherit; font-size: 13.5px; color: var(--color-text-dark, #202124); cursor: pointer;
}
.tg8cc-ghep__phu:hover { border-color: var(--color-primary, #58257B); color: var(--color-primary, #58257B); }

/* kết quả tạo tên */
.tg8cc-ket {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 8px; margin-top: 14px;
}
.tg8cc-dong {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px;
  min-height: 56px; padding: 8px 12px; text-align: left;
  border: 1px solid var(--color-box-border, #e3e5ea);
  border-radius: var(--radius, 6px); background: #fff;
  font: inherit; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.tg8cc-dong:hover { border-color: var(--color-primary, #58257B); background: var(--color-primary-soft, #f3eef8); }
.tg8cc-dong:focus-visible { outline: 2px solid var(--color-primary, #58257B); outline-offset: 1px; }
.tg8cc-dong__ket {
  grid-column: 1; font-size: 19px; line-height: 28px;
  color: var(--color-text-dark, #202124);
  overflow-wrap: anywhere;
}
.tg8cc-dong__ten {
  grid-column: 1; font-size: 12px; line-height: 16px;
  color: var(--color-text-secondary, #5f6368);
}
.tg8cc-dong__chep {
  grid-column: 2; grid-row: 1 / -1;
  padding: 5px 10px; border-radius: var(--radius, 6px);
  background: var(--color-primary-soft, #f3eef8);
  color: var(--color-primary, #58257B); font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.tg8cc-dong.da-chep { border-color: #1a7f37; background: #eaf6ec; }
.tg8cc-dong.da-chep .tg8cc-dong__chep { background: #1a7f37; color: #fff; }
.tg8cc-ket--khung .tg8cc-dong__ket { font-size: 17px; }
/* Trang font chữ để 2 cột, không phải 3: ở đây người ta gõ cả câu chứ không phải một
   nick ngắn, cột hẹp làm chữ vỡ thành ba bốn dòng và hết so được kiểu nọ với kiểu kia. */
.tg8cc-font .tg8cc-ket { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ----------------------------------------------------------------- bảng kí tự */
.tg8cc-loc { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tg8cc-loc__o {
  flex: 1 1 auto; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--color-border-medium, #ccc);
  border-radius: var(--radius, 6px); background: #fff;
  font: inherit; font-size: 16px;
}
.tg8cc-loc__o:focus { outline: 2px solid var(--color-primary, #58257B); outline-offset: -1px; }
.tg8cc-loc__dem { flex: none; font-size: 13px; color: var(--color-text-secondary, #5f6368); }

.tg8cc-tab {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.tg8cc-tab__i {
  flex: none; padding: 6px 12px;
  border: 1px solid var(--color-box-border, #e3e5ea);
  border-radius: 999px; background: #fff;
  font-size: 13.5px; color: var(--color-text-dark, #202124); text-decoration: none; white-space: nowrap;
}
.tg8cc-tab__i:hover { border-color: var(--color-primary, #58257B); color: var(--color-primary, #58257B); text-decoration: none; }
.tg8cc-tab__i span { color: var(--color-text-secondary, #5f6368); font-size: 12px; }

.tg8cc-luoi {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 6px; margin-bottom: 6px;
}
.tg8cc-luoi--rong { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.tg8cc-o {
  display: flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 4px;
  border: 1px solid var(--color-box-border, #e3e5ea);
  border-radius: var(--radius, 6px); background: #fff;
  font: inherit; cursor: pointer;
  transition: border-color .12s, background .12s, transform .08s;
}
.tg8cc-o:hover { border-color: var(--color-primary, #58257B); background: var(--color-primary-soft, #f3eef8); }
.tg8cc-o:active { transform: scale(.94); }
.tg8cc-o:focus-visible { outline: 2px solid var(--color-primary, #58257B); outline-offset: 1px; }
.tg8cc-o__c {
  font-size: 22px; line-height: 1.2; color: var(--color-text-dark, #202124);
  /* Kí tự lạ cần font có nó; để trình duyệt tự thay font chứ đừng ép một font duy nhất. */
  font-family: "Segoe UI Symbol", "Apple Color Emoji", "Noto Color Emoji", "Noto Sans Symbols 2", sans-serif;
}
.tg8cc-o--rong .tg8cc-o__c { font-size: 15px; white-space: nowrap; }
.tg8cc-o.da-chep { border-color: #1a7f37; background: #eaf6ec; }
.tg8cc-nhom[hidden] { display: none; }

.tg8cc-them {
  display: block; width: 100%; min-height: 44px; margin: 2px 0 10px; padding: 10px;
  border: 1px dashed var(--color-border-medium, #ccc); border-radius: var(--radius, 6px);
  background: #fff; font: inherit; font-size: 14px; color: var(--color-primary, #58257B); cursor: pointer;
}
.tg8cc-them:hover { border-color: var(--color-primary, #58257B); background: var(--color-primary-soft, #f3eef8); }
.tg8cc-luoi--them[hidden] { display: none; }

/* ----------------------------------------------------------------- danh sách tên */
.tg8cc-ten__nhom { margin-bottom: 18px; }
.tg8cc-ten__nhom[hidden] { display: none; }
.tg8cc-ten__mota { margin: 0 0 8px; font-size: 13.5px; line-height: 21px; color: var(--color-text-secondary, #5f6368); }
/* BỐN CỘT CỐ ĐỊNH, không auto-fill. Với auto-fill, một cặp tên bị nhét vào đúng một ô
   232px nên mỗi tên chỉ còn ~105px và chữ vỡ thành từng dòng một chữ. Bốn cột ở 1000px
   cho mỗi ô ~240px, và một CẶP chiếm hai cột nên mỗi tên vẫn đủ rộng. */
.tg8cc-ten__luoi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tg8cc-ten__i {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-width: 0; min-height: 46px; padding: 7px 10px 7px 13px; text-align: left;
  border: 1px solid var(--color-box-border, #e3e5ea); border-radius: var(--radius, 6px);
  background: #fff; font: inherit; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.tg8cc-ten__i:hover { border-color: var(--color-primary, #58257B); background: var(--color-primary-soft, #f3eef8); }
.tg8cc-ten__i:focus-visible { outline: 2px solid var(--color-primary, #58257B); outline-offset: 1px; }
.tg8cc-ten__i.da-chep { border-color: #1a7f37; background: #eaf6ec; }
.tg8cc-ten__c {
  /* Không in đậm: tên đã có kí tự trang trí, đậm thêm thì cả lưới thành một mảng đen. */
  font-size: 16px; line-height: 23px; font-weight: 400; color: var(--color-text-dark, #202124);
  /* anywhere, không phải break-word: break-word không làm nhỏ bề rộng tối thiểu, nên một
     tên viết liền dài hơn cột sẽ đẩy phình cả lưới và trang vuốt ngang được trên điện thoại. */
  min-width: 0; overflow-wrap: anywhere; hyphens: none;
}
.tg8cc-ten__c.dai { font-size: 14px; line-height: 20px; letter-spacing: -.2px; }
/* Số kí tự: tên đã trang trí dễ vượt giới hạn ô đặt tên mà nhìn thì không biết. */
.tg8cc-ten__so {
  flex: none; min-width: 26px; padding: 2px 6px; border-radius: 999px;
  background: #f1f1f4; color: var(--color-text-secondary, #5f6368);
  font-size: 11.5px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums;
}
.tg8cc-ten__i:hover .tg8cc-ten__so { background: #fff; color: var(--color-primary, #58257B); }
.tg8cc-ten__i.da-chep .tg8cc-ten__so { background: #1a7f37; color: #fff; }
.tg8cc-ten__nut { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.tg8cc-ten__ghichu { font-size: 12.5px; line-height: 19px; color: var(--color-text-secondary, #5f6368); }

/* Một cặp tên: hai nút dính nhau, có dấu nối ở giữa cho thấy chúng đi với nhau.
   Chiếm hai cột của lưới để mỗi tên rộng bằng một ô tên thường. */
.tg8cc-ten__cap {
  grid-column: span 2;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 4px;
}
.tg8cc-ten__cap::before {
  content: "+"; grid-column: 2; order: 2;
  color: var(--color-primary, #58257B); font-size: 14px; font-weight: 700;
}
.tg8cc-ten__i--cap { min-width: 0; }
.tg8cc-ten__i--cap:first-child { order: 1; }
.tg8cc-ten__i--cap:last-child { order: 3; }
.tg8cc-ten__i--cap .tg8cc-ten__so { min-width: 22px; padding: 2px 5px; font-size: 11px; }

/* ----------------------------------------------------------------- bảng A-Z */
/* Thanh chọn chữ cái dính lại khi cuộn, nhưng phải thật mỏng: trên điện thoại nó từng
   xuống 4 hàng và ăn gần một phần tư màn hình. Cho cuộn ngang một hàng thay vì xuống
   dòng, và chiều cao cố định để scroll-margin của các hàng bên dưới tính được. */
.tg8cc-az__chon {
  display: flex; gap: 4px; margin-bottom: 14px;
  padding: 8px 10px; border: 1px solid var(--color-box-border, #e3e5ea);
  border-radius: var(--radius, 6px); background: #fff;
  position: sticky; top: calc(var(--nav-height, 36px) + 4px); z-index: 20;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.tg8cc-az__chon a { flex: none; }
.tg8cc-az__chon a {
  display: flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 5px;
  border: 1px solid var(--color-box-border, #e3e5ea); border-radius: var(--radius, 6px);
  background: #fff; color: var(--color-text-dark, #202124);
  font-size: 14px; font-weight: 700; text-decoration: none;
}
.tg8cc-az__chon a:hover { border-color: var(--color-primary, #58257B); color: var(--color-primary, #58257B); text-decoration: none; }
.tg8cc-az__hang {
  display: grid; grid-template-columns: 54px 1fr; gap: 12px; align-items: start;
  padding: 11px 0; border-top: 1px solid var(--color-border, #eee);
  /* Chừa đúng chỗ cho thanh điều hướng của theme cộng thanh chọn chữ cái đang dính,
     nếu không thì nhảy tới #chu-v sẽ thấy hàng V bị che mất nửa trên. */
  scroll-margin-top: calc(var(--nav-height, 36px) + 68px);
}
.tg8cc-az__hang:target { background: var(--color-primary-soft, #f3eef8); border-radius: var(--radius, 6px); }
.tg8cc-az__chu {
  display: flex; align-items: center; justify-content: center;
  height: 44px; border-radius: var(--radius, 6px);
  background: var(--color-primary, #58257B); color: #fff;
  font-size: 22px; font-weight: 700;
}
.tg8cc-az__ds { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 5px; }
.tg8cc-az__o {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 52px; padding: 5px 3px;
  border: 1px solid var(--color-box-border, #e3e5ea); border-radius: var(--radius, 6px);
  background: #fff; font: inherit; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.tg8cc-az__o:hover { border-color: var(--color-primary, #58257B); background: var(--color-primary-soft, #f3eef8); }
.tg8cc-az__o:focus-visible { outline: 2px solid var(--color-primary, #58257B); outline-offset: 1px; }
.tg8cc-az__o.da-chep { border-color: #1a7f37; background: #eaf6ec; }
.tg8cc-az__gt {
  font-size: 19px; line-height: 24px; color: var(--color-text-dark, #202124);
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", sans-serif;
}
.tg8cc-az__ten {
  font-size: 9.5px; line-height: 12px; color: var(--color-text-secondary, #5f6368);
  text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* ----------------------------------------------------------------- khoảng trống */
.tg8cc-trong__luu {
  margin: 0 0 14px; padding: 11px 13px;
  border-left: 3px solid #b26a00; border-radius: var(--radius, 6px);
  background: #fff8e6; font-size: 14px; line-height: 22px;
}
.tg8cc-trong__ds { display: grid; gap: 7px; }
.tg8cc-trong__i {
  display: grid; grid-template-columns: 76px 1fr auto; align-items: center; gap: 12px;
  min-height: 60px; padding: 8px 12px; text-align: left;
  border: 1px solid var(--color-box-border, #e3e5ea);
  border-radius: var(--radius, 6px); background: #fff; font: inherit; cursor: pointer;
}
.tg8cc-trong__i:hover { border-color: var(--color-primary, #58257B); background: var(--color-primary-soft, #f3eef8); }
.tg8cc-trong__i.da-chep { border-color: #1a7f37; background: #eaf6ec; }
.tg8cc-trong__o { display: inline-flex; align-items: stretch; height: 30px; }
.tg8cc-trong__vach { width: 2px; background: var(--color-primary, #58257B); border-radius: 1px; }
.tg8cc-trong__c {
  display: inline-block; min-width: 2px; align-self: center;
  background: repeating-linear-gradient(45deg, #f0ecf5, #f0ecf5 4px, #fff 4px, #fff 8px);
  font-size: 18px; line-height: 30px;
}
.tg8cc-trong__chu { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tg8cc-trong__ten { font-size: 14.5px; font-weight: 700; color: var(--color-text-dark, #202124); }
.tg8cc-trong__ma {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 12px; color: var(--color-primary, #58257B);
}
.tg8cc-trong__mo-ta { font-size: 12.5px; line-height: 18px; color: var(--color-text-secondary, #5f6368); }
.tg8cc-trong__chep {
  padding: 5px 10px; border-radius: var(--radius, 6px);
  background: var(--color-primary-soft, #f3eef8); color: var(--color-primary, #58257B);
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.tg8cc-trong__nhieu {
  margin-top: 16px; padding: 14px;
  border: 1px solid var(--color-box-border, #e3e5ea); border-radius: var(--radius, 6px); background: #fff;
}
.tg8cc-trong__nhieu > label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 7px; }
.tg8cc-trong__hang { display: flex; gap: 8px; align-items: center; }
.tg8cc-trong__hang input {
  width: 90px; min-height: 44px; padding: 8px 10px;
  border: 1px solid var(--color-border-medium, #ccc); border-radius: var(--radius, 6px);
  font: inherit; font-size: 16px;
}
.tg8cc-nut {
  min-height: 44px; padding: 0 18px; border: 0; border-radius: var(--radius, 6px);
  background: var(--color-primary, #58257B); color: #fff;
  font: inherit; font-size: 14.5px; font-weight: 700; cursor: pointer;
}
.tg8cc-nut:hover { filter: brightness(1.12); }

/* ----------------------------------------------------------------- kiểm tra tên */
.tg8cc-soi__o {
  width: 100%; min-height: 76px; padding: 12px 14px;
  border: 2px solid var(--color-primary, #58257B); border-radius: var(--radius, 6px);
  background: #fff; font: inherit; font-size: 18px; resize: vertical;
}
.tg8cc-soi__o:focus { outline: 2px solid var(--color-primary, #58257B); outline-offset: 2px; }
.tg8cc-soi__ket {
  margin-top: 12px; padding: 14px;
  border: 1px solid var(--color-box-border, #e3e5ea); border-radius: var(--radius, 6px); background: #fff;
}
.tg8cc-soi__so { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tg8cc-soi__the {
  flex: 1 1 130px; padding: 9px 11px;
  border-radius: var(--radius, 6px); background: var(--color-primary-soft, #f3eef8);
}
.tg8cc-soi__the b { display: block; font-size: 22px; line-height: 28px; color: var(--color-primary, #58257B); }
.tg8cc-soi__the span { font-size: 12.5px; color: var(--color-text-secondary, #5f6368); }
.tg8cc-soi__canh { margin: 0 0 8px; padding-left: 18px; font-size: 14px; line-height: 22px; }
.tg8cc-soi__canh li { margin-bottom: 4px; }
.tg8cc-soi__chuoi { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.tg8cc-soi__c {
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 42px; padding: 5px 4px;
  border: 1px solid var(--color-box-border, #e3e5ea); border-radius: var(--radius, 6px); background: #fff;
}
.tg8cc-soi__c b { font-size: 18px; font-weight: 400; line-height: 22px; }
.tg8cc-soi__c span { font-family: ui-monospace, Menlo, monospace; font-size: 10px; color: var(--color-text-secondary, #5f6368); }
.tg8cc-soi__c.la { border-color: #b26a00; background: #fff8e6; }

/* ----------------------------------------------------------------- phần chữ */
.tg8cc-chu { margin: 26px 0 0; font-size: 15px; line-height: 25px; text-align: justify; }
.tg8cc-chu h2 { font-size: 20px; line-height: 30px; font-weight: 700; margin: 24px 0 8px; text-align: left; }
.tg8cc-chu h3 { font-size: 16px; line-height: 24px; font-weight: 700; margin: 18px 0 6px; text-align: left; }
.tg8cc-chu p { margin: 0 0 12px; }
.tg8cc-chu ul, .tg8cc-chu ol { margin: 0 0 12px; padding-left: 22px; }
.tg8cc-chu li { margin-bottom: 5px; text-align: left; }
/* Link trong phần chữ có gạch chân: giữa một đoạn văn dài, chỉ đổi màu thì người đọc
   dễ lướt qua, và người khó phân biệt màu thì không thấy gì cả. Gạch chân mảnh và cách
   chữ một chút nên không làm rối đoạn văn. */
.tg8cc-chu a {
  color: var(--color-primary, #58257B);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-color: rgba(88, 37, 123, .45);
}
.tg8cc-chu a:hover { text-decoration-color: currentColor; }

.tg8cc-chu table { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 14.5px; }
.tg8cc-chu th, .tg8cc-chu td {
  border: 1px solid var(--color-box-border, #e3e5ea); padding: 8px 10px; text-align: left; vertical-align: top;
  /* Ô có kaomoji hay chuỗi kí tự viết liền: cho ngắt ở bất kì đâu để bảng không rộng quá màn. */
  overflow-wrap: anywhere;
}
.tg8cc-chu th { background: var(--color-primary-soft, #f3eef8); font-weight: 700; }

/* ----------------------------------------------------------------- cuối trang */
.tg8cc-lq__ds, .tg8cc-the {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px; list-style: none; margin: 0; padding: 0;
}
.tg8cc-lq__ds a, .tg8cc-the a {
  display: block; height: 100%; padding: 11px 13px;
  border: 1px solid var(--color-box-border, #e3e5ea); border-radius: var(--radius, 6px);
  background: #fff; text-decoration: none;
}
.tg8cc-lq__ds a:hover, .tg8cc-the a:hover { border-color: var(--color-primary, #58257B); text-decoration: none; }
.tg8cc-lq__ds strong, .tg8cc-the strong {
  display: block; font-size: 14.5px; color: var(--color-primary, #58257B); margin-bottom: 3px;
}
.tg8cc-lq__ds span, .tg8cc-the span {
  display: block; font-size: 13px; line-height: 20px; color: var(--color-text-secondary, #5f6368);
}
.tg8cc-the__so {
  margin-top: 6px; font-size: 12px; color: var(--color-primary, #58257B);
  font-variant-numeric: tabular-nums;
}
.tg8cc-loc--tong { margin-bottom: 18px; }
.tg8cc-loc--tong .tg8cc-loc__o { min-height: 50px; font-size: 16px; }
.tg8cc-ds[hidden] { display: none; }
.tg8cc-the li[hidden] { display: none; }
.tg8cc-loc__trong { padding: 18px; border: 1px dashed var(--color-border-medium, #ccc); border-radius: var(--radius, 6px); text-align: center; color: var(--color-text-secondary, #5f6368); }
.tg8cc-loc__trong[hidden] { display: none; }
.tg8cc-ds .tg8cc-h2 { display: flex; align-items: baseline; gap: 8px; }

.tg8cc-tiep__ds { margin: 0 0 8px; padding-left: 20px; font-size: 15px; line-height: 26px; }
.tg8cc-tiep__cm { margin: 0; font-size: 14px; }
.tg8cc-ds { margin-bottom: 22px; }

/* ----------------------------------------------------------------- nhắc đã chép */
.tg8cc-bao {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px);
  z-index: 300; max-width: min(90vw, 420px);
  padding: 11px 18px; border-radius: var(--radius, 6px);
  background: #202124; color: #fff; font-size: 14.5px; line-height: 21px;
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
  opacity: 0; pointer-events: none; transition: opacity .16s, transform .16s;
  text-align: center; overflow-wrap: anywhere;
}
.tg8cc-bao.hien { opacity: 1; transform: translate(-50%, 0); }
.tg8cc-bao b { font-weight: 700; }

/* ----------------------------------------------------------------- điện thoại */
@media (max-width: 767px) {
  .tg8cc-h1 { font-size: 23px; }
  .tg8cc-h2 { font-size: 18px; line-height: 27px; }
  .tg8cc-tao { padding: 14px; }
  .tg8cc-tao__input { font-size: 17px; min-height: 50px; }
  /* Mọi lưới một cột ở đây dùng minmax(0, 1fr), không dùng 1fr trơn: 1fr không co nhỏ hơn
     chữ dài nhất trong cột, một tên viết liền là đủ đẩy trang rộng quá màn hình. */
  .tg8cc-ket, .tg8cc-font .tg8cc-ket { grid-template-columns: minmax(0, 1fr); }
  /* Màn hẹp: nút chép xuống hàng riêng, nếu không nó đè lên chính cái tên. */
  .tg8cc-xem { grid-template-columns: minmax(0, 1fr); }
  .tg8cc-xem__ket { font-size: 21px; line-height: 30px; }
  .tg8cc-xem__chep { grid-column: 1; grid-row: auto; justify-self: stretch; margin-top: 6px; padding: 10px; text-align: center; }
  .tg8cc-ghep__hang { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .tg8cc-ghep__luoi { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); max-height: 196px; }
  .tg8cc-luoi { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }
  /* Lưới rộng (kaomoji kiểu ヾ(≧▽≦)ノ) phải nhắc lại ở đây: dòng trên cùng độ ưu tiên và đứng
     sau nên đè mất lưới rộng, mặt cười dài bị nhét vào ô 48px và chòi ra khỏi ô. */
  .tg8cc-luoi--rong { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .tg8cc-o { min-height: 48px; }
  .tg8cc-trong__i { grid-template-columns: 62px minmax(0, 1fr); gap: 8px; }
  .tg8cc-trong__chep { grid-column: 1 / -1; justify-self: start; }
  .tg8cc-chu { text-align: left; }
  .tg8cc-bao { bottom: 14px; }
  /* Màn hẹp: một cột. Hai cột thì mỗi ô chỉ còn ~160px, không đủ cho một tên viết liền. */
  .tg8cc-ten__luoi { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .tg8cc-ten__c { font-size: 15px; }
  .tg8cc-ten__cap { grid-column: span 1; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }

  /* Dưới 768px cái dính trên cùng là header tím 54px chứ không phải thanh menu 36px:
     tính theo --nav-height thì thanh A-Z chui mất 14px dưới header. */
  .tg8cc-az__chon { top: 58px; }
  .tg8cc-az__hang { grid-template-columns: 42px minmax(0, 1fr); gap: 8px; scroll-margin-top: 122px; }
  .tg8cc-az__chu { height: 38px; font-size: 19px; }
  .tg8cc-az__ds { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
}

/* Màn trung gian (máy bảng, cửa sổ hẹp): bốn cột làm mỗi ô dưới 180px, chữ lại vỡ. */
@media (min-width: 768px) and (max-width: 1100px) {
  .tg8cc-ten__luoi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tg8cc-ten__cap { grid-column: span 2; }
}

@media (prefers-reduced-motion: reduce) {
  .tg8cc-o, .tg8cc-dong, .tg8cc-bao { transition: none; }
  .tg8cc-o:active { transform: none; }
}
