:root {
  --bg: #f4f6fb; --card: #fff; --ink: #151a2d; --muted: #6b7280; --line: #e3e7f0;
  --brand: #2563eb; --brand-ink: #fff; --ok: #16a34a; --bad: #dc2626; --warn: #d97706;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1220; --card: #181d30; --ink: #e8ebf5; --muted: #98a2b8; --line: #2a3150; --brand: #5b8cff; --brand-ink: #0b1020; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
header a.logo { font-weight: 800; text-decoration: none; color: var(--ink); font-size: 17px; }
header .who { color: var(--muted); font-size: 13px; display: flex; gap: 10px; align-items: center; }
main { max-width: 860px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 12px; } h2 { font-size: 17px; margin: 0 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 160px; }
.muted { color: var(--muted); font-size: 13px; }
.crumb { font-size: 13px; margin-bottom: 4px; } .crumb a { color: var(--muted); }
input, select, textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; }
label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 3px; }
button, .btn { padding: 9px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); font: inherit; cursor: pointer; text-decoration: none; display: inline-block; }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
button.danger { color: var(--bad); }
button.small { padding: 4px 9px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
ul.list li:last-child { border-bottom: 0; }
ul.list a { color: var(--ink); font-weight: 600; text-decoration: none; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; }
.pct-good { color: var(--ok); font-weight: 700; } .pct-mid { color: var(--warn); font-weight: 700; } .pct-bad { color: var(--bad); font-weight: 700; }
.auth { max-width: 380px; margin: 40px auto; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; margin-top: 8px; }
/* answer grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 14px; }
.q { display: flex; align-items: center; gap: 5px; padding: 3px 0; }
.q b { width: 26px; text-align: right; font-size: 12px; color: var(--muted); font-weight: 600; }
.q button.b { width: 30px; height: 30px; padding: 0; border-radius: 50%; font-size: 12px; }
.q button.b.sel { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.q button.b.right { background: var(--ok); color: #fff; border-color: var(--ok); }
.q button.b.wrong { background: var(--bad); color: #fff; border-color: var(--bad); }
.q.multi b::after { content: '!'; color: var(--warn); margin-left: 2px; }
.q .keyhint { font-size: 11px; color: var(--ok); width: 14px; }
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #111; color: #fff; padding: 9px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 20; max-width: 90vw; }
#toast.show { opacity: .95; }
#toast.error { background: var(--bad); }
canvas.preview { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); margin-top: 8px; }
.stats { display: flex; gap: 18px; flex-wrap: wrap; } .stats div { min-width: 70px; } .stats b { display: block; font-size: 20px; }
