:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1d2433;
  --muted: #6b7385;
  --line: #dfe3ec;
  --brand: #1f5f8b;
  --brand-ink: #ffffff;
  --ok: #1e8e3e;
  --ok-bg: #e6f4ea;
  --bad: #c5221f;
  --bad-bg: #fce8e6;
  --warn-bg: #fff4d6;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.5;
}
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px;
  background: var(--brand); color: var(--brand-ink);
}
.brand { color: inherit; text-decoration: none; font-weight: 700; font-size: 19px; }
.who { font-size: 15px; display: flex; gap: 10px; align-items: center; }
.who button { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.4); padding: 4px 10px; font-size: 14px; }
main { max-width: 920px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 26px; margin: 8px 0 16px; }
h2 { font-size: 20px; margin: 24px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px;
}
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
button, .btn {
  font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); padding: 10px 16px; text-decoration: none; display: inline-block;
}
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }
.student {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 12px;
  font-size: 18px; font-weight: 600; text-align: center;
}
.avatar {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-size: 26px; font-weight: 700;
}
.setcard h3 { margin: 0 0 4px; font-size: 18px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; background: #eef1f7; color: var(--muted); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
input[type=password], input[type=text], select {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; max-width: 100%;
}
.progress { height: 8px; background: #e6e9f0; border-radius: 999px; overflow: hidden; margin: 8px 0 14px; }
.progress > div { height: 100%; background: var(--brand); }
.qhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: 15px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
.timer.low { color: var(--bad); }
.qtext { font-size: 20px; font-weight: 600; white-space: pre-line; margin: 6px 0 14px; }
.qimg { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; margin: 0 auto 12px; }
.opt {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  padding: 12px 14px; margin-bottom: 8px; border: 2px solid var(--line); border-radius: 12px; background: #fff;
}
.opt img { max-height: 48px; }
.opt .mark {
  flex: none; width: 22px; height: 22px; border: 2px solid #9aa3b5; border-radius: 50%;
}
.opt.multi .mark { border-radius: 5px; }
.opt.sel { border-color: var(--brand); background: #eaf2f8; }
.opt.sel .mark { border-color: var(--brand); background: var(--brand); box-shadow: inset 0 0 0 3px #fff; }
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; align-items: center; }
.match .term { padding: 10px 12px; background: #f3f5fa; border-radius: 10px; }
.match select { width: 100%; }
.match select.right { border-color: var(--ok); background: var(--ok-bg); }
.match select.wrong { border-color: var(--bad); background: var(--bad-bg); }
.fixhint { grid-column: 2; font-size: 14px; color: var(--ok); margin-top: -4px; }
.hotspot { position: relative; display: block; width: 100%; user-select: none; touch-action: manipulation; }
.hotspot img { width: 100%; display: block; border-radius: 8px; border: 1px solid var(--line); cursor: crosshair; }
.hotspot .pin {
  position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%;
  background: rgba(31,95,139,.85); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4);
  color: #fff; font-size: 14px; font-weight: 700; display: grid; place-items: center; pointer-events: none;
}
.hotspot .area { position: absolute; border: 3px solid var(--ok); background: rgba(30,142,62,.15); border-radius: 6px; pointer-events: none; }
.hotspot .pin.bad { background: rgba(197,34,31,.9); }
.hint { font-size: 14px; color: var(--muted); margin: 8px 0 0; }
.feedback { margin-top: 14px; padding: 12px 14px; border-radius: 10px; font-weight: 600; }
.feedback.ok { background: var(--ok-bg); color: var(--ok); }
.feedback.bad { background: var(--bad-bg); color: var(--bad); }
.actions { display: flex; gap: 10px; justify-content: space-between; margin-top: 16px; flex-wrap: wrap; }
.navdots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.navdots button { width: 38px; height: 38px; padding: 0; font-size: 14px; }
.navdots .done { background: #eaf2f8; border-color: var(--brand); }
.navdots .cur { outline: 3px solid var(--brand); }
.navdots .right { background: var(--ok-bg); border-color: var(--ok); }
.navdots .wrong { background: var(--bad-bg); border-color: var(--bad); }
.score { font-size: 46px; font-weight: 800; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.tablewrap { overflow-x: auto; }
.notice { background: var(--warn-bg); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 15px; }
.foot { margin-top: 30px; text-align: center; }
.foot a { color: var(--muted); font-size: 14px; }
.match select:disabled { color: var(--ink); opacity: 1; }
@media (max-width: 560px) {
  .brand { font-size: 16px; }
  .wname { display: none; }
  body { font-size: 16px; }
  .qtext { font-size: 18px; }
  .match { grid-template-columns: 1fr; }
  .fixhint { grid-column: 1; }
  .score { font-size: 38px; }
}
