/* A student taking an online quiz - views/quiz/take.php, typescript/src/fxquiz-take.ts. A page of
   its own (no site stylesheet), so it can sit inside a school's site without either one's styles
   reaching the other. */

:root {
  --t-accent: #003794;
  --t-soft: #e4ecf9;
  --t-text: #1d2733;
  --t-muted: #6b7686;
  --t-line: #dbe2ec;
  --t-ground: #f5f7fa;
  --t-good: #0f7a4d;
  --t-bad: #b42318;
}

/* Equations a touch larger than the text around them. fxTeX's stylesheet sizes each equation from
   this property (fxTeX Pro injects it); my-home.css sets the same for the teacher's side. */
:root { --fxtex-font-size: 120%; }

* { box-sizing: border-box; }
body.fxt { margin: 0; background: var(--t-ground); color: var(--t-text); font: 16px/1.5 Helvetica, Arial, sans-serif; }
body.fxt.is-embedded { background: transparent; }
.fxt-page { max-width: 860px; margin: 0 auto; padding: 20px 16px 40px; }
.is-embedded .fxt-page { padding-top: 8px; }
.fxt-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.fxt-title { margin: 0; font-size: 1.5rem; }
.fxt-brand { color: var(--t-muted); font-size: 0.8rem; white-space: nowrap; }
.fxt-privacy { margin-top: 28px; color: var(--t-muted); font-size: 0.8rem; }
.fxt-muted { color: var(--t-muted); font-size: 0.9rem; }
.fxt-note { padding: 10px 14px; border-left: 3px solid var(--t-accent); background: var(--t-soft); }
.fxt-error { min-height: 1.4em; margin: 4px 0; color: var(--t-bad); font-size: 0.9rem; }

.fxt-button {
  padding: 8px 18px;
  border: 1px solid var(--t-line);
  border-radius: 6px;
  background: #fff;
  color: var(--t-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.fxt-button.is-primary { background: var(--t-accent); border-color: var(--t-accent); color: #fff; }
.fxt-button:disabled { opacity: 0.6; cursor: default; }
.fxt-button[hidden] { display: none; }
.fxt-link { padding: 0; border: none; background: none; color: var(--t-accent); font: inherit; font-size: 0.88rem; cursor: pointer; text-decoration: underline; }

.fxt-signin { max-width: 360px; margin: 24px auto; padding: 22px; border: 1px solid var(--t-line); border-radius: 10px; background: #fff; }
.fxt-signin h2 { margin: 0 0 4px; }
.fxt-field { display: block; margin: 12px 0; }
.fxt-field span { display: block; margin-bottom: 4px; font-size: 0.88rem; font-weight: 600; }
.fxt-field input { width: 100%; padding: 9px 11px; border: 1px solid var(--t-line); border-radius: 6px; font: inherit; }
.fxt-code { font-family: Menlo, Consolas, monospace; letter-spacing: 0.3em; }
.fxt-signin .fxt-button { width: 100%; margin-top: 6px; }
.fxt-signout { margin: 4px 0 12px; color: var(--t-muted); font-size: 0.85rem; }

.fxt-head { display: flex; justify-content: space-between; align-items: center; }
.fxt-saved { color: var(--t-good); font-size: 0.85rem; }
.fxt-questions { display: grid; gap: 14px; }
.fxt-q { padding: 14px 18px; border: 1px solid var(--t-line); border-radius: 10px; background: #fff; }
.fxt-q-head { display: flex; justify-content: space-between; align-items: center; }
.fxt-q-number { font-weight: 700; color: var(--t-accent); }
.fxt-q-text { margin: 6px 0 10px; line-height: 1.7; }
.fxt-inline { display: inline-block; vertical-align: middle; }
/* Each equation of a question on its own line, set in from the words around it. */
.fxt-q-math { margin: 6px 0; padding: 3px 0 3px 1.5em; overflow-x: auto; overflow-y: hidden; }
.fxt-label { display: block; margin: 10px 0 4px; color: var(--t-muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }

.fxt-choices { display: grid; gap: 6px; }
.fxt-choice { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--t-line); border-radius: 6px; cursor: pointer; }
.fxt-choice:has(input:checked) { border-color: var(--t-accent); background: var(--t-soft); }
.fxt-letter { font-weight: 700; }

/* Sideways only: overflow-x alone makes overflow-y auto as well, and maths that reaches a
   pixel past its box - an integral sign, a tall fraction - then grows a vertical scrollbar. */
.fxt-template { margin: 6px 0 10px; padding: 3px 0; overflow-x: auto; overflow-y: hidden; }
.fxt-blank { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.fxt-blank-n {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 24px; height: 24px; border: 1px solid var(--t-text); font-size: 0.8rem;
}

/* A maths box: the editor's view, one line each. */
.fxt-box { flex: 1 1 auto; min-width: 0; }
.fxt-mathview { min-height: 40px; padding: 6px 10px; border: 1px solid var(--t-line); border-radius: 6px; background: #fff; }
.fxt-mathview:focus-within { border-color: var(--t-accent); box-shadow: 0 0 0 2px var(--t-soft); }
.fxt-box.is-small .fxt-mathview { min-height: 34px; }
.fxt-box.is-answer .fxt-mathview { border-width: 2px; }
.fxt-latex { display: none; margin-top: 3px; font-family: Menlo, Consolas, monospace; font-size: 0.85rem; }
.show-latex .fxt-latex { display: block; }
.fxt-lines { display: grid; gap: 6px; }
.fxt-line-tools { display: flex; gap: 16px; margin: 6px 0 0; }
/* The editor's toolbar, when the question has one: centred in a grey frame, captioned, so it reads
   as a tool and not as part of the question. moveTo() fills this slot and adds .CCToolbar to it. */
.fxt-q-toolbar { display: flex; flex-direction: column; align-items: center; margin: 6px 0 10px; padding: 4px 10px 8px; border: 1px solid #e3e6ec; border-radius: 8px; background: #f3f4f7; }
.fxt-q-toolbar::before { content: 'Editor toolbar'; align-self: stretch; margin-bottom: 4px; font-size: 0.68rem; letter-spacing: 0.05em; text-transform: uppercase; color: #8a919e; text-align: center; }
.fxt-q-toolbar:empty { display: none; }
#fxt-toolbar:empty { display: none; }

.fxt-nav { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin: 16px 0; }
.fxt-nav .fxt-muted { margin-right: auto; }

/* Done: marks, and what the teacher lets them see. */
.fxt-score { font-size: 1.2rem; font-weight: 700; }
.fxt-mark { padding: 2px 10px; border-radius: 12px; background: #fde8e7; color: var(--t-bad); font-weight: 700; font-size: 0.85rem; }
.fxt-mark.is-part { background: #fff4dc; color: #8a5a00; }
.fxt-mark.is-full { background: #e3f4ea; color: var(--t-good); }
.fxt-lines-marked { margin: 6px 0; padding-left: 22px; }
.fxt-lines-marked li { margin: 3px 0; }
.fxt-tick { margin-left: 10px; font-weight: 700; }
.is-ok .fxt-tick { color: var(--t-good); }
.is-wrong .fxt-tick { color: var(--t-bad); }
.is-unchecked .fxt-tick { color: var(--t-muted); }
.fxt-key { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--t-good); background: #f3f8f4; }

/* A few questions a day: today's, any to catch up on, and earlier days', each under its day. */
.fxt-days { display: grid; gap: 4px; }
.fxt-day { margin-top: 18px; }
.fxt-day-title { margin: 0 0 8px; font-size: 1.05rem; }
.fxt-day > .fxt-muted { margin: -4px 0 8px; }
.fxt-q.is-final { background: #fbfcfd; }
.fxt-chose { margin: 0 0 6px; }

/* The question of the day, marked: a cartoon and a word (lib/quiz-cheer.ts). It pops in; for full
   marks the face jumps and confetti falls, for less the magnifying glass has a look about. */
.fxt-cheer { display: flex; align-items: center; gap: 14px; margin: 0 0 12px; padding: 8px 16px; border-radius: 12px; animation: fxt-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.fxt-cheer.is-right { background: #e3f4ea; color: var(--t-good); }
.fxt-cheer.is-almost { background: #fff4dc; color: #8a5a00; }
.fxt-cheer-art { flex: 0 0 auto; width: 150px; height: auto; overflow: visible; }
@media (max-width: 480px) { .fxt-cheer-art { width: 110px; } }
.fxt-cheer-art * { transform-box: fill-box; transform-origin: center; }
.fxt-cheer-words strong { display: block; font-size: 1.75rem; line-height: 1.2; }
.fxt-cheer-words span { color: var(--t-text); }
.is-right .fxt-cheer-body { transform-origin: center bottom; animation: fxt-jump 0.6s ease-in-out 0.3s 3; }
.fxt-confetti > * { animation: fxt-confetti 1.4s ease-out both; }
.fxt-confetti > :nth-child(3n) { animation-delay: 0.15s; }
.fxt-confetti > :nth-child(3n + 1) { animation-delay: 0.3s; }
.is-almost .fxt-cheer-glass { transform-origin: 10% 90%; animation: fxt-peer 1.2s ease-in-out 0.3s 2; }
.fxt-cheer-hmm { animation: fxt-hmm 0.6s ease-in-out 0.3s 6 alternate; }
@keyframes fxt-pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fxt-jump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-8px); } }
@keyframes fxt-confetti { from { transform: translateY(-16px) rotate(0); opacity: 0; } 30% { opacity: 1; } to { transform: translateY(6px) rotate(200deg); opacity: 1; } }
@keyframes fxt-peer { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-14deg); } 70% { transform: rotate(8deg); } }
@keyframes fxt-hmm { from { transform: translateY(0); } to { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .fxt-cheer, .fxt-cheer-art * { animation: none !important; } }

@media (max-width: 560px) {
  .fxt-q { padding: 12px; }
  .fxt-top { flex-direction: column; gap: 2px; }
}

/* A fill-in question: the equation, locked but for its slots. */
.fxt-box.is-slots .fxt-mathview { min-height: 48px; }

/* The editor's "i" in a quiz: how to answer (lib/quiz-help.ts). */
.fxhelp { max-width: 460px; width: calc(100% - 32px); padding: 20px 22px; border: 0; border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25); font: inherit; color: inherit; }
.fxhelp::backdrop { background: rgba(15, 23, 42, 0.35); }
.fxhelp h3 { margin: 0 0 12px; font-size: 1.1rem; }
.fxhelp dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0; }
.fxhelp dt { font-weight: 700; white-space: nowrap; font-family: ui-monospace, Menlo, monospace; font-size: 0.88rem; }
.fxhelp dd { margin: 0; font-size: 0.92rem; line-height: 1.45; }
.fxhelp-foot { margin: 14px 0 0; font-size: 0.85rem; color: #5b6472; }
.fxhelp-close { display: block; margin: 16px 0 0 auto; padding: 7px 16px; text-transform: none; letter-spacing: normal; height: auto; line-height: 1.4; border: 0; border-radius: 6px; background: #003794; color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
@media (max-width: 420px) { .fxhelp dl { grid-template-columns: 1fr; gap: 2px; } .fxhelp dd { margin-bottom: 8px; } }

/* A question's fxGraph (quiz-graph.ts). */
.fxt-graph { margin: 8px 0 12px; }
