/* =====================================================================
 *  shared/code-trainer — виджет тренажёра кода
 * =====================================================================
 *  Тёмное полотно редактора (в тон CodeMirror material-darker), светлая
 *  панель языков сверху, вывод песочницы снизу. Модуль самодостаточен:
 *  не наследует токены страницы, чтобы одинаково выглядеть и на главной,
 *  и внутри ЛК.
 * ===================================================================== */
.ctw {
  display: flex; flex-direction: column;
  border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(15,23,42,0.10);
  background: #0f172a;
  font-family: "Montserrat", Arial, sans-serif;
}

/* ── панель: языки + «Запустить» ── */
.ctw-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: #fff;
  border-bottom: 1px solid rgba(15,23,42,0.08);
}
.ctw-tabs {
  display: flex; gap: 4px; flex: 1; min-width: 0;
  overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
  touch-action: pan-x;
}
.ctw-tabs::-webkit-scrollbar { display: none; }
.ctw-tab {
  flex: none; height: 30px; padding: 0 12px;
  border-radius: 8px; border: 1px solid transparent; background: transparent;
  font: inherit; font-size: 13px; font-weight: 600; color: #475569;
  cursor: pointer; white-space: nowrap; transition: background 0.13s, color 0.13s;
}
.ctw-tab:hover { background: rgba(15,23,42,0.05); }
.ctw-tab.is-active { background: rgba(37,99,235,0.10); color: #2563eb; }
.ctw-run {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 16px; border: 0; border-radius: 9px;
  background: #2563eb; color: #fff; font: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: filter 0.14s, transform 0.12s;
}
.ctw-run:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-1px); }
.ctw-run:disabled { opacity: 0.6; cursor: default; }
.ctw-run svg { width: 13px; height: 13px; }

/* ── редактор ── */
.ctw-editor { background: #263238; }
.ctw-editor .CodeMirror {
  height: auto; min-height: 220px; max-height: 46vh;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13.5px; line-height: 1.55;
}
.ctw-textarea {
  display: block; width: 100%; min-height: 220px; padding: 12px 14px;
  border: 0; resize: vertical; outline: none;
  background: #263238; color: #eeffff;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13.5px; line-height: 1.55;
}

/* ── вывод песочницы ── */
.ctw-out { background: #0f172a; border-top: 1px solid rgba(255,255,255,0.08); }
.ctw-out-head {
  padding: 8px 14px 4px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase;
  color: #64748b;
}
.ctw-out-pre {
  margin: 0; padding: 0 14px 14px;
  max-height: 200px; overflow: auto;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.55; color: #e2e8f0;
  white-space: pre-wrap; word-break: break-word;
}
.ctw-out-pre.is-error { color: #fca5a5; }
