/* Fonts served from this site (SIL Open Font License; see /fonts/LICENSE-*.txt): no third-party requests. */
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/barlow-condensed-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }

/* Layout: one centred column (1120px for the admin, 720px for the examinee) under a sticky top bar;
   wide tables scroll inside their own frames. Scoreboard-style condensed numerals for levels. */
:root {
  --bg: #f1f4f6;
  --surface: #ffffff;
  --surface-2: #e8edf1;
  --ink: #13222c;
  --ink-2: #394a55;
  --muted: #5c6d78;
  --line: #d2dbe1;
  --line-strong: #b4c2cb;
  --accent: #0a5a8c;
  --accent-hover: #084a73;
  --accent-ink: #ffffff;
  --accent-soft: #e0ecf5;
  --focus: #1a7ec3;
  --good: #16803a;
  --good-soft: #e2f2e6;
  --warn: #8c5900;
  --warn-soft: #f9eed3;
  --bad: #b2312a;
  --bad-soft: #f7e2df;
  --chart-grid: #e3e9ed;
  --shadow: 0 1px 2px rgb(19 34 44 / 0.06), 0 6px 18px rgb(19 34 44 / 0.07);
  --scrim: rgb(13 24 31 / 0.45);
  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-sm: 6px;
  --r-md: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c151b;
    --surface: #131f27;
    --surface-2: #1a2933;
    --ink: #e4ecf1;
    --ink-2: #b9c7d0;
    --muted: #8d9ea9;
    --line: #283843;
    --line-strong: #3a4d59;
    --accent: #5fb2e6;
    --accent-hover: #86c6ee;
    --accent-ink: #061420;
    --accent-soft: #14324a;
    --focus: #8ccdf3;
    --good: #55c579;
    --good-soft: #12301f;
    --warn: #e6b04c;
    --warn-soft: #382a0e;
    --bad: #f27c71;
    --bad-soft: #3b1916;
    --chart-grid: #22323c;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 18px rgb(0 0 0 / 0.25);
    --scrim: rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c151b;
  --surface: #131f27;
  --surface-2: #1a2933;
  --ink: #e4ecf1;
  --ink-2: #b9c7d0;
  --muted: #8d9ea9;
  --line: #283843;
  --line-strong: #3a4d59;
  --accent: #5fb2e6;
  --accent-hover: #86c6ee;
  --accent-ink: #061420;
  --accent-soft: #14324a;
  --focus: #8ccdf3;
  --good: #55c579;
  --good-soft: #12301f;
  --warn: #e6b04c;
  --warn-soft: #382a0e;
  --bad: #f27c71;
  --bad-soft: #3b1916;
  --chart-grid: #22323c;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 18px rgb(0 0 0 / 0.25);
  --scrim: rgb(0 0 0 / 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font: 600 1.6rem/1.15 var(--font-display); letter-spacing: 0.01em; }
h2 { font: 600 1.15rem/1.25 var(--font-body); }
h3 { font: 600 1rem/1.3 var(--font-body); }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 0.86em; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------- top bar */
.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px 20px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { flex: none; }
.brand-name {
  font: 700 1.05rem/1 var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.brand-sub { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.nav button {
  border: 0;
  background: none;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-weight: 500;
  cursor: pointer;
}
.nav button:hover { background: var(--surface-2); }
.nav button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }

/* ---------------- page */
.page { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; display: grid; gap: 24px; }
.page-narrow { max-width: 720px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.page-head > div { min-width: 0; display: grid; gap: 4px; }
.section { display: grid; gap: 12px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.panel-pad { padding: 16px; }
.stack { display: grid; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-ghost { border-color: transparent; background: none; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 0.86rem; }
.btn-lg { min-height: 54px; padding: 12px 22px; font-size: 1.05rem; font-weight: 600; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------------- form controls */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .field-label { font-weight: 600; font-size: 0.9rem; }
.hint { font-size: 0.82rem; color: var(--muted); }
.input, .select, .textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--bad); }
.check { display: inline-flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .input { width: auto; flex: 1 1 220px; }
.toolbar .select { width: auto; flex: 0 1 auto; }

.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span {
  display: grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font: 600 1.05rem/1 var(--font-display);
  font-variant-numeric: tabular-nums;
  background: var(--surface);
}
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.answer-row { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; align-items: center; }
.answer-row .letter { font: 700 1.1rem/1 var(--font-display); width: 1.2em; text-align: center; }
.correct-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: var(--r-sm); }
.correct-pick input { width: 18px; height: 18px; accent-color: var(--good); }
.correct-pick:has(input:checked) { color: var(--good); font-weight: 600; background: var(--good-soft); }

/* ---------------- pills, badges */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--ink-2);
}
.pill-good { background: var(--good-soft); color: var(--good); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.lvl {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 24px;
  padding: 0 6px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font: 700 0.98rem/1 var(--font-display);
  font-variant-numeric: tabular-nums;
}

/* ---------------- summary strip */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.summary > div { background: var(--surface); padding: 14px 16px; display: grid; gap: 2px; }
.summary .big { font: 600 2rem/1 var(--font-display); font-variant-numeric: tabular-nums; }

/* ---------------- bank health */
.health { display: grid; gap: 2px; }
.health-row {
  display: grid;
  grid-template-columns: 74px minmax(120px, 1fr) 64px minmax(140px, auto);
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface);
}
.health-row:first-child { border-radius: var(--r-md) var(--r-md) 0 0; }
.health-row:last-child { border-radius: 0 0 var(--r-md) var(--r-md); }
.health-wrap { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--line); }
.health-level { font: 600 1.05rem/1 var(--font-display); letter-spacing: 0.03em; text-transform: uppercase; }
.bar { position: relative; height: 12px; background: var(--surface-2); border-radius: 3px; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 3px 3px 0; background: var(--accent); }
.bar > b { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); opacity: 0.55; }
.health-count { font: 600 1.2rem/1 var(--font-display); text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .health-row { grid-template-columns: 60px 1fr 44px; }
  .health-row .pill { grid-column: 1 / -1; justify-self: start; }
}

/* ---------------- tables */
.table-frame { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; background: var(--surface); position: sticky; top: 0; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: var(--surface-2); }
td.qtext { min-width: 260px; max-width: 520px; }
td.actions { white-space: nowrap; text-align: right; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.matrix td, .matrix th { text-align: center; padding: 6px 8px; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix td.zero { color: var(--muted); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }

/* ---------------- cards (tests) */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.card-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.card-head > div { min-width: 0; }
dl.meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 0.88rem; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; min-width: 0; }
.mini-levels { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; }
.mini-levels span { display: grid; gap: 1px; justify-items: center; padding: 4px 0; border-radius: 4px; background: var(--surface-2); font-size: 0.72rem; line-height: 1.1; }
.mini-levels span b { font: 600 0.95rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.mini-levels span.ok { background: var(--good-soft); color: var(--good); }
.mini-levels span.low { background: var(--warn-soft); color: var(--warn); }
.mini-levels span.empty { background: var(--bad-soft); color: var(--bad); }

/* ---------------- notices */
.notice { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--ink); align-items: start; }
.notice-warn { background: var(--warn-soft); }
.notice-bad { background: var(--bad-soft); }
.notice-good { background: var(--good-soft); }
.notice .icon { font-weight: 700; }
.notice-warn .icon { color: var(--warn); }
.notice-bad .icon { color: var(--bad); }
.notice-good .icon { color: var(--good); }
.empty-state { padding: 32px 16px; text-align: center; display: grid; gap: 8px; justify-items: center; color: var(--muted); }

/* ---------------- modal */
.modal-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 50; display: grid; place-items: start center; overflow-y: auto; padding: max(24px, env(safe-area-inset-top, 0px)) 12px 24px; }
.modal { width: min(760px, 100%); background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow); display: grid; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-body { padding: 20px; display: grid; gap: 16px; min-width: 0; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.modal-foot .missing { margin-right: auto; font-size: 0.84rem; color: var(--warn); }
.modal-sm { width: min(480px, 100%); }
.x { border: 0; background: none; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: var(--r-sm); }
.x:hover { background: var(--surface-2); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 620px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------------- toast */
#toast-root { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); }
.toast { background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: var(--r-sm); box-shadow: var(--shadow); font-size: 0.92rem; }
.toast-bad { background: var(--bad); color: #ffffff; }

/* ---------------- examinee */
.exam { max-width: 720px; margin: 0 auto; padding: 20px 16px 48px; display: grid; gap: 20px; }
.exam-head { display: grid; gap: 10px; }
.exam-title { font: 600 1.05rem/1.2 var(--font-display); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.exam-count { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.exam-count strong { font: 600 1.6rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.laps { display: grid; grid-template-columns: repeat(var(--n, 40), 1fr); gap: 2px; }
.laps i { height: 8px; border-radius: 2px; background: var(--surface-2); }
.laps i.done { background: var(--accent); }
.laps i.now { background: var(--accent); opacity: 0.4; }
.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px; display: grid; gap: 18px; }
.qtext-lg { font-size: 1.22rem; line-height: 1.45; font-weight: 500; overflow-wrap: anywhere; }
.options { display: grid; gap: 10px; border: 0; margin: 0; padding: 0; min-width: 0; }
.option { position: relative; }
.option input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.option .opt {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 60px;
  padding: 10px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 1.05rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.option .opt b {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  font: 700 1.05rem/1 var(--font-display);
}
.option:hover .opt { border-color: var(--accent); }
.option input:checked + .opt { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.option input:checked + .opt b { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.option input:focus-visible + .opt { outline: 2px solid var(--focus); outline-offset: 2px; }
.option input:disabled + .opt { opacity: 0.6; }
.result-hero { text-align: center; display: grid; gap: 6px; justify-items: center; padding: 28px 16px; }
.result-level { font: 700 clamp(4rem, 18vw, 7.5rem)/0.9 var(--font-display); letter-spacing: 0.01em; font-variant-numeric: tabular-nums; color: var(--accent); }
.result-level small { font-size: 0.32em; letter-spacing: 0.12em; color: var(--muted); display: block; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.stats > div { background: var(--surface); padding: 12px 14px; display: grid; gap: 2px; text-align: center; }
.stats .big { font: 600 1.7rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.code-box { font-family: var(--font-mono); font-size: 0.78rem; word-break: break-all; min-height: 110px; }
.test-pick { display: grid; gap: 8px; }
.test-pick label { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); cursor: pointer; }
.test-pick label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.test-pick input { margin-top: 4px; accent-color: var(--accent); }
ul.plain { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; }

/* ---------------- chart */
.chart-frame { overflow-x: auto; }
.chart-frame svg { display: block; width: 100%; min-width: 560px; height: auto; }
.chart-frame text { fill: var(--muted); font: 11px var(--font-body); }
.chart-frame .axis-title { fill: var(--ink-2); font-weight: 600; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.84rem; color: var(--ink-2); align-items: center; }
.chart-legend svg { vertical-align: -3px; }
.tip { position: fixed; z-index: 70; pointer-events: none; background: var(--ink); color: var(--surface); padding: 6px 9px; border-radius: var(--r-sm); font-size: 0.8rem; line-height: 1.35; max-width: 260px; box-shadow: var(--shadow); }

@media (max-width: 640px) {
  .page { padding-top: 16px; gap: 18px; }
  h1 { font-size: 1.4rem; }
  .qcard { padding: 16px; }
  .qtext-lg { font-size: 1.12rem; }
  .brand-sub { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------------- exam additions: timer and certificate */
.exam-timer { font: 600 1.05rem/1 var(--font-display); color: var(--muted); font-variant-numeric: tabular-nums; }
.exam-timer.low { color: var(--warn); }
.result-cert { font: 700 clamp(2.6rem, 12vw, 4.6rem)/1 var(--font-display); letter-spacing: 0.02em; text-transform: uppercase; color: var(--accent); padding: 6px 0 2px; }
.result-cert.tier-none { color: var(--ink-2); }
.result-stats { display: grid; gap: 8px; margin-top: 4px; }
.result-stats > p { margin: 0; text-align: center; }
.result-stats .stats { display: flex; flex-wrap: wrap; }
.result-stats .stats > div { flex: 1 1 130px; }

/* ---------------- public web edition: account, footer, sign-in */
.brand-link { color: inherit; text-decoration: none; min-width: 0; }
.who { padding: 0 6px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .who { display: none; } }
.foot { max-width: 720px; margin: 0 auto; padding: 8px 16px calc(28px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 8px 20px; justify-content: center; flex-wrap: wrap; font-size: 0.86rem; }
.foot a, .linklike { color: var(--muted); }
.linklike { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; font-size: inherit; }
.foot a:hover, .linklike:hover { color: var(--accent); }
.code-input { font: 600 1.6rem/1 var(--font-mono); letter-spacing: 0.3em; text-align: center; max-width: 260px; }

/* ---------------- certificate page */
.cert-page { max-width: 820px; margin: 0 auto; padding: 24px 16px 40px; display: grid; gap: 20px; }
.cert {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  outline: 6px double var(--accent-soft);
  outline-offset: -14px;
  border-radius: var(--r-md);
  padding: clamp(28px, 6vw, 56px) clamp(20px, 6vw, 64px);
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
}
.cert-top { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; text-align: left; }
.cert-kicker { font: 700 clamp(1.6rem, 5vw, 2.2rem)/1 var(--font-display); letter-spacing: 0.32em; text-transform: uppercase; color: var(--accent); padding-left: 0.32em; }
.cert-line { color: var(--ink-2); max-width: 46ch; }
.cert-name { font: 600 clamp(1.8rem, 6vw, 2.8rem)/1.1 var(--font-display); letter-spacing: 0.02em; padding: 6px 0; border-bottom: 1px solid var(--line-strong); min-width: min(100%, 420px); overflow-wrap: anywhere; }
.cert-tier { font: 700 clamp(3rem, 14vw, 5.4rem)/0.95 var(--font-display); letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); margin-top: 6px; }
.cert-sub { color: var(--muted); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.82rem; }
.cert-meta { display: flex; gap: 12px 40px; justify-content: center; flex-wrap: wrap; margin: 18px 0 0; }
.cert-meta div { display: grid; gap: 2px; }
.cert-meta dt { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.cert-meta dd { margin: 0; font-weight: 600; }
.cert-check { color: var(--muted); overflow-wrap: anywhere; }
.cert-trial { outline-color: var(--warn-soft); }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    color-scheme: light;
    --bg: #ffffff; --surface: #ffffff; --surface-2: #e8edf1; --ink: #13222c; --ink-2: #394a55; --muted: #5c6d78;
    --line: #d2dbe1; --line-strong: #b4c2cb; --accent: #0a5a8c; --accent-soft: #e0ecf5;
    --good: #16803a; --good-soft: #e2f2e6; --warn: #8c5900; --warn-soft: #f9eed3;
  }
  body { background: #ffffff !important; }
  .topbar, .foot, .no-print, #toast-root { display: none !important; }
  .cert-page { padding: 0; max-width: none; }
  .cert { box-shadow: none; break-inside: avoid; }
}
.prose { gap: 14px; }
.prose h2 { margin-top: 10px; }
.prose ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
