/* Задание 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__hint {
  margin: 0 0 0.15rem;
  font-size: 0.85rem;
  opacity: 0.9;
}

.task1-card.task1-card--diagram {
  overflow: visible;
}

.task1-graph-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  /* ~10% меньше прежнего clamp(260px, 42vw, 480px) */
  min-height: clamp(234px, 37.8vw, 432px);
  min-width: 0;
  max-width: 100%;
  overflow: visible;
}

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

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

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

.task1-graph-edge {
  stroke: #0a0a0a;
  stroke-width: 1.15;
  vector-effect: non-scaling-stroke;
}

[data-theme="light"] .task1-graph-edge {
  stroke: #111;
}

.task1-graph-dot {
  fill: #f8fafc;
  stroke: #0f172a;
  stroke-width: 1.25;
  cursor: pointer;
  vector-effect: non-scaling-stroke;
}

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

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

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

/* Узел А: анимированный зелёный градиент (defs в task1_diagram_and_table.js, id task1-graph-grad-a) */
@keyframes task1-grad-a-stop-0 {
  0%,
  100% {
    stop-color: #064e3b;
  }
  50% {
    stop-color: #34d399;
  }
}

@keyframes task1-grad-a-stop-1 {
  0%,
  100% {
    stop-color: #6ee7b7;
  }
  50% {
    stop-color: #047857;
  }
}

.task1-graph-svg stop.task1-graph-grad-a-stop--0 {
  animation: task1-grad-a-stop-0 2.8s ease-in-out infinite;
}

.task1-graph-svg stop.task1-graph-grad-a-stop--1 {
  animation: task1-grad-a-stop-1 2.8s ease-in-out infinite;
  animation-delay: -1.4s;
}

[data-theme="light"] .task1-graph-svg stop.task1-graph-grad-a-stop--0 {
  animation: task1-grad-a-stop-0-light 2.8s ease-in-out infinite;
}

[data-theme="light"] .task1-graph-svg stop.task1-graph-grad-a-stop--1 {
  animation: task1-grad-a-stop-1-light 2.8s ease-in-out -1.4s infinite;
}

@keyframes task1-grad-a-stop-0-light {
  0%,
  100% {
    stop-color: #047857;
  }
  50% {
    stop-color: #34d399;
  }
}

@keyframes task1-grad-a-stop-1-light {
  0%,
  100% {
    stop-color: #a7f3d0;
  }
  50% {
    stop-color: #059669;
  }
}

.task1-graph-wrap .task1-graph-node[data-node-id="A"] > circle.task1-graph-dot {
  fill: url(#task1-graph-grad-a);
  stroke: rgba(236, 253, 245, 0.9);
  stroke-width: 1.5;
}

.task1-graph-wrap .task1-graph-node[data-node-id="A"]:hover > circle.task1-graph-dot {
  fill: url(#task1-graph-grad-a);
  stroke: #ecfdf5;
}

.task1-graph-wrap .task1-graph-node[data-node-id="A"].task1-graph-node--active > circle.task1-graph-dot {
  fill: url(#task1-graph-grad-a);
}

.task1-graph-wrap .task1-graph-node[data-node-id="A"].task1-graph-node--degree-match > circle.task1-graph-dot {
  fill: #05b87d;
  stroke: #047857;
}

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

@media (prefers-reduced-motion: reduce) {
  .task1-graph-svg stop.task1-graph-grad-a-stop--0,
  .task1-graph-svg stop.task1-graph-grad-a-stop--1 {
    animation: none;
  }
}

.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 {
  outline: none;
}

.task1-graph-svg:focus-visible {
  outline: 2px solid rgba(5, 184, 125, 0.65);
  outline-offset: 2px;
  border-radius: 4px;
}

.task1-graph-value {
  fill: #0f172a;
  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: #34d399;
  font-size: 19px;
  font-weight: 700;
  font-family: Georgia, "Times New Roman", Times, serif;
  pointer-events: none;
}

[data-theme="light"] .task1-graph-wrap .task1-graph-letter {
  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);
}
