/* ============================================================================
   phongthi.css — giao diện CHẾ ĐỘ PHÒNG THI (đi kèm js/phongthi.js)
   Tự đủ màu, không phụ thuộc biến của app (có fallback), chạy cả nền sáng/tối.
   ==========================================================================*/

:root {
  --pt-hong: #FF1F8F;
  --pt-tim: #6D28D9;
  --pt-do: #E11D48;
  --pt-cam: #F59E0B;
  --pt-xanh: #059669;
  --pt-nen: #FFFFFF;
  --pt-chu: #16181D;
  --pt-mo: #64748B;
}
@media (prefers-color-scheme: dark) {
  :root { --pt-nen: #161A22; --pt-chu: #ECEFF5; --pt-mo: #94A3B8; }
}

/* ---------- lớp phủ chung ---------- */
.pt-lop {
  position: fixed; inset: 0; z-index: 99990;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(10, 12, 20, .72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: ptHien .18s ease-out;
}
@keyframes ptHien { from { opacity: 0 } to { opacity: 1 } }

.pt-hop {
  width: min(680px, 100%); max-height: 92vh; overflow: auto;
  background: var(--pt-nen); color: var(--pt-chu);
  border-radius: 20px; padding: 22px 22px 18px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .45);
  border: 2px solid rgba(255, 31, 143, .35);
  font-family: inherit; line-height: 1.55;
}

/* ---------- cổng vào phòng thi ---------- */
.pt-cong-hd { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.pt-cong-ic {
  width: 56px; height: 56px; flex: none; border-radius: 16px;
  display: grid; place-items: center; font-size: 30px;
  background: linear-gradient(135deg, var(--pt-hong), var(--pt-tim));
  box-shadow: 0 8px 20px rgba(255, 31, 143, .35);
}
.pt-cong-tt { margin: 0; font-size: 1.32rem; font-weight: 900; letter-spacing: .4px; color: var(--pt-hong); }
.pt-cong-sub { margin: 2px 0 0; font-size: .93rem; color: var(--pt-mo); }
.pt-cong-lead { margin: 10px 0 8px; font-weight: 600; }

.pt-quy-che { margin: 0 0 12px; padding-left: 0; list-style: none; }
.pt-quy-che li {
  position: relative; padding: 8px 10px 8px 34px; margin-bottom: 6px;
  border-radius: 12px; background: rgba(255, 31, 143, .07);
  border-left: 4px solid var(--pt-hong); font-size: .96rem;
}
.pt-quy-che li::before {
  content: "⛔"; position: absolute; left: 9px; top: 8px; font-size: .95rem;
}
.pt-cong-nguong {
  border-radius: 12px; padding: 10px 12px; font-size: .93rem;
  background: rgba(245, 158, 11, .12); border: 1.5px solid rgba(245, 158, 11, .45);
}
.pt-do { color: var(--pt-do); font-weight: 700; }
.pt-cong-rieng { margin-top: 8px; font-size: .86rem; color: var(--pt-mo); }

.pt-cam-ket {
  display: flex; align-items: flex-start; gap: 9px; margin: 12px 0 4px;
  font-size: .95rem; font-weight: 600; cursor: pointer;
}
.pt-cam-ket input { width: 20px; height: 20px; accent-color: var(--pt-hong); flex: none; margin-top: 1px; }

.pt-cong-nut { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.pt-btn {
  border: 0; border-radius: 12px; padding: 12px 20px; cursor: pointer;
  font-size: 1rem; font-weight: 800; font-family: inherit;
}
.pt-btn-chinh {
  color: #fff; background: linear-gradient(135deg, var(--pt-hong), var(--pt-tim));
  box-shadow: 0 8px 18px rgba(255, 31, 143, .32);
}
.pt-btn-chinh:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.pt-btn-phu { background: rgba(125, 135, 155, .18); color: var(--pt-chu); }
.pt-link-gv {
  display: block; margin: 12px auto 0; background: none; border: 0; cursor: pointer;
  color: var(--pt-mo); font-size: .85rem; text-decoration: underline; font-family: inherit;
}

/* ---------- màn che khi rời cửa sổ ---------- */
.pt-che { background: #0B0E15; backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); z-index: 99995; }
.pt-che-in { text-align: center; color: #fff; max-width: 460px; padding: 20px; }
.pt-che-ic { font-size: 62px; line-height: 1; margin-bottom: 10px; }
.pt-che-in h2 { margin: 0 0 10px; font-size: 1.5rem; font-weight: 900; color: var(--pt-cam); letter-spacing: 1px; }
.pt-che-in p { margin: 6px 0; font-size: 1rem; }
.pt-che-nho { font-size: .9rem !important; opacity: .8; }

/* ---------- hộp cảnh báo ---------- */
.pt-hop-canh { width: min(560px, 100%); text-align: center; border-color: rgba(225, 29, 72, .5); }
.pt-canh-ic { font-size: 48px; line-height: 1; }
.pt-hop-canh h2 { margin: 6px 0 10px; font-size: 1.2rem; font-weight: 900; color: var(--pt-do); }
.pt-hop-canh p { margin: 6px 0; font-size: .97rem; text-align: left; }
.pt-hop-canh .pt-btn { margin-top: 12px; }

/* ---------- huy hiệu đang giám sát ---------- */
.pt-huy {
  position: fixed; right: 12px; bottom: 12px; z-index: 99980;
  display: flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 999px; cursor: pointer;
  font-size: .82rem; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #0F766E, #059669);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .28); user-select: none;
}
.pt-huy-vang { background: linear-gradient(135deg, #B45309, var(--pt-cam)); }
.pt-huy-do { background: linear-gradient(135deg, #9F1239, var(--pt-do)); }
.pt-huy-cham {
  width: 9px; height: 9px; border-radius: 50%; background: #fff;
  animation: ptNhay 1.6s ease-in-out infinite;
}
@keyframes ptNhay { 0%, 100% { opacity: 1 } 50% { opacity: .25 } }

/* ---------- nhật ký ---------- */
.pt-nk { list-style: none; margin: 10px 0 0; padding: 0; text-align: left; max-height: 46vh; overflow: auto; }
.pt-nk li {
  padding: 7px 10px; margin-bottom: 5px; border-radius: 10px; font-size: .9rem;
  background: rgba(125, 135, 155, .12); border-left: 4px solid var(--pt-cam);
}
.pt-nk li.nang { border-left-color: var(--pt-do); background: rgba(225, 29, 72, .1); }
.pt-nk-gio { font-weight: 800; color: var(--pt-mo); margin-right: 4px; }
.pt-sach {
  margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; font-weight: 700;
  background: rgba(5, 150, 105, .12); border: 1.5px solid rgba(5, 150, 105, .4); color: var(--pt-xanh);
}

/* ---------- khối biên bản trong màn kết quả ---------- */
.pt-tomtat { border-radius: 16px; padding: 14px 16px; border: 2px solid rgba(5, 150, 105, .45); background: rgba(5, 150, 105, .07); }
.pt-tomtat.pt-vang { border-color: rgba(245, 158, 11, .5); background: rgba(245, 158, 11, .08); }
.pt-tomtat.pt-cam { border-color: rgba(234, 88, 12, .55); background: rgba(234, 88, 12, .08); }
.pt-tomtat.pt-do { border-color: rgba(225, 29, 72, .55); background: rgba(225, 29, 72, .08); }
.pt-tt-dau { display: flex; align-items: center; gap: 12px; }
.pt-tt-ic { font-size: 30px; }
.pt-tt-sub { font-size: .86rem; color: var(--pt-mo); font-weight: 600; }
.pt-tt-diem { margin-left: auto; text-align: center; font-size: 1.7rem; font-weight: 900; line-height: 1; color: var(--pt-hong); }
.pt-tt-diem i { font-size: .9rem; font-style: normal; opacity: .6; }
.pt-tt-diem small { display: block; font-size: .62rem; font-weight: 700; color: var(--pt-mo); letter-spacing: .3px; }
.pt-tt-so { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; font-size: .9rem; }
.pt-tt-canh { margin-top: 10px; padding: 9px 12px; border-radius: 10px; background: rgba(225, 29, 72, .12); font-size: .92rem; }
.pt-tt-ma { margin-top: 10px; font-size: .8rem; color: var(--pt-mo); }
.pt-tt-ma code { background: rgba(125, 135, 155, .18); padding: 2px 6px; border-radius: 6px; font-size: .78rem; letter-spacing: .5px; }

/* ---------- bảng khu vực Thầy ---------- */
.pt-hop-gv { width: min(960px, 100%); }
.pt-hop-gv h2 { margin: 0 0 6px; font-size: 1.2rem; color: var(--pt-hong); font-weight: 900; }
.pt-hop-gv h3 { margin: 16px 0 6px; font-size: 1rem; font-weight: 800; }
.pt-bang { width: 100%; border-collapse: collapse; font-size: .88rem; }
.pt-bang th, .pt-bang td { padding: 6px 8px; border-bottom: 1px solid rgba(125, 135, 155, .25); text-align: left; }
.pt-bang th { font-weight: 800; color: var(--pt-mo); font-size: .82rem; }
.pt-bang-bb tr.w td { background: rgba(245, 158, 11, .1); }
.pt-bang-bb tr.x td { background: rgba(225, 29, 72, .12); }
.pt-bang code { font-size: .74rem; letter-spacing: .4px; }
.pt-cuon { max-height: 40vh; overflow: auto; border-radius: 10px; border: 1px solid rgba(125, 135, 155, .25); }
.pt-trong { text-align: center; color: var(--pt-mo); padding: 16px 0; }
.pt-rd { margin-right: 12px; font-size: .86rem; cursor: pointer; }
.pt-o { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 6px 0; font-size: .9rem; }
.pt-o input[type="number"] { width: 78px; padding: 5px 8px; border-radius: 8px; border: 1.5px solid rgba(125, 135, 155, .4); background: transparent; color: inherit; font-family: inherit; }
.pt-o-ck label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.pt-ghi { font-size: .82rem; color: var(--pt-mo); margin: 6px 0 0; }

/* ---------- khoá chọn văn bản khi đang thi ---------- */
body.pt-khong-chon .qbox, body.pt-khong-chon .ld-cau, body.pt-khong-chon .opts,
body.pt-khong-chon .ld-de, body.pt-khong-chon .ex-grid, body.pt-khong-chon .vm-cau {
  -webkit-user-select: none; -moz-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
body.pt-khong-chon input, body.pt-khong-chon textarea {
  -webkit-user-select: text; -moz-user-select: text; user-select: text;
}

/* ---------- điện thoại ---------- */
@media (max-width: 560px) {
  .pt-hop { padding: 16px 14px 14px; border-radius: 16px; }
  .pt-cong-tt { font-size: 1.12rem; }
  .pt-quy-che li { font-size: .9rem; }
  .pt-btn { flex: 1 1 auto; padding: 11px 14px; font-size: .95rem; }
  .pt-tt-diem { font-size: 1.4rem; }
  .pt-bang { font-size: .8rem; }
}

/* ---------- in giấy: không in lớp phủ ---------- */
@media print { .pt-lop, .pt-huy { display: none !important; } }
