/* Exams: admin builder and grading, student exam page and the exam screen. Uses the colour variables from styles.css. */

/* ---------- admin ---------- */
.mono, textarea.mono, .x-pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.x-stu { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.x-stu-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; margin: 0; font-weight: 500; }
.x-stu-row:last-child { border-bottom: 0; }
.x-stu-row:hover { background: var(--green-50); }
.x-stu-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--green); flex: none; }
.x-stu-row > span:nth-child(2) { flex: 1; min-width: 0; }
.x-opts { display: grid; gap: 4px; margin-bottom: 12px; }
.x-check { display: flex; align-items: center; gap: 10px; font-weight: 600; margin: 4px 0; cursor: pointer; }
.x-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--green); flex: none; }
.x-optbox { margin: 4px 0 10px; }
.x-optbox .opt-row input[type=checkbox] { accent-color: var(--green); width: 18px; height: 18px; margin: 0; flex: none; }
.x-optbox .opt-row.correct input[type=text] { border-color: var(--green); background: var(--green-50); font-weight: 600; }
.x-pre { background: #0f1a14; color: #d7f5df; border-radius: 10px; padding: 12px 14px; font-size: 13px; overflow: auto; max-height: 300px; margin: 6px 0 0; white-space: pre; }
.x-pre.x-wrap { background: #f4f8f5; color: var(--black); white-space: pre-wrap; font-family: inherit; font-size: 14px; }
.x-gh { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.x-score { font-size: 28px; font-weight: 800; letter-spacing: -.03em; background: var(--black); color: var(--green-l); border-radius: 14px; padding: 8px 18px; }
.x-score b { color: #fff; }
.x-vio { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px; padding: 8px 12px; margin-bottom: 14px; font-size: 13px; color: #9a3412; }
.x-vio summary { cursor: pointer; font-weight: 700; }
.x-vio ul { margin: 8px 0 2px; padding-left: 18px; }
.x-gq .x-qt { font-weight: 600; margin: 4px 0 6px; line-height: 1.5; }
.x-lab { font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 12px 0 4px; }
.x-mark { display: flex; align-items: center; gap: 14px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.x-mark label { margin: 0; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.x-mark input { width: 110px; margin: 0; }
.x-out { margin-top: 8px; }

/* ---------- student: exams page ---------- */
.ex-h { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 0 10px; }
.ex-card { padding: 18px 20px; }
.ex-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ex-act { margin-top: 14px; }
.lock-card { text-align: center; padding: 44px 22px; }
.lock-ic { width: 64px; height: 64px; border-radius: 50%; background: var(--green-100); color: var(--green-d); display: grid; place-items: center; margin: 0 auto; }
.nav-btn.locked { opacity: .6; }
.nav-btn.locked::after { content: '\1F512'; font-size: 11px; margin-left: auto; }
@media (max-width: 900px) { .nav-btn.locked::after { display: none; } }

/* ---------- student: overlays ---------- */
.ex-over { position: fixed; inset: 0; z-index: 9000; background: rgba(10, 15, 12, .72); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.ex-over-top { z-index: 9600; }
.ex-over.ex-scroll { align-items: flex-start; }
.ex-box { background: #fff; border-radius: 18px; padding: 26px; width: 100%; max-width: 640px; box-shadow: 0 30px 80px rgba(0, 0, 0, .4); }
.ex-box.sm { max-width: 460px; }
.ex-box.wide { max-width: 820px; margin: 3vh auto; }
.ex-ins { background: var(--green-50); border: 1px solid var(--green-100); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; line-height: 1.6; }
.ex-rules { padding-left: 20px; line-height: 1.65; font-size: 14px; margin: 0 0 16px; }
.ex-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.ex-tick { width: 64px; height: 64px; border-radius: 50%; background: var(--green); color: #fff; font-size: 34px; display: grid; place-items: center; margin: 0 auto; }
.ex-rhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.ex-score { display: flex; align-items: center; gap: 18px; background: var(--black); color: #fff; border-radius: 16px; padding: 16px 22px; margin-bottom: 16px; }
.ex-big { font-size: 40px; font-weight: 800; letter-spacing: -.03em; color: var(--green-l); }
.ex-big small { font-size: 18px; color: #9fb3a7; }
.ex-pre { background: #f4f8f5; border-radius: 10px; padding: 10px 12px; font-size: 13px; overflow: auto; max-height: 260px; margin: 4px 0 0; white-space: pre; font-family: ui-monospace, Menlo, Consolas, monospace; }
.ex-pre.wrap { white-space: pre-wrap; font-family: inherit; font-size: 14px; }

/* ---------- student: the exam screen ---------- */
body.ex-lock { overflow: hidden; }
.ex-run { position: fixed; inset: 0; z-index: 9100; background: var(--bg); display: flex; flex-direction: column; user-select: none; -webkit-user-select: none; }
.ex-run textarea, .ex-run input[type=text] { user-select: text; -webkit-user-select: text; }
.ex-top { background: var(--black); color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 20px; flex: none; }
.ex-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.ex-meta { display: flex; align-items: center; gap: 14px; flex: none; }
.ex-warn { font-weight: 700; font-size: 13px; color: #9fb3a7; background: rgba(255, 255, 255, .08); border-radius: 99px; padding: 4px 12px; }
.ex-warn.on { color: #fde68a; background: rgba(245, 158, 11, .22); }
.ex-timer { font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 28px; letter-spacing: .02em; color: var(--green-l); min-width: 86px; text-align: right; font-variant-numeric: tabular-nums; }
.ex-timer.low { color: #fbbf24; }
.ex-timer.crit { color: #f87171; animation: exPulse 1s infinite; }
@keyframes exPulse { 50% { opacity: .45; } }
.ex-body { flex: 1; min-height: 0; overflow: auto; display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 20px; padding: 22px 24px; max-width: 1280px; width: 100%; margin: 0 auto; align-items: start; }
.ex-q { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); min-height: 320px; }
.ex-qhead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; font-weight: 700; color: var(--muted); }
.ex-qt { font-size: 18px; font-weight: 600; line-height: 1.55; margin-bottom: 18px; color: var(--black); }
.ex-opts { display: grid; gap: 10px; }
.ex-opt { display: flex; align-items: center; gap: 12px; margin: 0; padding: 13px 15px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 500; font-size: 15.5px; background: #fff; }
.ex-opt:hover { border-color: var(--green); }
.ex-opt.on { border-color: var(--green); background: var(--green-50); }
.ex-opt input { width: 18px; height: 18px; margin: 0; accent-color: var(--green); flex: none; }
.ex-l { width: 28px; height: 28px; border-radius: 8px; background: #eef2ef; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.ex-opt.on .ex-l { background: var(--green); color: #fff; }
.ex-in { width: 100%; font-size: 15.5px; }
.ex-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; line-height: 1.5; background: #0f1a14; color: #d7f5df; border-color: #0f1a14; tab-size: 4; }
.ex-side { position: sticky; top: 0; display: grid; gap: 14px; }
.ex-cam { background: #0f1a14; border-radius: 14px; overflow: hidden; position: relative; }
.ex-cam video { width: 100%; display: block; aspect-ratio: 4 / 3; object-fit: cover; transform: scaleX(-1); background: #000; }
.ex-cam span { position: absolute; left: 8px; bottom: 8px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px; }
.ex-cam span::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #ef4444; margin-right: 6px; }
.ex-prog { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.ex-prog b { color: var(--black); font-size: 16px; }
.ex-pal { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.ex-n { border: 1.5px solid var(--line); background: #fff; border-radius: 9px; padding: 8px 0; font-weight: 700; font-size: 13px; color: var(--muted); }
.ex-n.seen { background: #eef2ef; }
.ex-n.ans { background: var(--green-100); border-color: var(--green); color: var(--green-d); }
.ex-n.rev { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.ex-n.cur { outline: 2.5px solid var(--black); outline-offset: 1px; color: var(--black); }
.ex-key { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.ex-key i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; border: 1px solid var(--line); background: #eef2ef; }
.ex-key i.ans { background: var(--green-100); border-color: var(--green); } .ex-key i.rev { background: #fef3c7; border-color: #f59e0b; }
.ex-bar { flex: none; background: #fff; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 24px; }
.ex-bar > div:nth-child(2) { flex: 1; text-align: center; }
.ex-bar .flag { border-color: #f59e0b; color: #92400e; background: #fef3c7; }
@media (max-width: 860px) {
  .ex-body { grid-template-columns: 1fr; padding: 14px; }
  .ex-side { position: static; order: -1; grid-template-columns: 110px 1fr; align-items: start; }
  .ex-cam span { display: none; }
  .ex-q { padding: 18px; }
  .ex-qt { font-size: 16.5px; }
  .ex-bar { padding: 10px 12px; flex-wrap: wrap; }
  .ex-bar > div:nth-child(2) { order: 3; flex-basis: 100%; }
  .ex-top { padding: 10px 14px; }
  .ex-timer { font-size: 24px; }
}
