:root {
  --bg: #f4f6f9; --card: #fff; --ink: #1c2430; --muted: #5d6b7c; --line: #dde3ea;
  --accent: #1f5fbf; --accent-ink: #fff; --ok: #1d7a46; --warn: #a96500; --err: #b42318;
  --code-bg: #0f1720; --code-ink: #e6edf3;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { margin: 0 auto; padding: 16px; }
main.narrow { max-width: 460px; padding-top: 12vh; }
main.wide { max-width: 860px; }
h1 { font-size: 1.45rem; margin: .1em 0 .2em; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 1.6em 0 .6em; }
a { color: var(--accent); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #eef1f5; padding: 0 .3em; border-radius: 4px; font-size: .92em; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin: 12px 0; }
.center { text-align: center; }
.kicker { text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); font-size: .92rem; }
.error { color: var(--err); font-weight: 600; }
.login form { display: grid; gap: 10px; margin-top: 18px; text-align: left; }
.login input { font-size: 1.3rem; letter-spacing: .15em; text-align: center; text-transform: uppercase; }

input[type=text], input:not([type]), textarea {
  width: 100%; font: inherit; color: inherit; background: #fbfcfd;
  border: 1px solid #c5cfda; border-radius: 8px; padding: 10px 12px;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; background: #fff; }
textarea { resize: vertical; min-height: 90px; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; line-height: 1.5; background: var(--code-bg); color: var(--code-ink); border-color: #2a3644; tab-size: 4; white-space: pre; overflow-x: auto; }
textarea:disabled, input:disabled { opacity: .75; cursor: not-allowed; }

button { font: inherit; border: 1px solid #c5cfda; background: #fff; color: var(--ink); border-radius: 8px; padding: 10px 16px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { border: 0; background: none; color: var(--err); padding: 0 4px; font-size: .88rem; text-decoration: underline; }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; background: var(--bg); padding: 10px 0; border-bottom: 1px solid var(--line); }
.who { color: var(--muted); font-size: .9rem; }
.status { text-align: right; flex-shrink: 0; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.05rem; background: #e8eef8; color: var(--accent); padding: 4px 10px; border-radius: 6px; display: inline-block; }
.timer.soon { background: #fff2dc; color: var(--warn); }
.timer.late { background: #fde7e5; color: var(--err); }
.savestate { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.savestate.ok { color: var(--ok); } .savestate.warn { color: var(--warn); } .savestate.err { color: var(--err); font-weight: 600; }

.consignes p { margin: 0; }
.card > h2:first-child { margin-top: 0; }
.qhead { display: flex; justify-content: space-between; margin-bottom: 6px; }
.qid { font-weight: 700; color: var(--accent); }
.pts { font-size: .85rem; color: var(--muted); }
.enonce { margin-bottom: 10px; }
.nocopy { -webkit-user-select: none; user-select: none; }
pre.context { background: #eef1f5; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-x: auto; font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; margin: 0 0 12px; }
.qimg { max-width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--line); margin-bottom: 10px; }
.choices { display: grid; gap: 6px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.choice:hover { border-color: #b4c3d6; }
.choice input { margin-top: .3em; width: 18px; height: 18px; flex-shrink: 0; }
.choice:has(input:checked) { border-color: var(--accent); background: #eef4fd; }
.hint { font-size: .82rem; color: var(--muted); margin: 6px 0 0; }
.codewrap { position: relative; }
.codewrap .lang { position: absolute; right: 10px; top: 6px; font-size: .72rem; color: #8b98a8; text-transform: uppercase; pointer-events: none; }
.filelist { list-style: none; padding: 0; margin: 0 0 8px; }
.filelist li { padding: 6px 10px; background: #f2f7f3; border: 1px solid #cfe3d5; border-radius: 6px; margin-bottom: 4px; font-family: ui-monospace, Menlo, monospace; font-size: .88rem; display: flex; justify-content: space-between; align-items: center; gap: 8px; word-break: break-all; }
.filebtn { display: inline-block; border: 1px dashed #9fb0c4; border-radius: 8px; padding: 8px 14px; cursor: pointer; color: var(--accent); font-weight: 600; }
.filebtn input { display: none; }
.actions { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; box-shadow: 0 -4px 16px rgba(20,30,50,.06); }
.actions p { margin: 0; flex: 1 1 260px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.modal { position: fixed; inset: 0; background: rgba(15,23,32,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.modal[hidden] { display: none; }
.modalbox { background: #fff; border-radius: 12px; padding: 20px; max-width: 440px; width: 100%; }
.modalbox .btns { justify-content: flex-end; margin-top: 14px; }
@media (max-width: 600px) {
  .topbar { position: static; padding-right: 120px; }
  .status { position: fixed; top: 8px; right: 8px; z-index: 6; background: var(--bg); padding: 4px 6px; border-radius: 8px; box-shadow: 0 2px 8px rgba(20,30,50,.12); }
  .timer { font-size: .9rem; }
  .actions { position: static; }
  h1 { font-size: 1.25rem; }
}
@media print { .topbar, .actions { position: static; } .btns, .filebtn { display: none; } }
table.suivi { width: 100%; border-collapse: collapse; font-size: .9rem; }
.suivi th, .suivi td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.suivi th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.suivi tr.absent td { color: #9aa6b4; }
.suivi td.flag { color: var(--err); font-weight: 700; }
.scrollx { overflow-x: auto; }
