.task8-python-solutions-switcher-mount:not([hidden]) {
  display: inline-flex;
  align-items: flex-end;
}

.task8-python-solutions-toggle-group {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.32rem;
  flex-shrink: 0;
  padding: 0.05rem 0;
}

.task8-python-solutions-toggle__legend {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.82);
  white-space: nowrap;
  user-select: none;
  cursor: default;
}

.task8-python-solutions-toggle__legend:not(:disabled) {
  cursor: pointer;
  color: rgba(167, 243, 208, 0.92);
}

.task8-python-solutions-toggle__legend:not(:disabled):hover {
  color: rgba(240, 253, 250, 0.98);
}

.task8-python-solutions-toggle__legend:focus-visible {
  outline: 2px solid rgba(5, 184, 125, 0.85);
  outline-offset: 1px;
  border-radius: 0.2rem;
}

[data-theme="light"] .task8-python-solutions-toggle__legend {
  color: rgba(71, 85, 105, 0.78);
}

[data-theme="light"] .task8-python-solutions-toggle__legend:not(:disabled) {
  color: rgba(5, 120, 87, 0.92);
}

[data-theme="light"] .task8-python-solutions-toggle__legend:not(:disabled):hover {
  color: rgba(4, 100, 72, 0.98);
}

/* Premium pill-toggle в стиле libreoffice-hf-action-btn */
.task8-python-solutions-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
  padding: 0.22rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(
    180deg,
    rgba(40, 46, 58, 0.96) 0%,
    rgba(24, 30, 40, 0.98) 100%
  );
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.09);
  flex-shrink: 0;
}

.task8-python-solutions-toggle__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.36rem 0.62rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: rgba(226, 232, 240, 0.78);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.12s ease;
}

.task8-python-solutions-toggle__item:hover {
  transform: translateY(-1px);
}

/* Оттенки фона pill: зелёный / синий / янтарный (цикл для 3+) */
.task8-python-solutions-toggle__item--tone-0 {
  border-color: rgba(16, 185, 129, 0.38);
  background: linear-gradient(
    165deg,
    rgba(5, 150, 105, 0.34) 0%,
    rgba(52, 211, 153, 0.18) 100%
  );
  box-shadow: inset 0 1px 0 rgba(167, 243, 208, 0.12);
}

.task8-python-solutions-toggle__item--tone-1 {
  border-color: rgba(59, 130, 246, 0.38);
  background: linear-gradient(
    165deg,
    rgba(37, 99, 235, 0.34) 0%,
    rgba(96, 165, 250, 0.18) 100%
  );
  box-shadow: inset 0 1px 0 rgba(191, 219, 254, 0.12);
}

.task8-python-solutions-toggle__item--tone-2 {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(
    165deg,
    rgba(217, 119, 6, 0.34) 0%,
    rgba(251, 191, 36, 0.18) 100%
  );
  box-shadow: inset 0 1px 0 rgba(253, 230, 138, 0.12);
}

.task8-python-solutions-toggle__item[class*="--tone-"] {
  color: rgba(248, 250, 252, 0.92);
}

.task8-python-solutions-toggle__item--tone-0:hover {
  border-color: rgba(16, 185, 129, 0.55);
  background: linear-gradient(
    165deg,
    rgba(5, 150, 105, 0.48) 0%,
    rgba(52, 211, 153, 0.28) 100%
  );
  box-shadow:
    0 2px 8px rgba(5, 150, 105, 0.22),
    inset 0 1px 0 rgba(167, 243, 208, 0.16);
}

.task8-python-solutions-toggle__item--tone-1:hover {
  border-color: rgba(59, 130, 246, 0.55);
  background: linear-gradient(
    165deg,
    rgba(37, 99, 235, 0.48) 0%,
    rgba(96, 165, 250, 0.28) 100%
  );
  box-shadow:
    0 2px 8px rgba(37, 99, 235, 0.22),
    inset 0 1px 0 rgba(191, 219, 254, 0.16);
}

.task8-python-solutions-toggle__item--tone-2:hover {
  border-color: rgba(245, 158, 11, 0.58);
  background: linear-gradient(
    165deg,
    rgba(217, 119, 6, 0.48) 0%,
    rgba(251, 191, 36, 0.28) 100%
  );
  box-shadow:
    0 2px 8px rgba(217, 119, 6, 0.22),
    inset 0 1px 0 rgba(253, 230, 138, 0.16);
}

.task8-python-solutions-toggle__item[class*="--tone-"]:hover {
  color: rgba(255, 255, 255, 0.98);
}

.task8-python-solutions-toggle__item--tone-0:focus-visible {
  outline: 2px solid rgba(5, 184, 125, 0.85);
  outline-offset: 1px;
}

.task8-python-solutions-toggle__item--tone-1:focus-visible {
  outline: 2px solid rgba(14, 165, 233, 0.85);
  outline-offset: 1px;
}

.task8-python-solutions-toggle__item--tone-2:focus-visible {
  outline: 2px solid rgba(245, 158, 11, 0.85);
  outline-offset: 1px;
}

.task8-python-solutions-toggle__item:not([class*="--tone-"]):focus-visible {
  outline: 2px solid rgba(5, 184, 125, 0.85);
  outline-offset: 1px;
}

.task8-python-solutions-toggle__item--tone-0.task8-python-solutions-toggle__item--active,
.task8-python-solutions-toggle__item--tone-0.task8-python-solutions-toggle__item--active:hover {
  border-color: rgba(16, 185, 129, 0.78);
  background: linear-gradient(
    165deg,
    rgba(5, 150, 105, 0.62) 0%,
    rgba(4, 120, 87, 0.48) 100%
  );
  box-shadow:
    0 0 0 1px rgba(16, 185, 129, 0.36),
    0 2px 12px rgba(5, 150, 105, 0.32),
    inset 0 1px 0 rgba(167, 243, 208, 0.2);
}

.task8-python-solutions-toggle__item--tone-1.task8-python-solutions-toggle__item--active,
.task8-python-solutions-toggle__item--tone-1.task8-python-solutions-toggle__item--active:hover {
  border-color: rgba(59, 130, 246, 0.78);
  background: linear-gradient(
    165deg,
    rgba(37, 99, 235, 0.62) 0%,
    rgba(29, 78, 216, 0.48) 100%
  );
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.36),
    0 2px 12px rgba(37, 99, 235, 0.32),
    inset 0 1px 0 rgba(191, 219, 254, 0.2);
}

.task8-python-solutions-toggle__item--tone-2.task8-python-solutions-toggle__item--active,
.task8-python-solutions-toggle__item--tone-2.task8-python-solutions-toggle__item--active:hover {
  border-color: rgba(245, 158, 11, 0.8);
  background: linear-gradient(
    165deg,
    rgba(217, 119, 6, 0.62) 0%,
    rgba(180, 83, 9, 0.48) 100%
  );
  box-shadow:
    0 0 0 1px rgba(245, 158, 11, 0.38),
    0 2px 12px rgba(217, 119, 6, 0.32),
    inset 0 1px 0 rgba(253, 230, 138, 0.2);
}

.task8-python-solutions-toggle__item[class*="--tone-"].task8-python-solutions-toggle__item--active,
.task8-python-solutions-toggle__item[class*="--tone-"].task8-python-solutions-toggle__item--active:hover {
  color: rgba(255, 255, 255, 0.98);
  cursor: default;
  transform: translateY(-1px);
}

.task8-python-solutions-toggle__item:not([class*="--tone-"]):hover {
  border-color: rgba(5, 184, 125, 0.35);
  background: rgba(5, 184, 125, 0.1);
  color: rgba(240, 253, 250, 0.95);
}

.task8-python-solutions-toggle__item:not([class*="--tone-"]).task8-python-solutions-toggle__item--active,
.task8-python-solutions-toggle__item:not([class*="--tone-"]).task8-python-solutions-toggle__item--active:hover {
  border-color: rgba(5, 184, 125, 0.72);
  background: linear-gradient(
    165deg,
    rgba(5, 184, 125, 0.34) 0%,
    rgba(4, 130, 90, 0.26) 100%
  );
  color: #ecfdf5;
  cursor: default;
  box-shadow:
    0 0 0 1px rgba(5, 184, 125, 0.32),
    0 2px 10px rgba(5, 184, 125, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.task8-python-solutions-toggle__item:active {
  transform: translateY(0);
}

[data-theme="light"] .task8-python-solutions-toggle {
  border-color: rgba(15, 23, 42, 0.1);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.96) 0%,
    rgba(241, 245, 249, 0.92) 100%
  );
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.98);
}

[data-theme="light"] .task8-python-solutions-toggle__item:not([class*="--tone-"]) {
  color: rgba(51, 65, 85, 0.72);
}

[data-theme="light"] .task8-python-solutions-toggle__item--tone-0 {
  border-color: rgba(5, 150, 105, 0.32);
  background: linear-gradient(
    165deg,
    rgba(16, 185, 129, 0.22) 0%,
    rgba(167, 243, 208, 0.42) 100%
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

[data-theme="light"] .task8-python-solutions-toggle__item--tone-1 {
  border-color: rgba(37, 99, 235, 0.32);
  background: linear-gradient(
    165deg,
    rgba(59, 130, 246, 0.2) 0%,
    rgba(191, 219, 254, 0.46) 100%
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

[data-theme="light"] .task8-python-solutions-toggle__item--tone-2 {
  border-color: rgba(217, 119, 6, 0.34);
  background: linear-gradient(
    165deg,
    rgba(245, 158, 11, 0.22) 0%,
    rgba(253, 230, 138, 0.48) 100%
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

[data-theme="light"] .task8-python-solutions-toggle__item[class*="--tone-"] {
  color: rgba(30, 41, 59, 0.88);
}

[data-theme="light"] .task8-python-solutions-toggle__item--tone-0:hover {
  border-color: rgba(5, 150, 105, 0.48);
  background: linear-gradient(
    165deg,
    rgba(16, 185, 129, 0.3) 0%,
    rgba(110, 231, 183, 0.38) 100%
  );
}

[data-theme="light"] .task8-python-solutions-toggle__item--tone-1:hover {
  border-color: rgba(37, 99, 235, 0.48);
  background: linear-gradient(
    165deg,
    rgba(59, 130, 246, 0.28) 0%,
    rgba(147, 197, 253, 0.42) 100%
  );
}

[data-theme="light"] .task8-python-solutions-toggle__item--tone-2:hover {
  border-color: rgba(217, 119, 6, 0.5);
  background: linear-gradient(
    165deg,
    rgba(245, 158, 11, 0.3) 0%,
    rgba(252, 211, 77, 0.44) 100%
  );
}

[data-theme="light"] .task8-python-solutions-toggle__item--tone-0.task8-python-solutions-toggle__item--active,
[data-theme="light"] .task8-python-solutions-toggle__item--tone-0.task8-python-solutions-toggle__item--active:hover {
  border-color: rgba(5, 150, 105, 0.62);
  background: linear-gradient(
    165deg,
    rgba(16, 185, 129, 0.38) 0%,
    rgba(5, 150, 105, 0.24) 100%
  );
  color: rgba(6, 78, 59, 0.96);
  box-shadow:
    0 0 0 1px rgba(5, 150, 105, 0.24),
    0 2px 8px rgba(5, 150, 105, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

[data-theme="light"] .task8-python-solutions-toggle__item--tone-1.task8-python-solutions-toggle__item--active,
[data-theme="light"] .task8-python-solutions-toggle__item--tone-1.task8-python-solutions-toggle__item--active:hover {
  border-color: rgba(37, 99, 235, 0.62);
  background: linear-gradient(
    165deg,
    rgba(59, 130, 246, 0.36) 0%,
    rgba(29, 78, 216, 0.22) 100%
  );
  color: rgba(30, 64, 175, 0.96);
  box-shadow:
    0 0 0 1px rgba(37, 99, 235, 0.24),
    0 2px 8px rgba(37, 99, 235, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

[data-theme="light"] .task8-python-solutions-toggle__item--tone-2.task8-python-solutions-toggle__item--active,
[data-theme="light"] .task8-python-solutions-toggle__item--tone-2.task8-python-solutions-toggle__item--active:hover {
  border-color: rgba(217, 119, 6, 0.64);
  background: linear-gradient(
    165deg,
    rgba(245, 158, 11, 0.38) 0%,
    rgba(180, 83, 9, 0.22) 100%
  );
  color: rgba(146, 64, 14, 0.96);
  box-shadow:
    0 0 0 1px rgba(217, 119, 6, 0.26),
    0 2px 8px rgba(217, 119, 6, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

[data-theme="light"] .task8-python-solutions-toggle__item:not([class*="--tone-"]):hover {
  border-color: rgba(5, 150, 105, 0.35);
  background: rgba(5, 150, 105, 0.08);
  color: rgba(6, 78, 59, 0.92);
}

[data-theme="light"] .task8-python-solutions-toggle__item:not([class*="--tone-"]).task8-python-solutions-toggle__item--active,
[data-theme="light"] .task8-python-solutions-toggle__item:not([class*="--tone-"]).task8-python-solutions-toggle__item--active:hover {
  border-color: rgba(5, 150, 105, 0.55);
  background: linear-gradient(
    165deg,
    rgba(5, 150, 105, 0.2) 0%,
    rgba(16, 185, 129, 0.14) 100%
  );
  color: #047857;
  box-shadow:
    0 0 0 1px rgba(5, 150, 105, 0.22),
    0 2px 8px rgba(5, 150, 105, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

/* Видеоразборы: круглые вкладки с логотипом VK вместо цифр */
[data-variant-video-sources-switcher] .task8-python-solutions-toggle__item {
  min-width: 2.05rem;
  width: 2.05rem;
  height: 2.05rem;
  padding: 0.34rem;
  border-radius: 50%;
  font-size: 0;
  line-height: 0;
}

[data-variant-video-sources-switcher] .task8-python-solutions-toggle__item-icon {
  display: block;
  width: 0.9rem;
  height: 0.9rem;
  max-width: 0.9rem;
  max-height: 0.9rem;
  margin: 0 auto;
  object-fit: contain;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .task8-python-solutions-toggle__item {
    transition: none;
  }
}
