:root {
  --ink: #1d1b3a; --ink-2: #4a4867; --ink-3: #75738f; --line: #e3e1ec; --line-2: #d2cfe0;
  --bg: #f5f4f9; --card: #ffffff; --soft: #efedf7; --field: #ffffff;
  --brand: #2e2a7a; --brand-2: #4a43c4; --brand-soft: #e8e6fb; --gold: #ffd166; --brand-text: #2e2a7a; --bar: #8f88e8; --bar-hi: #2e2a7a; --toast: #1d1b3a; --pre-bg: rgba(255,255,255,.6);
  --good: #11795a; --good-soft: #def5ec; --warn: #9a5b00; --warn-soft: #fff1d6; --bad: #b42335; --bad-soft: #fde6e9; --info: #1f5fbf; --info-soft: #e2ecfc;
  --code-bg: #17162b; --code-ink: #ecebff;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Code", Consolas, "Courier New", monospace;
  --r: 14px; --shadow: 0 1px 2px rgba(29,27,58,.06), 0 8px 24px rgba(29,27,58,.06);
}
/* Dark mode: switched on with the Dark mode button after logging in (saved on this device only). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edecf8; --ink-2: #c9c7de; --ink-3: #a09eba; --line: #2f2d4a; --line-2: #423f63;
  --bg: #11101d; --card: #1b1a2d; --soft: #26253d; --field: #15142a;
  --brand: #5249d6; --brand-2: #6a61ee; --brand-soft: #2c2a57; --brand-text: #b9b3ff;
  --good: #3fcf9b; --good-soft: #143a2f; --warn: #f2b55a; --warn-soft: #3d2e14; --bad: #ff7d8e; --bad-soft: #43202a; --info: #7fb0ff; --info-soft: #1a2c4a;
  --code-bg: #0c0b17; --bar: #6c64d8; --bar-hi: #b9b3ff; --toast: #2c2a57; --pre-bg: rgba(0,0,0,.28);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}
:root[data-theme="dark"] .good-btn { color: #0b2a20; }
:root[data-theme="dark"] .good-btn:hover { background: #5fe0b0; }
:root[data-theme="dark"] .danger { border-color: #6a3340; }
.theme-btn { font-size: 14px; }
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* hidden boxes stay hidden even when they're flex/grid */
.jump-code { display: none; }
.short { display: none; }
html, body { margin: 0; }
body { font: 16px/1.55 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 30px; font-weight: 700; } h2 { font-size: 21px; font-weight: 650; } h3 { font-size: 17px; font-weight: 650; }
p { margin: 0 0 .8em; } a { color: var(--brand-2); }
.muted { color: var(--ink-3); } .small { font-size: 14px; } .tiny { font-size: 12.5px; }
.boot { display: grid; place-items: center; height: 100vh; font: 700 28px var(--display); color: var(--brand-text); }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; border-radius: 6px; }

/* buttons and inputs */
button, .btn { font: 600 15px var(--font); border: 1px solid var(--line-2); background: var(--card); color: var(--ink); padding: 9px 16px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
button:hover, .btn:hover { background: var(--soft); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--brand); color: #fff; border-color: var(--brand-text); }
.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.good-btn { background: var(--good); color: #fff; border-color: var(--good); } .good-btn:hover { background: #0d6249; }
.danger { color: var(--bad); border-color: #f0b8c0; } .danger:hover { background: var(--bad-soft); }
.ghost { border-color: transparent; background: transparent; } .ghost:hover { background: var(--soft); }
.sm { padding: 6px 11px; font-size: 14px; border-radius: 8px; }
.lg { padding: 12px 22px; font-size: 16.5px; }
label { display: block; font-weight: 600; font-size: 14px; margin: 0 0 6px; color: var(--ink-2); }
input, select, textarea { font: 15.5px var(--font); color: var(--ink); background: var(--field); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { resize: vertical; min-height: 90px; }
textarea.code, .code { font-family: var(--mono); font-size: 14.5px; }
.field { margin-bottom: 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; font-size: 14.5px; color: var(--ink-2); margin-bottom: 12px; cursor: pointer; }
.check input { width: 18px; height: 18px; flex: none; margin: 2px 0 0; accent-color: var(--brand-2); }
.check.strong { font-weight: 650; }
.copy-btn { padding: 3px 8px; font-size: 12.5px; font-weight: 600; color: var(--brand-text); }
@media print { .copy-btn { display: none !important; } }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; } .spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 650; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: var(--ink-2); white-space: nowrap; }
.chip.good { background: var(--good-soft); color: var(--good); } .chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); } .chip.info { background: var(--info-soft); color: var(--info); } .chip.brand { background: var(--brand-soft); color: var(--brand-text); }
.badge { background: var(--gold); color: var(--ink); font-size: 12px; font-weight: 750; border-radius: 999px; padding: 1px 8px; margin-left: auto; }
.badge.red { background: var(--bad); color: #fff; }

/* login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: radial-gradient(1200px 600px at 10% 10%, #4a43c4 0%, #2e2a7a 45%, #1b1850 100%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art h1 { font-size: 46px; max-width: 12ch; margin-top: 40px; }
.login-art p { font-size: 18px; opacity: .85; max-width: 34ch; }
.login-art .code-deco { font: 15px/1.7 var(--mono); background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.12); border-radius: 14px; padding: 18px 22px; max-width: 420px; color: #dcdaff; }
.code-deco .k { color: var(--gold); } .code-deco .s { color: #8ef0c4; }
.login-side { display: grid; place-items: center; padding: 32px; }
.login-card { width: 100%; max-width: 410px; }
.login-card h2 { font-size: 26px; }
.demo-box { margin-top: 26px; padding: 16px; border: 1px dashed var(--line-2); border-radius: var(--r); background: var(--card); }
.demo-box .row button { flex: 1; justify-content: center; }
.logo { display: flex; align-items: center; gap: 10px; font: 750 21px var(--display); letter-spacing: -.02em; }
.logo img { width: 34px; height: 34px; }
.err { color: var(--bad); background: var(--bad-soft); padding: 10px 12px; border-radius: 10px; font-size: 14.5px; margin-bottom: 14px; }

/* staff shell */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { padding: 4px 10px 6px; }
.side .school { font-size: 13px; color: var(--ink-3); padding: 0 10px 14px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: 15px; }
.nav a:hover { background: var(--soft); color: var(--ink); }
.nav a.on { background: var(--brand-soft); color: var(--brand-text); font-weight: 700; }
.nav .ico { width: 20px; text-align: center; font-size: 16px; }
.nav-h { font-size: 11.5px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 16px 12px 6px; }
.side .me { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 10px 0; font-size: 14px; }
.side .me b { display: block; }
.main { padding: 30px 40px 60px; max-width: 1240px; width: 100%; min-width: 0; }
.lay > *, .mark-lay > *, .work > * { min-width: 0; }
.demo-bar { background: var(--warn-soft); color: var(--warn); font-size: 13.5px; font-weight: 600; padding: 7px 14px; border-radius: 10px; margin-bottom: 18px; display: flex; gap: 8px; align-items: center; }
.page-h { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-h h1 { margin: 0; } .page-h .sub { color: var(--ink-3); margin-top: 4px; }
.page-h .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.back { font-size: 14px; color: var(--ink-3); text-decoration: none; display: inline-block; margin-bottom: 8px; font-weight: 600; }
.back:hover { color: var(--brand-2); }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 22px; }
.card + .card { margin-top: 18px; }
.card h2 { display: flex; align-items: center; gap: 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; }
a.tile:hover { border-color: var(--brand-2); }
.tile .n { font: 750 34px var(--display); letter-spacing: -.02em; }
.tile .l { color: var(--ink-3); font-size: 14px; font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 18px; }
.tile.hl { background: linear-gradient(135deg, #2e2a7a, #4a43c4); color: #fff; border: 0; }
.tile.hl .l { color: #d6d4ff; }
.lay { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.item-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column; gap: 8px; text-align: left; font: inherit; color: inherit; white-space: normal; }
.item-card:hover { border-color: var(--brand-2); background: var(--card); }
.item-card h3 { margin: 0; }
.empty { text-align: center; color: var(--ink-3); padding: 34px 10px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--soft); }
.progress { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; min-width: 90px; }
.progress > i { display: block; height: 100%; background: var(--brand-2); border-radius: 99px; }

/* gradebook */
.gb td, .gb th { text-align: center; padding: 8px; }
.gb td:first-child, .gb th:first-child { text-align: left; position: sticky; left: 0; background: var(--card); }
.cell { display: inline-block; min-width: 54px; padding: 5px 8px; border-radius: 8px; font-weight: 700; font-size: 14px; cursor: pointer; border: 0; }
.cell.hi { background: var(--good-soft); color: var(--good); } .cell.mid { background: var(--warn-soft); color: var(--warn); } .cell.lo { background: var(--bad-soft); color: var(--bad); }
.cell.in { background: var(--info-soft); color: var(--info); } .cell.none { background: transparent; color: var(--ink-3); cursor: default; font-weight: 500; }

/* code */
pre { margin: 0; }
.codeview { background: var(--code-bg); color: var(--code-ink); font: 14.5px/1.6 var(--mono); border-radius: 12px; padding: 14px 0; overflow: auto; max-height: 540px; counter-reset: ln; }
.codeview .ln { display: block; padding: 0 16px 0 0; white-space: pre; }
.codeview .ln::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 44px; padding-right: 14px; text-align: right; color: #6f6c95; user-select: none; }
.editor { display: flex; background: var(--code-bg); border-radius: 12px; overflow: hidden; border: 2px solid transparent; }
.editor:focus-within { border-color: var(--brand-2); }
.editor .gutter { color: #6f6c95; font: 15px/1.6 var(--mono); padding: 14px 10px 14px 0; text-align: right; min-width: 46px; user-select: none; white-space: pre; overflow: hidden; }
.editor textarea { flex: 1; background: transparent; color: var(--code-ink); border: 0; border-radius: 0; font: 15px/1.6 var(--mono); padding: 14px 14px 14px 6px; min-height: 380px; resize: vertical; white-space: pre; overflow: auto; tab-size: 4; caret-color: var(--gold); }
.editor textarea:focus { box-shadow: none; }
.console { background: #0f0e1f; color: #d8d6ff; font: 14px/1.55 var(--mono); border-radius: 12px; padding: 12px 14px; min-height: 70px; max-height: 260px; overflow: auto; white-space: pre-wrap; }
.console .e { color: #ff9aa8; } .console .m { color: #8f8cb8; }

/* pupil */
.p-top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.p-top .in { max-width: 1320px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 20px; }
.p-top nav { display: flex; gap: 4px; }
.p-top nav a { padding: 8px 14px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 600; }
.p-top nav a.on { background: var(--brand-soft); color: var(--brand-text); }
.p-main { max-width: 1320px; margin: 0 auto; padding: 28px 24px 60px; }
.hello { background: linear-gradient(135deg, #2e2a7a, #4a43c4 70%, #6b5be0); color: #fff; border-radius: 20px; padding: 28px 30px; margin-bottom: 24px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.hello h1 { margin: 0; font-size: 32px; } .hello p { margin: 4px 0 0; opacity: .85; }
.hello .stat { background: rgba(255,255,255,.12); border-radius: 14px; padding: 10px 18px; text-align: center; }
.hello .stat b { display: block; font: 750 26px var(--display); }
.task-card { border-left: 5px solid var(--brand-2); }
.task-card.late { border-left-color: var(--bad); } .task-card.done { border-left-color: var(--good); } .task-card.wait { border-left-color: var(--info); }
.work { display: grid; grid-template-columns: minmax(320px, 0.85fr) 1.15fr; gap: 20px; align-items: start; }
.work .brief { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; }
.brief .task p { font-size: 16.5px; }
/* easy-to-read task descriptions */
.task .task-lead { font-size: 17.5px; line-height: 1.55; margin-bottom: 14px; }
.task-step { display: flex; gap: 12px; align-items: flex-start; background: var(--soft); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; font-size: 16px; line-height: 1.6; }
.task-step strong { color: var(--ink); }
.step-n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-2); color: #fff; font: 750 14px var(--display); display: grid; place-items: center; margin-top: 1px; }
.task code { font-family: var(--mono); font-size: .9em; background: var(--brand-soft); color: var(--brand-text); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.task-list { padding-left: 22px; margin: 0 0 12px; } .task-list li { margin-bottom: 6px; line-height: 1.55; }
.task-preview { margin-top: 10px; padding: 14px; border: 1px dashed var(--line-2); border-radius: 12px; position: static; max-height: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.criteria { list-style: none; padding: 0; margin: 0; }
.criteria li { padding: 6px 0 6px 30px; position: relative; }
.criteria li::before { content: "✓"; position: absolute; left: 0; top: 6px; width: 20px; height: 20px; border-radius: 6px; background: var(--good-soft); color: var(--good); font-size: 13px; font-weight: 800; display: grid; place-items: center; }
.hint { background: var(--warn-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; font-size: 15px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; padding: 10px 14px; color: var(--ink-3); }
.tabs button.on { color: var(--brand-text); border-bottom-color: var(--brand-text); }
.test { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--soft); margin-bottom: 8px; align-items: flex-start; font-size: 14.5px; }
.test.pass { background: var(--good-soft); } .test.fail { background: var(--bad-soft); }
.test .ic { font-weight: 800; width: 20px; flex: none; }
.test pre { font: 13px/1.45 var(--mono); white-space: pre-wrap; background: var(--pre-bg); padding: 6px 8px; border-radius: 6px; margin-top: 4px; }
.banner { border-radius: var(--r); padding: 16px 20px; margin-bottom: 18px; display: flex; gap: 16px; align-items: center; }
.banner.good { background: var(--good-soft); } .banner.info { background: var(--info-soft); } .banner.warn { background: var(--warn-soft); }
.banner .big { font: 750 34px var(--display); }
.parsons { list-style: none; padding: 0; margin: 0; }
.parsons li { display: flex; align-items: center; gap: 8px; background: var(--code-bg); color: var(--code-ink); font: 14.5px var(--mono); padding: 8px 10px; border-radius: 9px; margin-bottom: 6px; cursor: grab; border: 2px solid transparent; }
.parsons li pre { flex: 1; white-space: pre; overflow-x: auto; }
.parsons li.ok { border-color: #34d399; } .parsons li.no { border-color: #fb7185; border-style: dashed; }
/* ✓ / ✗ markers: the symbol and border style carry the meaning, not just the colour (colour-blind friendly) */
.mark-ic { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font: 800 13px var(--font); line-height: 1; }
.mark-ic.ok { background: #34d399; color: #062b1f; }
.mark-ic.no { background: transparent; color: #ffb4be; border: 2px dashed #fb7185; }
.parsons li { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: background .15s, border-color .15s; }
.parsons li:hover { border-color: rgba(143,136,232,.45); }
.pz-grip { color: #8f8cb8; font-size: 18px; line-height: 1; cursor: grab; flex: none; }
/* the gap where the lifted block will land */
.parsons li.pz-gap { background: transparent; border: 2px dashed var(--brand-2); opacity: .7; margin-bottom: 6px; }
/* the block you're holding */
.pz-float { position: fixed; inset: 0 auto auto 0; margin: 0; padding: 0; z-index: 300; pointer-events: none; }
.parsons li.pz-ghost { position: fixed; margin: 0; cursor: grabbing; transition: transform .15s ease, box-shadow .15s ease; will-change: top, transform; }
.parsons li.pz-ghost.lifted { transform: scale(1.04) rotate(-.6deg); box-shadow: 0 18px 40px rgba(10,8,40,.45), 0 0 0 2px var(--brand-2); }
.parsons li.pz-ghost.landing { transition: top .16s ease, transform .16s ease, box-shadow .16s ease; }
.parsons li.pz-press { transform: scale(.98); transition: transform .25s ease; }
body.pz-dragging, body.pz-dragging * { cursor: grabbing !important; user-select: none; }
.pz-touch-tip { display: none; }
@media (pointer: coarse) { .pz-touch-tip { display: inline; } }
.parsons li button { background: rgba(255,255,255,.1); color: #fff; border: 0; padding: 3px 8px; font-size: 13px; }
.blanks { background: var(--code-bg); color: var(--code-ink); font: 15px/2.1 var(--mono); padding: 14px 16px; border-radius: 12px; white-space: pre-wrap; overflow-x: auto; }
.blanks input { width: 110px; display: inline-block; padding: 2px 8px; font: 14px var(--mono); border-radius: 6px; background: #2a2850; color: #fff; border: 1px solid #4b4880; }
.blanks input.ok { border-color: #34d399; background: #123d33; } .blanks input.no { border-color: #fb7185; background: #4a1d2a; border-style: dashed; border-width: 2px; }
.blanks .gap { white-space: nowrap; }
.blanks .gap-ic { width: 0; margin-left: 0; vertical-align: middle; overflow: hidden; }
.blanks .gap-ic.ok, .blanks .gap-ic.no { width: 20px; height: 20px; margin-left: 4px; font-size: 12px; }

/* marking */
.mark-lay { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; }
/* Stays in view while the left side scrolls, but scrolls on its own when it's taller than the screen,
   so the bottom (e.g. "Finished early?") is always reachable. */
.mark-panel { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; scrollbar-width: thin; padding-right: 2px; }
.mark-num { display: flex; align-items: center; gap: 14px; }
.mark-num input[type=number] { width: 100px; font: 750 28px var(--display); text-align: center; }
.mark-num input[type=range] { flex: 1; padding: 0; accent-color: var(--brand-2); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.quick button { font-size: 13px; padding: 5px 10px; border-radius: 99px; font-weight: 550; }

/* tests editor */
.t-row { display: grid; grid-template-columns: 1fr 1.2fr 1.6fr auto; gap: 8px; margin-bottom: 8px; align-items: start; }
.t-row textarea { min-height: 44px; font-family: var(--mono); font-size: 13.5px; }

/* modal & toast */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, 94vw); box-shadow: 0 30px 80px rgba(20,18,50,.35); color: var(--ink); background: var(--card); }
dialog.wide { width: min(900px, 96vw); }
dialog::backdrop { background: rgba(20,18,50,.45); backdrop-filter: blur(2px); }
.m-h { padding: 22px 24px 4px; } .m-b { padding: 8px 24px 8px; max-height: 70vh; overflow-y: auto; } .m-f { padding: 14px 24px 22px; display: flex; gap: 10px; justify-content: flex-end; }
#toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(30px); background: var(--toast); color: #fff; padding: 12px 20px; border-radius: 12px; font-weight: 600; opacity: 0; transition: .25s; pointer-events: none; z-index: 50; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--bad); }
.slips { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.slip { border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.slip b { font-size: 16px; display: block; margin-bottom: 4px; } .slip code { font: 600 14.5px var(--mono); background: var(--soft); padding: 1px 6px; border-radius: 5px; }
.chart { width: 100%; height: 150px; display: block; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-text); display: grid; place-items: center; font-weight: 750; font-size: 14px; flex: none; }
.mail { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: var(--card); }
.mail summary { padding: 14px 16px; cursor: pointer; display: flex; gap: 12px; align-items: center; list-style: none; }
.mail summary::-webkit-details-marker { display: none; }
.mail .body { padding: 0 16px 16px; }
.mail pre { font: 13.5px/1.55 var(--mono); background: var(--soft); padding: 14px; border-radius: 10px; white-space: pre-wrap; overflow-x: auto; }
.privacy { max-width: 760px; margin: 0 auto; padding: 40px 24px 80px; }
.privacy h2 { margin-top: 28px; }
.shield { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.shield div { background: var(--soft); border-radius: 12px; padding: 12px 14px; font-size: 14.5px; }
.shield b { display: block; margin-bottom: 2px; }

/* task types */
.handin { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.tab-main { font-size: 12px; margin-left: 2px; }
/* Task-type picker: Off / Practice / Marked for each type */
.mode-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 7px; background: var(--card); }
.mode-row .mode-txt { flex: 1 1 200px; min-width: 0; }
.mode-row.practice { border-color: var(--brand-2); }
.mode-row.marked { border-color: var(--brand-2); background: var(--brand-soft); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex: none; }
.seg button { border: 0; border-radius: 0; padding: 6px 10px; font-size: 13px; background: transparent; box-shadow: none; min-height: 0; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--brand); color: #fff; font-weight: 700; }
.seg button[data-set="off"].on { background: var(--soft); color: var(--ink); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.pick-pupils { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px 12px; max-height: 220px; overflow: auto; margin-top: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; }
.pick-pupils .check { margin: 4px 0; }
/* Pupil: marked / practice labels on tabs, and the predict-first lock */
.tab-badge { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px; margin-left: 4px; background: var(--soft); color: var(--ink-3); }
.tab-badge.mk { background: var(--brand-soft); color: var(--brand-text); }
.tabs button.locked:not(.on) { opacity: .55; }
/* Task tabs wrap onto a second line instead of running off the card; with 4+ tabs they use short names. */
.tabs.task-tabs { flex-wrap: wrap; overflow: visible; row-gap: 2px; }
.tabs.task-tabs button { flex: none; padding: 9px 10px; white-space: nowrap; }
.tabs.task-tabs.many .long { display: none; }
.tabs.task-tabs.many .short { display: inline; }
.tabs.task-tabs + .tab-key { margin: -8px 0 14px; }
/* 2-step login setup */
.mfa-steps { padding-left: 20px; display: grid; gap: 14px; margin: 10px 0 14px; }
.mfa-key { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.mfa-key code { font-size: 17px; letter-spacing: .08em; word-break: break-all; }
.pilot-bar a { color: inherit; font-weight: 700; text-decoration: underline; }
/* School data: download / restore */
.data-card .data-opt { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.data-card .data-opt h3 { margin: 0 0 6px; }
.data-card .danger-zone { border-color: var(--bad, #c0392b); }
.banner.bad-banner { background: color-mix(in srgb, var(--bad, #c0392b) 12%, var(--card)); border: 1px solid var(--bad, #c0392b); }
/* All pupils list: actions stay visible on the right even when the table scrolls */
#ap-t .ap-act { position: sticky; right: 0; background: var(--card); text-align: right; white-space: nowrap; box-shadow: -8px 0 8px -8px rgba(0,0,0,.25); }
.pupil-filters { margin-bottom: 14px; }
/* Pupil profile */
a.pupil-link { color: inherit; text-decoration: none; border-bottom: 1px dashed var(--line-2); }
a.pupil-link:hover { color: var(--brand-text); border-bottom-color: var(--brand-text); }
.avatar.big { width: 44px; height: 44px; font-size: 17px; flex: none; }
.pp-tiles .tile .n .of { font-size: 18px; color: var(--ink-3); font-weight: 600; }
.pp-tiles .tile.hl .n .of { color: #d6d4ff; }
.tile.warn-tile { border-color: var(--bad, #c0392b); }
.ai-level { gap: 6px; margin-top: 8px; align-items: center; }
.ai-level select { width: auto; padding: 5px 8px; font-size: 14px; }
.fix-info { margin-top: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 4px; }
.fix-tests { margin: 0 0 12px; }
a.banner.follow-up { text-decoration: none; color: inherit; cursor: pointer; }
a.banner.follow-up:hover { filter: brightness(1.04); }
.lock-note { text-align: center; padding: 28px 16px; border: 1px dashed var(--line); border-radius: 14px; }

/* leaderboards */
.lb { list-style: none; padding: 0; margin: 0; }
.lb li { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 12px; margin-bottom: 6px; background: var(--soft); }
.lb li.pod { background: var(--brand-soft); }
.lb li.me { outline: 2px solid var(--brand-2); }
.lb-r { width: 34px; text-align: center; font-size: 22px; flex: none; }
.lb-n { font: 750 15px var(--display); color: var(--ink-3); }
.lb-name { flex: 1; min-width: 0; }
.lb-score { font: 750 18px var(--display); color: var(--brand-text); white-space: nowrap; }
.lb-pts { font-size: 12px; font-weight: 600; opacity: .75; }
.lb-stars { min-width: 44px; text-align: right; font-size: 15px; white-space: nowrap; }
.lb-screen .lb-pts { font-size: 16px; } .lb-screen .lb-stars { font-size: 22px; min-width: 70px; }
.ext-mark { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); }
.ext-box summary { cursor: pointer; }
.my-rank { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: 14px; background: var(--good-soft); margin-bottom: 16px; }
.my-rank .big { font: 750 30px var(--display); color: var(--good); }

/* full-screen leaderboard for the class screen */
.lb-screen { position: fixed; inset: 0; z-index: 100; background: radial-gradient(1200px 700px at 20% 10%, #4a43c4, #2e2a7a 50%, #15133a); color: #fff; padding: 48px 56px; overflow: auto; }
.lb-screen-in { display: flex; gap: 48px; flex-wrap: wrap; }
.lb-col { flex: 1 1 420px; }
.lb-screen h1 { font-size: 44px; margin-bottom: 20px; }
.lb-screen .lb li { background: rgba(255,255,255,.1); padding: 16px 22px; margin-bottom: 10px; font-size: 24px; }
.lb-screen .lb li.pod { background: rgba(255,209,102,.18); }
.lb-screen .lb-r { width: 54px; font-size: 34px; } .lb-screen .lb-n { color: #d6d4ff; font-size: 24px; }
.lb-screen .lb-score { color: var(--gold); font-size: 28px; }
.lb-screen .chip { font-size: 15px; background: rgba(255,255,255,.18); color: #fff; }
.lb-screen .empty { color: #d6d4ff; }
.lb-close { position: absolute; top: 18px; right: 22px; background: rgba(255,255,255,.14); color: #fff; border-color: transparent; }
.lb-foot { margin-top: 28px; font-size: 20px; opacity: .85; }

#print { display: none; }
@media print {
  body > *:not(#print) { display: none !important; }
  #print { display: block; font-family: var(--font); }
  #print .slips { grid-template-columns: 1fr 1fr; gap: 0; }
  #print .slip { border: 1.5px dashed #888; border-radius: 0; padding: 16px; page-break-inside: avoid; height: 130px; }
}
@media (max-width: 1000px) {
  .lay, .mark-lay, .work, .grid2, .grid3 { grid-template-columns: 1fr; }
  .work .brief, .mark-panel { position: static; max-height: none; }
  .login-wrap { grid-template-columns: 1fr; } .login-art { display: none; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .side .school, .nav-h, .side .me { display: none; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .main { padding: 18px 16px 50px; }
  .t-row { grid-template-columns: 1fr; }
  /* Phones: a compact top bar that never wraps words */
  .p-top .in { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .p-top nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .p-top nav a { white-space: nowrap; padding: 8px 12px; }
  .p-top .in > .small.muted { display: none; }
  .theme-btn #theme-l { display: none; }
  .p-main { padding: 18px 14px 50px; }
  .hello { padding: 20px; } .hello h1 { font-size: 26px; }
  /* Typing boxes at 16px stop iPhones zooming in when tapped */
  input, select, textarea, .editor textarea { font-size: 16px; }
  /* Thumb-sized taps */
  button.sm, .btn.sm { min-height: 36px; }
  .copy-btn { min-height: 32px; padding: 5px 10px; }
  .cell { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; }
  .quick button { min-height: 36px; }
  .check input { width: 22px; height: 22px; }
  .parsons li { padding: 6px 8px; }
  .parsons li pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .tabs button { padding: 10px 12px; font-size: 15px; flex: none; }
  .long { display: none; } .short { display: inline; }
  .parsons li button { min-width: 42px; min-height: 42px; font-size: 18px; border-radius: 10px; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .chart { height: 170px; } .chart text { font-size: 26px; }
  .tile .n { font-size: 28px; }
  td:first-child b, td:first-child .row { white-space: nowrap; }
  .page-h .actions { margin-left: 0; }
  .jump-code { display: inline-flex; margin-bottom: 12px; }
}
