/* Задание с кодом (js/code.js). Цвета — переменные темы из style.css. Телефон — первый экран (360 точек). */
.cw { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cw .wg-q { margin: 2px 0 0; }
.cw-text { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.42; }

/* редактор: номера строк + поле; строки не переносятся, длинные прокручиваются вбок */
.cw-ed {
  display: flex; min-width: 0;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--inset); overflow: hidden;
}
.cw-ed:focus-within { border-color: var(--on); }
.cw-gut, .cw-ta {
  font: 14px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  margin: 0; padding: 10px 0;
}
.cw-gut {
  flex: none; width: 2.2em; padding-right: 5px; text-align: right;
  color: var(--muted); opacity: .7; overflow: hidden; user-select: none; -webkit-user-select: none;
  border-right: 1px solid var(--line);
}
.cw-gut b { color: var(--bad-text); opacity: 1; font-weight: 800; }
.cw-ta {
  flex: 1 1 auto; min-width: 0; min-height: 120px;
  padding-left: 6px; padding-right: 6px;
  border: 0; outline: 0; resize: none; background: transparent; color: var(--text);
  white-space: pre; overflow-x: auto; overflow-y: hidden; tab-size: 2;
  -webkit-user-select: text; user-select: text;
}
@supports (-webkit-touch-callout: none) {
  /* iPhone приближает страницу, если шрифт поля меньше 16 точек */
  .cw-gut, .cw-ta { font-size: 16px; }
}

/* строка частых знаков и слов: листается вбок, кнопки не меньше 44 точек */
.cw-keys { display: flex; flex-direction: column; gap: 6px; }
.cw-row {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.cw-k {
  flex: none; min-width: 44px; height: 44px; padding: 0 10px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font: 600 16px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; cursor: pointer;
}
.cw-k:active { background: var(--on-soft); border-color: var(--on); }
.cw-w { color: var(--on-text); font-size: 15px; }

.cw-bar { display: flex; gap: 10px; }
.cw-bar .btn { margin: 0; }
.cw-bar .cw-run { flex: 2 1 0; }
.cw-bar .cw-reset { flex: 1 1 0; }

.cw-load { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.cw-prog { width: 100%; height: 8px; accent-color: var(--on); }

.cw-res .why { min-height: 0; margin: 4px 0 0; }
.cw-go {
  margin-top: 8px; min-height: 44px; padding: 0 14px; border-radius: 10px;
  border: 1.5px solid var(--bad); background: transparent; color: var(--bad-text); font-weight: 700; cursor: pointer;
}
.cw-more, .cw-notes, .cw-tests { margin: 8px 0 0; padding-left: 20px; font-size: 14.5px; line-height: 1.45; }
.cw-notes { color: var(--muted); }
.cw-tests { list-style: none; padding-left: 0; }
.cw-tests li.yes { color: var(--ok); }
.cw-tests li.no { color: var(--bad-text); font-weight: 700; }
.cw-meta { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); }
.cw-raw { margin-top: 8px; font-size: 13px; color: var(--muted); }
.cw-raw summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.cw-raw pre {
  margin: 6px 0 0; padding: 8px; border-radius: 8px; background: var(--inset);
  white-space: pre-wrap; word-break: break-word; font: 12.5px/1.4 ui-monospace, Menlo, Consolas, monospace;
  max-height: 220px; overflow: auto; -webkit-user-select: text; user-select: text;
}

/* таблица по тактам / сочетаниям: первый столбец закреплён, прокрутка вбок */
.cw-tw { margin-top: 10px; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.cw-t { border-collapse: collapse; font: 14px/1.3 ui-monospace, Menlo, Consolas, monospace; min-width: 100%; }
.cw-t th, .cw-t td { padding: 6px 8px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cw-t th { color: var(--muted); font-weight: 700; background: var(--panel); position: sticky; top: 0; }
.cw-t th:first-child, .cw-t td:first-child { position: sticky; left: 0; background: var(--panel); }
.cw-t th.o { color: var(--on-text); }
.cw-t td.yes { color: var(--ok); }
.cw-t td.no { color: var(--bad-text); background: var(--panel-bad); font-weight: 800; }
.cw-t td.no small { display: block; font-weight: 600; font-size: 11.5px; }
.cw-t tr:last-child td { border-bottom: 0; }

/* схема из кода (DigitalJS) — светлый фон, своя прокрутка */
.cw-schema-row .btn { margin: 0; }
.cw-paper-wrap { overflow: auto; background: #fff; border-radius: 10px; border: 1px solid var(--line); max-height: 60vh; }
.cw-io { margin-top: 8px; padding: 6px; border-radius: 10px; background: #fff; color: #15181d; overflow-x: auto; }
