/* ==========================================================================
   phat-dark · HỆ KHỐI HỌC — một nguồn style cho MỌI khối học tương tác:
   PA1 "Phòng tập" (.pd-tap trong thân bài: phan-loai · cham-cau · quyet-dinh)
   và PA2 "Bài học 15 phút" (.pd-hoc — bai-hoc.css chỉ còn khung 5 chặng +
   ghep-manh · soi-cho · ap-dung, dùng lại thành phần ở đây).
   Viết lại 24/09/2026 (J4, PRJ-045) theo lời Anh Phát "đồng bộ UIUX, PA01 và
   PA02 chưa đẹp mắt và ấn tượng". Công thức màu: DNA_PHIVAN_THAMMY.md — một
   sắc cam trải nhiều độ (nền .043 · chip .094 · viền .18 · bóng cùng màu),
   thêm 2 sắc trạng thái hoà tông ấm: ô liu (đúng) · đất nung (chưa đúng).
   Tương phản đo: danh_gia_2409_uiux/THIET_KE_HE_KHOI.md.
   Luật: mọi chuyển động nằm trong prefers-reduced-motion:no-preference và
   chỉ đi TỪ trạng thái ẩn VỀ trạng thái hiện (keyframes) — tắt animation thì
   phần tử đứng yên ở trạng thái hiện, không có gì kẹt opacity:0.
   ========================================================================== */

.pd-tap, .pd-hoc {
  --tap-nen: #1e1a13;
  --tap-cam-05: rgba(255, 138, 43, .043);
  --tap-cam-09: rgba(255, 138, 43, .094);
  --tap-cam-18: rgba(255, 138, 43, .18);
  --tap-kem-06: rgba(255, 241, 227, .06);
  --tap-kem-16: rgba(255, 241, 227, .16);
  --tap-ok: #b9ca7e;          /* ô liu ấm */
  --tap-ok-chu: #dbe6b3;
  --tap-ok-nen: rgba(185, 202, 126, .11);
  --tap-ok-vien: rgba(185, 202, 126, .42);
  --tap-sai: #e39272;         /* đất nung */
  --tap-sai-chu: #f5c6b3;
  --tap-sai-nen: rgba(227, 146, 114, .11);
  --tap-sai-vien: rgba(227, 146, 114, .42);
  --tap-chu: #f5ead8;
  --tap-chu-2: #d9cfbf;
  --tap-chu-3: #b3a894;
  --tap-nay: cubic-bezier(.34, 1.4, .64, 1);
  --tap-em: cubic-bezier(.2, .7, .3, 1);
}

/* ---------- Thẻ khối: nhấc khỏi thân bài ---------- */
.pd .pd-prose > .pd-tap { margin-top: 40px; }
.pd-tap, .pd-hoc__man {
  position: relative;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(255, 138, 43, .085), transparent 55%),
    linear-gradient(180deg, var(--tap-cam-05), transparent 60%),
    var(--tap-nen);
  border: 1px solid var(--tap-cam-18);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 48px -28px rgba(255, 138, 43, .30), 0 2px 0 0 rgba(255, 241, 227, .04) inset;
  padding: 26px clamp(18px, 4vw, 36px) 30px;
  color: var(--tap-chu);
  font-family: var(--font-body);
}
.pd-tap::before, .pd-hoc__man::before {
  content: ""; position: absolute; left: 28px; right: 28px; top: -1px; height: 2px;
  border-radius: 0 0 2px 2px; background: var(--o-grad-flat); opacity: .9;
}
/* nút / ô nhập không kế thừa font — ép về Be Vietnam Pro cho toàn hệ */
.pd-tap button, .pd-tap textarea, .pd-tap input,
.pd-hoc button, .pd-hoc textarea, .pd-hoc input { font-family: var(--font-body); letter-spacing: normal; }

/* Việc 4 (24/09/2026, WP1): nav .pd-nav sticky (giao-dien.css, KHÔNG đổi ở đây) che mất nút/ô
   đầu khối khi cuộn hoặc Tab focus tới, đo thấy ở 390px. Dùng lại đúng công thức "đáy nav + 12"
   đã áp cho #noi-dung / .pd-prose h2 trong giao-dien.css: mặc định 96px (đáy nav ~84 + 12),
   ≤612px nav xuống 2 hàng cao hơn (đáy nav 114) nên 126px — khớp số của h2 ở ngưỡng đó. */
.pd-tap button, .pd-tap textarea, .pd-tap input { scroll-margin-top: 96px; }
@media (max-width: 612px) {
  .pd-tap button, .pd-tap textarea, .pd-tap input { scroll-margin-top: 126px; }
}

.pd-tap noscript { display: block; }
.pd-tap__khong-js { margin: 0; padding: 14px 16px; border-left: 2px solid var(--o-500); font-size: 15px; line-height: 1.6; color: var(--color-neutral-300); }

/* ---------- Đầu khối: nhãn "Thực hành · Chặng x/M" + Làm lại ---------- */
.pd-tap__dau { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 12px; margin-bottom: 16px; }
.pd-tap__chang, .pd-hoc__so {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 10px; border-radius: 999px;
  background: var(--tap-cam-09); border: 1px solid var(--tap-cam-18);
  font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; line-height: 1.5;
  color: var(--o-300);
}
.pd-tap__chang svg, .pd-hoc__so svg { width: 16px; height: 16px; flex: none; color: var(--o-400); }

.pd-tap__tieude { margin: 0 0 8px; font-family: var(--font-heading); font-size: clamp(22px, 2.6vw, 27px); line-height: 1.3; color: var(--tap-chu); }
.pd-tap__de, .pd-hoc__de { margin: 0 0 22px; font-size: 17px; line-height: 1.6; color: var(--tap-chu); font-weight: 600; }

/* ---------- Nút chính / nút phụ ---------- */
.pd-tap-cc__cham, .pd-gm__kiem, .pd-sc__kiem, .pd-hoc__tiep, .pd-ad__chep, .pd-tap-cc__chep {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; background: var(--o-grad); color: var(--o-900);
  font-size: 15px; font-weight: 700; line-height: 1.3;
  padding: 13px 24px; min-height: 48px; border-radius: 999px; cursor: pointer;
  box-shadow: 0 8px 20px -10px rgba(255, 138, 43, .7);
  transition: transform .22s var(--tap-nay), box-shadow .22s ease, filter .22s ease;
}
.pd-tap-cc__cham svg, .pd-hoc__tiep svg { width: 18px; height: 18px; flex: none; }
.pd-tap__lai, .pd-tap-cc__mau-nut, .pd-hoc__lui, .pd-hoc__lai, .pd-ad__anh {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--tap-kem-16); background: var(--tap-kem-06); color: var(--tap-chu-2);
  font-size: 14px; font-weight: 600; line-height: 1.3;
  padding: 10px 18px; min-height: 44px; border-radius: 999px; cursor: pointer;
  transition: transform .22s var(--tap-nay), border-color .22s ease, color .22s ease, background .22s ease;
}
.pd-tap__lai svg, .pd-hoc__lai svg, .pd-hoc__lui svg { width: 16px; height: 16px; flex: none; }
@media (hover: hover) {
  .pd-tap-cc__cham:hover, .pd-gm__kiem:hover, .pd-sc__kiem:hover, .pd-hoc__tiep:hover:not(:disabled),
  .pd-ad__chep:hover, .pd-tap-cc__chep:hover { transform: translateY(-3px); box-shadow: var(--o-glow); }
  .pd-tap__lai:hover, .pd-tap-cc__mau-nut:hover, .pd-hoc__lui:hover, .pd-hoc__lai:hover, .pd-ad__anh:hover {
    border-color: var(--o-500); color: var(--o-200); background: var(--tap-cam-09); transform: translateY(-2px);
  }
}
.pd-tap-cc__cham:active, .pd-gm__kiem:active, .pd-sc__kiem:active, .pd-hoc__tiep:active:not(:disabled) { transform: translateY(0) scale(.98); }

.pd-tap :focus-visible, .pd-hoc :focus-visible { outline: 2px solid var(--o-300); outline-offset: 3px; }

/* ---------- Danh sách mục trong khối: MỘT lớp thẻ (không thẻ lồng thẻ) ---------- */
.pd-tap-bb-ds, .pd-tap-qd-ds { display: flex; flex-direction: column; counter-reset: tap-muc; }
.pd-tap-bb, .pd-tap-qd {
  position: relative; counter-increment: tap-muc;
  padding: 20px 0 20px 50px;
  border-top: 1px solid var(--tap-kem-06);
}
.pd-tap-bb:first-child, .pd-tap-qd:first-child { border-top: none; padding-top: 4px; }
.pd-tap-bb::before, .pd-tap-qd::before {
  content: counter(tap-muc, decimal-leading-zero);
  position: absolute; left: 0; top: 20px;
  width: 34px; height: 34px; border-radius: 999px; display: grid; place-items: center;
  background: var(--tap-cam-09); border: 1px solid var(--tap-cam-18);
  font-size: 12.5px; font-weight: 700; color: var(--o-300); line-height: 1;
}
.pd-tap-bb:first-child::before, .pd-tap-qd:first-child::before { top: 4px; }
.pd-tap-bb.is-xong::before, .pd-tap-qd.is-xong::before { background: var(--tap-ok-nen); border-color: var(--tap-ok-vien); color: var(--tap-ok-chu); }
.pd-tap-bb.is-truot::before, .pd-tap-qd.is-truot::before { background: var(--tap-sai-nen); border-color: var(--tap-sai-vien); color: var(--tap-sai-chu); }
.pd-tap-bb__bc, .pd-tap-qd__bc { margin: 4px 0 14px; font-size: 16.5px; line-height: 1.6; color: var(--tap-chu); }

/* ---------- Nút tuỳ chọn (pill) — dùng chung phan-loai · quyet-dinh · chip · mảnh ---------- */
.pd-tap-bb__ds { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0; }
.pd-tap-qd__hang { display: flex; flex-wrap: wrap; gap: 10px; }
.pd-tap-bb__nut, .pd-tap-qd__nut, .pd-ad__chip, .pd-gm__manh {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--tap-kem-16); background: var(--tap-kem-06); color: var(--tap-chu);
  font-size: 15px; font-weight: 600; line-height: 1.4; text-align: left;
  padding: 11px 20px; min-height: 46px; border-radius: 999px; cursor: pointer;
  transition: transform .22s var(--tap-nay), box-shadow .22s ease, border-color .22s ease, background .22s ease, color .22s ease, opacity .22s ease;
}
.pd-tap-qd__nut { flex: 1 1 220px; justify-content: center; border-radius: var(--radius-md); }
@media (hover: hover) {
  .pd-tap-bb__nut:hover:not(:disabled), .pd-tap-qd__nut:hover:not(:disabled), .pd-ad__chip:hover, .pd-gm__manh:hover:not(:disabled) {
    transform: translateY(-4px); border-color: var(--o-500); background: var(--tap-cam-09); color: var(--o-100);
    box-shadow: 0 12px 24px -10px rgba(255, 138, 43, .55);
  }
}
.pd-tap-bb__nut:disabled, .pd-tap-qd__nut:disabled { cursor: default; opacity: .5; }
.pd-tap-bb__nut.is-chon-dung, .pd-tap-qd__nut.is-chon-dung { opacity: 1; background: var(--tap-ok-nen); border-color: var(--tap-ok); color: var(--tap-ok-chu); box-shadow: 0 0 0 3px rgba(185, 202, 126, .12); }
.pd-tap-bb__nut.is-chon-sai, .pd-tap-qd__nut.is-chon-sai { opacity: 1; background: var(--tap-sai-nen); border-color: var(--tap-sai); color: var(--tap-sai-chu); }
.pd-tap-bb__nut.is-dap-an:not(.is-chon-dung) { opacity: 1; border-style: dashed; border-color: var(--tap-ok-vien); color: var(--tap-ok-chu); }
.pd-tap-ic { width: 16px; height: 16px; flex: none; }

/* ---------- Hộp phản hồi đúng / chưa đúng ---------- */
.pd-tap-ph, .pd-tap-bb__ph, .pd-tap-qd__ph {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 14px 0 0; padding: 14px 16px; border-radius: var(--radius-md);
  border: 1px solid var(--tap-kem-16); background: var(--tap-kem-06);
  font-size: 15px; line-height: 1.6; color: var(--tap-chu);
}
.pd-tap-bb__ph[hidden], .pd-tap-qd__ph[hidden] { display: none; }
.pd-tap-ph__dau {
  flex: none; width: 28px; height: 28px; margin-top: 0; border-radius: 999px;
  display: grid; place-items: center; color: var(--ground);
}
.pd-tap-ph__dau svg { width: 16px; height: 16px; }
.pd-tap-ph__than { flex: 1; min-width: 0; }
.la-dung.pd-tap-bb__ph, .la-dung.pd-tap-qd__ph, .pd-tap-ph.la-dung { background: var(--tap-ok-nen); border-color: var(--tap-ok-vien); }
.la-dung > .pd-tap-ph__dau { background: var(--tap-ok); }
.la-dung b { color: var(--tap-ok-chu); }
.la-sai.pd-tap-bb__ph, .la-sai.pd-tap-qd__ph, .pd-tap-ph.la-sai { background: var(--tap-sai-nen); border-color: var(--tap-sai-vien); }
.la-sai > .pd-tap-ph__dau { background: var(--tap-sai); }
.la-sai b { color: var(--tap-sai-chu); }

/* ---------- cham-cau ---------- */
.pd-tap-cc__goc, .pd-tap-cc__ket-k, .pd-sc__nhan, .pd-ad__nhan, .pd-ad__khoi-k {
  display: block; margin: 0 0 8px; font-size: 12.5px; letter-spacing: .07em; text-transform: uppercase; font-weight: 700; color: var(--o-300);
}
.pd-tap-cc__gocbox, .pd-sc__boican {
  margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius-md);
  background: rgba(0, 0, 0, .22); border-left: 3px solid var(--o-700);
  font-size: 15px; line-height: 1.6; color: var(--tap-chu-2);
}
.pd-tap-cc__o, .pd-ad__o {
  width: 100%; box-sizing: border-box; padding: 14px 16px;
  border: 1px solid var(--tap-kem-16); border-radius: var(--radius-md);
  background: rgba(0, 0, 0, .28); color: var(--tap-chu);
  font-size: 15.5px; line-height: 1.6;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.pd-tap-cc__o { min-height: 116px; resize: vertical; }
.pd-ad__o { min-height: 48px; }
.pd-tap-cc__o:focus, .pd-ad__o:focus { outline: none; border-color: var(--o-500); box-shadow: 0 0 0 4px rgba(255, 138, 43, .16); }
.pd-tap-cc__hang { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; margin-top: 14px; }
.pd-tap-cc__rieng { margin: 0; font-size: 13px; line-height: 1.5; color: var(--tap-chu-3); }
/* Việc 1 (24/09/2026, WP1): hướng dẫn thân thiện khi câu chưa đủ dài/đủ khác câu gốc để chấm —
   tông ấm trung tính (không phải màu "sai" của tiêu chí) vì đây chỉ là lời nhắc viết thêm. */
.pd-tap-cc__canhbao {
  margin: 14px 0 0; padding: 12px 16px; border-radius: var(--radius-md);
  background: var(--tap-cam-09); border-left: 3px solid var(--o-500);
  font-size: 14.5px; line-height: 1.55; color: var(--tap-chu-2);
}
.pd-tap-cc__canhbao[hidden] { display: none; }

/* Điểm "Đạt x/5": vòng tiến độ + chữ */
.pd-tap-cc__kq, .pd-sc__ketqua { margin-top: 20px; }
.pd-tap-cc__kq[hidden], .pd-sc__ketqua[hidden] { display: none; }
.pd-tap-diem, .pd-tap-cc__diem, .pd-sc__diem {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 14px; font-family: var(--font-heading); font-size: 22px; line-height: 1.4; font-weight: 800; color: var(--tap-chu);
}
.pd-tap-vong {
  --tl: 0; flex: none; width: 52px; height: 52px; border-radius: 999px; position: relative;
  background: conic-gradient(var(--o-500) calc(var(--tl) * 1turn), rgba(255, 241, 227, .09) 0);
}
.pd-tap-vong::after {
  content: ""; position: absolute; inset: 6px; border-radius: 999px; background: var(--tap-nen);
}
.pd-tap-vong.is-du { background: conic-gradient(var(--tap-ok) 1turn, transparent 0); }
.pd-tap-vong svg { position: absolute; inset: 0; margin: auto; width: 22px; height: 22px; z-index: 1; color: var(--tap-ok); }
.pd-tap-diem__phu { display: block; font-family: var(--font-body); font-size: 13px; font-weight: 600; color: var(--tap-chu-3); letter-spacing: 0; }

.pd-tap-cc__ds, .pd .pd-prose .pd-tap-cc__ds { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pd-tap-cc__tc {
  display: flex; align-items: flex-start; gap: 12px; padding: 11px 14px; border-radius: var(--radius-md);
  border: 1px solid transparent; font-size: 15px; line-height: 1.55;
}
.pd-tap-cc__tc > svg {
  flex: none; width: 24px; height: 24px; padding: 5px; border-radius: 999px; margin-top: 0; color: var(--ground);
}
.pd-tap-cc__tc.la-dat { background: var(--tap-ok-nen); color: var(--tap-chu); }
.pd-tap-cc__tc.la-dat > svg { background: var(--tap-ok); }
.pd-tap-cc__tc.la-truot { background: var(--tap-kem-06); border-color: var(--tap-kem-06); color: var(--tap-chu-2); }
.pd-tap-cc__tc.la-truot > svg { background: var(--tap-sai); }
.pd-tap-cc__meo { display: block; margin-top: 3px; font-size: 14px; color: var(--o-200); }

.pd-tap-cc__mau-nut { margin-top: 16px; }
.pd-tap-cc__mau { margin-top: 12px; padding: 16px 18px; border-radius: var(--radius-md); background: var(--tap-cam-09); border: 1px solid var(--tap-cam-18); }
.pd-tap-cc__mau[hidden] { display: none; }
.pd-tap-cc__mau p { margin: 0; font-size: 15px; line-height: 1.65; color: var(--tap-chu); }

/* Hộp "Câu lệnh của bạn" */
.pd-tap-cc__ket, .pd-ad__khoi--chinh {
  margin-top: 20px; padding: 18px 18px 16px; border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--tap-cam-09), var(--tap-cam-05)); border: 1px solid var(--tap-cam-18);
}
.pd-tap-cc__ket[hidden] { display: none; }
.pd-tap-cc__ket-box { margin: 0; font-size: 15.5px; line-height: 1.65; color: var(--tap-chu); white-space: pre-wrap; font-family: var(--font-body); }
.pd-tap-cc__chep { margin-top: 14px; }
.pd-tap-cc__chep-bao, .pd-ad__bao { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; font-size: 13.5px; font-weight: 600; color: var(--tap-ok-chu); }

/* ---------- quyet-dinh: tổng kết ---------- */
.pd-tap-qd__tongket { margin-top: 20px; padding: 18px; border-radius: var(--radius-md); background: linear-gradient(180deg, var(--tap-cam-09), var(--tap-cam-05)); border: 1px solid var(--tap-cam-18); }
.pd-tap-qd__tongket[hidden] { display: none; }
.pd-tap-qd__tongket > p:first-child { margin: 0 0 10px; font-size: 17px; line-height: 1.6; color: var(--tap-chu); font-family: var(--font-heading); font-weight: 700; }

/* ---------- Vi chuyển động: hiện ra (fade + trượt 8px) · pop icon ---------- */
@media (prefers-reduced-motion: no-preference) {
  .pd-tap-vao { animation: tap-vao .26s var(--tap-em) both; }
  .la-dung > .pd-tap-ph__dau, .pd-tap-vong.is-du svg { animation: tap-pop .42s var(--tap-nay) .06s both; }
  .pd-tap-cc__tc { animation: tap-vao .26s var(--tap-em) both; }
  .pd-tap-cc__tc:nth-child(2) { animation-delay: .04s; }
  .pd-tap-cc__tc:nth-child(3) { animation-delay: .08s; }
  .pd-tap-cc__tc:nth-child(4) { animation-delay: .12s; }
  .pd-tap-cc__tc:nth-child(5) { animation-delay: .16s; }
  .pd-tap-vong { transition: --tl .5s var(--tap-em); }
}
@keyframes tap-vao { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes tap-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@property --tl { syntax: "<number>"; inherits: true; initial-value: 0; }

/* nhãn + nút không bao giờ gãy 2 dòng */
.pd-tap__chang, .pd-hoc__so, .pd-tap__lai, .pd-hoc__lai, .pd-hoc__lui { white-space: nowrap; }
@media (max-width: 480px) {
  .pd-tap__chang, .pd-hoc__so { font-size: 11.5px; letter-spacing: .04em; padding: 6px 11px 6px 9px; }
  .pd-tap__lai { padding: 10px 14px; }
  .pd-tap, .pd-hoc__man { padding: 22px 16px 24px; border-radius: 22px; }
  .pd-tap::before, .pd-hoc__man::before { left: 20px; right: 20px; }
  .pd-tap-bb, .pd-tap-qd { padding-left: 0; padding-top: 52px; }
  .pd-tap-bb:first-child, .pd-tap-qd:first-child { padding-top: 44px; }
  .pd-tap-bb::before, .pd-tap-qd::before { top: 12px; width: 30px; height: 30px; }
  .pd-tap-bb:first-child::before, .pd-tap-qd:first-child::before { top: 2px; }
  .pd-tap-qd__hang { flex-direction: column; }
  .pd-tap-qd__nut { flex: 1 1 auto; }
  .pd-tap-bb__nut { flex: 1 1 auto; justify-content: center; }
}
