/* Taker-specific styles */
body.proctored { user-select: none; -webkit-user-select: none; }
body.proctored input[type=text] { user-select: text; -webkit-user-select: text; }

.hero { text-align: center; padding: 8px 0 18px; }
.hero p { color: var(--muted); max-width: 52ch; margin: 0 auto; }
.field { margin-bottom: 14px; }
.err { color: #ff8a92; min-height: 1.4em; margin-top: 8px; }

.rules li strong { color: var(--gold); }
.cols { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }
@media (max-width: 720px) { .cols { grid-template-columns: 1fr; } }

/* device check */
.preview { position: relative; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 4/3; border: 1px solid var(--line); }
.preview video, .selfview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.checks li:last-child { border: 0; }
.ico { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .9rem; font-weight: 700; flex: none; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
.ico.ok { background: #11271f; color: var(--green); border-color: #1f6b4f; }
.ico.bad { background: #2a1215; color: #ff8a92; border-color: #7a1c22; }
.ico.wait { color: var(--amber); }
.meter { height: 10px; background: #0f1115; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-top: 6px; }
.meter > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--gold), var(--red)); transition: width .08s linear; }

/* the test itself */
.testbar { position: sticky; top: 0; z-index: 20; background: rgba(13,14,17,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.testbar .in { max-width: 880px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.clock { font-family: var(--display); font-size: 2rem; letter-spacing: .04em; min-width: 3.3ch; text-align: right; }
.clock.low { color: var(--red); animation: pulse .8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.bar { height: 8px; background: #0f1115; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); flex: 1 1 160px; }
.bar > i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--gold), var(--red)); transition: width .2s linear; }
.qprompt { font-size: clamp(1.25rem, 3.4vw, 1.75rem); line-height: 1.3; font-weight: 600; margin: 8px 0 22px; }
.choices { display: grid; gap: 12px; }
.choice { display: flex; gap: 14px; align-items: center; text-align: left; width: 100%; font: inherit; color: var(--text); background: var(--panel2); border: 2px solid var(--line); border-radius: 12px; padding: 16px 18px; cursor: pointer; transition: border-color .1s, background .1s; }
.choice:hover { border-color: var(--gold-d); }
.choice .k { font-family: var(--display); width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: #0f1115; border: 1px solid var(--line); flex: none; }
.choice.sel { border-color: var(--gold); background: #231e10; }
.choice.sel .k { background: var(--gold); color: #1a1405; }
.choice:disabled { opacity: .6; cursor: default; }
.answerbox { font-size: 1.4rem; padding: 16px 18px; }
.blocked .qarea { visibility: hidden; }

.selfview { position: fixed; right: 14px; bottom: 14px; width: 150px; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; border: 2px solid var(--red); background: #000; z-index: 15; box-shadow: 0 6px 20px rgba(0,0,0,.6); }
.selfview .rec { position: absolute; left: 6px; top: 6px; font-size: .65rem; font-weight: 800; letter-spacing: .1em; background: rgba(0,0,0,.65); padding: 2px 6px; border-radius: 999px; display: flex; gap: 5px; align-items: center; }
.selfview .rec::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: pulse 1s infinite; }
.banner { position: fixed; left: 50%; top: 74px; transform: translateX(-50%); background: #2a2010; border: 1px solid var(--amber); color: #ffcf7a; padding: 8px 16px; border-radius: 999px; z-index: 40; font-size: .9rem; box-shadow: 0 8px 24px rgba(0,0,0,.5); max-width: 92vw; text-align: center; }

#overlay { position: fixed; inset: 0; z-index: 100; background: rgba(8,8,10,.96); display: grid; place-items: center; padding: 20px; text-align: center; }
#overlay .box { max-width: 520px; }
#overlay h2 { color: var(--red); font-size: 2.2rem; }
.done-85 { font-family: var(--display); font-size: clamp(5rem, 22vw, 9rem); color: var(--red); line-height: 1; text-shadow: 0 0 0 2px var(--gold); }

/* questions are painted on canvas (see textCanvas in main.js); the wrapper carries the font + color */
.cvtext { display: block; flex: 1; min-width: 0; }
.cvtext canvas { display: block; max-width: 100%; }
.choice .cvtext { font-size: 1rem; line-height: 1.32; }
.qarea { position: relative; }
.wmark { position: absolute; inset: -8px; pointer-events: none; z-index: 5; background-repeat: repeat; }
/* lost focus => question blurred (another app, a capture tool, a side window) */
body.proctored.unfocused .qarea { filter: blur(18px); }
body.proctored.unfocused .qarea * { pointer-events: none; }

/* iPad keypad */
.kbox { min-height: 64px; display: flex; align-items: center; background: #0f1115; border: 1px solid var(--line); border-radius: 10px; font-family: var(--mono); letter-spacing: .03em; overflow-wrap: anywhere; }
.kbox .caret { width: 2px; height: 1.4em; margin-left: 2px; background: var(--gold); animation: pulse 1s steps(1) infinite; }
.keypad { margin-top: 14px; display: grid; gap: 7px; user-select: none; -webkit-user-select: none; touch-action: manipulation; -webkit-touch-callout: none; }
.krow { display: flex; gap: 7px; justify-content: center; }
.key { flex: 1 1 0; max-width: 70px; min-height: 54px; font: inherit; font-weight: 700; font-size: 1.15rem; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; touch-action: manipulation; }
.key.down, .key:active { background: var(--gold); color: #1a1405; }
.key.wide { flex: 5 1 0; max-width: 420px; text-transform: uppercase; font-size: .9rem; letter-spacing: .1em; }
.key.bs { flex: 1.6 1 0; max-width: 110px; }
@media (max-width: 520px) { .key { min-height: 46px; font-size: 1rem; } .krow, .keypad { gap: 5px; } }
#overlay video.facecheck { width: 240px; aspect-ratio: 4/3; object-fit: cover; transform: scaleX(-1); border-radius: 12px; border: 2px solid var(--gold); background: #000; margin: 10px auto 4px; display: block; }
#overlay .lighttip { color: var(--gold); font-weight: 600; }
/* long device names (some USB/virtual cameras) must wrap instead of squeezing the camera preview */
.cols > * { min-width: 0; }
.checks li > div { min-width: 0; overflow-wrap: anywhere; }
