/* ===== Card ===== */
.sd-hantu-card {
  position: relative;
  display: grid;
  gap: 10px;

  /* index | 2 cột nội dung | nút */
  grid-template-columns: 40px 1fr 1fr auto;
  align-items: center;

  background: #fff;
  border: 1px solid #e9e9ea;
  border-radius: 12px;
  padding: 10px;
  margin: 15px 0;
  border-left: 3px solid #5989cf;
}

.sd-hantu-card-index span {
  display: flex;
  justify-content: center;
  align-items: center;

  width: 28px;
  height: 28px;
  border-radius: 999px;

  text-align: center;
  color: #5989cf;
  background: #fff;
  border: 1px solid #e9e9ea;
  font-weight: 600;
}

.sd-hantu-pinyin {
  color: #777;
  margin-top: 4px;
  font-style: italic;
}

.sd-hantu-tag {
  font-size: 12px;
  color: #777;
  margin-top: 4px;
}

.sd-hantu-edit-btn {
  margin-left: auto;
  cursor: pointer;
  opacity: 0.9;
}

.sd-hantu-edit-btn svg {
  width: 28px;
  height: 28px;
  color: #c30e0e;
}

/* ===== Ví dụ ===== */
/* Chỉ áp cho span label đầu tiên, tránh đè lên span bên trong */
.sd-hantu-vidu > span:first-child {
  position: absolute;
  top: -15px;
  left: 12px;

  background: #fff;
  padding: 2px 10px;
  font-weight: bold;
  color: #41a577;
}

.sd-hantu-vidu {
  padding: 15px 10px 10px 10px;
  border: 2px dashed #41a577;
  border-radius: 10px;
  position: relative;
  margin: 20px 0px;
}

/* ===== HanziWriter boxes ===== */
.hantu-box-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  text-align: center;
}

.hantu-box-hinh {
  display: flex;
  align-content: center;
  justify-content: center;
  align-items: center;
}

.hantu-char {
  border: 3px solid #dfdfdf;
  border-radius: 10px;
  margin-bottom: 10px;
  margin-top: 10px;
  position: relative;
  overflow: hidden;
}

.hantu-char svg {
  position: relative;
  z-index: 1;
}

/* Đường kẻ dấu cộng ở giữa ô chữ */
.hantu-char::before,
.hantu-char::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background-color: #e0e0e0;
  pointer-events: none;
}

/* Đường kẻ dọc */
.hantu-char::before {
  width: 1px;
  height: 100%;
}

/* Đường kẻ ngang */
.hantu-char::after {
  width: 100%;
  height: 1px;
}

/* (Nếu bạn còn dùng id này ở đâu đó thì giữ, còn không có thể xóa) */
div#character-target-div {
  border: 2px solid #ccc;
  border-radius: 10px;
  margin: auto;
}

.hantu-box-nut {
  width: 200px;
  display: flex;
  gap: 10px;
  align-content: center;
  justify-content: center;
  align-items: center;
  margin: auto;
}

.hantu-box-nut button {
  height: 50px;
  width: 50px;
  border-radius: 100%;
  color: #cc1111;
  background: none;
  border: 2px solid #cc1111;

  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.hantu-box-nut button:hover {
  background: #ff5d96;
  color: #fff;
}

.hantu-box-nut button svg {
  width: 25px;
  height: 25px;
}

/* Nút 1 và 3 nhỏ hơn */
.hantu-box-nut button:first-child,
.hantu-box-nut button:last-child {
  height: 40px;
  width: 40px;
}

.hantu-box-nut button:first-child svg,
.hantu-box-nut button:last-child svg {
  width: 20px;
  height: 20px;
}

/* ===== View info ===== */
.sdhan-view {
  text-align: center;
  margin-top: 10px;
}

.sdhan-view span {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid #ccc;
  color: #777;
  border-radius: 5px;
  font-size: 14px;
}

/* ===== Luyện viết image ===== */
.sd-hantu-luyen-img {
  text-align: center;
  margin-top: 20px;
  margin-bottom: 10px;
}

.sd-hantu-luyen-img img {
  width: 100%;
  max-width: 500px;
}

/* ===== Loa đọc ví dụ chữ Hán ===== */
.sd-hantu-tts {
  position: relative;
  display: inline-block;
  cursor: pointer;
  white-space: nowrap;
}

.sd-hantu-tts::after {
  content: "🔊";
  position: relative;
  margin-left: 6px;
  top: -1px;
  font-size: 0.9em;
  opacity: 0.6;
}

.sd-hantu-tts:hover::after {
  opacity: 1;
}

/* ===== CSS hiển thị Hán Việt ===== */
.sd-hantu-btn {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  margin-top: 2px;

  font-size: 13px;
  font-weight: 500;

  color: #2c3e50;
  background: #f1f3f5;

  border: 1px solid #d0d7de;
  border-radius: 6px;

  line-height: 1.4;
  white-space: normal;
}

/* PHÂN TRANG */
/* ===== Pagination ===== */
.sd-hantu-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 25px 0;
  flex-wrap: wrap;
}

.sd-hantu-pagination button {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid #d0d7de;
  background: #fff;
  cursor: pointer;
  font-weight: 500;
}

.sd-hantu-pagination button.active {
  background: #5989cf;
  color: #fff;
  border-color: #5989cf;
}

.sd-hantu-pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
