/* TSU-TEP ห้องสอบออนไลน์ — ต่อยอดจาก tep-ui.css (ดีไซน์เดียวกับระบบสมัครสอบ)
   โครงหน้าทำข้อสอบอ้างอิงหน้าแบบทดสอบ + กระดาษคำตอบของระบบ DLT (do.jsp) */

/* ---------- หน้าที่จัดกลางจอ (หมดเวลา / SEB / ข้อผิดพลาด) ---------- */
.tu-center { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 32px 16px; }
.tu-result > img { height: 48px; width: auto; display: block; }
.tu-result p { color: var(--tu-muted); }
.tu-result .tu-notice { text-align: left; width: 100%; }
.tu-numlist { width: 100%; display: flex; flex-direction: column; gap: 12px; text-align: left; font-size: 15px; }
.tu-numlist li { display: flex; gap: 12px; align-items: flex-start; }
.tu-numlist li > b { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--tu-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.tu-err-detail { width: 100%; padding: 10px 12px; border-radius: 10px; background: var(--tu-bg); color: var(--tu-muted); font-size: 12px; text-align: left; word-break: break-word; }

/* ---------- หน้าเข้าสู่ห้องสอบ (อัตลักษณ์ห้องสอบ: หมึกเข้ม · กระดาษ · กระดาษคำตอบ OMR) ---------- */
.tu-exlogin .tu-exhero { position: relative; overflow: hidden; background-color: var(--tu-ink); background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.2px); background-size: 22px 22px; }
.tu-exhero .tu-login-hero-in { position: relative; z-index: 1; max-width: 520px; }
.tu-exhero .tu-pill { background: rgba(255, 255, 255, .1); font-size: 12px; letter-spacing: 1.5px; }
.tu-exhero h2 { font-size: 42px; }
.tu-exhero p, .tu-exhero .campus { position: relative; z-index: 1; color: #C9D3EA; }
.tu-exhero small { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 600; letter-spacing: .5px; color: #9FB0CF; }
/* แถบกระดาษคำตอบตกแต่งมุมขวาบน */
.tu-exhero-omr { position: absolute; top: 56px; right: 48px; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 16px 34px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 4px; opacity: .55; transform: rotate(4deg); }
.tu-exhero-omr div { position: relative; display: flex; align-items: center; gap: 8px; }
.tu-exhero-omr div::before { content: ""; position: absolute; left: -26px; width: 9px; height: 5px; background: rgba(255, 255, 255, .6); }
.tu-exhero-omr b { width: 16px; font-size: 12px; text-align: right; color: #C9D3EA; }
.tu-exhero-omr i { width: 26px; height: 16px; border-radius: 50%; border: 1.2px solid rgba(255, 255, 255, .55); }
.tu-exhero-omr i.on { background: #fff; border-color: #fff; }
.tu-exinfo { display: flex; flex-wrap: wrap; gap: 12px; }
.tu-exclock, .tu-exrounds { padding: 14px 18px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 12px; background: rgba(255, 255, 255, .05); line-height: 1.3; }
.tu-exclock b { display: block; font-size: 36px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.tu-exclock span { font-size: 13px; color: #C9D3EA; }
.tu-exrounds ul { display: flex; flex-direction: column; gap: 6px; }
.tu-exrounds li { display: flex; gap: 10px; align-items: baseline; font-size: 14px; }
.tu-exrounds li b { font-weight: 600; }
.tu-exrounds li span { color: #C9D3EA; font-variant-numeric: tabular-nums; }
.tu-exrules ol { counter-reset: exrule; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.tu-exrules li { counter-increment: exrule; display: flex; gap: 10px; align-items: flex-start; color: #E3E9F5; }
/* สิ่งที่ต้องเตรียมในวันสอบ: รายการติ๊กถูก */
.tu-exprep ul { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.tu-exprep li { display: flex; gap: 10px; align-items: flex-start; color: #E3E9F5; }
.tu-exprep li svg { flex: none; margin-top: 1px; color: #5FD08A; }
.tu-exrules li::before { content: counter(exrule); flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; background: var(--tu-accent); color: var(--tu-ink); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }

@media (max-width: 1100px) { .tu-exhero-omr { display: none; } }
@media (max-width: 640px) {
  .tu-exhero h2 { font-size: 32px; }
}
.tu-notice-sub { margin-top: 4px !important; font-size: 13px; opacity: .9; }
.tu-caps { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--tu-warn-ink); }
.tu-caps[hidden] { display: none; }

/* ---------- แถบหัวห้องสอบ: โลโก้ · ผู้เข้าสอบ · เวลา ---------- */
.tu-xtop { position: relative; z-index: 20; }
.tu-xhead { background: #fff; border-bottom: 1px solid var(--tu-line); }
.tu-xhead-in { padding: 10px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.tu-xwho { flex: 1 1 300px; min-width: 0; display: flex; align-items: center; gap: 14px; padding-left: 24px; border-left: 1px solid var(--tu-line); }
.tu-xphoto { position: relative; width: 56px; height: 56px; flex: none; border-radius: 50%; overflow: hidden; background: var(--tu-ink); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 20px; }
.tu-xphoto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--tu-bg); }
.tu-xwho-txt { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.tu-xwho-txt b { font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tu-xwho-txt span { font-size: 13px; color: var(--tu-muted); }
/* ห้องสอบ · เลขที่นั่ง · รอบสอบ · เวลาสอบ (หัวหน้าทำข้อสอบ) */
.tu-xinfo { flex: 0 1 380px; min-width: 260px; margin: 0; padding: 8px 14px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 18px; border: 1.5px solid var(--tu-line); border-radius: 12px; background: var(--tu-bg); }
.tu-xinfo > div { min-width: 0; line-height: 1.3; }
.tu-xinfo dt { font-size: 11.5px; font-weight: 500; color: var(--tu-muted); }
.tu-xinfo dd { margin: 0; font-size: 14.5px; font-weight: 600; color: var(--tu-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.tu-xtools { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.tu-xtimer { min-width: 172px; padding: 8px 16px; border-radius: 12px; background: var(--tu-ink); color: #fff; line-height: 1.2; transition: background-color .3s; }
.tu-xtimer small { display: block; font-size: 12px; font-weight: 600; color: #C9D3EA; }
.tu-xclock { display: flex; min-height: 32px; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.tu-xtimer.time-warn { background: var(--tu-accent); color: var(--tu-ink); }
.tu-xtimer.time-warn small { color: var(--tu-warn-dark); }
.tu-xtimer.time-danger { background: #C81E1E; }
.tu-xtimer.time-danger small { color: #FDECEC; }
.tu-xtimer.time-danger .tu-xclock { animation: tuBlink 1s steps(2) infinite; }
@keyframes tuBlink { 50% { opacity: .45; } }

/* ---------- แถบสถานะ: ทำแล้วกี่ข้อ · บันทึกอัตโนมัติ · ส่งแบบทดสอบ ---------- */
.tu-xbar { background: #fff; border-bottom: 1px solid var(--tu-line); box-shadow: 0 2px 8px rgba(14, 26, 51, .04); }
.tu-xbar-in { padding: 10px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.tu-xprog { flex: 1 1 360px; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 14px; }
.tu-xprog-n b { font-weight: 700; font-size: 18px; }
.tu-xprog .tu-meter-bar { flex: 1 1 140px; max-width: 260px; height: 8px; border-radius: 4px; }
.tu-xprog .tu-meter-bar span { transition: width .25s; }
.tu-xsave { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--tu-muted); }
.tu-xsave::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tu-line-input); }
.tu-xsave.is-ok::before { background: var(--tu-ok); }
.tu-xsave.is-busy::before { background: var(--tu-accent); }
.tu-xsave.is-err { color: var(--tu-err-ink); font-weight: 600; }
.tu-xsave.is-err::before { background: var(--tu-err-ink); }
.tu-xbar-act { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

/* ---------- เครื่องมือบนกระดาษข้อสอบ: ซูม · ไฮไลต์ (tep-annotate.js) ---------- */
.tu-xkit { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.tu-xkit button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 40px; height: 40px; padding: 0 12px; border: 1.5px solid var(--tu-line); border-radius: 10px; background: #fff; color: var(--tu-ink); font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
.tu-xkit button svg { flex: none; }
.tu-xkit button:hover:not(:disabled) { background: var(--tu-primary-faint); border-color: var(--tu-primary); color: var(--tu-primary); }
.tu-xkit button:active:not(:disabled) { background: var(--tu-primary-soft); }
.tu-xkit button:disabled { background: var(--tu-bg); color: var(--tu-line-input); border-color: var(--tu-line-soft); cursor: not-allowed; }
.tu-xkit button[aria-pressed="true"] { background: #FFF2A8; border-color: #D9A400; color: #5C4500; box-shadow: 0 0 0 3px rgba(217, 164, 0, .22); }
/* ซูม: ปุ่ม − 100% + ติดกันเป็นชุดเดียว */
.tu-xkit #kitZoomOut { border-radius: 10px 0 0 10px; }
.tu-xkit #kitZoomReset { min-width: 64px; margin: 0 -1.5px; border-radius: 0; font-variant-numeric: tabular-nums; }
.tu-xkit #kitZoomReset.is-changed { color: var(--tu-primary); }
.tu-xkit #kitZoomIn { border-radius: 0 10px 10px 0; }
.tu-xkit #kitZoomOut:hover, .tu-xkit #kitZoomReset:hover, .tu-xkit #kitZoomIn:hover { position: relative; z-index: 1; }
.tu-xkit-sep { width: 1px; height: 24px; margin: 0 4px; background: var(--tu-line); }
.tu-xkit .tu-xkit-zoom { gap: 0; }

/* ---------- พื้นที่ทำข้อสอบ: แบบทดสอบ (ซ้าย) + กระดาษคำตอบ (ขวา) ----------
   ห้องสอบใช้จอคอม (1366–1920): ข้อสอบกินพื้นที่หลัก · กระดาษคำตอบคงที่พอคลิกวงกลม */
.tu-exam { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.tu-xbody { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; padding: 16px 24px; background: #E4E8EF; }
@media (min-width: 1600px) {
  .tu-xbody { grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; padding: 18px 28px; }
}
@media (max-width: 1366px) {
  .tu-xbody { grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; }
}
@media (max-width: 1200px) {
  .tu-xbody { grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; padding: 12px 16px; }
}
.tu-sheet-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; margin: 0; scroll-behavior: smooth; }

/* ---------- กระดาษข้อสอบ ---------- */
.tu-paper { min-height: 0; overflow: auto; scroll-behavior: smooth; }
.tu-page { max-width: 920px; margin: 0 auto 8px; padding: 40px 52px 52px; background: #fff; color: #111; box-shadow: 0 1px 3px rgba(0, 0, 0, .14), 0 10px 28px rgba(14, 26, 51, .10); font-family: "Times New Roman", Times, Sarabun, serif; font-size: 18px; line-height: 1.65; }
/* ซูม: --pz ถูกตั้งที่ #examPaper โดย tep-annotate.js (ค่า 0.8–1.6) — ความกว้างหน้ากระดาษปรับเองตามพื้นที่ จึงไม่เกิดแถบเลื่อนแนวนอน */
.tu-paper .tu-page { zoom: var(--pz, 1); }
@supports not (zoom: 1) { .tu-paper .tu-page { font-size: calc(18px * var(--pz, 1)); } }

/* ไฮไลต์ (ดับเบิลคลิกเพื่อลบ) */
.tu-hl { background: #FFE45C; color: inherit; border-radius: 2px; padding: 0; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.tu-hl:hover { background: #FFD21F; outline: 1.5px dashed #B88A00; outline-offset: 1px; cursor: pointer; }
.tu-paper.is-hl-mode { cursor: text; }
.tu-paper.is-hl-mode ::selection { background: #FFE45C; color: #111; }

.tu-page-head { text-align: center; padding-bottom: 12px; border-bottom: 3px double #111; font-family: Sarabun, "Times New Roman", serif; }
.tu-page-head b { display: block; font-family: "Times New Roman", Times, serif; font-size: 22px; letter-spacing: .5px; }
.tu-page-head span { display: block; font-size: 17px; }
.tu-page-head small { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin-top: 10px; font-size: 14px; }
.tu-page-end { margin-top: 36px; text-align: center; font-weight: 700; letter-spacing: 2px; }

.tu-page .tu-x-cat { margin: 32px 0 8px; padding: 6px 0; border-top: 1.5px solid #111; border-bottom: 1.5px solid #111; text-align: center; font-size: 20px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; }
.tu-page .tu-x-part { margin: 22px 0 6px; font-size: 18px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.tu-page .tu-x-sub { margin: 12px 0 4px; font-size: 17px; font-weight: 700; font-style: italic; }
.tu-x-intro { margin: 0 0 10px; padding: 10px 14px; border: 1px solid #111; font-style: italic; }
.tu-passage { margin: 16px 0 8px; padding: 14px 18px; border: 1px solid #111; line-height: 1.75; }
.tu-page .tu-passage h4 { margin: 0 0 8px; text-align: center; font-size: 17px; font-weight: 700; }
.tu-passage.is-audio-only { margin: 14px 0 2px; padding: 0; border: 0; }
.tu-audio { margin: 4px 0 8px; font-family: Sarabun, sans-serif; }
.tu-audio audio { width: 100%; max-width: 420px; }
/* ตัวเล่นเสียงแบบเล่นได้ครั้งเดียว (tep-audio.js) */
.tu-play1 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; max-width: 520px; padding: 8px 12px; border: 1.5px solid #C9D3EA; border-radius: 12px; background: #F5F8FD; font-size: 14px; line-height: 1.3; }
.tu-play1-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 16px; border: 0; border-radius: 999px; background: #1F5FA8; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.tu-play1-btn:hover:not(:disabled) { background: #174C88; }
.tu-play1-btn:disabled { cursor: default; }
.tu-play1-bar { flex: 1 1 120px; height: 8px; border-radius: 4px; background: #DDE4F0; overflow: hidden; }
.tu-play1-bar > span { display: block; height: 100%; width: 0; background: #1F5FA8; transition: width .25s linear; }
.tu-play1-time { font-variant-numeric: tabular-nums; color: #33405C; }
.tu-play1-note { flex: 1 1 100%; font-size: 12.5px; color: #5B6785; }
.tu-play1[data-state="loading"] .tu-play1-btn, .tu-play1[data-state="playing"] .tu-play1-btn { background: #E8A100; color: #1A1A1A; }
.tu-play1[data-state="done"] { border-color: #B9DEC8; background: #F1F8F4; }
.tu-play1[data-state="done"] .tu-play1-btn { background: #8FB7A0; }
.tu-play1[data-state="done"] .tu-play1-bar > span { background: #3E9B66; }
.tu-play1[data-state="error"] { border-color: #F1B5B5; background: #FDF2F2; }
.tu-play1[data-state="error"] .tu-play1-btn { background: #C9A3A3; }
.tu-play1[data-state="error"] .tu-play1-note { color: #A51717; font-weight: 600; }

/* เนื้อหาข้อสอบจากฐานข้อมูล (HTML) — คืนค่าเริ่มต้นที่ tep-ui.css ล้างไว้ */
.tu-page p { margin: 0 0 8px; }
.tu-page p:last-child { margin-bottom: 0; }
.tu-page ul, .tu-page ol:not(.tu-q-choices) { list-style: revert; padding-left: 22px; margin: 0 0 8px; }
.tu-page img, .tu-q-text img, .tu-q-fig {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  margin: 0.35em 0;
  vertical-align: top;
}
.tu-q-choices .v img, .tu-q-choices .tu-q-fig {
  display: inline-block;
  margin: 0.15em 0;
  max-height: 220px;
}
.tu-page table { border-collapse: collapse; max-width: 100%; margin: 0.35em 0; }
.tu-page td, .tu-page th { padding: 4px 8px; vertical-align: top; }
/* ย่อช่องว่างจากย่อหน้าว่าง / บรรทัดว่างในเนื้อหาข้อสอบ */
.tu-q-text p { margin: 0 0 0.35em; line-height: 1.45; }
.tu-q-text p:empty,
.tu-q-text p:has(> br:only-child) { display: none; }
.tu-q-text br + br { display: none; }

/* ข้อสอบแต่ละข้อ: "1. คำถาม" แล้วตัวเลือก (A)–(D) เยื้องใต้คำถาม */
.tu-q { display: grid; grid-template-columns: 2.4em minmax(0, 1fr); padding: 10px 8px; margin: 0 -8px; scroll-margin-top: 16px; }
/* ข้อที่ Next unanswered พาไป (tep-exam.js ใส่ .is-pick): พื้นหลังชมพูอ่อน */
.tu-q.is-pick { background: #FFE3EA; border-radius: 8px; box-shadow: inset 4px 0 0 #E5718C; }
.tu-omr tbody tr.is-pick > * { background: #FFE3EA !important; }
.tu-q-head { display: contents; }
.tu-q-no { font-weight: 700; }
.tu-q-no::after { content: "."; }
.tu-q-text { min-width: 0; }
.tu-page .tu-q-choices { grid-column: 2; margin: 4px 0 0; display: flex; flex-direction: column; gap: 2px; }
.tu-q-choices li { display: flex; gap: 6px; align-items: baseline; }
.tu-q-choices .k { flex: none; min-width: 2.4em; padding: 0 2px; text-align: center; border-radius: 50%; transition: box-shadow .15s, color .15s; }
.tu-q-choices .k::before { content: "("; }
.tu-q-choices .k::after { content: ")"; }
.tu-q-choices .v { min-width: 0; }
/* ตัวเลือกที่ตอบไว้ในกระดาษคำตอบ: วงด้วยปากกา */
.tu-q-choices li.on .k { color: #1E4FA3; font-weight: 700; box-shadow: 0 0 0 1.8px #1E4FA3; }

/* ---------- กระดาษคำตอบ (OMR) ---------- */
.tu-sheet { --omr: #1F5FA8; --omr-soft: #EAF2FB; --pencil: #22262C; min-height: 0; display: flex; flex-direction: column; background: #fff; border: 1.5px solid var(--omr); border-radius: 3px; overflow: hidden; box-shadow: 0 1px 3px rgba(0, 0, 0, .14), 0 10px 28px rgba(14, 26, 51, .10); color: var(--omr); }
.tu-omr-head { padding: 12px 14px 10px; border-bottom: 1.5px solid var(--omr); }
.tu-omr-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 8px; }
.tu-omr-title b { font-size: 18px; font-weight: 700; }
.tu-omr-title span { font-size: 11px; font-weight: 600; letter-spacing: 1px; }
.tu-omr-info { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; margin-top: 8px !important; }
.tu-omr-info > div { min-width: 0; padding: 2px 8px 4px; border: 1px solid var(--omr); }
.tu-omr-info > div.wide { grid-column: 1 / -1; }
.tu-omr-info dt { font-size: 10.5px; font-weight: 600; line-height: 1.3; }
.tu-omr-info dd { color: var(--pencil); font-size: 14px; font-weight: 500; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tu-omr-how { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 8px !important; font-size: 12px; }
.tu-omr-ex { display: inline-flex; gap: 3px; }
.tu-omr-ex i { width: 15px; height: 15px; border-radius: 50%; border: 1.2px solid var(--omr); }
.tu-omr-ex i.on { background: var(--pencil); border-color: var(--pencil); }

.tu-omr { width: 100%; border-collapse: collapse; font-size: 13px; }
.tu-omr tbody th, .tu-omr td { padding: 3px 2px; text-align: center; }
.tu-omr tbody tr:nth-child(10n+6) > *, .tu-omr tbody tr:nth-child(10n+7) > *, .tu-omr tbody tr:nth-child(10n+8) > *,
.tu-omr tbody tr:nth-child(10n+9) > *, .tu-omr tbody tr:nth-child(10n) > * { background: var(--omr-soft); }
.tu-omr tbody tr:nth-child(5n) > * { border-bottom: 1px solid var(--omr); }
.tu-omr tbody th { position: relative; width: 60px; padding-left: 14px; }
/* แถบดำขอบซ้าย (timing mark) แบบกระดาษคำตอบจริง */
.tu-omr tbody th::before { content: ""; position: absolute; left: 0; top: 50%; width: 9px; height: 5px; margin-top: -2.5px; background: var(--pencil); }
.tu-omr tbody th a { display: flex; align-items: center; justify-content: flex-end; height: 28px; padding-right: 8px; color: var(--omr) !important; font-weight: 700; font-variant-numeric: tabular-nums; text-decoration: none; }
.tu-omr tbody th a:hover { text-decoration: underline; }
.tu-omr tbody th.is-err a { color: var(--tu-err-ink) !important; }
.tu-omr tbody th.is-err a::before { content: "!"; margin-right: 4px; }
.tu-bub { position: relative; display: inline-flex; cursor: pointer; }
.tu-bub input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tu-bub span { width: 30px; height: 30px; border-radius: 50%; border: 1.3px solid var(--omr); background: #fff; color: var(--omr); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; transition: background-color .1s, border-color .1s; }
.tu-bub:hover span { background: var(--omr-soft); }
.tu-bub input:checked + span { background: var(--pencil); border-color: var(--pencil); color: rgba(255, 255, 255, .7); }
.tu-bub input:focus-visible + span { outline: 3px solid #8CBCE3; outline-offset: 2px; }
.tu-bub input:disabled, .tu-bub input:disabled + span { cursor: not-allowed; }
.tu-bub input:disabled + span { opacity: .6; }

/* ---------- กล่องข้อความ (tep-dialog.js) และหน้าจอกำลังส่ง ---------- */
.tu-dlg, .tu-busy { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(14, 26, 51, .72); animation: tuDlgFade .2s ease-out; }
.tu-busy[hidden] { display: none; }
.tu-dlg-box, .tu-busy-box { width: 100%; max-width: 460px; padding: 28px 24px 22px; border-radius: 16px; background: #fff; color: var(--tu-ink); text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); animation: tuDlgPop .25s ease-out; }
.tu-dlg-icon { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--tu-primary-soft); color: var(--tu-primary); font-size: 28px; font-weight: 700; line-height: 1; }
.tu-dlg.is-success .tu-dlg-icon { background: var(--tu-ok-bg); color: var(--tu-ok); }
.tu-dlg.is-warning .tu-dlg-icon { background: var(--tu-warn-bg); color: var(--tu-warn-ink); }
.tu-dlg.is-danger .tu-dlg-icon { background: var(--tu-err-bg); color: var(--tu-err-ink); }
.tu-dlg .tu-dlg-title { margin: 0 0 8px; font-weight: 600; font-size: 20px; line-height: 1.4; }
.tu-dlg .tu-dlg-text { margin: 0; color: var(--tu-muted); line-height: 1.65; }
.tu-dlg-text b { color: var(--tu-ink); font-weight: 600; }
.tu-dlg-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }
.tu-dlg-actions .tu-btn { min-width: 132px; }
.tu-dlg.is-danger .tu-btn-primary { background: #C81E1E; }
.tu-dlg.is-danger .tu-btn-primary:hover { background: #A51717; }
.tu-busy-box { display: flex; flex-direction: column; align-items: center; gap: 14px; font-size: 17px; font-weight: 500; }
.tu-spin { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--tu-primary-soft); border-top-color: var(--tu-primary); animation: tuSpin .8s linear infinite; }
@keyframes tuSpin { to { transform: rotate(360deg); } }
@keyframes tuDlgFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tuDlgPop { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .tu-xtimer.time-danger .tu-xclock, .tu-dlg, .tu-dlg-box, .tu-busy, .tu-busy-box { animation: none; }
  .tu-paper, .tu-sheet-scroll { scroll-behavior: auto; }
}

/* ---------- จอโน้ตบุ๊กแคบ: ย่อขอบกระดาษข้อสอบ แต่กระดาษคำตอบยังอยู่ด้านขวา ---------- */
@media (max-width: 1100px) {
  .tu-page { padding: 32px 36px 44px; font-size: 17px; }
}
/* ---------- จอแคบมาก (มือถือ): เลื่อนทั้งหน้า กระดาษคำตอบอยู่ใต้ข้อสอบ ---------- */
@media (max-width: 640px) {
  .tu-exam { height: auto; overflow: visible; }
  .tu-exam .tu-xtop { position: sticky; top: 0; }
  .tu-xbody { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .tu-paper, .tu-sheet-scroll { overflow: visible; }
  .tu-page { padding: 28px 22px 36px; }
  .tu-xhead-in, .tu-xbar-in { padding: 8px 12px; }
  .tu-xwho { padding-left: 0; border-left: 0; }
  .tu-xhead .tu-brand-txt span { display: none; }
  .tu-xtimer { min-width: 0; }
  .tu-xclock { font-size: 22px; }
}

/* ---------- หน้ารอสอบ / คำชี้แจงข้อสอบ (main.jsp) ---------- */
/* ทดสอบเสียงก่อนสอบ (บังคับผ่านก่อนเข้าสอบ) */
.tu-soundcheck { padding: 22px 24px; border: 1px solid var(--tu-line); border-radius: 16px; background: #fff; box-shadow: 0 2px 10px rgba(14, 26, 51, .05); display: flex; flex-direction: column; gap: 14px; }
.tu-soundcheck[data-state="passed"] { border-color: #7BC9A0; background: #F3FBF6; }
.tu-soundcheck.is-flash { box-shadow: 0 0 0 3px rgba(226, 122, 18, .45); }
.tu-soundcheck-head { display: flex; align-items: flex-start; gap: 14px; }
.tu-soundcheck-ico { width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--tu-primary-faint); color: var(--tu-primary); display: flex; align-items: center; justify-content: center; }
.tu-soundcheck[data-state="passed"] .tu-soundcheck-ico { background: #D8F3E4; color: #1B7A4A; }
.tu-soundcheck-head h2 { margin: 0; font-size: 20px; font-weight: 700; color: var(--tu-ink); }
.tu-soundcheck-head p { margin: 4px 0 0; font-size: 15px; color: #44506B; line-height: 1.45; }
.tu-soundcheck-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tu-soundcheck-status { font-size: 14px; font-weight: 600; color: var(--tu-muted); }
.tu-soundcheck-status.is-ok { color: #1B7A4A; }
.tu-soundcheck-status.is-warn { color: var(--tu-warn-dark); }
.tu-soundcheck-status.is-err { color: #C81E1E; }
.tu-soundcheck-need { margin: 0; }

/* การ์ดหลัก: นับถอยหลังขนาดใหญ่ + วัน/เวลา + ที่นั่งสอบ */
.tu-wait { display: flex; flex-wrap: wrap; align-items: center; gap: 24px 32px; padding: 28px; border: 1px solid var(--tu-line); border-radius: 16px; background: #fff; box-shadow: 0 2px 10px rgba(14, 26, 51, .05); }
.tu-wait-count { flex: none; box-sizing: border-box; width: 340px; min-width: 340px; max-width: 340px; padding: 18px 26px 16px; border-radius: 14px; background: var(--tu-ink); color: #fff; text-align: center; display: flex; flex-direction: column; gap: 6px; }
.tu-wait-count small { font-size: 15px; font-weight: 600; color: #C9D3EA; }
.tu-wait-clock { display: flex; justify-content: center; align-items: baseline; width: 100%; font-size: 64px; font-weight: 700; line-height: 1.1; font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; letter-spacing: 0; }
/* plugin ใส่ข้อความ "00:" / "00:" / "00" ใน .hours .minutes .seconds — ล็อกความกว้างแต่ละช่องกันกล่องหดขยาย */
.tu-wait-clock .hours,
.tu-wait-clock .minutes { flex: none; width: 3ch; text-align: right; }
.tu-wait-clock .seconds { flex: none; width: 2ch; text-align: right; }
.tu-wait-unit { font-size: 13px; color: #9FB0CF; }
.tu-wait-info { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tu-wait-info small { align-self: flex-start; padding: 4px 14px; border-radius: 999px; background: var(--tu-primary-soft); color: var(--tu-primary-dark); font-size: 15px; font-weight: 600; }
.tu-wait-info strong { font-weight: 600; font-size: 26px; line-height: 1.35; color: var(--tu-ink); }
.tu-wait-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 2px !important; font-size: 16px; color: #33405C; }
.tu-wait-meta li { display: flex; align-items: center; gap: 8px; }
.tu-wait-meta svg { flex: none; color: var(--tu-primary); }
.tu-wait-note { margin-top: 6px !important; font-size: 15px; color: #44506B; }
.tu-wait-tiles { flex: 1 1 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; }
.tu-wait-tiles > div { min-width: 0; padding: 14px 18px; border: 1px solid #CFE3F4; border-radius: 12px; background: var(--tu-primary-faint); display: flex; flex-direction: column; gap: 2px; }
.tu-wait-tiles dt { font-size: 14px; font-weight: 600; color: #44506B; }
.tu-wait-tiles dd { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.25; color: var(--tu-primary-dark); word-break: break-word; }

/* ข้อปฏิบัติสำคัญ: ขึ้นก่อนรูปแบบข้อสอบ ตัวใหญ่ เด่นด้วยสีส้มอ่อน */
.tu-rules { padding: 22px 24px; border: 1px solid #F3C99A; border-left: 6px solid var(--tu-warn-line); border-radius: 14px; background: var(--tu-warn-bg); }
.tu-rules-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.tu-rules-ico { width: 44px; height: 44px; flex: none; border-radius: 12px; background: #fff; color: var(--tu-warn-line); display: flex; align-items: center; justify-content: center; }
.tu-rules-head .tu-h2 { font-size: 22px; font-weight: 700; color: var(--tu-warn-dark); }
/* .tu ol/ul/h3/p รีเซ็ต margin และ padding ทั้งหน้า จึงต้องเจาะจงกว่านั้น */
.tu .tu-rules-list { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 2px 12px 0 56px; list-style: none; }
.tu-rules-list > li { display: flex; gap: 14px; align-items: flex-start; font-size: 17px; font-weight: 500; line-height: 1.55; color: var(--tu-ink); }
.tu-rules-list .tu-rule-sub { list-style: disc; margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 15px; font-weight: 500; }
.tu-rules-list .tu-rule-sub li { display: list-item; }
/* กำหนดการวันสอบในกล่องข้อปฏิบัติ (main.jsp) — ชุดเดียวกับระบบสมัครสอบ */
.tu .tu-rules-sub { margin: 22px 12px 10px 56px; font-size: 18px; font-weight: 700; color: var(--tu-warn-dark); }
.tu .tu-rules .tu-sched { display: flex; flex-direction: column; gap: 8px; margin: 0 12px 0 56px; padding: 0; list-style: none; font-size: 16px; }
.tu-sched li { display: flex; gap: 16px; align-items: baseline; }
.tu-sched b { flex: none; min-width: 132px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--tu-ink); }
.tu .tu-rules .tu-sched-note { margin: 14px 12px 0 56px !important; font-size: 15px; font-weight: 600; color: var(--tu-warn-dark); }
.tu-rules-list .n { width: 28px; height: 28px; flex: none; margin-top: 1px; border-radius: 50%; background: var(--tu-warn-line); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }

/* ตารางรูปแบบข้อสอบ */
.tu-table .tu-total td { border-top: 2px solid var(--tu-ink); background: var(--tu-primary-faint); }

@media (max-width: 720px) {
  .tu-wait { padding: 20px; }
  .tu-wait-count { width: 100%; min-width: 0; max-width: none; }
  .tu-wait-clock { font-size: 48px; }
  .tu-wait-tiles { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .tu-wait-tiles > div { flex-direction: row; align-items: baseline; justify-content: space-between; }
  .tu-wait-tiles dd { font-size: 22px; }
  .tu-rules { padding: 18px; }
  .tu .tu-rules-list { padding-left: 0; }
  .tu .tu-rules-sub,
  .tu .tu-rules .tu-sched,
  .tu .tu-rules .tu-sched-note { margin-left: 0 !important; }
}

/* ---------- ปรับปรุงหน้าทำข้อสอบ (do.jsp): หัว · แถบสถานะ · กระดาษคำตอบ ---------- */
/* แถบหัว: ข้อมูลห้อง/ที่นั่งอ่านง่ายขึ้น */
.tu-xphoto { width: 52px; height: 52px; }
.tu-xwho-txt b { font-size: 18px; }
.tu-xwho-txt span { font-size: 14px; }
.tu-xinfo { flex-basis: 420px; padding: 8px 16px; }
.tu-xinfo dt { font-size: 12.5px; }
.tu-xinfo dd { font-size: 15.5px; }

/* แถบสถานะ: แถบความคืบหน้าหนาขึ้น ปุ่มส่งเด่นชัด */
.tu-xprog .tu-meter-bar { height: 10px; border-radius: 5px; }
.tu-xprog-n b { font-size: 20px; }
.tu-xsave { font-size: 14px; }
.tu-xbar-act .tu-btn { min-height: 44px; font-size: 15px; }
.tu-xbar-act .tu-btn-primary { min-width: 150px; font-size: 16px; }

/* ข้อที่ตอบแล้ว: แถบเขียวบางๆ ด้านซ้ายของข้อ (ข้อที่ Next unanswered พาไปยังใช้สีชมพูตามเดิม) */
.tu-q.is-done:not(.is-pick) { box-shadow: inset 3px 0 0 #8FD0AB; }

/* กระดาษคำตอบจอคอม: วงกลมคลิกเมาส์ง่าย · ไม่กินพื้นที่ข้อสอบ */
.tu-omr-head { padding: 12px 14px 10px; }
.tu-omr-title b { font-size: 18px; }
.tu-omr-title span { font-size: 11px; }
.tu-omr-info > div { padding: 5px 8px 6px; }
.tu-omr-info dt { font-size: 11px; margin-bottom: 2px; }
.tu-omr-info dd { font-size: 14px; }
.tu-omr-how { font-size: 12px; }
.tu-omr-ex i { width: 15px; height: 15px; }
.tu-omr { font-size: 13px; table-layout: fixed; }
.tu-omr tbody th, .tu-omr td { padding: 3px 2px; }
.tu-omr tbody th { width: 56px; padding-left: 14px; }
.tu-omr tbody th a { height: 32px; padding-right: 8px; font-size: 14px; }
.tu-bub span { width: 32px; height: 32px; font-size: 12px; font-weight: 700; }
.tu-bub input:checked + span { color: #fff; }
.tu-omr tbody tr:hover > th, .tu-omr tbody tr:hover > td { background: #DCEAFA; }

/* วงกลมรอบตัวเลือกที่ตอบแล้ว: ให้เป็นวงกลมจริง (กว้าง = สูง) ไม่ใช่วงรี */
.tu-q-choices .k { display: inline-flex; align-items: center; justify-content: center; flex: none; box-sizing: border-box; width: 2.3em; height: 2.3em; min-width: 0; padding: 0; margin: -.15em 0; line-height: 1; border-radius: 50%; }

/* ---------- กล่องข้อมูลการสอบในแถบหัว (Room · Seat No. · Session · Test time) ----------
   สไตล์เดียวกับแผ่นข้อมูลของระบบสมัครสอบ: พื้นฟ้าอ่อน ขอบฟ้าจาง ป้ายกำกับเล็ก ค่าตัวใหญ่ และเน้นเลขที่นั่ง */
.tu .tu-xinfo { flex: 0 1 auto; min-width: 300px; padding: 10px 22px; display: grid; grid-template-columns: minmax(0, max-content) minmax(0, max-content); gap: 8px 36px; border: 1px solid #CFE3F4; border-radius: 14px; background: var(--tu-primary-faint); }
.tu-xinfo > div { padding: 0; line-height: 1.3; }
.tu-xinfo dt { margin-bottom: 1px; font-size: 12.5px; font-weight: 600; letter-spacing: .2px; color: #44506B; }
.tu-xinfo dd { font-size: 16px; font-weight: 600; color: var(--tu-ink); }
/* เลขที่นั่ง: เน้นที่สุด เพราะผู้เข้าสอบต้องตรวจว่านั่งถูกเครื่อง */
.tu-xinfo > div:nth-child(2) dd { font-size: 22px; font-weight: 700; line-height: 1.15; color: var(--tu-primary-dark); }
@media (max-width: 1100px) { .tu .tu-xinfo { padding: 8px 16px; gap: 6px 24px; } }

/* หัวกระดาษคำตอบ: ชื่อเต็มแถวบน · รหัส/รอบแถวล่าง (คอลัมน์แคบแล้วไม่เบียด) */
.tu .tu-omr-info { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.tu .tu-omr-info > div.wide { grid-column: 1 / -1; }
.tu .tu-omr-info > div:nth-child(2) { min-width: 72px; }
.tu .tu-omr-info dd { min-height: 1.35em; }

/* ชื่อมหาวิทยาลัยใต้ชื่อระบบในแถบหัว: ไทย "มหาวิทยาลัยทักษิณ" / อังกฤษ "THAKSIN UNIVERSITY" */
.tu-xhead .tu-brand-txt small.tu-brand-uni { display: block; margin-top: 1px; font-size: 12.5px; font-weight: 600; letter-spacing: .6px; color: var(--tu-primary-dark); }
.tu-xhead .tu-brand-txt small.tu-brand-uni span { font-size: inherit; font-weight: inherit; color: inherit; }
@media (max-width: 640px) { .tu-xhead .tu-brand-txt small.tu-brand-uni { display: none; } }

/* หัวกระดาษคำตอบ: ข้อความวิธีใช้อยู่บรรทัดเดียวกับชื่อ "ANSWER SHEET" (ไม่แสดงคำว่า TSU-TEP แล้ว) */
.tu .tu-omr-title { flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.tu .tu-omr-title .tu-omr-how { flex: 1 1 140px; margin: 0 !important; justify-content: flex-end; gap: 2px 6px; text-align: right; font-size: 11.5px; line-height: 1.35; }
.tu .tu-omr-title .tu-omr-ex { letter-spacing: 0; }
.tu .tu-omr-info { margin-top: 10px !important; }

/* Exit Exam: กล่องหัว 3 ช่อง (วัน · รอบ · เวลา) */
.tu .tu-xinfo:has(> div:nth-child(3):last-child) {
  grid-template-columns: minmax(0, max-content) minmax(0, max-content) minmax(0, max-content);
  gap: 8px 28px;
}

/* คลิกเลือกบนข้อสอบ → วงตัวเลือก + ฝน OMR */
.tu-q-choices li[data-choice] { cursor: pointer; border-radius: 6px; padding: 2px 4px; margin: 0 -4px; }
.tu-q-choices li[data-choice]:hover { background: rgba(31, 95, 168, .06); }
.tu-q-choices li[data-choice]:hover .k { color: #1E4FA3; box-shadow: 0 0 0 1.5px rgba(30, 79, 163, .35); }
