* {
    margin: 0;
    padding: 0;
    touch-action: none;
  }

  body,
  html {
    height: 100%;
    width: 100%;
    overflow: hidden;
  }
  #canvas {
    height: 100%;
    touch-action: none;
  }
  canvas[resize] {
    width: 100%;
    height: 100%;
  }

.board-loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100500;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 320ms ease, visibility 320ms ease;
  background:
    radial-gradient(1200px 700px at 20% 10%, rgba(58, 115, 255, 0.2), transparent 68%),
    radial-gradient(1000px 650px at 80% 85%, rgba(56, 189, 248, 0.16), transparent 70%),
    linear-gradient(140deg, #f4f7ff 0%, #e8eefc 52%, #dce6fb 100%);
}

.board-loading-screen.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.board-loading-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.board-loading-screen__glow {
  position: absolute;
  width: min(82vw, 980px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(43, 108, 255, 0.24) 0%, rgba(43, 108, 255, 0) 65%);
  filter: blur(24px);
  animation: boardLoadingOrb 6s ease-in-out infinite;
}

.board-loading-card {
  position: relative;
  width: min(92vw, 620px);
  border-radius: 22px;
  padding: 30px;
  color: #22304c;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 70px rgba(26, 44, 85, 0.2);
  backdrop-filter: blur(6px);
}

.board-loading-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(43, 108, 255, 0.12);
  color: #3159d7;
}

.board-loading-title {
  margin: 0;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.08;
}

.board-loading-status {
  margin: 8px 0 16px;
  min-height: 1.5em;
  font-size: clamp(14px, 2.2vw, 16px);
  color: #4c5e82;
}

.board-loading-status.is-error {
  color: #d32f2f;
  font-weight: 500;
  text-align: center;
}

.board-loading-retry-btn {
  display: block;
  width: max-content;
  margin: 12px auto 0;
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  background: #2f59dd;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 160ms ease, transform 120ms ease;
}

.board-loading-retry-btn:hover {
  background: #2549b8;
}

.board-loading-retry-btn:active {
  transform: scale(0.98);
}

.board-loading-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(49, 89, 215, 0.18);
}

.board-loading-track-bar {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f59dd 0%, #1ea6f0 100%);
  background-size: 180% 100%;
  animation: boardLoadingTrackShine 3.2s linear infinite;
  transition: width 320ms ease;
}

.board-loading-progress-row {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.board-loading-progress-label {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6e81a9;
}

.board-loading-percent {
  font-size: 15px;
  font-weight: 700;
  color: #2f59dd;
}

.board-loading-tip {
  margin-top: 18px;
  border-radius: 16px;
  background: rgba(247, 250, 255, 0.9);
  border: 1px solid rgba(42, 80, 196, 0.15);
  padding: 14px 14px 12px;
}

.board-loading-tip-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #5e73a0;
}

.board-loading-tip-category {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(47, 89, 221, 0.12);
  color: #2f59dd;
  padding: 3px 10px;
  min-height: 24px;
}

.board-loading-categories {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.board-loading-category-chip {
  border: 1px solid rgba(47, 89, 221, 0.22);
  background: rgba(47, 89, 221, 0.05);
  color: #5d72a0;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.board-loading-category-chip:hover {
  border-color: rgba(47, 89, 221, 0.36);
  background: rgba(47, 89, 221, 0.12);
  color: #395cbf;
}

.board-loading-category-chip.is-active {
  border-color: rgba(47, 89, 221, 0.55);
  background: rgba(47, 89, 221, 0.18);
  color: #2f59dd;
}

.board-loading-tip-text {
  margin: 10px 0 0;
  height: 68px;
  overflow: hidden;
  font-size: 16px;
  line-height: 1.4;
  color: #31466f;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 260ms ease, transform 260ms ease;
}

/* Стартовый режим: показываем полный список подсказок до инициализации карусели. */
.board-loading-tip-text.is-tip-visible {
  opacity: 1;
  transform: translateY(0);
}

.board-loading-tip-controls {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.board-loading-tip-nav {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(47, 89, 221, 0.26);
  border-radius: 10px;
  background: rgba(47, 89, 221, 0.08);
  color: #2f59dd;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.board-loading-tip-nav:hover {
  background: rgba(47, 89, 221, 0.16);
  border-color: rgba(47, 89, 221, 0.45);
}

.board-loading-tip-nav:active {
  transform: scale(0.96);
}

.board-loading-tip-position {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5f739d;
}

@keyframes boardLoadingTrackShine {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 180% 50%;
  }
}

@keyframes boardLoadingOrb {
  0% {
    transform: translate3d(-2%, -1%, 0) scale(0.98);
  }
  50% {
    transform: translate3d(2%, 1.5%, 0) scale(1.02);
  }
  100% {
    transform: translate3d(-2%, -1%, 0) scale(0.98);
  }
}

@media (max-width: 640px) {
  .board-loading-card {
    padding: 22px;
    border-radius: 18px;
  }

  .board-loading-tip {
    padding: 12px;
  }
}

#cursor-indicators-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
  overflow: hidden;
}

.cursor-indicator {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
  flex-direction: row;
}

.cursor-indicator[data-side="left"] {
  transform: translate(0, -50%);
}
.cursor-indicator[data-side="right"] {
  transform: translate(-100%, -50%);
}
.cursor-indicator[data-side="top"] {
  transform: translate(-50%, 0);
}
.cursor-indicator[data-side="bottom"] {
  transform: translate(-50%, -100%);
}

.cursor-indicator[data-side="top"],
.cursor-indicator[data-side="bottom"] {
  flex-direction: column;
  gap: 3px;
}

.cursor-indicator-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
  transition: transform 120ms ease, opacity 160ms ease;
}

.cursor-indicator:hover .cursor-indicator-dot {
  transform: scale(1.15);
}

.cursor-indicator-name {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.65);
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Позиционирование имени в зависимости от стороны */
.cursor-indicator[data-side="left"] .cursor-indicator-name {
  order: 1;
}

.cursor-indicator[data-side="right"] .cursor-indicator-name {
  order: -1;
}

.cursor-indicator[data-side="top"] .cursor-indicator-name {
  order: 1;
}

.cursor-indicator[data-side="bottom"] .cursor-indicator-name {
  order: -1;
}

/* Бейдж в режиме «у курсора»: якорь — topLeft, точка скрыта (pointer-events задаётся из JS) */
.cursor-indicator[data-side="cursor"] {
  transform: none;
}

.cursor-indicator[data-side="cursor"] .cursor-indicator-dot {
  transform: scale(0.4);
  opacity: 0;
}

/* Контекстное меню настройки звука пользователя */
.user-audio-context-menu {
  position: fixed !important;
  z-index: 10060 !important;
  min-width: 220px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  background: #fff;
  overflow: hidden;
  font-family: inherit;
}

.user-audio-context-header {
  padding: 10px 14px;
  font-weight: 600;
  font-size: 14px;
  color: #1f2937;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-audio-context-body {
  padding: 12px 14px;
}

.user-audio-volume-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-audio-mute-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  background: #f8f9fa;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.user-audio-mute-btn:hover {
  background: #e9ecef;
  border-color: rgba(0, 0, 0, 0.18);
}

.user-audio-mute-btn.is-muted {
  background: #fee2e2;
  border-color: #ef4444;
  color: #ef4444;
}

.user-audio-mute-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.user-audio-slider-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.user-audio-slider {
  width: 100%;
  height: 16px;
  border-radius: 8px;
  background: transparent;
  margin: 0;
  padding: 0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.user-audio-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  margin: 6px 0;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    #355dff 0%,
    #355dff var(--value, 50%),
    #e5e7eb var(--value, 50%),
    #e5e7eb 100%
  );
}

.user-audio-slider::-moz-range-track {
  width: 100%;
  height: 4px;
  margin: 6px 0;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    #355dff 0%,
    #355dff var(--value, 50%),
    #e5e7eb var(--value, 50%),
    #e5e7eb 100%
  );
}

.user-audio-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: #355dff;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.user-audio-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #355dff;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.user-audio-volume-label {
  flex: 0 0 44px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
}

.user-audio-noise-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.user-audio-noise-icon {
  flex: 0 0 32px;
  text-align: center;
  font-size: 14px;
  color: #64748b;
}

.user-audio-slider:disabled {
  cursor: default;
  opacity: 0.45;
}

.user-audio-noise-hint {
  margin-top: 6px;
  font-size: 11px;
  color: #94a3b8;
}

/* Кнопка follow-режима в меню аватарки (только владелец доски) */
.user-audio-follow-btn {
  width: 100%;
  margin-top: 10px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(53, 93, 255, 0.35);
  border-radius: 8px;
  background: rgba(53, 93, 255, 0.08);
  color: #355dff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.user-audio-follow-btn:hover {
  background: rgba(53, 93, 255, 0.16);
}

.user-audio-follow-btn.is-active {
  background: #355dff;
  border-color: #355dff;
  color: #fff;
}

/* Индикатор локального мьюта на аватарке пользователя */
.user-audio-muted-badge {
  position: absolute;
  bottom: -6px;
  right: -6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--timer-bg, rgba(0,0,0,0.45));
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  z-index: 3;
}

.user-audio-muted-badge svg {
  width: 18px;
  height: 18px;
}

.my-avatar-action-trigger,
.user-avatar-action-trigger {
  position: relative;
}

/* ===== Тёмная тема прелоадера доски ===== */
html[data-board-theme="dark"] .board-loading-screen {
  background:
    radial-gradient(1200px 700px at 20% 10%, rgba(59, 130, 246, 0.18), transparent 68%),
    radial-gradient(1000px 650px at 80% 85%, rgba(14, 165, 233, 0.12), transparent 70%),
    linear-gradient(140deg, #0b1020 0%, #0e1425 52%, #121a2e 100%);
}

html[data-board-theme="dark"] .board-loading-screen__glow {
  background: radial-gradient(circle, rgba(96, 165, 250, 0.18) 0%, rgba(96, 165, 250, 0) 65%);
}

html[data-board-theme="dark"] .board-loading-card {
  color: #eef3ff;
  background: rgba(16, 24, 42, 0.78);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

html[data-board-theme="dark"] .board-loading-brand {
  background: rgba(59, 130, 246, 0.14);
  color: #7ab3ff;
}

html[data-board-theme="dark"] .board-loading-status {
  color: #9fb0d6;
}

html[data-board-theme="dark"] .board-loading-status.is-error {
  color: #ff7b7b;
}

html[data-board-theme="dark"] .board-loading-retry-btn {
  background: #3b82f6;
}

html[data-board-theme="dark"] .board-loading-retry-btn:hover {
  background: #2563eb;
}

html[data-board-theme="dark"] .board-loading-track {
  background: rgba(156, 189, 255, 0.18);
}

html[data-board-theme="dark"] .board-loading-track-bar {
  background-image: linear-gradient(90deg, #3b82f6 0%, #38bdf8 100%);
}

html[data-board-theme="dark"] .board-loading-progress-label {
  color: #7b8eb8;
}

html[data-board-theme="dark"] .board-loading-percent {
  color: #60a5fa;
}

html[data-board-theme="dark"] .board-loading-tip {
  background: rgba(18, 27, 48, 0.9);
  border-color: rgba(122, 179, 255, 0.15);
}

html[data-board-theme="dark"] .board-loading-tip-head {
  color: #7b8eb8;
}

html[data-board-theme="dark"] .board-loading-tip-category {
  background: rgba(59, 130, 246, 0.12);
  color: #7ab3ff;
}

html[data-board-theme="dark"] .board-loading-category-chip {
  border-color: rgba(122, 179, 255, 0.22);
  background: rgba(59, 130, 246, 0.05);
  color: #9fb0d6;
}

html[data-board-theme="dark"] .board-loading-category-chip:hover {
  border-color: rgba(122, 179, 255, 0.36);
  background: rgba(59, 130, 246, 0.12);
  color: #7ab3ff;
}

html[data-board-theme="dark"] .board-loading-category-chip.is-active {
  border-color: rgba(122, 179, 255, 0.55);
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
}

html[data-board-theme="dark"] .board-loading-tip-text {
  color: #c8d4f0;
}

html[data-board-theme="dark"] .board-loading-tip-nav {
  border-color: rgba(122, 179, 255, 0.26);
  background: rgba(59, 130, 246, 0.08);
  color: #7ab3ff;
}

html[data-board-theme="dark"] .board-loading-tip-nav:hover {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(122, 179, 255, 0.45);
}

html[data-board-theme="dark"] .board-loading-tip-position {
  color: #7b8eb8;
}