/* =========================================================
   База
   ========================================================= */
* { box-sizing: border-box; }
body {
  font: 15px/1.5 system-ui, -apple-system, Arial, sans-serif;
  background: #f4f6fa;
  margin: 0;
  color: #222;
  -webkit-text-size-adjust: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  flex: 1 0 auto;
  width: 100%;
}
.card {
  background: #fff;
  border-radius: 12px;
  padding: 24px 28px;
  box-shadow: 0 4px 20px rgba(0,0,0,.06);
}
.card.narrow { max-width: 520px; margin: 40px auto; }
.card.wide   { max-width: 1100px; margin: 20px auto; }

h1 { margin-top: 0; }
section {
  margin: 20px 0;
  padding-top: 12px;
  border-top: 1px solid #eef0f6;
}

label { display: block; margin: 10px 0; }
label.inline { display: inline-block; margin-right: 16px; }
input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccd;
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
input[type=checkbox], input[type=radio] { width: auto; }

.btn {
  display: inline-block;
  padding: 9px 16px;
  border: 0;
  border-radius: 8px;
  background: #eef1f7;
  color: #222;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  text-align: center;
}
.btn.primary { background: #2b6cff; color: #fff; }
.btn.danger  { background: #d33;    color: #fff; }
.btn.big     { padding: 12px 22px; margin-top: 12px; }
.btn.full    { display: block; width: 100%; text-align: center; margin: 14px 0; padding: 14px 20px; }

button.link {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.inline { gap: 6px; }
.row input, .row select { width: auto; min-width: 160px; }

table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { padding: 8px 10px; border-bottom: 1px solid #eee; text-align: left; }

.error { color: #a11; background: #fee; padding: 8px 12px; border-radius: 8px; }
.ok    { color: #1a6b1a; background: #e7f8e7; padding: 8px 12px; border-radius: 8px; }
.muted { color: #667; }
.score { font-size: 22px; }
hr { border: 0; border-top: 1px solid #eef0f6; margin: 20px 0; }
.inline { display: inline; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  background: #e6efff;
  color: #2b6cff;
  border-radius: 999px;
  font-size: 12px;
  margin-left: 6px;
}
.preview {
  border: 1px solid #e3e6ee;
  border-radius: 6px;
  margin-top: 6px;
}

/* Картинки в вопросах */
.q-img { max-width: 100%; max-height: 260px; display: block; margin: 8px 0; border-radius: 8px; }
.a-img { max-height: 60px; vertical-align: middle; margin-left: 8px; border-radius: 6px; }

/* Блоки вопросов */
.question, .question-edit {
  padding: 14px;
  margin: 14px 0;
  border: 1px solid #e3e6ee;
  border-radius: 10px;
  background: #fbfcff;
}
.answer { display: block; padding: 6px 0; }
.answer-edit {
  display: grid;
  grid-template-columns: 24px 1fr 1fr;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
}
fieldset { border: 1px solid #e3e6ee; border-radius: 10px; margin: 10px 0; padding: 10px; }

/* Таймер */
.timer {
  font-size: 18px;
  background: #fff5e0;
  padding: 8px 12px;
  border-radius: 8px;
  display: inline-block;
}
.timer b { color: #b60; }

/* Запрет выделения */
.no-select {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* =========================================================
   Верхняя панель
   ========================================================= */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 0 12px;
  border-bottom: 1px solid #e3e6ee;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
  color: inherit;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
}
.brand-link .ico { color: #2b6cff; }
.brand-link.active { background: #eef1f7; color: #2b6cff; }

.userbox {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 14px;
}
.userbox a,
.userbox button.link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  color: #333;
  text-decoration: none;
  background: transparent;
  border: 0;
  font: inherit;
  cursor: pointer;
  line-height: 1;
}
.userbox a:hover,
.userbox button.link:hover { background: #eef1f7; color: #2b6cff; }
.userbox a.active { background: #2b6cff; color: #fff; }
.userbox a.active .ico { color: #fff; opacity: 1; }
.userbox a.active:hover { background: #1e5ae0; color: #fff; }
.userbox .ico { flex: 0 0 auto; color: #2b6cff; opacity: .9; }
.userbox .user-name { background: #eef1f7; }
.userbox .user-name.active { background: #2b6cff; color: #fff; }
.userbox .user-name.active .ico { color: #fff; opacity: 1; }
.userbox .user-name span {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-badge {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #d33;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 700;
  margin-left: 4px;
}
.userbox a.active .nav-badge { background: #fff; color: #2b6cff; }

/* =========================================================
   Футер
   ========================================================= */
.site-footer {
  background: #fff;
  border-top: 1px solid #e3e9fb;
  margin-top: 32px;
  padding: 22px 0;
  flex-shrink: 0;
}

.site-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 24px;
  align-items: center;
}

.site-footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.site-footer-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #eef3ff;
  color: #2b6cff;
  flex: 0 0 auto;
}
.site-footer-brand-text { min-width: 0; }
.site-footer-title {
  font-weight: 700;
  font-size: 15px;
  color: #16213e;
  line-height: 1.2;
}
.site-footer-subtitle {
  font-size: 12.5px;
  color: #667;
  margin-top: 2px;
}

.site-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  align-items: center;
  justify-content: center;
}
.site-footer-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  color: #45506a;
  font-size: 13.5px;
  text-decoration: none;
  transition: background .12s, color .12s;
}
.site-footer-nav a .ico { color: #2b6cff; opacity: .85; transition: transform .12s; }
.site-footer-nav a:hover {
  background: #f2f6ff;
  color: #2b6cff;
}
.site-footer-nav a:hover .ico { transform: translateY(-1px); }

.site-footer-copy {
  text-align: right;
  color: #98a2b3;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: nowrap;
}
.site-footer-copy-line {
  font-size: 12.5px;
}
.site-footer-author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: #5a6b8f;
  font-size: 12.5px;
}
.site-footer-author .ico {
  color: #2b6cff;
  opacity: 0.85;
  flex: 0 0 auto;
}
.site-footer-author b {
  color: #16213e;
  font-weight: 600;
}

/* =========================================================
   Тосты
   ========================================================= */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
  padding: 12px 14px;
  border-left: 4px solid #2b6cff;
  font-size: 14px;
  animation: toast-in .25s ease;
}
.toast-ok    { border-left-color: #1a8a1a; }
.toast-error { border-left-color: #d33; }
.toast-info  { border-left-color: #2b6cff; }
.toast-icon { font-size: 18px; line-height: 1; }
.toast-message { flex: 1; }
.toast-close {
  background: none;
  border: 0;
  font-size: 20px;
  line-height: 1;
  color: #999;
  cursor: pointer;
  padding: 0 4px;
}
.toast-close:hover { color: #333; }
.toast-hide {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .35s, transform .35s;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* =========================================================
   Пагинация
   ========================================================= */
.pager a,
.pager span {
  display: inline-block;
  padding: 5px 10px;
  margin: 2px;
  border: 1px solid #ccd;
  border-radius: 6px;
  text-decoration: none;
  color: #333;
  background: #fff;
}
.pager a.active { background: #2b6cff; color: #fff; border-color: #2b6cff; }
.pager a:hover { background: #eef1f7; }
.pager a.active:hover { background: #1e5ae0; }

table th a { color: inherit; text-decoration: none; }
table th a:hover { color: #2b6cff; }

/* =========================================================
   Дашборд
   ========================================================= */
.dashboard .stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 12px 0 6px;
}
.stat-card {
  background: #f7f9ff;
  border: 1px solid #e3e9fb;
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
  transition: transform .12s ease, box-shadow .12s ease;
}
.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(43,108,255,.08);
}
.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
  color: #2b6cff;
  line-height: 1.1;
}
.stat-card .stat-label {
  color: #667;
  font-size: 13px;
  margin-top: 4px;
}
.stat-card-warn {
  background: #fff5e0;
  border-color: #f0d0a0;
}
.stat-card-warn .stat-value { color: #b60; }

/* =========================================================
   Прогресс-бар
   ========================================================= */
.progress-bar-wrap { margin: 12px 0 16px; }
.progress-bar-info { font-size: 14px; color: #445; margin-bottom: 6px; }
.progress-bar {
  height: 8px;
  background: #eef1f7;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0;
  background: #2b6cff;
  transition: width .25s ease;
}

/* =========================================================
   Модалка
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20,25,40,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  max-width: 460px;
  width: calc(100% - 40px);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-box h3 { margin-top: 0; }

/* =========================================================
   Предпросмотр теста
   ========================================================= */
.preview-banner {
  background: #fff5e0;
  border-left: 4px solid #b60;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}
.preview-question {
  background: #fbfcff;
  border: 1px dashed #b8c4e8;
}
.badge.ok-badge  { background: #d9f7d9; color: #1a6b1a; }
.badge.err-badge { background: #fee;    color: #a11; }

/* =========================================================
   Разбор попытки (учитель)
   ========================================================= */
.attempt-header {
  background: #f7f9ff;
  border: 1px solid #e3e9fb;
  border-radius: 10px;
  padding: 14px 18px;
  margin: 12px 0 20px;
}
.attempt-row { display: flex; gap: 8px; padding: 3px 0; font-size: 14px; }
.attempt-row > span:first-child { color: #667; min-width: 160px; }
.attempt-row .big-score { font-size: 18px; color: #2b6cff; }

.attempt-question {
  border: 1px solid #e3e6ee;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 12px 0;
  background: #fbfcff;
}
.attempt-qscore { float: right; font-size: 13px; color: #2b6cff; }
.attempt-answers { list-style: none; padding: 0; margin: 8px 0 0; }
.attempt-answers li { padding: 6px 8px; border-radius: 6px; margin: 3px 0; }
.attempt-answers .mark { display: inline-block; width: 22px; }
.attempt-answers li.chosen-correct { background: #e7f8e7; }
.attempt-answers li.chosen-wrong   { background: #fee; }
.attempt-answers li.was-correct    { background: #fff9e6; }

/* =========================================================
   Финальный экран ученика
   ========================================================= */
.result-page { max-width: 720px; margin: 20px auto; }
.result-card {
  background: #fff;
  border-radius: 16px;
  padding: 28px 32px;
  box-shadow: 0 8px 32px rgba(0,0,0,.08);
}
.result-header { text-align: center; margin-bottom: 16px; }
.result-header h1 { margin: 0 0 6px; }
.result-subtitle { color: #667; margin: 0; }

.result-circle {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 20px auto;
}
.result-ring { width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: #eef1f7; stroke-width: 10; }
.ring-fill {
  fill: none;
  stroke: #2b6cff;
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dasharray .6s ease;
}
.result-circle-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.result-pct { font-size: 34px; font-weight: 700; color: #222; line-height: 1; }
.result-score { font-size: 14px; color: #667; margin-top: 4px; }

.result-high .ring-fill { stroke: #2eaa4a; }
.result-high .result-pct { color: #2eaa4a; }
.result-mid  .ring-fill { stroke: #2b6cff; }
.result-mid  .result-pct { color: #2b6cff; }
.result-low  .ring-fill { stroke: #e0a020; }
.result-low  .result-pct { color: #e0a020; }
.result-fail .ring-fill { stroke: #d33; }
.result-fail .result-pct { color: #d33; }

.result-mood { text-align: center; font-size: 42px; margin: 6px 0 4px; }
.result-grade { text-align: center; font-size: 18px; color: #333; margin: 4px 0 12px; }
.result-grade b { color: #2b6cff; font-size: 22px; }

.result-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  background: #f7f9ff;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
}
.result-meta > div span { color: #667; margin-right: 6px; }

.result-details { margin-top: 12px; }
.result-question {
  border-radius: 10px;
  padding: 12px 16px;
  margin: 10px 0;
  border-left: 4px solid #ccd;
  background: #fafbff;
}
.result-question.q-correct { border-left-color: #2eaa4a; }
.result-question.q-wrong   { border-left-color: #d33; }
.result-question h3 { margin: 0 0 6px; font-size: 15px; }
.result-question .q-mark { float: right; font-size: 13px; color: #667; }

.result-answers { list-style: none; padding: 0; margin: 8px 0 0; }
.result-answers li { padding: 4px 8px; border-radius: 6px; margin: 2px 0; font-size: 14px; }
.result-answers .mark { display: inline-block; width: 22px; }
.result-answers li.chosen-correct { background: #e7f8e7; }
.result-answers li.chosen-wrong   { background: #fee; }
.result-answers li.was-correct    { background: #fff9e6; }

.result-hidden { text-align: center; padding: 30px 20px; }
.result-hidden-icon { font-size: 60px; margin-bottom: 10px; }
.result-hidden-text { font-size: 16px; color: #333; }

.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 22px;
}

/* =========================================================
   Лог ошибок
   ========================================================= */
.error-log {
  background: #1a1d24;
  color: #d5dae5;
  padding: 14px 16px;
  border-radius: 10px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  max-height: 600px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Лог: отображение diff */
.log-change {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.5;
  background: #f7f9ff;
  padding: 6px 8px;
  border-radius: 6px;
  border-left: 3px solid #2b6cff;
}
.log-old { color: #b60; text-decoration: line-through; }
.log-new { color: #1a6a1a; font-weight: 600; }

/* =========================================================
   Компактные иконки в таблицах
   ========================================================= */
.actions-cell { text-align: right; white-space: nowrap; }
.icon-actions { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 15px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.icon-btn:hover { background: #eef1f7; border-color: #dde2ee; }
.icon-btn.icon-danger:hover { background: #fee; border-color: #f3c2c2; }

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #dde2ee;
  background: #fff;
  color: #333;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.action-btn:hover {
  background: #eef1f7;
  border-color: #b8c8f0;
  color: #2b6cff;
}
.action-btn svg { flex: 0 0 auto; }
.action-btn-primary {
  background: #2b6cff;
  border-color: #2b6cff;
  color: #fff;
}
.action-btn-primary:hover {
  background: #1e5ae0;
  border-color: #1e5ae0;
  color: #fff;
}
.action-btn-danger {
  color: #a11;
  border-color: #f3c2c2;
}
.action-btn-danger:hover {
  background: #fee;
  border-color: #e79a9a;
  color: #a11;
}

/* =========================================================
   Выпадающий список чекбоксов
   ========================================================= */
.checkbox-dropdown {
  display: inline-block;
  position: relative;
  margin: 6px 0;
}
.checkbox-dropdown > summary {
  cursor: pointer;
  padding: 8px 12px;
  background: #eef1f7;
  border: 1px solid #ccd;
  border-radius: 8px;
  user-select: none;
  list-style: none;
}
.checkbox-dropdown > summary::-webkit-details-marker { display: none; }
.checkbox-dropdown > summary::after { content: ' ▾'; }
.checkbox-dropdown[open] > summary::after { content: ' ▴'; }
.checkbox-list {
  border: 1px solid #ccd;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  padding: 10px 14px;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  min-width: 240px;
}
.checkbox-list .inline { display: block; margin: 4px 0; }

/* =========================================================
   Match-grid (формы сопоставления)
   ========================================================= */
.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.match-grid h4 { margin: 0 0 6px; font-size: 14px; color: #667; }
.match-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin: 4px 0;
}
.match-row select { max-width: 140px; }

/* Прохождение match-вопроса учеником */
.match-answers { margin: 8px 0; }
.match-answer-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
  margin: 6px 0;
}
.match-left {
  font-weight: 500;
  padding: 6px 10px;
  background: #f7f9ff;
  border-radius: 6px;
}
.match-answer-row select { width: 100%; }

/* =========================================================
   Печать
   ========================================================= */
.only-print { display: none; }

@media print {
  body { background: #fff; }
  .topbar,
  .no-print,
  form.row,
  a.btn,
  button,
  .toast-container,
  .site-footer { display: none !important; }

  .card,
  .card.wide,
  .card.narrow {
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    max-width: none;
  }

  .only-print { display: block !important; }
  .print-header { margin-bottom: 12px; }
  .print-header h1 { margin: 0 0 4px; font-size: 18px; }
  .print-header p { margin: 2px 0; font-size: 12px; }

  table.printable {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
  }
  table.printable th,
  table.printable td {
    border: 1px solid #444;
    padding: 4px 6px;
  }
  table.printable th {
    background: #eee !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .result-page { margin: 0; }
  .result-card { box-shadow: none; padding: 0; }
  .result-actions { display: none !important; }
  .result-circle { margin: 10px auto; }
  .result-meta { background: none; padding: 0; }

  @page { size: A4; margin: 12mm; }
}

/* =========================================================
   Мобильная адаптация
   ========================================================= */
@media (max-width: 900px) {
  .site-footer-inner {
    grid-template-columns: 1fr;
    gap: 14px;
    text-align: center;
  }
  .site-footer-brand { justify-content: center; }
  .site-footer-nav {
    justify-content: center;
    gap: 4px 8px;
  }
  .site-footer-nav a { font-size: 13px; padding: 5px 8px; }
  .site-footer-copy {
    text-align: center;
    white-space: normal;
  }
  .site-footer-author { justify-content: center; }
}

@media (max-width: 720px) {
  .wrap { padding: 12px; }
  .card { padding: 16px; border-radius: 10px; }
  .card.wide, .card.narrow { max-width: none; margin: 12px auto; }

  h1 { font-size: 22px; }
  h2 { font-size: 18px; }

  /* Шапка: скрываем подписи, оставляем иконки */
  .userbox a span,
  .userbox button.link span { display: none; }
  .userbox a,
  .userbox button.link { padding: 8px; }
  .brand-link span { display: none; }

  /* Кнопки на всю ширину */
  .btn.big,
  .btn.full,
  form > button.btn.primary,
  .result-actions .btn {
    width: 100%;
    text-align: center;
    padding: 14px 16px;
    font-size: 16px;
  }
  .row { gap: 6px; }
  .row > .btn,
  .row > form > .btn { width: auto; }

  /* Поля ввода */
  input, select, textarea {
    width: 100%;
    font-size: 16px;
    padding: 10px 12px;
  }

  /* Таблицы в карточки */
  table.responsive {
    display: block;
    border-collapse: collapse;
    margin-top: 8px;
  }
  table.responsive thead { display: none; }
  table.responsive tbody,
  table.responsive tr,
  table.responsive td {
    display: block;
    width: 100%;
  }
  table.responsive tr {
    background: #fff;
    border: 1px solid #e3e6ee;
    border-radius: 10px;
    padding: 10px 12px;
    margin: 10px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
  }
  table.responsive td {
    border: 0;
    padding: 4px 0;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 14px;
    align-items: center;
  }
  table.responsive td::before {
    content: attr(data-label);
    color: #667;
    font-weight: 500;
    flex: 0 0 auto;
    padding-right: 10px;
  }
  table.responsive td:not([data-label])::before,
  table.responsive td[data-label=""]::before { content: none; }
  table.responsive td.no-print { display: none; }

  /* Дашборд */
  .dashboard .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
  }
  .stat-card { padding: 10px 8px; }
  .stat-card .stat-value { font-size: 20px; }
  .stat-card .stat-label { font-size: 11px; }

  /* Прогресс-бар */
  .progress-bar-wrap { margin: 10px 0 12px; }

  /* Тосты — снизу на всю ширину */
  .toast-container {
    top: auto;
    bottom: 12px;
    left: 12px;
    right: 12px;
    max-width: none;
  }

  /* Модалка */
  .modal-box { width: calc(100% - 24px); padding: 16px 18px; }

  /* Разбор попытки */
  .attempt-row { flex-direction: column; gap: 2px; }
  .attempt-row > span:first-child { min-width: 0; }
  .attempt-qscore { float: none; display: block; margin-top: 4px; }

  /* Финальный экран */
  .result-page { margin: 12px auto; }
  .result-card { padding: 18px 16px; border-radius: 12px; }
  .result-circle { width: 140px; height: 140px; }
  .result-pct { font-size: 28px; }
  .result-mood { font-size: 34px; }
  .result-meta { grid-template-columns: 1fr; padding: 10px 12px; }
  .result-question { padding: 10px 12px; }
  .result-actions { flex-direction: column; }

  /* Иконки-кнопки */
  .action-btn span { display: none; }
  .action-btn { padding: 8px 10px; }
  .actions-cell { text-align: left; }

  /* Match */
  .match-grid { grid-template-columns: 1fr; }
  .match-answer-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  h1 { font-size: 20px; }
  .stat-card .stat-value { font-size: 18px; }
  .result-circle { width: 120px; height: 120px; }
  .result-pct { font-size: 24px; }

  .site-footer { padding: 16px 0; }
  .site-footer-inner { padding: 0 16px; gap: 12px; }
  .site-footer-logo { width: 36px; height: 36px; }
  .site-footer-title { font-size: 14px; }
  .site-footer-nav a span { display: none; }
  .site-footer-nav a { padding: 7px 10px; }
  .site-footer-nav a .ico { width: 16px; height: 16px; }
  .site-footer-author { font-size: 11.5px; }
  .site-footer-author b { font-size: 12px; }
}
/* Логотип в шапке и футере */
.brand-logo-svg {
  flex: 0 0 auto;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(43,108,255,.12));
  transition: transform .15s ease;
}
.brand-link:hover .brand-logo-svg {
  transform: translateY(-1px) rotate(-2deg);
}

/* Логотип в футере */
.site-footer-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #eef3ff;
  flex: 0 0 auto;
}
.site-footer-logo .brand-logo-svg {
  filter: none;
}

/* Адаптив */
@media (max-width: 720px) {
  .brand-logo-svg {
    width: 26px !important;
    height: 26px !important;
  }
  .site-footer-logo {
    width: 36px;
    height: 36px;
  }
  .site-footer-logo .brand-logo-svg {
    width: 24px !important;
    height: 24px !important;
  }
}