/* Regent Mock Test ออนไลน์ · โทนเดียวกับ Regent DB / โปรแกรม Mock Test (น้ำเงินเข้ม #28285E · ปุ่มฟ้า #2F7CF6) */
:root {
  --bg: #F2F4F7; --card: #FFFFFF; --ink: #111827; --muted: #6B7280; --faint: #9CA3AF; --line: #E5E7EB;
  --nav: #28285E; --nav-2: #34347A;
  --pri: #2F7CF6; --pri-2: #1F63D4; --pri-soft: #EAF2FF;
  --ok: #16A34A; --ok-soft: #E7F6EC; --warn: #C2700A; --warn-soft: #FEF3E2; --bad: #DC3E42; --bad-soft: #FDECEC;
  --font: "IBM Plex Sans Thai", "Leelawadee UI", "Segoe UI", Tahoma, sans-serif;
  --r: 18px; --r-ctl: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .07);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--card); border-radius: var(--r-ctl); padding: 10px 18px; font-weight: 600; }
button:hover { background: var(--bg); }
button:disabled { opacity: .55; cursor: default; }
button.pri { background: var(--pri); border-color: var(--pri); color: #fff; }
button.pri:hover:not(:disabled) { background: var(--pri-2); border-color: var(--pri-2); }
button.big { width: 100%; padding: 14px 20px; font-size: 17px; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
:focus-visible { outline: 2px solid var(--pri); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.err { color: var(--bad); font-size: 14px; min-height: 22px; margin: 10px 0 0; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--pri); animation: sp 0.8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- หน้าแรก / ส่งแล้ว ---------- */
.page { min-height: 100vh; display: flex; flex-direction: column; }
.top { background: var(--nav); color: #fff; padding: 18px 20px; }
.top-in { max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { height: 36px; width: auto; display: block; }
.mark { width: 38px; height: 38px; border-radius: 11px; background: rgba(255, 255, 255, .14); display: grid; place-items: center; font: 700 20px/1 Arial, sans-serif; flex: none; }
.brand-t { font-weight: 700; font-size: 16px; line-height: 1.25; }
.brand-s { font-size: 13px; color: #CACBE8; }
.hero { background: linear-gradient(180deg, var(--nav) 0 90px, transparent 90px); padding: 0 16px 32px; flex: 1; }
.card { max-width: 560px; margin: 0 auto; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 28px 26px; }
.card h1 { font-size: 24px; line-height: 1.3; margin: 0 0 6px; }
.card .lead { color: var(--muted); margin: 0 0 18px; }
.event { display: inline-block; font-size: 13px; font-weight: 600; color: var(--pri-2); background: var(--pri-soft); border-radius: 999px; padding: 3px 12px; margin-bottom: 12px; }
.facts { display: grid; gap: 10px; margin: 0 0 22px; padding: 16px 18px; background: var(--bg); border-radius: 14px; }
.fact { display: flex; gap: 12px; align-items: baseline; font-size: 15px; }
.fact b { min-width: 64px; }
label.f { display: block; margin: 14px 0 6px; font-size: 14px; font-weight: 600; }
label.f .opt { color: var(--faint); font-weight: 400; }
input[type=text], input[type=tel], input[type=email] { width: 100%; height: 48px; border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 0 14px; background: #fff; font-size: 16px; }
input:focus { outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px var(--pri-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 4px; font-size: 14px; color: var(--muted); }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--pri); flex: none; }
.actions { margin-top: 18px; }
.done-ic { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; font-size: 32px; margin: 0 auto 14px; }
.center { text-align: center; }
.foot { text-align: center; font-size: 13px; color: var(--faint); padding: 0 16px 24px; }
.note { font-size: 14px; color: var(--muted); background: var(--warn-soft); border-radius: 12px; padding: 10px 14px; margin: 0 0 16px; }

/* ---------- หน้าสอบ ---------- */
.exam { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto auto 1fr; }
.ebar { background: var(--nav); color: #fff; display: flex; align-items: center; gap: 14px; padding: 10px 18px; }
.ebar .who { min-width: 0; flex: 1; }
.ebar .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ebar .who span { font-size: 13px; color: #CACBE8; }
.timer { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; padding: 3px 14px; border-radius: 10px; background: rgba(255, 255, 255, .12); min-width: 96px; text-align: center; }
.timer.low { background: var(--bad); }
.ebar button.pri { padding: 9px 20px; }
.etabs { display: flex; gap: 6px; padding: 10px 18px 0; background: var(--bg); overflow-x: auto; }
.etabs button { border: 0; border-radius: 12px 12px 0 0; background: #E3E7ED; padding: 9px 20px; color: var(--muted); white-space: nowrap; }
.etabs button.on { background: var(--card); color: var(--ink); }
.etabs .wc { font-size: 12px; color: var(--muted); margin-left: 8px; font-weight: 400; }
.epane { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 0; background: var(--card); }
.prompt { overflow: auto; padding: 22px 26px; border-right: 1px solid var(--line); }
.prompt h3 { margin: 0 0 12px; font-size: 19px; }
.prompt p { margin: 0 0 10px; }
.prompt p.lead { color: var(--muted); font-style: italic; }
.prompt img { max-width: 100%; display: block; margin: 14px 0; border: 1px solid var(--line); border-radius: 8px; }
.answer { display: grid; grid-template-rows: 1fr auto; min-height: 0; padding: 14px 18px 10px; background: var(--bg); }
.answer textarea { width: 100%; height: 100%; min-height: 200px; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; font: 16px/1.75 Arial, var(--font); background: #fff; }
.answer textarea:focus { outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px var(--pri-soft); }
.wcbar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); padding: 8px 2px 0; }
.wcbar .under { color: var(--warn); }
.wcbar .okw { color: var(--ok); }
.sv { font-size: 12px; color: var(--faint); }
.sv.off { color: var(--warn); }

@media (max-width: 820px) {
  .exam { height: auto; min-height: 100dvh; grid-template-rows: auto auto auto; }
  .ebar { position: sticky; top: 0; z-index: 5; padding: 8px 12px; gap: 10px; }
  .ebar .who span { display: none; }
  .timer { font-size: 19px; min-width: 82px; padding: 2px 10px; }
  .ebar button.pri { padding: 8px 14px; }
  .etabs { padding: 8px 10px 0; position: sticky; top: 54px; z-index: 4; }
  .epane { grid-template-columns: 1fr; }
  .prompt { border-right: 0; border-bottom: 1px solid var(--line); padding: 16px 16px 8px; max-height: none; }
  .answer { padding: 12px 10px 16px; }
  .answer textarea { min-height: 55vh; }
  .card { padding: 22px 18px; }
}

/* ---------- หน้าต่างยืนยัน ---------- */
.ov { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.dlg { background: var(--card); border-radius: var(--r); box-shadow: 0 20px 50px rgba(0, 0, 0, .25); padding: 22px; width: min(440px, 100%); }
.dlg h2 { margin: 0 0 8px; font-size: 20px; }
.dlg table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 15px; }
.dlg td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
.dlg td:last-child { text-align: right; }
.dlg .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; pointer-events: none; }
#toast div { background: #111827; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); }
#toast div.bad { background: var(--bad); }
