/* ================================================================
   Biology tests: one stylesheet for home, teacher and student pages.
   Look: a fluorescence microscope. Living cells drift behind frosted
   instrument panels; colours are the real stains: GFP green (actions),
   DAPI blue (info), actin red (alerts), plus a cyan reticle for focus.
   ================================================================ */
:root {
  --bg: #03070c;
  --glass: rgba(9, 19, 31, .86);
  --glass-2: rgba(9, 19, 31, .9);
  --glass-3: rgba(12, 25, 40, .96);
  --line: rgba(110, 230, 215, .14);
  --line-2: rgba(110, 230, 215, .26);
  --line-3: rgba(110, 230, 215, .46);
  --text: #e2f4f2;
  --text-2: #b7d6d1;
  --dim: #8fb3ad;
  --dim-2: #5d7d78;
  --gfp: #3fe6cf;
  --gfp-ink: #03201c;
  --gfp-soft: rgba(63, 230, 207, .13);
  --dapi: #a98bff;
  --dapi-soft: rgba(169, 139, 255, .14);
  --actin: #ff4d7a;
  --actin-soft: rgba(255, 77, 122, .16);
  --cyan: #7ff5e4;
  --cyan-soft: rgba(127, 245, 228, .14);
  --amber: #ffc46b;
  --amber-soft: rgba(255, 196, 107, .15);
  --ui: "Chakra Petch", "IBM Plex Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  --read: "IBM Plex Sans Thai", "Chakra Petch", system-ui, sans-serif;
  --mono: "Chakra Petch", "IBM Plex Sans Thai", ui-monospace, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --blur: blur(6px);
  --muted: var(--dim); --faint: var(--dim-2); --accent: var(--gfp);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--ui); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
.biobg { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }
/* vignette keeps text readable over the cells */
body::after { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(120% 90% at 50% 40%, transparent 40%, rgba(1, 4, 10, .55)); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--dim); }
.faint { color: var(--dim-2); }
.small { font-size: 13px; }
.th { font-family: "IBM Plex Sans Thai", var(--ui); }
h1, h2, h3 { font-family: var(--ui); font-stretch: 80%; font-weight: 800; letter-spacing: -.005em; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.label { font-family: var(--mono); font-size: 11.5px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.label.red { color: #ff8793; }

/* microscope scale bar in the corner */
.scalebar { position: fixed; left: 22px; bottom: 18px; z-index: 1; display: grid; gap: 4px; pointer-events: none; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: rgba(232, 246, 255, .55); }
.scalebar i { display: block; width: 90px; height: 3px; background: rgba(232, 246, 255, .6); }

/* ---------------------------------------------------------------- brand */
.brand { display: inline-flex; align-items: center; gap: 10px; font-stretch: 80%; font-weight: 800; font-size: 19px; letter-spacing: .04em; text-transform: uppercase; color: var(--text); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--gfp); border: 1.5px solid var(--gfp); box-shadow: 0 0 16px rgba(54, 214, 255, .45), inset 0 0 10px rgba(54, 214, 255, .25); }
.brand-mark svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- glass panels */
.panel, .glass { position: relative; background: var(--glass); border: 1px solid var(--line); border-radius: 10px; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 8px; white-space: nowrap;
  border: 1px solid var(--line-2); background: rgba(12, 28, 46, .7); color: var(--text);
  font-size: 14px; font-weight: 600; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { background: rgba(20, 44, 70, .85); border-color: var(--line-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn .i { width: 16px; height: 16px; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.lg { height: 50px; padding: 0 22px; font-size: 16px; }
.btn.wide { width: 100%; }
.btn.primary { background: var(--gfp); border-color: var(--gfp); color: var(--gfp-ink); font-weight: 700; box-shadow: 0 0 22px rgba(54, 214, 255, .35); }
.btn.primary:hover { background: #7fe6ff; box-shadow: 0 0 30px rgba(54, 214, 255, .5); }
.btn.green { background: var(--gfp); border-color: var(--gfp); color: var(--gfp-ink); font-weight: 700; }
.btn.green:hover { background: #7fe6ff; }
.btn.danger { background: var(--actin-soft); border-color: rgba(255, 77, 97, .45); color: #ff8793; }
.btn.danger:hover { background: rgba(255, 77, 97, .25); }
.btn.solid-danger { background: var(--actin); border-color: var(--actin); color: #fff; }
.btn.warn { background: var(--amber-soft); border-color: rgba(255, 182, 72, .45); color: #ffd27e; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--dim); }
.btn.ghost:hover { background: rgba(20, 44, 70, .6); color: var(--text); }
.btn.on { border-color: var(--gfp); color: var(--gfp); background: var(--gfp-soft); }
.iconbtn { width: 34px; height: 34px; padding: 0; }

/* ---------------------------------------------------------------- inputs */
.input {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 8px;
  background: rgba(3, 10, 20, .6); border: 1px solid var(--line-2); color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-soft); }
.input::placeholder { color: var(--dim-2); }
.input.sm { height: 34px; font-size: 14px; }
select.input { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.field { display: grid; gap: 6px; }
.field > span { font-family: var(--mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--gfp); }
.err { min-height: 20px; font-size: 14px; color: #ff8793; font-weight: 600; }

/* ---------------------------------------------------------------- status tags */
.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 9px; border-radius: 12px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
  color: var(--dim); background: rgba(124, 151, 171, .12);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; flex: none; }
.pill.active, .pill.live { color: var(--gfp); background: var(--gfp-soft); }
.pill.waiting { color: var(--dapi); background: var(--dapi-soft); }
.pill.away, .pill.locked { color: #ff7b88; background: var(--actin-soft); }
.pill.submitted { color: var(--amber); background: var(--amber-soft); }
.pill.live::before, .pill.away::before { animation: blink 1.2s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* toasts */
#toasts { position: fixed; z-index: 200; right: 18px; bottom: 18px; display: grid; gap: 10px; width: min(370px, calc(100vw - 32px)); }
.toast {
  --tc: var(--gfp); position: relative; padding: 12px 14px 12px 34px; border-radius: 10px;
  background: var(--glass-3); border: 1px solid var(--line-2); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55); font-size: 14px; line-height: 1.45; animation: toastin .3s var(--ease);
}
.toast::before { content: ""; position: absolute; left: 14px; top: 18px; width: 9px; height: 9px; border-radius: 50%; background: var(--tc); box-shadow: 0 0 12px var(--tc); }
.toast.red { --tc: var(--actin); border-color: rgba(255, 77, 97, .5); }
.toast.green { --tc: var(--gfp); }
.toast.amber { --tc: var(--amber); border-color: rgba(255, 182, 72, .45); }
.toast.click { cursor: pointer; }
.toast.out { opacity: 0; transform: translateY(6px); transition: .3s; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } }

/* modal */
.modal { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 16px; background: rgba(1, 4, 10, .6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal-box { width: min(440px, 100%); padding: 24px; background: var(--glass-3); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.modal-box h3 { margin: 6px 0 8px; font-size: 26px; text-transform: uppercase; }
.modal-box p { margin: 0 0 20px; color: var(--text-2); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(110, 200, 255, .15); border-top-color: var(--gfp); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================
   THE TEST SHEET (student page and the teacher's live copy share it,
   so this layout must stay identical in both places)
   ================================================================ */
.tbar {
  position: fixed; top: 0; left: 0; right: 0; height: 58px; z-index: 20;
  display: flex; align-items: center; gap: 16px; padding: 0 18px;
  background: rgba(3, 10, 20, .82); border-bottom: 1px solid var(--line-2); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.tb-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.tb-name { font-weight: 800; font-stretch: 85%; font-size: 16px; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gfp); flex: none; box-shadow: 0 0 10px var(--gfp); }
.tb-mid { display: flex; align-items: center; gap: 10px; }
.prog { width: 140px; height: 6px; border-radius: 3px; background: rgba(110, 200, 255, .12); overflow: hidden; }
.prog-fill { height: 100%; background: var(--gfp); box-shadow: 0 0 10px var(--gfp); transform-origin: left; transform: scaleX(0); transition: transform .4s var(--ease); }
.tb-mid .small { color: var(--dim); font-family: var(--mono); font-size: 13px; min-width: 50px; }
.timer { font-family: var(--mono); font-size: 17px; font-weight: 600; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--line-2); font-variant-numeric: tabular-nums; }
.timer.warn { color: var(--amber); border-color: var(--amber); }
.timer.crit { color: #ff7b88; border-color: var(--actin); }

.test-wrap { position: relative; z-index: 1; max-width: 780px; margin: 0 auto; padding: 80px 16px 140px; }
.test-who { margin: 0 4px 12px; font-family: var(--mono); font-size: 12.5px; color: var(--dim); letter-spacing: .04em; }
.qcard { position: relative; padding: 20px 20px 18px; margin-bottom: 12px; background: var(--glass-2); border: 1px solid var(--line); border-radius: 12px; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); transition: border-color .2s, box-shadow .2s; }
.qcard.answered { border-color: rgba(54, 214, 255, .32); }
.qcard.focus { border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-soft); }
.q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.q-num { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 15px; display: grid; place-items: center; border: 1.5px solid var(--line-3); font-family: var(--mono); font-size: 13px; font-weight: 600; }
.qcard.answered .q-num { background: var(--gfp); border-color: var(--gfp); color: var(--gfp-ink); box-shadow: 0 0 12px rgba(54, 214, 255, .5); }
.q-type { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.q-pts { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--dim-2); }
.q-text { font-size: 18.5px; font-weight: 600; line-height: 1.5; margin-bottom: 14px; overflow-wrap: anywhere; }
.q-img { display: block; max-width: 100%; max-height: 360px; margin: 0 0 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.opts { display: grid; gap: 8px; }
.opts.tf { grid-template-columns: 1fr 1fr; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 14px; text-align: left;
  background: rgba(3, 10, 20, .5); border: 1px solid var(--line-2); border-radius: 10px; color: var(--text);
  font-size: 16.5px; transition: border-color .12s, background .12s, box-shadow .12s;
}
.opt:hover { border-color: var(--line-3); }
.opt-l { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 1.5px solid var(--line-3); font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text-2); }
.opt-t { overflow-wrap: anywhere; }
.opt.sel { border-color: var(--gfp); background: var(--gfp-soft); box-shadow: 0 0 18px rgba(54, 214, 255, .18); }
.opt.sel .opt-l { background: var(--gfp); border-color: var(--gfp); color: var(--gfp-ink); }
.short { width: 100%; min-height: 96px; padding: 12px 14px; border-radius: 10px; background: rgba(3, 10, 20, .55); border: 1px solid var(--line-2); color: var(--text); font-size: 16.5px; line-height: 1.5; resize: vertical; outline: none; }
.short:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-soft); }
.short::placeholder { color: var(--dim-2); }
.submit-zone { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 18px 20px; margin-top: 18px; background: var(--glass-2); border: 1px solid var(--line-2); border-radius: 12px; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.sz-t { font-weight: 800; font-stretch: 85%; font-size: 19px; text-transform: uppercase; }

/* uploaded test paper + answer sheet */
.paper { margin: 0 0 14px; padding: 14px; display: grid; gap: 12px; background: var(--glass-2); border: 1px solid var(--line); border-radius: 12px; }
.paper-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.paper-page { display: block; width: 100%; height: auto; background: #fff; border-radius: 6px; }
.paper-text { padding: 4px; font-size: 17px; line-height: 1.65; overflow-wrap: anywhere; }
.sheet-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 18px 4px 8px; }
.qcard.sheet { display: flex; align-items: center; gap: 14px; padding: 10px 14px; margin-bottom: 6px; }
.qcard.sheet .q-num { min-width: 38px; }
.bubbles { display: flex; gap: 8px; flex-wrap: wrap; }
.opt.bub { width: auto; min-width: 48px; min-height: 44px; padding: 0 14px; justify-content: center; border-radius: 22px; font-family: var(--mono); font-size: 15px; font-weight: 600; }
.opt.bub.sel { background: var(--gfp); border-color: var(--gfp); color: var(--gfp-ink); }

/* ================================================================
   HOME
   ================================================================ */
.home { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; padding: 22px clamp(16px, 4vw, 48px); }
.home-hero { align-self: center; justify-self: center; width: min(1000px, 100%); padding: 40px 0; }
.home h1 { font-size: clamp(46px, 7.4vw, 92px); line-height: .9; letter-spacing: -.01em; font-stretch: 70%; font-weight: 800; text-transform: uppercase; margin: 16px 0 20px; max-width: 11ch; text-shadow: 0 4px 40px rgba(0, 0, 0, .6); }
.home h1 em { font-style: normal; color: var(--gfp); text-shadow: 0 0 30px rgba(54, 214, 255, .5); }
.home .sub { font-size: 18px; color: var(--text-2); max-width: 50ch; margin: 0 0 34px; }
.doors { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.door { position: relative; display: grid; gap: 6px; align-content: start; padding: 22px; border-radius: 12px; background: var(--glass); border: 1px solid var(--line-2); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); color: var(--text); text-decoration: none; transition: border-color .2s, transform .25s var(--ease), box-shadow .25s; }
.door:hover { border-color: var(--gfp); transform: translateY(-3px); box-shadow: 0 0 30px rgba(54, 214, 255, .18); }
.door .i { width: 28px; height: 28px; color: var(--gfp); margin-bottom: 6px; }
.door b { font-size: 26px; font-stretch: 78%; font-weight: 800; text-transform: uppercase; line-height: 1.05; }
.door span { color: var(--text-2); font-size: 15px; }
.door em { font-style: normal; font-family: var(--mono); font-size: 12.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; margin-top: 10px; color: var(--gfp); }
.home-foot { color: var(--dim-2); font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-align: right; }
@media (max-width: 600px) { .doors { grid-template-columns: 1fr; } }

/* ================================================================
   TEACHER
   ================================================================ */
.auth { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); padding: 30px; display: grid; gap: 14px; }
.auth-card h1 { margin: 10px 0 0; font-size: 40px; text-transform: uppercase; font-stretch: 72%; line-height: 1; }
.auth-card p { margin: 0; }
.auth-form { display: grid; gap: 14px; margin-top: 6px; }
.demo-note { padding: 12px 14px; border-radius: 8px; background: var(--amber-soft); color: #ffd27e; font-size: 14px; margin: 8px 0 12px; }

.app { position: relative; z-index: 1; display: grid; grid-template-columns: 206px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 22px; padding: 18px 12px; border-right: 1px solid var(--line); background: rgba(3, 10, 20, .62); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.side .brand { padding: 2px 6px; }
.nav { display: grid; gap: 2px; }
.nav button { position: relative; display: flex; align-items: center; gap: 11px; height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--dim); font-size: 14.5px; font-weight: 600; text-align: left; transition: background .15s, color .15s; }
.nav button:hover { color: var(--text); background: rgba(20, 44, 70, .5); }
.nav button.on { color: var(--text); background: rgba(20, 44, 70, .75); }
.nav button.on .i { color: var(--gfp); filter: drop-shadow(0 0 6px rgba(54, 214, 255, .7)); }
.side-foot { margin-top: auto; display: grid; gap: 8px; }
.modepill { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--line-2); }
.modepill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; flex: none; }
.modepill.online { color: var(--gfp); }
.modepill.demo { color: var(--amber); }
.side-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.main { min-width: 0; }
.view { padding: 18px 20px 24px; }
.view-title { font-size: 40px; text-transform: uppercase; font-stretch: 72%; margin: 0 0 16px; line-height: 1; }

/* ---------------------------------------------------------------- live */
.empty-live { display: grid; place-items: center; min-height: calc(100vh - 60px); }
.empty-box { width: min(540px, 100%); padding: 30px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.empty-box h2 { margin: 4px 0 0; font-size: 36px; text-transform: uppercase; font-stretch: 72%; line-height: 1; }
.empty-box p { margin: 0 0 8px; color: var(--text-2); }

/* flows with page scroll by default; locks to the window height only on big, unzoomed screens (see bottom) */
.live-wrap { display: flex; flex-direction: column; gap: 14px; }
.live-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.lh-title { min-width: 0; flex: 1 1 320px; display: grid; gap: 4px; }
.lh-title h2 { margin: 0; font-size: 40px; line-height: .96; text-transform: uppercase; font-stretch: 70%; overflow-wrap: anywhere; text-shadow: 0 2px 30px rgba(0, 0, 0, .7); }
.lh-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--dim); font-family: var(--mono); font-size: 12.5px; letter-spacing: .03em; }
.lh-clock { font-family: var(--mono); font-size: 34px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; text-shadow: 0 0 20px rgba(165, 240, 255, .3); }
.lh-clock.warn { color: var(--amber); }
.lh-clock.crit { color: #ff7b88; }
.codechip { position: relative; display: grid; gap: 1px; padding: 8px 16px 9px; border-radius: 10px; background: var(--glass-2); border: 1px solid rgba(54, 214, 255, .45); color: var(--text); text-align: left; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: 0 0 24px rgba(54, 214, 255, .15); transition: box-shadow .2s; }
.codechip:hover { box-shadow: 0 0 34px rgba(54, 214, 255, .35); }
.codechip span { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.codechip b { font-family: var(--mono); font-size: 26px; font-weight: 600; letter-spacing: .16em; line-height: 1.1; color: var(--gfp); text-shadow: 0 0 14px rgba(54, 214, 255, .6); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions .sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 4px; }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.stat { padding: 10px 14px 12px; display: grid; gap: 0; min-width: 0; background: var(--glass); border: 1px solid var(--line); border-radius: 10px; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.stat b { font-stretch: 72%; font-size: 38px; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat span { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.green b { color: var(--gfp); text-shadow: 0 0 18px rgba(54, 214, 255, .45); }
.stat.red b { color: #ff7b88; }
.stat.amber b { color: var(--amber); }
.stat.red.hot { border-color: rgba(255, 77, 97, .6); box-shadow: 0 0 26px rgba(255, 77, 97, .25); }
.stat.red.hot b { text-shadow: 0 0 18px rgba(255, 77, 97, .6); }

.live-body { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; align-items: start; }
.live-body.focus { grid-template-columns: 280px minmax(0, 1fr); }
.live-wrap.focus .stats { display: none; }
.roster-col { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.roster-head { display: flex; align-items: center; gap: 10px; }
.roster-head .label { white-space: nowrap; flex: none; }
.roster-head .input { max-width: 220px; margin-left: auto; }
.live-body.focus .roster-head .input { max-width: none; }
.alertbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-radius: 10px; background: rgba(255, 77, 97, .2); border: 1px solid rgba(255, 77, 97, .6); color: #ffd0d5; font-size: 14px; box-shadow: 0 0 26px rgba(255, 77, 97, .2); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.alertbar b { color: #fff; }
.alertbar .i { width: 16px; height: 16px; color: #ff7b88; }
.alertbar button { border: 0; background: var(--actin); color: #fff; border-radius: 12px; padding: 2px 10px; font-size: 13px; font-weight: 700; }
.alertbar button:hover { background: #ff6a78; }
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 10px; align-content: start; padding: 2px 2px 14px; }
.live-body.focus .roster { grid-template-columns: minmax(0, 1fr); gap: 6px; }

/* students: each avatar is a small cell (status-coloured membrane, blue nucleus) */
.srow {
  position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 11px;
  padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  color: var(--text); width: 100%; text-align: left; cursor: pointer; transition: border-color .2s, box-shadow .2s;
}
.srow:hover { border-color: var(--line-3); }
.srow.sel { border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-soft), 0 0 24px rgba(165, 240, 255, .2); }
.srow.dim { opacity: .55; }
.s-av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--dim-2); background: radial-gradient(circle at 45% 45%, rgba(139, 155, 255, .35), rgba(139, 155, 255, .05) 60%, transparent 70%); font-family: var(--mono); font-weight: 600; font-size: 12.5px; color: var(--text); }
.srow[data-st="active"] .s-av { border-color: var(--gfp); box-shadow: 0 0 12px rgba(54, 214, 255, .45); }
.srow[data-st="waiting"] .s-av { border-color: var(--dapi); }
.srow[data-st="away"] .s-av, .srow[data-st="locked"] .s-av { border-color: var(--actin); box-shadow: 0 0 14px rgba(255, 77, 97, .6); }
.srow[data-st="submitted"] .s-av { border-color: var(--amber); }
.s-main { min-width: 0; display: grid; gap: 1px; }
.s-name { font-weight: 700; font-size: 15.5px; line-height: 1.25; overflow-wrap: break-word; }
.s-sub { font-family: var(--mono); font-size: 11.5px; letter-spacing: .03em; color: var(--dim); line-height: 1.35; }
.s-right { display: grid; justify-items: end; gap: 5px; }
.s-prog { font-family: var(--mono); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.s-bar { width: 56px; height: 4px; border-radius: 2px; background: rgba(110, 200, 255, .12); overflow: hidden; }
.s-bar i { display: block; height: 100%; background: var(--gfp); transform-origin: left; transition: transform .4s var(--ease); }
.s-flags { display: flex; gap: 5px; }
.s-badge { display: inline-flex; align-items: center; gap: 3px; height: 19px; padding: 0 6px; border-radius: 10px; font-family: var(--mono); font-size: 11px; font-weight: 700; }
.s-badge.left { background: var(--actin-soft); color: #ff8793; }
.s-badge.msg { background: var(--gfp); color: var(--gfp-ink); }
.s-badge.after { background: var(--amber-soft); color: var(--amber); }
.s-badge .i { width: 11px; height: 11px; stroke-width: 2.4; }
.srow.alert { border-color: rgba(255, 77, 97, .75); background: rgba(70, 8, 16, .62); box-shadow: 0 0 26px rgba(255, 77, 97, .3); animation: alertpulse 1.4s ease-in-out infinite; }
.srow.alert .s-sub { color: #ff8793; font-weight: 600; }
@keyframes alertpulse { 50% { box-shadow: 0 0 6px rgba(255, 77, 97, .15); } }
.srow.warnafter { border-color: rgba(255, 182, 72, .7); }
.srow.warnafter .s-sub { color: var(--amber); }
.empty-roster { grid-column: 1 / -1; padding: 40px 20px; text-align: center; color: var(--dim); border: 1px dashed var(--line-3); border-radius: 12px; background: rgba(3, 10, 20, .4); }
.empty-roster b { display: block; margin-top: 10px; font-family: var(--mono); font-size: 34px; letter-spacing: .16em; color: var(--gfp); text-shadow: 0 0 16px rgba(54, 214, 255, .5); }

/* activity column */
.feed { display: flex; flex-direction: column; padding: 14px 14px 6px; max-height: 420px; min-height: 200px; }
.feed-list { flex: 1; min-height: 0; overflow: auto; margin-top: 8px; display: flex; flex-direction: column; }
.feed-item { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13.5px; line-height: 1.4; color: var(--text-2); }
.feed-item:first-child { border-top: 0; }
.feed-item b { color: var(--text); }
.feed-item time { font-family: var(--mono); font-size: 11.5px; color: var(--dim-2); padding-top: 2px; }
.feed-item.left, .feed-item.reload { color: #ff8793; }
.feed-item.leftafter { color: var(--amber); }
.feed-item.new { animation: feedin .8s var(--ease); }
@keyframes feedin { from { background: var(--gfp-soft); } }

/* ---------------------------------------------------------------- one student */
.focus-panel { display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; height: max(600px, calc(100vh - 170px)); }
.fp-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.fp-who { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 220px; }
.fp-who .s-av { width: 44px; height: 44px; font-size: 14px; border-color: var(--cyan); }
.fp-name { font-size: 28px; font-weight: 800; font-stretch: 72%; text-transform: uppercase; line-height: 1; overflow-wrap: anywhere; }
.fp-meta { font-family: var(--mono); font-size: 12px; color: var(--dim); margin-top: 3px; }
.fp-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fp-body { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 310px; }
.fp-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.fp-tabs { display: flex; gap: 2px; padding: 10px 14px 0; align-items: center; flex-wrap: wrap; }
.fp-tabs > button { height: 32px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--dim); font-size: 13.5px; font-weight: 700; }
.fp-tabs > button:hover { color: var(--text); }
.fp-tabs > button.on { color: var(--text); border-bottom-color: var(--gfp); }
.fp-tabs .zoom { margin-left: auto; display: flex; gap: 2px; padding: 2px; border-radius: 8px; border: 1px solid var(--line-2); }
.fp-tabs .zoom button { height: 26px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--dim); font-size: 12.5px; font-weight: 600; }
.fp-tabs .zoom button.on { background: rgba(20, 44, 70, .9); color: var(--text); }
.fp-pane { flex: 1; min-height: 0; overflow: auto; padding: 12px 14px 14px; }

/* the live screen: a monitor feed with reticle corners */
.feedframe { position: relative; height: 100%; min-height: 300px; display: flex; flex-direction: column; }
.ff-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; font-family: var(--mono); font-size: 12px; color: var(--dim); }
.ff-rec { display: inline-flex; align-items: center; gap: 6px; color: #ff7b88; font-weight: 600; letter-spacing: .1em; }
.ff-rec::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--actin); box-shadow: 0 0 8px var(--actin); animation: blink 1.2s steps(2, start) infinite; }
.ff-rec.off { color: var(--dim); }
.ff-rec.off::before { background: var(--dim); box-shadow: none; animation: none; }
.ff-age { margin-left: auto; }
.ff-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: start center; overflow: hidden; padding: 6px; }
.mirror { position: relative; padding: 8px; background: #01040a; border: 1px solid var(--line-2); border-radius: 10px; }
.mirror::before, .mirror::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid var(--cyan); pointer-events: none; }
.mirror::before { top: -6px; left: -6px; border-right: 0; border-bottom: 0; }
.mirror::after { bottom: -6px; right: -6px; border-left: 0; border-top: 0; }
.m-clip { position: relative; overflow: hidden; border-radius: 4px; }
.m-screen { position: absolute; top: 0; left: 0; transform-origin: 0 0; overflow: hidden; pointer-events: none;
  background: radial-gradient(60% 40% at 30% 30%, rgba(54, 214, 255, .08), transparent 70%), radial-gradient(50% 40% at 75% 70%, rgba(255, 77, 97, .07), transparent 70%), #020812; }
.m-screen .tbar { position: absolute; }
.m-screen .qcard, .m-screen .submit-zone, .m-screen .tbar, .m-screen .paper { -webkit-backdrop-filter: none; backdrop-filter: none; }
.m-scroll { position: absolute; inset: 0; overflow: hidden; }
.m-veil { position: absolute; inset: 0; z-index: 30; display: none; place-items: center; text-align: center; padding: 30px; }
.m-veil.on { display: grid; }
.m-veil.red { background: rgba(60, 6, 14, .9); }
.m-veil.blue { background: rgba(2, 8, 14, .9); }
.m-veil h4 { margin: 8px 0; font-size: 60px; text-transform: uppercase; font-stretch: 70%; font-weight: 800; line-height: 1; }
.m-veil p { margin: 0; font-size: 24px; color: var(--text-2); }
.m-veil .label { font-size: 18px; }

/* answers + log */
.ans-sum { display: flex; align-items: baseline; gap: 12px; padding: 4px 2px 14px; }
.ans-sum b { font-stretch: 72%; font-weight: 800; font-size: 36px; }
.ans-row { padding: 12px 14px; margin-bottom: 8px; border-radius: 10px; background: rgba(3, 10, 20, .5); border: 1px solid var(--line); }
.ans-row.ok { border-color: rgba(54, 214, 255, .35); }
.ans-row.bad { border-color: rgba(255, 77, 97, .35); }
.ans-q { display: flex; gap: 10px; font-weight: 600; margin-bottom: 8px; }
.ans-q b { font-family: var(--mono); color: var(--dim); }
.ans-line { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 8px; font-size: 14px; padding: 2px 0; }
.ans-line > span:first-child { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); padding-top: 2px; }
.ans-mark { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.log-item { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 8px; padding: 8px 2px; border-top: 1px solid var(--line); font-size: 14px; }
.log-item time { font-family: var(--mono); font-size: 12px; color: var(--dim-2); padding-top: 2px; }
.log-item.left, .log-item.reload { color: #ff8793; }
.log-item.leftafter { color: var(--amber); }

/* private chat */
.chat { min-height: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line-2); background: rgba(3, 10, 20, .35); }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px; border-bottom: 1px solid var(--line); }
.chat-head .i { color: var(--gfp); }
.chat-head b { font-size: 14px; font-weight: 700; }
.chat-head span { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; color: var(--dim); margin-left: auto; }
.chat-list { flex: 1; min-height: 120px; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-empty { margin: auto; text-align: center; color: var(--dim-2); font-size: 13px; padding: 6px; }
.bubble { max-width: 86%; padding: 8px 12px; border-radius: 14px; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.bubble time { display: block; margin-top: 2px; font-family: var(--mono); font-size: 11px; opacity: .65; }
.bubble.me { align-self: flex-end; background: var(--gfp); color: var(--gfp-ink); border-bottom-right-radius: 4px; }
.bubble.them { align-self: flex-start; background: rgba(20, 44, 70, .9); border-bottom-left-radius: 4px; }
.btn.msg { border-color: var(--gfp); color: var(--gfp); background: var(--gfp-soft); }
.chat.flash { animation: chatflash 1.2s var(--ease); }
@keyframes chatflash { 0%, 40% { box-shadow: inset 0 0 0 2px var(--gfp), 0 0 30px rgba(54, 214, 255, .35); } }
.s-msgbtn { display: inline-grid; place-items: center; width: 24px; height: 19px; border-radius: 10px; color: var(--gfp); border: 1px solid rgba(54, 214, 255, .45); background: var(--gfp-soft); cursor: pointer; }
.s-msgbtn .i { width: 12px; height: 12px; stroke-width: 2.2; }
.s-msgbtn:hover { background: var(--gfp); color: var(--gfp-ink); }
.quick { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--line); }
.quick::-webkit-scrollbar { display: none; }
.quick button { flex: none; white-space: nowrap; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); border-radius: 14px; padding: 4px 11px; font-size: 12.5px; }
.quick button:hover { border-color: var(--gfp); color: var(--text); }
.chat-form { display: flex; gap: 6px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.chat-form .input { height: 38px; }
.chat-form .btn { flex: none; }

/* ---------------------------------------------------------------- tests editor */
.tests-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; align-items: start; }
.tests-list { display: grid; gap: 8px; position: sticky; top: 18px; }
.tl-head h2 { margin: 0 0 4px; font-size: 40px; text-transform: uppercase; font-stretch: 72%; line-height: 1; }
.tcard { display: grid; gap: 3px; padding: 12px 14px; border-radius: 10px; cursor: pointer; background: var(--glass); border: 1px solid var(--line); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); transition: border-color .15s; }
.tcard:hover { border-color: var(--line-3); }
.tcard.on { border-color: var(--gfp); }
.tcard b { font-size: 15px; overflow-wrap: anywhere; }
.tcard span { font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
.editor { padding: 22px; min-width: 0; }
.editor-empty { padding: 40px 10px; text-align: center; }
.ed-top { display: grid; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line-2); margin-bottom: 16px; }
.ed-title { height: 54px; font-size: 22px; font-weight: 700; }
.ed-meta { display: flex; gap: 20px; flex-wrap: wrap; align-items: end; }
.ed-meta .field { width: 230px; }
.eq { padding: 16px; margin-bottom: 10px; border-radius: 10px; background: rgba(3, 10, 20, .55); border: 1px solid var(--line); display: grid; gap: 10px; }
.eq-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.eq-num { min-width: 30px; height: 30px; border-radius: 15px; display: grid; place-items: center; border: 1.5px solid var(--line-3); font-family: var(--mono); font-weight: 600; font-size: 13px; }
.eq-head select { width: auto; height: 34px; font-size: 14px; }
.eq-head .pts { width: 70px; height: 34px; }
.eq-hint { font-size: 12.5px; color: var(--dim); }
.eq-tools { margin-left: auto; display: flex; gap: 4px; }
.ibtn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: rgba(12, 28, 46, .7); color: var(--dim); font-size: 14px; display: grid; place-items: center; }
.ibtn:hover { color: var(--text); border-color: var(--line-3); }
.ibtn.del:hover { color: #ff7b88; border-color: var(--actin); }
.eq-opt { display: flex; align-items: center; gap: 8px; padding: 3px; border-radius: 8px; }
.eq-opt.correct { background: var(--gfp-soft); }
.eq-opt input[type=radio] { width: 18px; height: 18px; accent-color: var(--gfp); flex: none; }
.eq-opt .letter { width: 22px; font-family: var(--mono); font-size: 13px; color: var(--dim); text-align: center; }
.eq-img { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.eq-img img { max-height: 120px; border-radius: 6px; border: 1px solid var(--line); }
.tf-pick { display: flex; gap: 16px; flex-wrap: wrap; }
.tf-pick label { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.tf-pick input { accent-color: var(--gfp); width: 18px; height: 18px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ed-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 0; }
.ed-foot { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 14px 0 6px; margin-top: 6px; border-top: 1px solid var(--line-2); background: rgba(6, 16, 28, .92); }
.ed-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.paper-edit { padding: 14px; border-radius: 10px; background: rgba(3, 10, 20, .55); border: 1px dashed var(--line-3); display: grid; gap: 12px; }
.paper-thumbs { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.paper-thumbs img { height: 130px; background: #fff; border-radius: 4px; flex: none; }
.paper-text-prev { font-size: 13px; color: var(--dim); max-height: 110px; overflow: hidden; white-space: pre-wrap; }
.eq.sheet { padding: 8px 12px; margin-bottom: 6px; }
.eq.need { border-color: rgba(255, 182, 72, .6); }
.sheet-pick { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sheet-pick label { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 32px; padding: 0 10px; border-radius: 16px; border: 1px solid var(--line-3); font-family: var(--mono); font-size: 13px; cursor: pointer; }
.sheet-pick label.on { background: var(--gfp); border-color: var(--gfp); color: var(--gfp-ink); font-weight: 700; }
.sheet-pick input { position: absolute; opacity: 0; pointer-events: none; }
#uploadBtn .up { transform: rotate(180deg); }

/* ---------------------------------------------------------------- past results + mark sheet */
.archive-list { display: grid; gap: 8px; max-width: 960px; }
.arow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 14px; border-radius: 10px; background: var(--glass); border: 1px solid var(--line); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); cursor: pointer; transition: border-color .15s; }
.arow:hover { border-color: var(--line-3); }
.arow .code { font-family: var(--mono); font-weight: 600; letter-spacing: .14em; color: var(--gfp); }
.arow .grow { flex: 1; min-width: 180px; }
.arow .grow b { font-size: 16px; }
.ms-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.ms-title { flex: 1; min-width: 240px; display: grid; gap: 2px; }
.ms-title h2 { margin: 0; font-size: 40px; text-transform: uppercase; font-stretch: 70%; line-height: 1; }
.ms-wrap { overflow: auto; max-height: calc(100vh - 210px); background: var(--glass-2); border: 1px solid var(--line-2); border-radius: 12px; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.ms { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 14px; }
.ms th, .ms td { padding: 8px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ms thead th { position: sticky; top: 0; z-index: 2; background: #081a2c; font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--dim); border-bottom: 1px solid var(--line-3); }
.ms .ms-name { position: sticky; left: 0; z-index: 1; background: #06121f; text-align: left; font-weight: 700; min-width: 180px; border-right: 1px solid var(--line); }
.ms thead .ms-name { z-index: 3; background: #081a2c; }
.ms .ms-name .muted { font-weight: 400; }
.ms .ms-num { text-align: right; font-family: var(--mono); font-size: 13px; }
.ms .ms-num.bad { color: #ff7b88; font-weight: 700; }
.ms .ms-q { text-align: center; min-width: 34px; }
.ms-c { text-align: center; font-size: 16px; font-weight: 800; min-width: 34px; }
.ms-c.ok { color: var(--gfp); text-shadow: 0 0 10px rgba(54, 214, 255, .5); }
.ms-c.bad { color: #ff7b88; }
.ms-c.blank { color: var(--dim-2); }
.ms-c.can { cursor: pointer; text-decoration: underline dotted; }
.ms-c.can:hover { background: var(--cyan-soft); }
.ms-c.pct { font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--dim); text-shadow: none; }
.ms tbody tr:hover td { background-color: rgba(165, 240, 255, .06); }
.ms tfoot td { background: #081a2c; border-bottom: 0; border-top: 1px solid var(--line-3); }
.ms-key { margin-top: 12px; }

.setup { max-width: 820px; }
.setup h2 { font-size: 40px; text-transform: uppercase; font-stretch: 70%; margin: 0 0 6px; line-height: 1; }
.setup h3 { margin: 26px 0 10px; font-size: 22px; text-transform: uppercase; }
.setup .card { padding: 16px; border-radius: 10px; background: var(--glass); border: 1px solid var(--line); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.setup .card.warn { border-color: rgba(255, 182, 72, .4); }
.setup a { color: var(--gfp); }
.copyrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.copyrow code { font-family: var(--mono); font-size: 13px; padding: 7px 10px; border-radius: 8px; background: rgba(3, 10, 20, .6); border: 1px solid var(--line); overflow-wrap: anywhere; }
pre { font-family: var(--mono); font-size: 12px; padding: 14px; border-radius: 10px; background: rgba(3, 10, 20, .7); border: 1px solid var(--line); overflow: auto; max-height: 340px; }

/* ---------------------------------------------------------------- join screen (projector) */
.projector { position: fixed; inset: 0; z-index: 120; background: rgba(1, 4, 10, .82); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); display: grid; place-items: center; padding: 24px; overflow: auto; }
.proj-inner { position: relative; width: min(1140px, 100%); display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 80px); align-items: center; }
.proj-left { display: grid; gap: 20px; min-width: 0; }
.proj-left h1 { margin: 0; font-size: clamp(36px, 5vw, 70px); text-transform: uppercase; font-stretch: 70%; line-height: .95; }
.proj-steps { display: grid; gap: 12px; font-size: clamp(17px, 1.6vw, 21px); color: var(--text-2); }
.proj-step { display: flex; gap: 12px; align-items: baseline; }
.proj-step > span { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--gfp); color: var(--gfp); font-family: var(--mono); font-weight: 700; font-size: 14px; }
.proj-step b { color: var(--text); font-family: var(--mono); font-weight: 500; overflow-wrap: anywhere; }
.proj-codebox { display: grid; gap: 4px; }
.proj-code { font-family: var(--mono); font-weight: 600; font-size: clamp(70px, 11vw, 150px); line-height: 1; letter-spacing: .12em; color: var(--gfp); text-shadow: 0 0 40px rgba(54, 214, 255, .5); }
.proj-right { display: grid; justify-items: center; gap: 16px; }
.proj-qr { position: relative; padding: 18px; background: #fff; border-radius: 14px; box-shadow: 0 0 60px rgba(54, 214, 255, .25); }
.proj-qr img, .proj-qr canvas { display: block; width: clamp(200px, 26vw, 330px) !important; height: auto !important; }
.proj-count { font-family: var(--mono); font-size: 18px; color: var(--text-2); }
.proj-close { position: absolute; top: 18px; right: 18px; z-index: 2; }
@media (max-width: 760px) { .proj-inner { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- teacher responsive (browser zoom lands here too) */
/* big, unzoomed screens: the live view fills the window and the lists scroll inside it */
@media (min-width: 1181px) and (min-height: 720px) {
  .live-wrap { height: calc(100vh - 42px); height: calc(100dvh - 42px); }
  .live-body { flex: 1; min-height: 0; align-items: stretch; }
  .roster-col { min-height: 0; }
  .roster { flex: 1; min-height: 0; overflow: auto; }
  .feed { max-height: none; min-height: 0; }
  .focus-panel { height: auto; min-height: 0; }
}
@media (max-width: 1380px) {
  .fp-body { grid-template-columns: minmax(0, 1fr) 270px; }
  .live-body.focus { grid-template-columns: 240px minmax(0, 1fr); }
}
@media (max-width: 1180px) {
  .app { grid-template-columns: 64px minmax(0, 1fr); }
  .side { padding: 14px 8px; align-items: center; }
  .side .brand > span:last-child, .nav button span, .modepill span, .side-btns { display: none; }
  .nav button { width: 44px; justify-content: center; padding: 0; }
  .modepill { width: 30px; height: 30px; padding: 0; justify-content: center; }
  .live-body { grid-template-columns: minmax(0, 1fr) 250px; }
  .tests-layout { grid-template-columns: 230px minmax(0, 1fr); }
  /* zoomed in: the chat moves under the live screen and the page scrolls */
  .focus-panel { height: auto; overflow: visible; }
  .fp-body { grid-template-columns: minmax(0, 1fr); }
  .fp-main { height: max(480px, calc(100vh - 140px)); }
  .chat { border-left: 0; border-top: 1px solid var(--line-2); height: 340px; }
}
@media (max-width: 1000px) {
  .live-body, .live-body.focus { grid-template-columns: minmax(0, 1fr); }
  .live-body.focus .roster { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); max-height: 230px; overflow: auto; }
  .roster .srow { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(8, 20, 34, .94); }
  .tests-layout { grid-template-columns: minmax(0, 1fr); }
  .tests-list { position: static; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .view { padding: 14px 12px 20px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; align-items: center; padding: 8px 12px; }
  .nav { display: flex; }
  .side-foot { margin: 0 0 0 auto; }
}

/* ================================================================
   STUDENT
   ================================================================ */
.brandbar { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px clamp(16px, 3vw, 28px); padding-top: max(16px, env(safe-area-inset-top)); }
.secure-pill { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 11px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line-2); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.secure-pill .i { width: 14px; height: 14px; color: var(--gfp); }
body.s-test .brandbar { display: none; }
.screen { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 84px 16px 40px; }
.s-card { width: min(520px, 100%); padding: clamp(24px, 4vw, 34px); display: grid; gap: 16px; background: var(--glass); border: 1px solid var(--line-2); border-radius: 16px; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.s-card.wide { width: min(760px, 100%); }
.s-card h1 { margin: 2px 0 0; font-size: clamp(38px, 5.4vw, 50px); text-transform: uppercase; font-stretch: 70%; line-height: .95; }
.s-card .lead { margin: 0; color: var(--text-2); font-size: 16px; }
.s-card .lead .th { display: block; color: var(--dim); font-size: 14.5px; margin-top: 2px; }
#joinForm { display: grid; gap: 18px; }
.codebox { position: relative; }
.code-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; text-transform: uppercase; z-index: 2; }
.code-cells { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.code-cells i { height: 66px; display: grid; place-items: center; font-style: normal; border-radius: 10px; background: rgba(3, 10, 20, .6); border: 1px solid var(--line-2); font-family: var(--mono); font-size: 32px; font-weight: 600; color: var(--gfp); text-shadow: 0 0 14px rgba(54, 214, 255, .55); transition: border-color .15s, box-shadow .15s; }
.code-cells i.full { border-color: rgba(54, 214, 255, .45); }
.code-cells i.cur { border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-soft); }
.input.big { height: 52px; font-size: 18px; }

.joining { text-align: center; display: grid; gap: 14px; justify-items: center; width: min(420px, 100%); }
.j-title { font-size: clamp(34px, 5.4vw, 46px); font-weight: 800; font-stretch: 72%; text-transform: uppercase; min-height: 1.1em; line-height: 1; text-shadow: 0 0 30px rgba(54, 214, 255, .4); }
.j-bar { width: 100%; height: 3px; border-radius: 2px; background: rgba(110, 200, 255, .14); overflow: hidden; }
.j-bar i { display: block; height: 100%; background: var(--gfp); box-shadow: 0 0 10px var(--gfp); transform-origin: left; transform: scaleX(0); }

.who { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line-2); }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--gfp); box-shadow: 0 0 14px rgba(54, 214, 255, .4); background: radial-gradient(circle, rgba(139, 155, 255, .35), transparent 70%); font-family: var(--mono); font-weight: 600; flex: none; }
.who-txt { min-width: 0; flex: 1; }
.who-name { font-size: 24px; font-weight: 800; font-stretch: 76%; text-transform: uppercase; line-height: 1.05; overflow-wrap: anywhere; }
.test-title { font-size: 24px; font-weight: 800; font-stretch: 80%; text-transform: uppercase; margin: 2px 0; overflow-wrap: anywhere; }
.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rules li { display: flex; gap: 12px; padding: 12px; border-radius: 10px; background: rgba(3, 10, 20, .5); border: 1px solid var(--line); font-size: 15px; }
.rules li .i { color: var(--gfp); margin-top: 2px; }
.rules li.warn { border-color: rgba(255, 77, 97, .4); background: var(--actin-soft); }
.rules li.warn .i { color: #ff7b88; }
.rules em { display: block; font-style: normal; color: var(--dim); font-size: 14px; margin-top: 2px; font-family: "IBM Plex Sans Thai", var(--ui); }
.standby { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--dapi-soft); border: 1px solid rgba(139, 155, 255, .35); color: #b9ceff; font-size: 14.5px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.count { text-align: center; display: grid; gap: 4px; }
.count-n { font-stretch: 68%; font-weight: 800; font-size: clamp(160px, 34vw, 300px); line-height: .9; color: var(--gfp); text-shadow: 0 0 60px rgba(54, 214, 255, .6); }
.count-n.pop { animation: pop .8s var(--ease); }
@keyframes pop { from { transform: scale(1.4); opacity: 0; } }

.done-head { display: flex; align-items: center; gap: 16px; }
.done-head h1 { font-size: clamp(32px, 4.6vw, 44px); }
.done-ico { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 2px solid var(--gfp); color: var(--gfp); box-shadow: 0 0 20px rgba(54, 214, 255, .45); }
.done-ico .i { width: 28px; height: 28px; stroke-width: 2.6; }
.result { padding: 14px 16px; border-radius: 12px; background: rgba(3, 10, 20, .5); border: 1px solid var(--line-2); display: grid; gap: 8px; }
.score { font-stretch: 70%; font-size: 60px; font-weight: 800; line-height: 1; color: var(--gfp); text-shadow: 0 0 30px rgba(54, 214, 255, .5); }
.scorebar { height: 8px; border-radius: 4px; background: rgba(110, 200, 255, .12); overflow: hidden; }
.scorebar i { display: block; height: 100%; background: var(--gfp); transform-origin: left; transform: scaleX(0); transition: transform 1s var(--ease); }
.stay-note { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--amber-soft); border: 1px solid rgba(255, 182, 72, .35); color: #ffdb92; font-size: 14px; }
.stay-note .i { color: var(--amber); }

/* lock overlay */
.lock { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; text-align: center; background: radial-gradient(900px 600px at 50% 32%, rgba(90, 10, 22, .96), rgba(14, 2, 6, .98) 72%); }
.lock::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 4px); pointer-events: none; }
.lock-card { position: relative; width: min(580px, 100%); display: grid; gap: 14px; justify-items: center; }
.lock.unlocking { transition: opacity .6s .5s; opacity: 0; }
.lock h1 { margin: 4px 0 0; font-size: clamp(48px, 8vw, 78px); text-transform: uppercase; font-stretch: 68%; line-height: .92; text-shadow: 0 0 40px rgba(255, 77, 97, .6); }
.lock-msg { margin: 0; font-size: 18px; color: #ffd6da; max-width: 44ch; }
.lock-th { margin: 0; font-size: 15px; color: #e0a3ab; font-family: "IBM Plex Sans Thai", var(--ui); }
.lock-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; margin-top: 8px; border: 1px solid rgba(255, 123, 136, .35); border-radius: 12px; overflow: hidden; }
.lock-stats div { padding: 12px 8px; display: grid; gap: 2px; border-left: 1px solid rgba(255, 123, 136, .25); }
.lock-stats div:first-child { border-left: 0; }
.lock-stats span { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #e0a3ab; }
.lock-stats b { font-family: var(--mono); font-size: 19px; }
.blink { animation: blink 1.4s steps(2, start) infinite; }

/* student chat */
.chat-fab { position: fixed; z-index: 95; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); display: inline-flex; align-items: center; gap: 9px; height: 50px; padding: 0 18px 0 15px; border-radius: 25px; border: 1px solid rgba(54, 214, 255, .5); background: var(--glass-3); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); color: var(--text); font-size: 15px; font-weight: 700; box-shadow: 0 12px 30px rgba(0, 0, 0, .45), 0 0 20px rgba(54, 214, 255, .15); }
.chat-fab .i { color: var(--gfp); width: 20px; height: 20px; }
.chat-fab .dot { position: absolute; top: -5px; right: -5px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--actin); color: #fff; font-family: var(--mono); font-size: 12px; display: grid; place-items: center; box-shadow: 0 0 12px var(--actin); }
.incoming { position: fixed; z-index: 96; left: 50%; bottom: max(80px, calc(env(safe-area-inset-bottom) + 76px)); transform: translateX(-50%); width: min(520px, calc(100vw - 24px)); padding: 16px 18px; border-radius: 14px; background: rgba(4, 30, 46, .92); border: 1px solid var(--gfp); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 40px rgba(54, 214, 255, .25); display: grid; gap: 10px; animation: note .4s var(--ease); }
.incoming .label { color: var(--gfp); }
.incoming p { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.incoming .row { display: flex; gap: 8px; justify-content: flex-end; }
@keyframes note { from { opacity: 0; transform: translateX(-50%) translateY(14px); } }
.chat-sheet { position: fixed; z-index: 97; inset: auto 0 0 0; display: flex; justify-content: center; padding: 0 12px max(12px, env(safe-area-inset-bottom)); pointer-events: none; }
.sheet-box { pointer-events: auto; width: min(560px, 100%); height: min(70vh, 560px); display: flex; flex-direction: column; border-radius: 16px; background: rgba(6, 16, 28, .94); border: 1px solid var(--line-3); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: 0 -10px 60px rgba(0, 0, 0, .6); overflow: hidden; animation: toastin .3s var(--ease); }
.sheet-box .chat-head { padding: 14px 16px; }
.sheet-box .chat-head .btn { margin-left: 4px; }
.sheet-box .bubble { font-size: 16px; }
.sheet-box .chat-form .input { height: 46px; font-size: 16px; }
.sheet-box .chat-form .btn { height: 46px; }

/* ---------------------------------------------------------------- games (after submitting) */
.games { display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.games-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.games-head b { font-size: 22px; font-stretch: 78%; font-weight: 800; text-transform: uppercase; }
.game-menu { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.game-tile { display: grid; gap: 4px; align-content: start; justify-items: start; padding: 14px; border-radius: 12px; text-align: left; background: rgba(3, 10, 20, .55); border: 1px solid var(--line-2); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.game-tile:hover { border-color: var(--gfp); box-shadow: 0 0 22px rgba(54, 214, 255, .2); }
.game-tile b { font-size: 17px; font-stretch: 85%; font-weight: 800; text-transform: uppercase; line-height: 1.1; }
.game-tile span { font-size: 13.5px; color: var(--text-2); }
.game-tile em { font-style: normal; font-family: var(--mono); font-size: 11.5px; color: var(--gfp); margin-top: 4px; }
.gt-ico { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--gfp); color: var(--gfp); margin-bottom: 4px; }
.game { display: grid; gap: 8px; }
.game-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.game-top b { font-size: 18px; font-stretch: 80%; font-weight: 800; text-transform: uppercase; }
.game-score { margin-left: auto; font-family: var(--mono); font-size: 13px; color: var(--gfp); }
.game-area { position: relative; }
.game-canvas { display: block; width: 100%; border-radius: 12px; background: radial-gradient(circle at 50% 50%, rgba(54, 214, 255, .06), rgba(3, 10, 20, .7) 70%); border: 1px solid var(--line-2); touch-action: manipulation; }
.mgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mcard { position: relative; min-height: 84px; padding: 8px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(3, 10, 20, .6); color: var(--text); font-size: 13.5px; font-weight: 600; line-height: 1.25; display: grid; place-items: center; text-align: center; transition: background .2s, border-color .2s; }
.mcard .mface { display: none; }
.mcard .mback { font-family: var(--mono); font-size: 22px; color: var(--dim-2); }
.mcard.up .mface, .mcard.ok .mface { display: block; }
.mcard.up .mback, .mcard.ok .mback { display: none; }
.mcard.up { border-color: var(--cyan); background: var(--cyan-soft); }
.mcard.name.up, .mcard.name.ok { font-stretch: 85%; font-size: 15px; font-weight: 800; text-transform: uppercase; }
.mcard.ok { border-color: var(--gfp); background: var(--gfp-soft); color: var(--gfp); }
.rush { display: grid; gap: 14px; justify-items: center; padding: 6px 0; }
.rush-strand { display: flex; gap: 3px; min-height: 52px; flex-wrap: wrap; justify-content: center; }
.rush-strand span { display: grid; gap: 2px; }
.rush-strand i { font-style: normal; width: 22px; height: 22px; border-radius: 5px; display: grid; place-items: center; font-family: var(--mono); font-size: 12px; font-weight: 700; color: #01040a; }
.rush-base { width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-size: 56px; font-weight: 700; color: #01040a; background: var(--dim-2); }
.rush-time { width: 100%; height: 6px; border-radius: 3px; background: rgba(110, 200, 255, .12); overflow: hidden; }
.rush-time i { display: block; height: 100%; background: var(--cyan); transform-origin: left; }
.rush-btns { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; width: 100%; }
.rb { height: 70px; border-radius: 14px; border: 0; font-family: var(--mono); font-size: 30px; font-weight: 700; color: #01040a; }
.rb.bad { animation: shake .25s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.rb-A { background: #36d6ff; } .rb-T { background: #ff6b7a; } .rb-G { background: #8b9bff; } .rb-C { background: #ffb648; }
.rush-base.rb-A { box-shadow: 0 0 40px rgba(54, 214, 255, .6); } .rush-base.rb-T { box-shadow: 0 0 40px rgba(255, 107, 122, .6); }
.rush-base.rb-G { box-shadow: 0 0 40px rgba(139, 155, 255, .6); } .rush-base.rb-C { box-shadow: 0 0 40px rgba(255, 182, 72, .6); }

/* full-screen arcade (games open over the finished screen; same page, still monitored) */
.gt-art { width: 100%; height: 90px; border-radius: 8px; margin-bottom: 6px; display: block; }
.arcade { position: fixed; inset: 0; z-index: 99; display: flex; flex-direction: column; background: #01040a; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
body.arcade-on { overflow: hidden; }
.arc-top { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); background: rgba(3, 10, 20, .9); }
.arc-top b { font-size: 20px; font-stretch: 78%; font-weight: 800; text-transform: uppercase; }
.arc-score { margin-left: auto; font-family: var(--mono); font-size: 13px; color: var(--gfp); text-align: right; }
.arc-stage { position: relative; flex: 1; min-height: 0; }
.arc-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; -webkit-user-select: none; user-select: none; }
.arc-msg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100% - 32px)); padding: 24px; border-radius: 16px; text-align: center; display: grid; gap: 10px; background: rgba(6, 16, 28, .9); border: 1px solid var(--line-3); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); cursor: pointer; }
.arc-msg b { font-size: 30px; font-stretch: 72%; font-weight: 800; text-transform: uppercase; line-height: 1; }
.arc-msg span { color: var(--text-2); font-size: 15px; }
.arc-msg em { font-style: normal; font-family: var(--mono); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--gfp); animation: blink 1.4s steps(2, start) infinite; }
.arc-pad:empty { display: none; }
.arc-pad { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-2); background: rgba(3, 10, 20, .9); }
.td-bar { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.td-btn { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(12, 28, 46, .7); color: var(--text); text-align: left; }
.td-btn canvas { width: 32px; height: 32px; }
.td-btn span { display: grid; line-height: 1.2; }
.td-btn b { font-size: 14px; }
.td-btn i { font-style: normal; font-size: 11.5px; color: var(--dim); font-family: var(--mono); }
.td-btn.on { border-color: var(--gfp); box-shadow: 0 0 0 2px var(--gfp-soft); }
.td-btn.poor { opacity: .5; }
.td-bar .btn { margin-left: auto; align-self: center; }
.bm-pad { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dpad { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(2, 48px); gap: 6px; }
.dpad button, .bm-bomb { border: 1px solid var(--line-3); background: rgba(12, 28, 46, .85); color: var(--text); border-radius: 12px; font-size: 20px; touch-action: none; -webkit-user-select: none; user-select: none; }
.dpad button:active, .bm-bomb:active { background: var(--gfp-soft); border-color: var(--gfp); }
.dpad [data-d=up] { grid-column: 2; grid-row: 1; }
.dpad [data-d=left] { grid-column: 1; grid-row: 2; }
.dpad [data-d=down] { grid-column: 2; grid-row: 2; }
.dpad [data-d=right] { grid-column: 3; grid-row: 2; }
.bm-bomb { width: 120px; height: 102px; font-size: 15px; font-weight: 800; text-transform: uppercase; font-stretch: 85%; border-color: var(--gfp); color: var(--gfp); box-shadow: 0 0 22px rgba(54, 214, 255, .2); }

/* ================================================================
   VAULT DIAL
   ================================================================ */
.vault-box { width: 168px; height: 168px; margin: 0 auto; }
.vault-box.sm { width: 84px; height: 84px; margin: 0 0 2px; }
.lock .vault-box { width: 200px; height: 200px; }
.vault { --vc: var(--gfp); width: 100%; height: 100%; overflow: visible; display: block; }
.vault.v-lock { --vc: #ff5d6c; }
.vault.v-ok { --vc: var(--gfp); }
.vault * { fill: none; stroke: var(--vc); stroke-linecap: round; stroke-linejoin: round; transition: stroke .5s, fill .5s; }
.v-glow { fill: var(--vc) !important; stroke: none !important; opacity: .12; filter: blur(14px); }
.v-ring { transform-origin: 100px 100px; }
.v-r1 circle { stroke-width: 1.2; opacity: .45; }
.v-r2 line { opacity: .6; }
.v-r3 circle { stroke-width: 2.4; opacity: .95; }
.v-r1 { animation: vspin 60s linear infinite; }
.v-r2 { animation: vspin 90s linear infinite reverse; }
.v-r3 { animation: vspin 24s linear infinite; }
.vault.v-lock .v-r3 { animation-duration: 6s; }
.vault.v-lock .v-r2 { animation-duration: 30s; }
.vault.v-ok .v-r3, .vault.v-ok .v-r2 { animation-play-state: paused; }
g.v-lock rect { stroke-width: 3.2; fill: color-mix(in srgb, var(--vc) 12%, transparent); }
g.v-lock circle { fill: var(--vc); stroke: none; }
g.v-lock path { stroke-width: 3.2; }
.v-shackle { transition: transform .5s var(--ease); }
.vault.v-open .v-shackle { transform: translateY(-9px); }
.vault.v-lock .v-glow { opacity: .3; animation: vpulse 1.6s ease-in-out infinite; }
@keyframes vspin { to { transform: rotate(360deg); } }
@keyframes vpulse { 50% { opacity: .1; } }

@media (max-width: 760px) {
  .game-menu { grid-template-columns: 1fr; }
  .mgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .tbar { gap: 10px; padding: 0 12px; }
  .prog { width: 60px; }
  .opts.tf { grid-template-columns: 1fr; }
  .code-cells i { height: 56px; font-size: 26px; }
  .chat-fab span { display: none; }
  .chat-fab { width: 50px; padding: 0; justify-content: center; }
  .scalebar { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ================================================================
   PRESENTATION: students follow the teacher's slides
   ================================================================ */
body.s-present .brandbar, body.s-present .scalebar { display: none; }
#scr-present { position: fixed; inset: 0; z-index: 2; display: flex; flex-direction: column; background: rgba(1, 4, 10, .9); }
.pbar { flex: none; height: 52px; display: flex; align-items: center; gap: 14px; padding: 0 16px; padding-top: env(safe-area-inset-top); background: rgba(3, 10, 20, .86); border-bottom: 1px solid var(--line-2); }
.pbar-who { font-size: 13px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.pbar-num { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--gfp); letter-spacing: .06em; white-space: nowrap; }
.pstage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; padding: 10px; }
.pstage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); background: #fff; }
.pstage img:not([src]) { visibility: hidden; }
.pstage img.pop { animation: slideIn .35s var(--ease); }
@keyframes slideIn { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
.ploader { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.pfoot { flex: none; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); font-size: 12.5px; color: var(--dim); }
.pfoot .i { width: 15px; height: 15px; color: var(--gfp); }
.pptr, .laser-dot { position: fixed; left: 0; top: 0; z-index: 30; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, #fff 0 18%, #ff3347 32%, rgba(255, 51, 71, .35) 62%, transparent 72%); box-shadow: 0 0 18px 6px rgba(255, 51, 71, .45); transition: transform .07s linear; }
.laser-dot { position: absolute; }
.modal.over .modal-box { border-color: var(--actin); box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 50px rgba(255, 77, 97, .25); }

/* ---------- teacher: Present tab ---------- */
.pr-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
.pr-card { padding: 20px; display: grid; gap: 14px; align-content: start; }
.pr-help { color: var(--text-2); line-height: 1.6; padding: 12px 14px; border-radius: 8px; background: rgba(139, 155, 255, .08); border: 1px solid rgba(139, 155, 255, .2); }
.pr-help b { color: var(--text); }
.pr-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: 52vh; overflow: auto; padding: 2px; }
.pr-th { position: relative; margin: 0; border-radius: 6px; overflow: hidden; border: 1px solid var(--line-2); background: #fff; }
.pr-th img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; }
.pr-th figcaption { position: absolute; left: 6px; bottom: 6px; padding: 1px 7px; border-radius: 4px; background: rgba(1, 4, 10, .8); font-family: var(--mono); font-size: 11.5px; }
.pr-del { position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; border: 0; background: rgba(1, 4, 10, .78); color: #ff8793; opacity: 0; transition: opacity .15s; }
.pr-th:hover .pr-del { opacity: 1; }
.pr-del .i { width: 14px; height: 14px; }
.pr-row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.kind-tag { display: inline-block; margin-right: 8px; padding: 1px 7px; border-radius: 4px; vertical-align: 2px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--dapi); background: var(--dapi-soft); }

/* ---------- teacher: presenting inside the live screen ---------- */
.pres-box { display: none; }
body.presenting .pres-box { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 14px; align-items: start; }
.ps-main { padding: 12px; display: grid; gap: 10px; min-width: 0; }
.ps-stage { position: relative; display: grid; place-items: center; height: min(46vh, 520px); border-radius: 8px; background: #000; overflow: hidden; }
.ps-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ps-stage img:not([src]), .ps-next img:not([src]) { visibility: hidden; }
.ps-ctrl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ps-num { font-family: var(--mono); font-size: 16px; min-width: 70px; text-align: center; }
.ps-keys { margin-left: auto; }
.ps-next { padding: 10px; display: grid; gap: 8px; }
.ps-next img { width: 100%; border-radius: 4px; background: #fff; aspect-ratio: 16 / 9; object-fit: contain; opacity: .9; }
.ps-strip { grid-column: 1 / -1; display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; }
.ps-mini { position: relative; flex: none; width: 112px; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; background: #fff; opacity: .7; transition: opacity .15s, border-color .15s; }
.ps-mini:hover { opacity: 1; }
.ps-mini.on { border-color: var(--gfp); opacity: 1; box-shadow: 0 0 14px rgba(54, 214, 255, .4); }
.ps-mini img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; }
.ps-mini span { position: absolute; left: 4px; bottom: 3px; padding: 0 5px; border-radius: 3px; background: rgba(1, 4, 10, .8); color: var(--text); font-family: var(--mono); font-size: 10.5px; }
.laser-btn.on { color: #ff8793; border-color: #ff4d61; background: var(--actin-soft); }
body.laser #psImg, body.laser #pfImg { cursor: none; }

/* full screen for the projector */
.pres-full { position: fixed; inset: 0; z-index: 140; background: #000; display: grid; place-items: center; }
.pf-stage { position: relative; width: 100vw; height: 100vh; display: grid; place-items: center; }
.pf-stage img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.pf-bar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 10px; background: rgba(10, 16, 22, .82); border: 1px solid var(--line-2); opacity: 0; transition: opacity .25s; }
.pres-full:hover .pf-bar, .pf-bar:focus-within { opacity: 1; }
.pf-bar span { font-family: var(--mono); font-size: 14px; padding: 0 10px; }
.pf-btn { height: 34px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--line-2); background: transparent; color: var(--text); font-size: 13px; }
.pf-btn:hover { border-color: var(--line-3); background: rgba(110, 200, 255, .08); }
.pf-alert { position: fixed; top: 14px; right: 14px; padding: 5px 12px; border-radius: 16px; border: 1px solid #ff4d61; background: rgba(60, 4, 12, .9); color: #ff8793; font-family: var(--mono); font-size: 13px; font-weight: 600; }
.pf-alert.pulse { animation: pfPulse 1s ease 3; }
@keyframes pfPulse { 50% { box-shadow: 0 0 0 10px rgba(255, 77, 97, .25); } }
@media (max-width: 1100px) { .pr-layout { grid-template-columns: 1fr; } body.presenting .pres-box { grid-template-columns: 1fr; } .ps-next { display: none; } }

/* ---------------- screen sharing (PowerPoint with animations) */
.pr-share { margin-bottom: 22px; border-color: rgba(54, 214, 255, .28); }
.pr-share-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pr-share-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.pr-steps { margin: 0; padding-left: 22px; display: grid; gap: 9px; line-height: 1.55; color: var(--text-2); }
.pr-steps b { color: var(--text); }
.pr-share-go { display: grid; gap: 12px; }
.pr-or { margin: 0 0 12px; font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); }
.pr-or .muted { text-transform: none; letter-spacing: 0; font-family: inherit; }
#psVid { display: none; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.ss-ctrl { display: none; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 10px; }
.ss-paused { position: absolute; inset: auto 0 0 0; margin: auto; top: 0; display: grid; place-items: center; color: #ffb3ba; font-weight: 600; background: rgba(0, 0, 0, .72); }
body.screenmode #psImg, body.screenmode .ps-ctrl, body.screenmode .ps-next, body.screenmode .ps-strip { display: none !important; }
body.screenmode #psVid { display: block; }
body.screenmode .ss-ctrl { display: flex; }
body.screenmode.presenting .pres-box { grid-template-columns: minmax(0, 1fr); }
body.screenmode .ps-stage { height: min(40vh, 460px); }
#pVid { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; background: #000; border-radius: 6px; }
.pvmsg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; font-size: 17px; line-height: 1.6; color: var(--text); background: rgba(1, 4, 10, .78); }
.pvmsg .th { display: block; color: var(--text-2); font-size: 15px; }
@media (max-width: 1100px) { .pr-share-body { grid-template-columns: 1fr; } }

/* internet drops: grey, so they read differently from leaving */
.feed-item.net, .log-item.net { color: #9aa9b8; }


/* ================================================================ question types: matching, fill-in, essay */
.tb-set { margin-left: 10px; padding: 2px 9px; border-radius: 6px; border: 1px solid var(--line-3); font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--cyan); white-space: nowrap; }
.tb-set:empty { display: none; }
.match { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; margin-top: 4px; }
.m-left, .m-right { display: grid; gap: 8px; align-content: start; }
.m-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) 76px; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(3, 10, 20, .5); border: 1px solid var(--line-2); }
.m-n { font-family: var(--mono); font-weight: 600; color: var(--dim); text-align: center; }
.m-t { overflow-wrap: anywhere; }
.mselect { height: 44px; border-radius: 10px; background: rgba(3, 10, 20, .7); border: 1.5px solid var(--line-3); color: var(--text); font-family: var(--mono); font-size: 17px; font-weight: 600; text-align: center; padding: 0 6px; }
.mselect:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-soft); }
.m-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px dashed var(--line-2); }
.m-opt span:last-child { overflow-wrap: anywhere; }
.fill-text { font-size: 17px; line-height: 2.3; }
input.blank { display: inline-block; width: 9.5em; max-width: 100%; height: 38px; margin: 0 4px; padding: 0 10px; vertical-align: baseline; border: 0; border-bottom: 2px solid var(--line-3); border-radius: 6px 6px 0 0; background: rgba(3, 10, 20, .6); color: var(--text); font-size: 16.5px; text-align: center; }
input.blank:focus { outline: none; border-color: var(--cyan); background: var(--cyan-soft); }
input.blank::placeholder { color: var(--dim-2); font-family: var(--mono); font-size: 13px; }
.short.essay { min-height: 220px; }
@media (max-width: 640px) { .match { grid-template-columns: 1fr; } }

/* live answers + mark sheet */
.s-set { min-width: 22px; height: 22px; padding: 0 5px; border-radius: 6px; display: inline-grid; place-items: center; border: 1px solid var(--line-3); font-family: var(--mono); font-size: 11.5px; font-weight: 700; color: var(--cyan); }
.ans-row.part { border-color: rgba(255, 182, 72, .4); }
.ans-row.pend { border-color: rgba(255, 182, 72, .6); background: rgba(40, 30, 6, .35); }
.ans-line .pair { display: inline-block; margin: 0 12px 2px 0; }
.ans-line .long { white-space: pre-wrap; }
.ov-pts { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.ov-pts .input { width: 70px; height: 32px; }
.ans-mark { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pendtag { display: inline-block; padding: 1px 7px; border-radius: 10px; background: var(--amber-soft); color: var(--amber); font-family: var(--mono); font-size: 11px; font-weight: 600; white-space: nowrap; }
.ms-c.part { color: var(--amber); font-size: 12.5px; font-family: var(--mono); }
.ms-c.pend { color: var(--amber); background: rgba(255, 182, 72, .08); }
.ms-c.na { background: repeating-linear-gradient(135deg, transparent 0 5px, rgba(110, 200, 255, .05) 5px 6px); }

/* editor: pool + sets, new question types */
.pool-note { padding: 9px 12px; border-radius: 8px; background: var(--dapi-soft); color: var(--text-2); }
.pool-note b { color: var(--text); }
.pool-note:empty { display: none; }
.ed-tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line-2); }
.ed-tabs button { padding: 9px 16px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--dim); font-weight: 700; font-size: 14px; margin-bottom: -1px; }
.ed-tabs button.on { color: var(--text); border-bottom-color: var(--gfp); }
.ed-tabs button:hover { color: var(--text); }
.eq-pairs { display: grid; gap: 6px; }
.eq-pair { display: grid; grid-template-columns: 22px minmax(0, 1fr) 18px minmax(0, 1fr) 32px; gap: 8px; align-items: center; }
.eq-pair .letter { font-family: var(--mono); font-size: 13px; color: var(--dim); text-align: center; }
.eq-arrow { color: var(--dim); text-align: center; }
.fill-prev { font-size: 13px; color: var(--text-2); padding: 7px 10px; border-radius: 8px; background: rgba(12, 28, 46, .6); }
.eq-explain { font-style: italic; }

.sets-empty { padding: 30px; text-align: center; }
.sets-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.set-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.set-chip { min-width: 74px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(3, 10, 20, .55); display: grid; justify-items: center; gap: 1px; color: var(--text); }
.set-chip b { font-size: 24px; line-height: 1; font-stretch: 80%; }
.set-chip span { font-family: var(--mono); font-size: 10.5px; color: var(--dim); }
.set-chip.on { border-color: var(--gfp); background: var(--gfp-soft); box-shadow: 0 0 16px rgba(54, 214, 255, .15); }
.sets-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.sets-warn { padding: 8px 12px; margin-bottom: 12px; border-radius: 8px; background: var(--amber-soft); color: var(--amber); }
.set-card { padding: 16px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(3, 10, 20, .5); }
.set-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.set-top h3 { margin: 2px 0 0; font-size: 22px; text-transform: uppercase; }
.set-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.set-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr); gap: 18px; align-items: start; }
.set-qs { display: grid; gap: 6px; max-height: 60vh; overflow: auto; padding-right: 4px; }
.set-q { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px; padding: 8px 10px; border-radius: 8px; background: rgba(12, 28, 46, .45); }
.set-q > b { font-family: var(--mono); color: var(--dim); }
.set-qt { overflow-wrap: anywhere; }
.set-qt .kind { margin-right: 8px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--cyan); }
.set-ans { margin-top: 3px; font-size: 13.5px; color: var(--gfp); }
.set-ans .muted { color: var(--dim); }
.set-studs { display: grid; gap: 10px; align-content: start; }
.ss-group { display: grid; gap: 4px; }
.ss-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; background: rgba(12, 28, 46, .45); }
.ss-row span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-row b { font-family: var(--mono); font-size: 13px; }
.paper-class { margin-top: 16px; padding: 16px; border-radius: 12px; border: 1px dashed var(--line-3); display: grid; gap: 12px; }
.pc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.pc-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.pc-table { width: 100%; border-collapse: collapse; }
.pc-table th { text-align: left; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); padding: 4px 6px; }
.pc-table td { padding: 3px 6px; border-top: 1px solid var(--line); }
.pc-table td:first-child { width: 36px; color: var(--dim); }
.pc-table select { width: 70px; }
.pc-score { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.pc-score .input { width: 80px; }
@media (max-width: 1100px) { .set-body { grid-template-columns: 1fr; } }

/* mark one answer */
.mark-box { width: min(760px, 100%); max-height: 92vh; overflow: auto; display: grid; gap: 12px; }
.mark-box h3 { margin: 0; }
.mark-q { padding: 10px 12px; border-radius: 8px; background: rgba(12, 28, 46, .6); color: var(--text-2); overflow-wrap: anywhere; }
.mark-q img { display: block; max-width: 100%; max-height: 200px; margin-top: 8px; border-radius: 6px; }
.mark-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mark-a, .mark-k { margin-top: 4px; padding: 10px 12px; border-radius: 8px; min-height: 90px; max-height: 38vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.mark-a { background: rgba(3, 10, 20, .7); border: 1px solid var(--line-3); color: var(--text); font-size: 15.5px; }
.mark-k { background: var(--gfp-soft); border: 1px solid rgba(54, 214, 255, .3); color: var(--text-2); font-size: 14px; }
.mark-a .pair, .mark-k .pair { display: inline-block; margin-right: 12px; }
.mark-pts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mark-pts > span { font-weight: 700; }
.mark-pts .input { width: 90px; height: 40px; font-size: 18px; font-weight: 700; }
.mark-quick { display: flex; gap: 4px; flex-wrap: wrap; }
.mark-quick .btn { min-width: 38px; }
@media (max-width: 640px) { .mark-cols { grid-template-columns: 1fr; } }

/* picture from the paper */
.crop-box { width: min(980px, 100%); max-height: 94vh; display: grid; gap: 12px; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.crop-pages { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.crop-pages button { position: relative; flex: none; width: 56px; padding: 0; border: 2px solid transparent; border-radius: 6px; background: #fff; overflow: hidden; }
.crop-pages button.on { border-color: var(--gfp); }
.crop-pages img { display: block; width: 100%; }
.crop-pages span { position: absolute; right: 2px; bottom: 2px; padding: 0 4px; border-radius: 4px; background: rgba(0, 0, 0, .7); color: #fff; font-size: 10px; }
.crop-stage { position: relative; justify-self: center; overflow: hidden; touch-action: none; user-select: none; cursor: crosshair; line-height: 0; }
.crop-stage img { max-width: 100%; max-height: 64vh; display: block; -webkit-user-drag: none; }
.crop-rect { position: absolute; border: 2px solid var(--gfp); background: rgba(54, 214, 255, .12); box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45); pointer-events: none; }

/* make from paper */
.mk-lead { max-width: 760px; margin: -6px 0 18px; }
.mk-grid { display: grid; grid-template-columns: minmax(240px, .9fr) minmax(280px, 1fr) minmax(300px, 1.1fr); gap: 18px; align-items: start; }
.mk-src { display: grid; gap: 10px; }
.mk-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.mk-thumbs figure { margin: 0; position: relative; border-radius: 6px; overflow: hidden; background: #fff; }
.mk-thumbs img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: top; }
.mk-thumbs figcaption { position: absolute; right: 3px; bottom: 3px; padding: 0 5px; border-radius: 4px; background: rgba(0, 0, 0, .7); color: #fff; font-size: 10px; }
.mk-types { display: grid; gap: 6px; }
.mk-type { display: grid; grid-template-columns: minmax(0, 1fr) 76px; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.mk-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mk-go { gap: 16px; }
.mk-way { display: grid; gap: 10px; padding: 14px; border-radius: 10px; background: rgba(3, 10, 20, .5); border: 1px solid var(--line-2); }
.mk-way-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.mk-keyok { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--gfp); }
.mk-keyok span { flex: 1; color: var(--text-2); }
.mk-keyrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.mk-paste { font-family: var(--mono); font-size: 12px; }
.mk-way a { color: var(--cyan); }
.mk-result { margin-top: 18px; padding: 18px 20px; display: grid; gap: 12px; border-color: rgba(54, 214, 255, .4); }
.mk-res-h { display: flex; gap: 12px; align-items: flex-start; }
.mk-res-h > svg { color: var(--gfp); width: 26px; height: 26px; }
.mk-res-b { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 1250px) { .mk-grid { grid-template-columns: 1fr 1fr; } .mk-go { grid-column: 1 / -1; } }
@media (max-width: 760px) { .mk-grid { grid-template-columns: 1fr; } .mk-two { grid-template-columns: 1fr; } }

/* make-from-paper: step by step status that stays on screen */
.mk-status { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line-2); background: rgba(3, 12, 24, .7); }
.mk-status.bad { border-color: rgba(255, 77, 97, .6); }
.mk-step { display: flex; align-items: center; gap: 10px; font-size: 14.5px; color: var(--text-2); }
.mk-step i { width: 10px; height: 10px; flex: none; transform: rotate(45deg); border: 1.5px solid var(--dim); }
.mk-step.ok { color: var(--text); } .mk-step.ok i { background: var(--gfp); border-color: var(--gfp); }
.mk-step.run i { border-color: var(--gfp); animation: blink 0.8s steps(2, start) infinite; }
.mk-step.bad { color: #ff8793; } .mk-step.bad i { background: var(--actin); border-color: var(--actin); }
.mk-step.todo i { border-color: var(--amber); }
.mk-err { display: grid; gap: 2px; margin-top: 4px; padding: 10px 12px; background: var(--actin-soft); border-left: 3px solid var(--actin); font-size: 14.5px; }
.mk-err b { color: #ffd0d5; }

/* ================================================================
   NEURONS & GALAXIES THEME (2026-10-15, from the user's reference image)
   Deep space behind everything (assets/cosmos.js), dark navy glass panels,
   cut-corner tiles and buttons with a teal -> violet glowing edge,
   glowing renders of real biology (cell, DNA, neuron, virus, protein).
   ================================================================ */
:root { --teal: #3fe6cf; --teal-2: #7ff5e4; --violet: #b46cff; --navy: rgba(9, 19, 31, .86); --navy-2: rgba(12, 25, 40, .92); --edge: rgba(110, 230, 215, .26); }
body { background: #03070c; color: #e2f4f2; }
body::after { display: none; }
.cosmos { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }
.biobg, .holobg, .holo-cap, .bgvid, .bgveil { display: none !important; }
h1, h2, h3 { font-family: var(--ui); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-stretch: normal; }
.label { font-family: var(--ui); font-weight: 600; letter-spacing: .16em; color: #78d9cc; }

/* the big glowing title */
.glow-title { display: block; text-align: center; font-family: "Orbitron", var(--ui); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #8ff7e6;
  font-size: clamp(34px, 5vw, 66px); line-height: 1; margin: 0; text-shadow: 0 0 6px rgba(80, 240, 220, .9), 0 0 22px rgba(60, 230, 210, .55), 0 0 60px rgba(60, 230, 210, .35); }

/* glass panels */
.panel, .glass, .stat, .qcard, .submit-zone, .tcard, .srow, .modal-box, .s-card, .paper, .eq, .ans-row, .set-card, .mk-way, .paper-class, .feed, .empty-roster, .proj-codebox, .toast, .incoming, .game-tile, .auth-card, .arow, .ms-wrap, .focus-panel, .setup .card {
  background: var(--navy); border: 1px solid var(--edge); border-radius: 10px; box-shadow: 0 24px 60px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(160, 255, 240, .06);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: #e2f4f2; clip-path: none;
}
.qcard.answered { border-color: rgba(63, 230, 207, .6); }
.qcard.focus { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal), 0 0 24px rgba(63, 230, 207, .25); }
.srow:hover, .tcard:hover { border-color: rgba(110, 230, 215, .5); }
.srow.sel, .tcard.on { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal), 0 0 22px rgba(63, 230, 207, .25); }
.srow.alert { background: rgba(60, 10, 30, .85); border-color: #ff4d7a; box-shadow: 0 0 24px rgba(255, 77, 122, .3); }

/* cut-corner shapes with a glowing gradient edge: buttons, tiles, title boxes */
.btn, .tile, .box-title, .door {
  --cut: 9px; --e1: var(--teal); --e2: var(--violet); --fill: rgba(8, 18, 30, .94);
  position: relative; isolation: isolate; border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
  background: linear-gradient(100deg, var(--e1), var(--e2)) !important;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  color: #e9fbf8; font-family: var(--ui); font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}
.btn::before, .tile::before, .box-title::before, .door::before {
  content: ""; position: absolute; inset: 1.5px; z-index: -1; background: var(--fill);
  clip-path: polygon(calc(var(--cut) - 1px) 0, 100% 0, 100% calc(100% - var(--cut) + 1px), calc(100% - var(--cut) + 1px) 100%, 0 100%, 0 calc(var(--cut) - 1px));
  box-shadow: inset 0 0 18px rgba(63, 230, 207, .14);
}
.btn { --cut: 7px; height: 38px; font-size: 12.5px; }
.btn.sm { height: 32px; font-size: 11.5px; }
.btn:hover::before { background: rgba(16, 40, 56, .96); box-shadow: inset 0 0 22px rgba(63, 230, 207, .3); }
.btn.primary, .btn.green, .btn.on, .btn.msg { --fill: linear-gradient(90deg, rgba(63, 230, 207, .34), rgba(63, 230, 207, .1)); color: #fff; }
.btn.primary::before, .btn.green::before, .btn.on::before, .btn.msg::before { background: linear-gradient(90deg, rgba(20, 70, 76, .97), rgba(12, 32, 46, .97)); box-shadow: inset 0 0 22px rgba(63, 230, 207, .35); }
.btn.danger, .btn.solid-danger { --e1: #ff4d7a; --e2: #b46cff; color: #ffd2dd; }
.btn.warn { --e1: #ffb648; --e2: #ff6fb0; color: #ffe2b3; }
.btn.ghost { --e1: rgba(110, 230, 215, .35); --e2: rgba(180, 108, 255, .35); color: #b9d9d4; }
.btn .i { color: var(--teal-2); }
.ibtn { background: rgba(8, 18, 30, .9); border: 1px solid var(--edge); border-radius: 6px; color: #9fc9c3; }
.box-title { display: inline-flex; align-items: center; justify-content: center; padding: 14px 34px; --cut: 12px; font-size: clamp(17px, 1.6vw, 22px); letter-spacing: .14em; --e1: rgba(127, 245, 228, .85); --e2: rgba(127, 245, 228, .55); margin: 0 auto 18px; }

/* tiles with glowing biology on both sides */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 760px; margin: 0 auto; }
.tile, .door { --cut: 14px; display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; gap: 12px; min-height: 76px; padding: 10px 16px; font-size: 15px; text-decoration: none; cursor: pointer; text-align: center; }
.tile img, .door img { width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 0 8px rgba(63, 230, 207, .45)); }
.tile img:last-child, .door img.r { opacity: .9; }
.tile.hot::before, .door.hot::before { background: linear-gradient(90deg, rgba(20, 70, 76, .97), rgba(14, 30, 48, .97)); box-shadow: inset 0 0 26px rgba(63, 230, 207, .35); }
.tile:hover::before, .door:hover::before { background: rgba(18, 48, 64, .97); }
.tile small, .door small { display: block; font-size: 11.5px; letter-spacing: .04em; text-transform: none; color: #9fc9c3; font-weight: 400; margin-top: 3px; }
@media (max-width: 640px) { .tiles { grid-template-columns: 1fr; } }

/* inputs */
.input, .short, .mselect, input.blank { background: rgba(4, 12, 20, .9); border: 1px solid var(--edge); color: #e9fbf8; border-radius: 6px; font-family: var(--ui); }
input.blank { border-width: 0 0 2px; border-radius: 4px 4px 0 0; }
.input:focus, .short:focus, .mselect:focus, input.blank:focus { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal), 0 0 18px rgba(63, 230, 207, .2); }
.field > span { font-family: var(--ui); letter-spacing: .14em; color: #78d9cc; }

/* tags */
.pill { border-radius: 3px; border: 1px solid currentColor; background: transparent; font-family: var(--ui); letter-spacing: .12em; }
.pill.active, .pill.live { color: var(--teal); }
.pill.away, .pill.locked { color: #ff6f92; }
.pill.submitted { color: #ffc46b; }
.pill.waiting { color: #a98bff; }
.modepill { border-radius: 3px; border-color: var(--edge); color: var(--teal); }
.s-badge { border-radius: 3px; }

/* progress bars: teal glow like the reference */
.prog, .s-bar { height: 6px; border-radius: 3px; background: rgba(110, 230, 215, .12); }
.prog-fill, .s-bar i { background: linear-gradient(90deg, #2fb9a8, var(--teal-2)); box-shadow: 0 0 10px rgba(63, 230, 207, .7); border-radius: 3px; }

/* brand: a glowing cell */
.brand { font-family: var(--ui); font-weight: 600; font-size: 17px; letter-spacing: .18em; text-transform: uppercase; color: #dff8f4; }
.brand-mark { width: 30px; height: 30px; border: 0; border-radius: 50%; transform: none; background: url(cosmos/i_cell.png) center/120% no-repeat; box-shadow: none; }
.brand-mark svg { display: none; }

/* ---------------------------------------------------------------- home: title, one panel, tiles (the reference layout) */
.home { padding: 0; grid-template-rows: auto 1fr auto; }
.home > .brand { padding: 18px clamp(16px, 4vw, 40px); }
.home-hero { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 10px 0 30px; display: grid; gap: 26px; justify-items: stretch; }
.home .stage { padding: 22px clamp(18px, 3vw, 34px) 28px; display: grid; gap: 22px; }
.home .stage-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--edge); font-family: var(--ui); letter-spacing: .14em; text-transform: uppercase; font-size: 14px; color: #cdeee9; }
.home .stage-head span:last-child { display: flex; gap: 10px; align-items: center; color: #9fc9c3; }
.home .stage-head img { width: 28px; height: 28px; }
.home .intro { text-align: center; color: #b7d6d1; font-size: 16px; line-height: 1.55; max-width: 640px; margin: 0 auto; }
.home .intro .th { color: #78d9cc; }
.home .doors { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 760px; margin: 0 auto; width: 100%; }
.home .door b { font-size: 16px; letter-spacing: .1em; }
.home .live-strip { max-width: 760px; margin: 0 auto; width: 100%; padding: 14px 18px; border: 1px solid var(--edge); border-radius: 8px; background: rgba(5, 13, 22, .8); display: grid; gap: 10px; font-size: 14px; color: #b7d6d1; }
.home .live-strip .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-family: var(--ui); letter-spacing: .08em; text-transform: uppercase; font-size: 12.5px; }
.home .live-strip .row b { color: #e9fbf8; }
.home .live-strip ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.home .live-strip .prog { width: 100%; }
.home-foot { color: #6f908b; font-family: var(--ui); text-align: center; font-size: 12px; letter-spacing: .04em; padding: 0 16px 20px; }
.home-foot a { color: #8fb3ad; }
@media (max-width: 640px) { .home .doors { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- teacher */
.auth { background: transparent; flex-direction: column; gap: 26px; }
.auth-card h1 { font-size: 22px; }
.app { position: relative; z-index: 1; width: min(1560px, calc(100% - 28px)); margin: 14px auto; min-height: calc(100vh - 28px); grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: auto 1fr;
  background: rgba(6, 14, 24, .72); border: 1px solid var(--edge); border-radius: 12px; box-shadow: 0 30px 90px rgba(0, 0, 0, .55); }
.side { position: sticky; top: 0; z-index: 30; height: auto !important; flex-direction: row !important; align-items: center; gap: 22px; padding: 12px 20px !important; background: rgba(6, 14, 24, .95); border: 0; border-bottom: 1px solid var(--edge); border-radius: 12px 12px 0 0; }
.side .brand > span:last-child { display: inline !important; }
.nav { display: flex !important; gap: 2px; flex-wrap: wrap; }
.nav button { height: 36px; padding: 0 12px !important; border-radius: 4px; color: #9fc9c3; font-family: var(--ui); font-weight: 600; font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; justify-content: center; border-left: 0; background: none; }
.nav button span { display: inline !important; }
.nav button:hover { color: #e9fbf8; background: rgba(63, 230, 207, .08); }
.nav button.on { color: var(--teal-2); background: rgba(63, 230, 207, .12); box-shadow: inset 0 -2px 0 var(--teal); }
.nav button.on .i { color: var(--teal-2); filter: drop-shadow(0 0 6px rgba(63, 230, 207, .8)); }
.side-foot { margin: 0 0 0 auto !important; display: flex !important; flex-direction: row; align-items: center; gap: 8px; }
.side-btns { display: flex !important; gap: 6px; }
.modepill span { display: inline !important; }
.view { padding: 22px 24px 28px; }
.view-title, .tl-head h2, .ms-title h2, .lh-title h2, .empty-box h2 { font-family: var(--ui); font-size: 24px; letter-spacing: .12em; color: #e9fbf8; text-shadow: 0 0 18px rgba(63, 230, 207, .25); }
.lh-clock { font-family: var(--ui); color: var(--teal-2); text-shadow: 0 0 16px rgba(63, 230, 207, .45); }
.lh-row, .ff-top, .s-sub, .tcard span, .feed-item time, .fp-meta, .q-type, .q-pts, .stat span, .codechip span { font-family: var(--ui); letter-spacing: .06em; color: #8fb3ad; }
.codechip { border-radius: 8px; border-color: rgba(63, 230, 207, .55); }
.codechip b { color: var(--teal-2); font-family: var(--ui); text-shadow: 0 0 12px rgba(63, 230, 207, .5); }
.stat b { font-family: var(--ui); font-weight: 600; }
.stat.green b { color: var(--teal-2); } .stat.red b { color: #ff6f92; } .stat.amber b { color: #ffc46b; }
.stat.red.hot { border-color: #ff4d7a; box-shadow: 0 0 24px rgba(255, 77, 122, .3); }
.alertbar { background: rgba(60, 10, 30, .85); border: 1px solid #ff4d7a; border-radius: 8px; color: #ffd2dd; }
.alertbar button { background: #ff4d7a; border-radius: 4px; }
.s-av { border-radius: 50%; background: url(cosmos/i_cell.png) center/150% no-repeat, rgba(8, 18, 30, .9); color: #fff; text-shadow: 0 1px 4px #000; border: 2px solid rgba(110, 230, 215, .35); font-family: var(--ui); }
.srow[data-st="active"] .s-av { border-color: var(--teal); box-shadow: 0 0 12px rgba(63, 230, 207, .5); }
.srow[data-st="away"] .s-av, .srow[data-st="locked"] .s-av { border-color: #ff4d7a; background-image: url(cosmos/i_virus.png); }
.srow[data-st="submitted"] .s-av { border-color: #ffc46b; }
.feed-item { border-color: rgba(110, 230, 215, .12); color: #b7d6d1; }
.feed-item b { color: #e9fbf8; }
.fp-name { font-family: var(--ui); font-size: 20px; letter-spacing: .1em; }
.fp-tabs > button.on, .ed-tabs button.on { border-bottom-color: var(--teal); color: #e9fbf8; }
.mirror { background: #020810; border-color: var(--edge); }
.mirror::before, .mirror::after { border-color: var(--teal); }
.m-screen { background: #050c14; }
.chat { background: rgba(4, 12, 20, .6); border-color: var(--edge); }
.bubble { border-radius: 8px; }
.bubble.me { background: linear-gradient(90deg, #1f8f84, #2b6fa0); color: #fff; }
.ms thead th, .ms thead .ms-name, .ms tfoot td { background: #0a1a29; color: #8fb3ad; }
.ms .ms-name { background: #07131f; }
.ms-c.ok { color: var(--teal-2); text-shadow: 0 0 8px rgba(63, 230, 207, .5); }
.set-chip { background: rgba(8, 18, 30, .9); border-color: var(--edge); border-radius: 6px; color: #e9fbf8; }
.set-chip.on { border-color: var(--teal); box-shadow: 0 0 16px rgba(63, 230, 207, .25); }
.set-q, .ss-row, .fill-prev { background: rgba(4, 12, 20, .7); border-radius: 6px; }
.set-ans { color: var(--teal-2); }
.pool-note { background: rgba(169, 139, 255, .12); color: #cfc3ff; border-radius: 6px; }
.ed-foot { background: rgba(6, 14, 24, .96); }
.eq-opt.correct { background: rgba(63, 230, 207, .12); }
.mk-status { background: rgba(4, 12, 20, .8); border: 1px solid var(--edge); border-radius: 8px; }
.empty-live { min-height: calc(100vh - 120px); }
.empty-box { background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; width: min(860px, 100%); gap: 18px; }
.empty-box .glow-title { margin-bottom: 6px; }
.empty-box p { color: #b7d6d1; }
.dash-tiles { width: 100%; }

/* join screen (projector) */
.projector { background: #03070c; }
.proj-inner { background: var(--navy); border: 1px solid var(--edge); border-radius: 14px; padding: 34px; }
.proj-left h1 { font-family: var(--ui); color: #e9fbf8; }
.proj-code { font-family: var(--ui); color: var(--teal-2); text-shadow: 0 0 20px rgba(63, 230, 207, .6); }

/* ---------------------------------------------------------------- students */
.s-card { border-radius: 12px; }
.s-card h1 { font-family: var(--ui); letter-spacing: .08em; }
.screen { position: relative; z-index: 1; }
.code-cells i { border-radius: 6px; background: rgba(4, 12, 20, .9); border-color: var(--edge); }
.code-cells i.full { border-color: var(--teal); box-shadow: 0 0 12px rgba(63, 230, 207, .3); }
.rules li { background: rgba(4, 12, 20, .7); border-radius: 6px; border-color: var(--edge); }
.rules li.warn { background: rgba(60, 10, 30, .7); border-color: rgba(255, 77, 122, .5); }
.standby { background: rgba(169, 139, 255, .12); color: #cfc3ff; border-color: rgba(169, 139, 255, .35); border-radius: 6px; }
.avatar { background: url(cosmos/i_cell.png) center/150% no-repeat, rgba(8, 18, 30, .9); color: #fff; text-shadow: 0 1px 4px #000; }
.secure-pill { background: rgba(8, 18, 30, .9); border: 1px solid var(--edge); color: var(--teal); }
.tbar { background: rgba(5, 12, 20, .94); border-bottom: 1px solid var(--edge); }
.tb-name { font-family: var(--ui); letter-spacing: .1em; }
.tb-set { color: var(--teal); border: 1px solid var(--teal); border-radius: 3px; }
.timer { font-family: var(--ui); border-radius: 4px; border-color: var(--edge); color: var(--teal-2); }
.q-num { border-radius: 50%; font-family: var(--ui); border-color: var(--edge); }
.qcard.answered .q-num { background: var(--teal); border-color: var(--teal); color: #03201c; box-shadow: 0 0 12px rgba(63, 230, 207, .6); }
.q-text, .opt-t, .short, .fill-text { font-family: "IBM Plex Sans Thai", var(--ui); }
.opt { background: rgba(4, 12, 20, .85); border: 1px solid var(--edge); border-radius: 6px; }
.opt:hover { border-color: rgba(110, 230, 215, .55); }
.opt-l { border-radius: 50%; font-family: var(--ui); border-color: var(--edge); }
.opt.sel { border-color: var(--teal); background: rgba(63, 230, 207, .14); box-shadow: 0 0 16px rgba(63, 230, 207, .2); }
.opt.sel .opt-l { background: var(--teal); border-color: var(--teal); color: #03201c; }
.m-row { background: rgba(4, 12, 20, .7); border-color: var(--edge); }
.m-opt { border-color: var(--edge); }
.lock h1 { font-family: var(--ui); }
body.bg-calm .cosmos { opacity: .55; }
#scr-join { align-content: center; gap: 22px; }
.s-title { font-size: clamp(30px, 6vw, 54px); }
.home h1.glow-title, h1.glow-title { max-width: none; width: 100%; margin: 6px 0 0; text-align: center; font-family: "Orbitron", var(--ui); font-weight: 700; letter-spacing: .14em; color: #8ff7e6; text-shadow: 0 0 6px rgba(80, 240, 220, .9), 0 0 22px rgba(60, 230, 210, .55), 0 0 60px rgba(60, 230, 210, .35); line-height: 1.05; }
.auth h1.glow-title, .empty-box h1.glow-title { font-size: clamp(32px, 4.4vw, 58px); }

/* see the animation: no frosted blur anywhere, no big box behind the page, light see-through cards */
*, *::before, *::after { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
.app { background: transparent !important; border: 0 !important; box-shadow: none !important; }
.side { background: rgba(4, 10, 18, .55) !important; border-radius: 10px !important; border: 1px solid var(--edge) !important; }
.home .stage { background: transparent !important; border: 0 !important; box-shadow: none !important; }
.home .stage-head { border-bottom-color: rgba(110, 230, 215, .18); }
.panel, .stat, .srow, .tcard, .feed, .set-card, .mk-way, .paper-class, .ms-wrap, .focus-panel, .arow, .eq, .ans-row, .empty-roster, .setup .card { background: rgba(6, 14, 24, .58) !important; box-shadow: none !important; }
.s-card, .auth-card, .modal-box { background: rgba(6, 14, 24, .7) !important; box-shadow: none !important; }
.btn::before, .tile::before, .box-title::before, .door::before { background: rgba(6, 16, 28, .72); }
.home .live-strip { background: rgba(4, 10, 18, .5); }

/* test folders */
.test-tree { display: grid; gap: 10px; }
.fgroup { border: 1px solid var(--edge); border-radius: 10px; background: rgba(4, 10, 18, .45); transition: border-color .15s, box-shadow .15s; }
.fgroup.drop { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal), 0 0 18px rgba(63, 230, 207, .3); }
.fhead { display: flex; align-items: center; gap: 8px; padding: 9px 10px; cursor: pointer; font-family: var(--ui); letter-spacing: .06em; color: #cdeee9; user-select: none; }
.fhead .i { width: 16px; height: 16px; color: var(--teal-2); }
.fhead b { flex: 1; min-width: 0; font-size: 13.5px; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcaret { width: 12px; color: #8fb3ad; font-size: 12px; }
.fcount { min-width: 22px; padding: 0 6px; border-radius: 10px; background: rgba(63, 230, 207, .14); color: var(--teal-2); font-size: 12px; text-align: center; }
.fbtns { display: none; gap: 4px; }
.fhead:hover .fbtns, .fgroup.open .fbtns { display: inline-flex; }
.fbtns .ibtn { width: 26px; height: 26px; font-size: 12px; }
.fbody { display: none; gap: 8px; padding: 0 8px 8px; }
.fgroup.open .fbody { display: grid; }
.fempty { margin: 0; padding: 8px; font-size: 12.5px; color: #8fb3ad; border: 1px dashed var(--edge); border-radius: 8px; }
.tcard.dragging { opacity: .45; }
.side { background: rgba(4, 10, 18, .96) !important; }
.ed-foot { background: rgba(4, 10, 18, .96) !important; }

/* copy and paste questions */
.modal-box.paste-box { width: min(1080px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.paste-box > p { margin-bottom: 14px; }
.paste-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; min-height: 0; flex: 1; margin-bottom: 16px; }
.paste-grid textarea { height: min(56vh, 520px); resize: none; font-family: var(--read); font-size: 15px; line-height: 1.5; }
.paste-prev { height: min(56vh, 520px); overflow: auto; display: grid; align-content: start; gap: 8px; padding-right: 4px; }
.pm-empty { display: grid; place-items: center; height: 100%; border: 1px dashed var(--line-2); border-radius: 10px; padding: 20px; text-align: center; }
.pm-q { padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: rgba(6, 14, 24, .8); }
.pm-q.need { border-color: var(--amber); }
.pm-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.pm-n { font-weight: 700; color: var(--gfp); min-width: 18px; }
.pm-head .kind { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--cyan); }
.pm-need { font-size: 12px; color: var(--amber); }
.pm-pic { font-size: 12px; color: var(--dapi); }
.pm-t { font-family: var(--read); font-size: 15px; margin-bottom: 6px; }
.pm-opt { font-family: var(--read); font-size: 14px; color: var(--text-2); padding: 2px 8px; border-radius: 6px; }
.pm-opt b { color: var(--dim); margin-right: 4px; }
.pm-opt.ok { color: var(--gfp); background: var(--gfp-soft); }
.pm-opt.ok b { color: var(--gfp); }
.pm-info { margin-right: auto; align-self: center; }
@media (max-width: 760px) { .paste-grid { grid-template-columns: 1fr; } .paste-grid textarea, .paste-prev { height: 34vh; } }

/* "Right answer?" button on each choice in the editor (the bare radio circle was too easy to miss) */
.eq-ok { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; height: 34px; padding: 0 12px; border: 1px solid var(--edge); border-radius: 6px; font-size: 13px; color: #9fb7c2; cursor: pointer; white-space: nowrap; user-select: none; }
.eq-ok:hover { border-color: var(--teal); color: #e9fbf8; }
.eq-ok input { position: absolute; opacity: 0; pointer-events: none; }
.eq-ok.on { background: var(--teal); border-color: var(--teal); color: #04121a; font-weight: 700; }
.tf-pick { align-items: center; }
.tf-pick .eq-ok { min-width: 96px; }
@media (max-width: 520px) { .eq-ok { padding: 0 8px; font-size: 12px; } }
/* matching editor: column titles + the right-answer column looks like the answer key */
.eq-pair-head span { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: #9fb7c2; }
.eq-pair-head span:nth-child(4) { color: var(--teal); }
.input.eq-key { border-color: rgba(63, 230, 207, .55); }

/* ---------------- draw / write on a question picture (assets/draw.js) */
.eq-img img[data-qa=draw] { cursor: pointer; }
#drawModal { padding: 10px; }
.draw-box { display: flex; flex-direction: column; gap: 10px; width: min(1200px, 100%); height: min(860px, calc(100vh - 20px)); padding: 14px; background: rgba(6, 14, 24, .97); border: 1px solid var(--edge); border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.draw-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.draw-tools, .draw-colors, .draw-sizes, .draw-acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dt-btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px; border: 1px solid var(--edge); border-radius: 6px; background: rgba(4, 12, 20, .9); color: #cfe4ea; font: 600 13px var(--ui); cursor: pointer; }
.dt-btn b { font-size: 16px; line-height: 1; }
.dt-btn.on { background: var(--teal); border-color: var(--teal); color: #04121a; }
.dc-btn { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); background: var(--c); cursor: pointer; }
.dc-btn.on { outline: 3px solid var(--teal); outline-offset: 2px; }
.ds-btn { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--edge); border-radius: 6px; background: rgba(4, 12, 20, .9); cursor: pointer; }
.ds-btn i { display: block; width: 20px; height: var(--w); border-radius: 9px; background: #cfe4ea; }
.ds-btn.on { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal); }
.draw-stage { flex: 1; min-height: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .35); border-radius: 8px; overflow: hidden; }
.draw-wrap { position: relative; line-height: 0; }
#drawCv { display: block; touch-action: none; border-radius: 4px; box-shadow: 0 6px 30px rgba(0, 0, 0, .5); }
.draw-txt { position: absolute; min-width: 160px; padding: 2px 6px; line-height: 1.2; background: rgba(255, 255, 255, .92); border: 2px dashed var(--teal); border-radius: 4px; font-weight: 700; font-family: "Chakra Petch", "IBM Plex Sans Thai", Arial, sans-serif; }
.draw-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 720px) { .dt-btn span { display: none; } .draw-box { height: calc(100vh - 20px); } }

/* live screen mirror: the student's phone-width rules must follow the MIRRORED screen's width, not the teacher's
   wide window (a phone's matching question was drawn in two columns and squashed to one letter per line) */
.m-screen { container-type: inline-size; }
@container (max-width: 640px) { .match { grid-template-columns: 1fr; } }
@container (max-width: 560px) {
  .tbar { gap: 10px; padding: 0 12px; }
  .prog { width: 60px; }
  .opts.tf { grid-template-columns: 1fr; }
}
/* a picture dragged over a question */
.eq.drop-on { outline: 2px dashed var(--teal); outline-offset: 3px; }

/* ---------- locked test: open in Safe Exam Browser ---------- */
.seb-steps { margin: 16px 0 0; padding-left: 22px; display: grid; gap: 10px; text-align: left; }
.seb-steps .th { display: block; }
.seb-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.seb-btns .btn { text-decoration: none; }
