/* ===== Nền "màn hình desktop" cho các cửa sổ ===== */
.page-desktop {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 12px;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(120, 210, 235, 0.45), transparent 55%),
    radial-gradient(ellipse at 80% 85%, rgba(0, 40, 80, 0.55), transparent 60%),
    linear-gradient(160deg, #0a6f93 0%, #0f86ad 45%, #045573 100%);
}

/* ===== Cửa sổ kiểu Windows 10 (kích thước theo docs/reference/login-video-4m23.png) ===== */
.win-dialog {
  width: 756px;
  max-width: 100%;
  background: #eef4f7;
  border: 1px solid #7fa8c4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.win-titlebar {
  display: flex;
  align-items: center;
  height: 36px;
  padding-left: 12px;
  background: #fff;
  font-family: "Segoe UI", var(--ui);
  font-size: 14px;
}

.win-app-icon {
  width: 16px;
  height: 14px;
  margin-right: 9px;
  background:
    linear-gradient(90deg, #e43c3c 0 33%, #2e9b4b 33% 66%, #2f62d8 66%) top / 100% 50% no-repeat,
    linear-gradient(90deg, #f2b31d 0 50%, #7b4fc9 50%) bottom / 100% 50% no-repeat;
  border-radius: 2px;
}

.win-title { flex: 1; color: #1a1a1a; letter-spacing: 0.01em; }

.win-close {
  width: 46px;
  height: 100%;
  display: grid;
  place-items: center;
  color: #222;
  text-decoration: none;
  font-size: 15px;
}
.win-close:hover { background: #e81123; color: #fff; }

/* Banner "TỰ LUYỆN SÁT HẠCH LÝ THUYẾT 600 CÂU" */
.win-banner {
  position: relative;
  height: 106px;
  margin: 6px 10px 0;
  background: #fff;
  overflow: hidden;
}

.win-banner-art {
  position: absolute;
  inset: 0;
  clip-path: polygon(12.6% 6%, 38.6% 6%, 40.6% 25%, 100% 25%, 100% 100%, 0 100%, 0 96%);
  background:
    radial-gradient(ellipse 4% 14% at 74% 40%, rgba(150, 230, 170, 0.30), transparent),
    radial-gradient(ellipse 5% 18% at 84% 72%, rgba(130, 220, 160, 0.25), transparent),
    radial-gradient(ellipse 4% 15% at 93% 42%, rgba(150, 230, 180, 0.22), transparent),
    radial-gradient(ellipse 5% 16% at 64% 70%, rgba(110, 190, 240, 0.22), transparent),
    radial-gradient(ellipse 6% 20% at 30% 70%, rgba(90, 150, 255, 0.28), transparent),
    linear-gradient(174deg, transparent 0 44%, rgba(190, 220, 255, 0.35) 44.3% 44.8%, transparent 45.1%),
    linear-gradient(90deg, #07174a 0%, #0a2a7e 18%, #1250c2 40%, #0f58a8 52%, #0b7552 66%, #0b7a45 80%, #075a3a 100%);
}

.win-banner-title {
  position: absolute;
  left: 14.6%;
  bottom: 21px;
  margin: 0;
  color: #fff;
  font-family: var(--sans);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  /* Bản gốc dùng chữ đứng hẹp (condensed) */
  transform: scaleX(0.86);
  transform-origin: left bottom;
}

.win-stripe {
  height: 13px;
  margin: 4px 10px 0;
  border-top: 3px solid #dcdcdc;
  background: #ff998b;
}

.win-body {
  position: relative;
  margin: 8px 10px 10px;
  border: 1px solid #d3dcc8;
  border-radius: 10px;
  background: linear-gradient(180deg, #f4f8e5 0%, #f6f7e7 55%, #f7f1e1 100%);
}

/* ===== Màn đăng nhập: toạ độ tuyệt đối theo ảnh tham chiếu ===== */
.login-panel {
  position: relative;
  height: 454px;
}

.login-form { position: static; }

.login-row { display: contents; }

.login-label {
  position: absolute;
  left: 30px;
  font-family: var(--serif);
  font-size: 15.5px;
  font-weight: 700;
  color: #2e3d99;
  transform: translateY(-50%);
}
/* nth-of-type: form POST có thêm ô ẩn authenticity_token đứng đầu, không được tính vào thứ tự hàng */
.login-row:nth-of-type(1) .login-label { top: 36px; }
.login-row:nth-of-type(2) .login-label { top: 77px; }
.login-row:nth-of-type(3) .login-label { top: 117px; }
.login-row:nth-of-type(4) .login-label { top: 160px; }

.win-select,
.win-input {
  position: absolute;
  left: 151px;
  height: 33px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  color: #1a101b;
  border: 1px solid #adadad;
  border-radius: 0;
}

.win-select {
  appearance: none;
  padding: 0 30px 0 6px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23606060' stroke-width='1.3'/%3E%3C/svg%3E") right 9px center / 12px 8px no-repeat,
    linear-gradient(#f0f0f0, #e3e3e3);
  cursor: pointer;
}
.win-select:hover { border-color: var(--win-accent); }

.select-unit { top: 19px; width: 489px; }
.select-course { top: 60px; width: 233px; }
.select-class { top: 142px; width: 165px; height: 34px; }

.win-input {
  top: 100px;
  width: 86px;
  padding: 0 6px;
  background: #fff;
  color: #c0504d;
  font-weight: 400;
  border-color: #7a7a7a;
}
.win-input:focus { outline: none; border: 2px solid var(--win-accent); padding: 0 5px; }

.login-hint {
  position: absolute;
  left: 328px;
  top: 160px;
  transform: translateY(-50%);
  font-family: var(--serif);
  font-size: 18px;
  color: #464d96;
}

/* Nút kiểu Windows cổ điển, nền cam nhạt */
.win-btn {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid #9a9a9a;
  border-radius: 2px;
  background: linear-gradient(#fff2df, #ffe3c3);
  box-shadow: inset 0 0 0 1px #fff7ec, 1px 1px 0 rgba(0, 0, 0, 0.08);
  color: #332995;
  font-family: var(--sans);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.win-btn:hover { border-color: var(--win-accent); background: linear-gradient(#fff6ea, #ffe9cf); }
.win-btn:active { background: linear-gradient(#ffe3c3, #ffd9b0); }
.win-btn:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }

.btn-check {
  left: 418px;
  top: 66px;
  width: 147px;
  height: 63px;
  font-size: 12.5px;
  line-height: 1.25;
  text-align: center;
}

/* Thẻ thí sinh */
.portrait {
  position: absolute;
  left: 18px;
  top: 217px;
  width: 98px;
  height: 145px;
  padding: 5px;
  background: #f6f6f6;
  border: 1px solid #c9c9c9;
  box-shadow: 2px 3px 6px rgba(0, 0, 0, 0.18), inset 0 0 0 1px #fff;
}
.portrait svg { display: block; width: 100%; height: 100%; }

.candidate-info { margin: 0; }
.candidate-info > div {
  position: absolute;
  left: 161px;
  display: flex;
  align-items: center;
  height: 30px;
  transform: translateY(-50%);
  font-family: var(--serif);
  font-size: 18px;
}
.candidate-info > div:nth-child(1) { top: 217px; }
.candidate-info > div:nth-child(2) { top: 252px; }
.candidate-info > div:nth-child(3) { top: 287px; }
.candidate-info > div:nth-child(4) { top: 322px; }
.candidate-info > div:nth-child(5) { top: 358px; }
.candidate-info dt { width: 124px; color: #475195; }
.candidate-info dd {
  max-width: 250px;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 700;
  color: #1d2d6b;
}

.portrait { overflow: hidden; }
.portrait-photo {
  position: absolute;
  inset: 5px;
  width: calc(100% - 10px);
  height: calc(100% - 10px);
  object-fit: cover;
}

/* Tài khoản Facebook: khoảng trống bên phải thẻ thí sinh */
.account-box {
  position: absolute;
  left: 548px;
  top: 204px;
  width: 166px;
  text-align: center;
}

.fb-form { margin: 0; }

.fb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: #1877f2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  color: #fff;
  font: 700 14px/1.2 var(--sans);
  text-align: left;
  cursor: pointer;
}
.fb-btn:hover { background: #166fe5; }
.fb-btn:focus-visible { outline: 2px solid #0b3d91; outline-offset: 2px; }

.fb-logo {
  flex: none;
  display: inline-grid;
  place-items: end center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  color: #1877f2;
  font: 700 19px/1 var(--sans);
  overflow: hidden;
}

.account-hint {
  margin: 8px 0 0;
  font: 12px/1.35 var(--ui);
  color: #5b5b5b;
}

.account-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 4px 0 10px;
  font: 700 13px var(--serif);
  color: #2e3d99;
  white-space: nowrap;
}
.account-status .fb-logo { width: 18px; height: 18px; background: #1877f2; color: #fff; font-size: 15px; }

.account-logout {
  min-width: 110px;
  height: 30px;
  border: 1px solid #9a9a9a;
  background: linear-gradient(#fdfdfd, #e9e9e9);
  font: 13px var(--ui);
  cursor: pointer;
}
.account-logout:hover { border-color: var(--win-accent); }

/* Nút Facebook trong hộp thoại màn thi */
.msgbox--wide { width: min(540px, calc(100vw - 24px)); }
.msgbox-actions .fb-form { margin-right: auto; }
.fb-btn--dialog { width: auto; min-height: 30px; padding: 4px 12px; border-radius: 4px; font-size: 13px; white-space: nowrap; }
.fb-btn--dialog .fb-logo { width: 18px; height: 18px; font-size: 16px; }

/* Hàng nút dưới cùng */
.login-actions .win-btn,
.login-actions form .win-btn { top: 397px; height: 46px; font-size: 18px; }
.btn-start { left: 228px; width: 180px; }
.btn-history { left: 418px; width: 160px; }
.btn-cancel { left: 588px; width: 112px; }
.btn-back { left: 588px; width: 112px; }

.icon-blank {
  align-self: flex-start;
  width: 16px;
  height: 12px;
  margin: 3px 8px 0 -10px;
  background: #fff;
  border: 1px solid #d6d6d6;
}
.icon-check { color: #3aa53a; font-size: 17px; }
.icon-back { color: #2e3d99; font-size: 13px; }
.icon-power {
  width: 22px;
  height: 22px;
  margin-right: 6px;
  border-radius: 50%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3v8M7.1 6.3a7 7 0 1 0 9.8 0' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") center / 15px no-repeat,
    radial-gradient(circle at 35% 30%, #ff6d5a, #d41f12 70%);
  box-shadow: 0 0 0 1px #a81a10;
}

/* ===== Lịch sử thi ("Xem lại bài thi") ===== */
.history-panel { position: relative; height: 454px; padding: 18px 22px 0; }

.history-head {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 18px;
  color: #475195;
}
.history-head strong { color: #1d2d6b; }

.history-note {
  margin: 8px 0 0;
  font: 12px var(--ui);
  color: #5b5b5b;
}

.history-list {
  height: 314px;
  overflow: auto;
  background: #fff;
  border: 1px solid #a9a9a9;
}

.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th {
  position: sticky;
  top: 0;
  padding: 5px 8px;
  text-align: left;
  font-weight: 400;
  background: linear-gradient(#fdfdfd, #ececec);
  border-bottom: 1px solid #d5d5d5;
  border-right: 1px solid #e5e5e5;
}
.history-table td { padding: 5px 8px; border-bottom: 1px solid #f0f0f0; }
.history-table tbody tr:hover td { background: #e5f3ff; }
.history-table a { color: #0645ad; }
.history-table .is-pass { color: #118a11; font-weight: 700; }
.history-table .is-fail { color: #d0021b; font-weight: 700; }
.history-empty { padding: 24px 8px !important; text-align: center; color: #666; }

/* ===== Hộp thoại kiểu MessageBox ===== */
.msgbox {
  width: min(440px, calc(100vw - 24px));
  padding: 0;
  border: 1px solid #7fa8c4;
  background: #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  font-family: "Segoe UI", var(--ui);
  font-size: 14px;
}

.msgbox-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
  padding-left: 12px;
}

.msgbox-x {
  width: 44px;
  height: 32px;
  border: 0;
  background: none;
  cursor: pointer;
}
.msgbox-x:hover { background: #e81123; color: #fff; }

.msgbox-body {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 22px 22px;
}
.msgbox-body p { margin: 6px 0 0; line-height: 1.45; }

.msgbox-icon {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #5aa9ff, #1460c8 75%);
  color: #fff;
  font: 700 19px/1 Georgia, var(--serif);
}

.msgbox-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 11px 12px;
  background: #f0f0f0;
}

.msgbox-btn {
  min-width: 88px;
  white-space: nowrap;
  padding: 4px 12px;
  border: 1px solid #adadad;
  background: #e1e1e1;
  color: #000;
  font-size: 14px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.msgbox-btn:hover { border-color: var(--win-accent); background: #e5f1fb; }
.msgbox-btn:focus-visible { outline: 1px dotted #000; outline-offset: -4px; border-color: var(--win-accent); }

/* Kết quả bài thi */
.result-box { width: min(520px, calc(100vw - 24px)); }
.result-body { padding: 14px 26px 18px; font-family: var(--serif); }
.result-candidate { margin: 0 0 10px; font-size: 16px; color: #475195; }
.result-table { border-collapse: collapse; font-size: 18px; }
.result-table th { padding: 3px 16px 3px 0; text-align: left; font-weight: 400; color: #1d2d52; }
.result-table td { font-weight: 700; color: #1d2d52; }
.result-verdict { margin: 14px 0 6px; font-size: 30px; font-weight: 700; color: #d0021b; }
.result-verdict.is-pass { color: #118a11; }
.result-note { margin: 0; font-size: 15px; color: #444; }

/* ===== Màn hình hẹp: bỏ toạ độ tuyệt đối, xếp dọc ===== */
@media (max-width: 780px) {
  .page-desktop { padding: 0; place-items: start stretch; }
  .win-dialog { width: 100%; border: 0; }
  .win-banner { height: 78px; }
  .win-banner-title { left: 12px; bottom: 12px; font-size: 18px; }

  .login-panel { height: auto; padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 10px; }
  .login-form { display: flex; flex-direction: column; gap: 10px; }
  .login-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
  .login-label,
  .win-select,
  .win-input,
  .login-hint,
  .win-btn,
  .portrait,
  .candidate-info > div { position: static; transform: none; }
  .login-label { width: 100px; }
  .win-select, .select-unit, .select-course, .select-class { width: calc(100% - 110px); font-size: 16px; }
  .win-input { width: 120px; }
  .login-hint { display: none; }
  .btn-check { width: 100%; height: 48px; }

  .account-box { position: static; width: auto; }
  .candidate-info dd { max-width: 190px; }

  .candidate-card { display: flex; gap: 14px; align-items: flex-start; }
  .portrait { position: relative; flex: none; width: 82px; height: 120px; }
  .candidate-info { display: flex; flex-direction: column; gap: 4px; }
  .candidate-info > div { height: auto; font-size: 16px; }
  .candidate-info dt { width: 92px; }

  .login-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .login-actions form { flex: 1 1 100%; }
  .login-actions .win-btn { flex: 1; width: auto; height: 46px; font-size: 16px; }
  .login-actions form .win-btn { width: 100%; }

  .history-panel { height: auto; padding: 14px; }
  .history-list { height: auto; max-height: 60vh; }
  .history-panel .login-actions { margin-top: 12px; }
}
