/* 🛡️ Chống sao chép — Kho chữ Hán bản công khai (14/10/2026). Đi cùng kho-chong-chep.js. */

/* Không bôi đen, không nhấn giữ hiện menu Lưu ảnh/Sao chép (iOS/Android), không kéo ảnh ra ngoài. */
html.kc-chong-chep body {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
html.kc-chong-chep img, html.kc-chong-chep canvas, html.kc-chong-chep svg, html.kc-chong-chep video {
  -webkit-user-drag: none; user-drag: none;
  -webkit-touch-callout: none;
}
/* Ô nhập vẫn bôi đen/dán bình thường — khách phải dán được chữ cần tra. */
html.kc-chong-chep input, html.kc-chong-chep textarea, html.kc-chong-chep select,
html.kc-chong-chep [contenteditable="true"], html.kc-chong-chep img[alt^="Phiếu trang"] {
  -webkit-user-select: text; user-select: text;
  -webkit-touch-callout: default;
}

/* Dấu chìm truy vết: phủ cả trang, kể cả hộp nổi — không chặn thao tác (pointer-events:none). */
.kc-dau-chim {
  position: fixed; inset: 0; z-index: 2147483000; pointer-events: none;
  background-repeat: repeat; opacity: .055;
}

/* Màn che khi có dấu hiệu chụp màn hình / rời cửa sổ — ĐẶC, không phải làm mờ (mờ vẫn đọc được chữ to). */
.kc-man-che {
  position: fixed; inset: 0; z-index: 2147483600; display: none;
  align-items: center; justify-content: center; padding: 16px;
  background: #f4ecd8;
}
.kc-man-che.hien { display: flex; }
html.kc-dang-che .kh-trang { visibility: hidden; }
.kc-man-o {
  max-width: 420px; width: 100%; text-align: center; padding: 28px 22px;
  background: #fffaf0; border-radius: 22px; box-shadow: 0 12px 40px rgba(60, 40, 10, .18);
  color: #3a2e18; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.kc-man-ky { font-family: "Noto Serif TC", serif; font-size: 44px; color: #A8452F; line-height: 1.1; }
.kc-man-t { font-size: 20px; font-weight: 700; margin: 10px 0 6px; }
.kc-man-p { font-size: 15px; line-height: 1.5; color: #5d4f33; }
.kc-man-nut {
  margin-top: 18px; min-height: 48px; padding: 0 26px; border: 0; border-radius: 999px;
  background: #A8452F; color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
  transition: transform .15s;
}
.kc-man-nut:active { transform: scale(.96); }

/* Lời báo nhỏ dưới đáy. */
.kc-bao {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 2147483500;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 999px;
  background: rgba(40, 32, 14, .9); color: #fff; font-size: 14px; text-align: center;
  transition: opacity .2s, transform .2s;
}
.kc-bao.hien { opacity: 1; transform: translate(-50%, 0); }

/* In / Lưu PDF: giấy chỉ còn một dòng bản quyền. */
/* (Phiếu đồ chữ in qua body.kch-dang-in — tờ luyện viết, được in; mọi thứ khác ra giấy trắng.) */
@media print {
  html.kc-chong-chep body:not(.kch-dang-in) > * { display: none !important; }
  html.kc-chong-chep body:not(.kch-dang-in)::after {
    content: "Nội dung Kho chữ Hán thuộc bản quyền Thiên Nghĩa Hán Ngữ — không in được. Tra cứu tại baitap.thiennghiahanngu.com";
    display: block; padding: 40px; font: 16px sans-serif; color: #000;
  }
}

/* 🤖 Hộp "Xác minh bạn là người" — kho-app.js mở khi máy gác cổng nghi công cụ tự động (canXacMinh). */
.kh-xm-phu {
  position: fixed; inset: 0; z-index: 2147483400; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(40, 32, 14, .62);
}
.kh-xm-hop {
  width: 100%; max-width: 400px; max-height: calc(100dvh - 32px); overflow: auto;
  background: #fffaf0; border-radius: 22px; padding: 24px 20px; text-align: center; color: #3a2e18;
  box-shadow: 0 12px 40px rgba(60, 40, 10, .25);
}
.kh-xm-t { font-size: 19px; font-weight: 700; margin-bottom: 8px; }
.kh-xm-p { font-size: 15px; line-height: 1.5; color: #5d4f33; }
.kh-xm-o { margin: 16px auto 0; min-height: 10px; display: flex; justify-content: center; }
.kh-xm-loi { margin-top: 10px; font-size: 14px; color: #A8452F; }

/* 📱 Điện thoại / máy tính bảng: khối quý (lời chiết tự · hình ảnh gốc · tranh) mờ, chạm giữ mới rõ —
   ảnh chụp màn hình iPhone chỉ ra bản mờ. kho-chong-chep.js gắn html.kc-cam-ung + .kc-dang-giu. */
html.kc-cam-ung .kc-quy { position: relative; }
/* Chữ: trong suốt + bóng nhoè (filter trên cả khối sẽ nhoè luôn nhãn "Chạm giữ"); ảnh/canvas: blur. */
html.kc-cam-ung .kc-quy:not(.kc-dang-giu), html.kc-cam-ung .kc-quy:not(.kc-dang-giu) * {
  color: transparent !important; text-shadow: 0 0 9px rgba(58, 46, 24, .8) !important;
}
html.kc-cam-ung .kc-quy:not(.kc-dang-giu) img, html.kc-cam-ung .kc-quy:not(.kc-dang-giu) canvas { filter: blur(14px); }
html.kc-cam-ung .kc-quy img, html.kc-cam-ung .kc-quy canvas { transition: filter .12s; }
html.kc-cam-ung .kc-quy::after {
  content: "👆 Chạm giữ để đọc"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 8px 16px; border-radius: 999px; background: rgba(40, 32, 14, .78); color: #fff;
  font-size: 15px; font-weight: 600; white-space: nowrap; pointer-events: none; transition: opacity .12s;
  text-shadow: none !important; color: #fff !important; z-index: 2;
}
html.kc-cam-ung .kc-quy.kc-dang-giu::after { opacity: 0; }
/* 🔦 Khe đọc: đang giữ thì CHỈ dải quanh --kc-y (kho-chong-chep.js đặt, phía trên đầu ngón tay) hiện rõ, phần
   còn lại của khối trong suốt — ảnh chụp lúc đang giữ chỉ lấy được ~2 dòng. Nhãn hướng dẫn đổi theo. */
html.kc-cam-ung .kc-quy.kc-dang-giu {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent calc(var(--kc-y, 0px) - 58px),
    #000 calc(var(--kc-y, 0px) - 36px), #000 calc(var(--kc-y, 0px) + 36px), transparent calc(var(--kc-y, 0px) + 58px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, transparent calc(var(--kc-y, 0px) - 58px),
    #000 calc(var(--kc-y, 0px) - 36px), #000 calc(var(--kc-y, 0px) + 36px), transparent calc(var(--kc-y, 0px) + 58px), transparent 100%);
}
html.kc-cam-ung .kc-quy::after { content: "👆 Giữ ngón tay dưới dòng cần đọc"; }
/* Đang soi khe đọc: dấu chìm mã máy đậm lên — ảnh chụp lọt ra vẫn truy được máy nào. Buông tay là nhạt lại. */
html.kc-cam-ung.kc-dang-soi .kc-dau-chim { opacity: .16; }
/* Dấu chìm trên máy cảm ứng đậm hơn — ảnh chụp lọt ra phải đọc được SĐT/mã máy. */
html.kc-cam-ung .kc-dau-chim { opacity: .08; }   /* bản nhẹ 15/10/2026 — chỉ mã máy */
