/* ============================================================
   css/classroom.css — режим учителя (проектор)
   ------------------------------------------------------------ */
/* Верхний резерв 76px под фиксированный HUD (QA BUG-3: панель учителя не должна под ним прятаться) */
#screen-classroom {
  padding: 76px 0 0;
  /* лёгкая виньетка проекторного экрана (дизайн-критик P3) */
  background:
    radial-gradient(900px 420px at 85% -5%, rgba(46, 74, 158, 0.25) 0%, rgba(14, 20, 40, 0) 60%),
    radial-gradient(700px 380px at 0% 100%, rgba(226, 54, 54, 0.1) 0%, rgba(14, 20, 40, 0) 55%);
}

.cr-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px;
  background: rgba(10, 14, 30, 0.8);
  border-bottom: 2px solid var(--sp-red);
  flex: none;
}
/* Левая связка: «К тропе» + заголовок локации */
.cr-top-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* Тулбар-пилюля: единый стиль кнопок, аккуратная геометрия */
.cr-actions-pill {
  display: flex; align-items: center; gap: 2px;
  padding: 4px;
  background: rgba(10, 14, 30, 0.72);
  border: 1.5px solid var(--glass-border);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.cr-pillbtn {
  min-height: 40px;
  padding: 8px 13px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text, #fff);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
  transition: background 0.15s, transform 0.15s;
}
.cr-pillbtn:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-1px); }
.cr-pillbtn:focus-visible { outline: 2px solid rgba(255, 209, 84, 0.9); outline-offset: 1px; }
.cr-finishbtn { color: #ffb3b3; }
.cr-pill-sep { width: 1px; height: 22px; background: rgba(255, 255, 255, 0.16); margin: 0 4px; flex: none; }

/* Базовая (узкая/мобильная) раскладка: обычный поток со страницей */
.cr-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  padding: 18px;
  max-width: 1400px; margin: 0 auto;
}

.cr-taskcard {
  background: linear-gradient(170deg, rgba(29, 39, 80, 0.9), rgba(16, 22, 46, 0.94));
  border: 2px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.cr-taskcard .pz-q { font-size: 1.35rem; }

.cr-taskbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 20px; flex-wrap: wrap;
}
.btn-reveal { min-width: 220px; }
.cr-nav { display: flex; gap: 10px; }

/* ============================================================
   VIEWPORT-FIT (планшеты/десктоп/проектор, ≥981px):
   экран урока занимает ровно вьюпорт — страница НЕ прокручивается.
   Прокручивается только содержимое задачи (.cr-pz-scroll) и список
   учеников; все кнопки (Дальше/Показать ответ/отметки) видны всегда.
   ============================================================ */
@media (min-width: 981px) {
  #screen-classroom.active,
  #screen-cr-map.active { display: flex; flex-direction: column; overflow: hidden; }
  .cr-body {
    display: flex; align-items: stretch;
    flex: 1 1 auto; min-height: 0;
    max-width: 1560px; width: 100%;
    padding: 14px 18px 16px;
    gap: 16px;
  }
  .cr-taskcard {
    flex: 1 1 auto; min-width: 0; min-height: 0;
    display: flex; flex-direction: column;
    padding: 16px 18px 14px;
  }
  /* прокручиваемая начинка задачи: условие + интерактив движка */
  .cr-pz-scroll {
    flex: 1 1 auto; min-height: 0;
    overflow-y: auto; overscroll-behavior: contain;
    padding-right: 8px;
  }
  /* панель действий задачи — ПРИБИТА к низу карточки, не уезжает */
  .cr-taskbar {
    flex: none;
    margin-top: 12px; padding-top: 12px;
    border-top: 1.5px solid var(--glass-border);
    flex-wrap: nowrap;
  }
  .cr-side {
    flex: 0 0 356px; min-height: 0;
    display: flex; flex-direction: column;
    max-height: none; overflow: hidden;
    padding: 14px 16px 12px;
  }
  /* Окно отметок: гарантированный минимум — чем больше учеников,
     тем важнее чтобы список ✅/❌ НЕ съёживался (Task 22) */
  .cr-students {
    flex: 1 1 auto; min-height: 220px;
    overflow-y: auto; overscroll-behavior: contain;
    padding-right: 4px;
    margin-bottom: 12px;
  }
  .cr-top-live { flex: 0 1 auto; min-height: 30px; max-height: 24%; overflow-y: auto; overscroll-behavior: contain; }
}

/* Невысокие десктопы/ноутбуки: чуть компактнее, чтобы всё влезало */
@media (min-width: 981px) and (max-height: 880px) {
  .cr-students { min-height: 170px; }
  .cr-body { padding: 10px 18px 12px; gap: 14px; }
  .cr-taskcard { padding: 14px 16px 12px; }
  .cr-taskcard .pz-q { font-size: 1.16rem; margin-bottom: 6px; }
  .cr-taskbar { margin-top: 10px; padding-top: 10px; }
  .cr-side { padding: 12px 14px 10px; }
  .cr-side .cr-side-head h3 { font-size: 1rem; }
  .cr-side-head { margin-bottom: 8px; }
}

/* Головка панели отметок: заголовок + кнопка разворота (статистика Task 25 удалена) */
.cr-side-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 12px; flex: none;
}
.cr-side .cr-side-head h3 { margin: 0; color: var(--sp-yellow); font-size: 1.1rem; }

/* На средних ширинах кнопки шапки — только иконки (подписи в тултипах) */
@media (max-width: 1180px) and (min-width: 641px) {
  .cr-actions-pill .cr-lbl { display: none; }
  .cr-pillbtn { min-width: 40px; padding: 8px 10px; }
  .btn-reveal { min-width: 0; }
}

/* Панель отметок (мобильный/узкий фолбэк — весь столбец прокручивается) */
.cr-side {
  background: linear-gradient(170deg, rgba(29, 39, 80, 0.75), rgba(16, 22, 46, 0.85));
  border: 2px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 18px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  transition: flex-basis .35s ease;
}

/* ---------- АДАПТИВ ПАНЕЛИ ОТМЕТОК (Task 21/22) ----------
   >4 учеников → панель автоматически раздвигается, >8 — ещё шире;
   кнопка ⤢ в шапке разворачивает её до половины экрана.
   ВАЖНО: кнопки и строки НЕ сжимаются ни при каком количестве
   учеников — список просто прокручивается (жалоба: «чем больше
   учеников, тем меньше окно верно/неверно»). */
@media (min-width: 981px) {
  .cr-side.cr-side--crowd { flex-basis: 446px; }
  .cr-side.cr-side--pack  { flex-basis: 508px; }
  .cr-side.cr-side--wide  { flex-basis: min(720px, 48vw); }
  /* в развёрнутой панели — говорящие кнопки и звёзды, как на проекторе */
  .cr-side--wide .cr-btn-t, .cr-side--wide .cr-btn-p { display: inline; }
  .cr-side--wide .cr-st-life { display: inline; }
  .cr-side--wide .cr-st-name { font-size: 1.03rem; }
  /* мини-бригада в сайдбаре — КРУПНЫЕ герои (Task 23): до двух рядов,
     дальше свой скролл, но окно отметок со своим минимумом */
  .cr-mini-crew {
    flex: 0 1 auto; min-height: 56px;
    max-height: 240px; overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: rgba(225, 29, 46, .5) transparent;
    padding-right: 3px;
  }
  .cr-mini-crew::-webkit-scrollbar { width: 6px; }
  .cr-mini-crew::-webkit-scrollbar-thumb { background: rgba(225, 29, 46, .5); border-radius: 6px; }
  /* «прямое включение» — компактное окошко, чтобы героев учеников
     было видно КРУПНЕЕ (Task 23: уменьшена по просьбе пользователя) */
  .cr-spycam { max-height: 124px; width: min(100%, 340px); margin-inline: auto; }
}
.cr-side-x {
  flex: none;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px;
  border: 1.5px solid var(--glass-border);
  background: rgba(255, 255, 255, .07);
  color: inherit; font: inherit; font-size: 15px; line-height: 1;
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.cr-side-x:hover { background: rgba(255, 255, 255, .16); transform: translateY(-1px); }
.cr-side-x:focus-visible { outline: 2px solid rgba(255, 209, 84, .9); outline-offset: 1px; }
/* Устаревший прямой заголовок панели (ныне h3 живёт в .cr-side-head) */
.cr-side > h3 { color: var(--sp-yellow); margin-bottom: 12px; font-size: 1.1rem; }

/* На средних десктопах (панель узкая) lifetime-⭐ в строке отметок
   скрываем — имя ученика должно читаться целиком; lifetime виден в Топе */
@media (min-width: 981px) and (max-width: 1599px) {
  .cr-st-life { display: none; }
}

.cr-students { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.cr-student {
  display: flex; align-items: center; gap: 8px;
  flex: none; /* НИКОГДА не сжимается — иначе кнопки наезжают друг на друга */
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid var(--glass-border);
  border-radius: 12px;
  padding: 8px 10px;
  transition: background 0.2s;
  overflow: hidden;
}
.cr-student.cr-ok { background: rgba(47, 168, 79, 0.14); border-color: rgba(47, 168, 79, 0.5); }
.cr-st-av {
  width: 34px; height: 34px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  border: 1.5px solid var(--glass-border);
}
.cr-st-name { flex: 1; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: baseline; gap: 8px; }
.cr-st-life { font-style: normal; font-weight: 600; font-size: 0.78rem; color: rgba(255, 209, 84, 0.85); flex: none; }
.cr-st-pts { font-weight: 900; color: var(--sp-yellow); min-width: 34px; text-align: right; }
.cr-st-pts.neg { color: #ff9d9d; }
.cr-st-btns { display: flex; gap: 5px; flex: none; }
.cr-btn {
  height: 46px; min-width: 46px; padding: 0 8px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 20px; font-family: inherit;
  border-radius: 12px;
  border: 1.5px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.07);
  transition: all 0.12s;
}
.cr-btn-e { font-size: 18px; line-height: 1; }
.cr-btn-t { display: none; font-size: 0.85rem; font-weight: 700; line-height: 1; }
.cr-btn-p { display: none; font-size: 0.78rem; font-weight: 800; line-height: 1; color: var(--sp-yellow); }
/* на очень широких экранах (проектор 27"+) — говорящие кнопки, как в
   референсе: «✅ Верно +10»; панель расширяется, чтобы имена помещались */
@media (min-width: 1600px) {
  .cr-btn-t, .cr-btn-p { display: inline; }
  .cr-btn { padding: 0 10px; }
  .cr-side { flex-basis: 520px; }
}
/* широкие экраны с компактными иконками отметок: панели тоже чуть больше */
@media (min-width: 1500px) and (max-width: 1599px) {
  .cr-side { flex-basis: 400px; }
}
.cr-btn:hover:not(:disabled) { transform: translateY(-2px); background: rgba(255, 255, 255, 0.16); }
.cr-btn.cr-correct.on {
  background: var(--sp-ok);
  border-color: #7ee29a;
  box-shadow: 0 0 14px rgba(47, 168, 79, 0.6);
}
.cr-btn.cr-wrong:hover { background: rgba(214, 69, 69, 0.35); }
.cr-btn.cr-undo { font-size: 16px; border-style: dashed; border-color: rgba(214, 69, 69, 0.55); opacity: 0; pointer-events: none; width: 0; min-width: 0; padding: 0; border-width: 0; overflow: hidden; }
.cr-btn.cr-undo.show { opacity: 1; pointer-events: auto; width: 46px; border-width: 1.5px; padding: 0 8px; animation: crPop 0.25s ease; }
@keyframes crPop { 0% { transform: scale(0.6); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }

.cr-empty {
  color: rgba(255, 255, 255, 0.55);
  text-align: center; padding: 18px 10px;
  font-size: 0.92rem; line-height: 1.5;
  border: 1.5px dashed var(--glass-border);
  border-radius: 12px;
}

/* Живой топ */
.cr-top-live h4 { margin-bottom: 8px; color: var(--sp-yellow); }
.cr-top-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; margin-bottom: 5px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  font-weight: 700;
}
.cr-top-row.big { font-size: 1.15rem; padding: 12px 14px; }
.cr-top-av { font-size: 1.05em; }
.cr-top-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-top-row b { color: var(--sp-yellow); }

/* Модалка ростера */
.cr-add-row { display: flex; gap: 8px; margin-bottom: 14px; }
.cr-add-row .quest-input { flex: 1; min-height: 48px; }
.cr-add-row .btn-quest { min-width: 56px; min-height: 48px; padding: 8px; font-size: 1.3rem; }
/* Тряска невалидного поля */
.cr-nudge { animation: crShakeX 0.6s ease; border-color: rgba(214, 69, 69, 0.8) !important; }
@keyframes crShakeX { 0%, 100% { transform: translateX(0); } 15%, 45%, 75% { transform: translateX(-6px); } 30%, 60%, 90% { transform: translateX(6px); } }
.cr-roster-body { display: flex; flex-direction: column; gap: 6px; max-height: 34vh; overflow-y: auto; }
.cr-roster-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px; padding: 8px 12px; font-weight: 600;
}
.cr-roster-av { font-size: 1.1rem; }
.cr-roster-row span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 980px) {
  .cr-body { grid-template-columns: 1fr; }
  .cr-side { max-height: none; }
  /* Панель действий задачи прибита к низу карточки: «Дальше» и
     «Показать ответ» всегда под рукой, даже когда задача длинная */
  .cr-taskbar {
    position: sticky; bottom: 0; z-index: 6;
    margin: 14px -22px -22px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(16, 22, 46, 0.25), rgba(13, 18, 38, 0.96) 46%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1.5px solid var(--glass-border);
  }
}

/* Мобильная шапка класс-режима */
@media (max-width: 640px) {
  .cr-top { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .cr-top .lvl-title { flex: 1 1 100%; order: -1; justify-content: center; text-align: center; }
  .cr-body { padding: 12px; gap: 12px; }
  .cr-taskcard { padding: 16px; }
  .cr-taskcard .pz-q { font-size: 1.1rem; }
  /* шапка: пилюля с иконками в один ряд (подписи в тултипах) */
  .cr-actions-pill { flex: 1 1 100%; justify-content: center; flex-wrap: nowrap; }
  .cr-actions-pill .cr-lbl { display: none; }
  .cr-actions-pill .cr-pillbtn { min-width: 40px; padding: 8px 10px; }
  .cr-actions-pill .cr-gradesel { min-width: 0; }
  /* панель действий: «Показать ответ» своей строкой, навигация под ней */
  .cr-taskbar { flex-wrap: wrap; gap: 8px; margin: 12px -16px -16px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .cr-taskbar .btn-reveal { flex: 1 1 100%; min-width: 0; white-space: nowrap; }
  .cr-taskbar .cr-taskbar-left { flex: 1 1 100%; gap: 8px; }
  .cr-taskbar .cr-hintbtn { flex: 1; }
  .cr-taskbar .cr-nav { flex: 1; }
  .cr-taskbar .cr-nav .btn-quest { flex: 1; }
  .cr-taskbar .btn-ghost, .cr-taskbar .btn-quest, .cr-taskbar .cr-hintbtn, .cr-taskbar .btn-reveal { min-height: 46px; }
}

/* Селектор класса внутри пилюли */
.cr-actions-pill .cr-gradesel { min-height: 40px; padding: 6px 28px 6px 12px; border-radius: 999px; border-color: transparent; background-color: transparent; }
.cr-actions-pill .cr-gradesel:hover { background-color: rgba(255, 255, 255, 0.1); border-color: transparent; }

/* Селектор класса в шапке класс-режима */
.cr-gradesel {
  min-height: 44px; padding: 8px 12px; font-size: 0.9rem; font-weight: 700;
  font-family: inherit; color: var(--text, #fff); cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 10px;
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.8) 50%),
                    linear-gradient(135deg, rgba(255,255,255,0.8) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  padding-right: 30px;
}
.cr-gradesel option { color: #101020; background: #fff; }
.cr-gradesel:hover { background-color: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.32); }
.cr-gradesel:focus-visible { outline: 2px solid rgba(255, 209, 84, 0.9); outline-offset: 2px; }

@media (max-width: 640px) {
  .cr-top-actions { flex: 1 1 100%; justify-content: center; flex-wrap: wrap; }
}

/* Очень узкие экраны (≤380px, напр. 320×568): пилюле действий с иконками
   нужно ~341px, а в строке остаётся 296px — «⏹ Завершить» обрезался за
   правым краем (FIX-game2-zoom-typography, проверено на 320×568).
   Ужимаем кнопки/селект; wrap — страховка на экстремальный зум (<280px),
   на 320px всё по-прежнему помещается в один ряд. */
@media (max-width: 380px) {
  .cr-actions-pill { gap: 0; padding: 3px; flex-wrap: wrap; justify-content: center; }
  .cr-actions-pill .cr-pillbtn { min-width: 36px; padding: 8px 8px; }
  .cr-actions-pill .cr-gradesel {
    font-size: 0.84rem; min-height: 38px; padding: 5px 22px 5px 10px;
    background-position: calc(100% - 13px) 55%, calc(100% - 9px) 55%;
  }
}

/* (старый резерв под плававшую кнопку звука убран — звук теперь в фиксированном HUD) */

/* ============================================================
   НАСТРОЙКА УРОКА на стартовом экране (регистрация класса)
   ============================================================ */
.cr-badge {
  align-self: flex-start;
  padding: 7px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(226, 54, 54, 0.28), rgba(226, 54, 54, 0.12));
  border: 1.5px solid rgba(226, 54, 54, 0.55);
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--sp-white);
}
.cr-setup-sub { font-size: 0.92rem; line-height: 1.55; color: rgba(255, 255, 255, 0.78); margin-bottom: 2px; }
.cr-setup-sub b { color: var(--sp-yellow); }

/* Чипы зарегистрированных учеников */
.cr-setup-list { display: flex; flex-wrap: wrap; gap: 8px; }
.cr-setup-empty { padding: 10px 14px; font-size: 0.88rem; }
.cr-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 7px 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid var(--glass-border);
  font-weight: 700; font-size: 0.92rem;
  animation: crChipIn 0.18s ease;
}
@keyframes crChipIn { from { transform: scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }
.cr-chip-av {
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s ease;
}
.cr-chip-av:hover { transform: translateY(-2px) scale(1.1); }
.cr-chip-av:focus-visible { outline: 2px solid rgba(255, 255, 255, .7); outline-offset: 2px; border-radius: 8px; }
.cr-chip-x {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 900; color: #ffb3b3;
  background: rgba(214, 69, 69, 0.18);
  border: 1px solid rgba(214, 69, 69, 0.45);
  transition: background 0.15s, color 0.15s;
}
.cr-chip-x:hover { background: rgba(214, 69, 69, 0.5); color: #fff; }

/* Правила очков */
.score-rules { display: flex; gap: 10px; flex-wrap: wrap; }
.score-rules span {
  padding: 7px 12px;
  border-radius: 10px;
  font-weight: 800; font-size: 0.86rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid var(--glass-border);
}
.score-rules .plus { color: #7ee29a; border-color: rgba(47, 168, 79, 0.5); }
.score-rules .minus { color: #ffb3b3; border-color: rgba(214, 69, 69, 0.5); }

#btnCrResume { min-height: 44px; }

/* Панель урока в HUD (некликабельный чип — без hover-эффектов) */
.hud-lesson {
  display: flex; align-items: center; gap: 8px;
  min-height: 42px; padding: 4px 14px 4px 5px;
  cursor: default;
}
.hud-lesson:hover { transform: none; background: rgba(255, 255, 255, 0.07); }

/* ============================================================
   ФИНАЛ УРОКА: рейтинг класса
   ============================================================ */
#screen-cr-final {
  display: none;
  padding: 84px 16px 20px;
  overflow-y: auto;
  background:
    radial-gradient(900px 420px at 85% -5%, rgba(46, 74, 158, 0.3) 0%, rgba(14, 20, 40, 0) 60%),
    radial-gradient(700px 380px at 0% 100%, rgba(226, 54, 54, 0.12) 0%, rgba(14, 20, 40, 0) 55%);
}
#screen-cr-final.active { display: block; }

.crf-wrap {
  max-width: 760px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 16px;
  padding-bottom: 26px;
}
.crf-head { text-align: center; }
/* Кинобаннер-гифка «паучок празднует» над заголовком финала */
.crf-gif {
  display: block; width: min(100%, 340px); max-height: 132px; object-fit: cover;
  margin: 0 auto 10px; border-radius: 16px;
  border: 2px solid var(--glass-border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.crf-spider { font-size: 46px; animation: spiderBob 2.6s ease-in-out infinite; }
.crf-head h2 {
  font-size: clamp(1.5rem, 4.5vw, 2.1rem);
  color: var(--sp-yellow);
  letter-spacing: 0.02em;
}
.crf-meta {
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 700; font-size: 0.95rem;
}
.crf-rating { display: flex; flex-direction: column; gap: 8px; }
.crf-empty {
  text-align: center; color: rgba(255, 255, 255, 0.6);
  padding: 18px;
  border: 1.5px dashed var(--glass-border);
  border-radius: 14px;
}
.cr-rate-row {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(170deg, rgba(29, 39, 80, 0.9), rgba(16, 22, 46, 0.94));
  border: 2px solid var(--glass-border);
  border-radius: 14px;
  padding: 10px 14px;
}
.cr-rate-row.place-1 { border-color: rgba(255, 197, 49, 0.75); box-shadow: 0 0 18px rgba(255, 197, 49, 0.22); }
.cr-rate-row.place-2 { border-color: rgba(222, 226, 236, 0.5); }
.cr-rate-row.place-3 { border-color: rgba(205, 127, 50, 0.5); }
.cr-rate-place { font-size: 1.25rem; min-width: 42px; text-align: center; font-weight: 900; }
.cr-rate-av { font-size: 1.4rem; }
.cr-rate-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cr-rate-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-rate-details { font-size: 0.8rem; color: rgba(255, 255, 255, 0.6); }
.cr-rate-details .ok { color: #7ee29a; }
.cr-rate-details .err { color: #ffb3b3; }
.cr-rate-score { font-weight: 900; color: var(--sp-yellow); font-size: 1.1rem; white-space: nowrap; }
.cr-rate-stars { min-width: 64px; text-align: right; font-size: 0.9rem; letter-spacing: -2px; }
.crf-actions { display: flex; flex-direction: column; gap: 10px; }
.crf-actions .btn-quest,
.crf-actions .btn-ghost { min-height: 48px; font-size: 1.02rem; }
.crf-actions .btn-quest:disabled { filter: grayscale(0.4) brightness(0.85); cursor: default; }

@media (max-width: 640px) {
  #screen-cr-final { padding: 76px 10px 14px; }
  .cr-rate-row { gap: 8px; padding: 9px 10px; }
  .cr-rate-place { min-width: 32px; font-size: 1.05rem; }
  .cr-rate-av { font-size: 1.2rem; }
  .cr-rate-stars { min-width: 0; font-size: 0.78rem; }
}

/* ============================================================
   «Кого спросить?» — рулетка случайного ученика
   ============================================================ */
.cr-askbtn { position: relative; }
.cr-askbtn::after {
  content: '';
  position: absolute; inset: -3px;
  border-radius: inherit;
  border: 1.5px solid rgba(255, 209, 102, 0.0);
  transition: border-color 0.2s;
  pointer-events: none;
}
.cr-askbtn:hover::after { border-color: rgba(255, 209, 102, 0.65); }

.cr-ask-overlay {
  position: fixed; inset: 0; z-index: 120;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(5, 8, 18, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 18px;
}
.cr-ask-overlay.open { display: flex; }

.cr-ask-card {
  width: min(380px, 92vw);
  padding: 30px 26px 26px;
  border-radius: 20px;
  background: var(--glass);
  border: 1.5px solid var(--glass-border);
  backdrop-filter: blur(14px);
  text-align: center;
  display: flex; flex-direction: column; gap: 14px; align-items: center;
  animation: crAskIn 0.25s both;
}
@keyframes crAskIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: none; }
}
.cr-ask-title { font-size: 1.15rem; font-weight: 800; color: var(--sp-yellow); letter-spacing: 0.02em; }
.cr-ask-name {
  width: 100%;
  min-height: 76px;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(1.4rem, 5vw, 1.9rem);
  font-weight: 800;
  color: var(--sp-white);
  border-radius: 14px;
  background: rgba(229, 9, 20, 0.14);
  border: 1.5px solid rgba(229, 9, 20, 0.4);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.cr-ask-name.cr-ask-tick { background: rgba(255, 255, 255, 0.07); }
.cr-ask-name.cr-ask-landed {
  background: linear-gradient(135deg, rgba(48, 209, 88, 0.22), rgba(48, 209, 88, 0.08));
  border-color: rgba(48, 209, 88, 0.65);
  color: #7dffa8;
  animation: crAskLand 0.35s cubic-bezier(0.2, 1.5, 0.4, 1);
}
@keyframes crAskLand {
  from { transform: scale(1.12); }
  to { transform: scale(1); }
}
.cr-ask-meta { font-size: 0.82rem; color: rgba(255, 255, 255, 0.6); }

/* ============================================================
   КАРТА ПАУТИНЫ (#screen-cr-map): тропа локаций урока
   ============================================================ */
#screen-cr-map {
  padding: 76px 0 0;
  background:
    radial-gradient(900px 420px at 85% -5%, rgba(46, 74, 158, 0.3) 0%, rgba(14, 20, 40, 0) 60%),
    radial-gradient(700px 380px at 0% 100%, rgba(226, 54, 54, 0.12) 0%, rgba(14, 20, 40, 0) 55%);
}
/* паучья паутина на фоне карты */
#screen-cr-map::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    repeating-radial-gradient(circle at 12% -8%, transparent 0 54px, rgba(255, 255, 255, 0.045) 54px 56px),
    repeating-radial-gradient(circle at 96% 112%, transparent 0 64px, rgba(255, 255, 255, 0.04) 64px 66px);
  pointer-events: none;
}

.cr-map-body {
  display: flex; flex-direction: column;
  max-width: 1560px; width: 100%; margin: 0 auto;
  padding: 18px;
  gap: 14px;
}
@media (min-width: 981px) {
  .cr-map-body { flex: 1 1 auto; min-height: 0; padding: 16px 18px 16px; }
}

/* «Живой город»: этапы разбросаны по карте (координаты в data.js: x/y),
   соединены паутинными нитями, у каждого — SVG-здание */
.cr-map-city {
  position: relative;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  flex: 1 1 auto;
  min-height: 360px;
}
@media (min-width: 981px) { .cr-map-city { min-height: 0; } }

.cr-map-threads {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}
.cr-map-threadlines path {
  fill: none;
  stroke: rgba(255, 255, 255, .3);
  stroke-width: 2;
  stroke-dasharray: 5 6;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  animation: crThreadDash 16s linear infinite;
}
@keyframes crThreadDash { to { stroke-dashoffset: -264; } }

.cr-pin {
  position: absolute;
  z-index: 1;
  transform: translate(-50%, -100%);
  width: min(172px, 25vw);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 6px 11px;
  border-radius: 16px;
  background: linear-gradient(170deg, rgba(29, 39, 80, 0.78), rgba(16, 22, 46, 0.86));
  border: 1.5px solid var(--glass-border);
  color: var(--text, #fff); font-family: inherit;
  transition: transform .15s, border-color .15s, box-shadow .15s, filter .3s;
}
.cr-pin-bld { width: 78px; line-height: 0; }
.cr-pin-bld .sp-bld { height: 58px; width: auto; }
.cr-pin-name { font-weight: 800; font-size: 0.88rem; text-align: center; line-height: 1.25; }
.cr-pin-meta { font-size: 0.75rem; color: rgba(255, 255, 255, 0.6); font-weight: 700; }
.cr-pin.current {
  border-color: rgba(255, 209, 84, 0.8);
  background: linear-gradient(170deg, rgba(84, 66, 20, 0.5), rgba(29, 39, 80, 0.65));
  animation: crPinPulse 2.6s ease-in-out infinite;
}
@keyframes crPinPulse {
  0%, 100% { box-shadow: 0 0 16px rgba(255, 209, 84, 0.18); }
  50%      { box-shadow: 0 0 32px rgba(255, 209, 84, 0.45); }
}
.cr-pin.done { border-color: rgba(47, 168, 79, 0.55); }
.cr-pin.done .cr-pin-bld { filter: drop-shadow(0 0 10px rgba(47, 168, 79, .5)); }
.cr-pin.done .cr-pin-meta { color: #7ee29a; }
.cr-pin.locked { opacity: 0.58; filter: grayscale(.4); }
.cr-pin.open:hover, .cr-pin.current:hover, .cr-pin.done:hover {
  transform: translate(-50%, calc(-100% - 4px));
}
.cr-pin:focus-visible { outline: 2px solid rgba(255, 209, 84, 0.9); outline-offset: 2px; }
.cr-pin:disabled { cursor: not-allowed; }
/* маркер «вы здесь» (виден только на узких экранах, где токен скрыт) */
.cr-pin-you { display: none; position: absolute; top: -13px; right: 12px; font-size: 20px; animation: spiderBob 2.6s ease-in-out infinite; }

/* БРИГАДА ГЕРОЕВ на карте (Task 23): стоит у здания текущей локации;
   при смене этапа ПЕШКОМ идёт к новому пину (left/top transition + walk),
   по прибытии — cheer. Замена старого GIF-токена. */
.cr-map-crew {
  position: absolute;
  z-index: 3;
  display: flex; align-items: flex-end; gap: 2px;
  transform: translate(-14%, -96%);
  transition: left 1s cubic-bezier(0.45, 0.05, 0.35, 1), top 1s cubic-bezier(0.45, 0.05, 0.35, 1);
  pointer-events: none;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
}
.cr-map-crew-m .spidey-wrap { --sp-size: 52px; }
.cr-map-crew-more {
  align-self: flex-end; margin: 0 0 10px 3px;
  font-weight: 900; font-size: .95rem; color: var(--sp-yellow);
  text-shadow: 0 2px 6px rgba(0, 0, 0, .6);
}

/* нижняя панель карты: живой Топ + «К задаче» */
.cr-mapbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: rgba(10, 14, 30, 0.75);
  border: 1.5px solid var(--glass-border);
  border-radius: 16px;
  flex-wrap: wrap;
}
.cr-mapbar-top { flex: 1 1 auto; min-width: 0; display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.cr-mapchip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid var(--glass-border);
  font-weight: 700; font-size: 0.85rem; white-space: nowrap;
}
.cr-mapchip b { color: var(--sp-yellow); }
.cr-mapchip.muted { color: rgba(255, 255, 255, 0.5); font-weight: 600; border-style: dashed; }
.cr-map-go { flex: none; min-height: 44px; padding: 10px 22px; }

@media (max-width: 980px) {
  /* узкий экран: карта превращается в вертикальный список зданий */
  .cr-map-crew { display: none; }
  .cr-pin-you { display: block; }
  .cr-map-threads { display: none; }
  .cr-map-city { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
  .cr-pin {
    position: static; transform: none; width: auto;
    flex-direction: row; text-align: left; padding: 10px 12px; gap: 10px;
  }
  .cr-pin.open:hover, .cr-pin.current:hover, .cr-pin.done:hover { transform: none; }
  .cr-pin-bld { width: 52px; flex: none; }
  .cr-pin-bld .sp-bld { height: 40px; }
  .cr-pin-name { text-align: left; flex: 1; }
  .cr-mapbar-top { order: 2; flex-basis: 100%; }
  .cr-map-go { order: 1; flex: 1; }
}

/* ============================================================
   АНИМАЦИЯ ПЕРЕЛЁТА (#crTransition)
   ============================================================ */
#crTransition {
  position: fixed; inset: 0; z-index: 140;
  display: none; align-items: center; justify-content: center;
  background:
    radial-gradient(700px 400px at 50% 42%, rgba(46, 74, 158, 0.4) 0%, rgba(5, 8, 18, 0.55) 70%),
    rgba(5, 8, 18, 0.88);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
#crTransition.open { display: flex; }
.crt-web {
  position: absolute; inset: 0;
  background-image: repeating-radial-gradient(circle at 50% 44%, transparent 0 52px, rgba(255, 255, 255, 0.05) 52px 54px);
  animation: crtWebSpin 24s linear infinite;
}
@keyframes crtWebSpin { to { transform: rotate(360deg); } }
.crt-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; animation: crtIn 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes crtIn { from { opacity: 0; transform: scale(0.8) translateY(16px); } }
.crt-vid-wrap {
  position: relative;
  width: min(440px, 76vw);
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 0 0 6px rgba(255, 255, 255, 0.05);
  transform-origin: top center;
  animation: crtSwing 1.7s ease-in-out infinite;
}
@keyframes crtSwing { 0%, 100% { transform: rotate(2.4deg); } 50% { transform: rotate(-2.4deg); } }
.crt-vid { width: 100%; height: 100%; object-fit: cover; display: block; }
/* GIF-фолбэк, если видео перехода не загрузилось */
.crt-vid-fallback { width: 100%; height: 100%; object-fit: cover; display: block; }
.crt-live {
  position: absolute; top: 10px; left: 10px;
  font-size: 0.64rem; font-weight: 900; letter-spacing: 0.14em;
  color: #fff; background: rgba(214, 47, 47, 0.92);
  padding: 3px 9px; border-radius: 6px;
  text-transform: uppercase;
}
.crt-sub { color: rgba(255, 255, 255, 0.65); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.78rem; }
.crt-icon { font-size: 64px; line-height: 1.1; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.6)); animation: crtIconIn 0.6s 0.15s cubic-bezier(0.2, 1.4, 0.4, 1) backwards; }
@keyframes crtIconIn { from { opacity: 0; transform: scale(0.4); } }
.crt-name { font-size: clamp(1.3rem, 4vw, 1.7rem); font-weight: 900; color: var(--sp-yellow); }

/* ============================================================
   ДЕКОР ЗАДАЧИ: паутина-угол, город, висящий паук, частицы
   ============================================================ */
.cr-taskcard { position: relative; }
.cr-decor {
  position: absolute; inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.cr-pz-scroll { position: relative; z-index: 1; }
/* taskbar: позицию (sticky/static) задаёт раскладка — тут только слой поверх декора */
.cr-taskbar { z-index: 6; }
.cr-web { position: absolute; top: 0; left: 0; width: 150px; height: 150px; opacity: 0.12; }
.cr-city { position: absolute; left: 0; right: 0; bottom: 0; height: 62px; opacity: 0.55; }
.cr-city svg { width: 100%; height: 100%; display: block; }
.cr-hang {
  position: absolute; top: 0; right: 30px;
  display: flex; flex-direction: column; align-items: center;
  transform-origin: top center;
  animation: crHangSwing 3.4s ease-in-out infinite;
  opacity: 0.55;
}
@keyframes crHangSwing { 0%, 100% { transform: rotate(5deg); } 50% { transform: rotate(-5deg); } }
.cr-hang-thread { width: 1.5px; height: 42px; background: linear-gradient(rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.15)); }
.cr-hang-spider { font-size: 20px; line-height: 1; margin-top: -2px; }
.cr-dot {
  position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.25);
  animation: crFloat 10s linear infinite;
}
.cr-dot.d1 { width: 6px; height: 6px; left: 9%; top: 34%; }
.cr-dot.d2 { width: 4px; height: 4px; left: 56%; top: 16%; animation-delay: -3.5s; animation-duration: 12s; }
.cr-dot.d3 { width: 5px; height: 5px; left: 80%; top: 58%; animation-delay: -7s; animation-duration: 14s; }
@keyframes crFloat {
  0% { transform: translate3d(0, 24px, 0); opacity: 0; }
  12% { opacity: 0.85; }
  85% { opacity: 0.4; }
  100% { transform: translate3d(30px, -34px, 0); opacity: 0; }
}

/* ============================================================
   ПОДСКАЗКА ПАУЧКА (класс-режим)
   ============================================================ */
.cr-hintbtn {
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 209, 84, 0.5);
  background: rgba(255, 209, 84, 0.12);
  color: var(--sp-yellow);
  font-family: inherit; font-weight: 700; font-size: 0.92rem;
  white-space: nowrap;
  transition: transform 0.12s, background 0.15s;
}
.cr-hintbtn:hover:not(:disabled) { transform: translateY(-2px); background: rgba(255, 209, 84, 0.22); }
.cr-hintbtn:disabled { opacity: 0.55; cursor: default; }
.cr-taskbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cr-hintbubble { margin-top: 12px; }

/* ============================================================
   ФОТО-И ВИДЕО-ДЕКОР (ассеты img/spiderman/)
   ============================================================ */

/* --- Стартовый экран: неоновый Майлз фон + тёмный градиент --- */
.sp-hero-bg {
  position: absolute; inset: 0;
  background: url('../img/spiderman/bg-miles-neon.jpg') center 30% / cover no-repeat;
  pointer-events: none;
}
.sp-hero-bg::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(1200px 600px at 50% 0%, rgba(5, 8, 18, 0.1) 0%, rgba(5, 8, 18, 0.55) 70%),
    linear-gradient(180deg, rgba(5, 8, 18, 0.5) 0%, rgba(5, 8, 18, 0.78) 100%);
}

/* --- Карта Паутины: фото-фон за тропой --- */
.cr-map-body { position: relative; }
.cr-map-bg {
  position: absolute; inset: -18px;
  background: url('../img/spiderman/bg-schoolbus.jpg') center 30% / cover no-repeat;
  opacity: 0.14;
  filter: saturate(1.1) blur(1px);
  border-radius: 26px;
  pointer-events: none;
  z-index: 0;
}
.cr-map-city, .cr-mapbar { position: relative; z-index: 1; }

/* --- Задача: фото-фон внутри карточки --- */
.cr-bgphoto {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center 25%;
  opacity: 0.16;
  filter: blur(1.5px) saturate(1.05);
  transform: scale(1.05);
}
.cr-bgphoto::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(5, 8, 18, 0.5) 0%, rgba(5, 8, 18, 0.18) 45%, rgba(5, 8, 18, 0.55) 100%);
}

/* --- Задача: «прямое включение с Манхэттена» (видео в боковой панели) --- */
.cr-spycam {
  display: none;
  position: relative;
  width: 100%; aspect-ratio: 16 / 9;
  flex: none;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.32);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
  background: rgba(5, 8, 18, 0.55);
}
@media (min-width: 1281px) and (min-height: 761px) {
  .cr-spycam {
    display: block;
    /* компактное «прямое включение» (Task 23): уже и ниже —
       чтобы герои учеников в панели были крупнее и виднее */
    width: min(100%, 340px);
    max-height: 124px;
    margin-inline: auto;
  }
}
.cr-spycam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cr-spycam-live {
  position: absolute; top: 7px; left: 7px;
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.58rem; font-weight: 900; letter-spacing: 0.12em;
  color: #fff; background: rgba(214, 47, 47, 0.92);
  padding: 2px 7px; border-radius: 5px;
  text-transform: uppercase;
}
.cr-spycam-live i {
  width: 6px; height: 6px; border-radius: 50%;
  background: #fff;
  animation: crLiveBlink 1.4s ease-in-out infinite;
}
@keyframes crLiveBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.cr-spycam-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: 0.6rem; font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  padding: 10px 8px 4px;
  background: linear-gradient(rgba(5, 8, 18, 0), rgba(5, 8, 18, 0.85));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* когда «прямое включение» в эфире — висящий паучок не нужен */
@media (min-width: 1281px) and (min-height: 761px) {
  .cr-decor .cr-hang { display: none; }
}

/* --- Финал: неоновый фон под рейтингом --- */
#screen-cr-final { position: relative; }
.crf-bg {
  position: absolute; inset: 0;
  background: url('../img/spiderman/bg-miles-neon.jpg') center 30% / cover no-repeat;
  opacity: 0.18;
  filter: blur(2px) saturate(1.15);
  pointer-events: none;
}
.crf-wrap { position: relative; z-index: 1; }

/* --- Адаптив фото- и видео-декора --- */
@media (max-width: 980px) {
  .cr-bgphoto { opacity: 0.12; }
  .sp-hero-bg { background-position: center 20%; }
}
@media (max-width: 640px) {
  .crt-vid-wrap { width: min(320px, 82vw); }
}
@media (prefers-reduced-motion: reduce) {
  .crt-vid-wrap { animation: none; }
  .cr-spycam video, .crt-vid { display: block; }
}

/* ============================================================
   🛒 МАГАЗИН ЭКИПИРОВКИ (SpiderHero v2): костюмы/аксессуары за баллы
   ============================================================ */
.cr-shop-card {
  width: min(880px, 96vw);
  max-height: min(90vh, 860px);
  display: flex; flex-direction: column;
}
.cr-shop-tile { min-width: 0; max-width: 100%; }
.cr-shop-sub { margin: 4px 0 10px; font-size: .85rem; opacity: .75; overflow-wrap: anywhere; }

/* Верхний раздел магазина — БОЛЬШИЕ вкладки-герои (Task 24: заметно выше и крупнее) */
.cr-shop-tabs {
  display: flex; flex-wrap: wrap; gap: 12px;
  flex: none;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .08);
  min-height: 118px;
  max-height: 380px; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(225, 29, 46, .5) transparent;
}
.cr-shop-tab {
  display: inline-flex; align-items: center; gap: 13px;
  min-width: 0; max-width: 320px;
  padding: 9px 22px 9px 11px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .05);
  color: inherit; font: inherit; font-size: 1.1rem;
  cursor: pointer; transition: border-color .2s, background .2s, transform .15s;
}
.cr-shop-tab:hover { border-color: rgba(255, 255, 255, .32); transform: translateY(-1px); }
.cr-shop-tab.on {
  border-color: rgba(225, 29, 46, .85);
  background: rgba(225, 29, 46, .16);
}
.cr-shop-tab-av { display: inline-flex; line-height: 0; flex: none; }
.cr-shop-tab-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.cr-shop-tab b { color: #f5c542; font-size: 1.16rem; flex: none; }

.cr-shop-headrow { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cr-shop-balance {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(245, 197, 66, .2), rgba(245, 197, 66, .07));
  border: 1.5px solid rgba(245, 197, 66, .45);
  font-size: 1.02rem;
  max-width: 100%;
}
.cr-shop-balance b { font-size: 1.15rem; color: #f5c542; }
.cr-shop-balance i { font-style: normal; opacity: .85; font-size: .88rem; }
.cr-shop-hint { font-style: normal; font-size: .72rem; opacity: .55; overflow-wrap: anywhere; }

/* Мобильные: раздел вкладок остаётся крупным, но компактнее */
@media (max-width: 640px) {
  .cr-shop-tabs { padding: 9px; gap: 9px; min-height: 86px; max-height: 320px; border-radius: 16px; }
  .cr-shop-tab { padding: 7px 15px 7px 8px; gap: 10px; font-size: 1rem; }
  .cr-shop-tab b { font-size: 1.05rem; }
}

.cr-shop-body {
  flex: 1 1 auto; min-height: 0;
  max-height: none;
  overflow-y: auto; overflow-x: hidden;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(225, 29, 46, .55) transparent;
}
.cr-shop-body::-webkit-scrollbar { width: 8px; }
.cr-shop-body::-webkit-scrollbar-thumb { background: rgba(225, 29, 46, .55); border-radius: 8px; }
.cr-shop-body h4 {
  margin: 12px 2px 8px; font-size: .92rem; letter-spacing: .02em;
  opacity: .9;
}
.cr-shop-body h4:first-child { margin-top: 2px; }

.cr-shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px;
}
.cr-shop-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .045);
  border: 1.5px solid rgba(255, 255, 255, .1);
  transition: border-color .2s, box-shadow .2s, transform .15s;
}
.cr-shop-tile:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, .22); }
.cr-shop-tile.active {
  border-color: rgba(225, 29, 46, .8);
  box-shadow: 0 0 0 1px rgba(225, 29, 46, .35), 0 6px 18px rgba(225, 29, 46, .18);
  background: rgba(225, 29, 46, .08);
}
.cr-shop-prev {
  height: 96px;
  display: flex; align-items: flex-end; justify-content: center;
  pointer-events: none;
}
.cr-shop-name { font-size: .78rem; text-align: center; min-height: 2.3em; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; align-content: center; gap: 3px 4px; overflow-wrap: break-word; padding: 0 2px; }
.cr-shop-name > * { max-width: 100%; }
/* превью питомца в карточке магазина */
.cr-shop-prev-pet { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; }
.cr-shop-prev-pet .sp-pet { position: static; width: 58px; min-width: 0; right: auto; bottom: auto; filter: none; }
.cr-shop-nopet { font-size: 32px; opacity: .45; }
.cr-shop-free {
  font-style: normal; font-size: .62rem; padding: 1px 6px;
  border-radius: 999px; background: rgba(96, 200, 120, .2); color: #7ee29a;
  border: 1px solid rgba(96, 200, 120, .4);
}
.cr-shop-btn {
  width: 100%;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1.5px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .08);
  color: inherit; font: inherit; font-size: .78rem;
  cursor: pointer; transition: background .2s, border-color .2s, transform .12s;
}
.cr-shop-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .4); transform: translateY(-1px); }
.cr-shop-btn.buy { border-color: rgba(245, 197, 66, .55); color: #f5c542; font-weight: 600; }
.cr-shop-btn.buy:hover:not(:disabled) { background: rgba(245, 197, 66, .14); }
.cr-shop-btn.on { border-color: rgba(96, 200, 120, .5); color: #7ee29a; cursor: default; }
.cr-shop-btn:disabled { opacity: .45; cursor: not-allowed; }

/* Баланс в списке учеников (модалка) */
.cr-roster-bal {
  font-style: normal; font-size: .74rem; color: #f5c542;
  background: rgba(245, 197, 66, .1);
  border: 1px solid rgba(245, 197, 66, .3);
  border-radius: 999px; padding: 1px 8px; margin-left: 6px;
  white-space: nowrap;
}
