/* ============================================================
   ЕНТ Платформа — design system
   ============================================================ */
:root {
  --violet-700: #5b21b6;
  --violet-600: #6d28d9;
  --violet-500: #7c3aed;
  --violet-400: #8b5cf6;
  --violet-100: #ede9fe;
  --violet-050: #f5f3ff;

  --gold-500: #f59e0b;
  --gold-400: #fbbf24;
  --gold-300: #fcd34d;

  --green-500: #22c55e;
  --green-100: #dcfce7;
  --red-500: #ef4444;
  --red-100: #fee2e2;

  --ink: #1e1b3a;
  --ink-soft: #4b4869;
  --muted: #8884a3;
  --line: #ece9f5;
  --card: #ffffff;
  --bg: #f6f4fd;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow-sm: 0 4px 16px rgba(76, 29, 149, .06);
  --shadow-md: 0 14px 40px rgba(76, 29, 149, .10);
  --shadow-lg: 0 26px 70px rgba(76, 29, 149, .18);

  --reward-per-answer: 140;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', 'Roboto', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.container { width: min(1140px, 92vw); margin-inline: auto; }

/* ---------- buttons ---------- */
.btn {
  border: 0;
  border-radius: 999px;
  padding: 14px 26px;
  font-weight: 800;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--violet-500); color: #fff; box-shadow: 0 10px 24px rgba(124, 58, 237, .35); }
.btn-primary:hover { background: var(--violet-600); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--violet-400); color: var(--violet-600); }
.btn-gold {
  background: linear-gradient(180deg, var(--gold-400), var(--gold-500));
  color: #3b2a00;
  box-shadow: 0 14px 34px rgba(245, 158, 11, .4);
}
.btn-gold:hover { filter: brightness(1.03); }
.btn-block { width: 100%; }
.btn-lg { padding: 22px; font-size: 26px; border-radius: 20px; }

/* ============================================================
   HERO
   ============================================================ */
.hero { padding: 40px 0 30px; }
.hero-grid { display: grid; gap: 34px; }
.hero h1 {
  font-size: clamp(40px, 9vw, 62px);
  line-height: 1.02; margin: 0 0 22px; letter-spacing: -.5px; font-weight: 800;
}
.hero h1 .reward {
  background: linear-gradient(120deg, var(--violet-500), var(--violet-700));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  position: relative;
}
.hero h1 .reward::after {
  content: ""; position: absolute; left: 0; right: 14%; bottom: -6px; height: 7px;
  background: var(--gold-400); border-radius: 4px;
}
.hero p.lead { font-size: 19px; color: var(--ink-soft); max-width: 480px; margin: 0 0 26px; }
.hero-cta { margin-top: 28px; }

.hero-badges { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; max-width: 520px; }
.hero-badge {
  background: var(--card); border-radius: var(--radius-sm); padding: 14px 16px;
  display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow-sm);
}
.hero-badge .bi {
  width: 40px; height: 40px; flex: none; border-radius: 11px; display: grid; place-items: center;
}
.hero-badge .bi svg { width: 22px; height: 22px; }
.hero-badge.full { grid-column: 1 / -1; }
.hero-badge b { display: block; font-size: 15px; }
.hero-badge span { font-size: 13px; color: var(--muted); }
.bi-violet { background: var(--violet-100); color: var(--violet-600); }
.bi-green { background: var(--green-100); color: var(--green-500); }
.bi-gold { background: #fef3c7; color: var(--gold-500); }

/* hero visual */
.hero-art { position: relative; }
.hero-art-card {
  background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-md);
  position: relative; overflow: hidden;
}
.qcard-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.qcard-head .subj { color: var(--violet-600); font-weight: 800; }
.qcard-head .cnt { color: var(--muted); font-size: 13px; font-weight: 700; }
.qcard-q { font-weight: 800; font-size: 18px; margin-bottom: 14px; }
.qcard-q .eq { display: block; margin-top: 6px; }
.opt-row {
  display: flex; align-items: center; gap: 12px;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 14px; margin-bottom: 9px;
  font-weight: 600;
}
.opt-row .key {
  width: 26px; height: 26px; border-radius: 8px; background: var(--violet-050);
  color: var(--violet-600); font-weight: 800; display: grid; place-items: center; font-size: 13px; flex: none;
}
.opt-row.correct { border-color: var(--green-500); background: var(--green-100); }
.opt-row.correct .key { background: var(--green-500); color: #fff; }
.opt-row .check { margin-left: auto; color: var(--green-500); }
.income-chip {
  position: absolute; top: 16px; right: 16px; background: var(--card);
  border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow-md); font-size: 12px; width: 150px;
}
.income-chip small { color: var(--muted); }
.income-chip .big { font-size: 22px; font-weight: 800; }
.income-chip .row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.coin { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, var(--gold-300), var(--gold-500)); display: grid; place-items: center; color: #7a4e00; font-weight: 800; font-size: 12px; }

/* ============================================================
   STAT STRIP
   ============================================================ */
.stat-strip {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  display: grid; grid-template-columns: 1fr 1fr 1fr; padding: 30px 10px; margin: 18px 0 40px;
}
.stat { text-align: center; padding: 6px 14px; position: relative; }
.stat + .stat::before { content: ""; position: absolute; left: 0; top: 14%; height: 72%; width: 1px; background: var(--line); }
.stat .ico { width: 50px; height: 50px; margin: 0 auto 12px; border-radius: 14px; background: var(--violet-050); color: var(--violet-600); display: grid; place-items: center; }
.stat .ico svg { width: 26px; height: 26px; }
.stat b { font-size: 26px; display: block; }
.stat span { color: var(--muted); font-size: 14px; }


/* ============================================================
   HEADER
   ============================================================ */
.site-head { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.site-head .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 0; }
.head-logo { height: 42px; width: auto; }
/* admin header (shares the white .site-head band) */
.head-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.head-badge { font-size: 12px; font-weight: 800; color: var(--violet-700); background: var(--violet-050); border: 1.5px solid var(--violet-100); padding: 5px 11px; border-radius: 999px; white-space: nowrap; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.admin-head .btn { padding: 11px 18px; font-size: 15px; }
.head-contact {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--violet-050); color: var(--violet-700); font-weight: 800; font-size: 15px;
  padding: 11px 18px; border-radius: 999px; border: 1.5px solid var(--violet-100);
  transition: background .15s, border-color .15s, transform .12s;
}
.head-contact:hover { background: var(--violet-100); border-color: var(--violet-400); }
.head-contact:active { transform: translateY(1px); }
.head-contact svg { width: 20px; height: 20px; flex: none; }
@media (max-width: 560px) {
  .site-head .container { padding: 12px 0; }
  .head-logo { height: 34px; }
  .head-contact { padding: 10px; }          /* icon-only pill */
  .head-contact .hc-label { display: none; }
}

/* ============================================================
   APP SCREENS (phone / profile / test / result)
   ============================================================ */
.screen { min-height: 100dvh; display: grid; place-items: center; padding: 40px 0 60px; }
.screen-inner { width: min(680px, 92vw); }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 32px; }
.panel h2 { margin: 0 0 6px; font-size: 26px; }
.panel .sub { color: var(--muted); margin: 0 0 24px; }

.field label { font-weight: 800; font-size: 14px; display: block; margin-bottom: 8px; }
.field input, .field select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 14px; padding: 16px;
  font-size: 17px; font-weight: 600; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--violet-400); box-shadow: 0 0 0 4px var(--violet-100); }
.field .hint { color: var(--muted); font-size: 13px; margin-top: 8px; }
.field .err { color: var(--red-500); font-size: 13px; margin-top: 8px; font-weight: 700; }
.field + .field { margin-top: 18px; }

.back-link { background: none; border: 0; color: var(--muted); font-weight: 700; padding: 0; margin-bottom: 16px; display: inline-flex; gap: 6px; align-items: center; }
.back-link:hover { color: var(--violet-600); }

/* format picker */
.format-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; margin-top: 8px; }
.format-opt {
  text-align: center; background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 26px 16px; transition: border-color .12s, box-shadow .12s;
}
.format-opt:hover { border-color: var(--violet-400); box-shadow: 0 0 0 3px var(--violet-100); }
.format-opt .tag { font-size: 12px; font-weight: 800; color: var(--violet-600); background: var(--violet-050); padding: 3px 10px; border-radius: 999px; display: inline-block; margin-bottom: 12px; }
.format-opt b { display: block; font-size: 26px; line-height: 1.1; }
.format-opt span { color: var(--muted); font-size: 14px; font-weight: 700; }

/* profile picker */
.profile-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin-top: 8px; }
.profile-opt {
  text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px; transition: border-color .12s, box-shadow .12s;
}
.profile-opt:hover { border-color: var(--violet-400); }
.profile-opt.active { border-color: var(--violet-500); box-shadow: 0 0 0 3px var(--violet-100); }
.profile-opt .tag { font-size: 12px; font-weight: 800; color: var(--violet-600); background: var(--violet-050); padding: 3px 9px; border-radius: 999px; display: inline-block; margin-bottom: 8px; }
.profile-opt b { display: block; font-size: 15px; }
.profile-opt span { color: var(--muted); font-size: 13px; }
.fixed-subjects { background: var(--violet-050); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 22px; }
.fixed-subjects .t { font-weight: 800; font-size: 14px; margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 700; }
.chip.gold { background: var(--gold-400); border-color: var(--gold-400); color: #3b2a00; }

/* test runner */
.test-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.test-top .subj-tag { font-weight: 800; color: var(--violet-600); background: var(--violet-050); padding: 7px 14px; border-radius: 999px; font-size: 14px; }
.test-progress-wrap { display:flex; align-items:center; gap:12px; margin-bottom: 22px; }
.test-progress { height: 9px; background: var(--violet-100); border-radius: 999px; overflow: hidden; flex: 1; }
.test-progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet-500), var(--violet-400)); border-radius: 999px; transition: width .25s; }
.test-progress-wrap .pct { font-weight: 800; font-size: 13px; color: var(--muted); white-space: nowrap; }
.q-task { color: var(--ink-soft); font-weight: 600; margin-bottom: 4px; }
.q-text { font-size: 22px; font-weight: 800; margin: 0 0 22px; }
.q-text .eq { display:block; margin-top: 8px; font-family: 'Cambria Math', Georgia, serif; }
.answers { display: grid; gap: 12px; }
.answer {
  display: flex; align-items: center; gap: 14px; text-align: left;
  border: 1.5px solid var(--line); border-radius: 14px; padding: 16px; background: #fff; font-size: 16px; font-weight: 600;
}
.answer:hover { border-color: var(--violet-400); }
.answer.selected { border-color: var(--violet-500); background: var(--violet-050); box-shadow: 0 0 0 3px var(--violet-100); }
.answer .key { width: 30px; height: 30px; border-radius: 9px; background: var(--violet-050); color: var(--violet-600); font-weight: 800; display: grid; place-items: center; flex: none; }
.answer.selected .key { background: var(--violet-500); color: #fff; }
.test-nav { display: flex; gap: 12px; margin-top: 26px; }
.timer-box { font-weight: 800; color: var(--violet-700); background: #fff; border:1.5px solid var(--violet-100); padding: 8px 14px; border-radius: 999px; display:inline-flex; gap:8px; align-items:center; font-variant-numeric: tabular-nums; }
.timer-box.warn { color: var(--red-500); border-color: var(--red-100); background: var(--red-100); }

/* result */
.result-screen { text-align: center; }
.score-ring { width: 170px; height: 170px; max-width: 60vw; max-height: 60vw; margin: 4px auto 20px; position: relative; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring .mid { position: absolute; inset: 0; display: grid; place-content: center; }
.score-ring .mid b { font-size: 40px; line-height: 1; }
.score-ring .mid span { color: var(--muted); font-size: 14px; }
.reward-banner {
  background: linear-gradient(120deg, var(--gold-400), var(--gold-500)); color: #3b2a00;
  border-radius: var(--radius-sm); padding: 18px; margin: 6px 0 24px; font-weight: 800;
}
.reward-banner .amt { font-size: 30px; display: block; }
.result-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.result-stats .rs { background: #faf9ff; border-radius: 14px; padding: 16px; }
.result-stats .rs b { font-size: 24px; display: block; }
.result-stats .rs.ok b { color: var(--green-500); }
.result-stats .rs.no b { color: var(--red-500); }
.result-stats .rs span { color: var(--muted); font-size: 13px; }
.result-actions { display: grid; gap: 12px; }
.subj-breakdown { text-align:left; margin: 8px 0 24px; }
.subj-breakdown .sb-row { display:flex; align-items:center; gap:12px; padding: 10px 0; border-top:1px solid var(--line); }
.subj-breakdown .sb-row .nm { font-weight:700; flex:1; }
.subj-breakdown .sb-row .sc { font-weight:800; }

/* ============================================================
   ADMIN
   ============================================================ */
.admin-shell { min-height: 100dvh; }
.admin-main { padding: 30px 0 60px; }
.admin-login { display:grid; place-items:center; min-height: calc(100dvh - 68px); }

.admin-stats { display:grid; grid-template-columns: repeat(4,1fr); gap:14px; margin-bottom: 24px; }
.astat { background: var(--card); border-radius: var(--radius-sm); padding: 18px; box-shadow: var(--shadow-sm); }
.astat b { font-size: 28px; display:block; }
.astat span { color: var(--muted); font-size: 13px; }

.admin-search { position: relative; margin-bottom: 18px; }
.admin-search input { width:100%; border:1.5px solid var(--line); border-radius: 14px; padding: 15px 15px 15px 46px; font-size:16px; background:#fff; }
.admin-search input:focus { outline:none; border-color: var(--violet-400); box-shadow: 0 0 0 4px var(--violet-100); }
.admin-search svg { position:absolute; left:15px; top:50%; transform: translateY(-50%); color: var(--muted); }

.table-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow-x: auto; }
table.attempts { width:100%; border-collapse: collapse; }
table.attempts th, table.attempts td { white-space: nowrap; }
table.attempts th, table.attempts td { text-align:left; padding: 15px 18px; font-size: 14px; }
table.attempts thead th { background: #faf9ff; color: var(--muted); font-weight: 800; text-transform: uppercase; font-size: 12px; letter-spacing: .04em; }
table.attempts tbody tr { border-top: 1px solid var(--line); cursor: pointer; transition: background .1s; }
table.attempts tbody tr:hover { background: var(--violet-050); }
table.attempts .phone-cell { font-weight: 800; color: var(--violet-700); }
.pill { display:inline-block; padding: 4px 11px; border-radius:999px; font-size:12px; font-weight:800; }
.pill.green { background: var(--green-100); color: #15803d; }
.pill.amber { background: #fef3c7; color: #b45309; }
.pill.red { background: var(--red-100); color: #b91c1c; }
.empty-state { padding: 50px; text-align:center; color: var(--muted); }

/* drawer / detail */
.drawer-back { position: fixed; inset: 0; background: rgba(30,27,58,.45); backdrop-filter: blur(2px); z-index: 60; }
.drawer { position: fixed; top:0; right:0; height:100%; width: min(560px, 96vw); background: var(--bg); z-index: 61; box-shadow: var(--shadow-lg); overflow-y:auto; }
.drawer-head { position: sticky; top:0; background: var(--violet-700); color:#fff; padding: 22px 24px; display:flex; align-items:center; justify-content:space-between; }
.drawer-head h3 { margin:0; font-size: 22px; }
.drawer-head .x { background: rgba(255,255,255,.15); color:#fff; border:0; width:36px; height:36px; border-radius: 10px; font-size: 18px; }
.drawer-body { padding: 24px; }
.detail-meta { display:grid; grid-template-columns: 1fr 1fr; gap:12px; margin-bottom: 20px; }
.detail-meta .dm { background:#fff; border-radius: 12px; padding: 14px; box-shadow: var(--shadow-sm); }
.detail-meta .dm span { color: var(--muted); font-size:12px; display:block; }
.detail-meta .dm b { font-size: 17px; }
.attempt-block { background:#fff; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); margin-bottom: 16px; overflow:hidden; }
.attempt-block .ab-head { width:100%; padding: 16px 18px; display:flex; justify-content:space-between; align-items:center; gap:12px; border:0; border-bottom:1px solid var(--line); background:none; font:inherit; color:inherit; text-align:left; cursor:pointer; }
.attempt-block .ab-head:hover { background: var(--violet-050); }
.attempt-block .ab-head-main { min-width:0; }
.attempt-block .ab-head b { font-size: 15px; }
.attempt-block .ab-head small { color: var(--muted); }
.qa-item { padding: 14px 18px; border-top: 1px solid var(--line); }
.qa-item .qa-subj { font-size: 12px; font-weight: 800; color: var(--violet-600); }
.qa-item .qa-q { font-weight: 700; margin: 4px 0 8px; }
.qa-item .qa-ans { display:flex; gap:8px; align-items:flex-start; font-size: 14px; margin: 3px 0; }
.qa-item .qa-ans .lbl { color: var(--muted); width: 96px; flex:none; }
.qa-item .qa-ans.good .val { color: #15803d; font-weight: 700; }
.qa-item .qa-ans.bad .val { color: #b91c1c; font-weight: 700; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing:.05em; color: var(--muted); font-weight:800; margin: 6px 0 12px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 880px) {
  .hero-grid { grid-template-columns: 1.05fr .95fr; align-items: center; }
}
@media (max-width: 879px) {
  .admin-stats { grid-template-columns: 1fr 1fr; }
}

/* tablets & large phones */
@media (max-width: 720px) {
  .screen { min-height: 100dvh; padding: 28px 0 48px; }
  .hero { padding: 30px 0 22px; }
  .hero-grid { gap: 24px; }
  .hero h1 { margin-bottom: 18px; }
  .stat-strip { padding: 24px 10px; margin: 14px 0 32px; }
}

/* phones */
@media (max-width: 560px) {
  .hero-badges { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .format-grid { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: 1fr; gap: 16px; padding: 20px 14px; }
  .stat { padding: 6px 8px; }
  .stat + .stat::before { display: none; }
  .stat + .stat { border-top: 1px solid var(--line); padding-top: 16px; }
  .panel { padding: 22px; }
  .income-chip { display: none; }
  .btn-lg { font-size: 18px; padding: 16px; }
  .hero-cta { margin-top: 22px; }
  .hero-cta .btn { width: 100%; }
  .hero p.lead { font-size: 17px; margin-bottom: 22px; }
  .q-text { font-size: 20px; }
  .test-top .subj-tag { font-size: 13px; padding: 6px 11px; }
  /* admin */
  .admin-main { padding: 22px 0 48px; }
  .admin-stats { gap: 10px; }
  .astat { padding: 14px; }
  .astat b { font-size: 22px; }
  .admin-login { min-height: calc(100dvh - 60px); }
  table.attempts th:nth-child(3), table.attempts td:nth-child(3) { display: none; }
  .admin-head .head-badge { display: none; }
  .admin-head .head-logo { height: 30px; }
  .admin-head .head-actions { gap: 8px; }
  .admin-head .btn { padding: 9px 13px; font-size: 13px; }
}

/* small phones */
@media (max-width: 380px) {
  .hero h1 { font-size: 36px; }
  .panel { padding: 18px; }
  .profile-opt { padding: 14px; }
  .answer { padding: 14px; font-size: 15px; gap: 12px; }
  .answer .key { width: 28px; height: 28px; }
  .test-nav { gap: 8px; }
  .test-nav .btn { padding: 14px 14px; }
  .reward-banner .amt { font-size: 26px; }
  .admin-stats { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   ACCESSIBILITY & SAFEGUARDS
   ============================================================ */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* visible keyboard focus */
.btn:focus-visible,
.answer:focus-visible,
.profile-opt:focus-visible,
.back-link:focus-visible,
.drawer .x:focus-visible,
.attempt-block .ab-head:focus-visible,
.field input:focus-visible,
#search:focus-visible {
  outline: 3px solid var(--violet-400); outline-offset: 2px;
}
table.attempts tbody tr:focus-visible { outline: 2px solid var(--violet-500); outline-offset: -2px; }
/* flow screens receive focus on transition but should not show a ring */
#view-landing:focus, .screen:focus, .drawer:focus { outline: none; }

/* non-color cue for the low-time warning (WCAG 1.4.1) */
.timer-box.warn::after { content: "⚠"; }

/* ============================================================
   REAL TEST UI — subject tabs + question grid + bank HTML
   ============================================================ */
.screen-inner-test { width: min(880px, 94vw); }
#view-test.screen { align-items: start; }
.test-panel { padding: 24px; }

/* subject tabs */
.subject-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 14px; }
.subj-tab {
  flex: 0 0 auto; min-width: 96px; border: 1.5px solid var(--line); background: #fff;
  border-radius: 12px; padding: 9px 14px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 2px;
}
.subj-tab .st-name { font-weight: 800; font-size: 13px; color: var(--ink); white-space: nowrap; }
.subj-tab .st-count { font-size: 11px; font-weight: 700; color: var(--muted); }
.subj-tab:hover { border-color: var(--violet-400); }
.subj-tab.active { background: var(--violet-500); border-color: var(--violet-500); }
.subj-tab.active .st-name { color: #fff; }
.subj-tab.active .st-count { color: rgba(255,255,255,.85); }

/* question-number grid */
.qnav { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.qnum {
  width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid var(--line);
  background: #fff; font-weight: 800; font-size: 14px; color: var(--ink-soft); cursor: pointer;
  font-variant-numeric: tabular-nums; transition: background .1s, border-color .1s;
}
.qnum:hover { border-color: var(--violet-400); }
.qnum.answered { background: var(--violet-050); border-color: var(--violet-400); color: var(--violet-600); }
.qnum.current { border-color: var(--violet-500); box-shadow: 0 0 0 3px var(--violet-100); color: var(--violet-700); }
.qnum.answered.current { background: var(--violet-500); color: #fff; }

/* reading passage */
.q-passage {
  background: #faf9ff; border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 18px; margin-bottom: 16px; max-height: 340px; overflow-y: auto;
  font-size: 15px; line-height: 1.6;
}

/* normalize HTML rendered from the question bank */
.q-text { font-size: 19px; font-weight: 700; margin: 4px 0 20px; }
.q-text, .q-passage, .opt-body { overflow-wrap: anywhere; }
.q-text p, .q-passage p, .opt-body p { margin: 0 0 6px; }
.q-text p:last-child, .q-passage p:last-child, .opt-body p:last-child { margin-bottom: 0; }
.q-text img, .q-passage img, .opt-body img, .qa-q img, .qa-item .val img { max-width: 100%; height: auto; border-radius: 8px; }
.q-text figure, .opt-body figure { margin: 8px 0; }
.q-text table, .q-passage table, .opt-body table { border-collapse: collapse; max-width: 100%; }
.q-text td, .q-text th, .q-passage td, .q-passage th { border: 1px solid var(--line); padding: 4px 8px; }
.answer .opt-body { flex: 1; font-weight: 600; }
.answer .opt-body p { font-weight: 600; }

/* admin: render question/option HTML inline-ish */
.qa-q p { margin: 2px 0; }
.qa-item .val p { display: inline; margin: 0; }

@media (max-width: 560px) {
  .test-panel { padding: 18px; }
  .qnum { width: 34px; height: 34px; font-size: 13px; }
  .subj-tab { min-width: 84px; padding: 8px 11px; }
  .q-text { font-size: 18px; }
}
