.fixed-left {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    width: 100px;
 }

 .fixed-left .btn {
    margin: 10px 0;
 }
 .settings-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
 }

#userBar {
    display: inline-flex;
    align-items: center;
}

 .copylink-button {
    margin-right: 8px;
    width: 44px;
    height: 44px;
    padding: 0 !important;
    border-radius: 50% !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--timer-bg, rgba(0,0,0,0.16)) !important;
    border: none !important;
    color: #ffffff;
    -webkit-tap-highlight-color: transparent;
    transition: transform 150ms ease, box-shadow 150ms ease;
 }

.copylink-button:hover,
.copylink-button:focus,
.copylink-button:active {
    background: var(--timer-bg, rgba(0,0,0,0.16)) !important;
    border: none !important;
    color: #ffffff;
    box-shadow: none !important;
}

.copylink-button:active {
    transform: scale(1.06);
}

.copylink-button i {
    line-height: 1;
 }

.my-avatar-action-trigger,
.user-avatar-action-trigger {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.my-avatar-action-trigger .rounded-circle,
.user-avatar-action-trigger .rounded-circle {
    margin: 0 !important;
}

.my-avatar-action-overlay,
.user-avatar-action-overlay {
    position: absolute;
    inset: 0;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 24, 39, 0.62);
    color: #ffffff;
    padding: 0;
    opacity: 0;
    transform: scale(0.76);
    pointer-events: none;
    transition: opacity 190ms ease, transform 190ms ease;
}

.my-avatar-action-overlay svg,
.user-avatar-action-overlay svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.1;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.user-avatar-action-overlay svg circle {
    fill: currentColor;
    stroke: none;
}

@media (hover: hover) and (pointer: fine) {
    .my-avatar-action-trigger:hover .my-avatar-action-overlay,
    .my-avatar-action-trigger:focus-visible .my-avatar-action-overlay,
    .user-avatar-action-trigger:hover .user-avatar-action-overlay,
    .user-avatar-action-trigger:focus-visible .user-avatar-action-overlay {
        opacity: 1;
        transform: scale(1);
        pointer-events: auto;
    }
}

.my-avatar-action-trigger.is-tap-armed .my-avatar-action-overlay,
.user-avatar-action-trigger.is-tap-armed .user-avatar-action-overlay {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.my-avatar-action-trigger:active .my-avatar-action-overlay,
.user-avatar-action-trigger:active .user-avatar-action-overlay {
    transform: scale(1.04);
}

 .btn-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2px;
}
.dropdown-menu{
    background-color: #E6E6FA;
}
.dropdown-header{
    color: black;
    text-align: left;
}
.btn-image {
    position: fixed;
    top: 0px;
    left: 0px;
    margin: 15px;
    background-image: url('64.png') ;
    background-size: contain;
    width: 64px; /* Ширина кнопки. Подгоните под ваше изображение. */
    height: 64px; /* Высота кнопки. Подгоните под ваше изображение. */
    border: none; /* Убираем рамку вокруг кнопки */
    cursor: pointer; /* Курсор при наведении */
    outline: none;
  }
  
.btn-image:hover {
    filter: brightness(0.8); /* Эффект при наведении, опционально */
}
.btn:focus,
.btn:active:focus {
  outline: 0;
    box-shadow: none;
}

/* Все кнопки инструментов слегка уводим влево, но оставляем полностью кликабельными. */
#toolContainer .btn {
    transform: translateX(-9px);
        transition: transform 140ms ease, filter 120ms ease;
}

/* Внутри выпадающих меню палитры не применяем сдвиг, иначе сетка цветов уезжает влево. */
#toolContainer .dropdown-menu .btn {
    transform: none;
}

#toolContainer .shape-toolbar-menu {
    min-width: 420px;
    max-width: min(86vw, 520px);
    max-height: min(72vh, 520px);
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 12px;
    background: linear-gradient(180deg, #f7f8fb 0%, #eef2f9 100%);
}

.shape-toolbar-layout {
    display: grid;
    grid-template-columns: 168px 1fr;
    gap: 0;
    min-height: 280px;
}

.shape-toolbar-types {
    border-right: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255, 255, 255, 0.6);
    padding: 8px;
    overflow: auto;
}

.shape-toolbar-type-btn {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 10px;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    padding: 8px 10px;
    color: #1f2937;
    background: transparent;
    transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.shape-toolbar-type-btn .premium-lock-indicator {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 10px;
    color: #9a5f00;
    background: #ffe7b8;
    border: 1px solid #ffc56f;
    flex-shrink: 0;
}

.shape-toolbar-type-btn.active .premium-lock-indicator {
    color: #9a5f00;
    background: #ffe2ab;
    border-color: #f4b85f;
}

.shape-toolbar-type-btn.is-locked .premium-lock-indicator {
    color: #9a5f00;
    background: #ffe7b8;
    border-color: #ffc56f;
    filter: saturate(0.75);
}

.shape-toolbar-type-btn:hover {
    background: rgba(43, 108, 255, 0.08);
    border-color: rgba(43, 108, 255, 0.2);
}

.shape-toolbar-type-btn.active {
    background: rgba(43, 108, 255, 0.16);
    border-color: rgba(43, 108, 255, 0.35);
    color: #0f172a;
    transform: translateX(2px);
}

.shape-toolbar-type-btn.is-locked {
    opacity: 0.65;
}

.shape-toolbar-shapes {
    padding: 10px;
    overflow: auto;
}

.shape-toolbar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(106px, 1fr));
    gap: 8px;
}

.shape-toolbar-item {
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 10px;
    background: #ffffff;
    color: #111827;
    padding: 8px;
    min-height: 94px;
    display: grid;
    grid-template-rows: 48px auto;
    align-items: center;
    justify-items: center;
    transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.shape-toolbar-item:hover {
    transform: translateY(-1px);
    border-color: rgba(43, 108, 255, 0.35);
    box-shadow: 0 8px 18px rgba(43, 108, 255, 0.12);
}

.shape-toolbar-item.is-locked {
    opacity: 0.62;
}

.shape-toolbar-item svg {
    width: 46px;
    height: 46px;
}

.shape-toolbar-item-label {
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
}

.shape-toolbar-empty {
    margin: 8px;
    padding: 10px;
    border-radius: 10px;
    color: #6b7280;
    text-align: center;
    background: rgba(255, 255, 255, 0.75);
}

@media (max-width: 768px) {
    #toolContainer .shape-toolbar-menu {
        min-width: min(92vw, 420px);
        max-width: min(92vw, 420px);
    }

    .shape-toolbar-layout {
        grid-template-columns: 142px 1fr;
        min-height: 250px;
    }

    .shape-toolbar-grid {
        grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
    }
}

/* Кнопки буфера действий (назад/вперёд) выравниваем с инструментами. */
.fixed-left > .btn-group-vertical:not(#toolContainer) .btn {
    transform: translateX(-9px);
}

/* Явное выделение текущего инструмента (без белой рамки, независимо от focus). */
#toolContainer .btn.tool-selected {
    box-shadow: none;
    /* Активный инструмент остаётся у края экрана, остальные уходят левее. */
    transform: translateX(0) scale(1.07);
}

#toolContainer .btn.tool-selected i,
#toolContainer .btn.tool-selected svg {
    filter: drop-shadow(0 0 0.25rem rgba(255, 255, 255, 0.9));
}

#changeToEraser:focus{
    box-shadow: 0 0 0 0.25rem rgba(147, 155, 164, 0.5);
}
#goBack:focus{
    box-shadow: 0 0 0 0.25rem rgba(255, 40, 40, 0.5);
}
#goForward:focus{
    box-shadow: 0 0 0 0.25rem rgba(16, 136, 26, 0.5);
}
.custom-range {
    width: 160px; 
  }
/* Анимации для кнопки настроек (шестерёнки) */
.settings-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    /* чтобы масштаб при клике выглядел плавно */
    transition: transform 150ms ease, box-shadow 150ms ease;
}
.settings-button:focus {
    outline: none;
}
.settings-button i {
    display: inline-block;
    /* центр трансформации для аккуратного вращения */
    transform-origin: 50% 50%;
}

/* медленная непрерывная прокрутка при наведении */
.settings-button:hover i {
    animation: spin-slow 6s linear infinite;
}

/* быстрый оборот и лёгкое увеличение при нажатии */
.settings-button:active i {
    /* При клике не прерываем медленную анимацию, чтобы не было рывка */
    animation: spin-slow 6s linear infinite;
}
.settings-button:active {
    transform: scale(1.06);
}

/* Ключевые кадры: медленный бесконечный спин и быстрый одноразовый */
@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
/* Прежний быстрый keyframes удалён (не используется) */

/* Если дропдаун открыт — держим медленный спин вне зависимости от hover */
.settings-button.open-dropdown i {
    animation: spin-slow 6s linear infinite;
}

/* DOM-хэндл поворота выделенной группы поверх canvas. */
.board-rotate-handle {
    position: absolute;
    z-index: 990;
    display: none;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    padding: 0;
    font-size: 0 !important;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    background: var(--timer-bg, rgba(0,0,0,0.24)) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
}

.board-rotate-handle::before {
    content: '↺';
    position: absolute;
    left: 50%;
    top: 50%;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    transform: translate(-46%, -58%);
}

.board-rotate-handle:hover,
.board-rotate-handle:focus,
.board-rotate-handle:active {
    background: var(--timer-bg, rgba(0,0,0,0.24)) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
}

/* DOM-хэндл удаления выделенной группы поверх canvas. */
.board-delete-handle {
    position: absolute;
    z-index: 990;
    display: none;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    padding: 0;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    font-size: 0;
    background: rgba(220, 53, 69, 0.76) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
}

.board-delete-handle:hover,
.board-delete-handle:focus,
.board-delete-handle:active {
    background: rgba(220, 53, 69, 0.76) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
}

.board-delete-handle::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 22px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 1);
    opacity: 1 !important;
    transform: translate(-50%, -50%) rotate(45deg);
}

.board-delete-handle::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 22px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 1);
    opacity: 1 !important;
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* DOM-кнопки +/- для изменения размерности системы координат. */
.board-coord-size-handle {
    position: absolute;
    z-index: 990;
    display: none;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    padding: 0;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    font-size: 22px;
    font-weight: 700;
    border: none !important;
    box-shadow: none !important;
}

.board-coord-size-plus,
.board-coord-size-minus {
    background: var(--timer-bg, rgba(0,0,0,0.24)) !important;
    color: #ffffff !important;
}

.board-coord-size-handle:hover,
.board-coord-size-handle:focus,
.board-coord-size-handle:active {
    color: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
}

.board-coord-size-plus:hover,
.board-coord-size-plus:focus,
.board-coord-size-plus:active,
.board-coord-size-minus:hover,
.board-coord-size-minus:focus,
.board-coord-size-minus:active {
    background: var(--timer-bg, rgba(0,0,0,0.24)) !important;
}

.board-coord-size-handle:disabled {
    opacity: 0.45;
    cursor: default;
}

/* DOM-слайдер толщины линий для выделенной группы. */
.board-group-stroke-slider {
    position: absolute;
    z-index: 990;
    display: none;
    width: 130px;
    height: 14px;
    transform: translate(-50%, -50%);
    background: transparent !important;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    border: none;
    outline: none;
    --slider-progress: 50%;
    -webkit-appearance: none;
    appearance: none;
}

.board-group-stroke-slider:focus,
.board-group-stroke-slider:active {
    outline: none;
    box-shadow: none;
    border: none;
}

.board-group-stroke-slider::-webkit-slider-runnable-track {
    background: linear-gradient(
        to right,
        #0d6efd 0,
        #0d6efd var(--slider-progress),
        rgba(128, 128, 128, 0.75) var(--slider-progress),
        rgba(128, 128, 128, 0.75) 100%
    );
    height: 6px;
    border-radius: 999px;
    border: none;
    box-shadow: none;
}

.board-group-stroke-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #0d6efd !important;
    border: none !important;
    margin-top: -4px;
    box-shadow: none;
}

.board-group-stroke-slider::-moz-range-track {
    background: rgba(128, 128, 128, 0.75);
    height: 6px;
    border-radius: 999px;
    border: none;
    box-shadow: none;
}

.board-group-stroke-slider::-moz-range-progress {
    background: #0d6efd;
    height: 6px;
    border-radius: 999px;
    border: none;
    box-shadow: none;
}

.board-group-stroke-slider::-moz-range-thumb {
    -moz-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #0d6efd !important;
    border: none !important;
    box-shadow: none;
}
