/* phim.css - Phim tuong tac quan ca phe (T019). Khung doc 9:16, video phu
   toan khung, phu de chong o phan duoi, o nhap dinh o day man hinh. */

body.trang-phim {
  background: #241a12;
  color: #1c2b3a;
}

/* Khung doc o giua tren may tinh, hai ben nen mo toi */
.khung-dung {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: #eaf2fb;
  min-height: 100dvh;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.55);
}

@media (min-width: 560px) {
  body.trang-phim {
    background: #241a12;
  }
  .khung-dung {
    border-left: 1px solid rgba(255, 255, 255, 0.14);
    border-right: 1px solid rgba(255, 255, 255, 0.14);
  }
}

/* Man hinh video doc */
.man-hinh {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 78dvh;
  overflow: hidden;
  background: #2b2118;
  touch-action: pan-y;
  user-select: none;
}

.lop-video {
  position: absolute;
  inset: 0;
}

.lop-video video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  /* Lop cu giu nguyen 0,25 s roi moi tat, de lop moi hien dan DE LEN no: khong lo nen toi giua hai clip. */
  transition: opacity 0s linear 0.25s;
}

.lop-video video.hien {
  opacity: 1;
  z-index: 1;
  transition: opacity 0.25s ease;
}

.lop-video video.an {
  display: none;
}

#anh-goc {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Mo dau: chi co nut Bo qua trong suot tren clip mo-dau */
.mo-dau {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

#nut-bo-qua {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  pointer-events: auto;
}

/* Nut bat/tat tieng tren man hinh */
#nut-tieng {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 6;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

/* Nhan trang thai nho goc tren, cham de mo bang trang thai */
.nhan-trang-thai {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 6;
  max-width: 62%;
}

#nut-trang-thai {
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Phu de chong o phan duoi hinh */
.phu-de {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  text-align: center;
  pointer-events: none;
}

.phu-de-han {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.35;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85), 0 0 12px rgba(0, 0, 0, 0.6);
}

.phu-de-pinyin {
  font-size: 14px;
  color: #ffe9a8;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.phu-de-viet {
  font-size: 15px;
  font-style: italic;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.goc-canh {
  position: absolute;
  left: 10px;
  bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
  z-index: 2;
}

.nhan-canh {
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.goc-canh .che-do {
  margin: 0;
  color: #fff;
  font-size: 12px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

/* Khung hoi thoai duoi video */
.khung-phim {
  padding-top: 10px;
  max-width: 480px;
}

.khung-phim .trang-thai {
  display: none;
}

.khung-phim .trang-thai.mo {
  display: grid;
}

.an-tren-canh {
  display: none;
}

.khung-phim .hoi-thoai {
  max-height: 34vh;
}

/* O nhap dinh o day man hinh, nen mo */
.khung-phim .nhap {
  position: sticky;
  bottom: 0;
  z-index: 3;
  padding: 10px 0 12px 0;
  background: rgba(234, 242, 251, 0.92);
  backdrop-filter: blur(8px);
}

@media (max-width: 599px) {
  .goc-canh {
    display: none;
  }
  .man-hinh {
    max-height: 62dvh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lop-video video {
    transition: none;
  }
}

/* Laptop (T025): man hinh rong (tu 900 px) va ngang thi chia hai cot:
   clip 9:16 ben trai cao bang cua so, bang hoi thoai ben phai gom lich
   su bong bong, vi va don hang, thuc don, nut mic lon va o go. Khong
   con khung dien thoai dung giua man hinh den. Dien thoai giu nguyen
   bo cuc cu (media query nay khong ap dung). */
@media (min-width: 900px) and (orientation: landscape) {
  .khung-dung {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    max-width: none;
    height: 100dvh;
    min-height: 100dvh;
  }
  .man-hinh {
    width: calc(100dvh * 9 / 16);
    max-width: none;
    height: 100dvh;
    max-height: none;
    aspect-ratio: 9 / 16;
  }
  .khung-phim {
    max-width: none;
    height: 100dvh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 16px;
  }
  .khung-phim .trang-thai {
    display: grid;
  }
  .khung-phim .thuc-don.an-tren-canh {
    display: block;
  }
  .khung-phim .hoi-thoai {
    flex: 1 1 auto;
    max-height: none;
    min-height: 0;
  }
  .khung-phim .tin-nhan {
    max-width: 720px;
  }
  .khung-phim .nhap {
    position: sticky;
    bottom: 0;
  }
}

/* Laptop (Claude Code, 06/12): o 1366x768 khung hoi thoai chi con 60 px vi thuc don, chan trang va nhan o go chiem cho.
   Thuc don thanh luoi nhieu cot, an chan trang ghi chu ky thuat, an nhan o go (van con cho trinh doc man hinh),
   hoi thoai luon cao it nhat 200 px. */
@media (min-width: 900px) and (orientation: landscape) {
  .khung-phim .thuc-don ul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 2px 16px;
    margin: 4px 0 0;
  }
  .khung-phim .chan-trang {
    display: none;
  }
  .khung-phim .nhap > label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .khung-phim .hoi-thoai {
    min-height: 200px;
  }
}
