/*
 * Дизайн-система интерактивов курса «Безопасный ИИ» — общий файл трех блоков.
 * Источник токенов: Ресурсы/Дизайн-система интерактивов.md.
 * Эталоны композиции: самоаудит (SERVICE_Safe AI_self-audit) и светофор задач Урока 2.
 *
 * Главное правило композиции: весь контент экрана лежит в ОДНОЙ белой панели
 * поверх голубого фона. Плашки, карточки задач и вердикты — вложены внутрь нее,
 * а не рассыпаны отдельными островами по фону.
 */

:root {
  --accent: #5F94FF;        /* обвязка: кнопки, ссылки, фокус */
  --accent-dark: #4070E0;
  --map-accent: #3f6fff;    /* только листы Маршрутной карты (Блок 3) */
  --accent-soft: #DCE8FF;
  --accent-faint: #F0F4FF;
  --bg: #E8F0FE;
  --text: #1A1A2E;
  --lead: #33384a;          /* вводные абзацы: чуть мягче основного текста */
  --muted: #6B7280;
  --line: #e6e9ef;          /* тонкие рамки внутри белой панели */
  --green: #16a34a;
  --yellow: #f59e0b;
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 'Inter', Arial, sans-serif;
  overflow-x: hidden;
}

/* Колонка 650px — совпадает с шириной картинок в уроках (iframe школы ужимает ~x0.5) */
.container {
  width: 650px;
  max-width: 100%;
  margin: 0 auto;
  padding: 32px 16px 44px;
}

/* Белый лист — основной носитель контента */
.panel {
  background: #fff;
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(95, 148, 255, 0.12);
}

/* Шапка блока — узкая полоса (Блоки 2 и 3) */
.block-header {
  background: #fff;
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 14px;
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 2px 8px rgba(95, 148, 255, 0.15);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Экраны */
.screen { display: none; }
.screen.visible { display: block; animation: fadein 0.25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Типографика */
h1 {
  font: 700 27px/1.22 'Inter', Arial, sans-serif;
  letter-spacing: -0.01em;
  margin: 0;
}
h2 {
  font: 800 22px/1.25 'Inter', Arial, sans-serif;
  margin: 0;
}
.lead {
  font-size: 16px;
  line-height: 1.55;
  color: var(--lead);
  margin: 14px 0 0;
}
.bullets { margin: 10px 0 0; padding-left: 22px; }
.bullets li {
  font-size: 16px;
  line-height: 1.55;
  color: var(--lead);
  margin: 10px 0;
}
.bullets li::marker { color: var(--accent); }

/* Прогресс-бар рабочих экранов (эталон — самоаудит).
   Крупного заголовка на этих экранах нет: название шага живет здесь,
   а большой заголовок — один раз на обложке. */
.progress-wrap { margin-bottom: 20px; }
.progress-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}
.progress-step { font: 600 14px 'Inter', Arial, sans-serif; color: var(--accent-dark); white-space: nowrap; }
.progress-title { font: 500 14px 'Inter', Arial, sans-serif; color: var(--muted); text-align: right; }
.progress-bar { height: 8px; border-radius: 8px; background: var(--accent-soft); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 8px; transition: width 0.35s ease; }

/* Пилюли обложки: слева иконка, справа обещание */
.pills { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 0; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-faint);
  color: var(--accent-dark);
  font: 600 13.5px 'Inter', Arial, sans-serif;
  padding: 8px 14px;
  border-radius: 22px;
  border: 1px solid rgba(95, 148, 255, 0.18);
}
.pill-ic { font-size: 16px; line-height: 1; flex: 0 0 auto; }

/* Плашки внутри панели. Размер шрифта у обеих одинаковый: на экране разбора
   они стоят рядом, и разнобой в полпикселя читается как неряшливость. */
.plate-info {
  background: var(--accent-faint);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--text);
}
/* Предупреждение о чувствительных данных — единственное, что стоит между
   студентом и отправкой реальных цифр в нейросеть. Не прятать и не смягчать. */
.plate-safety {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #fff7e8;
  border: 1px solid #f5dca0;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14.5px;
  line-height: 1.45;
  color: #6b5320;
}
.plate-safety .ic { font-size: 20px; line-height: 1.2; flex: 0 0 auto; }

/* Кнопки — радиус 8px, БЕЗ box-shadow и свечения */
.primary-btn {
  background: var(--accent); color: #fff; border: none;
  border-radius: 8px; padding: 12px 22px;
  font: 600 15px 'Inter', Arial, sans-serif; cursor: pointer;
  transition: background 0.2s;
}
.primary-btn:hover { background: var(--accent-dark); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.secondary-btn {
  background: transparent; color: var(--accent);
  border: 1.5px solid var(--accent); border-radius: 8px;
  padding: 12px 22px; font: 600 15px 'Inter', Arial, sans-serif;
  cursor: pointer; transition: background 0.2s, color 0.2s;
}
.secondary-btn:hover { background: rgba(95, 148, 255, 0.08); }
.secondary-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.link-btn {
  background: none; border: none; color: var(--muted);
  font: 500 14px 'Inter', Arial, sans-serif; text-decoration: underline;
  cursor: pointer; padding: 6px;
}
.link-btn:hover { color: var(--accent-dark); }

.btn-block { display: block; width: 100%; font-size: 16px; padding: 14px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

/* Карточка задачи — вложена в белую панель, поэтому держится на тонкой рамке */
.task-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px 15px;
  margin-bottom: 10px;
}
.task-card .remove-btn {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 18px; line-height: 1; padding: 4px;
}
.task-card .remove-btn:hover { color: var(--accent-dark); }
.task-card .char-counter { text-align: right; margin-top: 4px; }
.task-text-fixed { white-space: pre-wrap; word-break: break-word; padding-right: 20px; }

/* Поля ввода */
textarea, select {
  width: 100%;
  font: 400 15px/1.5 'Inter', Arial, sans-serif;
  color: var(--text);
  border: 1.5px solid rgba(95, 148, 255, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}
textarea { resize: vertical; min-height: 64px; }
textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea::placeholder { color: var(--muted); }

/* Разбор: зеленые задачи — одной строкой без пояснений.
   Пояснение по каждой зеленой задаче раздувало экран и ничему не учило:
   если задача зеленая, разбирать нечего. Учат только проблемные. */
.group-title { font: 700 15px 'Inter', Arial, sans-serif; margin: 22px 0 10px; }
.green-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #f6fdf9;
  border: 1px solid #d6efe0;
  border-radius: 11px;
  padding: 11px 13px;
  margin-bottom: 8px;
}
.green-line .ic { flex: 0 0 auto; line-height: 1.4; }
.green-line .txt { flex: 1; font-size: 15px; line-height: 1.4; word-break: break-word; }

/* Проблемная задача: заголовок-строка + разбор нейроинструктора под ней */
.task-head { display: flex; gap: 10px; align-items: flex-start; }
.task-head .ic { flex: 0 0 auto; line-height: 1.4; }
.task-head .txt { flex: 1; font-size: 15px; line-height: 1.4; word-break: break-word; }

.verdict {
  border-radius: 10px;
  padding: 12px 14px 12px 16px;
  margin-top: 12px;
  font-size: 14px;
}
.verdict-yellow { background: #fffbeb; border-left: 4px solid var(--yellow); }
.verdict-hint { margin-top: 8px; font-size: 13.5px; color: #6b5320; }

/* Три кнопки должны влезать в одну строку: «Удалить», уехавшее на свою строку,
   читается как отдельный блок, а это всего лишь третий вариант маршрута. */
.route-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.route-buttons .secondary-btn { padding: 8px 11px; font-size: 13.5px; }
.route-buttons .link-btn { padding: 8px 4px; font-size: 13.5px; }
.route-buttons .secondary-btn.chosen { background: var(--accent); color: #fff; }
.route-note { margin-top: 8px; font-size: 13px; color: var(--muted); }

.summary-head { font: 700 18px/1.4 'Inter', Arial, sans-serif; margin-top: 14px; }
.disclaimer { font-size: 13px; color: var(--muted); margin-top: 18px; line-height: 1.5; }

/* Модальные окна (детектор, подтверждения) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}
.modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  padding: 24px;
  width: 480px;
  max-width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}
.modal h3 { margin: 0 0 12px; font-size: 19px; }
.modal .quote {
  background: var(--accent-faint);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  margin: 10px 0;
  word-break: break-word;
}
.modal mark { background: #fde68a; border-radius: 3px; padding: 0 2px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

.status-error {
  color: #b45309;
  background: #fffbeb;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  margin-top: 12px;
}

.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -3px;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Тост поверх контента (лимит задач, «скопировано») */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  font-size: 14px;
  border-radius: 8px;
  padding: 10px 18px;
  z-index: 110;
  max-width: 90%;
}

.clear-row { text-align: center; margin-top: 14px; }

/* ───────── Блок 2 «Отвоеванные задачи» ─────────
   Только новые классы. Правила Блока 1 не переопределяем: на них держится
   работающий интерактив. */

/* Пара «было / стало»: исходная формулировка серой строкой над полем ввода —
   студент должен видеть, что именно он отвоевывает. */
.was-line {
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
  margin-bottom: 8px;
  padding-right: 22px;
  word-break: break-word;
}
.was-line .label { font-weight: 600; margin-right: 4px; }

.hint-line {
  background: var(--accent-faint);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--lead);
  margin-bottom: 10px;
}
.hint-line .label { font-weight: 600; }

/* Строка накопления: сколько зеленых задач уже лежит в перечне */
.count-line {
  font-size: 14px;
  color: var(--lead);
  background: #f6fdf9;
  border: 1px solid #d6efe0;
  border-radius: 10px;
  padding: 10px 13px;
  margin-top: 18px;
}

/* Разбор: своя версия и версия инструктора идут одна под другой.
   Весь текст внутри карточки одного кегля — 15px, как база дизайн-системы.
   Разнобой в полпикселя читается как неряшливость. */
.verdict-b2 { font-size: 15px; line-height: 1.5; }
.verdict-b2 .verdict-hint { font-size: 15px; line-height: 1.5; margin-top: 10px; }
.verdict-b2 .route-note { font-size: 15px; line-height: 1.5; }
.verdict-b2 textarea { font-size: 15px; line-height: 1.5; }
.version-label {
  font: 600 15px/1.5 'Inter', Arial, sans-serif;
  margin: 14px 0 6px;
}
.version-mine {
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
  word-break: break-word;
}
/* Поле версии инструктора растет под текст: прокрутка внутри поля заставляла
   студента скроллить, чтобы дочитать предложенный промпт. */
.verdict-b2 textarea { min-height: 96px; overflow: hidden; resize: none; }
.verdict-b2 .route-buttons .primary-btn { padding: 10px 16px; font-size: 14.5px; }
/* Выбранный запасной выход подсвечиваем, но кнопкой не делаем */
.link-btn.chosen-link { color: var(--accent-dark); font-weight: 700; }

/* Пометка «отвоевана» в итоговом списке */
.badge {
  display: inline-block;
  background: var(--accent-faint);
  color: var(--accent-dark);
  border: 1px solid rgba(95, 148, 255, 0.25);
  border-radius: 20px;
  padding: 1px 9px;
  font: 600 11.5px 'Inter', Arial, sans-serif;
  margin-left: 8px;
  white-space: nowrap;
  vertical-align: 1px;
}

/* Свернутая строка отложенных задач */
.fold { margin-top: 18px; }
.fold-toggle {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-dark);
  font: 600 14px 'Inter', Arial, sans-serif;
  cursor: pointer;
  text-align: left;
}
.fold-toggle:hover { text-decoration: underline; }
.fold-hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.fold-body { margin-top: 10px; }
.fold-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.fold-item .txt { flex: 1 1 220px; font-size: 14px; line-height: 1.4; word-break: break-word; }
.fold-item .secondary-btn { padding: 7px 10px; font-size: 13px; }

/* Две части регламента на итоговом экране — равновесные по весу.
   Раньше чек-лист лежал в рамке, а список задач шел голым, и чек-лист
   выпирал вперед, хотя части равноценны. */
.part {
  border: 1.5px solid var(--accent-soft);
  background: var(--accent-faint);
  border-radius: 14px;
  padding: 18px 20px;
  margin-top: 22px;
}
.part-label {
  font: 700 11.5px 'Inter', Arial, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-dark);
}
.part h2 { font-size: 19px; margin-top: 7px; }
.part-lead {
  font-size: 15px;
  line-height: 1.5;
  color: var(--lead);
  margin: 10px 0 0;
}
/* Часть регламента на своем экране (Блок 3, ревизия 17.07.2026).
   Голубой плашки .part здесь нет намеренно: она нужна была, когда три части лежали
   на одном экране и должны были читаться равноценно рядом. Теперь у каждой свой экран,
   сравнивать не с чем, а рамка внутри белой карточки была бы просто второй рамкой. */
.part-head { margin-top: 16px; }
.part-title { font-size: 19px; margin: 7px 0 0; }
.part .green-line { background: #fff; border-color: #d6efe0; }
.part .plate-info { background: #fff; }

/* Карусель правил (конструкция — из интерактива самоаудита) */
.carousel { margin-top: 14px; }
.carousel-viewport { overflow: hidden; transition: height 0.35s ease; }
/* align-items:flex-start — иначе флексбокс растянет все карточки до высоты самой
   длинной, и высота вьюпорта будет меряться по ней, а не по текущей карточке. */
.carousel-track { display: flex; align-items: flex-start; transition: transform 0.35s ease; }
/* Поля внутри слайда — это место для тени карточки. Без них тень упирается
   в край вьюпорта с overflow: hidden и обрезается по низу и бокам. */
.carousel-card { flex: 0 0 100%; width: 100%; padding: 6px 14px 18px; }
.carousel-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 12px;
}
.carr {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 3px;
  transition: background 0.2s;
}
.carr:hover { background: var(--accent-dark); }
.carr:disabled { opacity: 0.32; cursor: default; }
.carousel-counter {
  font: 600 14px 'Inter', Arial, sans-serif;
  color: var(--muted);
  min-width: 52px;
  text-align: center;
}
.carousel-dots { display: flex; justify-content: center; gap: 8px; margin-top: 11px; flex-wrap: wrap; }
.cdot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent-dark);
  opacity: 0.28;
  cursor: pointer;
  border: none;
  padding: 0;
  transition: opacity 0.2s, transform 0.2s;
}
.cdot.active { opacity: 1; transform: scale(1.35); }
/* Точка правила, у которого есть личный пример: студент видит, где его задачи */
.cdot.marked { background: var(--green); opacity: 0.5; }
.cdot.marked.active { opacity: 1; }

/* Карточка правила приподнята тенью: без нее карусель читалась как плоское белое
   поле, и было непонятно, что карточки вообще листаются. */
.rule-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 16px 18px;
  box-shadow: 0 6px 16px rgba(26, 26, 46, 0.09), 0 2px 5px rgba(95, 148, 255, 0.10);
}
.rule-head { display: flex; align-items: baseline; gap: 10px; }
.rule-num {
  font: 800 20px/1 'Inter', Arial, sans-serif;
  color: var(--accent);
  flex: 0 0 auto;
}
.rule-title {
  font: 700 15.5px/1.4 'Inter', Arial, sans-serif;
  flex: 1;
}
.rule-badge {
  display: inline-block;
  font: 600 11.5px 'Inter', Arial, sans-serif;
  color: var(--green);
  background: #f0fbf4;
  border: 1px solid #d6efe0;
  border-radius: 20px;
  padding: 2px 9px;
  margin-top: 8px;
}
.rule-text { font-size: 15px; line-height: 1.5; color: var(--lead); margin-top: 8px; }
.rule-example {
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--lead);
  background: var(--accent-faint);
  border-radius: 9px;
  padding: 10px 12px;
  margin-top: 10px;
}

/* Реплика нейроинструктора под каруселью: она связывает общие правила
   с задачами конкретного студента, поэтому подана как обращение, а не как сноска. */
.checklist-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--accent-soft);
  border-radius: 12px;
  padding: 13px 15px;
  margin-top: 16px;
}
.checklist-note .ic { font-size: 18px; line-height: 1.3; flex: 0 0 auto; }
.checklist-note .body { flex: 1; }
.checklist-note .author {
  font: 700 13px 'Inter', Arial, sans-serif;
  color: var(--accent-dark);
  margin-bottom: 3px;
}
.checklist-note .txt { font-size: 15px; line-height: 1.5; color: var(--text); }

.bridge-note {
  margin-top: 22px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--lead);
}

/* ───────── Блок 3 «Лист Маршрутной карты» ─────────
   Только новые классы. Правила Блоков 1 и 2 не переопределяем: на них держатся
   два работающих интерактива. */

/* Карточка шага плана: заголовок, вопрос-подсказка, пустое поле.
   Поле пустое сознательно — готовые формулировки приходят после попытки,
   а не вместо нее. Пример живет в плейсхолдере. */
.step-title { font: 700 15.5px/1.4 'Inter', Arial, sans-serif; padding-right: 22px; }
.step-question { font-size: 14px; line-height: 1.45; color: var(--muted); margin: 4px 0 10px; }
.step-title-input {
  width: 100%;
  font: 700 15.5px 'Inter', Arial, sans-serif;
  color: var(--text);
  border: 1.5px solid rgba(95, 148, 255, 0.35);
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 10px;
  background: #fff;
}
.step-title-input:focus { outline: none; border-color: var(--accent); }
.step-title-input::placeholder { color: var(--muted); font-weight: 400; }

/* Рабочий шаг: пояснение без желтой рамки — рамка читалась бы как претензия
   к тому, что человек сделал хорошо. */
.verdict-ok-line {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--green);
}

/* Строка листа Маршрутной карты: поле во всю ширину, крестик справа.
   Заголовок и бейдж занимают свою строку над полем. */
.sheet-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 8px;
  margin-bottom: 10px;
}
.sheet-row .row-title {
  grid-column: 1 / -1;
  font: 700 14.5px/1.4 'Inter', Arial, sans-serif;
  margin-bottom: 2px;
}
.sheet-row .badge { grid-column: 1 / -1; margin-left: 0; justify-self: start; }
.sheet-row textarea {
  min-height: 44px;
  overflow: hidden;
  resize: none;
  font-size: 14.5px;
  line-height: 1.45;
  background: #fff;
}
.row-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  padding: 10px 4px;
}
.row-remove:hover { color: var(--accent-dark); }
.part .sheet-row textarea { border-color: rgba(95, 148, 255, 0.3); }
.part .secondary-btn { margin-top: 4px; padding: 8px 14px; font-size: 14px; }

@media (max-width: 560px) {
  .container { padding: 24px 12px 32px; }
  .panel { padding: 20px; }
  h1 { font-size: 23px; }
  h2 { font-size: 20px; }
}
