/* TAB «HẬU KỲ» — bố cục mới (anh duyệt từng phần 06/11/2026; vào bản thật 07/11, nhánh d6-hau-ky-that). Nạp SAU luxury*.css: dùng token «Đêm vàng».
 * Phần tử `.hk-*` do web/man/hau-ky-bo-cuc*.js · hau-ky-hinh*.js thêm; mọi khối cũ chỉ được DỜI chỗ (cùng id / data-hd / .mieng), không xoá.
 * Màu cố định còn lại là màu của HÌNH MINH HOẠ (ô mẫu, huy hiệu mẫu, dải phủ): chúng mô tả kết quả, không phải da của app. Không bóng đổ (luxury): tách khối bằng kẻ 1px. */

/* ── KHUNG: bàn xem DÍNH trái · bàn sửa phải ───────────────────
 * Đầu tab giữ NGUYÊN thứ tự của vỏ: tên tab → mô tả → băng chiếu `#dai-ket-qua` → khe quảng cáo → dải giới thiệu → công cụ (anh 07/11: không gập, không ẩn khối nào của đầu tab). */
#khu .st-cot { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr); gap: var(--k-5); align-items: start }
#khu .st-cot > .trai { position: sticky; top: var(--k-3); min-width: 0; display: flex; flex-direction: column; gap: var(--k-3); max-height: calc(100vh - var(--k-5)); overflow: auto }
#khu .st-cot > .phai { min-width: 0; display: flex; flex-direction: column; gap: var(--k-3) }
#st-dong-thu { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--k-2); margin: 0 0 var(--k-3) !important; padding: var(--k-2) var(--k-3); border: 1px solid var(--vien); border-radius: var(--bo); background: var(--sau) }
#st-dong-thu #st-ten { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch }

/* ── ⓘ chi tiết: thẻ thông tin cũ gập vào nút, mở thành khung nổi ── */
.hk-ct { font: inherit; cursor: pointer; border: 1px solid var(--vien); background: var(--nen); border-radius: var(--bo-vien, var(--bo-lon)); padding: 0 var(--k-3); min-height: var(--cao-dk, 40px); color: var(--chu) }
.hk-ct[aria-expanded="true"] { border-color: var(--vien-chon); box-shadow: 0 0 0 1px var(--vien-chon) }
#st-doc > .tam:first-child { display: none }
.hk-mo-ct #st-doc > .tam:first-child { display: block; position: fixed; z-index: var(--lop-hop-phu); top: calc(var(--k-6) * 4); left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - var(--k-6))); max-height: 70vh; overflow: auto; border: 1px solid var(--vien-chon) }
.hk-mo-ct::before { content: ""; position: fixed; inset: 0; z-index: var(--lop-hop-phu); background: var(--nen-phu) }

/* ── BÀN XEM: một ô lớn, công tắc Bản đang mở · Xem thử · Bản gốc ─ */
/* Nút trong con nhộng bỏ lề chung của `.mieng` (0 8px 8px 0) — lề ấy làm con nhộng dư 8px đáy và mép phải, nút lệch khỏi vùng chứa (anh báo 09/11/2026); đệm + khe đều bốn phía. */
.hk-cong { display: inline-flex; border: 1px solid var(--vien); border-radius: var(--bo-vien, var(--bo-lon)); overflow: hidden; align-self: flex-start; padding: var(--k-1); gap: var(--k-1) }
.hk-cong button { font: inherit; border: 0; background: var(--nen); color: var(--chu); padding: var(--k-1) var(--k-4); min-height: var(--cao-dk, 40px); cursor: pointer; margin: 0; border-radius: var(--bo-vien, var(--bo-lon)) }
@container khu (max-width: 560px) { .hk-cong button { padding-inline: var(--k-2); white-space: nowrap } }
@container khu (max-width: 340px) { .hk-cong button { white-space: normal } }
.hk-cong button[aria-pressed="true"] { background: var(--nut-dam); color: var(--nut-chu) }
#st-doc { display: flex; flex-direction: column; gap: var(--k-3) }
#st-doc > .tam:nth-child(2) { padding: var(--k-3); display: flex; flex-direction: column; gap: var(--k-3) }
#st-doc > .tam:nth-child(2) > h3, #st-doc > .tam:nth-child(2) > p.nhat { display: none }
.st-sanh { display: block !important }
.st-sanh > div { width: 100% }
.st-sanh .st-nhan, .hk-mo .st-nhan { margin: 0 0 var(--k-1) }
.st-sanh .goc img, .st-sanh .goc video, #f-xem-thu img, #f-xem-thu video, .hk-mo img { display: block; max-width: 100%; width: auto; max-height: calc(100vh - 400px); min-height: 120px; margin-inline: auto; object-fit: contain; background: var(--nen-anh); border-radius: var(--bo) }
/* ba chế độ: mo (đang mở, mặc định) · sua (Xem thử) · goc (bản gốc để so). Video / ảnh động dùng ô «Bản đang sống» thật. */
.hk-bc[data-hk-ban="mo"] .st-sanh > div:nth-child(1), .hk-bc[data-hk-ban="sua"] .st-sanh > div:nth-child(2) { display: none }
.hk-bc[data-hk-ban="goc"] .st-sanh > div:nth-child(1) { display: none }
.hk-bc[data-hk-ban="mo"]:not([data-hk-vid]) .st-sanh { display: none !important }
.hk-bc[data-hk-ban="mo"][data-hk-vid] .st-sanh > div:nth-child(2) { display: block }
.hk-mo { display: none }
.hk-bc[data-hk-ban="mo"]:not([data-hk-vid]) .hk-mo { display: block }
/* dải phiên bản NGANG dưới ô xem */
#st-doc > .tam:nth-child(3) { padding: var(--k-2) var(--k-3) }
#st-doc > .tam:nth-child(3) > p.nhat { display: none }
#st-doc > .tam:nth-child(3) > h3 { font-size: var(--cs-ban); margin: 0 0 var(--k-2) }
#st-doc .phien-ban { display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important; overflow-x: auto; gap: var(--k-2); padding-bottom: var(--k-1); max-height: none !important }
#st-doc .phien-ban .ngoi { flex: 0 0 auto; width: 96px }
#st-doc .phien-ban .ngoi img { width: 96px; height: 64px; object-fit: cover }

/* ── BÀN SỬA: hàng thẻ, «Vẽ lại hình ₫» nút riêng ────────────── */
#st-ban > .tam { padding: var(--k-3) }
/* 08/11 (Vier, anh chê thẻ Kịch bản): mọi luật `.tc-dai` ở đây viết cho bàn sửa Hậu kỳ nhưng KHÔNG gác theo tab, lại có `!important` — rò sang hai tab Kịch bản: nuốt dòng trạng thái `.tc-tt` của bốn mục Bối cảnh, ép hai nút «Tạo mới / Đã có» thành khối ngà + dải tối. Nay gác bằng `body[data-man="hau-ky"]` (id màn Hậu kỳ, `app.js` đặt `body.dataset.man`). Hậu kỳ chụp trước/sau: 0 điểm ảnh khác. */
body[data-man="hau-ky"] .tc-dai { display: flex !important; gap: var(--k-2) !important; align-items: stretch; flex-wrap: nowrap }
body[data-man="hau-ky"] .tc-dai .tc-nut { flex: 1 1 0; min-width: 0; display: flex !important; flex-direction: column; align-items: center; justify-content: flex-start; gap: var(--k-1); padding: var(--k-2) var(--k-1); text-align: center }
body[data-man="hau-ky"] .tc-dai .tc-nut .tc-ten { font-size: var(--cs-phu); line-height: var(--dong-chat); overflow-wrap: anywhere }
body[data-man="hau-ky"] .tc-dai .tc-nut .tc-tt { display: none }
body[data-man="hau-ky"] .tc-dai .tc-nut[data-tab="ve-lai"] { flex: 0 0 auto; margin-left: var(--k-2); border: 1px solid var(--canh); background: var(--nen-chan); color: var(--chu); padding-inline: var(--k-3); justify-content: center }
body[data-man="hau-ky"] .tc-dai .tc-nut[data-tab="ve-lai"][aria-selected="true"] { border-color: var(--vien-chon); box-shadow: 0 0 0 1px var(--vien-chon) }
.hk-the-ic .ic, .hk-nut-ic .ic, .hk-ic .ic { display: block }
/* bốn thẻ chính: ảnh phủ kín nút, tên ở đáy trên dải tối chuyển dần */
body[data-man="hau-ky"] .tc-dai .tc-nut:not([data-tab="ve-lai"]) { position: relative; overflow: hidden; padding: 0 !important; min-height: 78px; justify-content: flex-end; border: 2px solid transparent; background: var(--nen-anh); border-radius: var(--bo) }
body[data-man="hau-ky"] .tc-dai .tc-nut:not([data-tab="ve-lai"]) .hk-tv { position: absolute; inset: 0; display: block; filter: brightness(.7); transition: filter var(--tg-vua) var(--ez-doi) }
body[data-man="hau-ky"] .tc-dai .tc-nut[aria-selected="true"]:not([data-tab="ve-lai"]) .hk-tv { filter: brightness(1.05) }
body[data-man="hau-ky"] .tc-dai .tc-nut[aria-selected="true"]:not([data-tab="ve-lai"]) { border-color: var(--vien-chon); box-shadow: 0 0 0 1px var(--vien-chon) }
body[data-man="hau-ky"] .tc-dai .tc-nut:not([data-tab="ve-lai"]) .tc-ten { position: relative; z-index: var(--lop-trong-the); width: 100%; box-sizing: border-box; padding: var(--k-5) var(--k-1) var(--k-1); color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .78) 60%); font-weight: 400 }
body[data-man="hau-ky"] .tc-dai .tc-nut[aria-selected="true"]:not([data-tab="ve-lai"]) .tc-ten { font-weight: 700 }
.hk-tv-bg { position: absolute; inset: 0; background-size: cover; background-position: center; display: block }
.hk-tv-aa { position: absolute; left: var(--k-2); top: var(--k-1); color: #fff; font-size: var(--cs-so); line-height: var(--dong-chat); font-weight: 700; text-shadow: 0 1px 4px rgba(0, 0, 0, .7) }
.hk-tv-hh { position: absolute; right: var(--k-1); top: var(--k-1); background: #20409a; color: #fff; font-size: var(--cs-nho); line-height: var(--dong-chat); font-weight: 700; padding: var(--k-0) var(--k-2); border-radius: var(--bo-lon) }
.hk-tv-cat { position: absolute; left: 22%; right: 22%; top: 14%; bottom: 36%; border: 2px solid #fff; box-shadow: 0 0 0 80px rgba(0, 0, 0, .6); display: block }
.hk-tv-tong { clip-path: inset(0 0 0 50%); filter: sepia(.55) saturate(1.3) hue-rotate(-12deg) }

/* ── Thẻ Chữ: Nội dung + ô mẫu, rồi bốn thẻ con ─────────────── */
.hk-nd { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 168px); gap: var(--k-3); align-items: stretch; margin-bottom: var(--k-3) }
.hk-nd label, .hk-nd legend { display: block; margin: 0 0 var(--k-1); padding: 0 }
.hk-nd input { width: 100% }
.hk-nd-o { display: flex; flex-direction: column; gap: var(--k-2); min-width: 0 }
.hk-nd-o:last-child { gap: 0 } /* ô mẫu cao đúng bằng cột nhập: mép trên khớp nhãn «Tiêu đề», mép dưới khớp ô «Dòng phụ» */
.hk-mau { position: relative; flex: 1 1 auto; min-height: 128px; border-radius: var(--bo); overflow: hidden; background-size: cover; background-position: center; border: 1px solid var(--vien); display: flex; flex-direction: column; justify-content: flex-end; padding: var(--k-2); gap: var(--k-0) }
.hk-mau::before { content: ""; position: absolute; inset: 0; background: var(--hk-phu, linear-gradient(transparent 35%, rgba(0, 0, 0, .66))) }
.hk-mau > * { position: relative; overflow-wrap: anywhere; max-width: 100% }
.hk-mau .td { font-weight: 700; line-height: var(--dong-chat) }
.hk-mau .dp { line-height: var(--dong-chat) }
#f-chu-xem { display: none }
.hk-con-dai { display: flex; gap: var(--k-2); flex-wrap: wrap; margin-bottom: var(--k-3) }
.hk-con-dai button { font: inherit; display: inline-flex; gap: var(--k-1); align-items: center; border: 1px solid var(--vien); background: var(--nen); border-radius: var(--bo); padding: var(--k-1) var(--k-3); min-height: var(--cao-dk, 40px); cursor: pointer; color: var(--chu) }
.hk-con-dai button[aria-selected="true"] { border-color: var(--vien-chon); box-shadow: 0 0 0 1px var(--vien-chon); background: var(--sau) }
.hk-g { width: 20px; height: 14px; border-radius: var(--bo-nho); border: 1px solid var(--vien); flex: none; position: relative }
.hk-g.td::before { content: "Aa"; font-weight: 700; font-size: var(--cs-nho); line-height: var(--dong-chat); padding-left: var(--k-0) }
.hk-g.dp::before { content: "Aa"; font-size: var(--cs-nho); line-height: var(--dong-chat); padding-left: var(--k-0); transform: scale(.8); transform-origin: left center; display: block }
.hk-g.phu { background: linear-gradient(transparent, rgba(0, 0, 0, .66)), var(--vien-sang) }
.hk-g.vt::after { content: ""; position: absolute; left: var(--k-0); bottom: var(--k-0); width: 7px; height: 4px; background: var(--vien-chon) }
.hk-con[hidden] { display: none !important }
.hk-con > fieldset { border: 0; padding: 0; margin: 0 }
.hk-con > fieldset > legend { display: none }
.hk-con > div, .hk-con > .hk-hang2 { margin-bottom: var(--k-3) }
.hk-hang2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--k-3) var(--k-4); align-items: start }
@container khu (max-width: 560px) { .hk-hang2 { grid-template-columns: minmax(0, 1fr) } }
#f-font-tieu-de, #f-font-dong-phu { width: 100% }
.hk-dem { margin-left: var(--k-2); font-size: var(--cs-phu); line-height: var(--dong-chat); font-weight: 700; padding: var(--k-0) var(--k-2); border-radius: var(--bo-lon); background: var(--sau); border: 1px solid var(--vien) }
.hk-sym { font-weight: 700 }

/* ── THANH Ghi chú + Xem thử + Xuất lại DÍNH đáy cột phải ────── */
#st-lam { position: sticky; bottom: 0; z-index: var(--lop-dinh); margin-top: auto }
#st-lam > .tam { padding: var(--k-2) var(--k-3); border-top: 1px solid var(--vien-chon); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--k-2) var(--k-3); align-items: end }
#st-lam label { margin: 0 }
#st-lam label .nhat { display: none }
#st-lam #f-ghi-chu { width: 100% }
#st-lam .ban-nut#st-lam-xuat:not([hidden]) { display: flex !important; gap: var(--k-2); margin: 0 }
#st-lam .ban-nut[hidden] { display: none !important }
#st-lam .ban-nut#st-lam-xuat > span.nhat { display: none }
#st-lam .ban-nut button { display: inline-flex; gap: var(--k-1); align-items: center; justify-content: center; flex: 1 1 0 }
#st-lam .canh, #st-lam #st-lam-ve-lai { grid-column: 1 / -1 }

/* ── NÚT LỰA CHỌN THÀNH HÌNH + nhãn nhỏ ──────────────────────── */
.mieng.hk-co-hinh { display: inline-flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: var(--k-1); min-height: 56px; min-width: 64px; position: relative }
.hk-v { display: flex; flex-direction: column; align-items: center; gap: var(--k-1); line-height: var(--dong-chat) }
.hk-v small { font-size: var(--cs-nho); line-height: var(--dong-chat); color: var(--chu-nhat); max-width: 96px; text-align: center; overflow-wrap: anywhere }
.hk-aa { font-weight: 700; line-height: var(--dong-chat); min-height: 22px; display: inline-flex; align-items: flex-end; font-family: var(--phong-chu, inherit) }
.hk-dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--vien-nut); box-sizing: border-box; display: block }
#f-mau-chu .mieng.hk-co-hinh, #f-mau-chu-phu .mieng.hk-co-hinh, #f-hieu .mieng.hk-co-hinh:has(.hk-dot) { background: none; border-color: transparent; box-shadow: none; min-width: 0; padding: var(--k-1) }
#f-mau-chu .hk-dot, #f-mau-chu-phu .hk-dot, #f-hieu .hk-dot { width: 36px; height: 36px }
.mieng.chon .hk-dot { border-color: var(--vien-chon); outline: 2px solid var(--vien-chon); outline-offset: 2px }
.hk-theo { font-size: var(--cs-tab); line-height: var(--dong-chat) }
.hk-img.hk-bong { width: 96px; height: 48px }
.hk-img.hk-bong > b { position: absolute; inset: 0; display: grid; place-items: center; left: 0; top: 0; color: #fff; font-size: var(--cs-de); line-height: var(--dong-chat); font-weight: 700 }
.hk-img { position: relative; display: block; width: 88px; height: 54px; border-radius: var(--bo-nho); overflow: hidden; background-size: cover; background-position: center; background-color: var(--nen-anh) }
.hk-img.hk-169 { height: 50px }
.hk-img > i { position: absolute; inset: 0 }
.hk-img > b { position: absolute; left: var(--k-1); top: var(--k-0); color: #fff; font-size: var(--cs-nho); line-height: var(--dong-chat); font-weight: 700 }
.hk-img > u { position: absolute; width: 38%; height: 26%; background: rgba(255, 255, 255, .92); border-radius: var(--bo-nho); box-shadow: 0 0 0 1px rgba(0, 0, 0, .4) }
.hk-aa-phu { position: absolute; left: var(--k-1); bottom: var(--k-0); font-size: var(--cs-tab); line-height: var(--dong-chat); font-weight: 700 }
.hk-src { height: auto; overflow: hidden }
.hk-src > em { position: absolute; border: 3px solid #fff; box-shadow: 0 0 0 60px rgba(0, 0, 0, .68); box-sizing: border-box }
.hk-rec-box { display: grid; place-items: center; width: 100%; height: 62px }
.hk-rec { display: block; background-size: cover; background-position: center; border-radius: var(--bo-nho); border: 1px solid var(--vien-nut); box-sizing: border-box; background-repeat: no-repeat }
.hk-tick { display: none; position: absolute; right: var(--k-0); top: var(--k-0); width: 16px; height: 16px; border-radius: 50%; background: var(--vien-chon); color: var(--nut-chu); font-size: var(--cs-nho); line-height: 16px; font-weight: 700; text-align: center; font-style: normal }
.mieng.chon .hk-tick { display: block }
.hk-mi { color: var(--chu) }
.hk-chu s { position: absolute; left: 8%; height: 4px; background: #fff; border-radius: var(--bo-nho); box-shadow: 0 0 2px #000 }
.hk-chu s:nth-of-type(1) { top: 36%; width: 60% }
.hk-chu s:nth-of-type(2) { top: 56%; width: 40% }
.hk-chu-md s { background: rgba(255, 255, 255, .45) }
.hk-chu-tl s { transform: translateY(5px) }
.hk-chu b { position: absolute; right: var(--k-1); top: var(--k-1); color: #fff; font-size: var(--cs-chinh) }
.hk-hh { display: block; background: #20409a; width: 30px; height: 16px }
.hk-hh-vien { border-radius: var(--bo-lon) }
.hk-hh-hop { border-radius: var(--bo-nho) }
.hk-hh-no { clip-path: polygon(50% 0, 61% 30%, 95% 20%, 72% 48%, 100% 62%, 66% 68%, 70% 100%, 50% 78%, 30% 100%, 34% 68%, 0 62%, 28% 48%, 5% 20%, 39% 30%); height: 24px; width: 28px }
.hk-hh-ruy { transform: rotate(-35deg); width: 34px; height: 9px }
.hk-hh-dai { width: 44px; height: 8px }
.hk-co { display: block; background: #20409a; border-radius: var(--bo-nho) }
.hk-trong { border: 2px dashed var(--vien-nut); background: var(--sau); display: grid; place-items: center }
.hk-trong > b { position: static; color: var(--vien-chon); font-size: var(--cs-tab) }
.hh-chon { display: flex; flex-wrap: wrap; gap: var(--k-2) }
#f-ti-le { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: var(--k-2) }
#f-ti-le .mieng.hk-co-hinh { min-width: 0; width: 100%; height: 92px }

/* ── ĐIỆN THOẠI (khu hẹp): một cột — bàn xem trên, bàn sửa dưới, thanh nút cố định đáy màn trên thanh điều hướng ── */
@container khu (max-width: 860px) {
  #khu .st-cot { grid-template-columns: minmax(0, 1fr) }
  #khu .st-cot > .trai { position: static; max-height: none; overflow: visible }
  .st-sanh .goc img, .st-sanh .goc video, #f-xem-thu img, #f-xem-thu video, .hk-mo img { max-height: 52vh; width: 100% }
  /* Mép trái `--rong-ben` (quy ước vo.css cho khối `fixed` trong #khu): `left: 0` tính theo CỬA SỔ nên ở máy tính có
     thanh bên mà khu hẹp (cửa sổ 1024px → khu 737px) thanh nút trải hết bề ngang, đè thanh bên (anh báo 09/11/2026).
     Máy tính không có dải đáy `#dai-duoi` nên đáy 0; đệm ngang bằng #khu để nút cùng trục với nội dung. */
  #st-lam { position: fixed; left: var(--rong-ben); right: 0; bottom: 0; padding: var(--k-2) var(--k-6) }
  #st-lam label { display: none }
  #st-lam > .tam { border: 1px solid var(--vien-chon); border-radius: var(--bo) }
  #st-lam #f-ghi-chu { min-height: 36px }
  #khu .hk-bc { padding-bottom: calc(var(--k-6) * 5) }
  /* Điện thoại thật (≤760px — cùng ngưỡng vo.css: `--rong-ben` về 0, có dải đáy): ghim TRÊN dải đáy. */
  @media (max-width: 760px) {
    #st-lam { bottom: calc(var(--k-6) * 3); padding: var(--k-2) }
    #khu .hk-bc { padding-bottom: calc(var(--k-6) * 8) }
  }
  body[data-man="hau-ky"] .tc-dai .tc-nut[data-tab="ve-lai"] { padding-inline: var(--k-2) }
  .hk-nd { grid-template-columns: minmax(0, 1fr) }
  .hk-mau { min-height: 0; aspect-ratio: 16 / 7; max-height: 200px }
  .hk-nd .hk-nd-o:last-child { order: 3 }
}
/* #454: chip màu tự chọn · thanh bóng · số px cỡ chữ video (08/11/2026) — màu chỉ qua token. */
.st-mau-tu { display: inline-flex; align-items: center; gap: var(--k-1) }
.st-mau-cham { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--vien) }
.st-mau-o { width: 32px; height: 28px; padding: 0; border: 1px solid var(--vien); border-radius: var(--bo); background: none; vertical-align: middle; cursor: pointer }
.st-bong-thanh { display: flex; align-items: center; gap: var(--k-2); margin-top: var(--k-1) }
.st-bong-thanh input[type=range] { flex: 1 1 auto; min-width: 0 }
.st-bong-thanh output { min-width: 3ch; text-align: right; font-size: var(--cs-ban); color: var(--chu-nhat) }
.st-co-px { margin: var(--k-1) 0 0; font-size: var(--cs-nho) }

:root { --tai-tron-hau-ky: 1 }
