/* ===== levels.css — стили движков задач ===== */

/* ---- Контейнер задачи ---- */
.pz-host {
  min-height: 200px;
  padding: 8px 0;
}

/* ---- Универсальная центровка иллюстраций виджетов (svg + кнопки строго
     по центру карточки задания, симметрично тексту вопроса) ---- */
.pz-center-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.pz-center-col > svg {
  display: block; /* inline-svg по умолчанию прилипает к левому краю */
  max-width: 100%;
  height: auto;
}
/* Любая крупная иллюстрация виджета не шире карточки (мобильные 320px+) */
.task-host svg[class*="pz-"] {
  max-width: 100%;
  height: auto;
}

/* ---- Choice (варианты ответа) ---- */
.pz-choice {
  display: grid;
  gap: 10px;
}
.pz-choice.cols-2 { grid-template-columns: repeat(2, 1fr); }
.pz-choice.cols-3 { grid-template-columns: repeat(3, 1fr); }
.pz-choice.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 480px) {
  .pz-choice.cols-3, .pz-choice.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
.pz-choice-opt {
  padding: 14px 12px;
  background: linear-gradient(180deg, #346A4E, var(--fq-dark-3));
  border: 3px solid rgba(158,224,186,.18);
  border-radius: var(--fq-radius);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: all .12s;
  text-align: center;
  min-height: 52px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: var(--fq-shadow-l), inset 0 1px 0 rgba(255,255,255,.10);
}
.pz-choice-opt:hover { background: linear-gradient(180deg, #3E7B5C, #33614A); transform: translateY(-2px); }
.pz-choice-opt.selected {
  background: var(--fq-blue);
  border-color: var(--fq-yellow);
}
.pz-choice-opt.correct {
  background: var(--fq-green);
  border-color: var(--fq-yellow);
  animation: bounce .4s;
}
.pz-choice-opt.wrong {
  background: var(--fq-red);
  border-color: #fff;
  animation: shake .4s;
}
.pz-choice-opt.disabled { cursor: default; opacity: .85; }
.pz-choice-opt .opt-letter {
  background: var(--fq-dark);
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

/* ---- numin (ввод числа) ---- */
.pz-numin {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.pz-numin-input {
  width: min(280px, 80%);
  padding: 14px 16px;
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  background: var(--fq-dark);
  border: 3px solid var(--fq-dark-3);
  border-radius: var(--fq-radius);
  color: var(--fq-yellow);
  letter-spacing: 4px;
}
.pz-numin-input:focus { outline: none; border-color: var(--fq-yellow); }
.pz-numin-input.wrong { animation: shake .4s; border-color: var(--fq-red); }
.pz-numin-input.correct { border-color: var(--fq-green); }

/* Пюпитр (клавиатура) */
.pz-numpad {
  display: grid;
  grid-template-columns: repeat(3, 60px);
  gap: 6px;
  justify-content: center;
}
.pz-numpad button {
  width: 60px; height: 56px;
  background: var(--fq-dark-3);
  border: 2px solid rgba(255,255,255,.1);
  border-radius: var(--fq-radius);
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  box-shadow: var(--fq-shadow-l);
  transition: transform .08s;
}
.pz-numpad button:active { transform: translateY(2px); box-shadow: none; }
.pz-numpad button:hover { background: var(--fq-gray); }
.pz-numpad button.action { background: var(--fq-red); }
.pz-numpad button.action.go { background: var(--fq-green); }

/* ---- logtab (логическая таблица +/−) ---- */
.pz-logtab {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  max-width: 600px;
  margin: 0 auto;
}
.pz-logtab th, .pz-logtab td {
  padding: 8px 10px;
  text-align: center;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
}
.pz-logtab th {
  background: var(--fq-dark-3);
  color: var(--fq-yellow);
}
.pz-logtab td.cell-name {
  background: var(--fq-dark-3);
  text-align: left;
  font-weight: 700;
}
.pz-logtab td.cell-opt {
  background: var(--fq-dark);
  cursor: pointer;
  transition: all .12s;
  min-width: 44px;
  min-height: 44px;
  font-size: 18px;
}
.pz-logtab td.cell-opt:hover { background: var(--fq-dark-3); }
.pz-logtab td.cell-opt.selected-yes { background: var(--fq-green); color: #fff; }
.pz-logtab td.cell-opt.selected-no  { background: var(--fq-red); color: #fff; }
.pz-logtab td.cell-opt.correct { box-shadow: inset 0 0 0 3px var(--fq-yellow); }
.pz-logtab td.cell-opt.wrong { box-shadow: inset 0 0 0 3px #fff; }

/* ---- order (построй по порядку: скамейка + слоты) ---- */
.pz-order {
  display: flex; flex-direction: column; gap: 12px;
  align-items: center;
  max-width: 520px;
  margin: 0 auto;
}
.pz-order-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--fq-gray-l);
  text-align: center;
}
.pz-order-slots {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
}
.pz-order-slot {
  min-width: 72px; min-height: 84px;
  border: 3px dashed var(--fq-gray);
  border-radius: var(--fq-radius-l);
  background: var(--fq-dark);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 8px 10px;
  cursor: pointer;
  transition: all .15s;
}
.pz-order-slot .slot-num {
  font-size: 22px; font-weight: 900; color: var(--fq-gray);
}
.pz-order-slot:hover { border-color: var(--fq-gray-l); }
.pz-order-slot.ready {
  border-style: solid; border-color: var(--fq-yellow);
  background: rgba(245,194,66,.08);
  animation: pulse 1.4s infinite;
}
.pz-order-slot.filled {
  border-style: solid; border-color: rgba(255,255,255,.14);
  background: var(--fq-dark-3);
}
.pz-order-slot.filled:hover { border-color: var(--fq-cyan); }
.pz-order-slot.wrong {
  border-color: var(--fq-red);
  animation: shake .4s;
}
.pz-order-slot.correct {
  border-style: solid; border-color: var(--fq-green);
}
.pz-order-slot.correct .chip-emoji { animation: bounce .5s; }
.pz-order-slot .chip-emoji { font-size: 30px; line-height: 1.1; }
.pz-order-slot .chip-name { font-size: 11px; font-weight: 700; }
.pz-order-bench {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  min-height: 74px;
  padding: 10px;
  background: var(--fq-dark);
  border-radius: var(--fq-radius);
  width: 100%;
  box-sizing: border-box;
}
.pz-order-bench-empty {
  color: var(--fq-gray); font-size: 26px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  flex: 1; min-height: 50px;
}
.pz-order-chip {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 12px;
  background: var(--fq-dark-3);
  border: 3px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all .15s;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  min-width: 68px;
  box-shadow: var(--fq-shadow-l);
}
.pz-order-chip .chip-emoji { font-size: 28px; line-height: 1.1; }
.pz-order-chip:hover { background: var(--fq-gray); transform: translateY(-2px); }
.pz-order-chip.lifted {
  border-color: var(--fq-yellow);
  background: var(--fq-blue);
  transform: translateY(-6px) scale(1.06);
  box-shadow: 0 8px 18px rgba(0,0,0,.45);
}
.pz-order-chip.correct { background: var(--fq-green); }

/* ---- grid (расставь в таблице: соседи по стороне и углу) ---- */
.pz-grid {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.pz-grid-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
}
.pz-grid-chip {
  background: var(--fq-dark-3);
  border: 2px solid rgba(255,255,255,.08);
  border-radius: 999px;
  padding: 6px 16px;
  font-weight: 800;
  font-size: 14px;
  color: var(--fq-yellow);
  transition: background .15s, color .15s;
}
.pz-grid-chip.ok {
  background: var(--fq-green);
  color: #fff;
  border-color: var(--fq-yellow);
}
.pz-grid-chip.shake { animation: shake .4s; }
.pz-grid-clear {
  background: transparent;
  border: 2px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--fq-gray-l);
  transition: all .15s;
}
.pz-grid-clear:hover { border-color: var(--fq-red); color: #fff; }
.pz-grid-clear:disabled { opacity: .4; cursor: default; }
.pz-grid-board {
  display: grid;
  gap: 4px;
  width: 100%;
  max-width: 340px;
}
.pz-grid-cell {
  min-height: 46px;
  background: #2a3d2a;
  border: 2px solid rgba(255,255,255,.08);
  border-radius: 10px;
  font-size: 24px;
  line-height: 1;
  padding: 4px 0;
  cursor: pointer;
  transition: background .12s, transform .12s, border-color .12s;
}
.pz-grid-cell:hover { background: #38503a; }
.pz-grid-cell:active { transform: scale(.93); }
.pz-grid-cell:disabled { cursor: default; }
.pz-grid-cell.on {
  background: var(--fq-dark-3);
  border-color: rgba(255,255,255,.2);
}
.pz-grid-cell.correct {
  background: var(--fq-green);
  border-color: var(--fq-yellow);
  animation: pulseGreen .7s;
}
.pz-grid-cell.wrong {
  background: var(--fq-red);
  border-color: #fff;
  animation: shake .4s;
}
.pz-grid-cell.lonely {
  background: rgba(245,194,66,.28);
  border-color: var(--fq-yellow);
}
@keyframes pulseGreen {
  0% { transform: scale(1); background: var(--fq-green); }
  50% { transform: scale(1.12); background: var(--fq-green-d); }
  100% { transform: scale(1); background: var(--fq-green); }
}

/* ---- walls (расставь вдоль стен, углы — двум стенам) ---- */
.pz-walls {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.pz-walls-room {
  --wallw: 12px;
  position: relative;
  width: min(100%, 380px);
  aspect-ratio: 1 / 1;
  background: linear-gradient(180deg, #c69a68, #b98a5a);
  border-radius: 18px;
  box-shadow: var(--fq-shadow-l), inset 0 0 0 2px rgba(0,0,0,.15);
}
.pz-walls-floor {
  position: absolute;
  inset: var(--wallw);
  border-radius: 9px;
  background: #86b35c;
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0 7px, transparent 7px 14px),
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.1), transparent 60%);
  box-shadow: inset 0 0 12px rgba(0,0,0,.18);
}
.pz-walls-slot {
  position: absolute;
  width: 42px; height: 42px;
  transform: translate(-50%, -50%);
  background: rgba(20,28,16,.55);
  border: 2px solid rgba(255,255,255,.3);
  border-radius: 10px;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .12s;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.pz-walls-slot:hover { background: rgba(20,28,16,.8); border-color: var(--fq-yellow); }
.pz-walls-slot:active { transform: translate(-50%, -50%) scale(.9); }
.pz-walls-slot:disabled { cursor: default; }
.pz-walls-slot.on {
  background: var(--fq-dark-3);
  border-color: var(--fq-yellow);
}
.pz-walls-slot.correct {
  background: var(--fq-green);
  border-color: var(--fq-yellow);
  animation: pulseGreen .7s;
}
.pz-walls-slot.wrong {
  background: var(--fq-red);
  border-color: #fff;
  animation: shake .4s;
}
.pz-walls-center {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 62%;
  text-align: center;
  pointer-events: none;
}
.pz-walls-counters {
  display: flex; gap: 6px; justify-content: center; flex-wrap: wrap;
}
.pz-walls-counter {
  background: var(--fq-dark);
  border: 2px solid rgba(255,255,255,.12);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 800;
  color: var(--fq-yellow);
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.pz-walls-counter.ok {
  background: var(--fq-green);
  color: #fff;
  border-color: var(--fq-yellow);
}
.pz-walls-total {
  font-size: 13px;
  font-weight: 800;
  color: var(--fq-dark);
  background: rgba(255,255,255,.55);
  border-radius: 999px;
  padding: 3px 12px;
}
.pz-walls-total.ok { background: var(--fq-green); color: #fff; }
.pz-walls-hint {
  font-size: 13px;
  font-weight: 700;
  color: var(--fq-gray-l);
  text-align: center;
}

/* ---- doors (Эйлеров путь) ---- */
.pz-doors-svg {
  background: var(--fq-dark);
  border-radius: var(--fq-radius);
}
.pz-doors-svg .room { fill: var(--fq-dark-3); stroke: var(--fq-gray); stroke-width: 2; }
.pz-doors-svg .door-open { stroke: var(--fq-green); stroke-width: 6; }
.pz-doors-svg .door-closed { stroke: var(--fq-yellow); stroke-width: 5; cursor: pointer; }
.pz-doors-svg .door-closed:hover { stroke: var(--fq-cyan); }
.pz-doors-svg .node { fill: var(--fq-yellow); stroke: #000; stroke-width: 2; cursor: pointer; }
.pz-doors-svg .node.visited { fill: var(--fq-green); }
.pz-doors-svg .path-line { stroke: var(--fq-cyan); stroke-width: 4; fill: none; }
.pz-doors-svg .label { fill: #fff; font-size: 14px; font-weight: 700; text-anchor: middle; pointer-events: none; }

/* ---- numlink (непересекающиеся линии) ---- */
.pz-numlink-svg { background: var(--fq-dark); border-radius: var(--fq-radius); }
.pz-numlink-svg .cell { fill: var(--fq-dark-3); stroke: var(--fq-dark); stroke-width: 1; }
.pz-numlink-svg .endpoint {
  fill: var(--fq-yellow);
  stroke: #000;
  stroke-width: 2;
  cursor: pointer;
}
.pz-numlink-svg .endpoint.paired { fill: var(--fq-green); }
.pz-numlink-svg .endpoint.selected { fill: var(--fq-cyan); }
.pz-numlink-svg .wire { stroke: var(--fq-cyan); stroke-width: 5; fill: none; stroke-linecap: round; }
.pz-numlink-svg .num { fill: #fff; font-size: 16px; font-weight: 800; text-anchor: middle; }

/* ---- rotate (поворот фигуры) ---- */
.pz-rotate-svg { background: var(--fq-dark); border-radius: var(--fq-radius); }
.pz-rotate-svg .figure-cell { fill: var(--fq-dark-3); stroke: var(--fq-dark); }
.pz-rotate-svg .figure-on { fill: var(--fq-yellow); cursor: pointer; }
.pz-rotate-svg .figure-target { fill: none; stroke: var(--fq-green); stroke-width: 2; stroke-dasharray: 4 3; }
.pz-rotate-controls {
  display: flex; gap: 8px; justify-content: center; margin-top: 12px;
}

/* ---- pattern (недостающая фигура) ---- */
.pz-pattern-grid {
  display: grid;
  gap: 6px;
  justify-content: center;
  margin: 12px auto;
}
.pz-pattern-cell {
  width: 70px; height: 70px;
  background: var(--fq-dark-3);
  border: 2px solid var(--fq-dark);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
}
.pz-pattern-cell.question {
  background: var(--fq-purple);
  border-color: var(--fq-yellow);
  font-size: 36px;
  color: var(--fq-yellow);
  animation: pulse 1.5s infinite;
}
.pz-pattern-opts {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px;
}
.pz-pattern-opt {
  width: 64px; height: 64px;
  background: var(--fq-dark-3);
  border: 3px solid transparent;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  cursor: pointer;
  transition: all .12s;
}
.pz-pattern-opt:hover { transform: translateY(-3px); background: var(--fq-gray); }
.pz-pattern-opt.selected { border-color: var(--fq-cyan); }
.pz-pattern-opt.correct { background: var(--fq-green); border-color: var(--fq-yellow); }
.pz-pattern-opt.wrong { background: var(--fq-red); border-color: #fff; animation: shake .4s; }

/* ---- symchoice (выбор симметричных) ---- */
.pz-symchoice {
  display: grid;
  gap: 12px;
}
.pz-symchoice.cols-2 { grid-template-columns: repeat(2, 1fr); }
.pz-symchoice.cols-3 { grid-template-columns: repeat(3, 1fr); }
.pz-symchoice-item {
  background: var(--fq-dark-3);
  border: 3px solid transparent;
  border-radius: var(--fq-radius);
  padding: 12px;
  cursor: pointer;
  transition: all .12s;
  text-align: center;
  min-height: 90px;
  display: flex; align-items: center; justify-content: center;
}
.pz-symchoice-item:hover { background: var(--fq-gray); }
.pz-symchoice-item.selected { border-color: var(--fq-cyan); background: var(--fq-blue); }
.pz-symchoice-item.correct { background: var(--fq-green); border-color: var(--fq-yellow); animation: bounce .4s; }
.pz-symchoice-item.wrong { background: var(--fq-red); border-color: #fff; animation: shake .4s; }
.pz-symchoice-item svg { max-width: 100%; height: 60px; }

/* ---- symirror (дорисуй отражение) ---- */
.pz-symirror-svg { background: var(--fq-dark); border-radius: var(--fq-radius); }
.pz-symirror-svg .axis { stroke: var(--fq-yellow); stroke-width: 3; stroke-dasharray: 6 4; }
.pz-symirror-svg .given { fill: var(--fq-yellow); stroke: #000; stroke-width: 1; }
.pz-symirror-svg .user { fill: var(--fq-cyan); stroke: #000; stroke-width: 1; cursor: pointer; }
.pz-symirror-svg .user:hover { fill: var(--fq-green); }
.pz-symirror-svg .mirror-ghost { fill: rgba(255,255,255,.08); stroke: rgba(255,255,255,.2); stroke-dasharray: 3 2; }
.pz-symirror-controls { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }

/* ---- graphcount (считай связи) ---- */
.pz-graphcount-svg { background: var(--fq-dark); border-radius: var(--fq-radius); }
.pz-graphcount-svg .node { fill: var(--fq-yellow); stroke: #000; stroke-width: 2; cursor: pointer; }
.pz-graphcount-svg .edge { stroke: var(--fq-cyan); stroke-width: 3; }
.pz-graphcount-svg .label { fill: #fff; font-size: 13px; font-weight: 700; text-anchor: middle; }

/* ---- headslegs (головы и ноги) ---- */
.pz-headslegs {
  display: flex; flex-direction: column; gap: 14px; align-items: center;
}
.pz-headslegs-inputs {
  display: flex; gap: 14px; flex-wrap: wrap; justify-content: center;
}
.pz-headslegs-field {
  display: flex; flex-direction: column; gap: 4px; align-items: center;
}
.pz-headslegs-field label {
  font-size: 13px; color: var(--fq-gray-l); font-weight: 700;
}
.pz-headslegs-field input {
  width: 80px;
  padding: 8px;
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  background: var(--fq-dark);
  border: 3px solid var(--fq-dark-3);
  border-radius: 8px;
  color: var(--fq-yellow);
}
.pz-headslegs-field input:focus { outline: none; border-color: var(--fq-yellow); }

/* ---- parity (чётный/нечётный ответ) ---- */
.pz-parity {
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
}
.pz-parity-opt {
  padding: 16px 28px;
  background: var(--fq-dark-3);
  border: 3px solid transparent;
  border-radius: var(--fq-radius);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  transition: all .12s;
  min-width: 120px;
  text-align: center;
  box-shadow: var(--fq-shadow-l);
}
.pz-parity-opt:hover { background: var(--fq-gray); transform: translateY(-2px); }
.pz-parity-opt.selected { background: var(--fq-blue); border-color: var(--fq-yellow); }
.pz-parity-opt.correct { background: var(--fq-green); border-color: var(--fq-yellow); }
.pz-parity-opt.wrong { background: var(--fq-red); border-color: #fff; animation: shake .4s; }

/* ---- coins (набор монет) ---- */
.pz-coins {
  display: flex; flex-direction: column; gap: 12px; align-items: center;
}
.pz-coins-tray {
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
  min-height: 60px;
  padding: 10px;
  background: var(--fq-dark);
  border-radius: var(--fq-radius);
  min-width: 200px;
}
.pz-coin {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--fq-yellow), var(--fq-yellow-d));
  border: 2px solid #0F2A1E;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
  font-size: 13px;
  color: #0F2A1E;
  box-shadow: var(--fq-shadow-l);
  cursor: pointer;
}
.pz-coin.available { cursor: pointer; }
.pz-coin.available:hover { transform: translateY(-3px); }
.pz-coin.bin { background: var(--fq-gray-l); }
.pz-coins-bank {
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
}
.pz-coins-sum {
  font-size: 18px; font-weight: 800; color: var(--fq-yellow);
}
.pz-coins-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--fq-gray-l);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.pz-coins-msg {
  font-size: 13px;
  font-weight: 700;
  color: var(--fq-red);
  min-height: 18px;
  text-align: center;
}
.pz-coins.solved .pz-coin { cursor: default; }
.pz-coins.solved .pz-coin.available:hover { transform: none; }
.pz-coins.solved .pz-coins-bank { opacity: .55; }

/* ---- cube (развёртка → кубик) ---- */
.pz-cube-svg { background: var(--fq-dark); border-radius: var(--fq-radius); }
.pz-cube-svg .face { fill: var(--fq-dark-3); stroke: var(--fq-gray); stroke-width: 2; cursor: pointer; transition: fill .12s; }
.pz-cube-svg .face:hover { fill: var(--fq-gray); }
.pz-cube-svg .face.selected { fill: var(--fq-blue); stroke: var(--fq-yellow); stroke-width: 3; }
.pz-cube-svg .face.correct { fill: var(--fq-green); stroke: var(--fq-yellow); }
.pz-cube-svg .face.wrong { fill: var(--fq-red); }
.pz-cube-svg .face-label { fill: #fff; font-size: 14px; font-weight: 800; text-anchor: middle; pointer-events: none; }
.pz-cube-target {
  background: var(--fq-dark);
  border-radius: var(--fq-radius);
  padding: 10px;
  margin: 10px auto;
  text-align: center;
  max-width: 240px;
}

/* ---- weighing (взвешивание) ---- */
.pz-weigh {
  display: flex; flex-direction: column; gap: 12px; align-items: center;
}
.pz-weigh-svg { background: var(--fq-dark); border-radius: var(--fq-radius); }
.pz-weigh-svg .scale-pole { stroke: var(--fq-gray); stroke-width: 4; }
.pz-weigh-svg .scale-beam { stroke: var(--fq-gray); stroke-width: 4; transition: transform .4s; }
.pz-weigh-svg .scale-pan { stroke: var(--fq-gray); stroke-width: 2; fill: var(--fq-dark-3); }
.pz-weigh-svg .coin { fill: var(--fq-yellow); stroke: #000; stroke-width: 1.5; cursor: pointer; }
.pz-weigh-svg .coin.selected { fill: var(--fq-cyan); }
.pz-weigh-svg .coin.on-pan { cursor: pointer; }
.pz-weigh-controls {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.pz-weigh-result {
  font-size: 16px; font-weight: 700;
  padding: 8px 14px;
  background: var(--fq-dark-3);
  border-radius: var(--fq-radius);
  min-height: 36px;
}
.pz-weigh-history {
  font-size: 12px; color: var(--fq-gray-l);
  text-align: left;
  max-height: 80px; overflow-y: auto;
  width: 100%;
}

/* ---- euler (круги Эйлера) ---- */
.pz-euler-svg { background: var(--fq-dark); border-radius: var(--fq-radius); }
.pz-euler-svg .circle {
  fill: rgba(0,102,204,.15);
  stroke: var(--fq-blue);
  stroke-width: 2;
}
.pz-euler-svg .circle.b { fill: rgba(0,166,81,.15); stroke: var(--fq-green); }
.pz-euler-svg .label { fill: #fff; font-size: 14px; font-weight: 800; text-anchor: middle; }
.pz-euler-svg .count { fill: var(--fq-yellow); font-size: 20px; font-weight: 900; text-anchor: middle; }

/* ---- cryptarithm (ребус) ---- */
.pz-crypt {
  display: flex; flex-direction: column; gap: 12px; align-items: center;
}
.pz-crypt-expr {
  font-size: 28px;
  font-weight: 900;
  font-family: 'Comfortaa', monospace;
  letter-spacing: 4px;
  background: var(--fq-dark);
  padding: 14px 20px;
  border-radius: var(--fq-radius);
  border: 2px solid var(--fq-dark-3);
  text-align: center;
}
.pz-crypt-expr .letter {
  display: inline-block;
  min-width: 28px;
  padding: 2px 4px;
  background: var(--fq-dark-3);
  border-radius: 4px;
  margin: 0 1px;
  cursor: pointer;
}
.pz-crypt-expr .letter.assigned { background: var(--fq-green); color: #fff; }
.pz-crypt-expr .letter.selected { background: var(--fq-purple); border: 2px solid var(--fq-yellow); }
.pz-crypt-expr .op { color: var(--fq-yellow); margin: 0 6px; }
.pz-crypt-pad {
  display: grid;
  grid-template-columns: repeat(5, 44px);
  gap: 4px;
  justify-content: center;
}
.pz-crypt-pad button {
  width: 44px; height: 44px;
  background: var(--fq-dark-3);
  border: 2px solid transparent;
  border-radius: 6px;
  font-size: 18px;
  font-weight: 800;
}
.pz-crypt-pad button:hover { background: var(--fq-gray); }
.pz-crypt-pad button.used { opacity: .35; cursor: not-allowed; }

/* ---- divisibility (признаки делимости) ---- */
.pz-divis {
  display: flex; flex-direction: column; gap: 12px; align-items: center;
}
.pz-divis-number {
  font-size: 32px;
  font-weight: 900;
  background: var(--fq-dark);
  padding: 14px 20px;
  border-radius: var(--fq-radius);
  letter-spacing: 4px;
  color: var(--fq-yellow);
}
.pz-divis-number .digit { display: inline-block; min-width: 24px; }
.pz-divis-number .star { color: var(--fq-purple); }
.pz-divis-number .digit.editable { cursor: pointer; background: var(--fq-dark-3); border-radius: 4px; }
.pz-divis-number .digit.editable:hover { background: var(--fq-gray); }
.pz-divis-number .digit.selected { background: var(--fq-purple); border: 2px solid var(--fq-yellow); }

/* ---- implication / negation (логика) ---- */
.pz-logic {
  display: flex; flex-direction: column; gap: 10px;
}
.pz-logic-text {
  background: var(--fq-dark);
  padding: 14px;
  border-radius: var(--fq-radius);
  font-size: 15px;
  line-height: 1.5;
  font-style: italic;
  border-left: 4px solid var(--fq-cyan);
}
.pz-logic-opts {
  display: grid; gap: 8px;
}
.pz-logic-opt {
  background: var(--fq-dark-3);
  border: 3px solid transparent;
  border-radius: var(--fq-radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: all .12s;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.pz-logic-opt:hover { background: var(--fq-gray); transform: translateX(4px); }
.pz-logic-opt.selected { background: var(--fq-blue); border-color: var(--fq-yellow); }
.pz-logic-opt.correct { background: var(--fq-green); border-color: var(--fq-yellow); }
.pz-logic-opt.wrong { background: var(--fq-red); border-color: #fff; animation: shake .4s; }

/* ---- arith (восстанови действие) ---- */
.pz-arith {
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.pz-arith-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 22px; font-weight: 800;
  font-family: monospace;
}
.pz-arith-cell {
  display: inline-flex;
  min-width: 36px; height: 36px;
  align-items: center; justify-content: center;
  background: var(--fq-dark-3);
  border-radius: 6px;
  padding: 0 4px;
}
.pz-arith-cell.question {
  background: var(--fq-purple);
  color: var(--fq-yellow);
  cursor: pointer;
  border: 2px solid var(--fq-yellow);
}
.pz-arith-cell.question.selected { background: var(--fq-blue); }
.pz-arith-ops {
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
}
.pz-arith-op {
  padding: 8px 14px;
  background: var(--fq-dark-3);
  border: 2px solid transparent;
  border-radius: 6px;
  font-size: 18px; font-weight: 800;
  cursor: pointer;
}
.pz-arith-op:hover { background: var(--fq-gray); }
.pz-arith-op.selected { background: var(--fq-blue); border-color: var(--fq-yellow); }

/* ---- generic reveal (показать ответ) ---- */
.pz-reveal {
  background: rgba(255,215,0,.1);
  border-left: 4px solid var(--fq-yellow);
  padding: 10px 14px;
  border-radius: var(--fq-radius);
  margin-top: 10px;
  display: none;
}
.pz-reveal.show { display: block; animation: toastIn .3s; }
.pz-reveal-title { font-weight: 800; color: var(--fq-yellow); margin-bottom: 4px; }
.pz-reveal-body { font-size: 14px; line-height: 1.5; }

/* ---- perm (перестановки) ---- */
.pz-perm {
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.pz-perm-row {
  display: flex; gap: 6px; justify-content: center;
  background: var(--fq-dark);
  padding: 10px;
  border-radius: var(--fq-radius);
  min-height: 60px;
}
.pz-perm-tile {
  min-width: 44px; height: 44px;
  background: var(--fq-yellow);
  color: #0F2A1E;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 18px;
  cursor: grab;
  box-shadow: var(--fq-shadow-l);
}
.pz-perm-tile.empty {
  background: var(--fq-dark-3);
  border: 2px dashed var(--fq-gray);
  color: transparent;
  cursor: default;
}

/* ---- folding (салфетка: сложи → разрежь → разверни) ---- */
.pz-folding {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.pz-folding-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
}
.pz-folding-chip {
  background: var(--fq-dark-3);
  border: 2px solid rgba(255,255,255,.08);
  border-radius: 999px;
  padding: 6px 16px;
  font-weight: 800;
  font-size: 14px;
  color: var(--fq-yellow);
  transition: background .15s, color .15s;
}
.pz-folding-chip.ok {
  background: var(--fq-green);
  color: #fff;
  border-color: var(--fq-yellow);
}
.pz-folding-chip.shake { animation: shake .4s; }
.pz-folding-svg {
  background: var(--fq-dark);
  border-radius: var(--fq-radius);
  width: 100%;
  max-width: 360px;
  height: auto;
}
.pz-folding-svg .napkin {
  fill: #FFF8E7;
  stroke: #C99A1E;
  stroke-width: 3;
  transition: x .45s ease, y .45s ease, width .45s ease, height .45s ease;
}
.pz-folding-svg .crease {
  stroke: var(--fq-orange);
  stroke-width: 3;
  stroke-dasharray: 8 6;
}
.pz-folding-svg .crease.mark { stroke-width: 2.5; stroke-dasharray: 5 4; }
.pz-folding-svg .layer {
  fill: #FFF8E7;
  stroke: #C99A1E;
  stroke-width: 2.5;
}
.pz-folding-svg .piece {
  fill: #FFF8E7;
  stroke: #C99A1E;
  stroke-width: 2.5;
}
.pz-folding-svg .piece.alt { fill: #FFEEC9; }
.pz-folding-svg .footprint {
  fill: none;
  stroke: var(--fq-gray-l);
  stroke-width: 2;
  stroke-dasharray: 5 5;
  opacity: .5;
}
.pz-folding-btns {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
}
.pz-folding .btn.off {
  opacity: .45;
  cursor: default;
  filter: grayscale(.6);
}
.pz-folding .btn.off:hover { transform: none; }
.pz-folding .btn.shake { animation: shake .4s; }
.pz-folding-answer {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding-top: 4px;
}
.pz-folding-answer.hidden { display: none; }
.pz-folding-q { font-size: 15px; font-weight: 800; }
.pz-folding-row {
  display: flex; gap: 10px; align-items: center; justify-content: center;
}
.pz-folding-row .pz-numin-input { width: 110px; font-size: 24px; letter-spacing: 2px; }

/* ---- fence (загон наибольшей площади) ---- */
.pz-fence {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.pz-fence-slider-label {
  font-size: 15px;
  font-weight: 800;
  color: var(--fq-yellow);
}
.pz-fence-slider {
  width: 100%;
  max-width: 360px;
  accent-color: var(--fq-yellow);
  height: 28px;
  cursor: pointer;
}
.pz-fence-slider:disabled { cursor: default; opacity: .6; }
.pz-fence-svg {
  background: var(--fq-dark);
  border-radius: var(--fq-radius);
  width: 100%;
  max-width: 360px;
  height: auto;
}
.pz-fence-svg .pen-grass { fill: #7ec850; }
.pz-fence-svg .pen-fence {
  stroke: #b98a5a;
  stroke-width: 10;
  fill: none;
  stroke-linejoin: round;
}
.pz-fence-svg .pen-fence2 {
  stroke: rgba(0,0,0,.22);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 3 7;
}
.pz-fence-svg.solved .pen-fence { stroke: var(--fq-green); }
.pz-fence-svg.solved .pen-fence2 { stroke: rgba(255,255,255,.45); }
.pz-fence-svg .pen-label {
  fill: #fff;
  font-weight: 800;
  font-size: 13px;
  text-anchor: middle;
}
.pz-fence-svg .pen-pig { user-select: none; }
.pz-fence-dims {
  font-size: 14px;
  font-weight: 700;
  color: var(--fq-gray-l);
}
.pz-fence-area {
  font-size: 24px;
  font-weight: 900;
  color: var(--fq-yellow);
}
.pz-fence-area.ok { color: var(--fq-green); animation: bounce .5s; }
.pz-fence-msg {
  font-size: 13px;
  font-weight: 700;
  color: var(--fq-red);
  min-height: 18px;
  text-align: center;
}

/* ---- percentbar (проценты на полосе) ---- */
.pz-pbar {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.pz-pbar-barwrap {
  position: relative;
  width: 100%;
  max-width: 420px;
}
.pz-pbar-bar {
  position: relative;
  height: 44px;
  border-radius: 12px;
  background: var(--fq-cream);
  border: 3px solid #C99A1E;
  box-shadow: var(--fq-shadow-l);
}
.pz-pbar-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  min-width: 4px;
  border-radius: 9px 0 0 9px;
  background: linear-gradient(180deg, #FFE082, var(--fq-yellow));
  display: flex;
  align-items: center;
  overflow: visible;
  transition: background .25s;
}
.pz-pbar.solved .pz-pbar-fill {
  background: linear-gradient(180deg, #7ee3a8, var(--fq-green));
}
.pz-pbar-chip {
  margin-left: 8px;
  white-space: nowrap;
  background: rgba(15,42,30,.22);
  color: #0F2A1E;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 800;
}
.pz-pbar-slider {
  width: 100%;
  max-width: 420px;
  accent-color: var(--fq-yellow);
  height: 28px;
  cursor: pointer;
}
.pz-pbar-slider:disabled { cursor: default; opacity: .6; }
.pz-pbar-readout {
  font-size: 22px;
  font-weight: 900;
  color: var(--fq-yellow);
}
.pz-pbar.solved .pz-pbar-readout { color: var(--fq-green); }
.pz-pbar-calc {
  font-size: 14px;
  font-weight: 700;
  color: var(--fq-gray-l);
}
.pz-pbar-msg {
  font-size: 13px;
  font-weight: 700;
  color: var(--fq-red);
  min-height: 18px;
  text-align: center;
}

/* ---- Адаптивность ---- */
@media (max-width: 480px) {
  .task-card { padding: 14px; }
  .task-question { font-size: 15px; }
  .pz-numpad button { width: 52px; height: 48px; font-size: 18px; }
  .pz-choice-opt { padding: 10px; font-size: 14px; min-height: 44px; }
  .pz-coin { width: 38px; height: 38px; font-size: 11px; }
  .pz-crypt-expr { font-size: 20px; letter-spacing: 2px; }
  .pz-crypt-pad { grid-template-columns: repeat(5, 38px); }
  .pz-crypt-pad button { width: 38px; height: 38px; font-size: 15px; }
  .pz-divis-number { font-size: 24px; letter-spacing: 2px; }
  .pz-pattern-cell { width: 56px; height: 56px; font-size: 24px; }
  .pz-pattern-opt { width: 52px; height: 52px; font-size: 22px; }
  .pz-grid-cell { min-height: 42px; font-size: 20px; }
  .pz-grid-board { max-width: 300px; }
  .pz-order-slot { min-width: 62px; min-height: 76px; }
  .pz-order-slot .slot-num { font-size: 18px; }
  .pz-order-slot .chip-emoji { font-size: 25px; }
  .pz-walls-slot { width: 36px; height: 36px; font-size: 18px; }
  .pz-walls-counter { font-size: 11px; padding: 3px 8px; }
  .pz-folding-row .pz-numin-input { width: 96px; font-size: 20px; }
  .pz-folding-svg, .pz-fence-svg { max-width: 320px; }
  .pz-fence-slider, .pz-pbar-slider, .pz-pbar-barwrap { max-width: 100%; }
  .pz-fence-area { font-size: 20px; }
  .pz-pbar-bar { height: 40px; }
  .pz-pbar-readout { font-size: 19px; }
  .pz-pbar-chip { font-size: 12px; padding: 2px 8px; }
}

/* ---- Доступность: меньше резких движений ---- */
@media (prefers-reduced-motion: reduce) {
  .pz-grid-cell, .pz-grid-chip, .pz-walls-slot, .pz-order-slot,
  .pz-order-chip, .pz-walls-counter,
  .pz-folding-chip, .pz-folding .btn, .pz-fence-area,
  .pz-folding-svg .napkin, .pz-pbar-fill {
    animation: none !important;
    transition: none !important;
  }
}

/* ---- r33-fix: на узких экранах ряды виджетов задач переносятся ----
   Раньше ряд «переключатель + инпут + кнопка» или 4 опции-карточки
   не влезали в 320–390px и вылезали за край экрана. */
@media (max-width: 480px) {
  .cr-task-area .row { flex-wrap: wrap; }
}
