/* =========================================================================
   ПЕРЕМЕННЫЕ ТЕМ. Светлая тема — :root, тёмная — [data-theme="dark"].
   Меняя значения здесь, можно быстро перекрасить всю игру.
   ========================================================================= */
:root {
  --bg: #eef1fb;
  --bg-gradient: radial-gradient(circle at 15% 0%, #e5dcff 0%, transparent 45%),
    radial-gradient(circle at 85% 10%, #d8ecff 0%, transparent 45%);
  --panel: #ffffff;
  --panel-soft: #f6f7ff;
  --ink: #1f2440;
  --muted: #6b7280;
  --line: #e2e5f1;
  --brand: #6d28d9;
  --brand-soft: #ede9fe;
  --brand-ink: #5b21b6;
  --accent: #f59e0b;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --ok-line: #4ade80;
  --ok-fill: #15803d;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --bad-line: #f87171;
  --bad-fill: #b91c1c;
  --warn: #a16207;
  --warn-bg: #fef9c3;
  --warn-line: #facc15;
  --zone: #fbfbff;
  --shadow: 0 18px 40px rgba(31, 36, 64, 0.12);
  --shadow-sm: 0 6px 14px rgba(31, 36, 64, 0.1);
  --radius-lg: 26px;
  --radius: 16px;
  --radius-sm: 12px;
}

[data-theme="dark"] {
  --bg: #0e1120;
  --bg-gradient: radial-gradient(circle at 15% 0%, #2a1f52 0%, transparent 45%),
    radial-gradient(circle at 85% 10%, #10294a 0%, transparent 45%);
  --panel: #171b2e;
  --panel-soft: #1e2340;
  --ink: #e9ecff;
  --muted: #9aa2c0;
  --line: #2b3252;
  --brand: #a78bfa;
  --brand-soft: #2a2350;
  --brand-ink: #c4b5fd;
  --accent: #fbbf24;
  --ok: #86efac;
  --ok-bg: #10361f;
  --ok-line: #22c55e;
  --ok-fill: #16a34a;
  --bad: #fca5a5;
  --bad-bg: #3d1414;
  --bad-line: #ef4444;
  --bad-fill: #dc2626;
  --warn: #fde68a;
  --warn-bg: #3a2f08;
  --warn-line: #eab308;
  --zone: #12162a;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 6px 14px rgba(0, 0, 0, 0.4);
}

/* ============================ БАЗА ============================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  padding: 18px clamp(12px, 3vw, 34px) 34px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

button {
  font-family: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ============================ ШАПКА ============================ */
.topbar {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  white-space: nowrap;
}

.brand-icon {
  font-size: 24px;
}

.topbar-progress {
  flex: 1 1 240px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 180px;
}

.progress-track {
  position: relative;
  flex: 1;
  height: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #22d3ee);
  transition: width 0.45s ease;
}

.progress-counter {
  font-weight: 800;
  font-size: 15px;
  color: var(--brand-ink);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: var(--panel-soft);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.icon-btn:hover {
  transform: translateY(-2px);
  background: var(--brand-soft);
}

.icon-btn:active {
  transform: translateY(0);
}

/* ==================== ВЫБОР ЗАДАНИЯ: КЛАСС И НОМЕР ==================== */
.level-nav {
  max-width: 1240px;
  margin: 16px auto 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.grade-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.grade-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  background: var(--panel-soft);
  border: 2px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease,
    color 0.15s ease;
}

.grade-btn:hover {
  transform: translateY(-2px);
  background: var(--brand-soft);
}

.grade-btn:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

/* класс, задания которого раскрыты */
.grade-btn.open {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand-ink);
}

.grade-count {
  font-size: 13px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
  color: var(--brand-ink);
  background: var(--brand-soft);
}

.grade-btn.open .grade-count {
  color: #fff;
  background: rgba(255, 255, 255, 0.25);
}

.task-row-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.task-row-label {
  font-size: 14px;
  color: var(--muted);
}

.task-row-label[hidden] {
  display: none;
}

.task-row {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 2px;
  scrollbar-width: thin;
}

.task-row[hidden] {
  display: none;
}

.station {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  color: var(--muted);
  background: var(--panel-soft);
  border: 2px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.station:hover {
  transform: translateY(-2px);
}

.station.active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand-ink);
  box-shadow: 0 0 0 5px var(--brand-soft);
  transform: scale(1.08);
}

.station.done {
  color: #fff;
  background: var(--ok-fill);
  border-color: var(--ok-line);
}

/* задание проверено, но ответ неполный или с ошибкой */
.station.failed {
  color: #fff;
  background: var(--bad-fill);
  border-color: var(--bad-line);
}

/* галочка у пройденного задания */
.station.done::after {
  content: "✓";
  position: absolute;
  top: -5px;
  right: -5px;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 900;
  color: #fff;
  background: var(--ok-fill);
  border: 2px solid var(--panel);
  border-radius: 50%;
}

.station.future {
  color: var(--muted);
  background: var(--panel-soft);
  border-color: var(--line);
  opacity: 0.75;
}

/* ============================ ПОЛЕ ============================ */
.board {
  max-width: 1240px;
  margin: 18px auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel-text {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 18px;
}

.level-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.level-badge {
  align-self: flex-start;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--brand-ink);
  background: var(--brand-soft);
  border: 1px dashed var(--brand);
  border-radius: 999px;
  padding: 5px 14px;
}

.level-title {
  margin: 0;
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.25;
}

.text-card {
  max-height: 46vh;
  overflow-y: auto;
  padding: 18px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 16px;
  line-height: 1.65;
  white-space: pre-line;
}

.text-card:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

/* ---------------- Персонаж и облачко ---------------- */
.character {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}

.character-figure {
  position: relative;
  flex: 0 0 auto;
  width: 96px;
  /* Высота по emoji: раньше здесь был рост картинки (132px), из-за чего
     над emoji оставалось много пустого места. */
  min-height: 72px;
  display: grid;
  place-items: end center;
}

.character-img {
  width: 100%;
  /* Картинка, если её вернут в data.js, снова займёт прежнюю высоту. */
  height: 132px;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(31, 36, 64, 0.25));
}

.character-emoji {
  font-size: 64px;
  line-height: 1;
}

.character-figure.has-emoji .character-img {
  display: none;
}

.character-figure.has-image .character-emoji {
  display: none;
}

.bubble {
  position: relative;
  flex: 1;
  background: var(--brand-soft);
  border: 2px solid var(--brand);
  border-radius: 18px 18px 18px 6px;
  padding: 12px 14px;
  animation: pop 0.35s ease-out;
}

.bubble::after {
  content: "";
  position: absolute;
  left: -12px;
  bottom: 14px;
  border: 8px solid transparent;
  border-right-color: var(--brand);
}

.bubble-name {
  display: block;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-ink);
  margin-bottom: 4px;
}

.bubble-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

@keyframes pop {
  0% {
    transform: scale(0.85);
    opacity: 0;
  }
  70% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ============================ ЗАДАНИЕ ============================ */
.task-title {
  margin: 0 0 6px;
  font-size: clamp(19px, 2.2vw, 23px);
}

.task-note {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------------- Зоны перетаскивания ---------------- */
.dropzone {
  position: relative;
  padding: 12px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--zone);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.dropzone + .dropzone {
  margin-top: 12px;
}

.dropzone.drag-over {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.dropzone.locked {
  cursor: default;
}

.zone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.zone-title {
  font-weight: 800;
  font-size: 15px;
}

.zone-counter {
  min-width: 26px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--brand-ink);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 2px 9px;
}

.zone-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 10px;
}

.zone-empty {
  margin: 6px 0 2px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

.zone-empty[hidden] {
  display: none;
}

/* ---------------- Карточки утверждений ---------------- */
.card {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-left: 6px solid var(--brand);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  line-height: 1.5;
  cursor: grab;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.2s ease,
    border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
}

.card:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.card.dragging {
  opacity: 0.4;
  transform: scale(0.98);
  cursor: grabbing;
}

.card-num {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: var(--brand);
  border-radius: 50%;
}

.card-text {
  flex: 1;
}

/* Итоговые состояния карточек после проверки */
.card.correct {
  background: var(--ok-bg);
  border-color: var(--ok-line);
  border-left-color: var(--ok);
}

.card.correct .card-num {
  background: var(--ok);
}

.card.correct::after {
  content: "✓";
  position: absolute;
  top: -10px;
  right: -8px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 900;
  color: #fff;
  background: var(--ok);
  border: 2px solid var(--panel);
  border-radius: 50%;
}

.card.incorrect {
  background: var(--bad-bg);
  border-color: var(--bad-line);
  border-left-color: var(--bad);
  animation: shake 0.35s ease;
}

.card.incorrect .card-num {
  background: var(--bad);
}

.card.incorrect::after {
  content: "✕";
  position: absolute;
  top: -10px;
  right: -8px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 900;
  color: #fff;
  background: var(--bad);
  border: 2px solid var(--panel);
  border-radius: 50%;
}

.card.missed {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  border-left-color: var(--warn);
}

.card.missed .card-num {
  background: var(--warn);
}

.card.missed::after {
  content: "!";
  position: absolute;
  top: -10px;
  right: -8px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 900;
  color: #fff;
  background: var(--warn);
  border: 2px solid var(--panel);
  border-radius: 50%;
}

.card.locked {
  cursor: default;
}

/* ---------------- Блок «Почему?» ---------------- */
.card-why {
  flex-basis: 100%;
  margin-top: 8px;
}

.why-list {
  margin: 0;
  padding: 8px 12px;
  list-style: none;
  background: var(--panel-soft);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink);
}

.why-list li {
  display: flex;
  gap: 8px;
  line-height: 1.5;
}

.why-icon {
  flex: 0 0 auto;
}

/* ---------------- Обратная связь ---------------- */
.feedback {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border-left: 8px solid var(--brand);
  background: var(--panel-soft);
  font-size: 15px;
  line-height: 1.55;
  animation: fade-in 0.3s ease-out;
}

.feedback[hidden] {
  display: none;
}

.feedback.ok {
  border-left-color: var(--ok);
  background: var(--ok-bg);
  color: var(--ok);
}

.feedback.bad {
  border-left-color: var(--bad);
  background: var(--bad-bg);
  color: var(--bad);
}

.feedback-title {
  display: block;
  font-weight: 800;
  margin-bottom: 4px;
}

/* ---------------- Кнопки действий ---------------- */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  flex: 1 1 130px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  background: var(--brand);
  border: 2px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease, opacity 0.15s ease;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}

.btn[hidden] {
  display: none;
}

.btn-primary {
  background: var(--brand);
}

.btn-success {
  background: var(--ok);
  color: #fff;
}

[data-theme="dark"] .btn-success {
  color: #06210f;
}

.btn-warn {
  background: var(--accent);
  color: #3a2a00;
}

.btn-ghost {
  background: var(--panel-soft);
  color: var(--ink);
  border-color: var(--line);
}

.btn-lg {
  flex: 0 1 auto;
  padding: 14px 32px;
  font-size: 18px;
}

/* ============================ МОДАЛКИ ============================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 17, 32, 0.6);
  backdrop-filter: blur(4px);
  animation: fade-in 0.2s ease-out;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  position: relative;
  width: min(560px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow);
  animation: rise 0.25s ease-out;
}

.modal-center {
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  font-size: 16px;
  color: var(--ink);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--brand-soft);
}

.modal-title {
  margin: 0 0 16px;
  font-size: 24px;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.rules-list {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  line-height: 1.55;
}

.rules-tip {
  margin: 18px 0 0;
  padding: 12px 14px;
  background: var(--brand-soft);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
}

/* ---------------- Модалка «Теория»: содержание + разделы ---------------- */
.modal-theory {
  width: min(1040px, 96vw);
  max-height: 90vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.theory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.theory-head .modal-title {
  margin: 0;
  font-size: 21px;
}

.theory-head .modal-close {
  position: static;
}

.theory-body {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 0;
}

.theory-toc {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  overflow-y: auto;
  background: var(--panel-soft);
  border-right: 1px solid var(--line);
}

.toc-btn {
  padding: 9px 12px;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.toc-btn:hover {
  background: var(--panel);
  border-color: var(--line);
}

.toc-btn.active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand-ink);
}

.toc-btn:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.theory-content {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 20px 24px 26px;
  overflow-y: auto;
}

.theory-section h3 {
  margin: 0 0 12px;
  font-size: 20px;
}

.theory-section p {
  margin: 0 0 10px;
  line-height: 1.6;
}

.theory-section > *:last-child,
.theory-card > *:last-child,
.theory-error > *:last-child {
  margin-bottom: 0;
}

.callout {
  padding: 10px 14px;
  background: var(--brand-soft);
  border-left: 5px solid var(--brand);
  border-radius: var(--radius-sm);
}

/* Карточки стилей и типов речи; цвет задаётся через --card-accent */
.theory-card {
  --card-accent: var(--brand);
  padding: 14px 16px;
  margin-bottom: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-left: 6px solid var(--card-accent);
  border-radius: var(--radius);
}

.theory-card h4 {
  margin: 0 0 8px;
  font-size: 17px;
}

.a-science {
  --card-accent: #2563eb;
}

.a-art {
  --card-accent: #db2777;
}

.a-media {
  --card-accent: #ea580c;
}

.a-official {
  --card-accent: #0891b2;
}

.a-talk {
  --card-accent: #16a34a;
}

.a-narr {
  --card-accent: #7c3aed;
}

.a-desc {
  --card-accent: #0ea5e9;
}

.a-reason {
  --card-accent: #f59e0b;
}

.theory-meta {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.5;
}

.theory-sub {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
}

.theory-subhead {
  margin: 18px 0 8px;
  font-size: 16px;
}

.theory-example {
  margin: 10px 0 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-style: italic;
  line-height: 1.55;
  color: var(--muted);
  background: var(--panel);
  border-left: 4px solid var(--card-accent, var(--brand));
  border-radius: var(--radius-sm);
}

.theory-table {
  width: 100%;
  margin: 6px 0 14px;
  border-collapse: collapse;
  font-size: 14px;
}

.theory-table th,
.theory-table td {
  padding: 9px 11px;
  text-align: left;
  vertical-align: top;
  border: 1px solid var(--line);
}

.theory-table th {
  font-weight: 800;
  background: var(--panel-soft);
}

.theory-steps {
  margin: 0 0 12px;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14.5px;
  line-height: 1.55;
}

.theory-error {
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-left: 6px solid var(--bad);
  border-radius: var(--radius);
}

.theory-error h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.theory-error p {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.55;
}

.mark-wrong {
  font-weight: 800;
  color: var(--bad);
}

.mark-right {
  font-weight: 800;
  color: var(--ok);
}

.theory-list {
  margin: 0 0 10px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.theory-list:last-child {
  margin-bottom: 0;
}

.theory-list-big {
  font-size: 15px;
}

.end-emoji {
  font-size: 62px;
  line-height: 1;
}

.end-score {
  margin: 14px 0 4px;
  font-size: 26px;
  font-weight: 800;
  color: var(--brand-ink);
}

.end-detail {
  margin: 0;
  color: var(--muted);
}

/* ============================ ТОСТ ============================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 60;
  max-width: min(460px, 90vw);
  padding: 12px 20px;
  background: var(--ink);
  color: var(--panel);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow);
  animation: rise 0.25s ease-out;
}

.toast[hidden] {
  display: none;
}

/* ============================ АНИМАЦИИ ============================ */
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

/* ============================ АДАПТИВ ============================ */
@media (max-width: 980px) {
  .board {
    grid-template-columns: 1fr;
  }

  .panel-text {
    position: static;
  }

  .text-card {
    max-height: 40vh;
  }
}

/* Модалка «Теория» на узких экранах: содержание — горизонтальной лентой */
@media (max-width: 820px) {
  .theory-body {
    grid-template-columns: 1fr;
  }

  .theory-toc {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .toc-btn {
    white-space: nowrap;
  }

  .theory-content {
    padding: 16px;
    gap: 22px;
  }

  .theory-table {
    font-size: 13px;
  }
}

@media (max-width: 620px) {
  body {
    padding: 10px 10px 26px;
  }

  .topbar {
    gap: 10px;
    padding: 10px 12px;
  }

  .brand-text {
    font-size: 15px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .panel {
    padding: 14px;
  }

  .character-figure {
    width: 72px;
    min-height: 56px;
  }

  .character-img {
    height: 100px;
  }

  .character-emoji {
    font-size: 48px;
  }

  .btn {
    flex: 1 1 100%;
  }
}

/* Уважаем настройку «меньше анимации» */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
/* =========================================================================
   ПРОФИЛЬ ИГРОКА И ОНБОРДИНГ
   ========================================================================= */
.icon-btn--profile {
  padding: 0;
  overflow: hidden;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.icon-btn--profile:hover {
  filter: brightness(1.08);
}

.profile-btn-emoji {
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

.modal-profile {
  width: min(680px, 96vw);
  max-height: 92vh;
}

.profile-note {
  margin: -8px 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.profile-preview {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
}

.profile-avatar {
  width: 110px;
  height: 110px;
  display: grid;
  place-items: center;
  font-size: 60px;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 10px 30px rgba(109, 40, 217, 0.35);
  transition: background 0.25s ease, transform 0.25s ease;
}

.profile-avatar span {
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.profile-section {
  margin-bottom: 18px;
}

.profile-section-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 10px;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.emoji-grid button {
  aspect-ratio: 1;
  font-size: 22px;
  display: grid;
  place-items: center;
  background: var(--panel-soft);
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.emoji-grid button:hover {
  transform: scale(1.08);
  background: var(--brand-soft);
}

.emoji-grid button.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 3px var(--brand-soft);
  transform: scale(1.05);
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}

.color-grid button {
  aspect-ratio: 1;
  border: 3px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.color-grid button:hover {
  transform: scale(1.1);
}

.color-grid button.selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px var(--brand-soft);
  transform: scale(1.08);
}

.profile-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 6px;
}

.profile-field {
  display: flex;
  flex-direction: column;
}

.profile-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

.profile-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: var(--panel-soft);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease;
}

.profile-input:focus {
  border-color: var(--brand);
}

@media (max-width: 560px) {
  .emoji-grid { grid-template-columns: repeat(6, 1fr); }
  .color-grid { grid-template-columns: repeat(4, 1fr); }
  .profile-row { grid-template-columns: 1fr; }
  .profile-avatar { width: 90px; height: 90px; font-size: 48px; }
}
/* =========================================================================
   ОТПРАВИТЬ ДРУГУ И ПЕЧАТЬ ОТЧЁТА
   ========================================================================= */

/* Скрытая область для печати */
#printArea {
  display: none;
}

/* Кнопка «Сохранить результат» — рядом с обычными действиями */
.btn-save-report {
  flex: 1 1 130px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  background: var(--panel-soft);
  border: 2px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
}
.btn-save-report:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}
.btn-save-report[hidden] { display: none; }

/* Модалка отправки другу */
.modal-share {
  width: min(560px, 96vw);
}

.share-note {
  margin: -8px 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.share-link-box {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.share-link {
  flex: 1;
  padding: 12px 14px;
  font-size: 14px;
  font-family: "Consolas", "Monaco", monospace;
  color: var(--ink);
  background: var(--panel-soft);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
}

.share-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* =========================================================================
   ПЕЧАТНАЯ ВЕРСИЯ (только при печати)
   ========================================================================= */
@media print {
  body * { visibility: hidden !important; }
  #printArea, #printArea * { visibility: visible !important; }

  #printArea {
    display: block !important;
    position: absolute;
    inset: 0;
    padding: 40px 50px;
    font-family: "Georgia", "Times New Roman", serif;
    color: #000;
    background: #fff;
    line-height: 1.55;
  }

  #printArea h1 {
    margin: 0 0 6px;
    font-size: 26px;
    text-align: center;
  }

  #printArea .print-sub {
    text-align: center;
    font-size: 14px;
    color: #444;
    margin-bottom: 26px;
  }

  #printArea .print-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #bbb;
    font-size: 15px;
  }

  #printArea .print-row .label { color: #555; }
  #printArea .print-row .value { font-weight: 700; }

  #printArea .print-block {
    margin: 22px 0;
    padding: 16px 20px;
    border: 2px solid #000;
    border-radius: 10px;
  }

  #printArea .print-block h2 {
    margin: 0 0 10px;
    font-size: 18px;
  }

  #printArea .print-answers {
    font-family: "Consolas", "Monaco", monospace;
    font-size: 14px;
  }

  #printArea .print-footer {
    margin-top: 36px;
    font-size: 12px;
    color: #666;
    text-align: center;
  }

  #printArea .print-sign {
    margin-top: 40px;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
  }

  #printArea .print-sign .line {
    border-top: 1px solid #000;
    padding-top: 6px;
    width: 40%;
    text-align: center;
  }
}
/* =========================================================================
   ПАНЕЛЬ КЛАССОВ + КНОПКА «РАСПЕЧАТАТЬ РЕЗУЛЬТАТ»
   ========================================================================= */
.level-nav-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.level-nav-top .grade-row {
  flex: 1 1 auto;
  min-width: 0;
}

/* Кнопка печати — правее классов, в стиле игры */
.print-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border: 2px solid #15803d;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  animation: printPulse 2.6s ease-in-out infinite;
  white-space: nowrap;
}

.print-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 0 10px 24px rgba(34, 197, 94, 0.55);
}

.print-btn:active {
  transform: translateY(0);
}

.print-btn:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}

.print-btn[hidden] {
  display: none;
}

.print-btn-icon {
  font-size: 18px;
  line-height: 1;
}

.print-btn-text {
  letter-spacing: 0.02em;
}

@keyframes printPulse {
  0%, 100% {
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
  }
  50% {
    box-shadow: 0 4px 22px rgba(34, 197, 94, 0.75);
  }
}

/* Тёмная тема — оставляем тот же зелёный, он хорошо читается */
[data-theme="dark"] .print-btn {
  border-color: #22c55e;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.5);
}

/* Адаптив */
@media (max-width: 620px) {
  .level-nav-top {
    gap: 10px;
  }
  .print-btn {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
    font-size: 14px;
  }
}
/* =========================================================================
   ПАНЕЛЬ КЛАССОВ + КНОПКА «РАСПЕЧАТАТЬ РЕЗУЛЬТАТ»
   ========================================================================= */
.level-nav-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.level-nav-top .grade-row {
  flex: 1 1 auto;
  min-width: 0;
}

.print-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border: 2px solid #15803d;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  animation: printPulse 2.6s ease-in-out infinite;
  white-space: nowrap;
}
.print-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 0 10px 24px rgba(34, 197, 94, 0.55);
}
.print-btn:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}
.print-btn[hidden] { display: none; }
.print-btn-icon { font-size: 18px; line-height: 1; }

@keyframes printPulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35); }
  50%      { box-shadow: 0 4px 22px rgba(34, 197, 94, 0.75); }
}

@media (max-width: 620px) {
  .print-btn {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
    font-size: 14px;
  }
}

/* =========================================================================
   ПЕЧАТНЫЙ СЕРТИФИКАТ
   ========================================================================= */
#printArea { display: none; }

@media print {
  @page { size: A4 landscape; margin: 0; }

  body * { visibility: hidden !important; }
  #printArea, #printArea * { visibility: visible !important; }

  #printArea {
    display: block !important;
    position: absolute;
    inset: 0;
    padding: 0;
    background: #fff;
    font-family: "Georgia", "Times New Roman", serif;
    color: #1a1a1a;
  }

  .cert {
    width: 297mm;
    height: 210mm;
    padding: 10mm;
    box-sizing: border-box;
  }

  .cert-border {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 14mm 16mm;
    box-sizing: border-box;
    border: 6px double #1a1a1a;
    border-radius: 8px;
    background:
      radial-gradient(circle at 0% 0%, #f7f3ff 0%, transparent 30%),
      radial-gradient(circle at 100% 100%, #f0f7ff 0%, transparent 30%),
      #fff;
    overflow: hidden;
  }

  .cert-corner {
    position: absolute;
    font-size: 22px;
    color: #b9a86a;
    line-height: 1;
  }
  .cert-corner--tl { top: 6mm; left: 8mm; }
  .cert-corner--tr { top: 6mm; right: 8mm; }
  .cert-corner--bl { bottom: 6mm; left: 8mm; }
  .cert-corner--br { bottom: 6mm; right: 8mm; }

  .cert-stripe {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4mm;
  }

  .cert-head {
    display: flex;
    align-items: center;
    gap: 8mm;
    margin-bottom: 6mm;
  }
  .cert-logo {
    flex: 0 0 auto;
    font-size: 30px;
    width: 18mm;
    height: 18mm;
    display: grid;
    place-items: center;
    background: #f0eaff;
    border-radius: 50%;
    border: 2px solid #d6c8ff;
  }
  .cert-head-text { flex: 1; }
  .cert-title {
    margin: 0;
    font-size: 34px;
    letter-spacing: 4px;
    text-align: center;
    color: #2b1f6b;
  }
  .cert-subtitle {
    margin: 4px 0 0;
    text-align: center;
    font-size: 12px;
    color: #6b6b6b;
    font-style: italic;
  }
  .cert-mascot {
    flex: 0 0 auto;
    width: 22mm;
    height: 22mm;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 36px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  }

  .cert-intro {
    text-align: center;
    font-style: italic;
    font-size: 15px;
    color: #555;
    margin: 4mm 0 2mm;
  }

  .cert-name {
    text-align: center;
    font-size: 40px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #1a1a1a;
    margin: 2mm 0 1mm;
    border-bottom: 2px solid #b9a86a;
    padding-bottom: 2mm;
    display: inline-block;
    margin-left: auto;
    margin-right: auto;
    min-width: 60%;
  }
  .cert-name { display: block; }

  .cert-age {
    text-align: center;
    font-size: 13px;
    color: #777;
    margin-bottom: 4mm;
  }

  .cert-text {
    text-align: center;
    font-size: 16px;
    line-height: 1.6;
    margin: 4mm auto;
    max-width: 80%;
  }
  .cert-text b { color: #2b1f6b; }

  .cert-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4mm;
    margin: 6mm 0;
  }
  .cert-stat {
    padding: 3mm;
    border: 1.5px solid #d6c8ff;
    border-radius: 10px;
    text-align: center;
    background: #faf8ff;
  }
  .cert-stat--score {
    background: #f0f7ff;
    border-color: #b9d5ff;
  }
  .cert-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    margin-bottom: 2mm;
  }
  .cert-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #2b1f6b;
  }

  .cert-medals-block {
    margin: 4mm 0;
    text-align: center;
  }
  .cert-medals-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #888;
    margin-bottom: 3mm;
  }
  .cert-medals {
    display: flex;
    justify-content: center;
    gap: 8mm;
    flex-wrap: wrap;
  }
  .cert-medal { text-align: center; }
  .cert-medal-icon { font-size: 28px; line-height: 1; }
  .cert-medal-label { font-size: 11px; color: #555; margin-top: 1mm; }
  .cert-no-medal { font-size: 13px; color: #999; font-style: italic; }

  .cert-progress {
    margin: 5mm 0;
  }
  .cert-progress-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #888;
    text-align: center;
    margin-bottom: 2mm;
  }
  .cert-progress-track {
    width: 70%;
    height: 6px;
    margin: 0 auto;
    background: #eee;
    border-radius: 999px;
    overflow: hidden;
  }
  .cert-progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s ease;
  }
  .cert-progress-text {
    text-align: center;
    font-size: 12px;
    color: #555;
    margin-top: 2mm;
  }

  .cert-footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
    gap: 8mm;
    margin-top: 8mm;
  }
  .cert-date-label { font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: 1px; }
  .cert-date-value { font-size: 15px; font-weight: 700; margin-top: 1mm; }
  .cert-date-time { font-size: 12px; color: #666; }

  .cert-footer-seal { display: grid; place-items: center; }
  .cert-seal {
    width: 26mm;
    height: 26mm;
    border: 3px solid #6d28d9;
    border-radius: 50%;
    display: grid;
    place-items: center;
    transform: rotate(-12deg);
    background: rgba(255, 255, 255, 0.6);
  }
  .cert-seal-icon { font-size: 20px; line-height: 1; }
  .cert-seal-text {
    font-size: 8px;
    text-align: center;
    letter-spacing: 1px;
    color: #6d28d9;
    font-weight: 700;
    line-height: 1.1;
    margin-top: 1mm;
  }

  .cert-footer-right { text-align: right; }
  .cert-sign-line {
    border-top: 1px solid #1a1a1a;
    width: 100%;
    margin-bottom: 2mm;
  }
  .cert-sign-label { font-size: 11px; color: #666; }

  .cert-note {
    text-align: center;
    font-size: 10px;
    color: #999;
    margin-top: 6mm;
    font-style: italic;
  }
}
/* =========================================================================
   КНОПКА «ПОЛУЧИТЬ СЕРТИФИКАТ» — золотая
   ========================================================================= */
.level-nav-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.level-nav-top .grade-row {
  flex: 1 1 auto;
  min-width: 0;
}

.print-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  color: #3a2a00;
  background: linear-gradient(135deg, #fde68a, #f59e0b);
  border: 2px solid #b45309;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.45);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  animation: goldPulse 2.6s ease-in-out infinite;
  white-space: nowrap;
}
.print-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 0 10px 24px rgba(245, 158, 11, 0.7);
}
.print-btn:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}
.print-btn[hidden] { display: none; }
.print-btn-icon { font-size: 18px; line-height: 1; }

@keyframes goldPulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(245, 158, 11, 0.45); }
  50%      { box-shadow: 0 4px 22px rgba(245, 158, 11, 0.85); }
}

/* Класс полностью пройден — зелёная обводка */
.grade-btn.complete {
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}
.grade-btn.complete .grade-count {
  background: #dcfce7;
  color: #166534;
}

@media (max-width: 620px) {
  .print-btn {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
    font-size: 14px;
  }
}

/* =========================================================================
   ПЕЧАТНЫЙ СЕРТИФИКАТ С ТВОЕЙ КАРТИНКОЙ
   Координаты полей (проценты) легко менять под свою картинку.
   ========================================================================= */
#printArea { display: none; }

@media print {
  @page { size: A4 landscape; margin: 0; }

  body * { visibility: hidden !important; }
  #printArea, #printArea * { visibility: visible !important; }

  #printArea {
    display: block !important;
    position: absolute;
    inset: 0;
    padding: 0;
    background: #fff;
  }

  .cert {
    position: relative;
    width: 297mm;
    height: 210mm;
    margin: 0 auto;
    overflow: hidden;
  }

  .cert-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
  }

  /* Все текстовые поля поверх картинки */
  .cert-field {
    position: absolute;
    transform: translate(-50%, -50%);
    font-family: "Georgia", "Times New Roman", serif;
    color: #1a1a1a;
    text-align: center;
    z-index: 1;
    white-space: nowrap;
  }

  /* 👇 Меняй координаты и размеры под свою картинку */
  .cert-field--avatar {
    left: 50%;
    top: 30%;
    font-size: 40px;
  }
  .cert-field--name {
    left: 50%;
    top: 40%;
    font-size: 34px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #2b1f6b;
    min-width: 60%;
    border-bottom: 2px solid #b9a86a;
    padding-bottom: 4px;
  }
  .cert-field--age {
    left: 50%;
    top: 46%;
    font-size: 14px;
    color: #666;
  }
  .cert-field--grade {
    left: 50%;
    top: 55%;
    font-size: 22px;
    font-weight: 700;
    color: #2b1f6b;
  }
  .cert-field--date {
    left: 25%;
    top: 82%;
    font-size: 16px;
  }
  .cert-field--levels {
    left: 50%;
    top: 68%;
    font-size: 20px;
    font-weight: 700;
  }
  .cert-field--percent {
    left: 75%;
    top: 68%;
    font-size: 20px;
    font-weight: 700;
  }
  }
  /* =========================================================================
   ПРАВИЛА ИГРЫ (официально-деловой стиль)
   ========================================================================= */
.modal-rules {
  width: min(720px, 96vw);
  max-height: 92vh;
}

.rules-doc {
  margin: -8px 0 20px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--muted);
  background: var(--panel-soft);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm);
  font-style: italic;
}

.rules-section {
  margin-bottom: 18px;
}

.rules-h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--brand-ink);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.rules-list {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
}

.rules-list li {
  padding-left: 4px;
}

.rules-list b {
  color: var(--brand-ink);
}