/* Задание 1: левая колонка — SVG-граф (бланк ЕГЭ) + матрица. */

.task1-card {
  background: var(--task-solve-panel-bg, rgba(30, 41, 59, 0.55));
  border: 1px solid var(--task-solve-border, rgba(148, 163, 184, 0.25));
  border-radius: 0.5rem;
  padding: 0.65rem 0.75rem;
  flex-shrink: 0;
}

.task1-card__title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
}

.task1-card--diagram .task1-card__title {
  text-align: center;
}

body.libreoffice-page-task1,
body.variant-exam-body.libreoffice-page-task1 {
  --task1-graph-edge-stroke: rgba(110, 231, 183, 0.78);
  --task1-graph-edge-arrow-fill: rgba(110, 231, 183, 0.88);
  --task1-graph-edge-diamond-stroke: rgba(52, 211, 153, 0.9);
  --task1-graph-edge-label-fill: rgba(167, 243, 208, 0.96);
  --task1-graph-value-outline: #064e3b;
  --task1-graph-dot-stroke: rgba(110, 231, 183, 0.72);
  --task1-graph-letter-fill: #fef08a;
  --task1-graph-letter-fill-inside: #fffbeb;
}

[data-theme="light"] body.libreoffice-page-task1,
[data-theme="light"] body.variant-exam-body.libreoffice-page-task1 {
  --task1-graph-edge-stroke: #047857;
  --task1-graph-edge-arrow-fill: #047857;
  --task1-graph-edge-diamond-stroke: #059669;
  --task1-graph-edge-label-fill: #064e3b;
  --task1-graph-value-outline: #065f46;
  --task1-graph-dot-stroke: #059669;
  --task1-graph-letter-fill: #b45309;
  --task1-graph-letter-fill-inside: #78350f;
}

body.libreoffice-page-task1[data-neuroege-hf-variant-selected="1"]:not(.task-mobile-mode) .task1-brief-trainer-question,
body.libreoffice-page-task1[data-neuroege-hf-variant-selected="1"]:not(.task-mobile-mode) .ege-task1-brief-trainer-question {
  display: block !important;
  z-index: 11;
}

body.libreoffice-page-task1 .task1-brief-trainer-question {
  position: absolute;
  top: 0.45rem;
  right: 0.5rem;
  z-index: 7;
  display: block;
  flex: 0 0 auto;
  width: auto;
  max-width: min(58%, 22rem);
  box-sizing: border-box;
  margin: 0;
  padding: 0.5rem 0.78rem 0.54rem;
  text-align: right;
  pointer-events: none;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.38;
  letter-spacing: 0.02em;
  color: rgba(236, 253, 245, 0.98);
  border-radius: 0.7rem;
  border: 1px solid rgba(52, 211, 153, 0.48);
  background: linear-gradient(
    165deg,
    rgba(16, 185, 129, 0.22) 0%,
    rgba(6, 95, 70, 0.32) 42%,
    rgba(15, 23, 42, 0.78) 100%
  );
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.26),
    0 0 0 1px rgba(52, 211, 153, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  text-shadow: 0 1px 14px rgba(16, 185, 129, 0.28);
}

[data-theme="light"] body.libreoffice-page-task1 .task1-brief-trainer-question {
  color: #064e3b;
  border-color: rgba(5, 150, 105, 0.38);
  background: linear-gradient(165deg, #ecfdf5 0%, #bbf7d0 42%, #f0fdf4 100%);
  box-shadow:
    0 8px 22px rgba(5, 150, 105, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  text-shadow: none;
}

.task1-card.task1-card--diagram {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.libreoffice-page-task1:not(.libreoffice-page-task4):not([data-neuroege-hf-variant-selected="1"]) .task1-card.task1-card--diagram {
  overflow: visible;
}

.task1-card.task1-card--diagram .task1-diagram-layout {
  flex: 1 1 auto;
  min-height: 0;
}

.task1-diagram-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.task1-diagram-layout__canvas {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 110px;
  display: flex;
  flex-direction: column;
}

.task1-diagram-layout__canvas .task1-graph-wrap {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 110px;
}

.task1-diagram-controls--bottom-left {
  position: absolute;
  left: 0.5rem;
  bottom: 0.45rem;
  z-index: 6;
  width: min(20%, 17rem);
  min-width: 8.5rem;
  max-width: calc(100% - 6.5rem);
  height: auto;
  max-height: calc(100% - 0.9rem);
  display: block;
  pointer-events: none;
}

/* Пошаговое решение / текст подсказки: широкая панель, читаемый шрифт */
.task1-diagram-controls--bottom-left.task1-diagram-controls--hint-message {
  width: min(48%, 40rem);
  min-width: 20rem;
}

/* Во время анимации «Запуск» — уже на 30% */
body.libreoffice-page-task1.task1-solution-animating
  .task1-diagram-controls--bottom-left.task1-diagram-controls--hint-message {
  width: min(33.6%, 28rem);
  min-width: 14rem;
}

.task1-diagram-controls--bottom-left.task1-diagram-controls--hint-message
  .task1-graph-guide--premium.task1-diagram-controls__panel {
  padding: 0.55rem 0.7rem;
}

.task1-diagram-controls--bottom-left.task1-diagram-controls--hint-message
  .task1-graph-guide__message {
  font-size: 1.02rem;
  line-height: 1.42;
  font-weight: 500;
}

.task1-diagram-controls--bottom-left.task1-diagram-controls--hint-message
  .task1-graph-guide__eyebrow {
  font-size: 0.72rem;
  margin-bottom: 0.25rem;
}

.task1-diagram-controls--bottom-left .task1-diagram-controls__panel {
  pointer-events: none;
}

.task1-diagram-controls--bottom-left .task1-graph-guide-reopen,
.task1-diagram-controls--bottom-left .task1-diagram-controls__panel button {
  pointer-events: auto;
}

body.libreoffice-page-task1 .task1-graph-guide__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  margin: 0 0 0.05rem;
}

body.libreoffice-page-task1 .task1-graph-guide__header .task1-graph-guide__eyebrow {
  margin: 0;
  padding: 0.05rem 0;
}

body.libreoffice-page-task1 .task1-graph-guide__close,
body.libreoffice-page-task1 .task1-graph-guide-reopen {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  min-height: 1.15rem;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.55);
  color: #e2e8f0;
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
}

body.libreoffice-page-task1 .task1-graph-guide__close:hover,
body.libreoffice-page-task1 .task1-graph-guide-reopen:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(148, 163, 184, 0.7);
}

body.libreoffice-page-task1
  .task1-diagram-controls:not(.task1-diagram-controls--dismissed)
  .task1-graph-guide-reopen,
body.libreoffice-page-task1 .task1-graph-guide-reopen[hidden] {
  display: none !important;
}

body.libreoffice-page-task1 .task1-diagram-controls--dismissed .task1-diagram-controls__panel {
  display: none;
}

body.libreoffice-page-task1 .task1-diagram-controls--dismissed .task1-graph-guide-reopen {
  display: inline-flex;
  position: absolute;
  left: 0.35rem;
  bottom: 0.3rem;
  z-index: 3;
  font-weight: 700;
  min-width: 1.45rem;
  min-height: 1.45rem;
  font-size: 0.85rem;
}

[data-theme="light"] body.libreoffice-page-task1 .task1-graph-guide__close,
[data-theme="light"] body.libreoffice-page-task1 .task1-graph-guide-reopen {
  background: rgba(255, 255, 255, 0.92);
  color: #334155;
  border-color: rgba(148, 163, 184, 0.65);
}

.task1-diagram-controls__panel {
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  max-height: inherit;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.task1-diagram-controls__section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-shrink: 0;
}

.task1-diagram-controls__section-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.9);
  line-height: 1.2;
}

[data-theme="light"] .task1-diagram-controls__section-label {
  color: #64748b;
}

.task1-diagram-controls__btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.task1-diagram-controls__btn-group .task1-diagram-chrome__btn {
  width: 100%;
}

body.libreoffice-page-task1.task-mobile-mode .task1-diagram-layout__canvas:has(.task1-brief-trainer-question:not([hidden]))
  .task1-diagram-chrome--float {
  top: 3.35rem;
  right: 0.5rem;
  left: auto;
  justify-content: flex-end;
}

body.libreoffice-page-task1:not(.task-mobile-mode) .task1-diagram-layout__canvas:has(.task1-brief-trainer-question:not([hidden]))
  .task1-diagram-chrome--float {
  top: 4.5rem;
  right: 0.5rem;
  left: auto;
  justify-content: flex-end;
}

body.libreoffice-page-task1[data-neuroege-hf-variant-selected="1"]:not(.task-mobile-mode) #task1-diagram-chrome.task1-diagram-chrome--float {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 12;
}

body.libreoffice-page-task1[data-neuroege-hf-variant-selected="1"]:not(.task-mobile-mode) .task1-diagram-slot,
body.libreoffice-page-task1[data-neuroege-hf-variant-selected="1"]:not(.task-mobile-mode) #task1-diagram-card,
body.libreoffice-page-task1[data-neuroege-hf-variant-selected="1"]:not(.task-mobile-mode) .task1-diagram-layout__canvas {
  overflow: hidden !important;
}

body.libreoffice-page-task1[data-neuroege-hf-variant-selected="1"]:not(.task-mobile-mode) #task1-graph-wrap.task1-graph-wrap {
  overflow: hidden;
  flex: 1 1 0;
  min-height: 0;
  transform-origin: center center;
}

body.libreoffice-page-task1[data-neuroege-hf-variant-selected="1"]:not(.task-mobile-mode)
  #task1-graph-wrap.task1-graph-wrap
  .task1-graph-host {
  width: 100%;
  max-width: 100%;
  height: 100%;
}

body.libreoffice-page-task1[data-neuroege-hf-variant-selected="1"]:not(.task-mobile-mode)
  #task1-graph-wrap.task1-graph-wrap
  .task1-graph-svg {
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
}

body.libreoffice-page-task1:not(.task-mobile-mode) .task1-diagram-chrome--float {
  top: 3.25rem;
}

.task1-diagram-chrome--float {
  position: absolute;
  top: 2.75rem;
  right: 0.5rem;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: calc(100% - 0.5rem);
  pointer-events: none;
}

.task1-diagram-chrome--bottom-right {
  position: absolute;
  bottom: 0.45rem;
  right: 0.5rem;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
}

.task1-diagram-chrome--float .task1-diagram-chrome__group,
.task1-diagram-chrome--bottom-right .task1-diagram-chrome__group {
  pointer-events: none;
}

.task1-diagram-chrome--float .task1-diagram-chrome__btn,
.task1-diagram-chrome--bottom-right .task1-diagram-chrome__btn {
  pointer-events: auto;
}

.task1-diagram-chrome--float .task1-diagram-chrome__group,
.task1-diagram-chrome--bottom-right .task1-diagram-chrome__group {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem;
  border-radius: 0.45rem;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.28);
  backdrop-filter: blur(6px);
}

[data-theme="light"] .task1-diagram-chrome--float .task1-diagram-chrome__group,
[data-theme="light"] .task1-diagram-chrome--bottom-right .task1-diagram-chrome__group {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(148, 163, 184, 0.45);
}

.task1-diagram-chrome__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.85rem;
  width: auto;
  height: 1.85rem;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 0.35rem;
  background: rgba(30, 41, 59, 0.85);
  color: #e2e8f0;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

[data-theme="light"] .task1-diagram-chrome__btn {
  background: #f8fafc;
  color: #0f172a;
  border-color: rgba(148, 163, 184, 0.55);
}

.task1-diagram-chrome__btn:hover:not(:disabled) {
  background: rgba(51, 65, 85, 0.95);
  border-color: rgba(148, 163, 184, 0.55);
}

.task1-diagram-chrome__btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.task1-diagram-chrome__btn--reset {
  border-color: rgba(251, 191, 36, 0.45);
  color: #fcd34d;
}

.task1-diagram-chrome__btn--reset:hover:not(:disabled) {
  border-color: #fbbf24;
  background: rgba(120, 53, 15, 0.35);
}

[data-theme="light"] .task1-diagram-chrome__btn--reset {
  color: #b45309;
  border-color: rgba(217, 119, 6, 0.45);
}

[data-theme="light"] .task1-diagram-chrome__btn--reset:hover:not(:disabled) {
  background: rgba(254, 243, 199, 0.95);
}

.task1-diagram-chrome__btn--fullscreen {
  min-width: 1.85rem;
  padding: 0;
}

.task1-diagram-chrome__win-icon {
  display: block;
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.task1-diagram-chrome__btn--fullscreen .task1-diagram-chrome__win-icon--restore {
  display: none;
}

.task1-diagram-chrome__btn--fullscreen .task1-diagram-chrome__win-icon--maximize {
  display: block;
}

.task1-diagram-chrome__btn--fullscreen[aria-pressed="true"] .task1-diagram-chrome__win-icon--maximize {
  display: none;
}

.task1-diagram-chrome__btn--fullscreen[aria-pressed="true"] .task1-diagram-chrome__win-icon--restore {
  display: block;
}

.task1-diagram-chrome__btn--new-scheme {
  min-width: 1.85rem;
  padding: 0;
  border-color: rgba(56, 189, 248, 0.5);
  color: #7dd3fc;
}

.task1-diagram-chrome__btn--new-scheme:hover:not(:disabled) {
  border-color: #38bdf8;
  background: rgba(12, 74, 110, 0.4);
  color: #bae6fd;
}

[data-theme="light"] .task1-diagram-chrome__btn--new-scheme {
  color: #0369a1;
  border-color: rgba(14, 165, 233, 0.45);
}

[data-theme="light"] .task1-diagram-chrome__btn--new-scheme:hover:not(:disabled) {
  background: rgba(224, 242, 254, 0.95);
  color: #0284c7;
}

.task1-diagram-chrome__scheme-icon {
  display: block;
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.task1-diagram-chrome__btn--play {
  min-width: 2rem;
  padding: 0;
  border-color: rgba(16, 185, 129, 0.55);
}

.task1-diagram-chrome__btn--play:hover:not(:disabled) {
  border-color: #10b981;
  background: rgba(6, 78, 59, 0.35);
}

.task1-diagram-chrome__btn--play.task1-diagram-chrome__btn--playing {
  border-color: rgba(248, 113, 113, 0.78);
  background: rgba(127, 29, 29, 0.42);
}

.task1-diagram-chrome__btn--play.task1-diagram-chrome__btn--playing:hover:not(:disabled) {
  border-color: #f87171;
  background: rgba(185, 28, 28, 0.52);
}

.task1-diagram-chrome__btn--play.task1-diagram-chrome__btn--playing .task1-diagram-chrome__play-icon {
  width: 11px;
  height: 11px;
  margin-left: 0;
  border: none;
  background: #ef4444;
  border-radius: 1px;
}

[data-theme="light"] .task1-diagram-chrome__btn--play.task1-diagram-chrome__btn--playing {
  border-color: rgba(220, 38, 38, 0.55);
  background: rgba(254, 226, 226, 0.95);
}

[data-theme="light"]
  .task1-diagram-chrome__btn--play.task1-diagram-chrome__btn--playing
  .task1-diagram-chrome__play-icon {
  background: #dc2626;
}

.task1-diagram-chrome__play-icon {
  display: block;
  width: 0;
  height: 0;
  margin-left: 0.15rem;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid #10b981;
}

.task1-diagram-chrome__btn--active .task1-diagram-chrome__play-icon {
  border-left-color: #34d399;
}

/* Панель управления: единый стиль кнопок и подсказок */
.task1-panel-actions {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

.task1-panel-actions[hidden] {
  display: none !important;
}

.task1-panel-hints {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

.task1-panel-btn,
.task1-panel-row {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
  margin: 0;
  text-align: left;
  font-family: inherit;
  line-height: 1.25;
}

.task1-panel-btn {
  padding: 0.34rem 0.42rem;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: linear-gradient(180deg, rgba(40, 48, 62, 0.98) 0%, rgba(28, 34, 44, 0.98) 100%);
  color: #e2e8f0;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.task1-panel-btn:hover:not(:disabled) {
  border-color: rgba(52, 211, 153, 0.45);
  background: linear-gradient(180deg, rgba(48, 62, 78, 0.98) 0%, rgba(32, 42, 56, 0.98) 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.32);
}

.task1-panel-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.task1-panel-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

[data-theme="light"] .task1-panel-btn {
  color: #0f172a;
  border-color: rgba(148, 163, 184, 0.55);
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .task1-panel-btn:hover:not(:disabled) {
  border-color: #6ee7b7;
  background: linear-gradient(180deg, #ffffff 0%, #ecfdf5 100%);
}

.task1-panel-row {
  padding: 0.3rem 0.38rem;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.35);
}

[data-theme="light"] .task1-panel-row {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(241, 245, 249, 0.85);
}

.task1-panel-btn__mark {
  flex: 0 0 1.5rem;
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  color: rgba(255, 255, 255, 0.95);
  background: linear-gradient(180deg, rgba(48, 54, 66, 0.98) 0%, rgba(32, 38, 48, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.task1-panel-btn__mark--accent {
  color: #ecfdf5;
  border-color: rgba(52, 211, 153, 0.45);
  background: linear-gradient(180deg, rgba(5, 184, 125, 0.35) 0%, rgba(4, 120, 82, 0.28) 100%);
}

[data-theme="light"] .task1-panel-btn__mark {
  color: #1e293b;
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  border-color: rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .task1-panel-btn__mark--accent {
  color: #047857;
  background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #6ee7b7;
}

.task1-panel-btn__text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  padding-top: 0.05rem;
}

.task1-panel-btn__label {
  font-size: 0.72rem;
  font-weight: 700;
  color: inherit;
}

.task1-panel-btn__detail {
  font-size: 0.62rem;
  font-weight: 500;
  color: rgba(148, 163, 184, 0.95);
  line-height: 1.3;
}

[data-theme="light"] .task1-panel-btn__detail {
  color: #64748b;
}

.task1-graph-guide--premium.task1-diagram-controls__panel {
  margin: 0;
  padding: 0.45rem 0.4rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(165deg, rgba(22, 28, 38, 0.96) 0%, rgba(14, 18, 26, 0.94) 100%);
  box-shadow:
    0 4px 18px rgba(0, 0, 0, 0.26),
    0 1px 0 rgba(255, 255, 255, 0.07) inset;
  backdrop-filter: blur(10px);
}

[data-theme="light"] .task1-graph-guide--premium.task1-diagram-controls__panel {
  border-color: rgba(0, 0, 0, 0.08);
  background: linear-gradient(165deg, #ffffff 0%, #f1f5f9 100%);
  box-shadow:
    0 4px 16px rgba(15, 23, 42, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.task1-graph-guide__panel {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.task1-graph-guide__eyebrow {
  display: block;
  align-self: center;
  margin: 0 0 0.1rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(167, 243, 208, 0.95);
  background: linear-gradient(180deg, rgba(5, 184, 125, 0.22) 0%, rgba(4, 120, 82, 0.18) 100%);
  border: 1px solid rgba(52, 211, 153, 0.35);
  flex-shrink: 0;
}

[data-theme="light"] .task1-graph-guide__eyebrow {
  color: #047857;
  background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #6ee7b7;
}

.task1-graph-guide__message {
  margin: 0;
  font-size: 0.62rem;
  line-height: 1.35;
  font-weight: 500;
  color: rgba(226, 232, 240, 0.92);
  flex-shrink: 0;
}

[data-theme="light"] .task1-graph-guide__message {
  color: #475569;
}

.task1-graph-guide__message[hidden],
.task1-graph-guide__panel[hidden] {
  display: none !important;
}

.task1-graph-wrap--editor .task1-graph-node--selected .task1-graph-dot {
  stroke: #38bdf8;
  stroke-width: 3;
}

.task1-graph-wrap--editor .task1-graph-node--edge-anchor .task1-graph-dot {
  stroke: #f472b6;
  stroke-width: 3.5;
  filter: drop-shadow(0 0 6px rgba(244, 114, 182, 0.55));
}

.task1-graph-wrap--edge-mode .task1-graph-host {
  cursor: crosshair;
}

.task1-diagram-chrome__btn--edge.task1-diagram-chrome__btn--active {
  border-color: rgba(244, 114, 182, 0.55);
  background: rgba(244, 114, 182, 0.18);
  color: #fbcfe8;
}

.task1-diagram-chrome__btn--delete.task1-diagram-chrome__btn--active {
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(248, 113, 113, 0.18);
  color: #fecaca;
}

[data-theme="light"] .task1-diagram-chrome__btn--edge.task1-diagram-chrome__btn--active {
  border-color: rgba(219, 39, 119, 0.35);
  background: rgba(251, 207, 232, 0.85);
  color: #9d174d;
}

[data-theme="light"] .task1-diagram-chrome__btn--delete.task1-diagram-chrome__btn--active {
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(254, 226, 226, 0.9);
  color: #b91c1c;
}

.task1-graph-wrap--delete-mode .task1-graph-host {
  cursor: not-allowed;
}

.task1-graph-wrap--delete-mode .task1-graph-dot,
.task1-graph-wrap--delete-mode .task1-graph-edge {
  cursor: pointer;
}

.task1-graph-digit-input {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: 0;
  padding: 0;
  margin: 0;
}

body.libreoffice-page-task1.task-mobile-mode .task1-graph-digit-input {
  left: 50%;
  top: auto;
  bottom: calc(var(--ege-task1-mobile-dock-pad, 3.85rem) + 0.25rem);
  width: 3.25rem;
  height: 2.75rem;
  transform: translateX(-50%);
  opacity: 0.02;
  font-size: 16px;
  line-height: 2.75rem;
  text-align: center;
  color: transparent;
  caret-color: transparent;
  background: transparent;
  z-index: 10050;
  pointer-events: auto;
}

.task1-graph-wrap--touch-targets .task1-graph-host,
.task1-graph-wrap--touch-targets .task1-graph-svg {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.task1-graph-dot-hit {
  fill: transparent;
  stroke: none;
  pointer-events: all;
  cursor: grab;
}

.task1-graph-editor--dragging .task1-graph-dot-hit {
  cursor: grabbing;
}

.task1-graph-wrap--touch-targets .task1-graph-svg line.task1-graph-edge {
  stroke-width: 9px;
  stroke-linecap: round;
}

.task1-graph-wrap--touch-targets .task1-graph-svg line.task1-graph-edge--selected {
  stroke-width: 11px;
}

.task1-panel-btn__mark--danger {
  color: #f87171;
}

.task1-graph-editor--dragging .task1-graph-dot {
  cursor: grabbing;
}

.task1-matrix__header-num {
  text-align: center;
  font-weight: 700;
  color: var(--text-muted, #94a3b8);
  background: rgba(15, 23, 42, 0.25);
  cursor: default;
}

.task1-matrix__header-point-map {
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  background: rgba(34, 197, 94, 0.12);
  letter-spacing: 0.02em;
}

[data-theme="light"] .task1-matrix__header-point-map {
  color: #0f172a;
  background: rgba(34, 197, 94, 0.14);
}

[data-theme="light"] .task1-matrix__header-num {
  background: rgba(241, 245, 249, 0.9);
  color: #475569;
}

.task1-matrix__dist-inp {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

.task1-graph-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
}

body.libreoffice-page-task1 .task1-graph-wrap--pan-active {
  cursor: grabbing;
  user-select: none;
}

body.libreoffice-page-task1 .task1-graph-wrap--pan-active .task1-graph-host,
body.libreoffice-page-task1 .task1-graph-wrap--pan-active .task1-graph-svg {
  cursor: grabbing;
}

.task1-card--diagram:not([style*="height"]) .task1-graph-wrap {
  min-height: clamp(234px, 37.8vw, 432px);
}

.task1-graph-host {
  position: relative;
  width: 100%;
  max-width: min(100%, 468px);
}

.task1-graph-letter-edit__input {
  position: absolute;
  z-index: 8;
  margin: 0;
  padding: 0 0.2rem;
  box-sizing: border-box;
  border: 2px solid rgba(52, 211, 153, 0.75);
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.96);
  color: #f8fafc;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  text-align: center;
  outline: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.task1-graph-letter-edit__input--error {
  border-color: #f87171;
  animation: task1-letter-edit-shake 0.35s ease;
}

@keyframes task1-letter-edit-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}

[data-theme="light"] .task1-graph-letter-edit__input {
  background: #ffffff;
  color: #0f172a;
  border-color: #059669;
}

[data-theme="light"] .task1-graph-letter-edit__input--error {
  border-color: #dc2626;
}

.task1-graph-svg {
  width: 100%;
  height: auto;
  display: block;
  color: #e2e8f0;
}

/* Legacy-сдвиг: на /ege-1/ viewBox подгоняется без translate (как на мобилке). */
.task1-graph-svg > .task1-graph-edges,
.task1-graph-svg > .task1-graph-nodes {
  transform: translate(120px, 30px);
}

body.libreoffice-page-task1:not(.libreoffice-page-task4) .task1-graph-svg > .task1-graph-edges,
body.libreoffice-page-task1:not(.libreoffice-page-task4) .task1-graph-svg > .task1-graph-nodes,
body.libreoffice-page-task1:not(.libreoffice-page-task4)
  .task1-solution-graph-svg
  > .task1-solution-edges,
body.libreoffice-page-task1:not(.libreoffice-page-task4)
  .task1-solution-graph-svg
  > .task1-solution-nodes,
body.variant-exam-body.libreoffice-page-task1:not(.libreoffice-page-task4)
  .task1-graph-svg
  > .task1-graph-edges,
body.variant-exam-body.libreoffice-page-task1:not(.libreoffice-page-task4)
  .task1-graph-svg
  > .task1-graph-nodes {
  transform: none;
}

[data-theme="light"] .task1-graph-svg {
  color: #0f172a;
}

.task1-graph-edge {
  stroke: var(--task1-graph-edge-stroke);
  stroke-width: 1.15;
  vector-effect: non-scaling-stroke;
}

/* ОГЭ схемы дорог (oge_directed_edges): тонкие рёбра и наконечники */
.task1-graph-svg--directed .task1-graph-edge {
  stroke-width: 0.85;
}

.task1-graph-edge-arrow {
  fill: var(--task1-graph-edge-arrow-fill);
}

.task1-graph-dot {
  fill: #334155;
  stroke: var(--task1-graph-dot-stroke, #94a3b8);
  stroke-width: 1.25;
  cursor: pointer;
  vector-effect: non-scaling-stroke;
}

.task1-graph-dot:hover {
  fill: #475569;
}

[data-theme="light"] .task1-graph-dot {
  fill: #ffffff;
  stroke: var(--task1-graph-dot-stroke, #059669);
}

[data-theme="light"] .task1-graph-dot:hover {
  fill: #f1f5f9;
}

.task1-graph-node--active .task1-graph-dot {
  stroke: #05b87d;
  stroke-width: 2.5;
}

[data-theme="light"] .task1-graph-node--active .task1-graph-dot {
  stroke: #059669;
}

/* Введённое число = числу рёбер из узла */
.task1-graph-node--degree-match .task1-graph-dot {
  fill: #05b87d;
  stroke: #047857;
}

.task1-graph-node--degree-match .task1-graph-dot:hover {
  fill: #06cf8f;
}

.task1-graph-node--active.task1-graph-node--degree-match .task1-graph-dot {
  stroke: #ecfdf5;
  stroke-width: 2.5;
}

[data-theme="light"] .task1-graph-node--degree-match .task1-graph-dot {
  fill: #10b981;
  stroke: #047857;
}

[data-theme="light"] .task1-graph-node--degree-match .task1-graph-dot:hover {
  fill: #34d399;
}

[data-theme="light"] .task1-graph-node--active.task1-graph-node--degree-match .task1-graph-dot {
  stroke: #ecfdf5;
}

.task1-graph-svg:focus,
.task1-graph-svg:focus-visible,
.task1-solution-graph-svg:focus,
.task1-solution-graph-svg:focus-visible {
  outline: none;
  box-shadow: none;
}

body.libreoffice-page-task1 .task1-graph-svg,
body.libreoffice-page-task1 .task1-solution-graph-svg,
body.variant-exam-body.libreoffice-page-task1 .task1-graph-svg,
body.variant-exam-body.libreoffice-page-task1 .task1-solution-graph-svg {
  border: none;
  outline: none;
  box-shadow: none;
}

.task1-graph-value {
  fill: #f1f5f9;
  font-size: 13px;
  font-weight: 700;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  pointer-events: none;
}

[data-theme="light"] .task1-graph-value {
  fill: #0f172a;
}

.task1-graph-wrap .task1-graph-letter {
  fill: var(--task1-graph-letter-fill, #fef08a);
  font-size: 20px;
  font-weight: 900;
  font-family: Georgia, "Times New Roman", Times, serif;
  pointer-events: none;
  paint-order: stroke fill;
  stroke: rgba(15, 23, 42, 0.42);
  stroke-width: 0.35px;
}

.task1-graph-wrap .task1-graph-letter--inside {
  fill: var(--task1-graph-letter-fill-inside, #fffbeb);
  font-size: 18px;
  font-weight: 900;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  stroke: rgba(15, 23, 42, 0.28);
  stroke-width: 0.3px;
}

.task1-graph-wrap--editor .task1-graph-letter[data-admin-drag] {
  pointer-events: auto;
  cursor: grab;
}

.task1-graph-wrap--editor .task1-graph-letter--inside {
  pointer-events: none;
  cursor: default;
}

.task1-graph-wrap--editor .task1-graph-edge.task1-graph-edge--selected {
  stroke: #f97316 !important;
  stroke-width: 5 !important;
  filter: drop-shadow(0 0 6px rgba(249, 115, 22, 0.55));
}

.task1-graph-wrap--editor .task1-graph-letter[data-admin-drag]:active {
  cursor: grabbing;
}

[data-theme="light"] .task1-graph-wrap .task1-graph-letter {
  fill: var(--task1-graph-letter-fill, #b45309);
  stroke: rgba(255, 255, 255, 0.65);
  stroke-width: 0.4px;
}

[data-theme="light"] .task1-graph-wrap .task1-graph-letter--inside {
  fill: var(--task1-graph-letter-fill-inside, #78350f);
  stroke: rgba(255, 255, 255, 0.5);
}

/* Граф решения (номера пунктов + расстояния на рёбрах) */
.task1-solution-wrap {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--task-solve-border, rgba(148, 163, 184, 0.35));
}

.task1-solution-wrap__title {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.task1-solution-wrap__hint {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  opacity: 0.85;
}

.task1-solution-graph-host {
  max-width: min(100%, 520px);
}

.task1-solution-graph-host .task1-solution-dot {
  fill: #ecfdf5;
  stroke: #047857;
}

[data-theme="light"] .task1-solution-graph-host .task1-solution-dot {
  fill: #ffffff;
  stroke: #475569;
}

.task1-solution-graph-svg .task1-graph-letter .task1-solution-point,
.task1-admin-diagram-editor__canvas .task1-solution-graph-svg .task1-graph-letter .task1-solution-point {
  fill: #2563eb;
  font-weight: 700;
  pointer-events: none;
}

[data-theme="light"] .task1-solution-graph-svg .task1-graph-letter .task1-solution-point,
[data-theme="light"]
  .task1-admin-diagram-editor__canvas
  .task1-solution-graph-svg
  .task1-graph-letter
  .task1-solution-point {
  fill: #1d4ed8;
}

.task1-solution-graph-svg .task1-graph-node--degree-match .task1-graph-value,
.task1-graph-host--solution-overlay .task1-graph-node[data-solution-degree] .task1-graph-value {
  fill: #ffffff;
  font-size: 15px;
  font-weight: 700;
  stroke: var(--task1-graph-value-outline);
  stroke-width: 1.25px;
  paint-order: stroke fill;
}

[data-theme="light"] .task1-solution-graph-svg .task1-graph-node--degree-match .task1-graph-value,
[data-theme="light"]
  .task1-graph-host--solution-overlay
  .task1-graph-node[data-solution-degree]
  .task1-graph-value {
  fill: #ffffff;
  stroke: #14532d;
}

/* Анимация «Показать решение» (/hyperformula/task1/) */
.task1-graph-node--anim-focus .task1-graph-dot {
  stroke: #38bdf8;
  stroke-width: 3;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.55));
}

.task1-graph-letter--anim-wrong .task1-solution-point,
.task1-graph-letter--anim-wrong {
  fill: #f87171 !important;
}

.task1-graph-letter--anim-wrong .task1-solution-point-sep,
.task1-graph-letter--anim-wrong tspan:not(.task1-solution-point) {
  fill: #f87171;
}

.task1-solution-edge-label--pending {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.task1-solution-edge-label:not(.task1-solution-edge-label--pending) {
  opacity: 1;
}

.task1-matrix__cell--anim-fill {
  animation: task1-table-cell-flash 0.55s ease;
}

@keyframes task1-table-cell-flash {
  0% {
    background-color: rgba(52, 211, 153, 0.45);
  }
  100% {
    background-color: transparent;
  }
}

.task1-show-solution-btn--busy {
  opacity: 0.72;
  cursor: wait;
}

@media (prefers-reduced-motion: reduce) {
  .task1-solution-edge-label--pending {
    opacity: 1;
    transition: none;
  }
  .task1-matrix__cell--anim-fill {
    animation: none;
  }
}

.task1-solution-edge-diamond {
  fill: #ffffff;
  stroke: var(--task1-graph-edge-diamond-stroke);
  stroke-width: 1.1;
  vector-effect: non-scaling-stroke;
}

[data-theme="light"] .task1-solution-edge-diamond {
  fill: #f8fafc;
}

.task1-solution-edge-label {
  fill: var(--task1-graph-edge-label-fill);
  font-size: 12px;
  font-weight: 700;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  pointer-events: none;
}

.task1-graph-wrap--editor .task1-graph-edge-wrap .task1-solution-edge-label {
  fill: #34d399;
  font-size: 18px;
  user-select: none;
  -webkit-user-select: none;
}

[data-theme="light"] .task1-graph-wrap--editor .task1-graph-edge-wrap .task1-solution-edge-label {
  fill: #059669;
}

.task1-distance-table-host {
  overflow: auto;
  max-width: 100%;
}

.task1-matrix {
  border-collapse: collapse;
  font-size: 0.82rem;
  font-family: Georgia, "Times New Roman", Times, serif;
}

.task1-matrix-corner {
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: transparent;
  padding: 0;
  min-width: 2.4rem;
  width: 2.4rem;
}

.task1-matrix-banner {
  border: 1px solid rgba(148, 163, 184, 0.55);
  padding: 0.35rem 0.5rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.88rem;
  background: rgba(15, 23, 42, 0.25);
}

.task1-matrix-side-banner {
  position: relative;
  border: 1px solid rgba(148, 163, 184, 0.55);
  padding: 0;
  vertical-align: middle;
  text-align: center;
  background: rgba(15, 23, 42, 0.25);
  min-width: 2rem;
  max-width: 2.4rem;
}

.task1-matrix-side-banner__inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.2rem;
  box-sizing: border-box;
}

.task1-matrix-side-banner__text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.2;
}

.task1-matrix-col-num,
.task1-matrix-row-num {
  border: 1px solid rgba(148, 163, 184, 0.55);
  padding: 0.25rem 0.35rem;
  min-width: 2.1rem;
  text-align: center;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.3);
}

.task1-matrix-h-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.task1-matrix-h-wrap--col {
  flex-direction: column;
}

.task1-matrix-h-wrap--row {
  flex-direction: row;
}

.task1-matrix__header-inp {
  width: 2.1rem;
  min-width: 1.75rem;
  max-width: 3rem;
  box-sizing: border-box;
  border: 1px solid rgba(5, 184, 125, 0.45);
  border-radius: 3px;
  background: rgba(15, 23, 42, 0.2);
  color: inherit;
  text-align: center;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.12rem 0.1rem;
}

.task1-matrix__header-inp[data-task1-hcol="1"] {
  border-width: 2px;
  border-color: rgba(5, 184, 125, 0.65);
}

.task1-matrix__header-inp:focus {
  outline: 2px solid rgba(5, 184, 125, 0.45);
}

.task1-matrix__header-inp--ok {
  background: rgba(5, 184, 125, 0.35) !important;
  border-color: rgba(5, 184, 125, 0.75) !important;
}

.task1-matrix__header-inp--bad {
  background: rgba(220, 38, 38, 0.35) !important;
  border-color: rgba(248, 113, 113, 0.85) !important;
}

[data-theme="light"] .task1-matrix__header-inp {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(5, 150, 105, 0.42);
}

[data-theme="light"] .task1-matrix__header-inp[data-task1-hcol="1"] {
  border-width: 2px;
  border-color: rgba(5, 150, 105, 0.62);
}

[data-theme="light"] .task1-matrix__header-inp--ok {
  background: rgba(167, 243, 208, 0.95) !important;
  border-color: #059669 !important;
}

[data-theme="light"] .task1-matrix__header-inp--bad {
  background: rgba(254, 202, 202, 0.95) !important;
  border-color: #dc2626 !important;
}

.task1-matrix td.task1-matrix__cell {
  border: 1px solid rgba(148, 163, 184, 0.55);
  padding: 0.2rem 0.35rem;
  min-width: 2.1rem;
  text-align: center;
  background: rgba(15, 23, 42, 0.15);
}

.task1-matrix td.task1-matrix__cell.task1-matrix__diag {
  background: rgba(100, 116, 139, 0.55);
  padding: 0.35rem;
}

.task1-matrix td input {
  width: 100%;
  min-width: 2rem;
  box-sizing: border-box;
  border: none;
  background: transparent;
  color: inherit;
  text-align: center;
  font: inherit;
  padding: 0.15rem 0;
}

.task1-matrix td input:focus {
  outline: 2px solid rgba(5, 184, 125, 0.55);
  border-radius: 2px;
}

[data-theme="light"] .task1-card {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .task1-matrix-banner,
[data-theme="light"] .task1-matrix-side-banner,
[data-theme="light"] .task1-matrix-col-num,
[data-theme="light"] .task1-matrix-row-num {
  background: rgba(241, 245, 249, 0.95);
  border-color: rgba(15, 23, 42, 0.35);
}

[data-theme="light"] .task1-matrix-corner {
  border-color: rgba(15, 23, 42, 0.35);
}

[data-theme="light"] .task1-matrix td.task1-matrix__cell {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(15, 23, 42, 0.45);
}

[data-theme="light"] .task1-matrix td.task1-matrix__cell.task1-matrix__diag {
  background: rgba(148, 163, 184, 0.65);
  border-color: rgba(15, 23, 42, 0.45);
}

/* Модальное подтверждение (перезапуск схемы) */
body.task1-confirm-modal-open {
  overflow: hidden;
}

.task1-confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.task1-confirm-modal[hidden] {
  display: none !important;
}

.task1-confirm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(6px);
}

.task1-confirm-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 22rem);
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: linear-gradient(165deg, rgba(28, 34, 44, 0.98) 0%, rgba(14, 18, 26, 0.98) 100%);
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 0 32px rgba(251, 191, 36, 0.12);
  overflow: hidden;
  animation: task1-confirm-in 0.22s ease-out;
}

@keyframes task1-confirm-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.task1-confirm-modal__header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem 0.55rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.task1-confirm-modal__icon {
  flex: 0 0 2.25rem;
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fcd34d;
  background: linear-gradient(180deg, rgba(120, 53, 15, 0.55) 0%, rgba(69, 26, 3, 0.4) 100%);
  border: 1px solid rgba(251, 191, 36, 0.45);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.task1-confirm-modal__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #f8fafc;
}

.task1-confirm-modal__body {
  margin: 0;
  padding: 0.75rem 1rem 0.9rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: rgba(203, 213, 225, 0.95);
}

.task1-confirm-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  padding: 0.65rem 1rem 0.85rem;
  background: rgba(0, 0, 0, 0.18);
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.task1-confirm-modal__btn {
  min-width: 5.5rem;
  padding: 0.42rem 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.9);
  color: #e2e8f0;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.task1-confirm-modal__btn:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: rgba(148, 163, 184, 0.5);
}

.task1-confirm-modal__btn:active {
  transform: translateY(1px);
}

.task1-confirm-modal__btn--primary {
  border-color: rgba(251, 191, 36, 0.55);
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
  color: #1c1917;
  box-shadow: 0 2px 10px rgba(217, 119, 6, 0.35);
}

.task1-confirm-modal__btn--primary:hover {
  background: linear-gradient(180deg, #fcd34d 0%, #f59e0b 100%);
  border-color: #fde68a;
}

.task1-confirm-modal__btn:focus-visible {
  outline: 2px solid rgba(52, 211, 153, 0.75);
  outline-offset: 2px;
}

[data-theme="light"] .task1-confirm-modal__backdrop {
  background: rgba(15, 23, 42, 0.35);
}

[data-theme="light"] .task1-confirm-modal__dialog {
  border-color: rgba(217, 119, 6, 0.35);
  background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
  box-shadow:
    0 20px 40px rgba(15, 23, 42, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.9) inset;
}

[data-theme="light"] .task1-confirm-modal__title {
  color: #0f172a;
}

[data-theme="light"] .task1-confirm-modal__body {
  color: #475569;
}

[data-theme="light"] .task1-confirm-modal__footer {
  background: rgba(241, 245, 249, 0.85);
}

[data-theme="light"] .task1-confirm-modal__btn {
  background: #fff;
  color: #334155;
  border-color: rgba(148, 163, 184, 0.55);
}

[data-theme="light"] .task1-confirm-modal__btn--primary {
  color: #1c1917;
}

/* Условие задания 1 — premium card (правая колонка) */
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;
}

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"] 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;
}

body.libreoffice-page-task1 .task1-statement--premium .task1-statement__lead {
  margin: 0 0 0.85rem;
  font-size: 1.02rem;
  font-weight: 500;
  color: rgba(241, 245, 249, 0.96);
}

[data-theme="light"] body.libreoffice-page-task1 .task1-statement--premium .task1-statement__lead {
  color: #0f172a;
}

body.libreoffice-page-task1 .task1-statement--premium .task1-statement__note {
  margin: 0 0 0.85rem;
  font-size: 0.92rem;
  color: rgba(148, 163, 184, 0.95);
}

[data-theme="light"] body.libreoffice-page-task1 .task1-statement--premium .task1-statement__note {
  color: #64748b;
}

body.libreoffice-page-task1 .task1-statement--premium .task1-statement__question {
  margin: 0 0 0.85rem;
  font-size: 0.98rem;
  font-weight: 500;
  color: rgba(226, 232, 240, 0.98);
}

[data-theme="light"] body.libreoffice-page-task1 .task1-statement--premium .task1-statement__question {
  color: #1e293b;
}

body.libreoffice-page-task1 .task1-statement--premium .task1-statement__answer-hint {
  display: inline-block;
  margin: 0;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(167, 243, 208, 0.98);
  background: linear-gradient(180deg, rgba(5, 184, 125, 0.22) 0%, rgba(4, 120, 82, 0.18) 100%);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

[data-theme="light"] body.libreoffice-page-task1 .task1-statement--premium .task1-statement__answer-hint {
  color: #047857;
  background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #6ee7b7;
}

body.libreoffice-page-task1 .task1-statement--premium .task1-statement__credit {
  margin: 0 0 0.65rem;
  font-size: 0.84rem;
  color: rgba(148, 163, 184, 0.9);
}

body.libreoffice-page-task1 .task1-statement--premium .task1-statement__text {
  margin: 0 0 0.75rem;
}

body.libreoffice-page-task1 .task1-statement--premium .task1-statement__figure {
  margin: 0.15rem 0 1rem;
  padding: 0.7rem;
  text-align: center;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: linear-gradient(
    180deg,
    rgba(15, 23, 42, 0.55) 0%,
    rgba(30, 41, 59, 0.35) 100%
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="light"] body.libreoffice-page-task1 .task1-statement--premium .task1-statement__figure {
  border-color: rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

body.libreoffice-page-task1 .task1-statement--premium .task1-statement__image {
  display: block;
  width: min(100%, 480px);
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
}

body.libreoffice-page-task1 .task1-statement--premium strong {
  color: #34d399;
  font-weight: 700;
}

[data-theme="light"] body.libreoffice-page-task1 .task1-statement--premium strong {
  color: #059669;
}

body.libreoffice-page-task1 .task1-statement--premium p:last-child {
  margin-bottom: 0;
}

/* Текстовое решение задания 1 — premium card */
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;
}

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"] 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;
}

body.libreoffice-page-task1 .task1-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"] body.libreoffice-page-task1 .task1-solution--premium .task1-solution__intro {
  color: #1e293b;
}

body.libreoffice-page-task1 .task1-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"] body.libreoffice-page-task1 .task1-solution--premium .task1-solution__step {
  color: #475569;
}

body.libreoffice-page-task1 .task1-solution--premium .task1-solution__list {
  margin: 0 0 0.65rem;
  padding-left: 1.15rem;
}

body.libreoffice-page-task1 .task1-solution--premium .task1-solution__list li {
  margin: 0.3rem 0;
}

body.libreoffice-page-task1 .task1-solution--premium .task1-solution__list--mapping li {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}

body.libreoffice-page-task1 .task1-solution--premium .task1-solution__sum {
  margin: 0.55rem 0 0.45rem;
  font-size: 0.93rem;
  color: rgba(226, 232, 240, 0.96);
}

[data-theme="light"] body.libreoffice-page-task1 .task1-solution--premium .task1-solution__sum {
  color: #334155;
}

body.libreoffice-page-task1 .task1-solution--premium .task1-solution__answer {
  display: inline-block;
  margin: 0.15rem 0 0;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(167, 243, 208, 0.98);
  background: linear-gradient(180deg, rgba(5, 184, 125, 0.24) 0%, rgba(4, 120, 82, 0.2) 100%);
  border: 1px solid rgba(52, 211, 153, 0.38);
}

[data-theme="light"] body.libreoffice-page-task1 .task1-solution--premium .task1-solution__answer {
  color: #047857;
  background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #6ee7b7;
}

body.libreoffice-page-task1 .task1-solution--premium strong {
  color: #34d399;
  font-weight: 700;
}

[data-theme="light"] body.libreoffice-page-task1 .task1-solution--premium strong {
  color: #059669;
}

body.libreoffice-page-task1 .task1-solution--premium p:last-child {
  margin-bottom: 0;
}

/* Premium panel resizers — task1 */
body.libreoffice-page-task1 .task1-panel-resizer--horizontal {
  flex: 0 0 14px;
  height: 14px;
  margin: 0.4rem 0;
  padding: 0;
  border: none;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: row-resize;
  touch-action: none;
  user-select: none;
  flex-shrink: 0;
  background: transparent;
  outline: none;
  transition: margin 0.18s ease;
}

body.libreoffice-page-task1 .task1-panel-resizer--horizontal::before {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(52, 211, 153, 0.18) 18%,
    rgba(52, 211, 153, 0.42) 50%,
    rgba(52, 211, 153, 0.18) 82%,
    transparent 100%
  );
  opacity: 0.75;
  transition:
    opacity 0.18s ease,
    height 0.18s ease,
    box-shadow 0.18s ease;
}

body.libreoffice-page-task1 .task1-panel-resizer--horizontal::after {
  content: "";
  position: relative;
  z-index: 1;
  width: 58px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, 0.28);
  background-color: rgba(15, 23, 42, 0.92);
  background-image:
    radial-gradient(circle, rgba(148, 163, 184, 0.95) 1.5px, transparent 1.6px),
    radial-gradient(circle, rgba(148, 163, 184, 0.95) 1.5px, transparent 1.6px),
    radial-gradient(circle, rgba(148, 163, 184, 0.95) 1.5px, transparent 1.6px);
  background-size: 6px 6px;
  background-position:
    calc(50% - 8px) center,
    50% center,
    calc(50% + 8px) center;
  background-repeat: no-repeat;
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

body.libreoffice-page-task1 .task1-panel-resizer--horizontal:hover::before,
body.libreoffice-page-task1 .task1-panel-resizer--horizontal:focus-visible::before,
body.libreoffice-page-task1 .task1-panel-resizer--horizontal.task1-panel-resizer--dragging::before {
  opacity: 1;
  height: 3px;
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.22);
}

body.libreoffice-page-task1 .task1-panel-resizer--horizontal:hover::after,
body.libreoffice-page-task1 .task1-panel-resizer--horizontal:focus-visible::after,
body.libreoffice-page-task1 .task1-panel-resizer--horizontal.task1-panel-resizer--dragging::after {
  border-color: rgba(52, 211, 153, 0.62);
  box-shadow:
    0 0 16px rgba(52, 211, 153, 0.28),
    0 2px 10px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: scale(1.04);
}

body.libreoffice-page-task1 .task1-panel-resizer--horizontal:focus-visible {
  outline: none;
}

[data-theme="light"] body.libreoffice-page-task1 .task1-panel-resizer--horizontal::before {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(5, 150, 105, 0.12) 18%,
    rgba(5, 150, 105, 0.32) 50%,
    rgba(5, 150, 105, 0.12) 82%,
    transparent 100%
  );
}

[data-theme="light"] body.libreoffice-page-task1 .task1-panel-resizer--horizontal::after {
  background-color: rgba(255, 255, 255, 0.96);
  border-color: rgba(5, 150, 105, 0.22);
  background-image:
    radial-gradient(circle, rgba(100, 116, 139, 0.95) 1.5px, transparent 1.6px),
    radial-gradient(circle, rgba(100, 116, 139, 0.95) 1.5px, transparent 1.6px),
    radial-gradient(circle, rgba(100, 116, 139, 0.95) 1.5px, transparent 1.6px);
  box-shadow:
    0 2px 8px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

body.libreoffice-page-task1.task1-panel-resizer--active,
body.libreoffice-page-task1.task1-panel-resizer--active .task1-panel-resizer--horizontal {
  cursor: row-resize;
}

body.libreoffice-page-task1.task1-panel-resizer--active {
  user-select: none;
}

/* Premium resizers + scrollbars: static/css/hf_premium_chrome.css */

/* Десктоп: task1-paint-solution-run-tools в шапке схемы (как на мобилке). */
body.libreoffice-page-task1 #task-answer-section #task1-paint-solution-run-tools {
  display: none !important;
}

body.libreoffice-page-task1.ege-task1-graph-toolbar-active:not(.task-mobile-mode) {
  --ege-task2-titlebar-btn-size: 1.9rem;
  --ege-task2-titlebar-icon-size: 0.98rem;
  --ege-task2-titlebar-radius: 0.48rem;
  --oge-kumir-chrome-btn-text: #a7f3d0;
  --oge-calc-solution-accent: #10b981;
  --oge-calc-solution-accent-deep: #047857;
  --oge-calc-solution-text: #a7f3d0;
}

[data-theme="light"]
  body.libreoffice-page-task1.ege-task1-graph-toolbar-active:not(.task-mobile-mode) {
  --oge-kumir-chrome-btn-text: #064e3b;
  --oge-calc-solution-accent: #059669;
  --oge-calc-solution-accent-deep: #047857;
  --oge-calc-solution-text: #064e3b;
}

body.libreoffice-page-task1.ege-task1-graph-toolbar-active:not(.task-mobile-mode) #task1-diagram-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title toolbar"
    "canvas canvas";
  align-items: center;
  gap: 0.35rem 0.5rem;
}

body.libreoffice-page-task1.ege-task1-graph-toolbar-active:not(.task-mobile-mode) #task1-diagram-title {
  grid-area: title;
  margin: 0;
}

body.libreoffice-page-task1.ege-task1-graph-toolbar-active:not(.task-mobile-mode)
  .oge-task15-mobile-solution-toolbar {
  grid-area: toolbar;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
}

body.libreoffice-page-task1.ege-task1-graph-toolbar-active:not(.task-mobile-mode)
  .task1-diagram-layout {
  grid-area: canvas;
}

body.libreoffice-page-task1.ege-task1-graph-toolbar-active:not(.task-mobile-mode)
  .oge-task15-mobile-solution-toolbar
  .oge-python-mobile-editor-chrome--in-titlebar {
  display: flex !important;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 auto;
  min-width: 0;
  gap: 0.23rem;
}

body.libreoffice-page-task1.ege-task1-graph-toolbar-active:not(.task-mobile-mode)
  .oge-task15-mobile-solution-toolbar
  .oge-python-mobile-solution-toolbar {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
  gap: 0.23rem;
  overflow-x: auto;
}

body.libreoffice-page-task1.ege-task1-graph-toolbar-active:not(.task-mobile-mode)
  .oge-task15-mobile-solution-toolbar
  .oge-paint-solution-run {
  display: inline-flex;
  align-items: center;
  gap: 0.23rem;
  margin: 0;
  padding: 0;
  border: 0;
}

body.libreoffice-page-task1.ege-task1-graph-toolbar-active:not(.task-mobile-mode)
  .oge-task15-mobile-solution-toolbar
  .task1-diagram-chrome__group {
  display: inline-flex;
  align-items: center;
  gap: 0.23rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body.libreoffice-page-task1.ege-task1-graph-toolbar-active:not(.task-mobile-mode)
  .oge-task15-mobile-solution-toolbar
  [data-oge-paint-solution-visibility-toggle],
body.libreoffice-page-task1.ege-task1-graph-toolbar-active:not(.task-mobile-mode)
  .oge-task15-mobile-solution-toolbar
  .oge-paint-solution-run
  [data-oge-run-paint-solution],
body.libreoffice-page-task1.ege-task1-graph-toolbar-active:not(.task-mobile-mode)
  .oge-task15-mobile-solution-toolbar
  .oge-paint-solution-run
  [data-oge-run-paint-solution-stepwise] {
  display: none !important;
}

body.libreoffice-page-task1.ege-task1-graph-toolbar-active:not(.task-mobile-mode)
  .oge-task15-mobile-solution-toolbar
  .oge-kumir-chrome__btn,
body.libreoffice-page-task1.ege-task1-graph-toolbar-active:not(.task-mobile-mode)
  .oge-task15-mobile-solution-toolbar
  .task1-diagram-chrome__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex: 0 0 auto;
  width: var(--ege-task2-titlebar-btn-size) !important;
  height: var(--ege-task2-titlebar-btn-size) !important;
  min-width: var(--ege-task2-titlebar-btn-size) !important;
  min-height: var(--ege-task2-titlebar-btn-size) !important;
  margin: 0;
  padding: 0;
  border-radius: var(--ege-task2-titlebar-radius);
  border: 1.5px solid color-mix(in srgb, var(--oge-calc-solution-accent, #10b981) 30%, transparent);
  background: color-mix(in srgb, var(--oge-calc-solution-accent, #10b981) 10%, transparent);
  color: var(--oge-kumir-chrome-btn-text, #a7f3d0);
  cursor: pointer;
}

body.libreoffice-page-task1.ege-task1-graph-toolbar-active:not(.task-mobile-mode)
  .oge-task15-mobile-solution-toolbar
  #task1-graph-new-scheme,
body.libreoffice-page-task1.ege-task1-graph-toolbar-active:not(.task-mobile-mode)
  .task1-diagram-chrome__play-icon {
  display: none !important;
}

body.variant-exam-body.libreoffice-page-task1.ege-task1-graph-toolbar-active:not(.task-mobile-mode)
  #task-answer-section
  #task1-paint-solution-run-tools {
  display: none !important;
}

