/* DELF/DALF practice tests: website and app. Plum, cream, lilac and sky; every text/ground pair used is ≥ 5.9:1
   in light and dark mode. A full-width web page: a sticky header with the navigation, the content across the
   window, a footer. Mobile first: one column, then two from 760px, and documents beside their questions from 1100px. */

:root {
  --plum: #69073a; --plum-deep: #3a0420; --cream: #fff9cb; --lilac: #f0c4ff; --sky: #e0efff;
  --page: var(--sky); --card: #ffffff; --soft: #f4ecf6; --field: #faf5f8;
  --text: var(--plum-deep); --muted: #6b3a55; --line: #ead9e4; --line-strong: #cfaec2;
  --accent: var(--plum); --accent-hover: #4d052a; --on-accent: var(--cream); --accent-soft: var(--lilac); --accent-text: var(--plum);
  --tint-1: var(--cream); --tint-2: var(--lilac);
  --ok: #15803d; --ok-bg: #f0fdf4; --ok-text: #166534;
  --bad: #dc2626; --bad-bg: #fef2f2; --bad-text: #b91c1c;
  --wait: #d97706; --wait-bg: #fffbeb; --wait-text: #92400e;
  --gutter: clamp(16px, 4vw, 56px);
  --radius: 22px; --sans: 'Instrument Sans', system-ui, -apple-system, sans-serif; --display: 'Unbounded', 'Instrument Sans', sans-serif;
  color-scheme: light;
}
:root.dark {
  --page: #160510; --card: #26101d; --soft: #331626; --field: #1d0c16;
  --text: #fdeef8; --muted: #d9b7cc; --line: #44203a; --line-strong: #6a3a5a;
  --accent: var(--lilac); --accent-hover: #e2a8f7; --on-accent: var(--plum-deep); --accent-soft: #4a1d3c; --accent-text: var(--lilac);
  --tint-1: #3d3415; --tint-2: #4a1d3c;
  --ok: #4ade80; --ok-bg: #052e16; --ok-text: #86efac;
  --bad: #f87171; --bad-bg: #450a0a; --bad-text: #fca5a5;
  --wait: #fbbf24; --wait-bg: #451a03; --wait-text: #fcd34d;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--text); font: 16px/1.6 var(--sans); min-height: 100vh;
       padding-bottom: env(safe-area-inset-bottom); display: flex; flex-direction: column; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.02em; line-height: 1.15; margin: 0 0 6px; }
h1 { font-size: 22px; } h2 { font-size: 22px; } h3 { font-size: 19px; }
p { margin: 4px 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
main:focus, main:focus-visible { outline: none; }  /* focused on each screen change, for screen readers only */
.muted { color: var(--muted); font-size: 14px; }
.warn { color: var(--wait-text); font-size: 14px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 10px; z-index: 50; }
.skip:focus { left: 8px; }
main { width: 100%; flex: 1; padding: 24px var(--gutter) 120px; display: flex; flex-direction: column; gap: 20px; outline: 0; }
.loading { text-align: center; color: var(--muted); padding: 48px 0; }

/* ---------- top bar */
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px 28px;
          padding: calc(12px + env(safe-area-inset-top)) var(--gutter) 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.mainnav { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.mainnav a { padding: 8px 14px; border-radius: 10px; text-decoration: none; font-weight: 600; font-size: 15px; white-space: nowrap; color: var(--muted); }
.mainnav a:hover { color: var(--text); background: var(--soft); }
.mainnav a[aria-current] { color: var(--accent-text); background: var(--accent-soft); }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; padding: 20px var(--gutter) calc(20px + env(safe-area-inset-bottom));
          border-top: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 13px; }
.pagehead { display: flex; flex-direction: column; gap: 4px; padding: 4px 0 4px; }
.pagehead h1 { font-size: clamp(26px, 3.2vw, 38px); font-weight: 800; letter-spacing: -.03em; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; flex: none; background: var(--accent);
        color: var(--on-accent); font: 700 15px var(--display); }
.brand-t { display: flex; flex-direction: column; line-height: 1.2; }
.brand-t b { font: 700 17px var(--display); letter-spacing: -.02em; }
.brand-t small { color: var(--muted); font-size: 13px; }
.tools { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--card); cursor: pointer; }
.banner { margin: 0; padding: 10px 16px; border-radius: 14px; background: var(--wait-bg); color: var(--wait-text); font-size: 14px; }

/* ---------- buttons, chips, fields */
.btn, .pill { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; text-decoration: none;
              background: var(--accent); color: var(--on-accent); border-radius: 14px; padding: 12px 18px; font-weight: 600; min-height: 44px; }
.btn:hover, .pill:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--big { width: 100%; min-height: 56px; font: 600 18px var(--display); letter-spacing: -.01em; }
.btn--ghost, .pill--ghost { background: var(--card); color: var(--text); border: 1.5px solid var(--line-strong); }
.btn--ghost:hover, .pill--ghost:hover { background: var(--card); border-color: var(--accent); color: var(--accent-text); }
.pill { border-radius: 999px; padding: 8px 16px; min-height: 40px; }
.chip { display: inline-flex; align-items: center; padding: 3px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
        background: var(--tint-2); color: var(--accent-text); white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend { font-size: 14px; color: var(--muted); padding: 0; }
input[type=text], input[type=number], input[type=password], input:not([type]), select, textarea {
  width: 100%; border: 1.5px solid var(--line-strong); background: var(--field); border-radius: 12px; padding: 12px 14px; min-height: 48px; }
textarea { resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- cards */
.card, .ex, .summary-card, .ph { background: var(--card); border-radius: var(--radius); }
.card { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.card--lilac { background: var(--tint-2); }

/* ---------- home */
.hero { display: grid; gap: 16px; }
.hero-main { background: var(--tint-1); border-radius: var(--radius); padding: 28px 24px; }
.hero-main h1 { font-size: clamp(38px, 9vw, 72px); line-height: .98; font-weight: 800; letter-spacing: -.04em; color: var(--accent-text); margin-bottom: 16px; }
.hero-main p { font-size: 18px; max-width: 34ch; }
.hero-side { background: var(--accent); color: var(--on-accent); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 22px; justify-content: space-between; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.steps li { display: flex; align-items: center; gap: 12px; }
.step-n { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none; background: var(--on-accent);
          color: var(--accent); font: 700 13px var(--display); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; line-height: 1.3; }
.stat b { font: 700 28px var(--display); letter-spacing: -.03em; }
.home-grid { display: grid; gap: 16px; }
.levels { display: flex; flex-wrap: wrap; gap: 8px; }
.lvl { min-width: 56px; min-height: 44px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--card); font-weight: 700; cursor: pointer; }
.lvl:hover { border-color: var(--accent); }
.lvl[aria-checked=true] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.lvl--noplan:not([aria-checked=true]) { border-style: dashed; color: var(--muted); }
.level-info { background: var(--soft); border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.chips-in { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip-check span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line-strong); font-size: 14px; min-height: 40px; }
.chip-check span::before { content: ""; width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid currentColor; flex: none; }
.chip-check input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.chip-check input:checked + span::before { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8l3 3 5-6' fill='none' stroke='white' stroke-width='2'/%3E%3C/svg%3E") center/12px no-repeat; border-color: var(--accent); }
.chip-check input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.gen-status .bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 4px 0 6px; }
.gen-status .bar i { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.tests { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 520px; overflow-y: auto; }
.tests a { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--card); border-radius: 14px; text-decoration: none; min-height: 52px; }
.tests a > span:first-child { flex: 1; }
.tests a:hover { outline: 2px solid var(--accent); }
.tests li { display: flex; flex-direction: column; background: var(--card); border-radius: 14px; }
.tests li:hover { outline: 2px solid var(--accent); }
.tests li > a { background: none; }
.tests li > a:hover { outline: none; }
.t-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 16px 12px; margin-top: -4px; }
.redo { margin-inline-start: auto; border: 0; background: none; color: var(--accent-text); font-weight: 600; font-size: 14px;
        padding: 6px 10px; border-radius: 10px; cursor: pointer; }
.redo:hover { background: var(--accent-soft); }
.chip--soft { background: var(--soft); color: var(--muted); }
.empty { padding: 24px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line-strong); border-radius: 14px; }

/* ---------- a paper: tabs, sticky head, exercises, questions */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--card); text-decoration: none;
       font-size: 14px; white-space: nowrap; }
.tab--on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tab--done:not(.tab--on) { border-color: var(--ok); color: var(--ok-text); }
.tab--aux:not(.tab--on) { border-style: dashed; }
.ph { position: sticky; top: 8px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
      padding: 14px 18px; box-shadow: 0 6px 24px rgb(58 4 32 / .12); }
.ph--static { position: static; box-shadow: none; }
.ph-main { flex: 1 1 240px; min-width: 0; }
.ph h1 { font-size: 20px; margin: 0; }
.progress { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.progress .bar { flex: 1; max-width: 280px; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.timer { padding: 8px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.timer b { font: 700 18px var(--sans); }
.timer--over { background: var(--bad-bg); color: var(--bad-text); }
.exercises { display: flex; flex-direction: column; gap: 16px; }
.ex { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.ex-h { display: flex; align-items: center; gap: 10px; }
.ex-h h3 { margin: 0; }
.doc { background: var(--soft); border-inline-start: 3px solid var(--accent); border-radius: 12px; padding: 12px 16px; }
.doc summary { cursor: pointer; font-weight: 600; color: var(--muted); font-size: 14px; }
.doc > :not(summary) { max-width: 70ch; }
.doc-h { font-weight: 700; margin-top: 12px; }
.doc-li { padding-inline-start: 12px; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.listen-box { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.task { margin: 0; }
.q-card { background: var(--soft); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.q-label { font-weight: 600; margin: 0; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opts--col { flex-direction: column; }
.opt { text-align: start; border: 1.5px solid transparent; background: var(--card); border-radius: 12px; padding: 12px 16px; min-height: 48px; cursor: pointer; }
.opt:hover { border-color: var(--line-strong); }
.opt[aria-checked=true] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.why input { background: var(--card); }
.prod textarea { min-height: 260px; }
.wc { align-self: flex-end; }
.grid-in { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.note { margin: 0; }
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
             background: linear-gradient(transparent, var(--page) 40%); }
.actionbar { padding-inline: var(--gutter); }
.actionbar .btn { display: flex; margin-inline-start: auto; }

/* the oral */
.oral { display: flex; flex-direction: column; gap: 10px; }
.chat { display: flex; flex-direction: column; gap: 8px; }
.turn { padding: 10px 14px; border-radius: 16px; max-width: 85%; }
.turn p { margin: 2px 0 0; }
.turn--ex { background: var(--soft); align-self: flex-start; border-end-start-radius: 4px; }
.turn--me { background: var(--accent-soft); align-self: flex-end; border-end-end-radius: 4px; }
.say-again { border: 0; background: none; color: var(--accent-text); cursor: pointer; padding: 0 4px; }
.oral-ctl { display: flex; flex-wrap: wrap; gap: 8px; }
.oral-ctl .btn { flex: 1 1 200px; }
.rec--on { border-color: var(--bad) !important; color: var(--bad-text) !important; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .6; } }

/* ---------- corrigé and result */
.summary-card { display: flex; align-items: center; gap: 24px; padding: 24px; flex-wrap: wrap; }
.score { font: 700 34px var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.score small { font: 500 16px var(--sans); color: var(--muted); }
.ring { --p: 0; width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; flex: none;
        background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--line) 0); }
.ring--low { background: conic-gradient(var(--bad) calc(var(--p) * 1%), var(--line) 0); }
.ring span { width: 76px; height: 76px; border-radius: 50%; background: var(--card); display: flex; align-items: baseline;
             justify-content: center; padding-top: 22px; font: 700 22px var(--display); }
.ring small { font: 600 12px var(--sans); color: var(--muted); }
.tallies { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.tally { padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.tally--ok { background: var(--ok-bg); color: var(--ok-text); }
.tally--bad { background: var(--bad-bg); color: var(--bad-text); }
.tally--pending { background: var(--wait-bg); color: var(--wait-text); }
.q { padding: 12px 16px; border-radius: 14px; background: var(--soft); border-inline-start: 4px solid var(--line-strong); }
.q--ok { border-inline-start-color: var(--ok); }
.q--bad { border-inline-start-color: var(--bad); background: var(--bad-bg); }
.q--pending { border-inline-start-color: var(--wait); background: var(--wait-bg); }
.q-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; }
.q-pts { white-space: nowrap; font-variant-numeric: tabular-nums; }
.q--ok .q-pts { color: var(--ok-text); } .q--bad .q-pts { color: var(--bad-text); }
.q-line { font-size: 14px; margin-top: 4px; }
.q-quote { font-size: 14px; font-style: italic; color: var(--muted); margin-top: 4px; }
.q-note { font-size: 13px; color: var(--muted); margin-top: 2px; }
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th, .grid td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.grid td:last-child, .grid th:last-child { text-align: end; white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
.summary { font-size: 14px; }
.verdict { display: inline-block; padding: 6px 16px; border-radius: 999px; font-weight: 700; margin: 6px 0; color: #fff; }
.verdict--ok { background: #15803d; } .verdict--bad { background: #b91c1c; }
.pcards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.pcard { display: block; text-decoration: none; padding: 22px; border-radius: var(--radius); background: var(--card); }
.pcard:nth-child(4n+1) { background: var(--tint-1); }
.pcard:nth-child(4n+2) { background: var(--tint-2); }
.pcard:nth-child(4n+3) { background: var(--accent); color: var(--on-accent); }
.pcard-t { font-weight: 600; font-size: 14px; min-height: 2.6em; }
.pcard-v { font: 600 44px/1 var(--display); letter-spacing: -.04em; margin: 8px 0 12px; font-variant-numeric: tabular-nums; }
.pcard-v small { font: 500 14px var(--sans); opacity: .8; }
.meter { --p: 0; --m: 20; position: relative; height: 8px; border-radius: 999px; background: rgb(0 0 0 / .1); }
:root.dark .meter, .pcard:nth-child(4n+3) .meter { background: rgb(255 255 255 / .2); }
.meter i { position: absolute; inset: 0 auto 0 0; width: calc(var(--p) * 1%); border-radius: inherit; background: var(--ok); }
.pcard--bad .meter i { background: var(--bad); } .pcard--pending .meter i { background: var(--wait); }
.meter b { position: absolute; top: -4px; bottom: -4px; left: calc(var(--m) * 1%); width: 2px; background: currentColor; opacity: .55; }
.pcard-n { min-height: 1.4em; margin-top: 6px; font-size: 14px; opacity: .85; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.row-btns > * { flex: 1 1 220px; }

/* ---------- accounts: who is signed in, the login screen, the admin's list */
.who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; margin-right: 4px; }
.who b { font-size: 14px; }
.who small { color: var(--muted); font-size: 12px; }
/* the login page: the brand on plum, the form on a card; stacked on a phone, side by side from 760px */
.login { display: grid; gap: 16px; margin-top: 8px; }
.login-side { background: var(--accent); color: var(--on-accent); border-radius: var(--radius); padding: 28px 24px;
              display: flex; flex-direction: column; gap: 20px; }
.login-kicker { font: 700 13px var(--display); letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.login-h { font-size: clamp(30px, 7vw, 46px); font-weight: 800; line-height: 1.02; letter-spacing: -.035em; margin: 0; }
.login-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.login-points li { display: flex; gap: 10px; align-items: baseline; }
.login-points li span { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%;
                        background: var(--on-accent); color: var(--accent); font-size: 12px; font-weight: 700; }
.login-levels { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.login-levels span { padding: 4px 12px; border-radius: 999px; border: 1.5px solid currentColor; font: 700 13px var(--display); opacity: .9; }
.login-card { background: var(--card); border-radius: var(--radius); padding: 28px 24px; display: flex; flex-direction: column; gap: 6px; }
.login-card h2 { font-size: 28px; }
.login-f { display: flex; flex-direction: column; gap: 16px; margin-top: 14px; }
.pw { position: relative; display: block; }
.pw input { padding-right: 96px; }
.pw-show { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: var(--soft);
           color: var(--accent-text); border-radius: 10px; padding: 6px 12px; font-size: 14px; font-weight: 600; cursor: pointer; min-height: 36px; }
.caps { font-size: 13px; }
.login-err { background: var(--bad-bg); color: var(--bad-text); border-radius: 12px; padding: 10px 14px; font-size: 14px; margin: 0; }
.login-help { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
@media (min-width: 760px) {
  .login { grid-template-columns: 1.1fr 1fr; align-items: stretch; margin-top: 24px; }
  .login-side { padding: 40px 36px; min-height: 460px; }
  .login-card { padding: 40px 36px; justify-content: center; }
}
.home-grid--one { grid-template-columns: 1fr !important; }
.users { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.users li { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 10px 14px;
            border-radius: 14px; background: var(--soft); }
.users .del { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.chip--admin { background: var(--accent); color: var(--on-accent); }
.add-user { display: grid; gap: 12px; align-items: end; }
.small { font-size: 13px; }
@media (min-width: 760px) { .add-user { grid-template-columns: 1fr 1fr 180px auto; } }
@media (max-width: 480px) { .who { display: none; } }

/* ---------- history */
.hlist { display: flex; flex-direction: column; gap: 8px; }
.hrow { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 14px 16px; border-radius: 14px; background: var(--soft);
        text-decoration: none; border: 1.5px solid transparent; }
.hrow:hover { border-color: var(--accent); }
.hrow-t { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.hrow-s { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.hrow-p { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.hp { font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--card); }
.hscore { font: 700 18px var(--display); } .hscore small { font-size: 12px; color: var(--muted); }
.hhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.chip--ok { background: var(--ok-bg); color: var(--ok-text); }
.chip--bad { background: var(--bad-bg); color: var(--bad-text); }
.hpaper > summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; padding: 4px 0; }
.hpaper[open] > summary { margin-bottom: 12px; }

/* ---------- the page across the window */
.ph { top: 84px; }
.ex-cols { display: flex; flex-direction: column; gap: 14px; }
.ex-qs { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hgrid { display: grid; gap: 16px; align-items: start; }
.home-grid--one .tests { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); max-height: none; align-items: start; }
.signed-out .footer { display: none; }
@media (min-width: 760px) {
  .actionbar .btn { width: auto; min-width: 320px; padding-inline: 32px; }
  .hgrid { grid-template-columns: repeat(auto-fill, minmax(560px, 1fr)); }
}
@media (min-width: 1100px) {
  /* a document beside its questions, the document kept in view while answering */
  .ex--split .ex-cols { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  .ex--split .ex-doc { position: sticky; top: 222px; max-height: calc(100vh - 242px); overflow-y: auto; border-radius: 12px; }
  .home-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
  .hero { grid-template-columns: 1.6fr 1fr; }
}
/* the login page fills the window: brand on one half, the form on the other */
.signed-out main { padding: 0; }
.signed-out .login { flex: 1; margin: 0; gap: 0; min-height: calc(100vh - 70px); }
.signed-out .login-side, .signed-out .login-card { border-radius: 0; }
.signed-out .login-card { justify-content: center; }
@media (min-width: 760px) {
  .signed-out .login-side { padding: 64px var(--gutter); justify-content: center; }
  .signed-out .login-card { padding: 64px var(--gutter); }
  .signed-out .login-card > * { width: 100%; max-width: 440px; }
  .signed-out .login-h { font-size: clamp(40px, 4.6vw, 68px); }
  .signed-out .login-levels { margin-top: 24px; }
}
@media (max-width: 759px) {
  /* a phone: the header scrolls away (two rows: brand and tools, then the links), the paper's head stays */
  .topbar { position: static; flex-wrap: wrap; gap: 8px 10px; padding-bottom: 8px; }
  .tools { gap: 4px; }
  .mainnav { order: 3; flex-basis: 100%; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
  .ph { top: 8px; }
  .brand { gap: 8px; } .logo { width: 38px; height: 38px; border-radius: 12px; }
  .brand-t small { display: none; }
  #logout { padding: 6px 12px; min-height: 36px; font-size: 14px; }
}

#toast { position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60;
         background: var(--text); color: var(--page); padding: 12px 18px; border-radius: 14px; max-width: calc(100% - 32px); transition: .25s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- wider screens */
@media (min-width: 760px) {
  .hero { grid-template-columns: 1.3fr 1fr; }
  .hero-main { padding: 40px 36px 36px; min-height: 320px; display: flex; flex-direction: column; justify-content: flex-end; }
  .hero-side { padding: 30px; }
  .home-grid { grid-template-columns: 1.4fr 1fr; align-items: start; }
  .card { padding: 30px; }
  .ex { padding: 30px; }
  h1 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
