/* ============================================================
   levels.css — стили игровых уровней (1–5)
   ============================================================ */

/* ===== Общий каркас уровня ===== */
.level-screen { position: relative; min-height: 100vh; padding: 84px 20px 20px; }
.level-bg { position: absolute; inset: 0; background-size: cover; background-position: center; z-index: 0; }
.level-overlay { position: absolute; inset: 0; z-index: 1; }
#level1 .level-bg { background-image: url('../img/level1-bg.jpg'); }
#level1 .level-overlay { background: linear-gradient(135deg, rgba(16,69,31,0.75), rgba(34,139,34,0.55)); }
#level2 .level-bg { background-image: url('../img/level2-bg.jpg'); }
#level2 .level-overlay { background: linear-gradient(135deg, rgba(0,105,148,0.75), rgba(0,150,199,0.55)); }
#level3 .level-bg { background-image: url('../img/level3-bg.jpg'); }
#level3 .level-overlay { background: linear-gradient(135deg, rgba(75,0,130,0.75), rgba(138,43,226,0.55)); }
#level4 .level-bg { background-image: url('../img/level4-bg.jpg'); }
#level4 .level-overlay { background: linear-gradient(135deg, rgba(255,140,0,0.75), rgba(255,165,0,0.55)); }
#level5 .level-bg { background-image: url('../img/level5-bg.jpg'); }
#level5 .level-overlay { background: linear-gradient(135deg, rgba(255,20,147,0.75), rgba(255,105,180,0.55)); }
.level-content { position: relative; z-index: 10; max-width: 900px; margin: 0 auto; background: rgba(255,255,255,0.95); border-radius: 20px; padding: 25px; box-shadow: 0 10px 40px rgba(0,0,0,0.3); animation: levelIn 0.45s ease; }
@keyframes levelIn { from { opacity: 0; transform: translateY(24px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.level-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.btn-back { background: #6c757d; color: white; border: none; padding: 10px 20px; border-radius: 10px; cursor: pointer; font-family: inherit; font-size: 1em; transition: all 0.3s; }
.btn-back:hover { background: #5a6268; }
.level-title { font-size: clamp(1.3em, 3vw, 2em); color: #333; text-align: center; flex: 1; }
.progress { font-size: 1.05em; color: #c44569; font-weight: bold; background: #fff0f6; border: 2px solid #ffb3d1; padding: 5px 14px; border-radius: 50px; white-space: nowrap; }
/* Визуальный прогресс: обёртка чип + полоска делений */
.progress-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.progress-track { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 150px; }
.progress-seg {
  width: 20px; height: 9px; border-radius: 6px;
  background: rgba(255,255,255,0.5);
  border: 1.5px solid rgba(196,69,105,0.35);
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.progress-seg.done {
  background: linear-gradient(90deg, #ffd700, #ffb300);
  border-color: #e6a817;
  box-shadow: 0 0 8px rgba(255,193,7,0.65);
}
.progress-seg.pop { animation: segPop 0.45s ease; }
@keyframes segPop { 0% { transform: scale(0.4); } 55% { transform: scale(1.45); } 100% { transform: scale(1); } }
.story-intro { background: linear-gradient(135deg, #fff9c4, #fff59d); padding: 18px; border-radius: 15px; margin-bottom: 20px; border-left: 5px solid #ffd700; }
.story-intro p { color: #333; line-height: 1.6; }
.game-area { min-height: 350px; position: relative; }
.btn-hint { background: linear-gradient(45deg, #9c27b0, #ba68c8); color: white; border: none; padding: 12px 25px; border-radius: 15px; cursor: pointer; font-family: inherit; font-size: 1em; font-weight: 800; text-shadow: 0 1px 2px rgba(0,0,0,0.3); margin-top: 20px; transition: all 0.3s; box-shadow: 0 5px 15px rgba(156,39,176,0.4); }
.btn-hint:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(156,39,176,0.6); }
.decorative-emojis { position: absolute; bottom: 15px; left: 0; width: 100%; display: flex; justify-content: space-around; font-size: 1.8em; opacity: 0.6; z-index: 5; pointer-events: none; }

/* ===== Тематические рамки карточек уровней =====
   Каждая локация — свой цвет и «водяной знак»-эмодзи в углу,
   чтобы уровни отличались даже не глядя на фон. */
.level-content { overflow: hidden; }
#level1 .level-content {
  border-top: 7px solid #2e7d32;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3), 0 0 0 1px rgba(46,125,50,0.25), 0 -3px 22px rgba(46,125,50,0.35);
}
#level1 .level-content::after,
#level2 .level-content::after,
#level3 .level-content::after,
#level4 .level-content::after,
#level5 .level-content::after {
  content: ''; position: absolute; right: -18px; bottom: -26px;
  font-size: 9em; opacity: 0.07; pointer-events: none; line-height: 1;
  transform: rotate(-12deg);
}
#level1 .level-content::after { content: '🌳'; }
#level2 .level-content {
  border-top: 7px solid #0277bd;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3), 0 0 0 1px rgba(2,119,189,0.25), 0 -3px 22px rgba(2,119,189,0.35);
}
#level2 .level-content::after { content: '🌊'; }
#level3 .level-content {
  border-top: 7px solid #7b1fa2;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3), 0 0 0 1px rgba(123,31,162,0.25), 0 -3px 22px rgba(123,31,162,0.35);
}
#level3 .level-content::after { content: '🔮'; }
#level4 .level-content {
  border-top: 7px solid #ef6c00;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3), 0 0 0 1px rgba(239,108,0,0.25), 0 -3px 22px rgba(239,108,0,0.35);
}
#level4 .level-content::after { content: '🗼'; }
#level5 .level-content {
  border-top: 7px solid #c2185b;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3), 0 0 0 1px rgba(194,24,91,0.25), 0 -3px 22px rgba(194,24,91,0.35);
}
#level5 .level-content::after { content: '🌈'; }
/* Цвет заголовка уровня — в тон локации */
#level1 .level-title { color: #2e7d32; }
#level2 .level-title { color: #0277bd; }
#level3 .level-title { color: #7b1fa2; }
#level4 .level-title { color: #ef6c00; }
#level5 .level-title { color: #c2185b; }
/* Чип прогресса «x/N» тоже перекрашивается */
#level1 .progress { background: #e8f5e9; border-color: #a5d6a7; color: #2e7d32; }
#level2 .progress { background: #e1f5fe; border-color: #81d4fa; color: #0277bd; }
#level3 .progress { background: #f3e5f5; border-color: #ce93d8; color: #7b1fa2; }
#level4 .progress { background: #fff3e0; border-color: #ffcc80; color: #ef6c00; }
#level5 .progress { background: #fce4ec; border-color: #f48fb1; color: #c2185b; }

/* ===== Уровень 1 — Лес Загадок (светлячки в волшебном лесу) ===== */
/* Вместо серого поля — настоящий волшебный ночной лес (img/forest-bg.png):
   светлячки прячутся в темноте, а волшебная палочка освещает путь */
#gameArea1 {
  position: relative; height: 430px; cursor: none;
  border-radius: 15px; overflow: hidden;
  background: #0a2416 url('../img/forest-bg.jpg') center/cover no-repeat;
  border: 3px solid rgba(255, 213, 79, 0.55);
  box-shadow: inset 0 0 80px rgba(2, 14, 8, 0.72), 0 6px 18px rgba(0,0,0,0.28);
}
/* Винетка: края темнее — светлячки и свет палочки заметнее */
#gameArea1::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%, rgba(3,20,11,0.16) 0%, rgba(3,20,11,0.6) 100%);
}
/* Подсказка-ленточка сверху леса */
#gameArea1::after {
  content: '✨ Веди волшебной палочкой по лесу — светлячки прячутся в темноте!';
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: 0.92em; font-weight: bold; white-space: nowrap; max-width: 96%;
  overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 2px 6px rgba(0,0,0,0.85);
  background: rgba(6, 26, 15, 0.62);
  border: 1.5px solid rgba(255, 213, 79, 0.45);
  padding: 7px 18px; border-radius: 50px;
  pointer-events: none;
}
/* Когда все светлячки пойманы — подсказка больше не нужна */
#gameArea1.done::after { display: none; }
.firefly {
  position: absolute; width: 26px; height: 26px;
  background: radial-gradient(circle, #fffde7, #ffee58 55%, #ffeb3b);
  border-radius: 50%; cursor: none; opacity: 0;
  transition: opacity 0.3s;
  box-shadow: 0 0 18px #ffff00, 0 0 38px #ffeb3b;
  pointer-events: auto;
  animation: fireflyFloat 3.6s ease-in-out infinite;
}
/* Светлячок появляется рядом с палочкой — тёпло пульсирует */
.firefly.visible {
  opacity: 1;
  animation: fireflyFloat 3.6s ease-in-out infinite, fireflyPulse 0.9s ease-in-out infinite;
}
.firefly.caught { opacity: 0; pointer-events: none; animation: none; }
/* Лёгкое парение светлячка */
@keyframes fireflyFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(7px, -11px); }
}
/* Пульсация свечения найденного светлячка */
@keyframes fireflyPulse {
  0%, 100% { box-shadow: 0 0 16px #ffff00, 0 0 34px #ffeb3b; }
  50% { box-shadow: 0 0 28px #ffff9c, 0 0 60px #ffeb3b; }
}
/* Магический свет волшебной палочки — мягкое пятно света следует за курсором
   и «освещает» лес вокруг (появляется рядом с ним светлячок) */
.wand-light {
  position: fixed; width: 320px; height: 320px;
  margin: -160px 0 0 -160px;
  border-radius: 50%; pointer-events: none; z-index: 9997;
  display: none;
  background: radial-gradient(circle,
    rgba(255, 249, 196, 0.34) 0%,
    rgba(255, 238, 150, 0.16) 42%,
    rgba(255, 238, 150, 0) 70%);
}
.sparkle-cursor { position: fixed; pointer-events: none; font-size: 24px; z-index: 9999; transform: translate(-50%, -50%); }
.sparkle-trail { position: fixed; pointer-events: none; font-size: 16px; z-index: 9998; animation: sparkleFade 1s forwards; }
@keyframes sparkleFade { to { opacity: 0; transform: scale(0.5) rotate(180deg); } }
@media (max-width: 600px) {
  #gameArea1 { height: 380px; }
  #gameArea1::after { font-size: 0.78em; padding: 6px 12px; }
}

/* ===== Уровень 2 — Волшебное Озеро (последовательности) ===== */
.task-question { text-align: center; font-size: 1.2em; color: #333; margin-bottom: 20px; font-weight: bold; }
.number-sequence { display: flex; justify-content: center; gap: 10px; margin: 20px 0; flex-wrap: wrap; }
.number-box { background: linear-gradient(135deg, #e3f2fd, #bbdefb); border: 3px solid #1976d2; padding: 15px 25px; border-radius: 15px; font-size: 1.5em; font-weight: bold; color: #1976d2; min-width: 60px; text-align: center; }
.number-box.question { background: linear-gradient(135deg, #fff3e0, #ffe0b2); border-color: #ff9800; color: #ff9800; animation: pulse 1.5s infinite; cursor: pointer; }
.number-box.filled { background: linear-gradient(135deg, #c8e6c9, #a5d6a7); border-color: #4caf50; color: #2e7d32; animation: none; }
.answer-options { display: flex; justify-content: center; gap: 15px; margin-top: 25px; flex-wrap: wrap; }
.answer-block { background: linear-gradient(135deg, #f3e5f5, #e1bee7); border: 3px solid #9c27b0; padding: 15px 30px; border-radius: 15px; font-size: 1.3em; font-weight: bold; color: #9c27b0; cursor: pointer; transition: all 0.3s; font-family: inherit; }
.answer-block:hover { transform: scale(1.05); }
.answer-block.selected { border-color: #ffd700; box-shadow: 0 0 20px #ffd700; transform: scale(1.1); }
.answer-block.used { opacity: 0.3; cursor: not-allowed; pointer-events: none; }

/* ===== Уровень 3 — Замок Колдуньи (сетка) ===== */
.grid-question { text-align: center; font-size: 1.1em; color: #333; margin-bottom: 15px; font-weight: bold; }
.magic-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; max-width: 500px; margin: 20px auto; }
.grid-cell { background: linear-gradient(135deg, #ede7f6, #d1c4e9); border: 2px solid #673ab7; padding: 15px 5px; border-radius: 10px; font-size: 1.1em; font-weight: bold; color: #673ab7; text-align: center; cursor: pointer; transition: all 0.3s; font-family: inherit; }
.grid-cell:hover { background: linear-gradient(135deg, #d1c4e9, #b39ddb); transform: scale(1.05); }
.grid-cell.correct { background: linear-gradient(135deg, #c8e6c9, #a5d6a7); border-color: #4caf50; color: #2e7d32; pointer-events: none; }

/* ===== Уровень 4 — Башня Магии (слайдер) ===== */
.slider-question { text-align: center; font-size: 1.1em; color: #333; margin-bottom: 20px; font-weight: bold; line-height: 1.6; }
.slider-container { text-align: center; margin: 30px 0; }
.slider-value { font-size: 4em; font-weight: bold; color: #ff6b9d; margin: 15px 0; }
.magic-slider { width: 80%; max-width: 500px; height: 10px; border-radius: 5px; background: #ddd; outline: none; -webkit-appearance: none; }
.magic-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(45deg, #ff6b9d, #c44569); cursor: pointer; box-shadow: 0 0 10px rgba(255,107,157,0.5); }
.magic-slider::-moz-range-thumb { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(45deg, #ff6b9d, #c44569); cursor: pointer; border: none; box-shadow: 0 0 10px rgba(255,107,157,0.5); }
.btn-check { background: linear-gradient(45deg, #4caf50, #81c784); color: white; border: none; padding: 12px 35px; border-radius: 15px; cursor: pointer; font-family: inherit; font-size: 1.1em; margin-top: 15px; transition: all 0.3s; box-shadow: 0 5px 15px rgba(76,175,80,0.4); }
.btn-check:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(76,175,80,0.6); }

/* ===== Уровень 5 — Радужная Поляна (пары) ===== */
.matching-game { display: flex; justify-content: space-around; gap: 20px; margin: 20px 0; flex-wrap: wrap; }
.matching-column { flex: 1; min-width: 250px; }
.matching-column h4 { text-align: center; color: #333; margin-bottom: 10px; font-size: 1.1em; }
.matching-item { background: linear-gradient(135deg, #fff3e0, #ffe0b2); border: 3px solid #ff9800; padding: 12px 15px; margin: 8px 0; border-radius: 15px; font-size: 1em; cursor: pointer; transition: all 0.3s; text-align: center; }
.matching-item:hover { transform: translateX(5px); }
.matching-item.selected { border-color: #2196f3; box-shadow: 0 0 15px #2196f3; background: linear-gradient(135deg, #e3f2fd, #bbdefb); }
.matching-item.matched { background: linear-gradient(135deg, #c8e6c9, #a5d6a7); border-color: #4caf50; cursor: not-allowed; opacity: 0.7; pointer-events: none; }

/* ===== Адаптивность уровней ===== */
@media (max-width: 600px) {
  .level-screen { padding: 76px 12px 16px; }
  .magic-grid { grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .grid-cell { padding: 10px 3px; font-size: 0.9em; }
  .number-box { padding: 10px 15px; font-size: 1.2em; min-width: 50px; }
  .answer-block { padding: 12px 20px; font-size: 1.1em; }
  .slider-value { font-size: 3em; }
  .level-content { padding: 15px; }
}

/* ===== Чип «Повторяем Урок N» — только для 1 класса (см. levels.js setLessonTopic) ===== */
.lesson-topic {
  margin: 8px auto 0;
  max-width: 660px;
  width: fit-content;
  text-align: center;
  background: rgba(255, 255, 255, 0.93);
  color: #6d3fa8;
  font-size: 0.95em;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 999px;
  border: 2px solid #e5ccf7;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
}
.lesson-topic strong { color: #b0327f; font-weight: 800; }

/* Небольшой счётчик «(задача 1/5)» в заголовке задания Озера */
.task-counter { font-size: 0.7em; color: #8a7ba0; font-weight: 700; }

/* ============================================================
   1 КЛАСС — ИНТЕРАКТИВНЫЕ ГОЛОВОЛОМКИ (Озеро = Урок 3)
   и последовательные ребусы (Поляна = Урок 4).
   Классы используются и в квесте (levels.js), и в режиме учителя
   (classroom.js) — размеры для проектора донастраиваются там.
   ============================================================ */

/* Условие головоломки */
.pz-q {
  text-align: center;
  color: #4a3f63;
  font-weight: 600;
  max-width: 640px;
  margin: 0 auto 14px;
  font-size: 1.02em;
  line-height: 1.45;
}

/* Сетка клеток (квадрат/судоку/лабиринт/сапёр/дорожка) */
.pz-grid {
  display: grid;
  grid-template-columns: repeat(var(--n, 4), 1fr);
  gap: 7px;
  max-width: 440px;
  margin: 0 auto;
  user-select: none;
}
.pz-cell {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 2px solid #cfd8e3;
  border-radius: 12px;
  font-weight: 800;
  font-size: 1.45em;
  color: #3c4a5c;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s, background 0.2s;
  overflow: hidden;
}
.pz-cell:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(60, 40, 90, 0.18); }

/* Заранее заполненная клетка */
.pz-fixed {
  background: #eef3fb;
  border-color: #c3cfe0;
  cursor: default;
}
.pz-fixed:hover { transform: none; box-shadow: none; }

/* Пустая клетка «?» */
.pz-empty {
  background: #fffdf2;
  border: 2px dashed #d8b13a;
  color: #c09a2e;
}
.pz-empty.sel {
  border-color: #8e44ad;
  border-style: solid;
  background: #f6edff;
  box-shadow: 0 0 0 4px rgba(142, 68, 173, 0.22);
}

/* Верно заполненная клетка */
.pz-filled {
  background: #e6f9ee;
  border: 2px solid #2e9e63;
  color: #1d7a4c;
  cursor: default;
  animation: pzPop 0.35s ease;
}
.pz-filled:hover { transform: none; box-shadow: none; }
@keyframes pzPop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Панель кнопок-ответов (цифры/фигуры) */
.pz-pad {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: center;
  margin-top: 16px;
}
.pz-pad-btn {
  min-width: 52px;
  min-height: 52px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 1.3em;
  font-weight: 800;
  color: #5b3f86;
  background: linear-gradient(180deg, #ffffff, #f3ecff);
  border: 2px solid #cbb3ee;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 3px 0 #d9c8f4;
  transition: transform 0.12s, box-shadow 0.12s;
}
.pz-pad-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 0 #d9c8f4; }
.pz-pad-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #d9c8f4; }

/* Числовая дорожка */
.pz-chain-wrap { position: relative; max-width: 440px; margin: 0 auto; }
.pz-chain-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.pz-chain-svg line {
  stroke: #8e44ad;
  stroke-width: 5;
  stroke-linecap: round;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}
.pz-chain-cell { font-size: 1.25em; }
.pz-chain-cell.pz-done {
  background: linear-gradient(180deg, #ffe9a8, #ffd76e);
  border-color: #e0a400;
  color: #8a5b00;
  cursor: default;
}

/* Лабиринт */
.pz-grid.maze { max-width: 470px; }
.pz-wall {
  background: linear-gradient(180deg, #5d6c82, #4a5870);
  border-color: #445064;
  cursor: not-allowed;
}
.pz-wall:hover { transform: none; box-shadow: none; }
.maze-cell { position: relative; }
.pz-hero {
  font-size: 1.25em;
  line-height: 1;
  animation: pzHeroFloat 1.6s ease-in-out infinite;
}
@keyframes pzHeroFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
.pz-goal-ico { font-size: 1.2em; line-height: 1; }
.pz-start { background: #f3ecff; border-color: #cbb3ee; }
.pz-goal { background: #e6f9ee; border-color: #2e9e63; }

/* Сапёр */
.bomb-cell {
  background: #fff7f7;
  border: 2px dashed #e08a8a;
  color: #c96a6a;
}
.bomb-cell.found {
  background: #ffe9ec;
  border: 2px solid #e74c3c;
  cursor: default;
  animation: pzPop 0.35s ease;
}
.bomb-digit { cursor: default; }
.bomb-digit:hover { transform: none; box-shadow: none; }

/* Последовательные ребусы (Поляна, 1 класс) */
.pz-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 460px;
  margin: 0 auto;
}
.pz-line {
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid #e3d5f7;
  border-radius: 14px;
  padding: 12px 18px;
  text-align: center;
  font-size: 1.35em;
  font-weight: 800;
  color: #4a3f63;
  box-shadow: 0 3px 10px rgba(60, 40, 90, 0.1);
}
.pz-line:last-child { color: #b0327f; }
.pz-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}
.pz-opt {
  min-width: 86px;
  padding: 12px 22px;
  font-family: inherit;
  font-size: 1.15em;
  font-weight: 800;
  color: #5b3f86;
  background: #ffffff;
  border: 2px solid #cbb3ee;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.2s;
}
.pz-opt:hover { transform: translateY(-2px); box-shadow: 0 5px 14px rgba(60, 40, 90, 0.22); }
.pz-opt.correct {
  background: linear-gradient(180deg, #58c98b, #2e9e63);
  border-color: #2e9e63;
  color: #ffffff;
}

/* Демо-ряд из нарисованных предметов (карандаши/башенки) у светлячка */
.pz-row.pz-demo {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin: 10px 0 4px;
}

/* CSS-карандаши (Урок 1, задание «раскрась карандаши») */
.pencil {
  display: inline-block;
  width: 17px;
  height: 46px;
  border-radius: 5px 5px 4px 4px;
  background: var(--c, #ccc);
  border: 2px solid rgba(0, 0, 0, 0.14);
  margin: 8px 2px 0;
  position: relative;
}
.pencil::before {
  content: '';
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 11px solid #ecd9a8;
}
.pencil.empty {
  background: #f4f1e9;
  border-style: dashed;
  border-color: #c9c2b2;
}

/* CSS-башенки из кубиков (Урок 1, задание «башенки») */
.tower {
  display: inline-flex;
  flex-direction: column-reverse;
  gap: 3px;
  vertical-align: middle;
  margin: 0 8px;
  padding-bottom: 3px;
}
.tower i {
  width: 34px;
  height: 15px;
  border-radius: 4px;
  background: var(--c, #ccc);
  border: 2px solid rgba(0, 0, 0, 0.13);
}

/* Варианты-картинки в модалке светлячка */
.modal-option .pencil { height: 40px; width: 14px; }
.modal-option .pencil::before { border-left-width: 6px; border-right-width: 6px; border-bottom-width: 9px; top: -9px; }
.modal-option .tower i { width: 28px; height: 12px; }

/* ============ КОМНАТЫ И ДВЕРИ + СОЕДИНИ ЦИФРЫ ============
   Пазлы из рабочей тетради QuantUM (Урок 3): рисуются SVG,
   решаются кликами. Панель инструментов + подсказка счётчиком. */
.pz-doors-wrap, .pz-nl-wrap, .pz-snake-wrap {
  max-width: 540px;
  margin: 0 auto;
}
.pz-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0 0 12px;
}
.pz-count {
  background: #ffffff;
  border: 2px solid #cbb3ee;
  color: #5b3f86;
  font-weight: 800;
  font-size: 1.05em;
  border-radius: 999px;
  padding: 8px 18px;
  box-shadow: 0 3px 0 #e7dbf9;
  white-space: nowrap;
}
.pz-tool {
  padding: 10px 16px;
  font-family: inherit;
  font-size: 1em;
  font-weight: 800;
  color: #5b3f86;
  background: linear-gradient(180deg, #ffffff, #f3ecff);
  border: 2px solid #cbb3ee;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 3px 0 #d9c8f4;
  transition: transform 0.12s, box-shadow 0.12s;
}
.pz-tool:hover { transform: translateY(-2px); box-shadow: 0 5px 0 #d9c8f4; }
.pz-tool:active { transform: translateY(2px); box-shadow: 0 1px 0 #d9c8f4; }
.pz-doors, .pz-numlink, .pz-snake {
  display: block;
  width: 100%;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 8px 26px rgba(60, 40, 90, 0.16);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
/* Клик-зоны комнат и клеток */
.dz-hit { fill: transparent; cursor: pointer; outline: none; }
.dz-hit:hover { fill: rgba(255, 255, 255, 0.5); }
.dz-hit:focus-visible { stroke: #8e44ad; stroke-width: 4; }
.nl-hit { fill: transparent; cursor: pointer; outline: none; }
.nl-hit:hover { fill: rgba(142, 68, 173, 0.08); }
.nl-hit:focus-visible { stroke: #8e44ad; stroke-width: 3; }
.pz-reveal .dz-hit, .pz-reveal .nl-hit { pointer-events: none; cursor: default; }
/* Порог двери: пунктир → зелёный, когда линия прошла */
.pz-doors line.used { stroke: #2e9e63 !important; stroke-dasharray: none !important; }
/* Пульсирующее кольцо красной точки старта */
.dz-start-ring {
  fill: none;
  stroke: #e53935;
  stroke-width: 4;
  opacity: 0.55;
  animation: dzRing 1.5s ease-out infinite;
}
@keyframes dzRing {
  0% { transform: scale(0.75); opacity: 0.7; }
  70% { transform: scale(1.25); opacity: 0.12; }
  100% { transform: scale(1.25); opacity: 0; }
}
.dz-start-ring, .nl-chip { transform-box: fill-box; transform-origin: center; }
.nl-chip { transition: stroke-width 0.15s; }
.nl-num { font-family: inherit; }

/* Числовая змейка: выделение выбранной клетки мягко пульсирует,
   вопросики в пустых клетках чуть пританцовывают */
.sn-sel { transform-box: fill-box; transform-origin: center; animation: snSel 1.3s ease-in-out infinite; }
@keyframes snSel {
  0%, 100% { stroke-opacity: 1; }
  50% { stroke-opacity: 0.4; }
}
.sn-q { animation: snQ 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes snQ {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
.pz-snake + .pz-pad { max-width: 540px; margin-left: auto; margin-right: auto; }

/* Мобильная версия головоломок */
@media (max-width: 600px) {
  .pz-grid { max-width: 340px; gap: 5px; }
  .pz-cell { border-radius: 9px; font-size: 1.15em; }
  .pz-chain-wrap, .pz-grid.maze { max-width: 340px; }
  .pz-pad-btn { min-width: 46px; min-height: 46px; font-size: 1.1em; }
  .pz-line { font-size: 1.12em; padding: 10px 12px; }
  .pencil { width: 13px; height: 34px; margin-top: 7px; }
  .pencil::before { border-left-width: 6px; border-right-width: 6px; border-bottom-width: 8px; top: -8px; }
  .tower i { width: 26px; height: 12px; }
  .pz-doors-wrap, .pz-nl-wrap, .pz-snake-wrap { max-width: 100%; }
  .pz-snake + .pz-pad { max-width: 100%; }
  .pz-snake + .pz-pad .pz-pad-btn { min-width: 42px; min-height: 44px; font-size: 1.05em; padding: 7px 9px; }
  .pz-count { font-size: 0.95em; padding: 7px 14px; }
  .pz-tool { padding: 9px 13px; font-size: 0.95em; }
}

/* ============ ЛАБИРИНТ С ТУМАНОМ ============
   Тёмные клетки прячут и стены, и дорогу — видно только область вокруг феи.
   Туман мягко «дышит», чтобы поле выглядело живым. */
.pz-grid.maze.fogmaze { max-width: 470px; }
.pz-cell.pz-fog {
  background: linear-gradient(135deg, #4d4668, #352e4d, #4d4668);
  background-size: 220% 220%;
  border-color: #3b3454;
  animation: pzFogDrift 5s ease-in-out infinite;
}
.pz-cell.pz-fog:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 14px rgba(142, 68, 173, 0.55);
  border-color: #8e44ad;
}
@keyframes pzFogDrift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.pz-cell.pz-fog.pz-wall { cursor: pointer; } /* в тумане даже стены кликабельны — разведка! */

/* Бонусный пин на карте (1 класс): золотое сияние, чтобы заметили секрет */
.location-btn.bonus .location-emoji {
  filter: drop-shadow(0 0 10px rgba(255, 205, 80, 0.95)) drop-shadow(0 0 22px rgba(255, 160, 0, 0.5));
  animation: bonusPulse 1.6s ease-in-out infinite;
}
@keyframes bonusPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

/* ============================================================
   ДВИЖКИ 2 КЛАССА (шифры, таблицы, мешок, стулья, Колобок…)
   ============================================================ */

/* Алфавитная лента (шифры) */
.g2-alpha {
  display: flex; flex-wrap: wrap; gap: 3px;
  justify-content: center;
  max-width: 640px; margin: 0 auto 14px;
  background: #fffbe9; border: 2px solid #f2d98c; border-radius: 14px;
  padding: 8px 10px;
}
.g2-alpha-cell {
  display: inline-flex; flex-direction: column; align-items: center;
  min-width: 30px; padding: 2px 3px; border-radius: 7px;
  background: #fff; border: 1.5px solid #eadfb8;
}
.g2-alpha-cell b { font-size: 0.92em; color: #4b5563; line-height: 1.15; }
.g2-alpha-cell i { font-style: normal; font-size: 0.68em; color: #b08b2e; line-height: 1.1; }

/* Легенда «язык значков» */
.g2-legend {
  max-width: 560px; margin: 0 auto 12px;
  background: #fff; border: 2px solid #e5d9f2; border-radius: 16px;
  padding: 10px 14px; display: grid; gap: 8px;
}
.g2-legend-row { display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; }
.g2-legend-sym { font-size: 1.5em; letter-spacing: 2px; }
.g2-legend-eq { color: #8e44ad; font-weight: 800; }
.g2-legend-txt { color: #4b5563; font-size: 1.02em; }
.g2-code-line {
  font-size: 1.75em; letter-spacing: 4px; text-align: center;
  background: #2d2a45; color: #ffe9a8; border-radius: 14px;
  padding: 10px 18px; max-width: 480px; margin: 0 auto 14px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* Шифр-плиточки */
.g2-tiles { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin: 4px 0 14px; }
.g2-tile-group {
  display: flex; gap: 8px; padding: 10px 12px;
  background: #fff; border: 2px dashed #d9cdf0; border-radius: 14px;
}
.g2-tile {
  width: 58px; height: 62px; border-radius: 12px;
  background: #f4effc; border: 3px solid #b9a5e3;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.55em; font-weight: 800; color: #5b4a8a;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
  user-select: none;
}
.g2-tile:hover { transform: translateY(-3px); box-shadow: 0 6px 14px rgba(142, 68, 173, 0.25); }
.g2-tile.sel { border-color: #8e44ad; background: #fff; box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.3); }
.g2-tile.done { border-color: #27ae60; background: #eafff1; color: #1e8a4c; cursor: default; }
.g2-tile.revealed { border-style: solid; }

/* Слово-шифровка (мэтчинг) */
.g2-match { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.g2-match-col { display: grid; gap: 8px; min-width: 150px; }
.g2-match-col h4 { margin: 0 0 2px; text-align: center; color: #7d8b97; font-size: 0.95em; }
.g2-match-item {
  padding: 12px 16px; border-radius: 12px; border: 2.5px solid #cfd8e3;
  background: #fff; font-size: 1.15em; font-weight: 700; color: #4b5563;
  cursor: pointer; transition: all 0.15s;
}
.g2-match-item:hover { border-color: #8e44ad; transform: translateY(-2px); }
.g2-match-item.sel { border-color: #8e44ad; background: #f4effc; box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.25); }
.g2-match-item.done { border-color: #27ae60; background: #eafff1; color: #1e8a4c; cursor: default; transform: none; }
.g2-match-item.revealed { outline: 3px dashed #27ae60; }

/* Роботы-имена */
.g2-robot-legend { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 10px; }
.g2-robot-card {
  background: #fff; border: 2px solid #e5d9f2; border-radius: 16px;
  padding: 8px 10px 6px; text-align: center;
}
.g2-robot-name { display: block; font-weight: 800; color: #6b3fa0; font-size: 0.92em; letter-spacing: 0.5px; }
.g2-robot-target { text-align: center; font-size: 1.25em; color: #4b5563; margin-bottom: 10px; }
.g2-robot-target b { color: #8e44ad; letter-spacing: 1px; }
.g2-robot-builder {
  display: flex; gap: 16px; align-items: flex-start; justify-content: center;
  flex-wrap: wrap; background: #fff; border: 2px solid #e5d9f2;
  border-radius: 18px; padding: 14px 16px; max-width: 660px; margin: 0 auto;
}
.g2-robot-preview { min-width: 120px; }
.g2-robot-preview.good { filter: drop-shadow(0 0 12px rgba(39, 174, 96, 0.65)); }
.g2-robot-part { display: grid; gap: 6px; }
.g2-robot-part-name { font-weight: 700; color: #7d8b97; font-size: 0.95em; }
.g2-shape-row { display: flex; gap: 7px; }
.g2-shape-btn {
  width: 46px; height: 46px; border-radius: 12px; border: 2.5px solid #cfd8e3;
  background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; padding: 4px;
}
.g2-shape-btn:hover { border-color: #8e44ad; transform: translateY(-2px); }
.g2-shape-btn.sel { border-color: #8e44ad; background: #f4effc; box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.25); }
.g2-shape-btn.revealed { border-color: #27ae60; background: #eafff1; }

/* Собери шифровку */
.g2-built { display: flex; gap: 10px; justify-content: center; margin: 6px 0 14px; }
.g2-built-slot {
  width: 62px; height: 66px; border-radius: 14px; background: #fff;
  border: 3px dashed #b9a5e3; display: flex; align-items: center; justify-content: center;
  font-size: 1.7em; color: #b9c2cc; transition: all 0.15s;
}
.g2-built-slot.filled { border-style: solid; border-color: #8e44ad; background: #f9f6fd; }
.g2-built-slot.revealed { border-color: #27ae60; background: #eafff1; }
.g2-palette { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 520px; margin: 0 auto; }
.g2-pal-btn {
  width: 58px; height: 58px; border-radius: 14px; border: 2.5px solid #cfd8e3;
  background: #fff; font-size: 1.65em; cursor: pointer; transition: all 0.15s;
}
.g2-pal-btn:hover { border-color: #8e44ad; transform: translateY(-3px) scale(1.05); }
.g2-pal-btn:disabled { opacity: 0.45; cursor: default; transform: none; }

/* Мешок невезения */
.g2-bag { text-align: center; }
.g2-bag-goal {
  display: inline-block; background: #fff4e0; border: 2px solid #f2c98c;
  border-radius: 14px; padding: 9px 16px; color: #8a5a19; font-weight: 700;
  margin-bottom: 14px; max-width: 520px;
}
.g2-bag-main { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.g2-bag-btn {
  border: none; background: radial-gradient(circle at 35% 30%, #c9a7f5, #8e44ad);
  width: 130px; height: 130px; border-radius: 38px; cursor: pointer;
  display: grid; place-items: center; position: relative;
  box-shadow: 0 10px 0 #5d2d75, 0 16px 26px rgba(93, 45, 117, 0.4);
  transition: transform 0.12s, box-shadow 0.12s;
}
.g2-bag-btn:hover { transform: translateY(-3px); }
.g2-bag-btn:active { transform: translateY(4px); box-shadow: 0 4px 0 #5d2d75; }
.g2-bag-btn.off { filter: grayscale(0.7); opacity: 0.65; cursor: default; transform: none; }
.g2-bag-emoji { font-size: 3.2em; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.3)); }
.g2-bag-count { color: #fff; font-weight: 800; font-size: 0.95em; text-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.g2-bag-btn-hint { position: absolute; bottom: -30px; left: 50%; transform: translateX(-50%); white-space: nowrap; color: #6b4a86; font-weight: 700; font-size: 0.92em; }
.g2-pulled { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 64px; max-width: 560px; }
.g2-chip {
  display: inline-flex; flex-direction: column; align-items: center;
  padding: 6px 10px; border-radius: 12px; background: #fff;
  border: 2.5px solid #cfd8e3; animation: g2Pop 0.3s ease;
}
@keyframes g2Pop { 0% { transform: scale(0.3) rotate(-14deg); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
.g2-chip-e { font-size: 1.55em; }
.g2-chip-t { font-size: 0.68em; color: #7d8b97; font-weight: 700; }
.g2-c-bel { background: #f5f7fa; } .g2-c-kras, .g2-c-kr, .g2-c-ap { background: #fdeaea; }
.g2-c-zel, .g2-c-ze, .g2-c-ban { background: #eafbea; }
.g2-c-zh { background: #fdf6dd; } .g2-c-si { background: #e8f1fd; }
.g2-c-or { background: #fdeeda; } .g2-c-kar { background: #f3ecfb; }
.g2-c-sho { background: #efe2d8; } .g2-c-gr { background: #eef7e0; }
.g2-flip .g2-chip-e { display: inline-block; transform: scaleX(-1); }

/* Ввод числа */
.g2-num-disp {
  width: 130px; margin: 0 auto 12px; padding: 10px 14px;
  background: #2d2a45; color: #ffe9a8; border-radius: 14px;
  font-size: 1.9em; font-weight: 800; text-align: center;
  text-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.g2-num-disp.revealed { background: #1e8a4c; color: #eafff1; }
.g2-numin-rows { max-width: 560px; margin: 0 auto 14px; display: grid; gap: 8px; }
.g2-nrow {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  background: #fff; border: 2px solid #eef1f5; border-radius: 14px;
  padding: 8px 12px; font-size: 1.3em;
}
.g2-nrow i { font-style: normal; color: #7d8b97; font-size: 0.78em; margin-left: 8px; }
.g2-cube { width: 26px; height: 26px; border-radius: 7px; background: var(--c, #ccc); display: inline-block; border: 2px solid rgba(0,0,0,0.15); }
.g2-actions { margin-top: 12px; }
.g2-hint-note { text-align: center; color: #7d8b97; font-size: 0.95em; margin: 8px 0; }

/* Логическая таблица */
.g2-logtab-wrap { overflow-x: auto; max-width: 640px; margin: 0 auto 6px; }
.g2-logtab { border-collapse: separate; border-spacing: 4px; margin: 0 auto; width: 100%; }
.g2-logtab th {
  background: #f4effc; color: #6b3fa0; font-weight: 800;
  border-radius: 10px; padding: 8px 6px; font-size: 0.95em;
}
.g2-logtab thead th { background: #f9d976; color: #6b5416; }
.g2-lt-cell {
  width: 100%; min-width: 64px; height: 52px; border-radius: 10px;
  border: 2.5px solid #d9cdf0; background: #fff; cursor: pointer;
  font-size: 1.5em; font-weight: 800; transition: all 0.15s;
}
.g2-lt-cell:hover { border-color: #8e44ad; background: #faf7fe; }
.g2-lt-cell.plus { border-color: #27ae60; background: #eafff1; color: #1e8a4c; }
.g2-lt-cell.minus { border-color: #e67e22; background: #fdf3e7; color: #b3541e; }
.g2-lt-cell.revealed { cursor: default; }
.g2-lt-cell.bad { border-color: #e53935; background: #fdeaea; }

/* Раскладка по дням */
.g2-days { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.g2-day { display: grid; gap: 5px; text-align: center; }
.g2-day-name { font-weight: 800; color: #7d8b97; }
.g2-day-val {
  width: 72px; height: 60px; border-radius: 14px; border: 3px solid #cfd8e3;
  background: #fff; font-size: 1.5em; font-weight: 800; color: #4b5563;
  cursor: pointer; transition: all 0.15s;
}
.g2-day-val.sel { border-color: #8e44ad; box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.25); }
.g2-day-val.bad { border-color: #e53935; background: #fdeaea; }
.g2-day-val.revealed { border-color: #27ae60; background: #eafff1; color: #1e8a4c; cursor: default; }

/* Стулья у стен */
.g2-chairs-wrap { max-width: 460px; margin: 0 auto; }
.g2-chairs { width: 100%; max-width: 380px; display: block; margin: 0 auto; }
.g2-ch-hit { fill: transparent; cursor: pointer; outline: none; }
.g2-ch-hit:hover { fill: rgba(142, 68, 173, 0.12); }
.g2-ch-hit:focus-visible { stroke: #8e44ad; stroke-width: 3; }
.g2-ch-chair { pointer-events: none; }
.g2-wall-counts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.g2-wall-counts span {
  background: #fff; border: 2px solid #e3e8ef; border-radius: 999px;
  padding: 5px 12px; font-weight: 700; color: #4b5563; font-size: 0.92em;
}
.g2-wall-counts span.dup { border-color: #e53935; color: #b71c1c; background: #fdeaea; }

/* Колобок и лиса */
.g2-kb-wrap { max-width: 560px; margin: 0 auto; }
.g2-kb { width: 100%; display: block; background: #fdfaf0; border-radius: 14px; }
.g2-kb-hit { fill: transparent; cursor: pointer; outline: none; }
.g2-kb-hit:hover { fill: rgba(229, 57, 53, 0.18); }
.g2-kb-hit:focus-visible { stroke: #e53935; stroke-width: 3; }
.g2-kb-bar { animation: g2BarIn 0.25s ease; }
@keyframes g2BarIn { 0% { opacity: 0; } 100% { opacity: 1; } }
.g2-kb-actor { pointer-events: none; }

/* Камень в сундуке */
.g2-rotate-wrap { max-width: 560px; margin: 0 auto; text-align: center; }
.g2-rotate { width: 100%; max-width: 520px; display: block; margin: 0 auto; }
.g2-stone { fill: #b9a5e3; stroke: #6b3fa0; stroke-width: 5; stroke-linejoin: round; }
.g2-chest { fill: #8d6e63; stroke: #4e342e; stroke-width: 5; }
.g2-hole { fill: #4e342e; stroke: #3a2723; stroke-width: 3; stroke-linejoin: round; }
.g2-rotate-label { font-size: 0.42em; fill: #7d8b97; font-weight: 700; }

/* Демо-картинки в светлячках (весы, треугольники) */
.g2-scales-demo { display: inline-flex; align-items: center; gap: 10px; font-size: 2em; }
.g2-scale-cup { background: #f4effc; border: 2.5px solid #b9a5e3; border-radius: 12px; padding: 8px 14px; }
.g2-scale-cup.empty { border-style: dashed; color: #b9a5e3; }
.g2-scale-beam { width: 60px; height: 5px; background: #8e7cc3; border-radius: 3px; }
.g2-tri-fig { max-width: 340px; width: 100%; display: block; margin: 4px auto; background: #fff; border-radius: 12px; }

/* Мобильная версия движков 2 класса */
@media (max-width: 600px) {
  .g2-tile { width: 50px; height: 54px; font-size: 1.3em; }
  .g2-built-slot { width: 52px; height: 56px; font-size: 1.4em; }
  .g2-pal-btn { width: 52px; height: 52px; font-size: 1.4em; }
  .g2-lt-cell { min-width: 48px; height: 46px; font-size: 1.25em; }
  .g2-logtab th { font-size: 0.78em; padding: 6px 3px; }
  .g2-day-val { width: 62px; height: 54px; font-size: 1.3em; }
  .g2-num-disp { width: 110px; font-size: 1.6em; }
  .g2-bag-btn { width: 112px; height: 112px; }
  .g2-robot-builder { gap: 10px; padding: 10px; }
  .g2-alpha { gap: 2px; padding: 6px; }
  .g2-alpha-cell { min-width: 24px; }
  .g2-alpha-cell b { font-size: 0.8em; }
  .g2-alpha-cell i { font-size: 0.62em; }
  .pz-pad-btn { min-height: 46px; }
  .pz-pad .pz-pad-btn { min-width: 44px; }
}

/* ============================================================
   ===== ДВИЖКИ 4 КЛАССА: рыцари и лжецы, карточки, закраска =====
   ============================================================ */

/* — Рыцари и лжецы: ряд персонажей — */
.kn-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin: 12px 0 4px; }
.kn-char {
  position: relative; width: 132px; max-width: 31vw; padding: 10px 8px 8px;
  background: #fffdf5; border: 3px solid #d8c9f0; border-radius: 16px;
  text-align: center; cursor: pointer; user-select: none;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  min-height: 44px;
}
.kn-char:hover { transform: translateY(-3px); border-color: #a97fd8; box-shadow: 0 6px 14px rgba(120, 80, 180, .18); }
.kn-char:focus-visible { outline: 3px solid #f6a21e; outline-offset: 2px; }
.kn-face { font-size: 2.6em; line-height: 1.1; filter: grayscale(.65) opacity(.75); transition: filter .15s; }
.kn-name { font-weight: 800; color: #5a4a72; font-size: .92em; margin-top: 2px; }
.kn-bubble {
  margin-top: 6px; background: #f3ecfb; border: 1.5px dashed #b79ae0; border-radius: 10px;
  padding: 6px 7px; font-size: .78em; color: #4a3b63; line-height: 1.35; min-height: 30px;
}
.kn-bubble.kn-silent { color: #a08fc0; font-style: italic; }
.kn-badge {
  position: absolute; top: -12px; right: -8px; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 2.5px solid #c9b6e8; border-radius: 50%;
  font-size: 17px; font-weight: 700; color: #b3a2cf; box-shadow: 0 2px 6px rgba(90, 60, 140, .25);
}
.kn-char.is-knight { border-color: #7cb342; background: #f4faf0; }
.kn-char.is-knight .kn-face { filter: none; }
.kn-char.is-knight .kn-badge { border-color: #7cb342; background: #eaf6df; }
.kn-char.is-liar { border-color: #e57373; background: #fdf2f2; }
.kn-char.is-liar .kn-face { filter: none; }
.kn-char.is-liar .kn-badge { border-color: #e57373; background: #fceaea; }
.kn-char.solved { animation: kn-pop .5s ease; }
@keyframes kn-pop { 0% { transform: scale(1); } 45% { transform: scale(1.08); } 100% { transform: scale(1); } }
.kn-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin: 8px 0 2px; font-size: .82em; color: #6a5a85; }
.kn-legend-item { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.kn-legend-item i { width: 18px; height: 18px; border-radius: 6px; display: inline-block; border: 2px solid #ccc; }
.kn-legend-item i.kn-k { background: #cde6b6; border-color: #7cb342; }
.kn-legend-item i.kn-l { background: #f6c6c6; border-color: #e57373; }
.kn-legend-hint { color: #9a8ab5; }

/* — Гибридный режим «круга рыцарей» для БОЛЬШИХ столов (N ≥ 8):
   компактный круг из фишек-номеров + читаемый список фраз. — */
.kn-hybrid { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 8px 0 4px; }
.kn-mini-stage {
  position: relative; width: 100%; max-width: 480px; height: 340px;
  margin: 4px auto 2px;
}
.kn-mini-pos { position: absolute; transform: translate(-50%, -50%); }
.kn-mini {
  width: var(--kn-size, 56px); height: var(--kn-size, 56px); border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #fffdf5; border: 2.5px solid #d8c9f0; cursor: pointer; position: relative;
  font-family: inherit; padding: 0; transition: transform .12s, border-color .12s, box-shadow .12s;
  box-shadow: 0 3px 8px rgba(120, 80, 180, .14);
}
.kn-mini:hover { transform: scale(1.1); border-color: #a97fd8; z-index: 3; }
.kn-mini:focus-visible { outline: 3px solid #f6a21e; outline-offset: 2px; }
.kn-mini-face { font-size: calc(var(--kn-size, 56px) * .38); line-height: 1.05; filter: grayscale(.65) opacity(.7); transition: filter .15s; }
.kn-mini-num { font-size: calc(var(--kn-size, 56px) * .24); font-weight: 900; color: #5a4a72; line-height: 1.1; }
.kn-mini-badge {
  position: absolute; top: -7px; right: -7px; width: calc(var(--kn-size, 56px) * .44); height: calc(var(--kn-size, 56px) * .44);
  border-radius: 50%; background: #fff; border: 2px solid #c9b6e8;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--kn-size, 56px) * .22); font-weight: 800; color: #b3a2cf;
}
.kn-mini.is-knight { border-color: #7cb342; background: #f4faf0; box-shadow: 0 0 0 3px rgba(124, 179, 66, .25); }
.kn-mini.is-knight .kn-mini-face { filter: none; }
.kn-mini.is-knight .kn-mini-badge { border-color: #7cb342; background: #eaf6df; color: #33691e; }
.kn-mini.is-liar { border-color: #e57373; background: #fdf2f2; box-shadow: 0 0 0 3px rgba(229, 115, 115, .22); }
.kn-mini.is-liar .kn-mini-face { filter: none; }
.kn-mini.is-liar .kn-mini-badge { border-color: #e57373; background: #fceaea; color: #b03a3a; }
/* Список фраз: чёткие строки, длинные списки прокручиваются */
.kn-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px;
  width: 100%; max-width: 680px;
  max-height: 340px; overflow-y: auto; padding: 4px 8px 4px 4px;
  scrollbar-width: thin; scrollbar-color: #cdbcec transparent;
}
.kn-cards::-webkit-scrollbar { width: 8px; }
.kn-cards::-webkit-scrollbar-thumb { background: #cdbcec; border-radius: 8px; }
.kn-cards::-webkit-scrollbar-track { background: transparent; }
.kn-card {
  display: flex; align-items: center; gap: 8px; text-align: left;
  background: #fffdf5; border: 2px solid #e4d9f5; border-radius: 12px;
  padding: 7px 9px; min-height: 44px; cursor: pointer; user-select: none;
  transition: border-color .12s, background .12s, transform .12s;
}
.kn-card:hover { border-color: #a97fd8; transform: translateY(-1px); }
.kn-card:focus-visible { outline: 3px solid #f6a21e; outline-offset: 1px; }
.kn-card-num {
  flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%;
  background: #f3ecfb; border: 2px solid #cdbcec; color: #6a5a85;
  display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: .82em;
}
.kn-card-face { font-size: 1.35em; line-height: 1; filter: grayscale(.6) opacity(.7); }
.kn-card-say { flex: 1; font-size: .8em; color: #4a3b63; line-height: 1.3; }
.kn-card-role {
  flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%;
  background: #fff; border: 2px solid #c9b6e8; color: #b3a2cf;
  display: flex; align-items: center; justify-content: center; font-size: .95em; font-weight: 800;
}
.kn-card.is-knight { border-color: #7cb342; background: #f4faf0; }
.kn-card.is-knight .kn-card-face { filter: none; }
.kn-card.is-knight .kn-card-num { border-color: #7cb342; background: #eaf6df; color: #33691e; }
.kn-card.is-knight .kn-card-role { border-color: #7cb342; background: #eaf6df; color: #33691e; }
.kn-card.is-liar { border-color: #e57373; background: #fdf2f2; }
.kn-card.is-liar .kn-card-face { filter: none; }
.kn-card.is-liar .kn-card-num { border-color: #e57373; background: #fceaea; color: #b03a3a; }
.kn-card.is-liar .kn-card-role { border-color: #e57373; background: #fceaea; color: #b03a3a; }
.kn-card.revealed, .kn-mini.revealed { animation: kn-pop .5s ease; }
@media (max-width: 600px) {
  .kn-mini-stage { height: 300px; }
  .kn-cards { grid-template-columns: 1fr; max-height: 300px; }
  .kn-card-say { font-size: .78em; }
}

/* — Рыцари и лжецы: круглый стол — */
.kn-stage { position: relative; width: 100%; max-width: 500px; height: 470px; margin: 10px auto 26px; }
.kn-table {
  position: absolute; left: 50%; top: 50%; width: 46%; height: 46%; transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 30%, #a9744f, #7d4f30);
  border: 6px solid #5d3a20; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 18px rgba(0,0,0,.35), 0 8px 18px rgba(70, 40, 10, .3);
}
.kn-arrow { font-size: 30px; color: #ffe9c9; text-shadow: 0 2px 4px rgba(0,0,0,.5); animation: kn-spin 6s linear infinite; }
@keyframes kn-spin { to { transform: rotate(360deg); } }
.kn-pos { position: absolute; width: 128px; margin-left: -64px; margin-top: -62px; }
.kn-dense .kn-pos { width: 106px; margin-left: -53px; margin-top: -58px; }
.kn-dense .kn-char { width: 100%; padding: 6px 4px 5px; border-width: 2.5px; }
.kn-dense .kn-face { font-size: 1.9em; }
.kn-dense .kn-name { font-size: .74em; }
.kn-dense .kn-bubble { font-size: .62em; padding: 4px 5px; min-height: 24px; border-radius: 8px; }
.kn-dense .kn-badge { width: 27px; height: 27px; font-size: 13px; top: -9px; right: -6px; }

/* — Карточки-переворот — */
.cards-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin: 14px 0 6px; }
.pz-card { width: 108px; height: 140px; cursor: pointer; perspective: 700px; user-select: none; }
.pz-card:focus-visible { outline: 3px solid #f6a21e; outline-offset: 3px; border-radius: 14px; }
.pz-card-inner { position: relative; width: 100%; height: 100%; transition: transform .55s; transform-style: preserve-3d; }
.pz-card.flipped .pz-card-inner { transform: rotateY(180deg); }
.pz-card-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center; text-align: center;
  border-radius: 14px; padding: 8px;
}
.pz-card-front {
  background: linear-gradient(160deg, #ffb64d, #f6a21e);
  border: 3px solid #d98a0b; color: #fff; font-size: 2.6em; font-weight: 900;
  text-shadow: 0 2px 5px rgba(140, 80, 0, .4); box-shadow: 0 5px 12px rgba(200, 130, 20, .3);
}
.pz-card-back {
  background: linear-gradient(160deg, #f7f2ff, #e9defc);
  border: 3px solid #a97fd8; color: #4a3b63; font-size: .78em; line-height: 1.3;
  transform: rotateY(180deg);
}
.pz-card.sel { transform: translateY(-6px); }
.pz-card.sel .pz-card-front { border-color: #2e7d32; background: linear-gradient(160deg, #8bc34a, #689f38); box-shadow: 0 0 0 4px rgba(104, 159, 56, .35), 0 5px 12px rgba(200, 130, 20, .3); }
.pz-card.revealed .pz-card-back { border-color: #7cb342; }

/* — Закрась клетки — счётчики идут ВДОЛЬ квадрата: строки справа, столбцы снизу.
   --pn задаётся на .paint-area (нужен и сетке, и обоим рядам счётчиков). */
.paint-area {
  display: inline-grid; grid-template-columns: minmax(0, 320px) auto; grid-template-rows: auto auto;
  grid-template-areas: "grid rows" "cols corner";
  gap: 7px; margin: 12px auto 4px; justify-content: center; align-items: center;
}
.paint-grid {
  grid-area: grid; display: grid; grid-template-columns: repeat(var(--pn), 1fr);
  width: 100%; max-width: 320px; aspect-ratio: 1; gap: 4px;
  background: #efe7fa; padding: 6px; border-radius: 14px; border: 3px solid #d8c9f0;
}
.paint-cell {
  background: #fff; border: 2px solid #cdbcec; border-radius: 8px; cursor: pointer;
  transition: background .12s, transform .12s; min-width: 44px; min-height: 44px;
}
.paint-cell:hover { transform: scale(1.06); }
.paint-cell:focus-visible { outline: 3px solid #f6a21e; outline-offset: 1px; }
.paint-cell.on { background: radial-gradient(circle at 32% 30%, #ff8f5e, #e65100); border-color: #bf360c; box-shadow: inset 0 0 6px rgba(120, 40, 0, .4); }
.paint-cell.revealed { border-color: #7cb342; }
/* Отступ 9px = рамка (3px) + внутренний отступ сетки (6px) — счётчики стоят ровно
   под столбцами / справа от строк, как будто «приклеены» к краям квадрата. */
.paint-rows { grid-area: rows; display: grid; grid-template-rows: repeat(var(--pn), 1fr); gap: 4px; height: 100%; padding: 9px 0; align-self: stretch; }
.paint-cols { grid-area: cols; display: grid; grid-template-columns: repeat(var(--pn), 1fr); gap: 4px; width: 100%; max-width: 320px; padding: 0 9px; }
.paint-corner { grid-area: corner; }
.paint-count {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; margin: auto; border-radius: 10px;
  background: #fff; border: 2.5px solid #d8c9f0; color: #8a76ad; font-weight: 900; font-size: 1em;
}
.paint-count.ok { background: #eaf6df; border-color: #7cb342; color: #33691e; }

/* — Мобильная версия движков 4 класса — */
@media (max-width: 600px) {
  .kn-char { width: 108px; }
  .kn-row { gap: 10px; }
  .kn-stage { height: 400px; margin: 8px auto 20px; }
  .kn-pos { width: 92px; margin-left: -46px; margin-top: -56px; }
  .kn-face { font-size: 2.1em; }
  .kn-bubble { font-size: .68em; }
  .kn-dense .kn-pos { width: 74px; margin-left: -37px; margin-top: -42px; }
  .kn-dense .kn-char { padding: 4px 2px 4px; }
  .kn-dense .kn-face { font-size: 1.45em; }
  .kn-dense .kn-name { font-size: .6em; }
  .kn-dense .kn-bubble { font-size: .52em; }
  .pz-card { width: 84px; height: 116px; }
  .pz-card-front { font-size: 2em; }
  .pz-card-back { font-size: .62em; }
  .paint-area { grid-template-columns: minmax(0, 250px) auto; }
  .paint-grid { max-width: 250px; }
  .paint-cols { max-width: 250px; padding: 0 9px; }
  .paint-cell { min-width: 34px; min-height: 34px; }
  .paint-count { width: 26px; height: 26px; font-size: .85em; }
}

/* — ✂️ Разрезания (5 класс) — */
.cut-grid {
  display: grid; grid-template-columns: repeat(var(--cut-cols), 1fr);
  width: 100%; max-width: 460px; gap: 4px; margin: 14px auto 6px;
  background: #fff; padding: 8px; border-radius: 16px; border: 3px solid #f0c987;
  box-shadow: 0 6px 18px rgba(180, 120, 20, .15);
}
.cut-cell {
  aspect-ratio: 1; background: #fdf8ef; border: 2px solid #e8c99a; border-radius: 10px;
  cursor: pointer; transition: transform .1s, box-shadow .15s; min-width: 44px; min-height: 44px;
  position: relative;
}
.cut-cell:hover { transform: scale(1.07); z-index: 2; box-shadow: 0 3px 10px rgba(180, 120, 20, .3); }
.cut-cell:focus-visible { outline: 3px solid #f6a21e; outline-offset: 1px; }
.cut-cell.filled { border-color: rgba(0, 0, 0, .22); box-shadow: inset 0 0 5px rgba(0, 0, 0, .12); }
.cut-cell.revealed { border-color: #7cb342; }
.cut-gap { aspect-ratio: 1; }
.cut-legend {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
  margin: 6px 0 2px; font-size: .82em; color: #7a5c2e; font-weight: 700;
}
.cut-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.cut-legend-item i {
  width: 20px; height: 20px; border-radius: 7px; display: inline-block;
  border: 2px solid rgba(0, 0, 0, .2);
}

/* — 🛢 Переливания кваса (5 класс) — */
.barrels-goal {
  text-align: center; background: #fff8e8; border: 2.5px solid #f0c987;
  border-radius: 14px; padding: 10px 14px; margin: 10px auto 4px;
  max-width: 520px; color: #7a5c2e; font-size: .95em;
}
.barrels-moves { color: #d84315; }
.barrels-row {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
  margin: 14px 0 4px;
}
.barrel-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.barrel {
  width: 74px; height: 88px; border-radius: 18px/22px; cursor: pointer;
  background: linear-gradient(180deg, #d2691e 0%, #a0522d 50%, #8b4513 100%);
  border: 3px solid #6d3410; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: transform .12s, box-shadow .15s; box-shadow: inset 0 0 0 3px rgba(255, 220, 150, .25), 0 4px 10px rgba(100, 60, 10, .3);
}
.barrel::before, .barrel::after {
  content: ''; position: absolute; left: 6%; right: 6%; height: 5px;
  background: #f3c980; border-radius: 4px; opacity: .85;
}
.barrel::before { top: 16%; }
.barrel::after { bottom: 16%; }
.barrel-num { font-size: 1.5em; font-weight: 900; color: #fff; text-shadow: 0 2px 4px rgba(60, 30, 0, .6); line-height: 1; }
.barrel-unit { font-size: .72em; font-weight: 700; color: #ffe0b2; }
.barrel:hover { transform: translateY(-4px); }
.barrel:focus-visible { outline: 3px solid #f6a21e; outline-offset: 2px; }
.barrel.sel { transform: translateY(-6px); box-shadow: 0 0 0 4px #ffd54f, 0 6px 16px rgba(100, 60, 10, .4); }
.barrel.src { box-shadow: 0 0 0 4px #66bb6a, 0 6px 16px rgba(100, 60, 10, .4); }
.barrel.equal { box-shadow: 0 0 0 3px #81c784, inset 0 0 0 3px rgba(120, 220, 130, .35), 0 4px 10px rgba(100, 60, 10, .3); }
.barrel.done { box-shadow: 0 0 0 4px #7cb342, 0 6px 16px rgba(60, 130, 40, .4); }
.barrel:disabled { cursor: default; }
.barrel-label { font-size: .72em; color: #9a8a70; font-weight: 700; }
.barrel-pad {
  background: #fff8e8; border: 2.5px dashed #f0c987; border-radius: 16px;
  padding: 10px 12px; margin: 10px auto; max-width: 460px;
}

/* — 🐴 Конь на доске (5 класс) — */
.horse-goal {
  text-align: center; background: #eef7e8; border: 2.5px solid #b5d89a;
  border-radius: 14px; padding: 10px 14px; margin: 10px auto 4px;
  max-width: 520px; color: #3f5a2a; font-size: .95em;
}
.horse-board {
  display: grid; grid-template-columns: repeat(var(--hb-cols), 1fr);
  width: 100%; max-width: 380px; gap: 4px; margin: 14px auto 6px;
  background: #f3e9d2; padding: 8px; border-radius: 16px; border: 3px solid #cbb489;
}
.horse-board.solved { border-color: #7cb342; box-shadow: 0 0 16px rgba(124, 179, 66, .5); }
.horse-cell {
  aspect-ratio: 1; background: #fffdf7; border: 2px solid #d9c9a4; border-radius: 10px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 1.5em; transition: transform .1s, background .15s; position: relative;
  min-width: 44px; min-height: 44px;
}
.horse-cell.dark { background: #efe2c2; }
.horse-cell:hover { transform: scale(1.06); }
.horse-cell:focus-visible { outline: 3px solid #f6a21e; outline-offset: 1px; }
.horse-cell.visited {
  background: radial-gradient(circle at 35% 30%, #c5e1a5, #8bc34a);
  border-color: #689f38; color: #33691e;
}
.horse-cell.visited::after {
  content: attr(data-step); position: absolute; top: 2px; right: 5px;
  font-size: .6em; font-weight: 800; color: #33691e;
}
.horse-cell.cur { box-shadow: 0 0 0 4px #ffd54f; z-index: 2; }
.horse-cell.jump { background: #fff3cd; border-color: #f0b429; animation: horse-pulse 1s infinite; }
@keyframes horse-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(240, 180, 41, .55); } 50% { box-shadow: 0 0 0 7px rgba(240, 180, 41, 0); } }
.horse-cell.revealed { border-color: #7cb342; }

/* — ⭐ Ряд с пропусками (5 класс) — */
.sf-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 14px 0 4px; }
.sf-cell {
  width: 48px; height: 52px; border-radius: 12px; border: 3px solid #cdbcec;
  background: #fff; font-family: inherit; font-size: 1.25em; font-weight: 800; color: #4a3b63;
  cursor: pointer; transition: transform .1s; padding: 0;
}
.sf-cell.fixed { background: #efe7fa; border-style: solid; cursor: default; color: #8a76ad; }
.sf-cell.empty { background: #fff8e8; border-color: #f0c987; color: #d84315; }
.sf-cell.sel { transform: translateY(-4px); box-shadow: 0 0 0 4px #ffd54f; }
.sf-cell.revealed { border-color: #7cb342; background: #eaf6df; color: #33691e; }
.sf-cell:focus-visible { outline: 3px solid #f6a21e; outline-offset: 2px; }

/* — 🧊 Куб и вершины (5 класс) — */
.cube-wrap { display: flex; justify-content: center; margin: 8px auto 4px; }
.cube-svg { width: 100%; max-width: 430px; height: auto; }
.cube-edge { stroke: #a97fd8; stroke-width: 3; stroke-linecap: round; opacity: .75; }
.cube-hit { fill: transparent; cursor: pointer; }
.cube-node { fill: #fff; stroke: #ba68c8; stroke-width: 3; cursor: pointer; transition: fill .15s; }
.cube-txt { font-size: 19px; font-weight: 800; fill: #6a3fa0; text-anchor: middle; pointer-events: none; font-family: inherit; }
.cube-v:hover .cube-node { fill: #f8e7ff; }
.cube-v:focus-visible { outline: none; }
.cube-v:focus-visible .cube-node { stroke: #f6a21e; stroke-width: 4; }
.cube-v.sel .cube-node { fill: #ffd54f; stroke: #f6a21e; }
.cube-v.filled .cube-node { fill: #eaf6df; stroke: #7cb342; }
.cube-v.filled .cube-txt { fill: #33691e; }
.cube-v.solved .cube-node { fill: #c5e1a5; stroke: #558b2f; }
.cube-v.revealed .cube-node { fill: #eaf6df; stroke: #7cb342; }

/* — Мобильная версия движков 5 класса — */
@media (max-width: 600px) {
  .cut-grid { max-width: 330px; gap: 3px; padding: 6px; }
  .cut-cell { min-width: 34px; min-height: 34px; border-radius: 8px; }
  .barrel { width: 60px; height: 74px; }
  .barrel-num { font-size: 1.2em; }
  .barrels-row { gap: 7px; }
  .horse-board { max-width: 300px; }
  .horse-cell { min-width: 34px; min-height: 34px; font-size: 1.2em; }
  .sf-cell { width: 40px; height: 46px; font-size: 1.05em; }
  .cube-svg { max-width: 340px; }
}

/* ============================================================
   Движки 6 класса: мишень, компас-угол, граф-маршрут, башни
   ============================================================ */

/* Общие SVG-иллюстрации в задачах (рисунки к choice/numin) */
.pz-fig { display: flex; justify-content: center; margin: 6px auto 10px; }
.pz-fig .pz-svg { width: 100%; max-width: 420px; height: auto; background: #fffdf8; border: 2px solid #eee3f7; border-radius: 14px; padding: 6px; }

/* — 🎯 Мишень волшебника — */
.pz-target-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 8px auto 4px; }
.pz-target-svg { width: 100%; max-width: 320px; height: auto; }
.pz-ring { cursor: pointer; transition: filter .15s, stroke-width .1s; }
.pz-ring:hover { filter: brightness(1.12) drop-shadow(0 0 6px rgba(196, 107, 184, .8)); stroke-width: 5; }
.pz-ring:focus-visible { outline: none; stroke: #f6a21e; stroke-width: 5; }
.pz-ring.correct { stroke: #558b2f; stroke-width: 5; animation: ring-hit .6s ease 2; }
.pz-ring.revealed { stroke: #7cb342; stroke-width: 4; fill: rgba(124, 179, 66, .25); }
@keyframes ring-hit { 0%, 100% { filter: none; } 50% { filter: brightness(1.3) drop-shadow(0 0 10px rgba(124, 179, 66, .9)); } }
.pz-target-info { font-size: .92em; color: #6a3fa0; font-weight: 700; text-align: center; min-height: 1.3em; }

/* — 🧭 Компас и сектор — */
.pz-angle-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 8px auto 4px; }
.pz-angle-svg { width: 100%; max-width: 340px; height: auto; cursor: pointer; border-radius: 16px; background: #fffdf8; border: 2px solid #eee3f7; }
.pz-angle-svg.solved { border-color: #7cb342; box-shadow: 0 0 16px rgba(124, 179, 66, .4); }
.pz-angle-svg.revealed { border-color: #7cb342; }
.pz-ang-move { transition: x2 .12s, y2 .12s; }
.pz-ang-label { font-family: inherit; }
.pz-angle-hint { font-size: .85em; color: #8a76ad; text-align: center; }

/* — 🕸 Граф-маршрут — */
.pz-gp-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 8px auto 4px; }
.pz-gp-svg { width: 100%; max-width: 520px; height: auto; background: #fffdf8; border: 2px solid #eee3f7; border-radius: 16px; }
.pz-gp-svg.solved { border-color: #7cb342; box-shadow: 0 0 16px rgba(124, 179, 66, .4); }
.gp-edge { stroke: #c9b8e0; stroke-width: 2; stroke-linecap: round; }
.gp-edge.lit { stroke: #558b2f; stroke-width: 3.5; }
.gp-v { cursor: pointer; }
.gp-v circle { fill: #ffffff; stroke: #a97fd8; stroke-width: 2; transition: fill .12s, stroke .12s; }
.gp-v:hover circle { fill: #f8e7ff; stroke: #8a5cc7; }
.gp-v:focus-visible { outline: none; }
.gp-v:focus-visible circle { stroke: #f6a21e; stroke-width: 3.5; }
.gp-v.on-path circle { fill: #eaf6df; stroke: #7cb342; stroke-width: 3.5; }
.gp-v.is-start circle { stroke: #2e9e5b; stroke-width: 3; }
.gp-v.is-goal circle { stroke: #e03131; stroke-width: 3; stroke-dasharray: 4 2; }
.gp-v.is-goal.on-path circle { stroke: #558b2f; stroke-dasharray: none; fill: #c5e1a5; }
.gp-vord { fill: #33691e; font-family: inherit; }
.gp-vname { fill: #5a4a72; font-weight: 700; font-family: inherit; }
.pz-gp-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.pz-gp-status { font-size: .9em; color: #4a3b63; font-weight: 700; max-width: 320px; text-align: center; }
.gp-no { background: linear-gradient(135deg, #ef5350, #d84343); }

/* — 🗼 Сторожевые башни — */
.pz-tw-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 8px auto 4px; }
.pz-tw-svg { width: 100%; max-width: 420px; height: auto; background: #fffdf8; border: 3px solid #cdbcec; border-radius: 16px; }
.pz-tw-svg.solved { border-color: #7cb342; box-shadow: 0 0 18px rgba(124, 179, 66, .45); }
.pz-tw-svg.revealed { border-color: #7cb342; }
.tw-cell { fill: #f4eefb; stroke: none; transition: fill .15s; }
.tw-cell.beaten { fill: #ffe3f2; }
.tw-grid { stroke: #b9a8d6; stroke-width: .7; }
.tw-node { fill: #ffffff; stroke: #a97fd8; stroke-width: 1.6; cursor: pointer; transition: fill .12s, stroke .12s; }
.tw-node:hover { fill: #f8e7ff; stroke: #8a5cc7; }
.tw-node:focus-visible { outline: none; stroke: #f6a21e; stroke-width: 2.5; }
.tw-node.beaten-node { fill: #fff3cd; stroke: #f0b429; }
.tw-node.has-tower { fill: #ffd54f; stroke: #f6a21e; stroke-width: 2.5; }
.tw-layer text { pointer-events: none; }
.pz-tw-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.pz-tw-count { font-size: .95em; font-weight: 800; color: #6a3fa0; }

/* — Мобильная версия движков 6 класса — */
@media (max-width: 600px) {
  .pz-target-svg { max-width: 270px; }
  .pz-angle-svg { max-width: 300px; }
  .pz-gp-svg { max-width: 100%; }
  .pz-gp-status { font-size: .8em; }
  .pz-tw-svg { max-width: 340px; }
  .pz-fig .pz-svg { max-width: 100%; }
}

/* — ⚖️ Весы и фальшивая монета (7 класс) — */
.sc-stage { max-width: 560px; margin: 10px auto 6px; }
.sc-beam { display: flex; align-items: flex-end; justify-content: center; gap: 10px; transition: transform .5s cubic-bezier(.34,1.56,.64,1); transform-origin: 50% 20%; }
.sc-beam.tilt-left { transform: rotate(-4deg); }
.sc-beam.tilt-right { transform: rotate(4deg); }
.sc-beam.tilt-even { transform: rotate(0deg); }
.sc-pan { flex: 1; min-height: 92px; background: linear-gradient(180deg, #fffdf8, #f3e8ff); border: 3px solid #b39ddb; border-radius: 16px 16px 26px 26px; padding: 8px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 6px 14px rgba(106,63,160,.16); }
.sc-pan-label { font-size: .78em; font-weight: 800; color: #7e57c2; text-transform: uppercase; letter-spacing: .04em; }
.sc-pan-coins { display: flex; flex-wrap: wrap; gap: 6px; min-height: 40px; align-items: center; }
.sc-mini { position: relative; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.sc-mini-coin {
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffe082 0 28%, #ffc93c 60%, #f0a500 100%);
  border: 2px solid #d18f00; box-shadow: inset 0 1px 2px rgba(255,255,255,.6);
}
.sc-mini i { position: absolute; right: -6px; bottom: -6px; font-style: normal; font-size: .62em; background: #6a3fa0; color: #fff; border-radius: 50%; width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.sc-post { font-size: 2.2em; line-height: 1; align-self: center; }
.sc-result { text-align: center; font-weight: 700; color: #4a3b63; background: #fff7ee; border: 2px dashed #f0b429; border-radius: 12px; padding: 9px 12px; margin-top: 12px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.sc-coins { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 14px 0 6px; }
.sc-coin { width: 64px; height: 64px; border-radius: 50%; border: 3px solid #d9c8ef; background: linear-gradient(135deg, #fff8e1, #ffe9b8); font-family: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; transition: transform .15s, box-shadow .15s, border-color .15s; box-shadow: 0 4px 10px rgba(184,160,80,.25); position: relative; }
/* Монета нарисована стилями (эмодзи 🪙 слишком новый и не отображается
   на части устройств): золотая монетка с бликом и номером. */
.sc-coin-face {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 32% 28%, #ffe082 0 28%, #ffc93c 60%, #f0a500 100%);
  border: 2.5px solid #d18f00; box-shadow: inset 0 2px 3px rgba(255,255,255,.65), inset 0 -2px 4px rgba(150,90,0,.35);
  font-style: normal; font-weight: 900; font-size: 1.05em; color: #6b4a00;
}
.sc-coin-face i { font-style: normal; }
.sc-coin:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 7px 16px rgba(184,160,80,.4); }
.sc-coin:focus-visible { outline: none; border-color: #f6a21e; box-shadow: 0 0 0 3px rgba(246,162,30,.35); }
.sc-coin.on-left { border-color: #7e57c2; background: linear-gradient(135deg, #ede7f6, #d1c4e9); box-shadow: 0 0 0 3px rgba(126,87,194,.25); }
.sc-coin.on-left::after { content: '⬅️'; position: absolute; top: -10px; right: -8px; font-size: .9em; }
.sc-coin.on-right { border-color: #26a69a; background: linear-gradient(135deg, #e0f2f1, #b2dfdb); box-shadow: 0 0 0 3px rgba(38,166,154,.25); }
.sc-coin.on-right::after { content: '➡️'; position: absolute; top: -10px; left: -8px; font-size: .9em; }
.sc-coin.fake-found { border-color: #e53935; background: linear-gradient(135deg, #ffebee, #ffcdd2); animation: scPulse .9s ease-in-out infinite; }
.sc-coin.fake-found .sc-coin-face { background: radial-gradient(circle at 32% 28%, #ffab91 0 28%, #ff7043 60%, #d84315 100%); border-color: #bf360c; color: #fff; }
@keyframes scPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.sc-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.sc-actions .btn-ghost.sc-reset { background: #fff; color: #6a3fa0; border: 2px solid #b39ddb; padding: 12px 22px; border-radius: 15px; cursor: pointer; font-family: inherit; font-size: 1em; font-weight: 700; }
/* Ответ: подпись на своей строке, кнопки №1–№5 — ровным рядом под ней. */
.sc-answer { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 16px; }
.sc-answer-label { font-weight: 800; color: #6a3fa0; }
.sc-answer-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.sc-ans-btn { min-width: 56px; }

/* — 📜 Доказательство по шагам (7 класс) — */
.st-wrap { max-width: 640px; margin: 8px auto 4px; display: flex; flex-direction: column; gap: 10px; }
.st-pool-label, .st-proof-label { font-weight: 800; color: #6a3fa0; font-size: .95em; }
.st-pool { display: flex; flex-direction: column; gap: 8px; }
.st-card { text-align: left; font-family: inherit; font-size: .95em; line-height: 1.35; background: linear-gradient(135deg, #fffdf8, #f6eeff); border: 2px solid #cdbcec; border-radius: 12px; padding: 12px 14px; min-height: 44px; cursor: pointer; color: #3c2e52; transition: transform .15s, box-shadow .15s, opacity .2s, border-color .15s; box-shadow: 0 3px 8px rgba(106,63,160,.12); }
.st-card:hover:not(:disabled) { transform: translateX(4px); border-color: #8a5cc7; box-shadow: 0 5px 14px rgba(106,63,160,.22); }
.st-card:focus-visible { outline: none; border-color: #f6a21e; box-shadow: 0 0 0 3px rgba(246,162,30,.3); }
.st-card.used { opacity: .25; cursor: default; transform: none; }
.st-slots { display: flex; flex-direction: column; gap: 8px; }
.st-slot { display: flex; align-items: center; gap: 10px; min-height: 52px; background: #fff; border: 2px dashed #cdbcec; border-radius: 12px; padding: 8px 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.st-slot:hover { border-color: #8a5cc7; background: #fdfaff; }
.st-slot .st-slot-num { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; background: #6a3fa0; color: #fff; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; font-size: .9em; }
.st-slot .st-slot-text { font-size: .92em; color: #6b5b85; line-height: 1.35; }
.st-slot.filled { border-style: solid; border-color: #8a5cc7; background: linear-gradient(135deg, #fffdf8, #f3ecff); }
.st-slot.filled .st-slot-text { color: #3c2e52; font-weight: 600; }
.st-slot.solved { border-color: #7cb342; background: linear-gradient(135deg, #f1f8e9, #dcedc8); }
.st-slot.solved .st-slot-num { background: #558b2f; }
.st-slot.shake { animation: shake .5s; }
.st-note { font-size: .85em; color: #8d7ba8; text-align: center; }

/* — Мобильная версия движков 7 класса — */
@media (max-width: 600px) {
  .sc-pan { min-height: 74px; }
  .sc-coin { width: 56px; height: 56px; }
  .sc-post { font-size: 1.7em; }
  .st-card { font-size: .88em; padding: 10px 12px; }
  .st-slot { min-height: 46px; padding: 6px 10px; }
}
