/* Online sittings: the student's paper, the results page and the tutor's view. Scoped to .tetms.
   System fonts only (no font requests), the same ink and paper colours as the builder. */
.tetms {
  --paper: #ffffff;
  --desk: #eef1f4;
  --ink: #1c2b45;
  --ink-soft: #4a5872;
  --rule: #c9d2dd;
  --gold: #b8862a;
  --red: #b3261e;
  --red-bg: #fdecea;
  --amber: #8a5a00;
  --amber-bg: #fff6e2;
  --ok: #1f6b3a;
  --ok-bg: #e8f4ec;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --top: var(--wp-admin--admin-bar--height, 0px);
  font-family: var(--sans);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  max-width: 1280px;
  margin: 0 auto;
  box-sizing: border-box;
}
.tetms *, .tetms *::before, .tetms *::after { box-sizing: border-box; }
.tetms h2, .tetms h3, .tetms h4, .tetms h5 { color: var(--ink); margin: 0; letter-spacing: 0; text-transform: none; }
.tetms h2 { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1.15; }
.tetms h3 { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.tetms h4 { font-family: var(--sans); font-size: 16px; font-weight: 700; }
.tetms h5 { font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin: 14px 0 6px; }
.tetms p { margin: 0 0 10px; }
.tetms button, .tetms select, .tetms input, .tetms textarea { font: inherit; color: inherit; }
.tetms :focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.tetms [hidden] { display: none !important; }
.tetms-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; }
.tetms-small { font-size: 14px; color: var(--ink-soft); }
.tetms-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); margin: 0 0 4px; }
.tetms-sub { font-family: var(--serif); font-size: 18px; color: var(--ink-soft); }
.tetms-row { display: flex; flex-wrap: wrap; gap: 8px; }

.tetms-btn { display: inline-block; border: 1px solid var(--ink); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 3px; cursor: pointer; font-weight: 600; font-size: 15px; text-decoration: none; line-height: 1.3; }
.tetms-btn:hover { background: #f3f5f8; color: var(--ink); }
.tetms-btn.primary { background: var(--ink); color: #fff; }
.tetms-btn.primary:hover { background: #2a3d60; color: #fff; }
.tetms-btn.big { padding: 12px 28px; font-size: 17px; }
.tetms-btn[disabled] { opacity: .5; cursor: not-allowed; }
.tetms-link { border: 0; background: none; padding: 0; color: var(--ink); text-decoration: underline; cursor: pointer; font-weight: 600; }

/* cover, gate and results head */
.tetms-cover, .tetms-gate, .tetms-result { background: var(--paper); border: 1px solid var(--rule); border-top: 4px solid var(--ink); border-radius: 4px; padding: 26px 28px; margin: 0 0 18px; }
.tetms-cover { max-width: 720px; margin: 0 auto; }
.tetms-cover h3 { margin: 22px 0 8px; font-size: 19px; }
.tetms-facts { list-style: none; margin: 16px 0; padding: 0; border-top: 1px solid var(--rule); }
.tetms-facts li { padding: 9px 0; border-bottom: 1px solid var(--rule); }
.tetms-list { margin: 0 0 14px; padding-left: 20px; }
.tetms-list li { margin: 0 0 6px; }
.tetms-note { background: var(--amber-bg); border-left: 4px solid var(--gold); border-radius: 3px; padding: 10px 14px; margin: 0 0 14px; }
.tetms-total { margin: 8px 0 4px; }
.tetms-total b { font-family: var(--serif); font-size: 54px; font-weight: 600; line-height: 1; }
.tetms-total span { font-size: 18px; color: var(--ink-soft); }
.tetms-total.is-part b { font-size: 36px; }
.tetms-todo { background: var(--amber-bg); border-radius: 3px; padding: 10px 14px; }
.tetms-alldone { background: var(--ok-bg); color: var(--ok); border-radius: 3px; padding: 12px 14px; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* the bar that stays at the top while sitting */
.tetms-bar { position: sticky; top: var(--top); z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 4px; margin: 0 0 14px; }
.tetms-bar-name { flex: 1 1 200px; min-width: 0; }
.tetms-bar-name b { display: block; font-family: var(--serif); font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tetms-bar-name span { font-size: 12px; opacity: .8; }
.tetms-timer { font-size: 13px; text-align: right; }
.tetms-timer b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tetms-timer.is-low b { color: #ffd98a; }
.tetms-timer.is-up b { color: #ffb4ab; }
.tetms-saved { font-size: 13px; opacity: .85; min-width: 96px; }
.tetms-saved.is-bad { color: #ffb4ab; opacity: 1; font-weight: 600; }
.tetms-bar .tetms-btn { border-color: #fff; background: transparent; color: #fff; }
.tetms-bar .tetms-btn:hover { background: rgba(255, 255, 255, .14); }
.tetms-bar .tetms-btn.primary { background: #fff; color: var(--ink); }
.tetms-bar .tetms-btn.primary:hover { background: #e9edf3; }
.tetms-timeup { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); border-radius: 4px; padding: 12px 16px; margin: 0 0 14px; }

/* paper and extracts side by side on a wide screen */
.tetms-layout.has-src { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 44%); gap: 18px; align-items: start; }
.tetms-paper { min-width: 0; }
.tetms-section { background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; padding: 22px 24px; margin: 0 0 18px; }
.tetms-section > h3 { padding-bottom: 8px; border-bottom: 2px solid var(--ink); margin-bottom: 10px; }
.tetms-instr { font-weight: 600; }
.tetms-group { padding: 14px 0 4px; border-top: 1px solid var(--rule); }
.tetms-section > h3 + .tetms-group, .tetms-instr + .tetms-group { border-top: 0; }
.tetms-group-title { margin: 0 0 8px; }
.tetms-stim { background: #f7f8fa; border-left: 3px solid var(--rule); padding: 12px 14px; margin: 0 0 12px; font-family: var(--serif); font-size: 16.5px; }
.tetms-source { font-size: 12px; color: var(--ink-soft); font-family: var(--sans); overflow-wrap: anywhere; }
.tetms-q { padding: 12px 0 16px; scroll-margin-top: calc(var(--top) + 90px); }
.tetms-q + .tetms-q { border-top: 1px dashed var(--rule); }
.tetms-q-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; margin: 0 0 10px; }
.tetms-num { font-weight: 700; min-width: 2.4em; }
.tetms-q-text { font-family: var(--serif); font-size: 17.5px; line-height: 1.45; }
.tetms-marks { font-weight: 700; white-space: nowrap; }
.tetms-answer label[for] { display: block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 4px; }
.tetms-answer textarea { display: block; width: 100%; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 3px; background: #fff; font-family: var(--sans); font-size: 16px; line-height: 1.75; resize: vertical; min-height: 96px;
  background-image: linear-gradient(to bottom, transparent 27px, #e6ebf1 27px); background-size: 100% 28px; background-attachment: local; background-position: 0 12px; }
.tetms-q-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; font-size: 13px; color: var(--ink-soft); margin: 6px 0 0; }
.tetms-opts { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; list-style: none; }
.tetms-opt { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 3px; cursor: pointer; background: #fff; }
.tetms-opts.is-done .tetms-opt { grid-template-columns: auto minmax(0, 1fr); cursor: default; }
.tetms-opt input { margin: 5px 0 0; width: 16px; height: 16px; accent-color: var(--ink); }
.tetms-opt:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: #f3f5f8; }
.tetms-letter { font-weight: 700; }
.tetms-opt.is-right { border-color: var(--ok); background: var(--ok-bg); }
.tetms-opt.is-wrong { border-color: var(--red); background: var(--red-bg); }
.tetms-opt em { font-style: normal; font-weight: 700; font-size: 13px; }
.tetms-why { margin: 8px 0 0; font-size: 15px; }
.tetms-choice { border: 2px solid var(--ink); border-radius: 4px; padding: 10px 14px 6px; margin: 12px 0; background: #f7f8fa; }
.tetms-choice legend { font-weight: 700; padding: 0 6px; font-size: 15px; }
.tetms-choice-opts { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0 0 6px; }
.tetms-choice label { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; cursor: pointer; padding: 6px 0; }
.tetms-choice input { width: 18px; height: 18px; accent-color: var(--ink); }
.tetms .is-off .tetms-answer, .tetms .is-off .tetms-opts, .tetms .is-off .tetms-stim, .tetms .is-off .tetms-read { display: none; }
.tetms .is-off .tetms-q-text, .tetms .is-off .tetms-group-title, .tetms .is-off .tetms-num, .tetms .is-off .tetms-marks { color: #7b8698; }
.tetms-off-note { font-size: 14px; color: var(--ink-soft); font-style: italic; margin: 0; }
.tetms-end { text-align: center; padding: 10px 0 40px; }

/* extracts and figures */
.tetms-src { background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; position: sticky; top: calc(var(--top) + 84px); max-height: calc(100vh - var(--top) - 100px); display: flex; flex-direction: column; overflow: hidden; }
.tetms-src-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 2px solid var(--ink); background: #f7f8fa; }
.tetms-src-head select { max-width: 100%; min-width: 0; flex: 1; padding: 6px 8px; border: 1px solid var(--rule); border-radius: 3px; background: #fff; font-weight: 600; }
.tetms-src-close, .tetms-src-toggle { display: none; }
.tetms-src-body { overflow: auto; padding: 16px 18px 24px; overscroll-behavior: contain; }
.tetms-src-title { font-size: 20px; margin: 0 0 10px; }
.tetms-scenario { background: #f7f8fa; border-left: 3px solid var(--gold); padding: 10px 14px; margin: 0 0 14px; }
.tetms-extract { margin: 0 0 18px; font-family: var(--serif); font-size: 16.5px; line-height: 1.55; }
.tetms-extract h4 { font-family: var(--sans); margin: 0 0 8px; padding-top: 10px; border-top: 1px solid var(--rule); }
.tetms-fig { margin: 0 0 18px; }
.tetms-fig figcaption { font-family: var(--sans); font-size: 15px; margin: 0 0 6px; }
.tetms-img { display: block; max-width: 100%; height: auto; }
.tetms-data { margin: 6px 0 0; font-family: var(--sans); font-size: 14px; }
.tetms-data summary, .tetms-srcd summary, .tetms-scheme summary, .tetms-typed summary { cursor: pointer; font-weight: 600; }
.tetms-tablewrap { overflow-x: auto; margin: 0 0 10px; }
.tetms-table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: 14.5px; background: #fff; }
.tetms-table caption { text-align: left; font-weight: 700; padding: 0 0 6px; }
.tetms-table th, .tetms-table td { border: 1px solid var(--rule); padding: 6px 9px; text-align: left; vertical-align: top; }
.tetms-table th { background: #f3f5f8; }
.tetms-breakdown { max-width: 620px; }
.tetms-srcd { background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; padding: 12px 16px; margin: 0 0 18px; }
.tetms-srcd[open] summary { margin-bottom: 12px; }

/* after hand-in */
.tetms-review { padding-left: calc(2.4em + 12px); }
.tetms-chip { display: inline-block; font-weight: 700; font-size: 14px; background: var(--ok-bg); color: var(--ok); border-radius: 999px; padding: 3px 12px; margin: 0 0 8px; }
.tetms-chip.is-wait { background: var(--amber-bg); color: var(--amber); }
.tetms-yours { white-space: pre-wrap; overflow-wrap: anywhere; background: #f7f8fa; border-left: 3px solid var(--rule); padding: 10px 14px; font-size: 15.5px; max-height: 420px; overflow: auto; }
.tetms-adjusted { background: var(--amber-bg); border-left: 4px solid var(--gold); padding: 8px 12px; border-radius: 3px; }
.tetms-nomark { background: var(--amber-bg); border-radius: 3px; padding: 10px 14px; }
.tetms-report { margin: 6px 0 0; }
.tetms-scheme { margin: 12px 0; font-size: 14px; }
.tetms-override { background: #f6f7f7; border: 1px solid #dcdcde; padding: 10px 12px; margin: 10px 0 0; font-size: 13px; }
.tetms-admin .tetms-result { border-top-width: 1px; padding: 16px 20px; }
.tetms-admin .tetms-section { padding: 16px 20px; }

/* dialog */
.tetms-dialog { border: 0; border-radius: 6px; padding: 24px 26px; max-width: min(92vw, 480px); color: var(--ink); box-shadow: 0 12px 48px rgba(16, 26, 46, .35); }
.tetms-dialog::backdrop { background: rgba(16, 26, 46, .55); }
.tetms-dialog h3 { margin: 0 0 10px; }

/* phones and narrow screens: the extracts become a full-screen drawer */
@media (max-width: 1079px) {
  .tetms-layout.has-src { display: block; }
  .tetms-src { position: fixed; inset: 0; top: var(--top); z-index: 60; max-height: none; border: 0; border-radius: 0; visibility: hidden; transform: translateY(100%); transition: transform .22s ease, visibility 0s linear .22s; }
  .tetms.src-open .tetms-src { visibility: visible; transform: none; transition: transform .22s ease; }
  .tetms-src-close, .tetms-src-toggle { display: inline-block; }
  .tetms-src-close { white-space: nowrap; }
}
@media (max-width: 640px) {
  .tetms { font-size: 15.5px; }
  .tetms h2 { font-size: 25px; }
  .tetms-section { padding: 16px 14px; }
  .tetms-cover, .tetms-gate, .tetms-result { padding: 20px 16px; }
  .tetms-bar { padding: 8px 10px; gap: 6px 10px; border-radius: 0; margin-left: -4px; margin-right: -4px; }
  .tetms-bar-name { flex-basis: 100%; }
  .tetms-bar-name span { display: none; }
  .tetms-timer { text-align: left; flex: 1; }
  .tetms-timer b { font-size: 19px; display: inline; }
  .tetms-saved { min-width: 0; font-size: 12px; }
  .tetms-bar .tetms-btn { padding: 7px 10px; font-size: 14px; }
  .tetms-q-head { grid-template-columns: auto minmax(0, 1fr); }
  .tetms-marks { grid-column: 2; justify-self: end; }
  .tetms-review { padding-left: 0; }
  .tetms-src-body { padding: 14px 14px 40px; }
}
@media (prefers-reduced-motion: reduce) { .tetms-src { transition: none !important; } }
@media print { .tetms-bar, .tetms-src { display: none !important; } }

/* how to add a diagram */
.tetms-diagram { background: #f7f8fa; border-left: 3px solid var(--gold); padding: 8px 12px; margin: 8px 0; font-size: 14.5px; }
.tetms-diagram summary { cursor: pointer; font-weight: 600; }
.tetms-diagram ul { margin: 6px 0 0; padding-left: 20px; }

/* photos or a PDF with an answer; the handed-in page */
.tetms-files { margin: 10px 0 0; }
.tetms-thumbs { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; padding: 0; }
.tetms-thumbs:empty { display: none; }
.tetms-thumb { position: relative; width: 84px; height: 84px; border: 1px solid var(--rule); border-radius: 3px; background: #f3f5f8; overflow: hidden; }
.tetms-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tetms-thumb.is-pdf a { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; font-weight: 700; color: var(--ink); }
.tetms-thumb-x { position: absolute; top: 2px; right: 2px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--ink); background: #fff; color: var(--ink); font-size: 18px; line-height: 1; cursor: pointer; padding: 0; }
.tetms-add { cursor: pointer; font-size: 14px; padding: 7px 12px; }
.tetms-add:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }
.tetms-add.is-busy { opacity: .6; pointer-events: none; }
.tetms [data-file-status].is-bad { color: var(--red); font-weight: 600; }
.tetms-unanswered { margin: 0 0 10px; padding-left: 20px; max-height: 9.5em; overflow: auto; columns: 2; }
.tetms-consent { display: flex; gap: 10px; align-items: flex-start; background: #f7f8fa; border: 1px solid var(--rule); border-radius: 3px; padding: 10px 12px; margin: 0 0 10px; font-size: 14.5px; cursor: pointer; }
.tetms-consent input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--ink); }
.tetms-handed-msg { font-size: 19px; margin: 14px 0 8px; }
.tetms-progress { display: inline-block; background: var(--amber-bg); color: var(--amber); font-weight: 700; border-radius: 999px; padding: 4px 14px; }
.tetms-job { font-size: 13px; margin: 8px 0; }
.tetms-job.is-failed { color: var(--red); }
.tetms-retry { margin: 0 0 8px; }
/* an answer to send again; marking held back */
.tetms-resend { background: var(--amber-bg); border-left: 4px solid var(--gold); border-radius: 3px; padding: 12px 14px; margin: 8px 0; }
.tetms-resend-msg { margin: 0 0 10px; }
.tetms-delayed { background: var(--amber-bg); border-radius: 3px; padding: 10px 14px; margin: 10px 0; }

/* ---- class candidates: entering a code, and the teacher's classes page ---- */
.tetms-noname { color: var(--amber); font-weight: 600; }
.tetms-noname-top { background: var(--amber-bg); padding: 8px 12px; border-radius: 3px; margin: 0 0 10px; }
.tetmc-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--rule); padding: 8px 0; margin-bottom: 14px; }
.tetmc-pin { flex: 1 1 260px; font-size: 14px; }
.tetmc-pin summary { cursor: pointer; text-decoration: underline; }
.tetmc-enter label, .tetmt label { font-weight: 600; }
.tetms input.tetmc-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 28px; letter-spacing: .12em; text-transform: uppercase; width: 11.5em; max-width: 100%; padding: 10px 12px; border: 2px solid var(--ink); border-radius: 3px; }
.tetms input.tetmc-pin-in { font-size: 20px; letter-spacing: .2em; width: 7em; padding: 8px 10px; border: 1px solid var(--ink); border-radius: 3px; }
.tetmt input[type=text], .tetmt input[type=number], .tetmt select { font-size: 15px; padding: 7px 9px; border: 1px solid var(--ink-soft); border-radius: 3px; background: #fff; color: var(--ink); }
.tetmt-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; }
.tetmt-box { background: #fff; border: 1px solid var(--rule); border-radius: 4px; padding: 14px 16px; margin: 16px 0; }
.tetmt-name { font-weight: 400; color: var(--ink-soft); }
.tetmt-grid th[scope=row], .tetmt-cands th[scope=row] { text-align: left; white-space: nowrap; }
.tetmt-cell { font-weight: 600; }
.tetmt-cell.is-set, .tetmt-cell.is-started { font-weight: 400; color: var(--ink-soft); }
.tetmt tr.is-archived { opacity: .6; }
.tetmt-actions .tetms-btn { padding: 4px 9px; font-size: 13px; margin: 2px 0; }
.tetmt-codes { background: var(--amber-bg); border: 2px solid var(--gold); border-radius: 4px; padding: 14px 16px; margin: 0 0 16px; }
.tetmt-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 18px; letter-spacing: .08em; }
.tetmt-danger { border-top: 1px solid var(--rule); margin-top: 28px; padding-top: 8px; }
.tetmt-danger .tetms-btn { border-color: var(--red); color: var(--red); }
.tetmt-review .tetms-override, .tetmt-review .tetms-retry { margin: 8px 0; }
.tetmt-review input.tetmt-note { min-width: min(24em, 100%); }
.tetmt-slips { display: none; }
@media print {
  body.tetmt-printing > *:not(.tetmt-slips) { display: none !important; }
  body.tetmt-printing .tetmt-slips { display: grid; grid-template-columns: 1fr 1fr; gap: 0; font-family: system-ui, Arial, sans-serif; color: #000; }
  .tetmt-slip { border: 1px dashed #666; padding: 14px 16px; break-inside: avoid; font-size: 12pt; }
  .tetmt-slip p { margin: 0 0 6px; }
  .tetmt-slip-cand { font-weight: 700; }
  .tetmt-slip-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 22pt; letter-spacing: .1em; font-weight: 700; }
}

/* "Tell your class": the message a teacher copies for pupils, and the links between the teacher's pages */
.tetmt-tell { margin: 14px 0; }
.tetmt-tell summary { cursor: pointer; padding: 6px 0; }
.tetmt-pupilmsg { border: 1px solid var(--rule); border-left: 5px solid var(--ok); background: var(--paper); border-radius: 3px; padding: 10px 12px; margin: 10px 0; }
.tetmt-pupilmsg textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 14px; border: 1px solid var(--rule); border-radius: 3px; padding: 8px; resize: vertical; }
.tetmt-pupilmsg .tetmb-row { display: flex; gap: 10px; align-items: center; margin: 6px 0 0; }
.tetmt-links { font-size: 14px; margin: 0 0 10px; }
.tetmt-links a { color: var(--ink); font-weight: 600; }
