/**
 * Premium WYSIWYG: условие и текстовое решение на /task{N}/{slug}/.
 * Семантика task1 (task1-statement__*, task1-solution__*) сохранена для задания 1.
 */

/* --- Карточка условия --- */
.task-wysiwyg--premium.task-9-statement,
.task-wysiwyg--premium.task-statement,
body.libreoffice-page-task1 .task1-statement--premium.task-9-statement {
  position: relative;
  margin: 0;
  padding: 1.1rem 1.3rem 1.15rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(
    165deg,
    rgba(22, 28, 38, 0.97) 0%,
    rgba(14, 18, 26, 0.94) 100%
  );
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.06) inset;
  backdrop-filter: blur(10px);
  font-size: 0.95rem;
  line-height: 1.55;
}

.task-wysiwyg--premium.task-9-statement::before,
.task-wysiwyg--premium.task-statement::before,
body.libreoffice-page-task1 .task1-statement--premium.task-9-statement::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.85rem;
  bottom: 0.85rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #34d399 0%, #059669 100%);
  opacity: 0.9;
}

[data-theme="light"] .task-wysiwyg--premium.task-9-statement,
[data-theme="light"] .task-wysiwyg--premium.task-statement,
[data-theme="light"] body.libreoffice-page-task1 .task1-statement--premium.task-9-statement {
  border-color: rgba(15, 23, 42, 0.08);
  background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
  box-shadow:
    0 8px 24px rgba(15, 23, 42, 0.07),
    0 1px 0 rgba(255, 255, 255, 0.95) inset;
}

/* --- Карточка решения --- */
.task-wysiwyg-solution--premium.task-9-statement,
.task-wysiwyg-solution--premium.task-statement,
body.libreoffice-page-task1 .task1-solution--premium.task-9-statement {
  position: relative;
  margin: 0;
  padding: 1rem 1.2rem 1.05rem;
  border-radius: 12px;
  border: 1px solid rgba(52, 211, 153, 0.18);
  background: linear-gradient(
    165deg,
    rgba(16, 24, 32, 0.96) 0%,
    rgba(10, 16, 24, 0.92) 100%
  );
  box-shadow:
    0 6px 22px rgba(0, 0, 0, 0.22),
    0 1px 0 rgba(255, 255, 255, 0.05) inset;
  backdrop-filter: blur(8px);
  font-size: 0.94rem;
  line-height: 1.55;
}

.task-wysiwyg-solution--premium.task-9-statement::before,
.task-wysiwyg-solution--premium.task-statement::before,
body.libreoffice-page-task1 .task1-solution--premium.task-9-statement::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75rem;
  bottom: 0.75rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #6ee7b7 0%, #10b981 100%);
  opacity: 0.85;
}

[data-theme="light"] .task-wysiwyg-solution--premium.task-9-statement,
[data-theme="light"] .task-wysiwyg-solution--premium.task-statement,
[data-theme="light"] body.libreoffice-page-task1 .task1-solution--premium.task-9-statement {
  border-color: rgba(5, 150, 105, 0.15);
  background: linear-gradient(165deg, #f0fdf4 0%, #ecfdf5 100%);
  box-shadow:
    0 6px 20px rgba(15, 23, 42, 0.06),
    0 1px 0 rgba(255, 255, 255, 0.95) inset;
}

/* --- Общая типографика --- */
.task-wysiwyg--premium p,
.task-wysiwyg-solution--premium p,
.task-wysiwyg--premium .task-wysiwyg__text,
.task-wysiwyg-solution--premium .task-wysiwyg__text {
  margin: 0 0 0.85rem;
}

.task-wysiwyg--premium p:last-child,
.task-wysiwyg-solution--premium p:last-child {
  margin-bottom: 0;
}

.task-wysiwyg--premium strong,
.task-wysiwyg-solution--premium strong,
.task-wysiwyg--premium b,
.task-wysiwyg-solution--premium b {
  font-weight: 700;
  color: #34d399;
}

.task-wysiwyg--premium .task2-statement__formula,
.task-wysiwyg--premium h2.task2-statement__formula {
  margin: 0 0 0.85rem;
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.45;
}

.task-wysiwyg--premium .task2-statement__formula strong,
.task-wysiwyg--premium h2.task2-statement__formula strong {
  font-weight: 700;
}

[data-theme="light"] .task-wysiwyg--premium strong,
[data-theme="light"] .task-wysiwyg-solution--premium strong,
[data-theme="light"] .task-wysiwyg--premium b,
[data-theme="light"] .task-wysiwyg-solution--premium b {
  color: #059669;
}

.task-wysiwyg--premium ul,
.task-wysiwyg-solution--premium ul,
.task-wysiwyg--premium ol,
.task-wysiwyg-solution--premium ol {
  margin: 0 0 0.85rem;
  padding-left: 1.15rem;
}

.task-wysiwyg--premium li + li,
.task-wysiwyg-solution--premium li + li {
  margin-top: 0.35rem;
}

.task-wysiwyg--premium .task-wysiwyg__figure,
.task-wysiwyg--premium .task1-statement__figure,
.task-wysiwyg-solution--premium .task-wysiwyg__figure {
  margin: 0 0 0.85rem;
  padding: 0.5rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

[data-theme="light"] .task-wysiwyg--premium .task-wysiwyg__figure,
[data-theme="light"] .task-wysiwyg--premium .task1-statement__figure,
[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__figure {
  background: rgba(15, 23, 42, 0.03);
  border-color: rgba(15, 23, 42, 0.08);
}

.task-wysiwyg--premium .task-wysiwyg__image,
.task-wysiwyg--premium .task1-statement__image,
.task-wysiwyg-solution--premium .task-wysiwyg__image,
.task-wysiwyg--premium img,
.task-wysiwyg-solution--premium img {
  display: block;
  max-width: min(100%, 520px);
  max-height: 220px;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
  border-radius: 8px;
}

.task-wysiwyg--premium .task-wysiwyg__image--schema {
  max-width: min(100%, 520px);
  max-height: 280px;
}

.task-wysiwyg-solution--premium .task-wysiwyg__intro,
.task-wysiwyg-solution--premium .task1-solution__intro {
  margin: 0 0 0.75rem;
  font-size: 0.98rem;
  font-weight: 500;
  color: rgba(226, 232, 240, 0.98);
}

[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__intro,
[data-theme="light"] .task-wysiwyg-solution--premium .task1-solution__intro {
  color: #1e293b;
}

.task-wysiwyg-solution--premium .task-wysiwyg__step,
.task-wysiwyg-solution--premium .task1-solution__step {
  margin: 0.65rem 0 0.45rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: rgba(203, 213, 225, 0.95);
}

[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__step,
[data-theme="light"] .task-wysiwyg-solution--premium .task1-solution__step {
  color: #475569;
}

.task-wysiwyg-solution--premium .task-wysiwyg__answer,
.task-wysiwyg-solution--premium .task1-solution__answer {
  margin: 0.75rem 0 0;
  font-weight: 600;
  color: #6ee7b7;
}

[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__answer,
[data-theme="light"] .task-wysiwyg-solution--premium .task1-solution__answer {
  color: #047857;
}

.task-wysiwyg-solution--premium .task-wysiwyg__table {
  width: 100%;
  margin: 0 0 0.85rem;
  border-collapse: collapse;
  font-size: 0.86rem;
  line-height: 1.35;
}

.task-wysiwyg-solution--premium .task-wysiwyg__table th,
.task-wysiwyg-solution--premium .task-wysiwyg__table td {
  padding: 0.35rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: left;
  vertical-align: top;
}

.task-wysiwyg-solution--premium .task-wysiwyg__table th,
.task-wysiwyg-solution--premium .task-wysiwyg__table thead th,
.task-wysiwyg-solution--premium .task-wysiwyg__table tbody > tr:first-child > th {
  background: rgba(52, 211, 153, 0.12);
  color: rgba(226, 232, 240, 0.98);
  font-weight: 600;
}

.task-wysiwyg-solution--premium .task-wysiwyg__table td {
  background: rgba(15, 23, 42, 0.32);
  color: rgba(226, 232, 240, 0.95);
}

[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__table th,
[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__table td {
  border-color: rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__table th,
[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__table thead th,
[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__table tbody > tr:first-child > th {
  background: rgba(5, 150, 105, 0.1);
  color: #1e293b;
}

[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__table td {
  background: rgba(255, 255, 255, 0.88);
  color: #1e293b;
}

.task-wysiwyg--premium .task-wysiwyg__table {
  width: 100%;
  margin: 0.65rem 0 0.85rem;
  border-collapse: collapse;
  font-size: 0.88rem;
  line-height: 1.35;
}

/* Таблица примера ввода-вывода (ОГЭ task16, Stepik и т.п.) */
.task-wysiwyg--premium .task-wysiwyg__table--io-example {
  width: auto;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* ОГЭ task 2: таблица буква → код (Morse, двоичные, *@~) */
.task-wysiwyg--premium .task-wysiwyg__table--cipher-codes {
  width: auto;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.task-wysiwyg--premium.task-9-statement .task-wysiwyg__table th,
.task-wysiwyg--premium.task-9-statement .task-wysiwyg__table td,
.task-wysiwyg--premium .task-wysiwyg__table th,
.task-wysiwyg--premium .task-wysiwyg__table td {
  padding: 0.35rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
  vertical-align: middle;
}

.task-wysiwyg--premium.task-9-statement .task-wysiwyg__table th,
.task-wysiwyg--premium .task-wysiwyg__table th,
.task-wysiwyg--premium .task-wysiwyg__table thead th,
.task-wysiwyg--premium .task-wysiwyg__table tbody > tr:first-child > th {
  background: rgba(52, 211, 153, 0.12);
  color: rgba(226, 232, 240, 0.98);
  font-weight: 600;
}

.task-wysiwyg--premium.task-9-statement .task-wysiwyg__table td,
.task-wysiwyg--premium .task-wysiwyg__table td {
  background: rgba(15, 23, 42, 0.32);
  color: rgba(226, 232, 240, 0.95);
}

[data-theme="light"] .task-wysiwyg--premium.task-9-statement .task-wysiwyg__table th,
[data-theme="light"] .task-wysiwyg--premium.task-9-statement .task-wysiwyg__table td,
[data-theme="light"] .task-wysiwyg--premium .task-wysiwyg__table th,
[data-theme="light"] .task-wysiwyg--premium .task-wysiwyg__table td {
  border-color: rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .task-wysiwyg--premium.task-9-statement .task-wysiwyg__table th,
[data-theme="light"] .task-wysiwyg--premium .task-wysiwyg__table th,
[data-theme="light"] .task-wysiwyg--premium .task-wysiwyg__table thead th,
[data-theme="light"] .task-wysiwyg--premium .task-wysiwyg__table tbody > tr:first-child > th {
  background: rgba(5, 150, 105, 0.1);
  color: #1e293b;
}

[data-theme="light"] .task-wysiwyg--premium.task-9-statement .task-wysiwyg__table td,
[data-theme="light"] .task-wysiwyg--premium .task-wysiwyg__table td {
  background: rgba(255, 255, 255, 0.88);
  color: #1e293b;
}

/* --- Python в решении (подсветка как Pyodide / CodeMirror) --- */
.task-solution-html-wrap__inner.task-wysiwyg-solution--premium h2,
.task-solution-html-wrap__inner.task-wysiwyg-solution--premium h3 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
}

.task-solution-html-wrap__inner.task-wysiwyg-solution--premium h2 + p,
.task-solution-html-wrap__inner.task-wysiwyg-solution--premium h3 + p {
  margin-top: 0;
}

.task-solution-html-wrap__inner.task-wysiwyg-solution--premium hr {
  margin: 1rem 0;
  border: 0;
  border-top: 1px solid rgba(52, 211, 153, 0.22);
}

.task-wysiwyg-solution--premium .task-wysiwyg__pre,
.task-wysiwyg-solution--premium pre.task-wysiwyg__pre,
.task-wysiwyg-solution--premium pre {
  margin: 0.65rem 0 0.95rem;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(52, 211, 153, 0.28);
  background: linear-gradient(165deg, #2f3438 0%, #25282c 100%);
  overflow: hidden;
  max-width: 100%;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 22px rgba(0, 0, 0, 0.22);
}

.task-wysiwyg-solution--premium .task-wysiwyg__pre--highlighted {
  border-color: rgba(52, 211, 153, 0.35);
}

.task-wysiwyg-solution--premium .task-wysiwyg__code,
.task-wysiwyg-solution--premium pre code {
  display: block;
  margin: 0;
  padding: 0.9rem 1rem;
  border: 0;
  background: transparent;
  color: #a9b7c6;
  font-family: Consolas, Menlo, Monaco, "Liberation Mono", "Courier New", monospace;
  font-size: 0.84rem;
  line-height: 1.5;
  white-space: pre;
  tab-size: 4;
  overflow-x: auto;
}

.task-wysiwyg-solution--premium .task-wysiwyg__code--python .cm-keyword,
.task-wysiwyg-solution--premium .task-wysiwyg__code--python .cm-builtin {
  color: #34d399;
  font-weight: 600;
}

.task-wysiwyg-solution--premium .task-wysiwyg__code--python .cm-def {
  color: #fcd34d;
  font-weight: 600;
}

.task-wysiwyg-solution--premium .task-wysiwyg__code--python .cm-variable,
.task-wysiwyg-solution--premium .task-wysiwyg__code--python .cm-variable-2 {
  color: #7dd3fc;
}

.task-wysiwyg-solution--premium .task-wysiwyg__code--python .cm-string {
  color: #86efac;
}

.task-wysiwyg-solution--premium .task-wysiwyg__code--python .cm-number {
  color: #93c5fd;
  font-weight: 500;
}

.task-wysiwyg-solution--premium .task-wysiwyg__code--python .cm-operator {
  color: #cbd5e1;
}

.task-wysiwyg-solution--premium .task-wysiwyg__code--python .cm-comment {
  color: #6ee7b7;
  font-style: italic;
  opacity: 0.82;
}

.task-wysiwyg-solution--premium p code,
.task-wysiwyg-solution--premium :not(pre) > code {
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
  background: rgba(52, 211, 153, 0.12);
  color: #6ee7b7;
  font-family: Consolas, Menlo, Monaco, "Liberation Mono", "Courier New", monospace;
  font-size: 0.88em;
}

[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__pre,
[data-theme="light"] .task-wysiwyg-solution--premium pre.task-wysiwyg__pre,
[data-theme="light"] .task-wysiwyg-solution--premium pre {
  border-color: rgba(5, 150, 105, 0.22);
  background: linear-gradient(165deg, #f8fafc 0%, #eef2f7 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 6px 18px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__code,
[data-theme="light"] .task-wysiwyg-solution--premium pre code {
  color: #334155;
}

[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__code--python .cm-keyword,
[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__code--python .cm-builtin {
  color: #059669;
}

[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__code--python .cm-def {
  color: #b45309;
}

[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__code--python .cm-variable,
[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__code--python .cm-variable-2 {
  color: #0369a1;
}

[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__code--python .cm-string {
  color: #15803d;
}

[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__code--python .cm-number {
  color: #1d4ed8;
}

[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__code--python .cm-operator {
  color: #475569;
}

[data-theme="light"] .task-wysiwyg-solution--premium .task-wysiwyg__code--python .cm-comment {
  color: #047857;
}

[data-theme="light"] .task-wysiwyg-solution--premium p code,
[data-theme="light"] .task-wysiwyg-solution--premium :not(pre) > code {
  background: rgba(5, 150, 105, 0.1);
  color: #047857;
}

/* Перекрыть базовый .task-9-statement для блока решения */
.task-solution-html-wrap__inner.task-wysiwyg-solution--premium.task-9-statement {
  border-radius: 12px;
}

/* Premium section titles: «Задание N», «Схема дорог», … */
.task-premium-section-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 0.75rem;
  padding: 0.38rem 0.9rem 0.42rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 1.2;
  color: rgba(226, 232, 240, 0.98);
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, 0.38);
  background: linear-gradient(
    165deg,
    rgba(22, 28, 38, 0.97) 0%,
    rgba(14, 18, 26, 0.94) 100%
  );
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.24),
    0 0 0 1px rgba(52, 211, 153, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

[data-theme="light"] .task-premium-section-title {
  color: #0f172a;
  border-color: rgba(5, 150, 105, 0.28);
  background: linear-gradient(165deg, #ffffff 0%, #f0fdf4 100%);
  box-shadow:
    0 4px 14px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.variant-exam__task-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 0.35rem;
}

.variant-exam__task-header .task-premium-section-title {
  margin-bottom: 0;
}

.variant-exam__panel-title.task-premium-section-title {
  font-size: 0.8125rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin: 0;
}

.task1-card__title.task-premium-section-title {
  display: flex;
  width: 100%;
  margin: 0 0 0.45rem;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-align: center;
}

.task1-card--diagram .task1-card__title.task-premium-section-title {
  text-align: center;
}

