/* /hw — student work and the staff results grid. HGS yellow + charcoal,
   the platform UI face as on the rest of the site. */
:root {
    --yellow: #F8D60A; --dark: #1a1d21; --ink: #23272b; --mid: #4a5056; --muted: #6b6b6b;
    --line: #e0e0e0; --soft: #f5f5f3; --card: #fff; --bg: #f4f4f2;
    --right: #2e9e60; --right-bg: #e4f5ea; --second: #e0a800; --second-bg: #fff6d6;
    --wrong: #cc2a1e; --wrong-bg: #fde8e6; --blue: #2A66B9;
    --g1: #9bd248; --g2: #e6c31e; --g0: #cf3b2d;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); min-height: 100vh; }
a { color: var(--blue); }
button, input, select { font: inherit; }

.fms-top { background: var(--dark); color: #fff; display: flex; align-items: center; gap: 16px; padding: 10px 20px; flex-wrap: wrap; }
.fms-top .brand { font-weight: 800; letter-spacing: .02em; color: #fff; text-decoration: none; font-size: 1.1rem; }
.fms-top .brand b { color: var(--yellow); }
.fms-top .spacer { flex: 1; }
.fms-top a.link, .fms-top .who { color: #ddd; font-size: .92rem; text-decoration: none; }
.fms-top a.link:hover { color: #fff; text-decoration: underline; }

.fms-wrap { max-width: 980px; margin: 0 auto; padding: 24px 16px 60px; }
.fms-wide { max-width: 1400px; }
.fms-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; margin-bottom: 18px; }
h1 { font-size: 1.6rem; margin: 0 0 6px; }
h2 { font-size: 1.2rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 16px; border-radius: 8px; cursor: pointer; text-decoration: none; font-weight: 600; }
.btn:hover { background: var(--soft); }
.btn-go { background: var(--yellow); border-color: #e2c200; color: var(--dark); }
.btn-go:hover { background: #ffe23a; }
.btn-dark { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn-dark:hover { background: #33383e; }
.btn-submit { background: #9bd248; border-color: #8cc23a; color: #fff; font-size: 1.05rem; padding: 10px 26px; }
.btn-submit:hover { background: #8cc23a; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-sm { padding: 4px 10px; font-size: .85rem; }

/* sign-in */
.fms-auth { max-width: 420px; margin: 8vh auto; }
.fms-auth label { display: block; font-weight: 600; margin: 14px 0 4px; }
.fms-auth input[type=email], .fms-auth input[type=password], .fms-auth input[type=text] { width: 100%; padding: 10px 12px; border: 1px solid #c9c9c9; border-radius: 8px; }
.fms-auth .btn { width: 100%; justify-content: center; margin-top: 18px; padding: 11px; }
.fms-msg { padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.fms-msg.err { background: var(--wrong-bg); color: var(--wrong); }
.fms-msg.ok { background: var(--right-bg); color: #1d6b40; }
.fms-msg.info { background: #eef3fb; color: #24497f; }

/* task list */
.fms-tasks { list-style: none; margin: 0; padding: 0; }
.fms-task { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.fms-task:first-child { border-top: 0; }
.fms-task .t { flex: 1 1 320px; }
.fms-task .t b { display: block; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.pill.done { background: var(--right-bg); color: #1d6b40; }
.pill.todo { background: var(--soft); color: var(--mid); }
.pill.going { background: #eef3fb; color: #24497f; }
.pill.late { background: var(--wrong-bg); color: var(--wrong); }
.pill.quick { background: #fff3cd; color: #8a5a00; }
/* /hw pupil page: something due within 24 hours, and a due time coming up */
.fms-banner.soon { background: #fff3cd; border: 1px solid #f0d27a; color: #5c3d00; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fms-banner.soon > span { flex: 1 1 240px; }
.fms-banner.soon .ic { margin-right: 6px; }
.fms-banner.soon .btn { margin-left: auto; }
.due-soon { color: #a15c00; font-weight: 700; }
.fms-task .dim { color: var(--muted); font-weight: 400; white-space: nowrap; }
/* phones: two tiles a row, so an odd one out takes the whole row rather than sitting alone */
@media (max-width: 520px) { .fms-tiles .tile:last-child:nth-child(odd) { grid-column: 1 / -1; } }
/* /hw staff results: a pupil's extension button, and the sortable headers */
.ext-btn { border: 0; background: none; padding: 0; margin-left: 6px; font: inherit; font-size: .75rem; color: var(--mid); text-decoration: underline; cursor: pointer; opacity: .55; }
tr:hover .ext-btn, .ext-btn:focus-visible { opacity: 1; }
/* /hw staff Overview: work not handed in, and when the class works */
ul.chase { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 20px; }
ul.chase li { padding: 8px 10px; border-left: 3px solid var(--wrong); background: #fbf7f7; border-radius: 6px; line-height: 1.5; }
ul.chase .pill { font-size: .7rem; padding: 0 7px; }
table.ov-when { border-collapse: separate; border-spacing: 3px; }
table.ov-when th { font-size: .72rem; color: var(--muted); font-weight: 600; text-align: left; padding: 0 4px 0 0; }
table.ov-when thead th { text-align: left; padding: 0; height: 16px; }
table.ov-when td { width: 22px; min-width: 22px; height: 22px; border-radius: 4px; }
/* the name cell: the name, then one fact a line with its label in a neat column */
table.fms-res td.name .nm { font-weight: 600; }
table.fms-res td.name .nm-l { display: flex; align-items: center; gap: 6px; font-size: .8rem; line-height: 1.55; color: var(--ink); }
table.fms-res td.name .nm-l .k { color: var(--muted); min-width: 76px; }
table.fms-res td.name .pill { font-size: .68rem; padding: 0 7px; line-height: 1.6; }
table.fms-res th.srt { cursor: pointer; text-align: left; }
table.fms-res th.srt.on { text-decoration: underline; }
.score { font-weight: 800; padding: 4px 10px; border-radius: 6px; color: #fff; min-width: 54px; text-align: center; }

/* doing a task */
.fms-qnav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 0 0 16px; }
.fms-qnav button { border: 0; background: #fff; border-radius: 6px; padding: 7px 12px; font-weight: 700; cursor: pointer; color: var(--ink); }
.fms-qnav button.cur { background: var(--dark); color: #fff; }
.fms-qnav button.r2 { background: var(--g1); color: #fff; }
.fms-qnav button.r1 { background: var(--g2); color: #fff; }
.fms-qnav button.r0 { background: var(--g0); color: #fff; }
.fms-qnav button.cur.r2, .fms-qnav button.cur.r1, .fms-qnav button.cur.r0 { outline: 3px solid var(--dark); outline-offset: 1px; }
.fms-stage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.fms-stage.with-fb { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 860px) { .fms-stage.with-fb { grid-template-columns: minmax(0, 1fr); } }
.fms-q { background: #fff; border-radius: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06); overflow: hidden; }
.fms-q-head { padding: 12px 22px; border-bottom: 1px solid var(--line); color: var(--mid); font-size: .9rem; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.fms-q-body { padding: 18px 22px 22px; font-size: 1.05rem; overflow-x: auto; }
.fms-q-body p { margin: .4em 0 .7em; }
.fms-part { display: flex; gap: .6em; margin: .5em 0; }
.fms-part > .fms-pl { font-weight: 600; flex: 0 0 auto; }
.fm-part { display: flex; gap: .6em; margin: .4em 0; }
.fm-pl { font-weight: 600; flex: 0 0 auto; }
.fm-row { display: flex; flex-wrap: wrap; gap: .4em 1.6em; align-items: center; justify-content: center; margin: .5em 0; }
.fm-marks { font-weight: 700; color: var(--mid); white-space: nowrap; }
.fm-plot, .fm-argand { max-width: 100%; height: auto; }

.fms-answers { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 14px; }
.fms-ans-part { margin: 10px 0 14px; }
.fms-ans-part > .lbl { font-weight: 700; margin-bottom: 4px; }
.fms-slot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.fms-slot .prompt { white-space: nowrap; }
math-field { min-width: 150px; font-size: 1.15rem; border: 1px solid #bfc4c8; border-radius: 8px; padding: 4px 8px; background: #fff; }
math-field:focus-within { outline: 2px solid var(--blue); outline-offset: 1px; }
math-field.ok { border-color: var(--right); background: var(--right-bg); }
math-field.bad { border-color: var(--wrong); background: var(--wrong-bg); }
math-field[read-only] { opacity: 1; }
.fms-grid { display: inline-grid; gap: 4px; padding: 4px 10px; border-left: 2px solid var(--ink); border-right: 2px solid var(--ink); border-radius: 10px; }
.fms-grid math-field { min-width: 70px; }
math-field.fms-factor { min-width: 90px; border-style: dashed; }
.fms-tuple { display: inline-flex; align-items: center; gap: 4px; font-size: 1.3rem; }
.fms-tuple math-field { min-width: 80px; font-size: 1.1rem; }
.fms-unmarked { background: var(--soft); border-radius: 8px; padding: 8px 12px; color: var(--mid); font-size: .92rem; }
.fms-submit-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.fms-hint { font-size: .9rem; color: var(--mid); }

.fms-fb { border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.fms-fb-head { color: #fff; padding: 14px 22px; font-size: 1.6rem; font-weight: 800; display: flex; align-items: center; gap: 12px; }
.fms-fb.r2 .fms-fb-head { background: #7cbc2c; }
.fms-fb.r1 .fms-fb-head { background: #d8a800; }
.fms-fb.r0 .fms-fb-head { background: var(--wrong); }
.fms-fb-body { padding: 16px 22px 20px; overflow-x: auto; }
.fms-fb-body h3 { font-size: 1rem; margin: 10px 0 4px; }
.fms-fb-foot { display: flex; justify-content: flex-end; gap: 12px; padding: 0 22px 18px; }

.fms-try { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 50; }
.fms-try > div { background: #fff; border-radius: 14px; padding: 34px 40px; text-align: center; max-width: 480px; margin: 16px; }
.fms-try .face { font-size: 3.2rem; line-height: 1; }
.fms-try p { font-size: 1.5rem; font-weight: 700; margin: 14px 0 6px; }
.fms-try .why { font-size: 1rem; font-weight: 400; color: var(--mid); }

.fms-done { text-align: center; padding: 34px 20px; }
.fms-done .big { font-size: 3rem; font-weight: 800; }

/* staff */
.fms-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.fms-tabs a { padding: 7px 14px; border-radius: 8px; text-decoration: none; color: var(--ink); background: #fff; border: 1px solid var(--line); font-weight: 600; }
.fms-tabs a.on { background: var(--dark); color: #fff; border-color: var(--dark); }
table.fms-t { border-collapse: collapse; width: 100%; font-size: .93rem; }
table.fms-t th, table.fms-t td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: middle; }
table.fms-t th { font-size: .82rem; color: var(--mid); text-transform: uppercase; letter-spacing: .03em; }
.fms-grid-wrap { overflow-x: auto; }
table.fms-res { border-collapse: separate; border-spacing: 0; font-size: .88rem; }
table.fms-res th, table.fms-res td { padding: 0; border-bottom: 1px solid #fff; }
table.fms-res th.q { width: 42px; text-align: center; padding: 6px 0; }
table.fms-res td.name { padding: 6px 12px 6px 6px; white-space: nowrap; position: sticky; left: 0; background: #fff; min-width: 190px; }
table.fms-res td.sum { padding: 6px 10px; text-align: center; white-space: nowrap; }
table.fms-res td.c { width: 42px; height: 42px; text-align: center; color: #fff; font-weight: 800; cursor: pointer; border-right: 1px solid #fff; }
td.c.r2 { background: var(--g1); } td.c.r1 { background: var(--g2); } td.c.r0 { background: var(--g0); }
td.c.r-1 { background: #d9dde1; color: var(--mid); } td.c.none { background: #f1f2f3; cursor: default; }
td.c.try1 { background: #fbe3a1; color: var(--mid); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--mid); margin: 10px 0; }
.legend span::before { content: ''; display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; background: var(--c); }

.fms-picker { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; }
@media (max-width: 860px) { .fms-picker { grid-template-columns: minmax(0, 1fr); } }
.fms-picker select, .fms-picker input[type=text], .fms-picker input[type=datetime-local], .fms-field { padding: 8px 10px; border: 1px solid #c9c9c9; border-radius: 8px; width: 100%; }
.fms-sk { border-top: 1px solid var(--line); padding: 8px 0; }
.fms-sk > b { display: block; margin-bottom: 4px; }
.fms-sub { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.fms-sub .code { font-weight: 700; color: var(--mid); min-width: 30px; }
.fms-sub.off { color: #9aa0a6; }
.fms-sub .eye { border: 0; background: none; cursor: pointer; color: var(--blue); font-size: .85rem; }
.fms-chosen li { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.fms-chosen input[type=number] { width: 56px; padding: 4px 6px; border: 1px solid #c9c9c9; border-radius: 6px; }
.fms-modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: none; align-items: flex-start; justify-content: center; z-index: 60; overflow-y: auto; padding: 30px 12px; }
.fms-modal.open { display: flex; }
.fms-modal > div { background: #fff; border-radius: 14px; max-width: 820px; width: 100%; padding: 20px 24px; position: relative; }
.fms-modal .x { position: absolute; right: 12px; top: 10px; border: 0; background: none; font-size: 1.6rem; cursor: pointer; }
.typed { background: var(--soft); border-radius: 8px; padding: 6px 10px; margin: 4px 0; }
.typed .tp { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; padding: 6px 0 6px 8px; margin-top: 4px; border-left: 3px solid var(--line); }
.typed .tp.ok { border-left-color: var(--right); } .typed .tp.bad { border-left-color: var(--wrong); }
.typed .tl { font-weight: 700; min-width: 3.2em; } .typed .tp.ok .tl { color: var(--right); } .typed .tp.bad .tl { color: var(--wrong); }
.typed .ts { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.typed .fms-grid { gap: 2px 12px; padding: 2px 8px; }
.typed .tb { padding: 1px 4px; border-radius: 4px; text-align: center; }
.typed .tb.bad { background: var(--wrong-bg); color: var(--wrong); }

/* beyond Dr Frost: the method hint, practice, the by-skill breakdown */
.fms-method { margin-top: 14px; background: #eef3fb; border-left: 4px solid var(--blue); border-radius: 8px; padding: 10px 14px; }
.fms-method > b { display: block; margin-bottom: 4px; color: #24497f; }
.fms-q.practice { box-shadow: 0 0 0 3px var(--yellow); }
.fms-practice-tag { margin-left: auto; font-size: .8rem; font-weight: 700; background: rgba(255,255,255,.25); padding: 3px 10px; border-radius: 999px; }
.fms-bar { height: 10px; background: #eceeef; border-radius: 6px; overflow: hidden; margin: 3px 0; }
.fms-bar > span { display: block; height: 100%; border-radius: 6px; }
.fms-top .brand { display: inline-flex; align-items: center; gap: 12px; }
.fms-top .brand img { height: 28px; width: auto; display: block; }
.fms-top .brand span { font-weight: 700; color: #fff; border-left: 1px solid #555; padding-left: 12px; }
td.c .h { display: block; font-size: .62rem; line-height: 1; font-weight: 700; opacity: .9; }
[hidden] { display: none !important; }
.pill { white-space: nowrap; }
/* MathLive's own menu is clutter here; in a matrix or a point the keyboard
   button too (a phone opens the keyboard when a box is tapped). */
math-field::part(menu-toggle) { display: none; }
.fms-grid math-field::part(virtual-keyboard-toggle), .fms-tuple math-field::part(virtual-keyboard-toggle) { display: none; }
.fms-grid math-field, .fms-tuple math-field { min-width: 56px; padding: 4px 6px; }
@media (max-width: 520px) {
    .fms-wrap { padding: 16px 10px 50px; }
    .fms-q-body { padding: 14px 14px 18px; }
    math-field { min-width: 120px; }
    .fms-grid math-field, .fms-tuple math-field { min-width: 46px; font-size: 1rem; }
}
td.c.fixed { box-shadow: inset 0 0 0 4px var(--g1); }

/* the pupil's dashboard */
.fms-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; background: var(--dark); color: #fff; border-radius: 16px; padding: 24px 28px; margin-bottom: 16px; }
.fms-hero h1 { font-size: 1.9rem; margin: 2px 0 14px; color: #fff; }
.fms-hero .rank { display: inline-block; background: var(--yellow); color: var(--dark); font-weight: 800; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; }
.fms-hero .next { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; align-items: center; background: #2a2f35; border-radius: 12px; padding: 12px 16px; max-width: 560px; }
.fms-hero .next .lbl { grid-column: 1; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--yellow); }
.fms-hero .next b { grid-column: 1; font-size: 1.08rem; }
.fms-hero .next .sub { grid-column: 1; color: #b8bec4; font-size: .88rem; }
.fms-hero .next .btn { grid-column: 2; grid-row: 1 / span 3; }
.fms-hero .links { margin: 12px 0 0; font-size: .9rem; color: #8d949a; }
.fms-hero .links a { color: #dfe3e6; }
.fms-level { display: flex; align-items: center; gap: 18px; }
.fms-level .ring { width: 116px; height: 116px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--yellow) calc(var(--p) * 1%), #3a3f45 0); flex: 0 0 auto; }
.fms-level .ring > span { width: 94px; height: 94px; border-radius: 50%; background: var(--dark); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.fms-level .ring small { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: #b8bec4; }
.fms-level .ring b { font-size: 2.3rem; color: var(--yellow); margin-top: 2px; }
.fms-level .pts b { font-size: 1.5rem; }
.fms-level .small { color: #dfe3e6; } .fms-level .dim { color: #8d949a; margin-top: 4px; max-width: 170px; }
@media (max-width: 720px) {
    .fms-hero { grid-template-columns: minmax(0, 1fr); padding: 20px; }
    .fms-level .ring { width: 92px; height: 92px; } .fms-level .ring > span { width: 74px; height: 74px; } .fms-level .ring b { font-size: 1.8rem; }
}
@media (max-width: 460px) { .fms-hero .next { grid-template-columns: minmax(0, 1fr); } .fms-hero .next .btn { grid-column: 1; grid-row: auto; margin-top: 8px; justify-content: center; } }
.fms-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.fms-tiles .tile { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; }
.fms-tiles .tile .ic { grid-row: 1 / span 3; font-size: 1.3rem; width: 42px; height: 42px; border-radius: 10px; background: var(--soft); display: grid; place-items: center; }
.fms-tiles .tile b { font-size: 1.6rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.fms-tiles .tile span:not(.ic) { color: var(--mid); font-size: .9rem; } .fms-tiles .tile small { color: #9aa0a6; font-size: .78rem; }
@media (max-width: 400px) { .fms-tiles { grid-template-columns: 1fr 1fr; } .fms-tiles .tile { grid-template-columns: minmax(0, 1fr); } .fms-tiles .tile .ic { grid-row: auto; margin-bottom: 6px; } }
.fms-card-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.fms-card-head h2 { margin-bottom: 4px; }
.fms-card-head .fms-bar { flex: 1 1 160px; max-width: 260px; margin-left: auto; align-self: center; }
.fms-bar.thin { height: 6px; } .fms-bar.thin > span { background: var(--yellow); }
/* achievements: a stats screen, not a sticker book — dark when earned, a
   thin line icon (yellow when earned), tier as four bars */
.fms-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.fms-badges .badge { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 3px; background: #fff; text-align: left; }
.fms-badges .badge .medal { color: #b9bfc4; margin-bottom: 6px; line-height: 0; }
.fms-badges .badge .medal svg { width: 26px; height: 26px; }
.fms-badges .badge b { font-size: .98rem; color: var(--ink); }
.fms-badges .badge.t0 b { color: var(--mid); }
.fms-badges .badge:not(.t0) { background: var(--dark); border-color: var(--dark); color: #e9ecee; }
.fms-badges .badge:not(.t0) .medal { color: var(--yellow); }
.fms-badges .badge:not(.t0) b { color: #fff; }
.fms-badges .badge .tier { display: flex; align-items: center; gap: 8px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #9aa0a6; }
.fms-badges .badge:not(.t0) .tier { color: var(--yellow); }
.fms-badges .badge .pips { display: inline-flex; gap: 3px; }
.fms-badges .badge .pips i { width: 12px; height: 4px; border-radius: 2px; background: #d7dadd; }
.fms-badges .badge:not(.t0) .pips i { background: #4a5056; }
.fms-badges .badge .pips i.on { background: var(--yellow); }
.fms-badges .badge .how { font-size: .82rem; color: var(--mid); line-height: 1.35; }
.fms-badges .badge:not(.t0) .how { color: #b9bfc4; }
.fms-badges .badge .fms-bar { width: 100%; margin-top: 6px; height: 4px; }
.fms-badges .badge .fms-bar > span { background: var(--yellow); }
.fms-badges .badge.t0 .fms-bar > span { background: #9aa0a6; }
.fms-badges .badge:not(.t0) .fms-bar { background: #3a3f45; }
.fms-badges .badge .prog { font-size: .74rem; font-weight: 700; color: var(--mid); font-variant-numeric: tabular-nums; }
.fms-badges .badge:not(.t0) .prog { color: #b9bfc4; }
.lvl { display: inline-block; font-weight: 700; font-size: .75rem; padding: 1px 8px; border-radius: 999px; margin-right: 4px; }
.lvl.ok { background: var(--right-bg); color: #1d6b40; } .lvl.mid { background: var(--second-bg); color: #7a5b00; } .lvl.low { background: var(--wrong-bg); color: var(--wrong); }
h2 .small { font-weight: 400; margin-left: 6px; }
.fms-or { font-weight: 700; color: var(--mid); padding: 0 4px; }
.fms-why { background: var(--wrong-bg); color: var(--wrong); border-radius: 8px; padding: 8px 12px; font-weight: 600; margin: 0 0 10px; }
table.fms-res.ov td.ovc { width: 46px; min-width: 46px; font-size: .78rem; font-weight: 700; cursor: default; }
table.fms-res.ov th.chh { font-size: .75rem; color: var(--mid); text-align: left; padding: 4px 6px; border-left: 2px solid #fff; white-space: nowrap; }
table.fms-res.ov tr.avg td { border-top: 2px solid var(--dark); }

/* the projector view */
body.fms-live { background: #14171a; color: #f2f2f0; }
body.fms-live main { padding: 24px 32px 40px; max-width: 1700px; margin: 0 auto; }
.lv-head { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-bottom: 20px; }
.lv-head h1 { font-size: 2rem; margin: 0; color: #fff; }
.lv-sub { color: #aab0b6; }
.lv-names { margin-left: auto; color: #aab0b6; font-size: .95rem; }
.lv-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.lv-stats > div { background: #1f2327; border-radius: 14px; padding: 16px 20px; }
.lv-stats b { display: block; font-size: 2.6rem; line-height: 1.1; color: var(--yellow); }
.lv-stats span { color: #aab0b6; }
.lv-stats b small { font-size: 1.3rem; color: #aab0b6; font-weight: 700; }
.lv-stats .lv-due { background: #24497f; } .lv-stats .lv-due b { color: #fff; } .lv-stats .lv-due span { color: #cfdaea; }
.lv-stats .lv-due.soon { background: #8a5a00; } .lv-stats .lv-due.past { background: #7a1f17; }
.lv-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; }
@media (max-width: 1000px) { .lv-body { grid-template-columns: minmax(0, 1fr); } }
.lv-body h2 { color: #fff; font-size: 1.2rem; }
.lv-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.lv-tile { background: #1f2327; border-radius: 14px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.lv-tile.none { opacity: .45; }
.lv-tile .nm { font-size: .85rem; color: #dfe3e6; }
.lv-ring { width: 70px; height: 70px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), #333a40 0); }
.lv-ring span { width: 54px; height: 54px; border-radius: 50%; background: #1f2327; display: grid; place-items: center; font-weight: 800; font-size: .95rem; }
.lv-skill { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 110px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid #2a2f34; }
.lv-skill-name { color: #dfe3e6; } .lv-skill-name b { color: var(--yellow); margin-right: 4px; }
.lv-bar { height: 16px; background: #333a40; border-radius: 8px; overflow: hidden; } .lv-bar span { display: block; height: 100%; }
.lv-pct { font-weight: 800; font-size: 1.2rem; } .lv-pct small { display: block; font-weight: 400; font-size: .75rem; color: #aab0b6; }

/* exam mode, reports, comments */
.fms-qnav button.ans { background: #8a9198; color: #fff; }
.fms-exam { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: #1f2327; color: #fff; border-radius: 12px; padding: 10px 16px; margin: 0 0 16px; }
.fms-exam span:first-child { flex: 1 1 300px; }
.fms-timer { font-weight: 800; font-size: 1.2rem; color: var(--yellow); font-variant-numeric: tabular-nums; }
.fms-timer.low { color: #ff7a6e; }
.fms-fb.saved .fms-fb-head { background: #5b636b; }
.fms-report { padding: 0 22px 12px; }
.fms-report textarea { width: 100%; margin: 6px 0; padding: 8px; border: 1px solid #c9c9c9; border-radius: 8px; font: inherit; }
.fms-report.done { color: var(--mid); font-size: .92rem; }
.fms-override { background: var(--right-bg); color: #1d6b40; border-radius: 8px; padding: 8px 12px; font-weight: 600; margin: 0 0 10px; }
.fms-banner { border-radius: 12px; padding: 12px 16px; margin: 0 0 16px; font-weight: 600; }
.fms-banner.due { background: #fff3cd; color: #6b5300; }
.fms-banner.late { background: var(--wrong-bg); color: var(--wrong); }
.fms-banner.intro { background: #eef3fb; color: #24497f; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.nt-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0; }
.nt-checks label, .nt-line { display: block; }
#nt-pupils { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; display: grid; grid-template-columns: 1fr 1fr; }
.rs-rep { background: var(--wrong-bg); border-radius: 10px; padding: 10px 14px; margin: 10px 0; }
.rs-rep li { margin: 4px 0; }
td.c .flag { position: absolute; top: 1px; right: 3px; font-size: .7rem; }
td.c { position: relative; }
.late-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; margin: 6px 0 10px; padding: 0; list-style: none; }

/* task insights (staff results page) */
.fms-tiles.ins { margin: 4px 0 14px; }
.fms-tiles.ins .tile { display: flex; flex-direction: column; background: var(--soft); border: 0; }
.ins-h { font-size: 1rem; margin: 6px 0 6px; }
.ins-help { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.ins-help li { border: 1px solid var(--line); border-left: 4px solid var(--wrong); border-radius: 8px; padding: 8px 12px; }
.ins-help .why { display: block; color: var(--mid); font-size: .88rem; }
.ins-line { margin-top: 5px; font-size: .85rem; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.ins-line .lab { color: var(--muted); }
.ins-part { background: var(--wrong-bg); color: var(--wrong); border-radius: 999px; padding: 1px 8px; font-weight: 700; }
.ins-slip { background: var(--second-bg); color: #6b5300; border-radius: 999px; padding: 1px 8px; cursor: help; }
table.ins-t td { vertical-align: top; }
.ins-ns { font-size: .9rem; color: var(--mid); background: var(--soft); border-radius: 8px; padding: 8px 12px; margin: 0 0 10px; }
.ins-ns.due { background: #fff3cd; color: #6b5300; }

/* phones and tablets */
.fms-auth { padding: 0 16px; }
@media (pointer: coarse) {
    /* a tap on a box brings the keyboard up, so the icon (60px tall on touch) only makes boxes huge */
    math-field::part(virtual-keyboard-toggle) { display: none; }
}
@media (max-width: 520px) {
    .fms-top { padding: 8px 12px; gap: 6px 12px; }
    .fms-top .brand img { height: 22px; }
    .fms-top .brand span { font-size: .92rem; padding-left: 10px; }
    .fms-top .who { display: none; }
    .fms-top a.link { font-size: .85rem; }
    .fms-card { padding: 16px; }
    .fms-badges { grid-template-columns: 1fr 1fr; gap: 8px; }
    .fms-badges .badge { padding: 10px 8px; }
    .fms-badges .badge .medal svg { width: 22px; height: 22px; }
    .fms-badges .badge .how { font-size: .78rem; }
    math-field.fms-factor { min-width: 64px; }
    .fms-task { gap: 8px 10px; }
}
mjx-container.fms-wide { display: block !important; max-width: 100%; overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
.fm-part > *, .fms-part > * { min-width: 0; }     /* so wide maths in a part can scroll instead of pushing out */
@media (max-width: 900px) {
    .fms-top .who { display: none; }                  /* the dashboard says "Hello, …" anyway */
    .fms-tiles .tile { grid-template-columns: minmax(0, 1fr); }
    .fms-tiles .tile .ic { grid-row: auto; margin-bottom: 6px; }
}

/* part marks on a question worth more than 1 (2026-10-25) */
.fms-pmarks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 12px; }
.fms-pmarks span { padding: 2px 9px; border-radius: 999px; font-weight: 600; font-size: .92rem; background: var(--soft); }
.fms-pmarks span.ok { background: var(--right-bg); color: #1d6b40; }
.fms-pmarks span.some { background: var(--second-bg); color: #7a5b00; }
.fms-pmarks span.bad { background: var(--wrong-bg); color: var(--wrong); }
.fms-pmarks b { margin-left: 4px; }
.fms-done .big .unit { font-size: 1.2rem; font-weight: 700; }
/* the how-sure question on the hand-in screen */
.fms-sure { margin: 18px auto 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); max-width: 460px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.fms-sure .q { flex-basis: 100%; font-weight: 700; }
.fms-sure-b { flex: 1 1 0; min-width: 0; border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 8px; font: inherit; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.fms-sure-b .f { font-size: 1.8rem; line-height: 1; }
.fms-sure-b:hover { border-color: #c9c9c9; }
.fms-sure-b.on { border-color: var(--dark); background: #fffbe6; }
.fms-sure .small { flex-basis: 100%; }
.fms-res td.c .pm { font-size: .72rem; font-weight: 700; letter-spacing: -.02em; }
.rs-parts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; background: var(--soft); border-radius: 8px; padding: 8px 12px; margin: -4px 0 12px; }
.rs-parts select { font-size: 1rem; padding: 2px 4px; }
/* the marking check (2026-10-25) */
.rs-remark { background: var(--second-bg); border-color: var(--second); color: #5a4300; }
.fms-res td.c .rmk { position: absolute; left: 2px; top: 0; font-size: .7rem; color: #fff; text-shadow: 0 0 2px #000; }
.fms-res td.c .fast { position: absolute; left: 2px; bottom: 0; font-size: .68rem; line-height: 1; }

/* gone quiet; adding a class */
.fms-quiet { background: #fff3cd; color: #6b5300; border-radius: 12px; padding: 10px 14px; margin: 0 0 14px; font-size: .92rem; }
.fms-quiet .muted { color: #8a7a3a; }
.imp { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 22px; }
@media (max-width: 860px) { .imp { grid-template-columns: minmax(0, 1fr); } }
.imp textarea { font: .9rem ui-monospace, Menlo, Consolas, monospace; }
.imp-df { background: var(--soft); border-radius: 12px; padding: 12px 16px; }
.imp-df h3 { font-size: 1rem; margin: 0 0 6px; }
.imp-df ol { padding-left: 18px; margin: 0 0 8px; } .imp-df li { margin: 6px 0; }
