:root {
  --ink: #1b2330; --muted: #637083; --line: #e3e7ee; --bg: #f5f7fa; --card: #fff;
  --brand: #1f5eff; --brand-ink: #fff; --ok: #1d8a4e; --warn: #b54708; --bad: #c4321c;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 15px/1.55 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 18px; margin: 24px 0 10px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.noselect { -webkit-user-select: none; user-select: none; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; letter-spacing: .2px; }
.who { color: var(--muted); font-size: 14px; }

.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; max-width: 860px; margin: 24px auto; }
.card.narrow { max-width: 460px; width: 100%; }
.center-page .card { margin: 0; }
.center-page .brand { color: var(--muted); font-size: 13px; margin-bottom: 6px; }

label { display: block; font-weight: 600; margin: 14px 0 6px; }
label.check { font-weight: 400; display: flex; gap: 8px; align-items: center; margin: 18px 0; }
input[type=text], input[type=password], input[type=number], input[type=email], input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #cfd6e0; border-radius: 8px; font: inherit; background: #fff; color: inherit;
}
textarea { resize: vertical; }
.code-input { font-size: 22px; letter-spacing: 4px; text-transform: uppercase; text-align: center; }

.btn { display: inline-block; padding: 10px 16px; border-radius: 8px; border: 1px solid #cfd6e0; background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: #9aa6b6; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.danger { color: var(--bad); border-color: #f0b4a9; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; margin-top: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.alert { background: #fff4e5; border: 1px solid #f5c58a; color: #7a3d00; padding: 10px 12px; border-radius: 8px; margin: 12px 0; }
.alert.ok { background: #e9f7ef; border-color: #9fd9b5; color: #135c33; }
.rules li { margin: 6px 0; }

.mic-test { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 18px 0; padding: 12px; background: #f8fafc; border-radius: 8px; }
.meter { flex: 1 1 160px; height: 8px; background: #e6ebf2; border-radius: 4px; overflow: hidden; }
.meter div { height: 100%; width: 0; background: var(--ok); transition: width .08s; }

/* Exam */
.exam-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; background: #eef3ff; color: #1d47c2; font-size: 13px; font-weight: 600; }
.timers { text-align: right; font-size: 14px; }
.timers strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.timers .urgent strong { color: var(--bad); }
.bar { height: 5px; background: #e6ebf2; border-radius: 3px; margin: 12px 0 18px; overflow: hidden; }
.bar div { height: 100%; background: var(--brand); transition: width .25s linear; }
.q-body { white-space: pre-wrap; font-size: 16px; margin-bottom: 14px; }
.q-code { display: block; border-radius: 8px; margin: 0 0 16px; max-width: 100%; }
.options { display: grid; gap: 8px; }
.option { text-align: left; padding: 12px 14px; border: 1px solid #cfd6e0; border-radius: 8px; background: #fff; font: inherit; cursor: pointer; color: inherit; }
.option:hover { border-color: #8ea2c0; }
.option.chosen { border-color: var(--brand); background: #eef3ff; box-shadow: inset 0 0 0 1px var(--brand); }
textarea.answer { font-family: Consolas, "Courier New", monospace; font-size: 14px; }
.exam-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; gap: 10px; }
.recorder { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 14px; background: #f8fafc; border-radius: 8px; }
.recorder audio { width: 100%; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1b2330; color: #fff; padding: 10px 16px; border-radius: 8px; max-width: 90vw; z-index: 50; }

/* Admin */
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; padding: 8px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.admin-nav a { padding: 6px 12px; border-radius: 6px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14px; }
.admin-nav a.on, .admin-nav a:hover { background: #eef3ff; color: #1d47c2; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 20px; }
.wrap .card { max-width: none; margin: 0 0 20px; }
table.grid { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; }
table.grid th, table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.grid th { background: #f3f5f9; font-weight: 600; position: sticky; top: 0; }
table.grid tr:hover td { background: #fafbfd; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #eef1f5; color: #445; margin: 1px 2px 1px 0; }
.tag.ok { background: #e3f5ea; color: #135c33; }
.tag.warn { background: #fff1de; color: #8a4b00; }
.tag.bad { background: #fde8e4; color: #9d2512; }
.flex { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; min-width: 150px; }
.stat b { display: block; font-size: 24px; }
pre.ans { white-space: pre-wrap; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: 13px/1.5 Consolas, "Courier New", monospace; margin: 6px 0; max-height: 420px; overflow: auto; }
.item { border-top: 1px solid var(--line); padding: 14px 0; }
.item h3 { font-size: 15px; margin: 0 0 6px; }
.right { text-align: right; }
@media (max-width: 760px) { .grid2, .grid3 { grid-template-columns: 1fr; } .card { padding: 16px; } }
