/* Экранная кисть и лазер — /task{N}/ и /variants/<slug>/task{N}/ */
.neuroege-screen-annotate {
  position: fixed;
  inset: 0;
  z-index: 10100;
  pointer-events: none;
}

/* Панель в шапке: activator поверх страницы */
body.neuroege-screen-annotate--open .header.header--task-hf,
body.neuroege-screen-annotate--open .variant-exam__topbar {
  position: relative;
  z-index: 10105;
}

/* Toolbar вынесен в #neuroege-screen-annotate — всегда выше холста кисти */
.neuroege-screen-annotate__toolbar--floating {
  position: fixed;
  z-index: 10102;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(0.96);
}

.neuroege-screen-annotate__toolbar--floating.neuroege-screen-annotate__toolbar--open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.neuroege-screen-annotate__canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  touch-action: none;
}

/* Курсор кисти: точка + мягкое кольцо (вместо crosshair) */
.neuroege-screen-annotate--mode-brush .neuroege-screen-annotate__canvas {
  pointer-events: auto;
  cursor:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='10' fill='none' stroke='%23ff3b3b' stroke-width='1.1' opacity='0.38'/%3E%3Ccircle cx='16' cy='16' r='5.25' fill='%23ff3b3b' stroke='%23ffffff' stroke-width='2'/%3E%3Ccircle cx='16' cy='16' r='1.6' fill='%23ffffff' opacity='0.92'/%3E%3C/svg%3E")
      16 16,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='4' fill='%23ff3b3b' stroke='%23fff' stroke-width='1.5'/%3E%3C/svg%3E")
      12 12,
    pointer;
}

[data-theme="light"] .neuroege-screen-annotate--mode-brush .neuroege-screen-annotate__canvas {
  cursor:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='10' fill='none' stroke='%23dc2626' stroke-width='1.1' opacity='0.42'/%3E%3Ccircle cx='16' cy='16' r='5.25' fill='%23ef4444' stroke='%23ffffff' stroke-width='2'/%3E%3Ccircle cx='16' cy='16' r='1.6' fill='%23ffffff' opacity='0.95'/%3E%3C/svg%3E")
      16 16,
    pointer;
}

.neuroege-screen-annotate__laser {
  position: fixed;
  left: 0;
  top: 0;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: #ff3b3b;
  box-shadow:
    0 0 8px #ff3b3b,
    0 0 18px rgba(255, 59, 59, 0.75),
    0 0 32px rgba(255, 59, 59, 0.35);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.1s ease;
  z-index: 10101;
}

.neuroege-screen-annotate--mode-laser .neuroege-screen-annotate__laser {
  opacity: 1;
  visibility: visible;
}

/* Навигация: рисунок на холсте остаётся, клики проходят на страницу */
.neuroege-screen-annotate--open.neuroege-screen-annotate--mode-navigate .neuroege-screen-annotate__canvas,
.neuroege-screen-annotate--open.neuroege-screen-annotate--mode-laser .neuroege-screen-annotate__canvas {
  pointer-events: none;
}

.neuroege-screen-annotate__tool--navigate.neuroege-screen-annotate__tool--active {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(59, 130, 246, 0.22);
  color: #dbeafe;
}

[data-theme="light"] .neuroege-screen-annotate__tool--navigate.neuroege-screen-annotate__tool--active {
  color: #1d4ed8;
  background: rgba(219, 234, 254, 0.95);
  border-color: rgba(59, 130, 246, 0.45);
}

main.task-solve-main {
  position: relative;
}

.neuroege-screen-annotate__chrome {
  position: fixed;
  z-index: 3;
  min-width: 2.5rem;
  min-height: 2.5rem;
  pointer-events: none;
}

/* Сегмент «Рисование» в .hf-header-util-toggle (рядом с темой) */
.neuroege-screen-annotate__chrome--header {
  position: relative;
  z-index: 120;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: stretch;
}

.neuroege-screen-annotate__chrome--header .neuroege-screen-annotate__toolbar {
  top: calc(100% + 0.35rem);
  bottom: auto;
  right: 0;
  z-index: 121;
}

.hf-header-util-toggle .neuroege-screen-annotate__chrome--header .neuroege-screen-annotate__activator {
  width: 2.25rem;
  height: 2.25rem;
  min-width: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 9px 0 0 9px;
  background: transparent;
  color: #ecfdf5;
  box-shadow: none;
}

.hf-header-util-toggle .neuroege-screen-annotate__chrome--header .neuroege-screen-annotate__activator:hover {
  background: rgba(5, 184, 125, 0.1);
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

[data-theme="light"] .hf-header-util-toggle .neuroege-screen-annotate__chrome--header .neuroege-screen-annotate__activator {
  color: #047857;
}

[data-theme="light"] .hf-header-util-toggle .neuroege-screen-annotate__chrome--header .neuroege-screen-annotate__activator:hover {
  background: rgba(245, 252, 249, 0.98);
}

.hf-header-util-toggle .neuroege-screen-annotate__chrome--header.neuroege-screen-annotate__chrome--open .neuroege-screen-annotate__activator {
  background: rgba(5, 184, 125, 0.22);
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  transform: none;
}

[data-theme="light"] .hf-header-util-toggle .neuroege-screen-annotate__chrome--header.neuroege-screen-annotate__chrome--open .neuroege-screen-annotate__activator {
  background: rgba(5, 184, 125, 0.14);
}

.neuroege-screen-annotate__chrome > * {
  pointer-events: auto;
}

.neuroege-screen-annotate__activator {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 2.5rem;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 2px solid rgba(5, 184, 125, 0.65);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(48, 54, 66, 0.98) 0%, rgba(32, 38, 48, 0.98) 100%);
  color: #ecfdf5;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.4),
    0 0 18px rgba(5, 184, 125, 0.25),
    0 1px 0 rgba(255, 255, 255, 0.1) inset;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.18s ease,
    opacity 0.18s ease,
    visibility 0.18s ease;
}

.neuroege-screen-annotate__activator-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.neuroege-screen-annotate__activator:hover {
  border-color: rgba(5, 184, 125, 0.75);
  box-shadow: 0 4px 16px rgba(5, 184, 125, 0.22);
  transform: translateY(-1px);
}

.neuroege-screen-annotate__activator:focus-visible {
  outline: 2px solid var(--green, #05b87d);
  outline-offset: 2px;
}

.neuroege-screen-annotate__chrome--open .neuroege-screen-annotate__activator {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.92);
}

.neuroege-screen-annotate__toolbar {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 3;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.45rem;
  border-radius: 999px;
  border: 2px solid rgba(5, 184, 125, 0.5);
  background: linear-gradient(
    165deg,
    rgba(18, 24, 30, 0.96) 0%,
    rgba(12, 16, 22, 0.98) 100%
  );
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.45),
    0 0 24px rgba(5, 184, 125, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px) scale(0.94);
  transition:
    opacity 0.24s ease,
    transform 0.24s cubic-bezier(0.34, 1.25, 0.64, 1),
    visibility 0.24s ease;
}

.neuroege-screen-annotate__chrome--open .neuroege-screen-annotate__toolbar {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.neuroege-screen-annotate__tool {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease;
}

.neuroege-screen-annotate__tool:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.neuroege-screen-annotate__tool:focus-visible {
  outline: 2px solid var(--green, #05b87d);
  outline-offset: 1px;
}

.neuroege-screen-annotate__tool--active {
  border-color: rgba(5, 184, 125, 0.55);
  background: rgba(5, 184, 125, 0.22);
  color: #ecfdf5;
}

.neuroege-screen-annotate__tool--laser.neuroege-screen-annotate__tool--active {
  border-color: rgba(255, 59, 59, 0.55);
  background: rgba(255, 59, 59, 0.2);
  color: #ffe4e6;
}

.neuroege-screen-annotate__tool svg {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
}

.neuroege-screen-annotate__tool--navigate {
  width: 2.45rem;
  height: 2.45rem;
}

.neuroege-screen-annotate__tool--navigate svg {
  width: 1.45rem;
  height: 1.45rem;
}

.neuroege-screen-annotate__sep {
  flex: 0 0 1px;
  align-self: center;
  width: 1px;
  height: 1.25rem;
  background: rgba(255, 255, 255, 0.16);
}

[data-theme="light"] .neuroege-screen-annotate__activator {
  border-color: rgba(5, 150, 105, 0.55);
  background: linear-gradient(180deg, #ffffff 0%, #f3f4f6 100%);
  color: #047857;
  box-shadow:
    0 2px 10px rgba(15, 23, 42, 0.12),
    0 0 16px rgba(5, 184, 125, 0.15);
}

[data-theme="light"] .neuroege-screen-annotate__toolbar {
  border-color: rgba(5, 150, 105, 0.28);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.92) 100%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .neuroege-screen-annotate__tool {
  color: #334155;
}

[data-theme="light"] .neuroege-screen-annotate__tool:hover {
  background: rgba(5, 184, 125, 0.1);
}

[data-theme="light"] .neuroege-screen-annotate__tool--active {
  color: #047857;
}

[data-theme="light"] .neuroege-screen-annotate__tool--laser.neuroege-screen-annotate__tool--active {
  color: #b91c1c;
  background: rgba(254, 202, 202, 0.65);
  border-color: rgba(239, 68, 68, 0.45);
}

[data-theme="light"] .neuroege-screen-annotate__sep {
  background: rgba(0, 0, 0, 0.1);
}
