/* Полноэкранная модалка */
#image-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 10, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    overflow: hidden;
}

/* Кнопка закрытия */
#image-viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 24px;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    z-index: 100000;
    transition: background 0.2s;
}
#image-viewer-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Главный контейнер для просмотра */
#image-viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
}
#image-viewer-container:active {
    cursor: grabbing;
}

/* Обертка для синхронизации картинки и холста */
#image-viewer-wrapper {
    position: relative;
    display: inline-block;
    transform-origin: center center;
    will-change: transform;
    line-height: 0; /* Фикс лишних отступов снизу у картинки */
}

#image-viewer-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

/* Холст строго поверх картинки */
#image-viewer-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 10;
}



#image-viewer-canvas.custom-cursor {
    cursor: none;
}
/* Создаем виртуальный круглый курсор, который будет бегать за мышкой */
#brush-cursor-follower {
    position: fixed;
    pointer-events: none; /* Критично: чтобы не мешать кликам */
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 100005; 
    display: none;
    background: transparent; /* Убеждаемся, что внутри пусто */
    box-sizing: border-box;  /* Защита размера */
}




/* Нижняя панель управления */
#viewer-paint-panel {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: #1e1e1e;
    padding: 12px 24px;
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 100000; /* Выше холста и контейнера */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    color: #fff;
    font-family: system-ui, -apple-system, sans-serif;
}

/* Элементы панели */
.paint-tool {
    background: #2a2a2a;
    border: 1px solid #444;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}
.paint-tool.active {
    background: #007bff;
    border-color: #007bff;
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
}
.paint-tool:hover {
    border-color: #666;
}
.paint-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
}
#paint-color {
    border: none;
    background: transparent;
    width: 35px;
    height: 35px;
    cursor: pointer;
    padding: 0;
}
#paint-size {
    width: 100px;
    cursor: pointer;
}
#paint-size-val {
    font-size: 14px;
    min-width: 45px;
    text-align: center;
}
#paint-btn-clear {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #ff4757;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
#paint-btn-clear:hover {
    background: rgba(255, 71, 87, 0.1);
}
.paint-save-btn {
    background: #2ed573;
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}
.paint-save-btn:hover {
    background: #26af5f;
}
