/*
 * Online Test Series — exam screen.
 * Button colours (spec): Start green · Pause orange · Previous blue ·
 * Next indigo · Skip grey · Mark for Review purple · Clear outlined grey ·
 * Submit red. All pass WCAG AA contrast with white text.
 */
body.ots-exam-page { margin: 0; background: #eef2f7; }
body.ots-exam-page #wpadminbar { display: none; }
html:has(body.ots-exam-page) { margin-top: 0 !important; }

.ots-exam {
	--x-start: #15803d;   --x-start-h: #166534;
	--x-pause: #c2410c;   --x-pause-h: #9a3412;
	--x-prev: #1d4ed8;    --x-prev-h: #1e40af;
	--x-next: #3730a3;    --x-next-h: #312e81;
	--x-skip: #52606d;    --x-skip-h: #3e4a56;
	--x-review: #7e22ce;  --x-review-h: #6b21a8;
	--x-submit: #b91c1c;  --x-submit-h: #991b1b;
	--p-an: #16a34a; --p-na: #dc2626; --p-nv: #e2e8f0; --p-mk: #7e22ce;
	min-height: 100vh; min-height: 100dvh;
	display: flex; flex-direction: column;
	background: #eef2f7;
	font-size: 16px;
}

/* ---------- Buttons ---------- */
.ots-exam .ots-xbtn {
	-webkit-appearance: none; appearance: none;
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	min-height: 44px; padding: 8px 16px; margin: 0;
	border: 2px solid transparent; border-radius: 8px;
	font: inherit; font-size: .92rem; font-weight: 650; line-height: 1.2;
	text-transform: none; letter-spacing: normal; white-space: nowrap;
	color: #fff; cursor: pointer; box-shadow: none; text-decoration: none;
	transition: background-color .15s, border-color .15s, box-shadow .15s, opacity .15s;
}
.ots-exam .ots-xbtn:focus-visible { outline: none; box-shadow: 0 0 0 3px #fff, 0 0 0 5px #0f172a; }
.ots-exam .ots-xbtn[disabled] { opacity: .45; cursor: not-allowed; }
.ots-exam .ots-xbtn--block { width: 100%; }
.ots-exam .ots-xbtn--start { background: var(--x-start); }
.ots-exam .ots-xbtn--start:not([disabled]):hover { background: var(--x-start-h); }
.ots-exam .ots-xbtn--pause { background: var(--x-pause); }
.ots-exam .ots-xbtn--pause:not([disabled]):hover { background: var(--x-pause-h); }
.ots-exam .ots-xbtn--prev { background: var(--x-prev); }
.ots-exam .ots-xbtn--prev:not([disabled]):hover { background: var(--x-prev-h); }
.ots-exam .ots-xbtn--next { background: var(--x-next); }
.ots-exam .ots-xbtn--next:not([disabled]):hover { background: var(--x-next-h); }
.ots-exam .ots-xbtn--skip { background: var(--x-skip); }
.ots-exam .ots-xbtn--skip:not([disabled]):hover { background: var(--x-skip-h); }
.ots-exam .ots-xbtn--review { background: var(--x-review); }
.ots-exam .ots-xbtn--review:not([disabled]):hover { background: var(--x-review-h); }
.ots-exam .ots-xbtn--review[aria-pressed="true"] { background: #fff; color: var(--x-review); border-color: var(--x-review); }
.ots-exam .ots-xbtn--clear { background: #fff; color: #334155; border-color: #94a3b8; }
.ots-exam .ots-xbtn--clear:not([disabled]):hover { background: #f1f5f9; border-color: #64748b; }
.ots-exam .ots-xbtn--submit { background: var(--x-submit); }
.ots-exam .ots-xbtn--submit:not([disabled]):hover { background: var(--x-submit-h); }
.ots-exam .ots-xbtn--section { background: #0f766e; }
.ots-exam .ots-xbtn--palette { display: none; background: #334155; }

/* ---------- Top bar ---------- */
.ots-exam__bar {
	position: sticky; top: 0; z-index: 30;
	display: flex; align-items: center; gap: 16px;
	padding: 10px 20px; background: #0f172a; color: #fff;
	box-shadow: 0 2px 8px rgba(15, 23, 42, .2);
}
.ots-exam__title { flex: 1; min-width: 0; font-weight: 650; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ots-exam__timer { display: flex; flex-direction: column; align-items: center; padding: 4px 14px; border-radius: 8px; background: #1e293b; min-width: 110px; }
.ots-exam__timer-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #cbd5e1; }
.ots-exam__timer-value { font-size: 1.35rem; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.ots-exam__timer.is-warning { background: #9a3412; }
.ots-exam__timer.is-danger { background: #b91c1c; animation: ots-pulse 1s ease-in-out infinite; }
@keyframes ots-pulse { 50% { opacity: .75; } }
.ots-exam__tools { display: flex; align-items: center; gap: 8px; }
.ots-lang { display: inline-flex; border: 1px solid #475569; border-radius: 8px; overflow: hidden; }
.ots-exam .ots-lang__btn { background: transparent; color: #e2e8f0; border: 0; padding: 8px 12px; min-height: 40px; font: inherit; font-weight: 650; cursor: pointer; }
.ots-exam .ots-lang__btn[aria-pressed="true"] { background: #e2e8f0; color: #0f172a; }

/* ---------- Sections ---------- */
.ots-exam__sections { display: flex; gap: 6px; padding: 8px 20px; background: #fff; border-bottom: 1px solid #e2e8f0; overflow-x: auto; }
.ots-exam .ots-sectab { flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; border: 1px solid #cbd5e1; background: #fff; color: #334155; font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; min-height: 38px; }
.ots-exam .ots-sectab.is-active { background: #0f172a; color: #fff; border-color: #0f172a; }
.ots-exam .ots-sectab.is-done { text-decoration: line-through; }
.ots-exam .ots-sectab[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Body ---------- */
.ots-exam__body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; padding: 16px 20px 20px; align-items: start; max-width: 1400px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.ots-exam__main { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; display: flex; flex-direction: column; min-height: calc(100vh - 140px); }
.ots-q__head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid #e2e8f0; }
.ots-q__num { font-size: 1.05rem; font-weight: 700; margin: 0; color: #0f172a; }
.ots-q__num:focus { outline: none; }
.ots-q__marks { font-size: .82rem; font-weight: 650; color: #334155; background: #f1f5f9; padding: 3px 10px; border-radius: 999px; }
.ots-q__save { margin-left: auto; font-size: .82rem; color: #64748b; }
.ots-q__save.is-saved { color: #15803d; }
.ots-q__save.is-offline, .ots-q__save.is-session { color: #b91c1c; font-weight: 600; }
.ots-q__body { flex: 1; padding: 20px; }
.ots-q__img img { max-width: 100%; height: auto; border-radius: 8px; margin-bottom: 12px; }
.ots-q__text { font-size: 1.08rem; line-height: 1.65; color: #0f172a; margin-bottom: 18px; overflow-wrap: anywhere; }
.ots-q__text p { margin: 0 0 .6em; }
.ots-q__text img { max-width: 100%; height: auto; }
.ots-q__text[lang="hi"], .ots-opt__text[lang="hi"] { font-size: 1.12em; line-height: 1.75; }
.ots-q__opts { border: 0; margin: 0; padding: 0; min-width: 0; }
.ots-exam .ots-opt {
	display: flex; align-items: flex-start; gap: 12px;
	padding: 12px 14px; margin: 0 0 10px;
	border: 2px solid #e2e8f0; border-radius: 10px; background: #fff;
	cursor: pointer; transition: border-color .12s, background-color .12s;
}
.ots-exam .ots-opt:hover { border-color: #94a3b8; }
.ots-exam .ots-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ots-exam .ots-opt:focus-within { box-shadow: 0 0 0 3px rgba(55, 48, 163, .35); }
.ots-exam .ots-opt.is-selected { border-color: var(--x-next); background: #eef2ff; }
.ots-opt__key { flex: 0 0 30px; height: 30px; border-radius: 50%; border: 2px solid #94a3b8; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; color: #334155; }
.ots-exam .ots-opt.is-selected .ots-opt__key { background: var(--x-next); border-color: var(--x-next); color: #fff; }
.ots-opt__text { flex: 1; padding-top: 3px; line-height: 1.55; overflow-wrap: anywhere; }
.ots-opt__text p { margin: 0; }
.ots-opt__text img { display: block; max-width: 100%; height: auto; margin-top: 6px; }

.ots-exam__actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 20px; border-top: 1px solid #e2e8f0; background: #f8fafc; border-radius: 0 0 12px 12px; }
.ots-exam__actions .ots-xbtn--next { margin-left: auto; }

/* ---------- Palette ---------- */
.ots-exam__palette { position: sticky; top: 76px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px; max-height: calc(100vh - 96px); overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.ots-palette__head { display: flex; justify-content: space-between; align-items: center; }
.ots-exam .ots-palette__close { display: none; background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: #334155; min-width: 44px; min-height: 44px; }
.ots-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 0; padding: 0; list-style: none; font-size: .78rem; color: #334155; }
.ots-legend li { display: flex; align-items: center; gap: 6px; }
.ots-palette__sec { margin: 6px 0 4px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #64748b; }
.ots-palette__group { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 8px; }
.ots-exam .ots-pal {
	position: relative; display: inline-flex; align-items: center; justify-content: center;
	width: 100%; aspect-ratio: 1; min-height: 40px; padding: 0; margin: 0;
	border: 2px solid transparent; border-radius: 8px; font: inherit; font-size: .85rem; font-weight: 700;
	cursor: pointer; color: #fff;
}
.ots-exam .ots-pal--dot { width: 24px; min-height: 24px; aspect-ratio: auto; height: 24px; font-size: .7rem; border-radius: 6px; cursor: default; flex: 0 0 24px; }
.ots-exam .ots-pal--an { background: var(--p-an); }
.ots-exam .ots-pal--na { background: var(--p-na); }
.ots-exam .ots-pal--nv { background: var(--p-nv); color: #334155; border-color: #cbd5e1; }
.ots-exam .ots-pal--mk { background: var(--p-mk); border-radius: 50%; }
.ots-exam .ots-pal--am { background: var(--p-mk); border-radius: 50%; }
.ots-exam .ots-pal--am::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--p-an); border: 2px solid #fff; }
.ots-exam .ots-pal.is-current { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0f172a; }
.ots-exam .ots-pal[disabled] { opacity: .45; cursor: not-allowed; }
.ots-exam .ots-pal:focus-visible { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--x-prev); }

/* ---------- Toast / modals ---------- */
.ots-exam__toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; max-width: min(560px, calc(100vw - 32px)); background: #0f172a; color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: .92rem; }
.ots-modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 23, 42, .55); }
.ots-modal--solid { background: rgba(15, 23, 42, .92); }
.ots-modal[hidden] { display: none; }
.ots-modal__box { width: 100%; max-width: 440px; background: #fff; border-radius: 14px; padding: 24px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.ots-modal__box--center { text-align: center; }
.ots-modal__title { margin: 0 0 6px; font-size: 1.25rem; color: #0f172a; }
.ots-modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.ots-summary { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.ots-summary li { display: flex; align-items: center; gap: 10px; font-size: .95rem; }
.ots-summary strong { margin-left: auto; }
.ots-paused-clock { font-size: 2.2rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 6px 0 16px; color: #c2410c; }
.ots-spinner { display: inline-block; width: 36px; height: 36px; border-radius: 50%; border: 4px solid #e2e8f0; border-top-color: var(--x-next); animation: ots-spin .8s linear infinite; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
	.ots-exam__bar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
	.ots-exam__title { flex-basis: calc(100% - 140px); font-size: .9rem; }
	.ots-exam__timer { min-width: 0; padding: 2px 10px; }
	.ots-exam__timer-value { font-size: 1.15rem; }
	.ots-exam__tools { width: 100%; justify-content: space-between; }
	.ots-exam .ots-xbtn { min-height: 44px; padding: 8px 12px; font-size: .85rem; }
	.ots-exam .ots-xbtn--palette { display: inline-flex; }
	.ots-exam__sections { padding: 6px 12px; }
	.ots-exam__body { grid-template-columns: 1fr; padding: 10px 10px 0; }
	.ots-exam__main { min-height: 0; border-radius: 10px; }
	.ots-q__head, .ots-q__body { padding-left: 14px; padding-right: 14px; }
	.ots-exam__actions {
		position: sticky; bottom: 0; z-index: 20;
		display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
		padding: 8px; border-radius: 0; box-shadow: 0 -4px 12px rgba(15,23,42,.08);
	}
	.ots-exam__actions .ots-xbtn { padding: 8px 6px; white-space: normal; text-align: center; }
	.ots-exam__actions .ots-xbtn--next { margin-left: 0; }
	.ots-exam__actions .ots-xbtn--section { grid-column: 1 / -1; }
	.ots-exam__palette {
		position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
		width: min(340px, 88vw); max-height: none; border-radius: 0;
		transform: translateX(105%); transition: transform .2s ease;
		box-shadow: -10px 0 30px rgba(0,0,0,.2);
	}
	.ots-exam.is-palette-open .ots-exam__palette { transform: none; }
	.ots-exam .ots-palette__close { display: inline-flex; align-items: center; justify-content: center; }
	.ots-exam .ots-lang__btn { padding: 6px 10px; min-height: 40px; }
}
@media (max-width: 420px) {
	.ots-exam .ots-xbtn--pause span, .ots-exam .ots-xbtn--palette span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); }
}
@media (prefers-reduced-motion: reduce) {
	.ots-exam__timer.is-danger { animation: none; }
	.ots-exam__palette { transition: none; }
}
