:root {
    --bg: #f3efe6;
    --paper: #fffdf8;
    --ink: #1c1714;
    --muted: #6b6258;
    --line: #d8cfc2;
    --accent: #7a1f2b;
    --accent2: #1e3a4c;
    --ok: #2c5f2d;
    --err: #8b1e1e;
    --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font: 18px/1.45 "Segoe UI", "PT Sans", "Arial", sans-serif;
    background: var(--bg);
    color: var(--ink);
}
a { color: var(--accent2); }
.top, .foot, .wrap { max-width: 980px; margin: 0 auto; }
.top {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px 8px;
}
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit; }
.brand .mark { margin-right: 10px; }
.brand small { display: block; color: var(--muted); font-size: 13px; }
.mark {
    background: var(--accent); color: #fff; font-weight: 700;
    padding: 8px 10px; border-radius: 10px; letter-spacing: .04em;
}
.top nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.top nav > * { margin-left: 14px; }
.inline { display: inline; }
.linkish, button.linkish {
    background: none; border: 0; color: var(--accent2); font: inherit; cursor: pointer; padding: 0;
}
.wrap { padding: 10px 20px 40px; }
.foot { padding: 10px 20px 30px; color: var(--muted); font-size: 13px; }
.hero h1 { margin: 10px 0 8px; font-size: 32px; }
.cards { display: flex; flex-wrap: wrap; margin: 14px -6px 20px; }
.card {
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px; text-decoration: none; color: inherit;
    box-shadow: 0 1px 0 rgba(0,0,0,.04);
    border-top: 5px solid var(--c, var(--accent));
    flex: 1 1 210px; margin: 6px;
}
.card span { display: block; color: var(--muted); margin-top: 8px; }
.h2 { margin-top: 28px; }
.list { list-style: none; padding: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list a { display: block; padding: 12px 0; text-decoration: none; color: inherit; }
.list small { display: block; color: var(--muted); }
.narrow { max-width: 560px; }
.form { display: grid; gap: 12px; margin: 16px 0; }
.form label, .form .check { display: grid; gap: 6px; font-size: 15px; }
input, select, textarea, button {
    font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
    background: #fff;
}
button, .btn {
    background: var(--accent); color: #fff; border: 0; cursor: pointer;
    display: inline-block; text-decoration: none; text-align: center;
    padding: 10px 12px; border-radius: 10px;
}
.btn.ghost, button.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 8px; }
.toolbar > * { margin: 0 8px 8px 0; }
.note { padding: 12px 14px; border-radius: 10px; margin: 12px 0; }
.note.ok { background: #e7f3e7; }
.note.err { background: #f8e3e3; }
.muted { color: var(--muted); }
.meta { padding-left: 18px; }
.table { width: 100%; border-collapse: collapse; background: var(--paper); }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.st { padding: 2px 8px; border-radius: 999px; background: #eee; font-size: 13px; }
.st-published { background: #d7edd8; }
.st-draft { background: #f3e6c8; }
.st-closed { background: #eadfdf; }
.box { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 16px 0; }
.linkline input { width: 100%; }
.grid2 { grid-template-columns: 1fr 1fr; }
.preview ul { margin: 6px 0 16px; }
.checks { list-style: none; padding: 0; }
.checks .yes { color: var(--ok); }
.checks .no { color: var(--err); }
.row { grid-template-columns: 2fr 1fr auto; }
.scorebox { display: flex; gap: 16px; align-items: center; background: var(--paper); padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); }
.grade { font-size: 48px; font-weight: 700; color: var(--accent); }
.attempt-body { background: #efe8dc; }
.att-top {
    position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center;
    background: #1e3a4c; color: #fff; padding: 10px 16px;
}
.timer { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 700; }
.att-form { max-width: 800px; margin: 0 auto; padding: 16px; }
.q { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 14px; }
.q header { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }
.stem { margin: 8px 0; }
.hint { color: var(--muted); font-size: 15px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.opt.row { align-items: center; }
.opt .left { flex: 1; }
.wide { width: 100%; }
.q-media img { max-width: 100%; height: auto; border-radius: 8px; }
.qr-page { text-align: center; }
.qr-box { display: inline-block; padding: 16px; background: #fff; border-radius: 12px; margin: 12px 0; }
.att-actions { display: flex; gap: 12px; align-items: center; padding: 10px 0 30px; }
@media print {
    .top, .foot, .crumb, .toolbar { display: none; }
}
@media (max-width: 640px) {
    .grid2, .row { grid-template-columns: 1fr; }
    .top { flex-direction: column; align-items: flex-start; gap: 8px; }
    .top nav > * { margin: 0 12px 4px 0; }
    .cards { display: block; margin-left: 0; margin-right: 0; }
    .card { display: block; margin: 10px 0; }
    .table { display: block; max-width: 100%; overflow-x: auto; white-space: nowrap; }
    body { font-size: 17px; }
}
