/* Design tokens (update 12, docs/design-system.md). Every text colour is 4.5:1 or more on the ground it is used on;
   field borders and the focus ring are 3:1 or more. Use the tokens, not new hex values. */
:root {
  /* grounds and ink */
  --bg: #f4f6fb; --card: #ffffff; --surface-2: #f6f8ff; --ink: #1c2333; --muted: #5d667a; --line: #dfe3ee;
  --field-border: #8b93a7;            /* inputs and selects: 3.07:1 on white */
  --disabled-ink: #8a91a3;
  /* brand */
  --brand: #3b5bdb; --brand-dark: #2f49b0; --brand-tint: #eef1fb; --brand-tint-2: #dbe4ff; --brand-soft-line: #9db1ff;
  --focus: #3b5bdb;                   /* focus ring: 5.67:1 on white */
  /* status: ink on its own tint is 4.5:1 or more */
  --ok: #146c32; --ok-bg: #e6f6ec; --ok-line: #b6e2c3;            /* 5.82:1 */
  --bad: #c92a2a; --bad-bg: #fdeaea; --bad-line: #f3b8b8;         /* 4.71:1 */
  --warn: #8a5300; --warn-bg: #fff3dd; --warn-line: #f1d49b;      /* 5.76:1 */
  --notice-bg: #fff7d6; --notice-ink: #5a4300; --notice-line: #ecd98b;
  /* spacing, type, shape */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --text-xs: .8rem; --text-sm: .875rem; --text-md: 1rem; --text-lg: 1.25rem; --text-xl: 1.6rem;
  --radius-sm: 8px; --radius: 12px; --radius-lg: 16px; --radius-pill: 999px;
  --tap: 44px;                        /* smallest tap target */
  --gutter: 16px;                     /* page margin on phones */
  --shadow: 0 1px 3px rgba(20, 30, 60, .08), 0 6px 20px rgba(20, 30, 60, .06);   /* only for things that float */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
.hidden { display: none !important; }

.container { max-width: 880px; margin: 0 auto; padding: 16px; }
.container.narrow { max-width: 440px; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar .inner { max-width: 1000px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.2rem; color: var(--brand); letter-spacing: .3px; }
.spacer { flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 14px 0; }

.btn { font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; min-height: var(--tap); cursor: pointer; background: var(--brand); color: #fff; }
.btn:hover:not(:disabled) { background: var(--brand-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: var(--card); color: var(--brand); border-color: var(--field-border); }
.btn.ghost:hover:not(:disabled) { background: var(--brand-tint); }
.btn.danger { background: var(--bad); } .btn.danger:hover:not(:disabled) { background: #a61e1e; }
.btn.ghost.danger { background: var(--card); color: var(--bad); border-color: var(--bad-line); }
.btn.ok { background: var(--ok); }
.btn.small { padding: 6px 12px; font-size: .9rem; min-height: 40px; }
.btn.block { width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }

.field { margin: 0 0 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; font: inherit; padding: 10px 12px; min-height: var(--tap); border: 1px solid var(--field-border); border-radius: 10px; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
.hint { display: block; color: var(--muted); margin-top: 3px; }
.pw-row { display: flex; gap: 8px; align-items: stretch; }
.pw-row input { flex: 1; }
.toggle-pw { min-width: 68px; }
.checklist { list-style: none; padding: 0; margin: 8px 0 0; font-size: .9rem; }
.checklist li.ok { color: var(--ok); } .checklist li.todo { color: var(--muted); }
.error-box { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad-line); padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }
.info-box { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }
.success-box { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line); padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
.center { text-align: center; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; overflow-wrap: break-word; }
.badge { display: inline-block; padding: 2px 9px; border-radius: var(--radius-pill); font-size: .8rem; font-weight: 700; background: var(--brand-tint); color: var(--brand); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.warn { background: var(--warn-bg); color: var(--warn); }

/* tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.tab { min-height: var(--tap); white-space: nowrap; }
.tab { border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 600; color: var(--muted); }
.tab[aria-selected=true] { background: var(--brand); color: #fff; border-color: var(--brand); }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.table-wrap { overflow-x: auto; }

/* test screen */
.test-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.6rem; min-width: 4ch; }
.timer.low { color: var(--bad); }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.bar > i { display: block; height: 100%; background: var(--brand); width: 100%; transition: width .25s linear; }
.bar > i.low { background: var(--bad); }
.question { font-size: 1.15rem; font-weight: 600; margin: 8px 0 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.options { display: grid; gap: 10px; }
.option { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; padding: 12px 14px; border: 2px solid var(--line); background: #fff; border-radius: 12px; cursor: pointer; font: inherit; color: var(--ink); }
.option:hover:not(:disabled) { border-color: #9db1ff; }
.option:disabled { cursor: not-allowed; opacity: .7; }
.option .letter { font-weight: 800; color: var(--brand); min-width: 1.4em; }
.option .text { overflow-wrap: anywhere; white-space: pre-wrap; }
.option.selected { border-color: var(--brand); background: #eef1fb; }
.grid { display: flex; flex-wrap: wrap; gap: 6px; }
.qbtn { width: var(--tap); height: var(--tap); border-radius: 10px; border: 2px solid var(--line); background: #fff; font: inherit; font-weight: 700; cursor: pointer; color: var(--ink); }
.qbtn.answered { background: var(--brand-tint-2); border-color: var(--brand-soft-line); }
.qbtn.locked { background: #e9ebf0; color: #5d667a; text-decoration: line-through; }
.qbtn.current { outline: 3px solid var(--brand); outline-offset: 1px; }
.legend { font-size: .82rem; color: var(--muted); margin-top: 6px; }

/* results / review */
.score { font-size: 3rem; font-weight: 800; color: var(--brand); line-height: 1; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 14px 0; }
.stat { background: #f6f8ff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 1.5rem; }
.review-q { border-top: 2px solid var(--line); padding-top: 14px; margin-top: 18px; }
.review-q:first-of-type { border-top: 0; margin-top: 0; }
.ropt { display: flex; gap: 10px; padding: 8px 12px; border: 2px solid var(--line); border-radius: 10px; margin: 6px 0; }
.ropt.correct { border-color: var(--ok); background: var(--ok-bg); }
.ropt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.ropt .mark { margin-left: auto; font-weight: 700; font-size: .85rem; white-space: nowrap; }
.solution { background: #f6f8ff; border-left: 4px solid var(--brand); padding: 10px 12px; border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 8px; }

/* modal + toast */
.overlay { position: fixed; inset: 0; background: rgba(15, 20, 40, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
#toasts { position: fixed; left: 0; right: 0; bottom: 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; padding: 0 12px; }
.toast { background: #1c2333; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 520px; }
.toast.error { background: var(--bad); } .toast.success { background: var(--ok); }

/* Deterrents (a web page can never fully block screenshots; see README) */
.no-copy, .no-copy * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.noscript { padding: 20px; text-align: center; }
@media print { body * { display: none !important; } body::before { content: "Printing is disabled in EDeval. / L’impression est désactivée."; display: block; padding: 40px; } }
@media (max-width: 520px) { .container { padding: 10px var(--gutter) var(--gutter); } .card { padding: 14px; } .topbar .inner { padding-top: 6px; padding-bottom: 6px; } }
.container.wide { max-width: 980px; }
.flex1 { flex: 1; min-width: 150px; }
.flex1.wide-min { min-width: 200px; }
textarea.tall { min-height: 140px; }
.options { margin-bottom: 14px; }

/* modules, past papers, trial banner */
.banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn); border-radius: var(--radius); padding: 12px 16px; margin: 14px 0; }
.banner.ok { background: var(--ok-bg); border-color: #b6e2c3; color: var(--ok); }
.banner .grow { flex: 1; min-width: 200px; }
.pay-note { color: var(--muted); font-size: .85rem; margin: 6px 0 0; }
.mode-tabs { margin-top: 0; }
.paper-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 10px; }
.paper-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font: inherit; color: var(--ink); cursor: pointer; }
.paper-tile b { font-size: 1.05rem; }
.paper-tile small { font-size: .78rem; }
.paper-tile:hover:not(:disabled) { border-color: #9db1ff; background: #f6f8ff; }
.paper-tile:disabled { background: #f0f2f7; color: #8a91a3; cursor: not-allowed; }
.paper-tile.selected { border-color: var(--brand); background: #eef1fb; }
.paper-tile.complete { border-color: #b6e2c3; }
.paper-tile.complete.selected { border-color: var(--brand); }
.progress { display: block; width: 100%; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); }
.progress > i.full { background: var(--ok); }
.p0 { width: 0; } .p10 { width: 10%; } .p20 { width: 20%; } .p30 { width: 30%; } .p40 { width: 40%; } .p50 { width: 50%; }
.p60 { width: 60%; } .p70 { width: 70%; } .p80 { width: 80%; } .p90 { width: 90%; } .p100 { width: 100%; }
.module-row small { display: block; }
.inline-edit { background: #f6f8ff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 0 0 14px; }

.check { display: flex; gap: 10px; align-items: center; margin-top: 8px; min-height: var(--tap); cursor: pointer; }
.check input { width: 22px; height: 22px; min-height: 0; flex: none; accent-color: var(--brand); }

/* pictures in questions, options and solutions */
.pic { display: block; max-width: 100%; height: auto; margin: 10px 0; border-radius: 8px; background: #fff; border: 1px solid var(--line, #dfe3ee); }
.option .text .pic, .ropt .pic { max-height: 220px; width: auto; margin: 8px 0 0; }
.pic-field { border: 1px dashed var(--line, #dfe3ee); border-radius: 10px; padding: 10px; }
.pic-field:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.pic-preview .pic { max-height: 260px; width: auto; }
.pic-preview:empty { display: none; }

/* roles update: message bar, support threads, teacher screens */
.msgbar-wrap:empty { display: none; }
.msgbar { display: flex; gap: 10px; align-items: flex-start; background: var(--notice-bg); color: var(--notice-ink); border-bottom: 1px solid var(--notice-line); padding: 8px 16px; }
.msgbar-text { flex: 1; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 1000px; margin: 0 auto; }
.msgbar-x { background: none; border: 0; font-size: 1.3rem; line-height: 1; cursor: pointer; color: inherit; padding: 0; width: var(--tap); height: var(--tap); margin: -10px -12px -10px 0; flex: none; border-radius: var(--radius-sm); }
.count { display: inline-block; min-width: 1.4em; padding: 0 6px; border-radius: 999px; background: var(--bad); color: #fff; font-size: .75rem; font-weight: 700; text-align: center; }
.card.slim { padding: 10px 16px; }
.mini-select { width: auto; max-width: 100%; padding: 6px 8px; font-size: .9rem; min-height: 40px; }
.thread { margin: 10px 0 14px; display: grid; gap: 10px; }
.msg { background: #f6f8ff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; max-width: 92%; }
.msg.staff { background: var(--ok-bg); border-color: #b6e2c3; margin-left: auto; }
.msg-meta { font-size: .82rem; color: var(--muted); margin-bottom: 4px; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.browse-q { border-top: 2px solid var(--line); padding: 12px 0; }
.browse-q .question { margin: 6px 0 10px; }
.q-pick { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- update 5: chat, join code, PDF, payments */
.code-input { width: 100%; font: 800 1.8rem/1.2 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .35em; text-align: center; text-transform: uppercase; padding: 12px; border: 2px solid var(--field-border); border-radius: 12px; }
.join-code-card { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: var(--brand-tint); }
.join-code-card .grow { flex: 1; min-width: 200px; }
.join-code { font: 800 2.6rem/1.1 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .3em; color: var(--brand); margin-top: 2px; }
.chat .chat-state { font-size: .88rem; color: var(--muted); margin-bottom: 8px; }
.chat .chat-state.paused { color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 10px; padding: 8px 10px; }
.chat-list { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px 8px; }
.chat-msg { background: #f6f8ff; border: 1px solid var(--line); border-radius: 12px 12px 12px 4px; padding: 7px 11px; max-width: 85%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; background: #e3e9ff; border-color: #c4d0ff; border-radius: 12px 12px 4px 12px; }
.chat-msg.teacher { background: var(--ok-bg); border-color: #b6e2c3; }
.chat-meta { font-size: .78rem; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chat-meta b { color: var(--ink); }
.chat-tools { margin-left: auto; display: inline-flex; gap: 10px; }
.chat-tools .link { font-size: .78rem; }
.chat-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-form { display: flex; gap: 8px; margin-top: 6px; }
.chat-form input { flex: 1; }
.chat-count { display: block; text-align: right; margin-top: 2px; font-size: .75rem; }
.info-box.done, #b-summary.done { background: var(--ok-bg); color: var(--ok); border-color: #b6e2c3; }
.q-list-pick, #q-list .q-pick { flex: none; }

/* payments */
.pay-hero { background: var(--brand); color: #fff; border-radius: var(--radius); padding: 22px 20px 26px; margin: 14px 0; }
.pay-hero h1 { color: #fff; margin-top: 8px; } .pay-hero p { color: #e5e9ff; margin: 0; }
.link.light { color: #fff; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.plan { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 22px 12px 16px; border: 2px solid var(--line); border-radius: 16px; background: #fff; cursor: pointer; font: inherit; color: var(--ink); }
.plan.selected { border-color: var(--brand); background: var(--brand); color: #fff; box-shadow: 0 8px 22px rgba(59, 91, 219, .35); }
.plan.selected small { color: #dfe5ff; }
.plan-name { font-size: 1.05rem; }
.plan-price { font-size: 1.7rem; font-weight: 800; }
.plan-tag { position: absolute; top: -12px; background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); font-size: .8rem; font-weight: 800; padding: 2px 10px; border-radius: var(--radius-pill); white-space: nowrap; }
.benefits { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.benefits li { display: flex; gap: 10px; align-items: flex-start; }
.tick { flex: none; width: 24px; height: 24px; border-radius: 8px; background: #eef1fb; color: var(--brand); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.btn.big { padding: 14px 18px; font-size: 1.05rem; border-radius: 14px; }
.pay-plan-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 10px 0 14px; background: #f8f9ff; }
.pay-sum td { padding: 8px 4px; } .pay-sum td:last-child { text-align: right; font-weight: 600; }
.pay-sum tr.total td { font-size: 1.15rem; font-weight: 800; border-bottom: 0; } .pay-sum tr.total td:last-child { color: var(--brand); }
.pay-amount { text-align: center; margin-bottom: 18px; }
.pay-amount b { display: block; font-size: 2.4rem; color: var(--ok); line-height: 1.2; }
.methods { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.method { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 10px; border: 2px solid var(--line); border-radius: 16px; background: #fff; cursor: pointer; font: inherit; color: var(--ink); }
.method:hover { border-color: #9db1ff; }
.method.selected { border-color: var(--brand); box-shadow: 0 0 0 4px #dbe4ff; }
.method-logo { width: 96px; height: 72px; object-fit: contain; }
.method-fallback { width: 96px; height: 72px; border-radius: 12px; display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 800; font-size: .85rem; line-height: 1.15; padding: 6px; }
.method-fallback.mtn { background: #ffcc00; color: #1a1a1a; }
.method-fallback.orange { background: #111; color: #ff7900; }
.method-name { font-weight: 700; font-size: .85rem; letter-spacing: .04em; }
.method-check { position: absolute; top: 8px; right: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; display: none; align-items: center; justify-content: center; font-size: .85rem; }
.method.selected .method-check { display: inline-flex; }
.phone-row { display: flex; align-items: stretch; }
.phone-row .cc { display: flex; align-items: center; padding: 0 12px; background: var(--brand-tint); border: 1px solid var(--field-border); border-right: 0; border-radius: 10px 0 0 10px; font-weight: 700; color: var(--muted); }
.phone-row input { border-radius: 0 10px 10px 0; flex: 1; font-size: 1.1rem; letter-spacing: .05em; }
.center-row { justify-content: center; }
.phone-pulse { width: 96px; height: 96px; margin: 6px auto 14px; border-radius: 50%; background: #eef1fb; display: flex; align-items: center; justify-content: center; font-size: 2.6rem; }
.check-anim { width: 96px; height: 96px; margin: 6px auto 14px; border-radius: 50%; background: var(--ok); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 3rem; font-weight: 800; }

/* skeleton loading */
.skeleton { display: grid; gap: 10px; padding: 6px 0; }
.sk-line { display: block; height: 14px; border-radius: 8px; background: #e9ecf4; }
.sk-0 { width: 92%; } .sk-1 { width: 70%; } .sk-2 { width: 82%; }

/* ranking medals */
tr.medal td:first-child { font-weight: 800; }
tr.medal.m1 td:first-child::before { content: "🥇 "; } tr.medal.m2 td:first-child::before { content: "🥈 "; } tr.medal.m3 td:first-child::before { content: "🥉 "; }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 70; }
.cf { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; opacity: .95; }
.cf.c0 { background: #3b5bdb; } .cf.c1 { background: #f08c00; } .cf.c2 { background: #2f9e44; } .cf.c3 { background: #e64980; } .cf.c4 { background: #fab005; } .cf.c5 { background: #15aabf; }
.cf.x0 { left: 4%; } .cf.x1 { left: 12%; } .cf.x2 { left: 20%; } .cf.x3 { left: 28%; } .cf.x4 { left: 36%; } .cf.x5 { left: 44%; }
.cf.x6 { left: 52%; } .cf.x7 { left: 60%; } .cf.x8 { left: 68%; } .cf.x9 { left: 76%; } .cf.x10 { left: 84%; } .cf.x11 { left: 92%; }

/* ---------------------------------------------------------------- animations */
@media (prefers-reduced-motion: no-preference) {
  @keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
  @keyframes popIn { 0% { opacity: 0; transform: scale(.92); } 70% { transform: scale(1.03); } 100% { opacity: 1; transform: none; } }
  @keyframes slideL { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
  @keyframes slideR { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }
  @keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
  @keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(59, 91, 219, .35); } 100% { box-shadow: 0 0 0 22px rgba(59, 91, 219, 0); } }
  @keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
  @keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
  @keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }
  @keyframes shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
  @keyframes fall { 0% { transform: translateY(-20px) rotate(0); } 100% { transform: translateY(105vh) rotate(720deg); } }
  @keyframes glow { 0%, 100% { text-shadow: none; } 50% { text-shadow: 0 0 16px rgba(59, 91, 219, .45); } }
  @keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.08); color: var(--brand); } 100% { transform: scale(1); } }
  @keyframes draw { from { transform: scale(0) rotate(-30deg); } to { transform: scale(1) rotate(0); } }

  .container > div > .card, .container > .card, .container > div > h1, .pay-hero { animation: fadeUp .32s ease-out both; }
  .container > div > .card:nth-of-type(2) { animation-delay: .04s; } .container > div > .card:nth-of-type(3) { animation-delay: .08s; }
  .container > div > .card:nth-of-type(4) { animation-delay: .12s; }
  .overlay { animation: fadeIn .18s ease-out; }
  .modal { animation: popIn .24s ease-out; }
  .toast { animation: toastIn .22s ease-out; } .toast.leaving { animation: toastOut .22s ease-in forwards; }
  .btn, .tab, .option, .plan, .method, .paper-tile { transition: transform .12s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease; }
  .btn:hover:not(:disabled), .plan:hover, .method:hover, .paper-tile:hover:not(:disabled) { transform: translateY(-1px); }
  .btn:active:not(:disabled), .option:active:not(:disabled), .plan:active, .method:active { transform: scale(.97); }
  .option.selected { animation: popIn .22s ease-out; }
  .option.selected .letter { animation: bump .3s ease-out; }
  .q-card.from-right { animation: slideL .25s ease-out; } .q-card.from-left { animation: slideR .25s ease-out; }
  .timer.low { animation: pulse .9s ease-in-out 3; }
  .score { animation: popIn .45s ease-out; }
  .result-card .stat { animation: fadeUp .35s ease-out both; } .result-card .stat:nth-child(2) { animation-delay: .1s; } .result-card .stat:nth-child(3) { animation-delay: .2s; }
  .list li.pop { animation: popIn .4s ease-out; background: #f1fbf4; }
  .join-code { animation: glow 2.4s ease-in-out 3; }
  #room-info.bump { animation: bump .45s ease-out; }
  .chat-msg.fresh { animation: fadeUp .25s ease-out; }
  .rank-rows tr { animation: fadeUp .35s ease-out both; }
  .rank-rows tr:nth-child(1) { animation-delay: .05s; } .rank-rows tr:nth-child(2) { animation-delay: .15s; } .rank-rows tr:nth-child(3) { animation-delay: .25s; }
  .rank-rows tr:nth-child(4) { animation-delay: .35s; } .rank-rows tr:nth-child(n+5) { animation-delay: .45s; }
  .shake { animation: shake .4s ease-in-out; }
  .phone-pulse { animation: ring 1.4s ease-out 4; } .phone-pulse span { animation: pulse 1.4s ease-in-out 4; display: inline-block; }
  .check-anim { animation: popIn .5s ease-out; } .check-anim span { animation: draw .45s .2s ease-out both; display: inline-block; }
  .cf { animation: fall 2.6s linear forwards; }
  .cf.d1 { animation-duration: 2.2s; animation-delay: .1s; } .cf.d2 { animation-duration: 2.9s; animation-delay: .2s; } .cf.d3 { animation-duration: 2.4s; animation-delay: .35s; }
  .msgbar { animation: fadeIn .3s ease-out; }
  .plan.selected { transition: transform .15s ease, box-shadow .2s ease; transform: translateY(-2px); }
  .method.selected .method-check { animation: popIn .25s ease-out; }
  .phone-box:not(.hidden) { animation: fadeUp .25s ease-out; }
}
@media (max-width: 520px) { .join-code { font-size: 2rem; } .pay-amount b { font-size: 2rem; } .plan-price { font-size: 1.4rem; } }
.row > .grow { flex: 1; min-width: 0; }
.chat h2 { margin: 0; }
.filters { margin: 6px 0 12px; }
.filters .mini-select { width: auto; min-width: 140px; }
#pf-search { flex: 1; min-width: 180px; }
#pay-stats .stat b { font-size: 1.3rem; }

/* ---------------------------------------------------------------- update 6 */
/* copy protection for the whole site: text cannot be selected, except where people type */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, select, [contenteditable], .allow-copy { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
img { -webkit-user-drag: none; }

/* EN | FR switch */
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--card); }
.lang-btn { font: inherit; font-size: .85rem; font-weight: 700; border: 0; background: transparent; color: var(--muted); padding: 4px 12px; min-width: var(--tap); min-height: 40px; cursor: pointer; }
.lang-btn[aria-pressed="true"] { background: var(--brand); color: #fff; }
.lang-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 4px; }

/* sub-system switch (admin) */
.sub-row { margin: 4px 0 2px; }
.sub-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.sub-btn { font: inherit; font-weight: 600; border: 0; background: var(--card); color: var(--ink); padding: 6px 14px; min-height: var(--tap); cursor: pointer; }
.sub-btn[aria-pressed="true"] { background: #e8edff; color: var(--brand); box-shadow: inset 0 -3px 0 var(--brand); }
.series-boxes { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.series-boxes .check { margin: 0; font-weight: 600; }

/* pictures of people */
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: #e3e8fb; color: var(--brand); font-weight: 800; font-size: .85rem; overflow: hidden; vertical-align: middle; }
.avatar img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.avatar.xs { width: 22px; height: 22px; font-size: .62rem; }
.avatar.sm { width: 30px; height: 30px; font-size: .72rem; }
.avatar.md { width: 44px; height: 44px; }
.avatar.lg { width: 96px; height: 96px; font-size: 1.8rem; }
.who { display: inline-flex; align-items: center; gap: 8px; }
.me-btn { font: inherit; display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; background: transparent; border-radius: 999px; padding: 2px 10px 2px 2px; min-height: var(--tap); min-width: var(--tap); cursor: pointer; color: var(--ink); }
.me-btn:hover:not(:disabled) { background: #eef1fb; border-color: var(--line); }
.me-btn:disabled { cursor: default; }
.me-name { font-size: .9rem; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-teacher { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.chat-meta .avatar { margin-right: 6px; }
.list li .avatar { margin-right: 4px; }

/* My profile */
.prof-head { align-items: center; gap: 16px; margin-bottom: 8px; }
.prof-name { font-size: 1.15rem; }
.small-print { font-size: .85rem; }
.locked-table { width: 100%; border-collapse: collapse; }
.locked-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 8px 10px 8px 0; width: 40%; border-bottom: 1px solid var(--line); }
.locked-table td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.locked-table td::after { content: "  🔒"; opacity: .5; font-size: .8rem; }

/* login */
.check.remember { margin-top: 2px; }
.remember-hint { display: block; margin: -4px 0 12px; }
.captcha { margin: 6px 0 12px; min-height: 65px; }
/* the robot trap: off screen, invisible to people and screen readers */
.hp-wrap { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* watermark over the test and review screens */
.watermark { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; display: flex; flex-wrap: wrap; align-content: space-around;
  justify-content: space-around; gap: 60px 40px; padding: 40px; transform: rotate(-24deg) scale(1.4); opacity: .07; }
.watermark span { font-weight: 700; font-size: 1.05rem; color: #1c2333; white-space: nowrap; }

@media (max-width: 640px) {
  .me-name { display: none; }
  .topbar .inner { gap: 8px; }
}

/* ---- update 7: past-paper sets and the PDF viewer ---- */
.set-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 10px 0; background: var(--card); }
.set-card h3 { margin: 0; font-size: 1.02rem; }
.set-card.locked { opacity: .65; }
.paper-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.set-card .row + .paper-row { margin-top: 8px; }
.hint-line { display: block; padding: 0 0 6px; }
.pdf-bar { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin: 12px 0; }
.pdf-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-wrap { position: relative; }
.pdf-stage { display: flex; flex-direction: column; align-items: center; gap: 14px; overflow-x: auto; padding-bottom: 30px; }
.pdf-page { position: relative; min-height: 200px; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 4px; }
.pdf-canvas { display: block; max-width: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; pointer-events: none; }
.pdf-pno { margin-top: 4px; }
@media print { .pdf-stage, .pdf-wrap { display: none !important; } }
/* admin: past papers tab */
.pp-set { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 8px 0; }
.pp-set .row { flex-wrap: wrap; }
.pp-file { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 0; border-top: 1px dashed var(--line); }
.pp-file .grow { min-width: 160px; }
.pp-label { max-width: 220px; }
.captcha-note { color: var(--bad); background: var(--bad-bg); border-radius: 8px; padding: 8px 10px; margin: 6px 0; font-size: .92rem; }
.captcha .btn.small { margin-top: 2px; }

/* ---- update 8 ---- */
/* never wider than the screen (no sideways scrolling on phones) */
html { overflow-x: hidden; }
body { max-width: 100%; overflow-x: clip; }
img, canvas, video, table { max-width: 100%; }
.question, .option .text, .msgbar-text, .pdf-title, .msg-body, .chat-body, .solution { overflow-wrap: anywhere; word-break: normal; }
.card, .list li, h1, h2, h3, p, small { overflow-wrap: break-word; word-break: normal; }
.list li { min-width: 0; }
.list li .grow { min-width: 0; }
.row > * { min-width: 0; }
.table-wrap { overflow-x: auto; max-width: 100%; }

/* top bar: menu folds into ☰ on phones */
.nav-items { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.burger { display: none; width: var(--tap); height: var(--tap); border: 1px solid var(--line); background: var(--card); border-radius: 10px; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0; }
.burger span { display: block; width: 20px; height: 2px; background: var(--ink); border-radius: 2px; }
@media (max-width: 720px) {
  .burger { display: inline-flex; }
  .nav-items { display: none; width: 100%; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 0 4px; }
  .nav-items.open { display: flex; }
  .nav-items .btn { width: 100%; min-height: 44px; text-align: left; }
  .nav-items .lang-switch { align-self: flex-start; }
}

/* previous / next page arrows, back to top, footer */
.page-arrows { max-width: 880px; margin: 8px auto 0; padding: 0 var(--gutter); display: flex; justify-content: space-between; gap: 8px; }
.arrow-btn { text-decoration: none; font-weight: 600; font-size: .92rem; padding: 6px 2px; min-height: var(--tap); }
.arrow-btn:disabled { color: var(--disabled-ink); cursor: default; }
.to-top { position: fixed; right: 16px; bottom: 18px; z-index: 30; width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: var(--brand); color: #fff; font-size: 1.3rem; font-weight: 800; box-shadow: var(--shadow); cursor: pointer; }
.site-footer { max-width: 880px; margin: 26px auto 0; padding: 18px var(--gutter) 70px; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: .9rem; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 6px; }
.foot-link { color: var(--muted); text-decoration: none; min-height: var(--tap); display: inline-flex; align-items: center; }
.foot-link:hover { color: var(--brand); text-decoration: underline; }
.info-page section { margin-top: 14px; }
.info-page h2 { font-size: 1.08rem; }
.container.wide-text { max-width: 720px; }

/* student home tabs and results */
.home-tabs { position: sticky; top: 0; z-index: 4; background: var(--bg); padding: 8px 0; margin: 8px 0 4px; }
.home-tabs .tab { flex: 1 1 auto; text-align: center; min-height: 44px; }
.tab-intro { margin: 6px 2px 0; }
.subject-avgs { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.avg-chip { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; min-width: 120px; background: #f8f9fd; }
.avg-chip b { font-size: 1.3rem; color: var(--brand); }
.avg-chip small { color: var(--muted); }
.btn.dl { background: var(--ok-bg); color: var(--ok); border-color: #bfe3cb; }
.btn.dl:hover:not(:disabled) { background: #d4f0de; }

/* the test: one clock, thin bar at the top, grid folds on phones */
.test-sticky { position: sticky; top: 0; z-index: 8; display: flex; align-items: center; gap: 10px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; margin: 8px 0; box-shadow: var(--shadow); }
.test-sticky .timer { font-size: 1.25rem; }
.sticky-q { font-weight: 700; font-size: .95rem; }
.timer.orange { color: var(--warn); }
.timer.red { color: var(--bad); }
.bar > i.orange { background: var(--warn); }
.bar > i.red { background: var(--bad); }
.q-card { scroll-margin-top: 70px; }
.q-num { font-size: 1.1rem; }
.qbtn.flag { position: relative; }
.qbtn.flag::after { content: "⚑"; position: absolute; top: -8px; right: -6px; font-size: .8rem; color: var(--warn); }
.btn.flagged { border-color: var(--warn); color: var(--warn); }
.grid-toggle { display: none; width: 100%; min-height: 44px; font: inherit; font-weight: 700; background: #eef1fb; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; color: var(--ink); }
.test-nav .btn { min-height: 44px; }
@media (max-width: 640px) {
  .grid-toggle { display: block; }
  .grid-card .grid, .grid-card .legend, .grid-card .grid-title { display: none; }
  .grid-card.open .grid, .grid-card.open .legend { display: flex; margin-top: 10px; }
  .grid-card.open .legend { display: block; }
  .test-nav { gap: 6px; }
  .test-nav .btn { flex: 1 1 45%; padding: 10px 8px; }
  .test-nav .spacer { display: none; }
  .option { min-height: 48px; }
  .question { font-size: 1.05rem; }
}

/* phones: buttons easy to tap, text never too small, forms one column */
@media (max-width: 520px) {
  .btn { min-height: 44px; }
  .btn.small { min-height: 38px; }
  .row { flex-wrap: wrap; }
  .flex1 { flex: 1 1 100%; }
  input, select, textarea { font-size: 16px; }         /* no zoom-in on iPhone */
  small, .muted { font-size: .9rem; }
  .paper-row .btn { flex: 1 1 auto; }
  h1 { font-size: 1.4rem; }
}

/* admin: dashboard, people menu, settings */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0; }
.stat-tile { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #f8f9fd; }
.stat-tile b { display: block; font-size: 1.6rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-tile span { color: var(--muted); font-size: .9rem; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr 54px; gap: 8px; align-items: center; font-size: .92rem; }
.bar-row .track { height: 14px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar-row .fill { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.bar-row .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.rank-list { counter-reset: r; padding-left: 0; list-style: none; margin: 0; }
.rank-list li { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.rank-list li::before { counter-increment: r; content: counter(r); width: 26px; height: 26px; border-radius: 50%; background: #eef1fb; color: var(--brand);
  font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .dash-cols { grid-template-columns: 1fr; } }
.more-wrap { position: relative; }
.more-btn { min-width: 44px; font-size: 1.2rem; line-height: 1; }
.more-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 210px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; }
.more-menu button { text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 8px; font: inherit; cursor: pointer; color: var(--ink); min-height: var(--tap); }
.more-menu button:hover { background: #eef1fb; }
.more-menu button.danger { color: var(--bad); }
.person-row { display: flex; gap: 10px; align-items: center; }
.person-row .grow { min-width: 0; }
.person-row small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.alert-bar { display: flex; gap: 10px; align-items: center; background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); border-radius: 12px; padding: 10px 14px; margin: 10px 0; font-weight: 600; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.switch-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.switch-row .grow { min-width: 0; }
/* chat: replies */
.chat-quote { display: block; border-left: 3px solid var(--brand); background: #eef1fb; padding: 3px 8px; border-radius: 6px; margin: 2px 0 4px; font-size: .82rem; color: var(--muted); cursor: pointer; text-align: left; border-top: 0; border-right: 0; border-bottom: 0; font-family: inherit; }
.chat-reply-btn { font-size: .78rem; }
.reply-box { display: flex; gap: 8px; align-items: center; background: #eef1fb; border-radius: 8px; padding: 4px 8px; margin-bottom: 6px; font-size: .85rem; }
.reply-box .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-msg.hl { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 8px; }
/* 404 page */
.not-found { margin-top: 30px; }
.nf-code { font-size: 4rem; font-weight: 800; color: var(--brand); line-height: 1; margin-bottom: 8px; }
.not-found a.btn { display: inline-block; text-decoration: none; }
.not-found hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

/* update 11: sign-up required fields and the new-account button */
.req-star { color: var(--bad); font-weight: 800; }
.req-note { font-size: .92rem; color: var(--ink); background: #f7f8fc; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.field.required > label { font-weight: 800; }
.field.required input[type=text], .field.required input[type=email], .field.required input[type=password], .field.required select {
  border: 2px solid #8f9bc0;
}
.field.required.empty input[type=text], .field.required.empty input[type=email], .field.required.empty input[type=password], .field.required.empty select {
  background: #fffbe8;
}
.field.required.missing input[type=text], .field.required.missing input[type=email], .field.required.missing input[type=password], .field.required.missing select {
  border-color: var(--bad); background: var(--bad-bg); box-shadow: 0 0 0 3px rgba(201, 42, 42, .18);
}
.field-msg { display: block; color: var(--bad); font-weight: 700; margin-top: 4px; }
.new-account { margin: 22px 0 6px; padding-top: 16px; border-top: 1px solid var(--line); }
.btn.new-account-btn { background: var(--ok); font-size: 1.02rem; padding: 14px 14px; letter-spacing: .2px; line-height: 1.3; white-space: normal; }
.btn.new-account-btn:hover:not(:disabled) { background: #0f5a29; }

/* ---------------------------------------------------------------- update 12: design foundations (docs/design-system.md) */
/* rows never squeeze their text column to a few letters: the text keeps about 9rem and the buttons move to the next line */
.row > .grow { min-width: min(9rem, 100%); }
.row > h1, .row > h2, .row > h3 { min-width: auto; }
@media (max-width: 720px) {
  .list li { flex-wrap: wrap; }
  .list li > .grow { min-width: min(9rem, 100%); }
  /* many tabs (admin, teacher): one row that scrolls sideways inside itself, never the page */
  .tabs:not(.home-tabs) { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin;
    padding-bottom: 6px; margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter); }
  .tabs:not(.home-tabs) > .tab { flex: none; }
  /* the student's three tabs always fit: equal parts, a long French label may take two lines */
  .home-tabs { display: grid; grid-template-columns: repeat(3, 1fr); }
  .home-tabs .tab { white-space: normal; padding: 6px 6px; line-height: 1.2; font-size: .92rem; }
}

/* ---------------------------------------------------------------- update 13: taking a test */
/* "No internet" bar: fixed at the bottom so nothing on the page moves when it appears */
.net-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: var(--ink); color: #fff; padding: 12px var(--gutter);
  text-align: center; font-weight: 600; }
.net-bar.hidden { display: none; }
/* the thin bar at the top of a test: "3/10", time, Finish on one line, even in French on a 360 px phone */
.test-sticky .sticky-q { font-variant-numeric: tabular-nums; white-space: nowrap; }
.test-sticky .btn { white-space: nowrap; min-height: var(--tap); }
.test-sticky { padding-top: 3px; padding-bottom: 3px; }   /* 44 px Finish button, same bar height as before */
.test-sticky .unsaved { font-size: var(--text-xs); font-weight: 700; color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn-line);
  border-radius: var(--radius-pill); padding: 2px 8px; white-space: nowrap; }

/* ---- update 15: results page (journey B) ---- */
.result-pct { margin: 6px 0 0; font-size: var(--text-lg); }
.result-advice { margin: 4px auto 0; max-width: 34em; font-weight: 600; color: var(--ink); }
.result-advice.band-high { color: var(--ok); }
.result-actions { justify-content: center; }
.result-card .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }   /* one row of three, also on phones */
@media (max-width: 520px) { .result-actions .btn { flex: 1 1 100%; } }   /* one button per line on phones, Try again first */

/* ---- update 11.2 merged in update 15: app download page (/app) and its links ----
   (Phase 2 tokens: --surface-2 for the tip box; the login link is a 44 px target) */
.app-page .container { padding-bottom: 30px; }
.app-hero h1 { font-size: 1.45rem; line-height: 1.25; margin: 4px 0 8px; }
.app-hero h2 { font-size: 1.08rem; margin: 22px 0 8px; }
.btn.app-dl-btn { display: block; text-align: center; text-decoration: none; font-size: 1.1rem; padding: 15px 14px; margin-top: 14px; }
.app-meta { text-align: center; color: var(--muted); font-size: .9rem; margin: 8px 0 0; }
.app-steps { padding-left: 1.3em; margin: 0; }
.app-steps li { margin: 0 0 10px; line-height: 1.45; }
.app-tip { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: .95rem; }
.app-qr { display: flex; gap: 16px; align-items: center; margin-top: 20px; }
.app-qr img { width: 150px; height: 150px; flex: none; border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: #fff; }
.app-qr p { margin: 0; font-size: .95rem; line-height: 1.45; }
.app-safe { margin-top: 6px; }
.app-sha { word-break: break-all; font-size: .8rem; }
.app-page .small { font-size: .85rem; }
.app-page .card + .card { margin-top: 16px; }
@media (max-width: 420px) { .app-qr { flex-direction: column; text-align: center; } .app-qr img { width: 170px; height: 170px; } }
.app-link { display: flex; align-items: center; justify-content: center; min-height: var(--tap); text-align: center; margin-top: 8px; font-weight: 700; }
.card.app-promo { display: flex; flex-direction: column; gap: 3px; margin-top: 18px; text-decoration: none; color: var(--ink); border-left: 5px solid var(--ok); }
.card.app-promo:hover, .card.app-promo:focus-visible { border-color: var(--brand); }
#nav-app { text-decoration: none; }

/* update 16: the subjects a Sixth Form student offers (tick boxes, 2 to 5) */
.subject-boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 16px; }
.subject-boxes .check { display: flex; font-weight: 400; margin: 4px 0 0; overflow-wrap: anywhere; }
fieldset.subject-field { border: 0; padding: 0; min-width: 0; }
fieldset.subject-field legend { font-weight: 800; padding: 0; margin-bottom: 4px; }
fieldset.subject-field.missing .subject-boxes { outline: 2px solid var(--bad, #b42318); outline-offset: 4px; border-radius: 8px; }
.subject-boxes .check:has(input:disabled) { opacity: .6; cursor: not-allowed; }
.notes-list { list-style: none; margin: 0; padding: 0; }
.notes-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.notes-row:first-child { border-top: 0; }
.list li.module-row { flex-wrap: wrap; }
.module-row .grow { flex-basis: 12rem; }

/* update 16: the page search engines read before the app starts */
.seo-home { padding-top: 24px; padding-bottom: 24px; }
.seo-home ul { padding-left: 1.2em; }
.about-edeval { margin: 18px 4px 8px; color: var(--muted); font-size: .92rem; }
.about-edeval h2 { font-size: 1rem; margin: 0 0 4px; color: var(--ink); }

/* update 17: subject groups */
.subject-name { display: inline-flex; flex-direction: column; }
.subject-name .subject-parts { display: block; font-size: .85rem; line-height: 1.35; }
.group-form-title { margin-top: 1.5rem; }

/* update 18: question picker settings and the module difficulty tool */
.rule-check { align-items: flex-start; }
.rule-check input { margin-top: 2px; }
.module-level { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.module-level select { width: auto; flex: 0 1 220px; min-width: 160px; }
