/* Grid responsive */
.sd-hantu-grid{
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1024px){
  .sd-hantu-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px){
  .sd-hantu-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Card wrapper – KHÔNG KHUNG */
.sd-hantu-grid-card{
  cursor: pointer;
  user-select: none;
  perspective: 1000px;
  background: transparent;
  border: 0;
  box-shadow: none;
  outline: 0;
  -webkit-tap-highlight-color: transparent;
}

/* 3D container */
.sd-hantu-grid-card3d{
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  transform-style: preserve-3d;
  transition: transform .45s ease;
  border-radius: 14px;
}

/* Flip */
.sd-hantu-grid-card.is-flipped .sd-hantu-grid-card3d{
  transform: rotateY(180deg);
}

/* Faces */
.sd-hantu-grid-face{
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 14px;

  /* ❌ bỏ hoàn toàn khung */
  border: 0;
  outline: 0;
  box-shadow: none;
}

/* ===================== */
/* MẶT TRƯỚC – NHIỀU MÀU */
/* ===================== */
.sd-hantu-grid-face.sd-front{
  color: #111;
}

/* ===================== */
/* MẶT SAU – 1 MÀU DUY NHẤT */
/* ===================== */
.sd-hantu-grid-face.sd-back{
  transform: rotateY(180deg);

  /* 👉 đổi màu ở đây nếu muốn */
  background: #f1f5f9;   /* xám xanh nhạt, rất nhẹ mắt */
  color: #111;
}

/* Text */
.sd-hantu-grid-han{
  font-size: 24px;
  font-weight: 360;
  line-height: 1;
  margin-bottom: 8px;
}
.sd-hantu-grid-pinyin{
  font-size: 16px;
  opacity: .9;
}
.sd-hantu-grid-meaning{
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  padding: 0 10px;
  margin-bottom: 6px;
}
.sd-hantu-grid-hv{
  font-size: 15px;
  opacity: .9;
}

/* ===================== */
/* PALETTE MÀU MẶT TRƯỚC */
/* ===================== */
.sd-hantu-grid-card.sd-c1 .sd-front{ background:#ffd6e7; }
.sd-hantu-grid-card.sd-c2 .sd-front{ background:#d7f5ff; }
.sd-hantu-grid-card.sd-c3 .sd-front{ background:#e6ffda; }
.sd-hantu-grid-card.sd-c4 .sd-front{ background:#fff3bf; }
.sd-hantu-grid-card.sd-c5 .sd-front{ background:#e9ddff; }
.sd-hantu-grid-card.sd-c6 .sd-front{ background:#ffe3d6; }
.sd-hantu-grid-card.sd-c7 .sd-front{ background:#d9f7e8; }
.sd-hantu-grid-card.sd-c8 .sd-front{ background:#dde7ff; }

/* ===================== */
/* PAGER (Lazy load: 40 thẻ/lần) */
/* ===================== */
.sd-hantu-pager{
  display: flex;
  flex-direction: column;   /* chữ xuống dưới */
  align-items: center;
  gap: 8px;
  margin: 18px 0 26px;
}

/* Hàng chứa 2 nút */
.sd-hantu-pager-row{
  display: flex;
  gap: 14px;
  justify-content: center;
  align-items: center;
}

/* ===== NÚT XANH LÁ ===== */
.sd-hantu-pager-btn{
  appearance: none;
  border: 0;
  border-radius: 12px;
  min-width: 130px;
  height: 44px;
  padding: 0 18px;

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

  font-size: 15px;
  font-weight: 700;

  background: #22c55e;          /* 🌿 XANH LÁ */
  color: #ffffff;

  cursor: pointer;
  transition:
    background .2s ease,
    transform .15s ease,
    box-shadow .15s ease;
}

.sd-hantu-pager-btn:hover{
  background: #16a34a;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(34,197,94,.35);
}

.sd-hantu-pager-btn:active{
  transform: translateY(0);
  box-shadow: 0 3px 8px rgba(34,197,94,.25);
}

.sd-hantu-pager-btn:disabled{
  background: #bbf7d0;
  color: #166534;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Dòng chữ trạng thái */
.sd-hantu-pager-status{
  font-size: 14px;
  opacity: .75;
  text-align: center;
  white-space: nowrap;
}

/* Mobile */
@media (max-width: 640px){
  .sd-hantu-pager-row{
    width: 100%;
  }
  .sd-hantu-pager-row .sd-hantu-pager-btn{
    width: 48%;
    min-width: 0;
  }
}

/* ===== STAR 6 CÁNH – KHÔNG NHẦM QUỐC KỲ ===== */
/* ===== STAR DỄ THƯƠNG – NỀN ĐỎ ===== */
.sd-hantu-grid-card{
  position: relative;
}

.sd-star-btn{
  position:absolute;
  top:10px;
  right:10px;
  z-index:3;

  width:40px;
  height:40px;
  border-radius:50%;
  border:0;
  padding:0;

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

  background:#e53935; /* 🔴 nền đỏ */
  cursor:pointer;

  box-shadow:0 6px 14px rgba(229,57,53,.35);
}

/* icon sao */
.sd-star-ico{
  width:24px;
  height:24px;
}

/* sao vàng – KHÔNG VIỀN */
.sd-star-ico path{
  fill:#ffeb3b; /* 🟡 vàng */
}

/* chưa chọn → làm mờ */
.sd-hantu-grid-card:not(.sd-starred) .sd-star-btn{
  background:rgba(0,0,0,.35);
  box-shadow:none;
}
.sd-hantu-grid-card:not(.sd-starred) .sd-star-ico path{
  fill:rgba(255,255,255,.7);
}

/* hover / active */
.sd-star-btn:hover{
  transform: translateY(-1px);
}
.sd-star-btn:active{
  transform: scale(.96);
}

/* ===== TOGGLE: Chỉ xem thẻ ⭐ ===== */
.sd-hantu-toggle{
  appearance:none;
  border:0;
  border-radius:12px;
  height:42px;
  padding:0 16px;

  font-size:14px;
  font-weight:700;

  background:#111;
  color:#fff;

  cursor:pointer;
  transition:
    background .2s ease,
    transform .15s ease,
    box-shadow .15s ease,
    opacity .15s ease;
}

/* Hover */
.sd-hantu-toggle:hover{
  background:#222;
  transform: translateY(-1px);
  box-shadow:0 6px 14px rgba(0,0,0,.25);
}

/* Active (khi bấm) */
.sd-hantu-toggle:active{
  transform: translateY(0);
  box-shadow:0 3px 8px rgba(0,0,0,.2);
}

/* Khi đang BẬT (aria-pressed=true) */
.sd-hantu-toggle[aria-pressed="true"]{
  background:#ffeb3b;          /* vàng */
  color:#d32f2f;               /* đỏ */
  box-shadow:0 6px 14px rgba(255,235,59,.35);
}
