/* Trang quay kiểu TikTok (js/quay.js, chủ trang 12/10/2026) — bấm ➕ ở trang Reel.
   Bố cục theo ảnh TikTok chủ trang gửi: khung camera bo góc lớn chiếm gần hết màn, dải đen dưới
   có ô thư viện + tab CAMERA / TẠO / LIVE. z-index 1046: trên Reel (1045), DƯỚI hộp Bootstrap
   (1055) — dù vậy js luôn đóng trang quay trước khi mở hộp đăng bài. */

#quay-view {
  position: fixed;
  inset: 0;
  z-index: 1046;
  display: none;
  flex-direction: column;
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  height: 100vh;
  height: 100dvh;
  padding-top: env(safe-area-inset-top, 0px);
  user-select: none;
  -webkit-user-select: none;
}
#quay-view.is-open { display: flex; }
html.qy-dang-mo, html.qy-dang-mo body { overflow: hidden; background-color: #000; }
html.qy-dang-mo #linkzalo, html.qy-dang-mo #linkphoneCircle { display: none !important; }

#quay-view button {
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
  padding: 0;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#quay-view [hidden] { display: none !important; }
#quay-view svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35));
}
#quay-view svg.qy-dac { fill: currentColor; stroke: none; }

/* ── Khung camera ── */
.qy-khung {
  position: relative;
  flex: 1 1 auto;
  margin-top: 18px;
  border-radius: 22px;
  overflow: hidden;
  background: #222;
}
.qy-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.qy-video.qy-guong { transform: scaleX(-1); }   /* camera trước: xem như soi gương */
#quay-view.qy-chu .qy-video { visibility: hidden; }
.qy-van-ban {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #7f5af0, #e45d9c 55%, #f7a440);
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  padding: 0 2rem;
}
.qy-loi {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 40%;
  text-align: center;
  font-size: .95rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, .9);
}
.qy-dem {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7rem;
  font-weight: 700;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .5);
  pointer-events: none;
}
/* Vạch thời gian quay — trên đỉnh khung như TikTok. */
.qy-tien-do {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 10px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .3);
  z-index: 3;
}
.qy-tien-do i { display: block; height: 100%; width: 0; border-radius: 2px; background: #fe2c55; }

/* ✕ góc trái, viên "Thêm âm thanh" giữa */
.qy-dong {
  position: absolute;
  top: 26px;
  left: 18px;
  z-index: 2;
}
.qy-dong svg { width: 28px; height: 28px; stroke-width: 2.4; }
.qy-nhac {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex !important;
  align-items: center;
  gap: 8px;
  max-width: 62%;
  padding: 10px 18px !important;
  border-radius: 24px;
  background: rgba(0, 0, 0, .38) !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  white-space: nowrap;
}
.qy-nhac svg { width: 18px; height: 18px; flex: none; }
.qy-nhac-ten { overflow: hidden; text-overflow: ellipsis; }
.qy-nhac-bo { margin-left: 2px; font-size: 20px; line-height: 1; opacity: .85; }
#quay-view.qy-dang-quay .qy-nhac,
#quay-view.qy-dang-quay .qy-cot,
#quay-view.qy-dang-quay .qy-dong,
#quay-view.qy-dang-quay .qy-che-do { visibility: hidden; }

/* Cột công cụ phải */
.qy-cot {
  position: absolute;
  top: 22px;
  right: 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.qy-cot button { position: relative; width: 40px; height: 36px; display: flex !important; align-items: center; justify-content: center; }
.qy-cot button.is-on { color: #fcc12b; }
.qy-vach { width: 22px; height: 1.5px; background: rgba(255, 255, 255, .55); border-radius: 1px; }
.qy-gio-so {
  position: absolute;
  right: -2px;
  bottom: -4px;
  font-size: 11px;
  font-weight: 700;
  color: #fcc12b;
}

/* Hàng chế độ + nút chụp */
.qy-duoi-khung {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.qy-che-do {
  display: flex;
  gap: 4px;
  max-width: 100%;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.qy-che-do::-webkit-scrollbar { display: none; }
.qy-che-do button {
  flex: none;
  padding: 6px 14px !important;
  border-radius: 18px;
  font-size: 16px !important;
  font-weight: 600 !important;
  color: rgba(255, 255, 255, .92) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
  white-space: nowrap;
}
.qy-che-do button.is-on { background: #fff !important; color: #111 !important; text-shadow: none; }

.qy-hang-chup { position: relative; display: flex; align-items: center; justify-content: center; }
/* Nút chụp: vòng trắng viền, lõi trắng — như TikTok chế độ ẢNH. */
.qy-chup {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, .9) !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.qy-chup i {
  display: block;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: #fff;
  transition: all .18s ease;
}
/* Chế độ video: lõi đỏ; đang quay thì lõi co thành ô vuông bo góc. */
.qy-chup.qy-chup-video i { background: #fe2c55; }
#quay-view.qy-dang-quay .qy-chup i { width: 30px; height: 30px; border-radius: 8px; }
#quay-view.qy-dang-quay .qy-chup { border-color: rgba(254, 44, 85, .55) !important; }
.qy-chup.qy-chup-tiep { background: #fe2c55 !important; border-color: #fff !important; }
.qy-chup.qy-chup-tiep svg { width: 34px; height: 34px; stroke-width: 2.6; }
.qy-dem-gio {
  position: absolute;
  top: -30px;
  font-size: 15px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}

/* ── Dải dưới: ô thư viện + tab ── */
.qy-day {
  position: relative;
  flex: none;
  height: calc(env(safe-area-inset-bottom, 0px) + 84px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.qy-thu-vien {
  position: absolute;
  left: 16px;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid #fff !important;
  overflow: hidden;
  background: linear-gradient(180deg, #8fd3f4 0%, #8fd3f4 55%, #e3a46f 55%, #c97b4a 100%) !important;
}
.qy-thu-vien i {
  position: absolute;
  top: 6px;
  left: 18px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff3a6;
}
.qy-tab { display: flex; gap: 30px; padding-left: 40px; }
.qy-tab button {
  font-size: 15px !important;
  font-weight: 700 !important;
  letter-spacing: .3px;
  color: rgba(255, 255, 255, .55) !important;
}
.qy-tab button.is-on { color: #fff !important; }

/* ── Bảng "Thêm âm thanh" ── */
.qy-bang {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, .45);
}
.qy-bang-than {
  width: 100%;
  max-height: 72%;
  display: flex;
  flex-direction: column;
  background: #1f1f1f;
  border-radius: 16px 16px 0 0;
  padding: 14px 16px calc(env(safe-area-inset-bottom, 0px) + 10px);
}
.qy-bang-dau { display: flex; align-items: center; justify-content: center; position: relative; margin-bottom: 10px; }
.qy-bang-dau b { font-size: 16px; }
.qy-bang-dau button { position: absolute; right: 0; }
.qy-bang-dau svg { width: 22px; height: 22px; }
.qy-bang-tim {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  background: #2f2f2f;
  color: #fff;
  font: inherit;
  font-size: 15px;
  margin-bottom: 8px;
}
.qy-bang-ds { overflow-y: auto; }
.qy-bai { display: flex !important; align-items: center; gap: 12px; width: 100%; padding: 8px 0 !important; text-align: left; }
.qy-bai.is-on .qy-bai-chu b { color: #fe2c55; }
.qy-bai-anh { width: 46px; height: 46px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex: none; }
.qy-bai-anh svg { width: 20px; height: 20px; }
.qy-bai-chu { display: flex; flex-direction: column; min-width: 0; }
.qy-bai-chu b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qy-bai-chu small { font-size: 13px; color: rgba(255, 255, 255, .6); }
.qy-bang-trong { text-align: center; color: rgba(255, 255, 255, .6); padding: 20px 0; }

/* Màn rộng (máy tính): khung dọc giữa màn như TikTok web. */
@media (min-width: 768px) {
  .qy-khung, .qy-day { width: min(100%, calc((100dvh - 120px) * 9 / 16)); margin-left: auto; margin-right: auto; }
}

/* Ô chọn tệp của nút thư viện: ẩn bằng kích thước 0 chứ không display:none (xem quay.js). */
.qy-tep { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; left: 0; bottom: 0; }
